:root,
html[data-theme="light"] {
    color-scheme: light;
    --page: #f4f7f7;
    --surface: #ffffff;
    --surface-soft: #eef3f4;
    --surface-raised: #ffffff;
    --ink: #172b34;
    --ink-soft: #536b75;
    --ink-faint: #71858d;
    --line: #dbe4e6;
    --line-strong: #c7d4d8;
    --brand: #173c4a;
    --brand-strong: #225f78;
    --brand-wash: #e7f0f3;
    --success: #287a54;
    --success-wash: #e8f4ed;
    --warning: #8d651a;
    --warning-wash: #fbf2dc;
    --danger: #a13e3e;
    --danger-wash: #faeeee;
    --shadow: 0 14px 38px rgba(23, 43, 52, .07);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page: #111c22;
    --surface: #192831;
    --surface-soft: #20333d;
    --surface-raised: #1c2d36;
    --ink: #eef4f5;
    --ink-soft: #b2c2c7;
    --ink-faint: #8ca1a8;
    --line: #30464f;
    --line-strong: #46616b;
    --brand: #b1d7e2;
    --brand-strong: #7ebbd0;
    --brand-wash: #203d49;
    --success: #8bd1aa;
    --success-wash: #1e3a2d;
    --warning: #f0cb77;
    --warning-wash: #3d3421;
    --danger: #f0a5a5;
    --danger-wash: #402929;
    --shadow: 0 14px 38px rgba(0, 0, 0, .22);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        color-scheme: dark;
        --page: #111c22;
        --surface: #192831;
        --surface-soft: #20333d;
        --surface-raised: #1c2d36;
        --ink: #eef4f5;
        --ink-soft: #b2c2c7;
        --ink-faint: #8ca1a8;
        --line: #30464f;
        --line-strong: #46616b;
        --brand: #b1d7e2;
        --brand-strong: #7ebbd0;
        --brand-wash: #203d49;
        --success: #8bd1aa;
        --success-wash: #1e3a2d;
        --warning: #f0cb77;
        --warning-wash: #3d3421;
        --danger: #f0a5a5;
        --danger-wash: #402929;
        --shadow: 0 14px 38px rgba(0, 0, 0, .22);
    }
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }

body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #5ba7c0; outline-offset: 3px; }

.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;
}

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 258px;
    flex-direction: column;
    padding: 25px 18px 18px;
    border-right: 1px solid var(--line);
    background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 2px 5px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px 11px 11px 4px; color: #fff; background: #1d6078; font-size: 20px; font-weight: 750; letter-spacing: -.06em; }
.brand-copy { display: grid; line-height: 1.25; }
.brand-name { font-size: 16px; font-weight: 730; letter-spacing: -.025em; }
.brand-caption { margin-top: 3px; color: var(--ink-faint); font-size: 11px; }
.nav-list { display: flex; flex: 1; flex-direction: column; gap: 5px; padding-top: 37px; }
.nav-label { padding: 0 11px 7px; color: var(--ink-faint); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.nav-label-spaced { margin-top: 25px; }
.nav-link { display: flex; width: 100%; align-items: center; gap: 12px; min-height: 42px; padding: 9px 11px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 13px; font-weight: 560; text-align: left; text-decoration: none; cursor: pointer; }
.nav-link:hover { color: var(--ink); background: var(--surface-soft); }
.nav-link.is-current { color: var(--brand-strong); background: var(--brand-wash); font-weight: 680; }
.nav-symbol { display: inline-grid; width: 19px; place-items: center; color: var(--ink-faint); font-size: 17px; }
.nav-link.is-current .nav-symbol { color: var(--brand-strong); }
.sidebar-bottom { padding-top: 15px; border-top: 1px solid var(--line); }
.profile-link { display: flex; align-items: center; gap: 10px; padding: 8px 7px 13px; text-decoration: none; }
.profile-avatar { display: grid; width: 33px; height: 33px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--brand-strong); background: var(--brand-wash); font-size: 13px; font-weight: 700; }
.profile-copy { display: grid; min-width: 0; line-height: 1.3; }
.profile-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy span { margin-top: 4px; color: var(--ink-faint); font-size: 11px; }
.nav-logout { color: var(--ink-faint); }

.main-column { min-height: 100vh; margin-left: 258px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 43px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.topbar-label { color: var(--ink-soft); font-size: 12px; font-weight: 580; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); background: var(--surface-soft); }
.theme-toggle[aria-pressed="true"] { color: var(--brand-strong); background: var(--brand-wash); }
.theme-toggle:disabled { opacity: .65; cursor: wait; }
.topbar-user { padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink-soft); font-size: 11px; }
.menu-toggle { display: none; border: 0; color: var(--ink); background: transparent; font-size: 20px; cursor: pointer; }
.page-content { width: min(1160px, 100%); margin: 0 auto; padding: 38px 43px 64px; }
.page-heading { display: flex; min-height: 94px; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-kicker, .panel-eyebrow, .story-label { margin: 0 0 8px; color: var(--brand-strong); font-size: 11px; font-weight: 740; letter-spacing: .045em; }
h1, h2, p { margin-top: 0; }
.page-heading h1 { margin: 0; font-size: clamp(24px, 3vw, 30px); font-weight: 660; letter-spacing: -.04em; line-height: 1.15; }
.page-description { max-width: 660px; margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 9px; padding-top: 13px; }
.content-panel, .metric-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.content-panel { padding: 25px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 19px; }
.metric-panel { min-height: 142px; padding: 20px 21px; }
.metric-label, .metric-note { display: block; }
.metric-label { color: var(--ink-soft); font-size: 12px; font-weight: 570; }
.metric-value { display: block; margin: 11px 0 4px; font-size: 33px; font-weight: 670; letter-spacing: -.05em; line-height: 1; }
.metric-note { color: var(--ink-faint); font-size: 11px; }
.metric-panel-accent { border-color: color-mix(in srgb, var(--brand-strong) 28%, var(--line)); background: linear-gradient(145deg, var(--surface), var(--brand-wash)); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .9fr); gap: 19px; }
.editorial-panel { min-height: 230px; padding: 29px; background: var(--surface-soft); }
.editorial-panel h2 { max-width: 620px; margin: 12px 0; font-size: clamp(20px, 2.5vw, 26px); font-weight: 620; letter-spacing: -.035em; line-height: 1.25; }
.editorial-panel p:not(.panel-eyebrow) { max-width: 600px; margin: 0; color: var(--ink-soft); font-size: 13px; }
.quick-panel h2, .account-security-panel h2 { margin: 0 0 15px; font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.shortcut-list { margin: 0; padding: 0; list-style: none; }
.shortcut-list li + li { border-top: 1px solid var(--line); }
.shortcut-list a { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; color: var(--ink-soft); font-size: 12px; text-decoration: none; }
.shortcut-list a:hover, .text-link:hover { color: var(--brand-strong); }
.employee-welcome { max-width: 770px; min-height: 225px; }
.employee-welcome .text-link { display: inline-block; margin-top: 22px; }

.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 650; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.button-primary { border-color: var(--brand-strong); color: #fff; background: #225f78; }
.button-primary:hover { border-color: #174b62; background: #174b62; }
.button-secondary { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger-quiet { padding-left: 0; border: 0; color: var(--danger); background: transparent; }
.button-danger-quiet:hover { text-decoration: underline; }
.button-wide { width: 100%; min-height: 45px; margin-top: 3px; }
.text-link { color: var(--brand-strong); font-size: 12px; font-weight: 640; text-decoration: none; }

.notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.notice p { margin: 0 0 4px; }
.notice span { display: block; }
.notice-success { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); color: var(--success); background: var(--success-wash); }
.notice-error { border-color: color-mix(in srgb, var(--danger) 36%, var(--line)); color: var(--danger); background: var(--danger-wash); }
.notice-info { border-color: color-mix(in srgb, var(--brand-strong) 35%, var(--line)); color: var(--brand-strong); background: var(--brand-wash); }

.list-panel { padding: 0; overflow: hidden; }
.filter-row { display: flex; align-items: end; gap: 9px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.filter-search { flex: 1; }
.filter-status { width: 190px; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table th { padding: 12px 16px; color: var(--ink-faint); background: var(--surface-soft); font-size: 10px; font-weight: 710; letter-spacing: .035em; white-space: nowrap; }
.data-table td { padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
.data-table td:first-child { min-width: 210px; color: var(--ink); }
.data-table td strong, .table-secondary { display: block; }
.data-table td strong { color: var(--ink); font-size: 12px; font-weight: 620; }
.table-secondary { margin-top: 3px; color: var(--ink-faint); font-size: 11px; }
.table-action { text-align: right; white-space: nowrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { padding: 3px 7px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink-soft); font-size: 10px; white-space: nowrap; }
.status-pill { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 680; white-space: nowrap; }
.status-active { color: var(--success); background: var(--success-wash); }
.status-inactive { color: var(--ink-soft); background: var(--surface-soft); }
.empty-state { display: grid; gap: 5px; justify-items: center; padding: 32px 14px; color: var(--ink-soft); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 13px; }
.empty-state span { font-size: 11px; }
.pagination-wrap { padding: 16px 20px; border-top: 1px solid var(--line); }
.pagination-wrap nav { display: flex; justify-content: flex-end; }
.pagination-wrap nav > div { display: flex; align-items: center; gap: 5px; }
.pagination-wrap a, .pagination-wrap span { min-width: 31px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-soft); font-size: 11px; text-align: center; text-decoration: none; }
.pagination-wrap [aria-current="page"] span { color: #fff; background: var(--brand-strong); }
.pagination-wrap p { margin: 0; color: var(--ink-faint); font-size: 11px; }

.form-panel { max-width: 930px; }
.narrow-panel { max-width: 690px; }
.form-stack { display: grid; gap: 18px; }
.form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .field-label, .choice-fieldset legend { color: var(--ink); font-size: 12px; font-weight: 640; }
.field input, .field select, .field textarea, .filter-row input, .filter-row select { width: 100%; min-height: 41px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: var(--surface); font-size: 12px; }
.field textarea { min-height: 78px; resize: vertical; }
.field input::placeholder, .filter-row input::placeholder { color: var(--ink-faint); }
.field-hint { color: var(--ink-faint); font-size: 11px; }
.field-error { color: var(--danger); font-size: 11px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.choice-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-fieldset legend { margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice-card, .check-card { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--brand-strong); background: var(--brand-wash); }
.choice-card input, .check-card input, .permission-line input { flex: 0 0 auto; margin: 3px 0 0; accent-color: var(--brand-strong); }
.choice-copy, .check-card span { display: grid; gap: 4px; }
.choice-copy strong, .check-card strong { font-size: 12px; font-weight: 650; }
.choice-copy span, .check-card small { color: var(--ink-faint); font-size: 10px; line-height: 1.45; }
.permission-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-card-compact { align-items: center; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.permission-group { padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.permission-group h2 { margin: 0 0 10px; font-size: 12px; font-weight: 660; }
.permission-line { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; color: var(--ink-soft); font-size: 11px; }
.permission-line + .permission-line { border-top: 1px solid var(--line); }
.readonly-value { min-height: 41px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-faint); background: var(--surface-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.account-security-panel { display: flex; max-width: 690px; align-items: center; justify-content: space-between; gap: 16px; margin-top: 17px; }
.account-security-panel h2 { margin-bottom: 3px; }
.account-security-panel p { margin: 0; color: var(--ink-faint); font-size: 11px; }
.delete-form { margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.event-name { color: var(--ink); font-size: 11px; font-weight: 620; }
.audit-details summary { color: var(--brand-strong); font-size: 11px; cursor: pointer; }
.audit-details pre { max-width: 350px; max-height: 230px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-soft); background: var(--surface-soft); font-size: 10px; white-space: pre-wrap; }

.guest-page { min-height: 100vh; background: #eaf0f1; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(320px, 1.04fr) minmax(390px, .96fr); }
.login-story { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(28px, 5vw, 68px); color: #f2f7f7; background: #173c4a; }
.login-story::after { position: absolute; right: -135px; bottom: -175px; width: 410px; height: 410px; border: 1px solid rgba(220, 240, 245, .18); border-radius: 50%; box-shadow: 0 0 0 44px rgba(220, 240, 245, .035), 0 0 0 94px rgba(220, 240, 245, .025); content: ""; }
.brand-light .brand-caption { color: #bed0d5; }
.brand-light .brand-mark { color: #173c4a; background: #c0e0e9; }
.story-content { position: relative; z-index: 1; max-width: 550px; padding: 48px 0 80px; }
.story-label { color: #b7dbe5; }
.story-content h1 { max-width: 530px; margin: 0 0 19px; font-size: clamp(32px, 4vw, 52px); font-weight: 580; letter-spacing: -.05em; line-height: 1.08; }
.story-content p:last-child { max-width: 370px; margin: 0; color: #ccdade; font-size: 14px; }
.story-index { position: relative; z-index: 1; color: #a8c0c6; font-size: 10px; font-weight: 680; letter-spacing: .07em; }
.login-panel { display: grid; place-items: center; padding: 36px; background: #f7f9f9; }
.login-form-wrap { width: min(100%, 400px); }
.login-form-wrap h2 { margin: 0; font-size: 27px; font-weight: 650; letter-spacing: -.04em; }
.form-intro { margin: 9px 0 25px; color: #5b717a; font-size: 13px; }
.login-form-wrap .notice { margin-bottom: 17px; }
.login-form-wrap .form-stack { gap: 17px; }
.login-form-wrap .field label { color: #203943; }
.login-form-wrap .field input { border-color: #ccd9dc; background: #fff; }
.check-line { display: flex; align-items: center; gap: 8px; color: #526a74; font-size: 11px; }
.check-line input { accent-color: #225f78; }
.login-footnote { margin: 22px 0 0; color: #71858d; font-size: 11px; text-align: center; }

@media (max-width: 980px) {
    .sidebar { width: 230px; }
    .main-column { margin-left: 230px; }
    .topbar { padding: 0 26px; }
    .page-content { padding-right: 26px; padding-left: 26px; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .sidebar { width: min(290px, calc(100vw - 52px)); transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
    .sidebar.is-open { transform: translateX(0); }
    .main-column { margin-left: 0; }
    .topbar { height: 56px; justify-content: flex-start; gap: 13px; padding: 0 16px; }
    .menu-toggle { display: inline-grid; width: 34px; height: 34px; place-items: center; }
    .topbar-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-user { display: none; }
    .page-content { padding: 28px 16px 48px; }
    .page-heading { min-height: 0; flex-direction: column; gap: 8px; margin-bottom: 20px; }
    .page-actions { padding-top: 0; }
    .metric-grid { grid-template-columns: 1fr; gap: 9px; }
    .metric-panel { min-height: 112px; padding: 16px; }
    .metric-value { margin-top: 8px; font-size: 29px; }
    .content-panel { padding: 19px; }
    .list-panel { padding: 0; }
    .filter-row { flex-wrap: wrap; padding: 13px; }
    .filter-search { flex-basis: 100%; }
    .filter-status { flex: 1; width: auto; }
    .form-columns, .permission-list, .permission-groups { grid-template-columns: 1fr; }
    .choice-grid { grid-template-columns: 1fr; }
    .account-security-panel { align-items: flex-start; flex-direction: column; }
    .login-shell { grid-template-columns: 1fr; }
    .login-story { display: none; }
    .login-panel { min-height: 100vh; padding: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
