/* Org Chart & JD Manager — ACT brand (Clinical / Compliance system): white
   surfaces, navy header areas, ACT Red and ACT Blue accents, Poppins headings,
   Lato body. All fonts are bundled locally; Inter fills missing glyphs. */
@font-face { font-family: 'Lato'; font-weight: 400; font-display: swap; src: url('/fonts/Lato-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Lato'; font-weight: 500 900; font-display: swap; src: url('/fonts/Lato-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('/fonts/Poppins-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('/fonts/Poppins-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 700 900; font-display: swap; src: url('/fonts/Poppins-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/Inter-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/Inter-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/vendor/fonts/Inter-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/Inter-Bold.woff2') format('woff2'); }

:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --sunken: #ececec;
  --text: #333333;
  --text-2: #555b66;
  --text-3: #6b7280;
  --border: #dcdfe4;
  --border-strong: #c4c9d1;
  --primary: #0070c0;
  --primary-hover: #005a9c;
  --primary-soft: #e6f1fa;
  --focus: #0070c0;
  --danger: #c00000;
  --danger-soft: #fee4e2;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --ok: #1e7a46;
  --ok-soft: #dcf2e4;
  --info-soft: #e6f1fa;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 2px rgba(30, 41, 59, 0.06), 0 1px 1px rgba(30, 41, 59, 0.04);
  --shadow-2: 0 4px 14px rgba(30, 41, 59, 0.08), 0 1px 3px rgba(30, 41, 59, 0.06);
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --panel-w: 400px;
  --font: 'Lato', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --navy: #0b1c46;
  --act-red: #c00000;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1, h2, h3, legend, .modal-head h2, .details-head h2 { font-family: var(--font-head); color: var(--navy); }
h1, h2, h3 { font-weight: 600; }
h1 { font-size: 18px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; color: var(--text-2); }
p { margin: 0 0 8px; }
a { color: var(--primary); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.boot { padding: 48px; color: var(--text-2); }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 15px; height: 15px; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar { background: var(--navy); color: #e5e7eb; display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 8px; padding: 4px 4px 16px; color: #fff; }
.brand .logo-plate { background: #fff; border-radius: 8px; padding: 10px 12px; display: flex; justify-content: center; }
.brand .logo-plate img { width: 100%; max-width: 180px; min-width: 120px; height: auto; display: block; }
.brand .app-name { font-family: var(--font-head); font-weight: 600; font-size: 13.5px; padding: 0 8px; line-height: 1.3; }
.brand small { display: block; font-family: var(--font); font-weight: 400; color: #aab4c8; font-size: 11px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: #dbe2ef; text-decoration: none; font-weight: 500; }
.nav-link:hover { background: #17295a; color: #fff; }
.nav-link[aria-current='page'] { background: #1d3470; color: #fff; box-shadow: inset 4px 0 0 var(--act-red); }
.nav-section { margin: 14px 11px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #9ca3af; }
.sidebar .spacer { flex: 1; }
.sidebar .proto { margin: 8px 6px 0; padding: 10px; border-radius: 8px; background: #17295a; font-size: 11.5px; color: #cbd5e1; line-height: 1.4; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 3px solid var(--primary); flex: none; }
.topbar .menu-btn { display: none; }
.topbar .org { color: var(--text-2); font-size: 13px; }
.topbar .user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.topbar .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 650; font-size: 12px; }
.content { flex: 1; overflow: auto; min-height: 0; position: relative; }
body:has(.shell) { overflow: hidden; }
.page { padding: 22px 24px 40px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 760px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13px; }
.banner .icon { margin-top: 1px; }
.banner.info { background: var(--info-soft); border-color: #c9d6ee; color: #1e3a66; }
.banner.warn { background: var(--warn-soft); border-color: #f3d48a; color: #6b3a07; }
.banner.danger { background: var(--danger-soft); border-color: #f5b8b2; color: #7a1a12; }
.banner.ok { background: var(--ok-soft); border-color: #acdcbe; color: #14532d; }
.banner.sample { background: #fff7e0; border-color: #f2c94c; color: #5c4400; border-radius: 0; border-width: 0 0 1px; padding: 8px 20px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.section-title { font-family: var(--font-head); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 600; margin: 0 0 8px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color 0.12s ease, border-color 0.12s ease; }
.btn:hover { background: var(--surface-2); border-color: #b9b2a5; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.approve { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.btn.approve:hover { background: #17623a; }
.btn.danger { color: var(--danger); border-color: #e7b3ad; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { min-height: 30px; padding: 4px 9px; font-size: 13px; }
.btn.icon-only { padding: 6px; min-width: 36px; }
.btn.sm.icon-only { min-width: 30px; padding: 4px; }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-align: left; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid; white-space: nowrap; line-height: 1; }
.badge.draft { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.badge.approved { background: var(--ok-soft); color: #14532d; border-color: #acdcbe; }
.badge.scheduled { background: #e0f2fe; color: #0c4a6e; border-color: #a5d8f5; }
.badge.superseded { background: #f1f5f9; color: #475569; border-color: #d5dde6; }
.badge.vacant { background: #fff; color: #334155; border: 1px dashed #64748b; }
.badge.acting { background: var(--warn-soft); color: #78350f; border-color: #f0c36d; }
.badge.inactive { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.badge.sample { background: #fff4cc; color: #5c4400; border-color: #e7c35a; }
.badge.missing { background: var(--danger-soft); color: #7a1a12; border-color: #f2b8b2; }
.badge.neutral { background: var(--sunken); color: var(--text-2); border-color: var(--border); }
.badge.role { background: var(--primary-soft); color: var(--primary); border-color: #c9d6ee; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--text-2); }
.field .error { font-size: 12.5px; color: var(--danger); font-weight: 500; display: flex; gap: 5px; align-items: center; }
.input, select.input, textarea.input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; min-width: 0; }
legend { font-weight: 650; padding: 0 6px; font-size: 14px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 3px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; background: #fff; }
.swatch:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.swatch .chip { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.15); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 16px; }
.dirty-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--warn); font-weight: 600; }
.dirty-flag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #d97706; }

/* Combobox */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow-2); padding: 4px; margin: 0; list-style: none; }
.combo-opt { padding: 7px 9px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.combo-opt .sub { font-size: 12px; color: var(--text-2); }
.combo-opt[aria-selected='true'], .combo-opt:hover { background: var(--primary-soft); }
.combo-opt.current { font-weight: 600; }
.combo-empty { padding: 8px 10px; color: var(--text-2); font-size: 13px; }

/* ---------- Tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; text-align: left; border-radius: 8px; cursor: pointer; }
.list-item:hover { background: var(--surface-2); }
.list-item[aria-current='true'] { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.list-item .t { font-weight: 550; overflow-wrap: anywhere; }
.list-item .s { font-size: 12px; color: var(--text-2); }
.tree-dept { margin: 2px 0; }
.tree-children { margin-left: 18px; border-left: 1px dashed var(--border-strong); padding-left: 4px; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; border: 1px solid rgba(0, 0, 0, 0.12); }
.scroll-list { max-height: calc(100vh - 260px); overflow: auto; padding: 6px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 13px; border: 0; background: none; cursor: pointer; font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab[aria-selected='true'] { color: var(--text); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* Empty states */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .icon { width: 34px; height: 34px; color: var(--text-3); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 14px; }

/* Diff */
.diff-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.diff-item { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; background: #fff; }
.diff-item .what { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 550; }
.diff-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 2px 7px; border-radius: 5px; text-transform: uppercase; }
.diff-tag.added { background: var(--ok-soft); color: #14532d; }
.diff-tag.removed { background: var(--danger-soft); color: #7a1a12; }
.diff-tag.changed { background: #e0e7ff; color: #3730a3; }
.diff-fields { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; }
.diff-fields li { padding: 2px 0; }
.diff-fields .from { color: #7a1a12; text-decoration: line-through; }
.diff-fields .to { color: #14532d; font-weight: 550; }
.textdiff { white-space: pre-wrap; line-height: 1.65; font-size: 13.5px; }
.textdiff ins { background: #d3f3df; color: #0f3d22; text-decoration: none; border-bottom: 2px solid #1e7a46; padding: 0 1px; }
.textdiff del { background: #fde0dd; color: #6f160f; text-decoration: line-through; padding: 0 1px; }
.textdiff .mark { font-size: 10.5px; font-weight: 700; vertical-align: 1px; margin-right: 2px; }
.diff-key { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.42); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade 0.12s ease-out; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; align-items: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #1f2937; color: #fff; padding: 11px 14px; border-radius: 9px; box-shadow: var(--shadow-2); display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; animation: fade 0.15s ease-out; }
.toast.error { background: #7a1a12; }
.toast.ok { background: #14532d; }
.toast button { margin-left: auto; color: #fff; background: none; border: 0; cursor: pointer; padding: 0; }

/* Copy box */
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: min(520px, 100%); }
.auth-head { padding: 22px 26px 6px; border-top: 5px solid var(--navy); border-radius: var(--radius) var(--radius) 0 0; }
.auth-head .auth-logo { width: 200px; max-width: 70%; height: auto; display: block; margin-bottom: 6px; }
.auth-head h1 { font-size: 21px; margin: 10px 0 4px; }
.auth-body { padding: 14px 26px 26px; }

/* ---------- Charts workspace ---------- */
.chart-page { display: flex; flex-direction: column; height: 100%; }
.chart-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 13px; cursor: pointer; font-weight: 550; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--border); }
.seg.seg-sm button { padding: 4px 9px; font-size: 13px; }
.seg.seg-sm button { min-height: 30px; }
.seg button[aria-pressed='true'] { background: var(--navy); color: #fff; }
.chart-work { position: relative; flex: 1; min-height: 0; display: flex; }
.viewport { position: relative; flex: 1; overflow: hidden; background-color: #f6f4ef; background-image: radial-gradient(#ddd8ce 1px, transparent 1px); background-size: 22px 22px; cursor: grab; touch-action: none; }
.viewport.panning { cursor: grabbing; }
.viewport:focus-visible { outline-offset: -4px; }
.canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas > svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.status-ribbon { font-family: var(--font-head); position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; padding: 6px 14px; border-radius: 999px; font-weight: 650; font-size: 12.5px; box-shadow: var(--shadow-1); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.status-ribbon.draft { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.status-ribbon.historic { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.status-ribbon.scheduled { background: #e0f2fe; color: #0c4a6e; border: 1px solid #a5d8f5; }

.toolbar { position: absolute; top: 12px; left: 12px; z-index: 6; display: flex; gap: 4px; align-items: center; padding: 5px; background: rgba(255, 255, 255, 0.97); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-2); flex-wrap: wrap; max-width: calc(100% - 24px); }
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }
.toolbar .zoom-val { min-width: 46px; text-align: center; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.toolbar .search { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 4px 0 8px; height: 32px; background: #fff; }
.toolbar .search input { border: 0; outline: 0; width: 170px; height: 30px; font-size: 13px; }
.toolbar .search:focus-within { outline: 3px solid rgba(37, 99, 235, 0.35); }
.legend { position: absolute; left: 12px; bottom: 12px; z-index: 6; background: rgba(255, 255, 255, 0.97); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-2); padding: 8px 10px; font-size: 11.5px; max-width: min(420px, calc(100% - 24px)); max-height: 40%; overflow: auto; }
.legend .legend-depts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.legend .badge { height: 18px; font-size: 10.5px; }
.legend h4 { margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: flex; gap: 8px; align-items: center; }

.node-card { position: absolute; display: flex; flex-direction: column; border-radius: 9px; background: #fff; border: 1.5px solid; box-shadow: var(--shadow-1); overflow: hidden; }
.node-card.lead { background: #fff6d6; }
.node-card.vacant { border-style: dashed; }
.node-card .accent { height: 5px; flex: none; }
.node-card .main { all: unset; box-sizing: border-box; display: block; padding: 6px 10px 0; cursor: pointer; flex: none; height: 80px; }
.node-card .main:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 8px; }
.node-card .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--text-2); font-weight: 550; }
.node-card.lead .meta { color: #4a3a05; }
.node-card .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-card .title { font-weight: 650; font-size: 13.5px; line-height: 1.25; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 34px; }
.node-card .badges { display: flex; gap: 4px; margin-top: 6px; overflow: hidden; }
.node-card .badges .badge { height: 17px; font-size: 10px; padding: 0 6px; }
.node-card .occ { border-top: 1px solid var(--border); margin: 0 8px; padding: 2px 0 4px; display: flex; flex-direction: column; }
.node-card .occ button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px; height: 18px; font-size: 12.5px; font-weight: 550; padding: 0 3px; border-radius: 4px; }
.node-card .occ button:hover { background: var(--primary-soft); }
.node-card .occ button:focus-visible { outline: 2px solid var(--focus); }
.node-card .occ button[aria-pressed='true'] { background: var(--primary-soft); color: var(--primary); }
.node-card .occ .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-card .occ .act { font-size: 10.5px; color: #78350f; font-weight: 700; }
.node-card .occ .vac { font-size: 12px; color: var(--text-2); font-style: italic; height: 18px; padding: 0 3px; }
.node-card:hover { box-shadow: var(--shadow-2); }
.node-card.selected { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--focus), var(--shadow-2); }
.node-card.match { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #f59e0b; }
.node-card.match.current-match { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #d97706, var(--shadow-2); }
.node-card.dim { opacity: 0.45; }
.seat-stack { position: absolute; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-family: var(--font-head); font-weight: 600; flex: none; object-fit: cover; letter-spacing: 0.02em; user-select: none; }
.vacant-avatar { background: #fff !important; color: var(--text-3); border: 1.5px dashed var(--border-strong); font-size: 18px; }
.node-card .person-main { height: auto; padding: 8px 10px 0; }
.person-row { display: flex; gap: 10px; align-items: center; }
.person-row .avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--border); }
.pinfo { min-width: 0; flex: 1; }
.pname { font-family: var(--font-head); font-weight: 600; font-size: 14.5px; color: var(--navy); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-card.lead .pname { color: #2b2100; }
.ptitle { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pdept { font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-card.vacant .pname { color: var(--text-3); font-style: italic; }
.person-card .badges { margin-top: 6px; min-height: 17px; }
.seat-stack.shared::before { content: ''; position: absolute; inset: -5px; border-radius: 12px; background: #e6e9ee; }
.dept-header { position: absolute; display: flex; align-items: stretch; border-radius: 7px; box-shadow: var(--shadow-1); overflow: hidden; }
.dept-header button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.dept-header .name { flex: 1; padding: 0 10px; font-weight: 650; font-size: 13px; min-width: 0; }
.dept-header .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-header .toggle { padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.dept-header .name:focus-visible, .dept-header .toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.dept-header .count { font-size: 11px; font-weight: 500; opacity: 0.92; }
.dept-header.selected { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--focus); }

.list-view { flex: 1; overflow: auto; padding: 70px 24px 24px; background: var(--bg); }
.list-view ul { list-style: none; margin: 0; padding-left: 22px; border-left: 1px solid var(--border-strong); }
.list-view > ul { border-left: 0; padding-left: 0; }
.list-view li { margin: 4px 0; }
.list-view .lv-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 6px; border-radius: 6px; }
.list-view .lv-row:hover { background: var(--surface); }

/* Details panel */
.details { width: var(--panel-w); flex: none; background: var(--surface); border-left: 1px solid var(--border); overflow: auto; display: flex; flex-direction: column; }
.details-head { position: sticky; top: 0; background: var(--surface); padding: 14px 16px 12px; border-bottom: 1px solid var(--border); z-index: 2; }
.details-head .kicker { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; }
.details-head h2 { margin-top: 2px; overflow-wrap: anywhere; }
.details-body { padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.details-body section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 8px; }
.panel-close { position: absolute; top: 10px; right: 10px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-list li { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.mini-list li button.linkish { font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--border); position: relative; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }

/* JD view */
.jd-doc { max-width: 860px; }
.jd-doc section { margin-bottom: 18px; }
.jd-doc h3 { font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 5px; margin-bottom: 8px; }
.jd-doc .body { white-space: pre-wrap; }
.jd-doc ol { margin: 0; padding-left: 22px; }
.jd-doc ol li { margin: 4px 0; }
.shared-note { border-left: 3px solid var(--primary); background: var(--primary-soft); padding: 9px 12px; border-radius: 0 8px 8px 0; font-size: 13px; }
.resp-row { display: flex; gap: 8px; align-items: flex-start; }
.resp-row .num { width: 22px; text-align: right; padding-top: 9px; color: var(--text-3); font-weight: 600; font-size: 13px; }
.approval-box { border: 1px solid #acdcbe; background: #f3fbf6; border-radius: 9px; padding: 12px 14px; }
.approval-box.draft { border-color: #c7d2fe; background: #f5f7ff; }

/* ---------- Responsive ---------- */
@media (min-width: 1181px) {
  .sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding-bottom: 4px; z-index: 3; }
}
@media (max-width: 1180px) {
  :root { --panel-w: 340px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split .scroll-list { max-height: 280px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 90; transform: translateX(-100%); transition: transform 0.18s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.35); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .org { display: none; }
  .details { position: fixed; inset: 0; width: 100%; z-index: 80; }
  .split, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .toolbar .search input { width: 120px; }
  .hide-sm, .toolbar .lbl { display: none !important; }
  .topbar { padding: 0 10px; gap: 6px; }
  .chart-bar { padding: 8px 10px; gap: 8px; }
  .chart-bar .rel-info { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .toolbar, .legend, .chart-bar { display: none !important; }
}
label.btn.disabled { opacity: 0.55; cursor: not-allowed; }
.list-item .avatar { margin-right: 2px; }
.ring-label { position: absolute; transform: translate(-50%, -50%); background: #fff; border: 1.5px solid #7fa3cc; color: var(--navy); font-family: var(--font-head); font-weight: 600; font-size: 13px; padding: 3px 12px; border-radius: 999px; white-space: nowrap; box-shadow: var(--shadow-1); pointer-events: none; z-index: 1; }
.plegal { font-size: 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
