: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); }
body.menu-open { overflow: hidden; }
body.admin-booting #loginView { visibility: hidden; }
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; }
.compact-form-stack { margin-top: 18px; }
.login-links { margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; }
.consent-panel { width: min(560px, 100%); }
.mfa-panel { width: min(620px, 100%); }
.mfa-enrollment { margin-top: 22px; display: grid; grid-template-columns: minmax(180px, 220px) 1fr; align-items: center; gap: 22px; }
.mfa-qr { width: 100%; aspect-ratio: 1; padding: 10px; border-radius: 6px; background: #fff; }
.mfa-secret { min-width: 0; padding: 11px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: #06101d; }
.mfa-secret code { min-width: 0; flex: 1; color: var(--accent); overflow-wrap: anywhere; font-size: 13px; }
.consent-summary { margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.equal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.equal-actions .quiet-button { min-height: 46px; }
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[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--accent); }
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; }
.forgot-password-button { justify-self: start; margin-top: -10px; padding: 0; font-size: 13px; }
.forgot-password-button:disabled { cursor: wait; opacity: .65; }
.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); }
.sidebar-backdrop { position: fixed; z-index: 9; inset: 0; display: none; padding: 0; border: 0; background: #01050a99; backdrop-filter: blur(3px); }
.sidebar-backdrop.visible { display: block; }
.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-link { text-decoration: none; }
.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; }
.sidebar-legal { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 0 12px; font-size: 11px; }
.sidebar-legal a { color: var(--muted); }
.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; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.row-action { white-space: nowrap; }
.danger-text { color: var(--danger); }
.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; }
.badge.error { color: #ff9b9b; background: #3d2026; }
.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-shell { max-width: 100%; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
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; }
.table-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.temporary-employee-groups:empty { display: none; }
.temporary-employee-groups { display: grid; gap: 16px; margin-bottom: 24px; }
.temporary-group-card { overflow: hidden; border: 1px solid #3f5268; border-radius: 8px; background: #0a1725bf; }
.temporary-group-card .table-shell { border-top-color: #3f5268; }
.temporary-group-heading { padding: 17px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.temporary-group-heading h3 { margin: 8px 0 3px; }
.temporary-group-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.temporary-group-delete { flex: 0 0 auto; color: var(--danger); border-color: #6d3542; }
.employee-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.permission-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.permission-panel legend { padding: 0 6px; color: var(--text); font-size: 13px; font-weight: 800; }
.permission-panel .checkbox-label { min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #28445e; border-radius: 8px; background: #0a1927; }
.permission-panel small { grid-column: 1 / -1; color: var(--muted); line-height: 1.45; }
.details-cell { min-width: 220px; max-width: 420px; white-space: normal; overflow-wrap: anywhere; }
.status-select { min-width: 175px; }
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; }
.checkbox-label { grid-template-columns: 22px 1fr; align-items: center; }
.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: min(320px, calc(100vw - 48px)); height: 100vh; height: 100dvh; padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; transform: translateX(-102%); transition: transform .2s ease; }
    .sidebar.open { transform: none; box-shadow: 20px 0 70px #000a; }
    .sidebar-footer { margin-top: 28px; }
    .brand-row { padding-bottom: 20px; }
    .nav-item { min-height: 50px; }
    .topbar { position: sticky; z-index: 8; top: 0; height: 72px; padding: 0 18px; }
    .topbar #menuButton { display: block; }
    .topbar h2 { max-width: 55vw; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .page { padding: 24px 18px 48px; }
}
@media (max-width: 560px) {
    .permission-panel { grid-template-columns: 1fr; }
    .permission-panel small { grid-column: auto; }
    .login-view { align-items: start; padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)); }
    .login-panel { padding: 26px 18px; }
    .login-panel h1 { font-size: 26px; }
    .metrics { grid-template-columns: 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; }
    .page { padding: 20px 14px 42px; }
    .section-heading { align-items: stretch; flex-direction: column; }
    .section-heading > button, .section-heading > .primary-button { width: 100%; }
    .temporary-group-heading { align-items: stretch; flex-direction: column; }
    .temporary-group-delete { width: 100%; min-height: 46px; }
    .list-row { align-items: flex-start; flex-wrap: wrap; }
    .row-actions { width: 100%; justify-content: stretch; }
    .row-actions > * { flex: 1; }
    .department-grid { grid-template-columns: 1fr; }
    .table-shell { margin-inline: -14px; padding-inline: 14px; }
    table { min-width: 720px; }
    th, td { padding: 13px 10px; }
    dialog { width: calc(100% - 20px); max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
    .dialog-body { padding: 19px 16px calc(19px + env(safe-area-inset-bottom)); }
    .dialog-body .section-heading { flex-direction: row; }
    .dialog-body .section-heading > button { width: 40px; flex: 0 0 40px; }
    .equal-actions { grid-template-columns: 1fr; }
    .toast { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; max-width: none; }
    .mfa-enrollment { grid-template-columns: 1fr; }
    .mfa-qr { width: min(220px, 100%); margin: 0 auto; }
}
