.org {
	--org-navy: #0b2a4a;
	--org-green: #1e9e57;
	--org-text: #1a1a1a;
	--org-muted: #5c667d;
	--org-line: #e3e8ef;
	--org-wire: #b8c4d3;
	--org-soft: #f4f6f9;
	--org-focus: #1a73e8;
	--org-radius: 12px;
	--org-cgap: clamp(32px, 5vw, 72px);  /* ustunlar orasi */
	--org-rail: 26px;                     /* yon chiziq uchun joy */
	--org-ugap: 10px;                     /* kartochkalar orasi */
	--org-tick: 26px;                     /* ulovchi chiziq balandligi (kartochka boshidan) */
	color: var(--org-text);
	overflow-wrap: anywhere;
}
.org *, .org *::before, .org *::after { box-sizing: border-box; }
.org ul { margin: 0; padding: 0; list-style: none; }
.org li { margin: 0; padding: 0; }
.org a:focus-visible, .org button:focus-visible { outline: 2px solid var(--org-focus); outline-offset: 2px; }
.org .org-sr {
	position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Sarlavha ---------- */
.org .org-head {
	display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
	gap: 14px 24px; margin-bottom: clamp(22px, 2.6vw, 34px);
}
.org .org-head__text { flex: 1 1 420px; min-width: 0; }
.org .org-title { margin: 0 0 6px; color: var(--org-navy); font-size: clamp(24px, 2.2vw + 14px, 32px); font-weight: 800; line-height: 1.2; }
.org .org-lead { margin: 0 0 12px; color: var(--org-muted); font-size: 16px; line-height: 1.5; }
.org .org-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.org .org-facts li { padding: 4px 12px; border-radius: 999px; background: var(--org-soft); color: var(--org-muted); font-size: 13px; font-weight: 600; }
.org .org-facts b { color: var(--org-green); font-size: 15px; font-weight: 800; }

.org .org-tools { display: flex; flex-wrap: wrap; gap: 8px; }
/* :not(#org-x) — mavzuning umumiy button stilini (yashil fon) !important'siz bekor qiladi */
.org .org-link,
.org .org-toggle:not(#org-x) {
	display: inline-flex; align-items: center; justify-content: center; min-height: 38px; height: auto; margin: 0;
	padding: 6px 16px; border: 1px solid var(--org-line); border-radius: 999px; background: #fff;
	color: var(--org-navy); font: inherit; font-size: 13px; font-weight: 700; line-height: 1.25;
	text-decoration: none; white-space: normal; box-shadow: none; cursor: pointer;
	transition: border-color .15s, color .15s;
}
.org .org-link:hover, .org .org-toggle:not(#org-x):hover { border-color: var(--org-green); background: #fff; color: var(--org-green); }
.org .org-toggle:not(#org-x) { border-color: var(--org-navy); }
.org .org-toggle[hidden] { display: none; }

/* ---------- Tugunlar ---------- */
.org .org-node {
	position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
	min-height: 56px; padding: 12px 16px; border: 2px solid var(--org-navy); border-radius: var(--org-radius);
	background: #fff; color: var(--org-navy); text-align: center;
}
.org .org-node__role { font-size: 15px; font-weight: 700; line-height: 1.3; }
.org .org-node__icon {
	display: flex; flex: 0 0 34px; align-items: center; justify-content: center; height: 34px;
	border-radius: 9px; background: var(--org-soft); font-size: 15px;
}
.org .org-node--dir { background: var(--org-navy); color: #fff; box-shadow: 0 6px 18px rgba(11, 42, 74, .16); }
.org .org-node--dir .org-node__icon { background: rgba(255, 255, 255, .14); }
.org .org-node--dir .org-node__role { font-size: 17px; font-weight: 800; }
.org .org-node--side { border-width: 1px; border-color: var(--org-wire); }
.org .org-node--council { border: 1px dashed var(--org-muted); background: #fafbfc; color: var(--org-muted); }

/* ---------- Yuqori qator: kengash ┄ direktor — kotib ---------- */
.org .org-top {
	position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
	align-items: center; gap: 0 36px; padding-bottom: 28px;
}
.org .org-node--council { grid-column: 1; grid-row: 1; }
.org .org-node--dir { grid-column: 2; grid-row: 1; }
.org .org-node--side { grid-column: 3; grid-row: 1; }
.org .org-node--council::after, .org .org-node--side::after {
	content: ""; position: absolute; top: 50%; width: 36px; height: 0;
}
.org .org-node--council::after { left: 100%; border-top: 2px dashed var(--org-wire); }
.org .org-node--side::after { right: 100%; border-top: 2px solid var(--org-wire); }
.org .org-top::after { /* direktordan pastga */
	content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 28px;
	margin-left: -1px; background: var(--org-wire);
}

/* ---------- Ikki ustun ---------- */
.org .org-cols {
	position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 var(--org-cgap); padding-top: 26px;
}
.org .org-cols::before { /* shina: oʻrinbosar markazidan oʻng ustun chizigʻigacha */
	content: ""; position: absolute; top: 0; height: 2px; background: var(--org-wire);
	left: calc((100% - var(--org-cgap)) / 4);
	right: calc(var(--org-rail) / 2 - 1px);
}
.org .org-col { position: relative; min-width: 0; }
.org .org-node--dep { margin-bottom: var(--org-ugap); }
.org .org-node--dep::before { /* shinadan oʻrinbosarga */
	content: ""; position: absolute; left: 50%; bottom: 100%; width: 2px; height: 28px;
	margin: 0 0 0 -1px; background: var(--org-wire);
}

.org .org-units { display: grid; gap: var(--org-ugap); }
.org .org-col--dep .org-units { padding-left: var(--org-rail); }
.org .org-col--dir .org-units { padding-right: var(--org-rail); }

/* ---------- Kartochka ---------- */
.org .org-unit {
	position: relative; border: 1px solid var(--org-line); border-radius: var(--org-radius); background: #fff;
	box-shadow: inset 4px 0 0 var(--c, var(--org-wire)); scroll-margin: 90px;
	transition: border-color .2s, box-shadow .2s;
}
.org .org-unit:hover { border-color: #cfd8e3; box-shadow: inset 4px 0 0 var(--c, var(--org-wire)), 0 6px 16px rgba(11, 42, 74, .06); }
.org .org-unit.is-flash { animation: orgFlash 1.6s ease-out; }
@keyframes orgFlash {
	0%, 35% { border-color: var(--c); box-shadow: inset 4px 0 0 var(--c), 0 0 0 3px rgba(26, 115, 232, .22); }
	100% { border-color: var(--org-line); box-shadow: inset 4px 0 0 var(--c); }
}

/* Ulovchi chiziqlar: ::before — gorizontal, ::after — vertikal */
.org .org-unit::before, .org .org-unit::after { content: ""; position: absolute; }
.org .org-unit::before { top: var(--org-tick); width: calc(var(--org-rail) / 2); height: 2px; background: var(--org-wire); }
.org .org-unit::after { top: calc(-1 * var(--org-ugap) - 1px); bottom: -1px; width: 2px; background: var(--org-wire); }
.org .org-unit:last-child::after { bottom: auto; height: calc(var(--org-tick) + var(--org-ugap) + 3px); }
/* chap ustun: chiziq chapda */
.org .org-col--dep .org-unit::before { right: 100%; margin-right: 1px; }
.org .org-col--dep .org-unit::after { left: calc(-1 * var(--org-rail) / 2 - 2px); }
/* oʻng ustun: chiziq oʻngda, yuqoridan shinaga ulanadi */
.org .org-col--dir .org-unit::before { left: 100%; margin-left: 1px; }
.org .org-col--dir .org-unit::after { right: calc(-1 * var(--org-rail) / 2 - 1px); }
.org .org-col--dir .org-unit:first-child::after { top: -27px; }

.org .org-unit__h { margin: 0; font-size: inherit; font-weight: inherit; line-height: inherit; }
.org .org-unit__btn:not(#org-x) {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
	width: 100%; height: auto; min-height: 54px; margin: 0; padding: 10px 14px 10px 18px; border: 0; border-radius: var(--org-radius);
	background: transparent; color: var(--org-navy); font: inherit; text-align: left;
	white-space: normal; box-shadow: none; cursor: pointer;
}
.org .org-unit__btn:not(#org-x):hover { background: #fafbfc; color: var(--org-navy); }
.org .org-unit__num {
	display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
	border-radius: 8px; background: var(--c); color: #fff; font-size: 14px; font-weight: 800;
}
.org .org-unit__name { font-size: 14px; font-weight: 700; line-height: 1.35; }
.org .org-unit__count { display: inline-flex; align-items: center; gap: 6px; color: var(--org-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.org .org-unit__btn .org-unit__count::after {
	content: ""; width: 7px; height: 7px; margin-left: 2px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg); transition: transform .2s;
}
.org .org-unit__btn[aria-expanded="true"] .org-unit__count::after { transform: translateY(2px) rotate(225deg); }

.org .org-unit__body { padding: 0 14px 12px 18px; }
.org .org-unit__body[hidden] { display: none; }
.org .org-unit__list li {
	display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
	border-top: 1px dashed var(--org-line); font-size: 13px; line-height: 1.35;
}
.org .org-unit__list b { color: var(--org-navy); font-variant-numeric: tabular-nums; }
.org .org-unit__more { display: inline-block; margin-top: 8px; color: var(--org-navy); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.org .org-unit__more:hover { color: var(--org-green); }

/* Alohida lavozim (Bosh buxgalter, Devonxona mudiri) */
.org .org-unit--post {
	--c: var(--org-wire);
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	min-height: 54px; padding: 10px 14px 10px 18px; color: var(--org-navy);
}
.org .org-unit--post .org-unit__name { font-weight: 700; }
/* Shtatdan tashqari (Institut nashrlari) — punktir */
.org .org-unit--aux { border-style: dashed; border-color: var(--org-muted); background: #fafbfc; box-shadow: none; }
.org .org-unit--aux:hover { box-shadow: none; }
.org .org-unit--aux .org-unit__name { color: var(--org-muted); }
.org .org-unit--aux::before { height: 0; background: none; border-top: 2px dashed var(--org-wire); }
.org .org-unit--aux::after { background: none; border-left: 2px dashed var(--org-wire); }

/* ---------- Manba ---------- */
.org .org-source {
	margin: clamp(26px, 2.6vw, 36px) 0 0; padding: 12px 14px; border-radius: 10px;
	background: var(--org-soft); color: var(--org-muted); font-size: 13px; line-height: 1.55;
}

/* ===================== Moslashuvchanlik ===================== */
@media (max-width: 1200px) {
	.org .org-top { gap: 0 28px; }
	.org .org-node--council::after, .org .org-node--side::after { width: 28px; }
}

/* Planshet va telefon: vertikal daraxt, barcha chiziqlar chapda */
@media (max-width: 992px) {
	.org { --org-rail: 22px; }
	.org .org-top { grid-template-columns: minmax(0, 1fr); gap: var(--org-ugap); padding: 0; }
	.org .org-top::after { display: none; }
	.org .org-node--dir, .org .org-node--council, .org .org-node--side { grid-column: 1; grid-row: auto; }
	.org .org-node--council { order: 2; }
	.org .org-node { justify-content: flex-start; text-align: left; }
	.org .org-node--council, .org .org-node--side { margin-left: calc(12px + var(--org-rail)); }
	.org .org-node--council::after, .org .org-node--side::after { right: 100%; left: auto; width: var(--org-rail); }
	.org .org-node--council::before, .org .org-node--side::before {
		content: ""; position: absolute; left: calc(-1 * var(--org-rail) - 2px); top: calc(-1 * var(--org-ugap) - 2px);
		bottom: calc(-1 * var(--org-ugap) - 2px); width: 2px; background: var(--org-wire); /* asosiy tana davom etadi */
	}

	.org .org-cols {
		grid-template-columns: minmax(0, 1fr); gap: var(--org-ugap);
		margin: 0 0 0 12px; padding: calc(var(--org-ugap) * 2) 0 0 var(--org-rail); border-left: 2px solid var(--org-wire);
	}
	.org .org-cols::before { display: none; }
	.org .org-node--dep::before { left: auto; right: 100%; bottom: auto; top: 50%; width: var(--org-rail); height: 2px; margin: 0 2px 0 0; }

	/* oʻrinbosar ostidagi boʻlimlar — ichki chiziq */
	.org .org-col--dep .org-units { margin-left: 12px; }
	/* direktorga bevosita boʻysunuvchilar — asosiy chiziqqa ulanadi */
	.org .org-col--dir .org-units { padding-right: 0; }
	.org .org-col--dir .org-unit::before { left: auto; right: 100%; margin: 0 1px 0 0; width: var(--org-rail); }
	.org .org-col--dir .org-unit::after { display: none; }
}
@media (max-width: 768px) {
	.org .org-head { align-items: flex-start; }
}
@media (max-width: 576px) {
	.org { --org-rail: 16px; }
	.org .org-lead { font-size: 15px; }
	.org .org-tools { width: 100%; }
	.org .org-link, .org .org-toggle:not(#org-x) { flex: 1 1 auto; }
	.org .org-cols { margin-left: 8px; }
	.org .org-node--council, .org .org-node--side { margin-left: calc(8px + var(--org-rail)); }
	.org .org-col--dep .org-units { margin-left: 8px; }
	.org .org-unit__btn:not(#org-x) { grid-template-columns: auto minmax(0, 1fr); padding: 10px 12px 10px 16px; }
	.org .org-unit__btn .org-unit__count { grid-column: 2; }
	.org .org-unit__body { padding: 0 12px 12px 16px; }
	.org .org-unit--post { padding: 10px 12px 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.org .org-link, .org .org-toggle:not(#org-x), .org .org-unit, .org .org-unit__btn .org-unit__count::after { transition: none; }
	.org .org-unit.is-flash { animation: none; }
}
@media print {
	.org .org-tools, .org .org-unit__more, .org .org-unit__btn .org-unit__count::after { display: none; }
	.org .org-unit__body[hidden] { display: block; }
	.org .org-unit { break-inside: avoid; }
	.org .org-node--dir, .org .org-unit__num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
