/* ===== «Ұйымдық құрылым» беті (page-org-structure.php, inc/org-structure.php) =====
   Компьютерде — скандағыдай сызықтары бар схема: басшыдан түскен сызық бағыттардың рамкасына кіреді, бөлімшелер сол жақтағы
   сызыққа ілінеді, институттар рамканың астында. Тар экранда (схема 1100px-тен тар) — бір ортақ сызыққа тізілген ашылатын тізім.
   Сайт палитрасы: қою көк #0A1628, негізгі көк #0052A5, алтын #F5C46B. */

/* ---------- Баннердегі сандар мен «Ресми құжат» ---------- */
.org-hero-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.org-stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); font: 600 12.5px system-ui, -apple-system, "Segoe UI", sans-serif; color: #dbe7f6; }
.org-stat b { font: 900 15px Merriweather, Georgia, serif; color: #F5C46B; font-variant-numeric: tabular-nums; }
.org-doc { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: #fff; color: #0052A5 !important; font: 700 13.5px Merriweather, Georgia, serif; text-decoration: none !important; }
.org-doc:hover { background: linear-gradient(135deg, #f5c46b 0%, #e0a526 100%); color: #2b1900 !important; }
.org-doc svg { width: 16px; height: 16px; flex-shrink: 0; }
.org-doc small { font: 500 11.5px system-ui, sans-serif; opacity: .75; }

/* ---------- Іздеу ---------- */
.org { font-family: Merriweather, Georgia, serif; color: #0A1628; padding-bottom: 56px; }
.org * { box-sizing: border-box; }
.org-tools { border-bottom: 1px solid #e3ebf6; background: #F5F9FF; margin-bottom: 28px; }
.org-tools__in { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding-top: 16px; padding-bottom: 16px; }
.org-search { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; height: 46px; margin: 0; padding: 0 12px; border: 1px solid #cfdcee; border-radius: 11px; background: #fff; }
.org-search:focus-within { border-color: #0052A5; box-shadow: 0 0 0 3px rgba(0,82,165,.12); }
.org-search svg { width: 17px; height: 17px; color: #5a6a80; flex-shrink: 0; }
.org .org-search input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; outline: none; box-shadow: none; background: none; font: 14.5px Merriweather, Georgia, serif; color: #0A1628; }
.org-hits { font: 600 12.5px system-ui, sans-serif; color: #5a6a80; min-width: 9ch; }
.org-legend { display: flex; gap: 14px; flex-wrap: wrap; font: 500 12px system-ui, sans-serif; color: #5a6a80; }
.org-legend span { display: inline-flex; align-items: center; gap: 6px; }
.org-legend i { width: 18px; height: 12px; border-radius: 3px; border: 1.5px solid #9fb3cf; background: #fff; }
.org-legend i.dash { border-style: dashed; }

/* ---------- Схема ---------- */
.org-chart { container: orgchart / inline-size; --ln: #7f97b8; --lw: 2px; position: relative; display: flex; flex-direction: column; }
.org-node { position: relative; border: 1.5px solid #9fb3cf; border-radius: 10px; background: #fff; padding: 9px 12px; font-size: 13px; font-weight: 700; line-height: 1.3; color: #0A1628; }
.org-node small { display: block; margin-top: 2px; font: 500 11px system-ui, sans-serif; color: #5a6a80; }
.org-node.dash { border-style: dashed; background: #F5F9FF; }
.org-node--light { font-size: 12px; font-weight: 600; }

/* Жоғарғы бөлік: кеңес басшының үстінде; кәсіподақ ⇄ басшы → алқалы органдар */
.org-gov { display: grid; grid-template-columns: 1fr minmax(240px, 300px) 1fr; row-gap: 24px; align-items: center; }
.org-g-board { grid-column: 2; grid-row: 1; display: flex; justify-content: center; }
.org-g-board .org-node { min-width: 70%; text-align: center; font-size: 14px; }
.org-g-left { grid-column: 1; grid-row: 2; display: flex; align-items: center; justify-content: flex-end; }
.org-g-left .org-node { max-width: 250px; }
.org-dbl { position: relative; flex: 1 1 40px; min-width: 40px; max-width: 90px; height: var(--lw); margin: 0 8px; background: var(--ln); }
.org-dbl::before, .org-dbl::after { content: ""; position: absolute; top: 50%; transform: translateY(-50%); border: 6px solid transparent; }
.org-dbl::before { left: -8px; border-right: 8px solid var(--ln); border-left: 0; }
.org-dbl::after { right: -8px; border-left: 8px solid var(--ln); border-right: 0; }
.org-g-head { grid-column: 2; grid-row: 2; position: relative; }
.org-g-head::before { content: ""; position: absolute; left: 50%; top: -24px; height: 24px; border-left: var(--lw) solid var(--ln); }
.org-g-head.no-board { grid-row: 1 / span 2; }
.org-g-head.no-board::before { display: none; }
.org-head { text-align: center; padding: 15px 14px; border-radius: 12px; color: #fff; background: linear-gradient(150deg, #0A1628, #0b2f63 60%, #0052A5); box-shadow: 0 16px 34px -18px rgba(10,22,40,.55); }
.org-head b { display: block; font-size: 16px; line-height: 1.3; }
.org-head small { display: block; margin-top: 3px; font: 500 11.5px system-ui, sans-serif; color: #bcd0ec; }
.org-g-right { grid-column: 3; grid-row: 2; display: flex; align-items: center; }
.org-hl { flex: 0 0 28px; height: var(--lw); background: var(--ln); }
.org-side { position: relative; display: flex; flex-direction: column; gap: 12px; padding-left: 18px; }
.org-side .org-node { min-width: 150px; }
.org-side .org-node::before { content: ""; position: absolute; left: -19.5px; top: 50%; width: 18px; border-top: var(--lw) solid var(--ln); }
.org-side .org-node::after { content: ""; position: absolute; left: -19.5px; top: -7.5px; bottom: -7.5px; border-left: var(--lw) solid var(--ln); }
.org-side .org-node:first-child::after { top: 50%; }
.org-side .org-node:last-child::after { bottom: 50%; }
.org-side .org-node:only-child::after { display: none; }

/* Үлкен рамка — бағыттардың ортақ сызығы (скандағыдай) */
.org-frame { position: relative; margin-top: 30px; border: var(--lw) solid var(--ln); border-radius: 14px; padding: 28px 10px 14px; }
.org-frame::before { content: ""; position: absolute; left: 50%; top: -32px; height: 30px; border-left: var(--lw) solid var(--ln); }
.org-cols { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); gap: 10px; align-items: start; }
.org-insts { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 14px; align-items: start; margin-top: 30px; }
.org-col { position: relative; }
.org-col > summary { list-style: none; cursor: pointer; position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1.5px solid #6f88ab; border-radius: 10px; background: #EEF5FF; }
.org-col > summary::-webkit-details-marker { display: none; }
.org-cols > .org-col > summary::before { content: ""; position: absolute; left: 50%; top: -29.5px; height: 28px; border-left: var(--lw) solid var(--ln); }
.org-insts > .org-col > summary::before { content: ""; position: absolute; left: 50%; top: -31.5px; height: 30px; border-left: var(--lw) solid var(--ln); }
.org-insts.no-frame > .org-col > summary::before { display: none; }
.org-ico { flex: 0 0 26px; height: 26px; border-radius: 7px; background: #fff; color: #0052A5; display: grid; place-items: center; border: 1px solid #d6e3f5; }
.org-ico svg { width: 15px; height: 15px; }
.org-ttl { flex: 1; min-width: 0; }
.org-ttl b { display: block; font-size: 12px; line-height: 1.3; font-weight: 700; }
.org-ttl small { display: block; margin-top: 2px; font: 600 10.5px system-ui, sans-serif; color: #5a6a80; }
.org-chev { display: none; flex: none; width: 16px; height: 16px; margin-top: 4px; color: #5a6a80; transition: transform .2s; }
.org-chev svg { width: 16px; height: 16px; }
.org-col[open] .org-chev { transform: rotate(180deg); }
.org-col > summary:focus-visible, .org-doc:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Бөлімшелер сол жақтағы тік сызыққа көлденең тармақпен ілінеді */
.org-units, .org-units ul { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.org-units { margin-left: 12px; padding: 10px 0 0 14px; }
.org-units ul { margin: 6px 0 0 4px; padding: 2px 0 0 14px; }
.org-units li { position: relative; margin: 0; padding: 6px 8px; border: 1.5px solid #9fb3cf; border-radius: 7px; background: #fff; font-size: 11.8px; line-height: 1.35; }
.org-units li::before { content: ""; position: absolute; left: -15.5px; top: -7.5px; bottom: -1.5px; border-left: var(--lw) solid var(--ln); }
.org-units > li:first-child::before { top: -11.5px; }
.org-units ul > li:first-child::before { top: -9.5px; }
.org-units li:last-child::before { bottom: auto; height: 22.5px; }
.org-units > li:first-child:last-child::before { height: 26.5px; }
.org-units ul > li:first-child:last-child::before { height: 24.5px; }
.org-units li::after { content: ""; position: absolute; left: -15.5px; top: 15px; width: 14px; border-top: var(--lw) solid var(--ln); }
.org-units li.adv { border-style: dashed; background: #F5F9FF; color: #334155; }
.org-units li.check { box-shadow: inset 3px 0 0 #E0A526; }
.org-flag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #FFF4DC; color: #8a5a00; font: 600 10px system-ui, sans-serif; vertical-align: 1px; }
.org mark { background: #FFE7A8; color: inherit; border-radius: 3px; padding: 0 1px; }
.org-col.nohit, .org-units li.nohit { display: none; }

/* Қосымша бағыныштылық (схемадағы нүктелі сызық): компьютерде — сызық (assets/js/org-structure.js салады), тар экранда — тізім */
.org-xsvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.org-xsvg path { fill: none; stroke: var(--ln); stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; }
.org-xrefs { display: none; list-style: none; margin: 8px 0 0 12px; padding: 0 0 0 14px; flex-direction: column; gap: 6px; }
.org-xrefs li { position: relative; margin: 0; padding: 6px 8px; border: 1.5px dotted #7f97b8; border-radius: 7px; background: #fff; font-size: 12.5px; line-height: 1.35; color: #334155; }
.org-xrefs li::before { content: ""; position: absolute; left: -15.5px; top: -9px; height: 24px; border-left: 2px dotted var(--ln); }
.org-xrefs li::after { content: ""; position: absolute; left: -15.5px; top: 15px; width: 14px; border-top: 2px dotted var(--ln); }
.org-xnote { display: block; margin-top: 2px; font: 500 10.5px system-ui, sans-serif; color: #5a6a80; }

/* ---------- Тар экран: бір ортақ сызық, ашылатын тізім ---------- */
@container orgchart (max-width: 1099px) {
    .org-gov { grid-template-columns: 1fr; row-gap: 0; }
    .org-g-board, .org-g-head, .org-g-left, .org-g-right { grid-column: 1; grid-row: auto; }
    .org-g-board { order: 1; }
    .org-g-board .org-node { min-width: 0; width: 100%; }
    .org-g-head { order: 2; margin-top: 22px; }
    .org-g-head.no-board { margin-top: 0; }
    .org-g-head::before { top: -22px; height: 22px; }
    .org-g-left, .org-g-right { position: relative; padding-left: 18px; margin-top: 10px; }
    .org-g-left::before, .org-g-right::before { content: ""; position: absolute; left: 7px; top: -10.5px; bottom: -1px; border-left: var(--lw) solid var(--ln); }
    .org-g-left { order: 3; justify-content: flex-start; }
    .org-g-left .org-node { max-width: none; flex: 1; }
    .org-dbl, .org-hl { display: none; }
    .org-g-right { order: 4; }
    .org-side { flex-direction: row; flex-wrap: wrap; gap: 8px; padding-left: 0; width: 100%; }
    .org-side .org-node { flex: 1 1 140px; min-width: 0; }
    .org-side .org-node::before, .org-side .org-node::after { display: none; }
    .org-frame { border: 0; border-radius: 0; padding: 0 0 0 18px; margin-top: 22px; }
    .org-frame::before { left: 7px; top: -22px; height: 22px; }
    .org-cols, .org-insts { grid-template-columns: 1fr; gap: 8px; }
    .org-insts { margin-top: 8px; padding-left: 18px; }
    .org-col > summary { padding: 11px 12px; }
    .org-ttl b { font-size: 13.5px; }
    .org-chev { display: block; }
    .org-cols > .org-col > summary::before, .org-insts > .org-col > summary::before { display: none; }
    .org-cols > .org-col::before, .org-insts > .org-col::before { content: ""; position: absolute; left: -12px; top: -8px; bottom: 0; border-left: var(--lw) solid var(--ln); }
    .org-cols > .org-col:first-child::before { top: 0; }
    .org-insts > .org-col:last-child::before { bottom: auto; height: 31px; }
    .org-cols > .org-col::after, .org-insts > .org-col::after { content: ""; position: absolute; left: -12px; top: 22px; width: 11px; border-top: var(--lw) solid var(--ln); }
    .org-units li { font-size: 13px; }
    .org-xrefs { display: flex; }
    .org-xsvg { display: none; }
}
@media (max-width: 600px) {
    .org-tools { margin-bottom: 18px; }
    .org-legend { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .org-chev { transition: none; } }

/* Нашар көретіндерге арналған нұсқа */
html body .bvi-body[data-bvi-theme]:not(.bvi-no-styles) :is(.org-head, .org-col > summary, .org-tools) { background: var(--bvi-site-bg) !important; color: var(--bvi-site-color) !important; border: 2px solid var(--bvi-site-color) !important; box-shadow: none !important; }
