/* Бүтэц, зохион байгуулалт: схем (/structure) ба нэгжийн хуудас (/structure/<slug>). about.css-тэй хамт ачаална. */
:root { --oc-line: #c7d2e3; --oc-navy: #003A8C; --oc-blue: #1D5FC2; --oc-sky: #4C9FE8; --oc-ink: #0f172a; --oc-muted: #64748b; }
.oc-main { padding: 2.5rem 1.5rem 4rem; }
@media (min-width: 1024px) { .oc-main { padding: 3.5rem 1.5rem 5rem; } }

/* Самбар: заавар + харагдац сонголт */
.oc-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.oc-hint { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--oc-muted); }
.oc-hint svg { width: 18px; height: 18px; color: var(--oc-blue); flex: 0 0 auto; }
.oc-switch { display: inline-flex; padding: .25rem; border-radius: .9rem; background: #e8eef7; }
.oc-switch button { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border: 0; border-radius: .65rem; background: transparent; font: inherit; font-size: .82rem; font-weight: 800; color: #475569; cursor: pointer; }
.oc-switch button svg { width: 16px; height: 16px; }
.oc-switch button.is-on { background: #fff; color: var(--oc-navy); box-shadow: 0 2px 8px -2px rgba(2, 20, 60, .25); }
.oc-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: 1.5rem; justify-content: center; font-size: .75rem; font-weight: 700; color: #475569; }
.oc-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.oc-legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }

/* Схем */
.oc-wrap { overflow-x: auto; overscroll-behavior-x: contain; padding: .5rem 0 1.25rem; -webkit-overflow-scrolling: touch; }
.oc-chart { min-width: 1120px; margin: 0 auto; }
.oc-center { display: flex; justify-content: center; }
.oc-stem { width: 2px; height: 30px; margin: 0 auto; background: var(--oc-line); }
.oc-band { position: relative; }
.oc-band::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--oc-line); }
.oc-band .oc-row::before { display: none; }

.oc-row { position: relative; display: flex; justify-content: center; align-items: flex-start; list-style: none; margin: 0; padding: 30px 0 0; }
.oc-row::before { content: ''; position: absolute; top: 0; left: 50%; width: 2px; height: 30px; margin-left: -1px; background: var(--oc-line); }
.oc-row > li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 26px 6px 0; }
.oc-row > li::before, .oc-row > li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 26px; border-top: 2px solid var(--oc-line); }
.oc-row > li::after { right: auto; left: 50%; border-left: 2px solid var(--oc-line); }
.oc-row > li:first-child::before { border-top: 0; }
.oc-row > li:last-child::after { border-top: 0; border-left: 0; }
.oc-row > li:last-child::before { border-right: 2px solid var(--oc-line); border-radius: 0 10px 0 0; }
.oc-row > li:first-child::after { border-radius: 10px 0 0 0; }
.oc-row > li:only-child { padding-top: 0; }
.oc-row > li:only-child::before, .oc-row > li:only-child::after { display: none; }
.oc-band .oc-row > li { z-index: 1; }

/* Доод нэгж (тасаг) — хэлтсийн доор босоо */
.oc-subs { display: flex; flex-direction: column; align-items: center; }
.oc-subs::before { content: ''; width: 2px; height: 18px; background: var(--oc-line); }
.oc-subs .oc-node + .oc-node { margin-top: 0; }
.oc-subs .oc-node::before { content: ''; position: absolute; left: 50%; top: -18px; width: 2px; height: 18px; margin-left: -1px; background: var(--oc-line); }
.oc-subs .oc-node:first-child::before { display: none; }
.oc-subs .oc-node { margin-top: 18px; }
.oc-subs .oc-node:first-child { margin-top: 0; }

/* Нэгжийн карт */
.oc-node { --c: var(--oc-navy); position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; width: 136px; padding: .8rem .6rem .7rem; border-radius: 1rem; background: #fff; border: 1px solid #e2e8f0; border-top: 4px solid var(--c); color: var(--oc-ink); text-decoration: none; box-shadow: 0 6px 16px -12px rgba(2, 20, 60, .35); transition: transform .2s, box-shadow .2s, border-color .2s; }
.oc-node:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -16px rgba(2, 20, 60, .45); border-color: var(--c); }
.oc-node b { font-size: .76rem; font-weight: 800; line-height: 1.25; letter-spacing: -.005em; }
.oc-node small { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--c); }
.oc-node .oc-ico { width: 34px; height: 34px; border-radius: .7rem; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); }
.oc-node .oc-ico svg { width: 18px; height: 18px; }
.oc-node .oc-photo { width: 52px; height: 52px; border-radius: 999px; object-fit: cover; object-position: top; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--c); background: #e2e8f0; }
.oc-node .oc-meta { display: flex; align-items: center; gap: .3rem; margin-top: .15rem; font-size: .66rem; font-weight: 700; color: var(--oc-muted); }
.oc-node .oc-meta svg { width: 12px; height: 12px; }
.oc-node .oc-go { position: absolute; right: .45rem; top: .45rem; width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; background: #f1f5f9; color: #94a3b8; opacity: 0; transition: opacity .2s; }
.oc-node .oc-go svg { width: 11px; height: 11px; }
.oc-node:hover .oc-go { opacity: 1; }
.oc-node.is-lead { flex-direction: row; text-align: left; gap: .85rem; width: auto; min-width: 280px; padding: .85rem 1.25rem .85rem .9rem; background: linear-gradient(135deg, #002a68, var(--oc-navy) 60%, var(--oc-blue)); color: #fff; border: 0; border-radius: 1.1rem; box-shadow: 0 16px 30px -14px rgba(0, 58, 140, .6); }
.oc-node.is-lead b { font-size: .98rem; }
.oc-node.is-lead small { color: #A9D2F7; }
.oc-node.is-lead .oc-photo { width: 58px; height: 58px; box-shadow: 0 0 0 2px #A9D2F7; }
.oc-node.is-lead .oc-ico { background: rgba(255, 255, 255, .14); color: #fff; }
.oc-node.is-lead .oc-meta { color: rgba(255, 255, 255, .75); }
.oc-node.is-lead .oc-go { background: rgba(255, 255, 255, .18); color: #fff; }
.oc-node.is-member { width: 150px; }
.oc-node.is-sub { width: 126px; border-style: dashed; border-top-style: solid; background: #f8fafc; }
.oc-node.is-sub b { font-size: .7rem; font-weight: 700; color: #334155; }
.oc-node.is-office { width: auto; min-width: 230px; flex-direction: row; text-align: left; gap: .75rem; padding: .7rem 1.1rem .7rem .8rem; background: var(--c); color: #fff; border: 0; }
.oc-node.is-office small { color: rgba(255, 255, 255, .75); } .oc-node.is-office b { font-size: .9rem; }
.oc-node.is-office .oc-ico { background: rgba(255, 255, 255, .14); color: #fff; } .oc-node.is-office .oc-meta { color: rgba(255, 255, 255, .75); }
.oc-node.is-office .oc-go { background: rgba(255, 255, 255, .18); color: #fff; }

/* Жагсаалт харагдац */
.oc-list { display: none; }
.oc-group { margin-bottom: 1.75rem; }
.oc-group > h2 { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--oc-muted); margin: 0 0 .75rem; }
.oc-cards { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.oc-card { --c: var(--oc-navy); display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border-radius: 1rem; background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid var(--c); color: inherit; text-decoration: none; transition: .2s; }
.oc-card:hover { border-color: var(--c); transform: translateY(-2px); box-shadow: 0 14px 24px -16px rgba(2, 20, 60, .4); }
.oc-card .oc-ico, .oc-card .oc-photo { flex: 0 0 auto; }
.oc-card .oc-ico { width: 38px; height: 38px; border-radius: .75rem; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); }
.oc-card .oc-ico svg { width: 19px; height: 19px; }
.oc-card .oc-photo { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; object-position: top; }
.oc-card > span { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.oc-card b { font-size: .9rem; line-height: 1.3; } .oc-card small { font-size: .74rem; color: var(--oc-muted); }
.oc-card .oc-arrow { width: 16px; height: 16px; color: #94a3b8; flex: 0 0 auto; }
.oc-card.is-sub { margin-left: 1.25rem; border-left-style: dashed; }
.oc-main.view-list .oc-wrap, .oc-main.view-list .oc-legend { display: none; }
.oc-main.view-list .oc-list { display: block; }
@media (max-width: 767px) {
  .oc-main:not(.view-chart) .oc-wrap, .oc-main:not(.view-chart) .oc-legend { display: none; }
  .oc-main:not(.view-chart) .oc-list { display: block; }
}

/* ---------- Нэгжийн хуудас ---------- */
.su-hero-grid { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.su-person { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-radius: 1.1rem; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); color: #fff; text-decoration: none; backdrop-filter: blur(6px); }
.su-person img { width: 64px; height: 64px; border-radius: 999px; object-fit: cover; object-position: top; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.su-person b { display: block; font-size: 1.05rem; } .su-person span { font-size: .78rem; color: rgba(255, 255, 255, .75); }
.su-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: .74rem; font-weight: 700; color: #fff; }
.su-contact { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.25rem; font-size: .88rem; color: rgba(255, 255, 255, .85); }
.su-contact a, .su-contact span { display: inline-flex; align-items: center; gap: .4rem; color: inherit; text-decoration: none; }
.su-contact svg { width: 16px; height: 16px; color: #A9D2F7; }

.su-side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.su-side-list a { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border-radius: .7rem; font-size: .84rem; font-weight: 600; color: #334155; text-decoration: none; }
.su-side-list a:hover { background: #eef4fb; color: var(--oc-navy); }
.su-side-list a i { width: 8px; height: 8px; border-radius: 999px; background: var(--c, var(--oc-navy)); flex: 0 0 auto; }
.su-back { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1rem; font-size: .84rem; font-weight: 800; color: var(--oc-navy); text-decoration: none; }
.su-back svg { width: 16px; height: 16px; }

.su-empty { padding: 1.25rem 1.4rem; border-radius: 1rem; background: #f8fafc; border: 1px dashed #cbd5e1; color: var(--oc-muted); font-size: .92rem; }

/* Чиг үүрэг — 2 багана */
.su-duties { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.su-duties li { font-size: .92rem; }

/* Албан тушаалын мод */
.su-tree-wrap { overflow-x: auto; padding: .5rem 0 1rem; }
.su-tree { display: inline-flex; min-width: 100%; justify-content: center; }
.pos-node { --c: var(--oc-navy); position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 160px; padding: .75rem .65rem; border-radius: .9rem; background: #fff; border: 1px solid #e2e8f0; border-top: 4px solid var(--c); color: var(--oc-ink); font: inherit; text-align: center; cursor: pointer; box-shadow: 0 6px 16px -12px rgba(2, 20, 60, .35); transition: transform .2s, box-shadow .2s, border-color .2s; }
.pos-node:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 16px 28px -16px rgba(2, 20, 60, .45); }
.pos-node b { font-size: .78rem; font-weight: 800; line-height: 1.3; }
.pos-node span { font-size: .7rem; color: var(--oc-muted); line-height: 1.3; }
.pos-node .pos-file { display: inline-flex; align-items: center; gap: .25rem; margin-top: .15rem; padding: .18rem .5rem; border-radius: 999px; font-size: .62rem; font-weight: 800; background: #ecfdf5; color: #047857; }
.pos-node .pos-file svg { width: 11px; height: 11px; }
.pos-node .pos-file.is-none { background: #f1f5f9; color: #94a3b8; }
.pos-node.is-root { background: var(--c); color: #fff; border: 0; width: 190px; }
.pos-node.is-root span { color: rgba(255, 255, 255, .8); }
.pos-node.is-root .pos-file { background: rgba(255, 255, 255, .18); color: #fff; }
.su-tree .oc-row > li { padding-left: 5px; padding-right: 5px; }

.pos-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pos-list li { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: .85rem; background: #fff; border: 1px solid #e2e8f0; }
.pos-list .pos-n { width: 28px; height: 28px; border-radius: .6rem; display: grid; place-items: center; background: #eef4fb; color: var(--oc-navy); font-size: .72rem; font-weight: 900; flex: 0 0 auto; }
.pos-list > li > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pos-list b { font-size: .86rem; } .pos-list small { font-size: .72rem; color: var(--oc-muted); }
.pos-list button { display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .65rem; border-radius: .65rem; border: 1px solid #e2e8f0; background: #f8fafc; font: inherit; font-size: .72rem; font-weight: 800; color: var(--oc-navy); cursor: pointer; }
.pos-list button:hover { background: #eef4fb; border-color: var(--oc-navy); }
.pos-list button svg { width: 14px; height: 14px; }
.pos-list button[disabled] { color: #94a3b8; cursor: default; }

.su-chart-img { margin-top: 1.5rem; border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff; padding: 1rem; }
.su-chart-img img { display: block; max-width: 100%; margin: 0 auto; }

/* Дэд нэгжүүд */
.su-kids { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.su-kid { --c: var(--oc-navy); display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.2rem; border-radius: 1rem; background: #fff; border: 1px solid #e2e8f0; border-top: 4px solid var(--c); color: inherit; text-decoration: none; transition: .2s; }
.su-kid:hover { transform: translateY(-3px); box-shadow: 0 16px 28px -16px rgba(2, 20, 60, .4); border-color: var(--c); }
.su-kid small { font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.su-kid b { font-size: .98rem; line-height: 1.3; }
.su-kid p { margin: 0; font-size: .82rem; color: var(--oc-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.su-kid .su-kid-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .25rem; font-size: .74rem; font-weight: 700; color: var(--oc-muted); }
.su-kid .su-kid-foot svg { width: 15px; height: 15px; color: var(--c); }

/* Ажлын байрны тодорхойлолтын цонх */
.pos-dlg { width: min(960px, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 1.25rem; box-shadow: 0 30px 60px -20px rgba(2, 10, 30, .6); overflow: hidden; }
.pos-dlg::backdrop { background: rgba(2, 10, 30, .62); backdrop-filter: blur(3px); }
.pos-dlg-head { display: flex; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.25rem; background: linear-gradient(135deg, #002a68, var(--oc-navy) 60%, var(--oc-blue)); color: #fff; }
.pos-dlg-head .oc-ico { width: 42px; height: 42px; border-radius: .8rem; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex: 0 0 auto; }
.pos-dlg-head .oc-ico svg { width: 20px; height: 20px; }
.pos-dlg-head > div { flex: 1; min-width: 0; }
.pos-dlg-head small { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #A9D2F7; }
.pos-dlg-head h3 { margin: .1rem 0 0; font-size: 1.1rem; font-weight: 900; line-height: 1.3; }
.pos-dlg-head p { margin: .2rem 0 0; font-size: .8rem; color: rgba(255, 255, 255, .78); }
.pos-dlg-close { width: 36px; height: 36px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.1rem; font-weight: 900; cursor: pointer; flex: 0 0 auto; }
.pos-dlg-body { padding: 1rem 1.25rem 1.25rem; background: #f8fafc; }
.pos-dlg-body p.pos-summary { margin: 0 0 .9rem; font-size: .9rem; color: #334155; line-height: 1.6; }
.pos-dlg-frame { width: 100%; height: min(68vh, 760px); border: 1px solid #e2e8f0; border-radius: .9rem; background: #fff; }
.pos-dlg-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.pos-dlg-actions a { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1rem; border-radius: .8rem; font-size: .82rem; font-weight: 800; text-decoration: none; }
.pos-dlg-actions a svg { width: 15px; height: 15px; }
.pos-dlg-actions .is-primary { background: var(--oc-navy); color: #fff; } .pos-dlg-actions .is-ghost { background: #fff; border: 1px solid #e2e8f0; color: var(--oc-navy); }
.pos-dlg-none { padding: 2rem 1rem; text-align: center; color: var(--oc-muted); font-size: .92rem; border: 1px dashed #cbd5e1; border-radius: .9rem; background: #fff; }
@media (max-width: 640px) { .pos-dlg-frame { height: 60vh; } }
