:root {
    color-scheme: dark;
    --bg: #050a12;
    --surface: #091424;
    --surface-2: #0d1b2d;
    --line: #203650;
    --text: #f2f7ff;
    --muted: #8fa2b8;
    --accent: #5ba8ff;
    --accent-soft: #17395f;
    --green: #4ed0a3;
    --amber: #f4bd63;
    --danger: #ff7f8b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; inset: 0; z-index: -1; background: radial-gradient(900px 520px at 82% -10%, #123f69 0%, transparent 64%), radial-gradient(680px 460px at -10% 80%, #103d36 0%, transparent 67%); opacity: .72; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(22px); border-radius: 8px; box-shadow: 0 28px 80px #0008; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; color: #03111f; background: linear-gradient(145deg, var(--green), var(--accent)); font-weight: 900; font-size: 27px; box-shadow: 0 12px 30px #2d9cd944; }
.brand-mark.small { width: 38px; height: 38px; font-size: 20px; }
.eyebrow { margin: 22px 0 7px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: 30px; letter-spacing: 0; }
h2 { margin: 3px 0 0; font-size: 24px; }
h3 { margin-bottom: 5px; font-size: 19px; }
.login-copy, .section-heading p { color: var(--muted); }
.form-stack, .form-grid { display: grid; gap: 16px; }
.form-stack { margin-top: 28px; }
label { display: grid; gap: 7px; color: #c9d6e5; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-height: 46px; padding: 0 13px; color: var(--text); border: 1px solid var(--line); border-radius: 6px; background: #07111e; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #5ba8ff20; }
.primary-button, .quiet-button, .text-button, .icon-button, .nav-item { border: 0; color: var(--text); }
.primary-button { min-height: 46px; padding: 0 18px; border-radius: 6px; background: var(--accent); color: #041426; font-weight: 800; }
.primary-button:hover { filter: brightness(1.08); }
.primary-button.compact { min-height: 40px; }
.quiet-button { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: transparent; }
.text-button { padding: 8px 0; color: var(--accent); background: transparent; font-weight: 700; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: #0b1726; font-size: 20px; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 13px; }
.app-view { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #07101bee; backdrop-filter: blur(20px); }
.brand-row { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row span { color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 5px; }
.nav-item { min-height: 46px; padding: 0 13px; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 6px; background: transparent; color: #a9b8c9; font-weight: 700; }
.nav-item span { width: 20px; color: var(--muted); font-size: 18px; text-align: center; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--accent-soft); }
.nav-item.active span { color: var(--accent); }
.sidebar-footer { margin-top: auto; display: grid; gap: 13px; }
.account-summary { padding: 11px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.account-summary strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 13px; }
.workspace { min-width: 0; }
.topbar { height: 86px; padding: 0 clamp(20px, 4vw, 54px); display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); background: #07111cb8; backdrop-filter: blur(18px); }
.topbar .eyebrow { margin: 0; }
.topbar #menuButton { display: none; }
.topbar #refreshButton { margin-left: auto; }
.page { display: none; padding: 32px clamp(20px, 4vw, 54px) 60px; }
.page.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 25px; }
.metric { min-height: 126px; padding: 19px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, #0a1727e8, #091421d9); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 16px 0 7px; font-size: 30px; }
.metric small { color: var(--green); }
.content-band { padding: 22px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading p { margin-bottom: 0; font-size: 13px; }
.page-heading { margin-bottom: 20px; }
.compact-list { margin-top: 18px; display: grid; }
.list-row { min-height: 62px; padding: 12px 4px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #16283d; }
.avatar { width: 37px; height: 37px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #061321; background: var(--accent); font-weight: 900; }
.list-main { min-width: 0; flex: 1; }
.list-main strong, .list-main span { display: block; }
.list-main span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.badge { padding: 5px 8px; border-radius: 999px; color: var(--green); background: #14362d; font-size: 11px; font-weight: 800; }
.badge.pending { color: var(--amber); background: #3c2e17; }
.badge.inactive { color: #a9b4c1; background: #212a35; }
.department-strip, .department-grid { display: grid; gap: 10px; }
.department-strip { margin-top: 18px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.department-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.department { min-height: 94px; padding: 17px; border-left: 3px solid var(--accent); background: #0a1725bf; }
.department span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.table-shell { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 12px; text-align: left; border-bottom: 1px solid #16283d; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
td { font-size: 13px; }
dialog { width: min(610px, calc(100% - 30px)); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #091523f5; box-shadow: 0 28px 100px #000b; }
dialog::backdrop { background: #02060bc4; backdrop-filter: blur(10px); }
.dialog-body { padding: 25px; }
.form-grid { grid-template-columns: 1fr 1fr; margin: 23px 0 6px; }
.form-grid .wide { grid-column: 1 / -1; }
.code-result { text-align: center; }
.code-result .eyebrow { margin-top: 0; }
.code-box { margin: 22px 0; padding: 15px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--accent); border-radius: 6px; background: #06101d; }
.code-box code { min-width: 0; flex: 1; color: var(--accent); overflow-wrap: anywhere; font-size: 15px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(360px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid var(--line); border-radius: 6px; background: #102238; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: none; }
.empty { padding: 36px 5px; color: var(--muted); text-align: center; }
@media (max-width: 900px) {
    .app-view { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 10; width: 236px; transform: translateX(-102%); transition: transform .2s ease; }
    .sidebar.open { transform: none; box-shadow: 20px 0 70px #000a; }
    .topbar #menuButton { display: block; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .login-panel { padding: 28px 22px; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .metric { min-height: 108px; padding: 15px; }
    .metric strong { margin-top: 12px; font-size: 24px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .section-heading { align-items: flex-start; }
}
