/* =====================================================================
   IMSU CPGS — administration console
   ===================================================================== */

:root {
    --green-950: #042417;
    --green-900: #07351f;
    --green-800: #0a4529;
    --green-700: #0b5d3b;
    --green-600: #147a4f;
    --green-100: #e7f0ea;
    --green-50: #f1f7f3;
    --gold: #c8a24a;
    --gold-dark: #9c7a28;
    --gold-100: #f4ead1;
    --cream: #f7f4ec;
    --paper: #fff;
    --ink: #16231c;
    --muted: #617068;
    --line: #e1e7e3;
    --line-dark: #cbd6cf;
    --danger: #a33b34;
    --warn: #956310;
    --info: #1d6fa5;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(6, 40, 24, .05), 0 4px 14px rgba(6, 40, 24, .05);
    --shadow-md: 0 14px 34px rgba(6, 40, 24, .10);
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    --sidebar: 258px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.6; color: var(--ink); background: #f3f5f3; }
img { max-width: 100%; display: block; }
a { color: var(--green-700); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--green-900); margin: 0 0 .5em; line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.14rem; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.2rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.text-muted { color: var(--muted); }
.small { font-size: .8rem; }
.mono { font-family: Consolas, "Courier New", monospace; }

/* ---------------------------------------------------------------------
   Shell
   --------------------------------------------------------------------- */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }

.admin-sidebar {
    background: var(--green-950); color: rgba(255, 255, 255, .78);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none; }
.sidebar-brand img { width: 42px; height: 41px; object-fit: contain; }
.sidebar-brand span { line-height: 1.2; }
.sidebar-brand strong { display: block; font-family: var(--serif); color: #fff; font-size: 1.02rem; }
.sidebar-brand small { display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); margin-top: 2px; }

.sidebar-nav { padding: 14px 12px 24px; flex: 1; }
.nav-group-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .15em; color: rgba(255,255,255,.36); margin: 18px 10px 6px; font-weight: 700; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 2px;
    border-radius: 7px; color: rgba(255,255,255,.74); text-decoration: none; font-size: .83rem; font-weight: 500;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.is-active { background: rgba(200,162,74,.16); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.sidebar-nav .icon { width: 17px; height: 17px; opacity: .8; flex: 0 0 auto; }
.sidebar-nav .count { margin-left: auto; font-size: .65rem; background: rgba(255,255,255,.13); padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: .68rem; color: rgba(255,255,255,.4); }
.sidebar-foot a { color: rgba(255,255,255,.62); }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    background: #fff; border-bottom: 1px solid var(--line); padding: 0 26px; min-height: 62px;
    display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: 0; z-index: 40;
}
.topbar-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title .crumb { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.topbar-title h1 { font-family: var(--sans); font-size: 1.08rem; margin: 0; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; }
.user-chip .avatar { width: 30px; height: 30px; font-size: .68rem; }
.user-chip strong { display: block; font-size: .76rem; line-height: 1.15; }
.user-chip span { display: block; font-size: .62rem; color: var(--muted); }
.sidebar-toggle { display: none; }

.admin-content { padding: 26px; max-width: 1420px; width: 100%; margin: 0 auto; }
.admin-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-page-head h1 { margin: 0 0 2px; font-size: 1.75rem; }
.admin-page-head p { margin: 0; color: var(--muted); font-size: .85rem; }
.admin-page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Buttons, badges, alerts
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 7px; border: 1.5px solid transparent;
    font-family: var(--sans); font-size: .82rem; font-weight: 700; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-gold { background: var(--gold); color: var(--green-950); }
.btn-gold:hover { background: #d5b15c; color: var(--green-950); }
.btn-outline { border-color: var(--line-dark); color: var(--green-800); background: #fff; }
.btn-outline:hover { border-color: var(--green-600); color: var(--green-800); }
.btn-ghost { background: var(--green-50); color: var(--green-800); }
.btn-ghost:hover { background: var(--green-100); }
.btn-danger { background: #fdf0ee; color: var(--danger); border-color: #f0cdc8; }
.btn-danger:hover { background: #f9e1dc; color: #822a24; }
.btn-sm { padding: 6px 11px; font-size: .74rem; border-radius: 6px; }
.btn-xs { padding: 4px 8px; font-size: .68rem; border-radius: 5px; }
.btn .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
    font-size: .65rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
    background: var(--green-100); color: var(--green-800);
}
.badge-ok { background: #e4f3e9; color: #1b6a3b; }
.badge-warn { background: #fbf1d9; color: #835a0b; }
.badge-danger { background: #fbe7e4; color: #96342c; }
.badge-muted { background: #ecefed; color: #59665f; }
.badge-draft { background: #e9eff5; color: #44586b; }
.badge-gold { background: var(--gold-100); color: #775610; }
.badge-info { background: #e7f1f9; color: #1a5b85; }

.alert { margin: 0 0 18px; padding: 12px 16px; border-radius: 8px; border-left: 4px solid var(--green-600); background: var(--green-50); font-size: .83rem; }
.alert-success { border-color: #2f8f5b; background: #effaf3; color: #185c37; }
.alert-danger, .alert-error { border-color: #b4392f; background: #fdf1ef; color: #7a271a; }
.alert-warning { border-color: #c48a1c; background: #fdf7e7; color: #6d4d08; }
.alert-info { border-color: var(--info); background: #eff6fc; color: #174d70; }

/* ---------------------------------------------------------------------
   Cards, tables, stats
   --------------------------------------------------------------------- */
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 20px; }
.admin-card > h2:first-child, .admin-card > h3:first-child { margin-top: 0; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-card-head h2, .admin-card-head h3 { margin: 0; }
.admin-card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 15px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; display: block; position: relative; overflow: hidden; }
.stat-tile:hover { border-color: var(--green-600); color: inherit; }
.stat-tile .icon { width: 19px; height: 19px; color: var(--gold-dark); position: absolute; right: 16px; top: 16px; }
.stat-tile strong { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.05; color: var(--green-800); }
.stat-tile strong.stat-name { font-family: var(--sans); font-size: 1rem; line-height: 1.35; letter-spacing: -.01em; margin-bottom: 4px; }
.stat-tile span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.stat-tile.gold strong { color: var(--gold-dark); }
.stat-tile.danger strong { color: var(--danger); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data th {
    text-align: left; padding: 10px 14px; background: var(--green-50); color: var(--green-900);
    font-size: .65rem; letter-spacing: .07em; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fcfcfa; }
table.data .row-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--muted); font-size: .74rem; }
table.data td strong { display: block; color: var(--ink); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.filter-bar { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 10px; align-items: end; }
.filter-bar.two { grid-template-columns: 1fr 1fr auto; }
.filter-bar.three { grid-template-columns: 1.5fr 1fr auto; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr); gap: 20px; align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.empty-state { text-align: center; padding: 44px 22px; color: var(--muted); border: 1px dashed var(--line-dark); border-radius: var(--radius); background: var(--green-50); }
.empty-state h3 { color: var(--green-800); }
.empty-state p { margin: 0 auto; max-width: 48ch; font-size: .85rem; }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--green-900); margin-bottom: 5px; }
.field .hint { font-size: .7rem; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
    width: 100%; padding: 9px 11px; font-family: var(--sans); font-size: .85rem; color: var(--ink);
    background: #fff; border: 1px solid var(--line-dark); border-radius: 7px;
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(20,122,79,.12); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.textarea.tall { min-height: 220px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235f6f66' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .third { grid-column: span 1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 6px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .83rem; margin-bottom: 8px; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--green-700); }
.check small { display: block; color: var(--muted); font-size: .72rem; }
.field label.check { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 600; color: var(--ink); }
.field label.check small { font-weight: 400; margin-top: 2px; line-height: 1.45; }
.required { color: var(--danger); }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 16px; margin: 0 0 16px; }
legend { padding: 0 8px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.form-note { background: var(--cream); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: .78rem; color: #5f5334; margin-bottom: 16px; }
.inline-form { display: inline; }

/* ---------------------------------------------------------------------
   Dashboard specifics
   --------------------------------------------------------------------- */
.welcome-banner { background: linear-gradient(120deg, var(--green-950), var(--green-800)); border-radius: var(--radius); color: #fff; padding: 24px 26px; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; position: relative; overflow: hidden; }
.welcome-banner::after { content: ""; position: absolute; right: -70px; top: -90px; width: 240px; height: 240px; border-radius: 50%; border: 1px solid rgba(200,162,74,.3); box-shadow: 0 0 0 34px rgba(200,162,74,.05), 0 0 0 68px rgba(200,162,74,.04); }
.welcome-banner h1 { color: #fff; font-size: 1.55rem; margin-bottom: 3px; position: relative; z-index: 1; }
.welcome-banner p { color: rgba(255,255,255,.7); margin: 0; font-size: .85rem; position: relative; z-index: 1; }
.welcome-banner .actions { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.welcome-banner .btn-outline { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); color: #fff; }
.welcome-banner .btn-outline:hover { background: rgba(255,255,255,.18); color: #fff; }

.dash-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 20px; align-items: start; }
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed li { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.activity-feed li:last-child { border-bottom: 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); flex: 0 0 auto; margin-top: 6px; }
.feed-time { margin-left: auto; font-size: .68rem; color: var(--muted); white-space: nowrap; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: .72rem; }
.mini-cal .dow { text-align: center; font-weight: 800; color: var(--muted); font-size: .6rem; padding: 4px 0; text-transform: uppercase; }
.mini-cal .day { text-align: center; padding: 6px 2px; border-radius: 5px; color: var(--ink); }
.mini-cal .day.is-empty { color: transparent; }
.mini-cal .day.has-event { background: var(--green-100); font-weight: 800; color: var(--green-800); }
.mini-cal .day.is-today { background: var(--gold); color: var(--green-950); font-weight: 800; }

/* ---------------------------------------------------------------------
   Organogram builder
   --------------------------------------------------------------------- */
.org-admin-list { display: grid; gap: 10px; }
.org-admin-row { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.org-admin-row .pos-level { width: 40px; height: 40px; border-radius: 8px; background: var(--green-50); color: var(--green-800); display: grid; place-items: center; font-family: var(--serif); font-size: 1.1rem; font-weight: 700; }
.org-admin-row h4 { margin: 0 0 2px; font-family: var(--sans); font-size: .88rem; color: var(--ink); }
.org-admin-row .meta { font-size: .72rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.org-admin-row .actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.org-admin-indent { margin-left: 26px; border-left: 2px solid var(--line); padding-left: 12px; }

.tree-preview { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 20px 12px 30px; overflow: auto; }
.tree-preview .org-tree li { padding: 26px 6px 0; }
.tree-preview .org-node { width: 190px; padding: 10px; }
.tree-preview .org-node h3 { font-size: .7rem; }
.tree-preview .org-person .staff-photo, .tree-preview .org-person .photo-initials { width: 28px; height: 28px; font-size: .6rem; }
.tree-preview .org-level { font-size: .52rem; }
.tree-preview .org-person strong { font-size: .68rem; }
.tree-preview .org-person span { font-size: .58rem; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-brand {
    position: relative; overflow: hidden; color: #fff; padding: 56px;
    background:
        radial-gradient(900px 500px at 85% 0%, rgba(200,162,74,.22), transparent 60%),
        linear-gradient(125deg, #042417 0%, #073a24 55%, #0b5d3b 100%);
    display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 62px 62px; mask-image: radial-gradient(ellipse at 70% 30%, #000 10%, transparent 75%); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand img { width: 72px; height: 70px; }
.login-brand h1 { color: #fff; font-size: 2.15rem; max-width: 18ch; margin: 24px 0 12px; }
.login-brand p { color: rgba(255,255,255,.68); max-width: 46ch; font-size: .92rem; }
.login-brand .login-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; font-size: .82rem; color: rgba(255,255,255,.72); }
.login-brand .login-points li { display: flex; gap: 9px; align-items: flex-start; }
.login-brand .login-points .icon { width: 16px; height: 16px; color: var(--gold); margin-top: 3px; }
.login-brand footer { font-size: .72rem; color: rgba(255,255,255,.45); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--cream); }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); padding: 32px; }
.login-card h2 { font-size: 1.45rem; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: .82rem; margin-bottom: 20px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-help { margin-top: 18px; font-size: .76rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.login-help code { display: block; margin-top: 4px; background: var(--green-50); padding: 6px 8px; border-radius: 5px; font-size: .72rem; }
.login-home { display: inline-flex; gap: 6px; align-items: center; font-size: .76rem; margin-top: 14px; }

/* ---------------------------------------------------------------------
   Misc
   --------------------------------------------------------------------- */
.pill-row { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .7rem; color: var(--muted); }
.notice { display: flex; gap: 9px; background: #fffaf0; border: 1px solid #ecd9ae; border-radius: 8px; padding: 11px 13px; font-size: .77rem; color: #6e5211; }
.notice .icon { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; color: var(--gold-dark); }
.stack { display: grid; gap: 16px; }
.inline-list { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.inline-list strong { color: var(--ink); }
.progress-track { height: 8px; background: var(--green-100); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--green-700), var(--gold)); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.list-plain li:last-child { border-bottom: 0; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(145deg, var(--green-700), var(--green-900)); color: #fff; font-family: var(--serif); font-size: .72rem; font-weight: 700; flex: 0 0 auto; }
.thumb-sm { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--green-50); display: grid; place-items: center; overflow: hidden; color: var(--green-700); }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.thumb-round { border-radius: 50%; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row .input { font-size: .75rem; }
.summary-strip { display: flex; gap: 18px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); padding: 10px 14px; background: var(--green-50); border-radius: 8px; margin-bottom: 14px; }
.summary-strip strong { color: var(--ink); }

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid, .split, .split-even { grid-template-columns: 1fr; }
    .filter-bar, .filter-bar.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
    body.sidebar-open .admin-sidebar { transform: none; }
    body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(4, 20, 12, .45); z-index: 80; }
    .sidebar-toggle { display: inline-flex; }
    .admin-content { padding: 18px; }
    .admin-topbar { padding: 0 16px; }
    .login-page { grid-template-columns: 1fr; }
    .login-brand { display: none; }
}
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar, .filter-bar.two, .filter-bar.three { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .admin-page-head h1 { font-size: 1.45rem; }
    .user-chip span { display: none; }
    .org-admin-row { grid-template-columns: 44px 1fr; }
    .org-admin-row .actions { grid-column: 2; justify-content: flex-start; }
}
@media print {
    .admin-sidebar, .admin-topbar, .actions, .btn, .no-print { display: none !important; }
    .admin-shell { display: block; }
    .admin-content { padding: 0; }
}

/* Staff and people records */
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell .avatar { width: 38px; height: 38px; font-size: .72rem; }
.thumb { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 1px solid var(--line); background: var(--green-50); }
.thumb.photo-initials { display: inline-grid; place-items: center; background: linear-gradient(145deg, var(--green-700), var(--green-950)); color: #fff; font-family: var(--serif); font-size: .7rem; font-weight: 700; }
.profile-photo { width: 118px; height: 118px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: var(--green-50); border: 1px solid var(--line); margin-bottom: 4px; font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: var(--green-800); }
.stat-tile small { display: block; margin-top: 3px; font-size: .68rem; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Organogram preview tree */
.tree-preview .org-tree, .tree-preview .org-tree ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; position: relative; }
.tree-preview .org-tree ul { padding-top: 26px; }
.tree-preview .org-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid var(--line-dark); }
.tree-preview .org-tree li { position: relative; display: flex; flex-direction: column; align-items: center; }
.tree-preview .org-tree > li { padding-top: 0; }
.tree-preview .org-tree li::before { content: ""; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid var(--line-dark); }
.tree-preview .org-tree li::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; border-top: 2px solid var(--line-dark); }
.tree-preview .org-tree li:first-child::after { left: 50%; width: 50%; }
.tree-preview .org-tree li:last-child::after { width: 50%; }
.tree-preview .org-tree li:only-child::after { display: none; }
.tree-preview .org-tree > li::before, .tree-preview .org-tree > li::after { display: none; }
.tree-preview .org-node { background: #fff; border: 1px solid var(--line-dark); border-radius: 10px; text-align: center; position: relative; box-shadow: 0 4px 12px rgba(6, 40, 24, .07); }
.tree-preview .org-node.level-1 { border-top: 3px solid var(--gold); background: linear-gradient(180deg, #fffdf6, #fff); }
.tree-preview .org-node.level-2 { border-top: 2px solid var(--green-700); }
.tree-preview .org-node.vacant { border-style: dashed; background: #fbfaf6; }
.tree-preview .org-level { font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: 4px; }
.tree-preview .org-node h3 { font-family: var(--sans); font-weight: 700; color: var(--green-900); line-height: 1.3; margin: 0 0 6px; }
.tree-preview .org-person { display: flex; align-items: center; gap: 7px; text-align: left; padding-top: 6px; border-top: 1px solid var(--line); }
.tree-preview .org-person .staff-photo, .tree-preview .org-person .photo-initials { border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: grid; place-items: center; background: linear-gradient(145deg, var(--green-700), var(--green-900)); color: #fff; font-family: var(--serif); }
.tree-preview .org-person strong { display: block; color: var(--ink); line-height: 1.25; }
.tree-preview .org-person span { display: block; color: var(--muted); line-height: 1.3; }
.tree-preview .org-unpublished { color: var(--warn); font-style: normal; font-size: .55rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tree-preview .org-vacant-label { font-size: .62rem; font-weight: 800; color: #8a6d1f; background: var(--gold-100); border-radius: 999px; padding: 3px 9px; letter-spacing: .06em; text-transform: uppercase; display: inline-block; }
.tree-preview .org-unit { color: var(--muted); margin-top: 6px; }
.tree-preview .org-toggle {
    position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%);
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-dark);
    background: #fff; color: var(--green-800); cursor: pointer; display: grid; place-items: center;
    font-size: 12px; line-height: 1; z-index: 2; padding: 0;
}
.tree-preview .org-toggle:hover { background: var(--green-50); }
.tree-preview .org-tree li.is-collapsed > ul { display: none; }
.tree-preview .org-tree li.is-collapsed::before { display: none; }
.tree-preview .org-tree li.is-collapsed > .org-node .org-toggle { transform: translateX(-50%) rotate(-90deg); }
@media print {
    .tree-preview { overflow: visible; border: 0; background: none; padding: 0; }
    .tree-preview .org-tree li.is-collapsed > ul { display: flex; }
    .tree-preview .org-toggle { display: none; }
    .tree-preview .org-node { break-inside: avoid; }
}

/* ---------------------------------------------------------------------
   Admissions module
   --------------------------------------------------------------------- */
.detail-list { display: grid; gap: 8px; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-list dt { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.detail-list dd { margin: 0; font-size: .84rem; color: var(--ink); overflow-wrap: anywhere; }
.detail-list a { color: var(--green-800); }
.payment-block { border: 1px solid var(--line); border-radius: 10px; padding: 15px; margin-bottom: 14px; background: #fdfdfc; }
.payment-block:last-child { margin-bottom: 0; }
@media (max-width: 700px) {
    .detail-list > div { grid-template-columns: 1fr; gap: 1px; }
}
