:root {
    color-scheme: light;
    --chrome: #1a2942;
    --chrome-deep: #142239;
    --chrome-2: #2d3b55;
    --chrome-3: #35455f;
    --chrome-line: rgba(255, 255, 255, 0.11);
    --chrome-text: #f6f9ff;
    --chrome-muted: #8fa2bf;
    --blue: #1f6ed4;
    --blue-2: #2f8bff;
    --blue-soft: #e9f2ff;
    --workspace: #edf3f9;
    --workspace-2: #e7eef7;
    --surface: #ffffff;
    --surface-2: #f7fbff;
    --surface-3: #eef5fc;
    --field: #ffffff;
    --text: #071a31;
    --soft: #314967;
    --muted: #637c9b;
    --line: #d7e2ee;
    --line-strong: #bfd0e3;
    --green: #118a5b;
    --amber: #bd7618;
    --red: #c33737;
    --cyan: #007c9c;
    --success-soft: #e8f7ef;
    --warn-soft: #fff3df;
    --danger-soft: #ffeded;
    --info-soft: #e8f6fb;
    --shadow: 0 12px 28px rgba(22, 39, 66, 0.12);
    --shadow-high: 0 22px 58px rgba(22, 39, 66, 0.18);
    --shadow-tight: 0 6px 14px rgba(22, 39, 66, 0.12);
    --button-shadow: 0 10px 18px rgba(19, 103, 214, 0.25);
    --mono: "Cascadia Code", "Consolas", monospace;
    --display: "Segoe UI Variable Display", "Aptos Display", "Bahnschrift", sans-serif;
    --body: "Segoe UI Variable Text", "Aptos", "Segoe UI", sans-serif;
    --radius: 10px;
    --radius-sm: 7px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --workspace: #0d1421;
    --workspace-2: #101b2b;
    --surface: #141f31;
    --surface-2: #18263a;
    --surface-3: #1e3048;
    --field: #101b2b;
    --text: #f3f7ff;
    --soft: #c7d5e8;
    --muted: #8da2bd;
    --line: #263a55;
    --line-strong: #38516f;
    --blue-soft: rgba(47, 139, 255, 0.16);
    --success-soft: rgba(17, 138, 91, 0.18);
    --warn-soft: rgba(189, 118, 24, 0.18);
    --danger-soft: rgba(195, 55, 55, 0.18);
    --info-soft: rgba(0, 124, 156, 0.18);
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
    --shadow-high: 0 24px 70px rgba(0, 0, 0, 0.34);
    --shadow-tight: 0 8px 18px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at 76% 10%, rgba(31, 110, 212, 0.12), transparent 27rem),
        linear-gradient(180deg, var(--workspace), var(--workspace-2));
    color: var(--text);
    font-family: var(--body);
    font-size: 14px;
    margin: 0;
    min-height: 100vh;
}

::selection {
    background: var(--blue);
    color: #ffffff;
}

a {
    color: var(--blue);
}

.app-frame {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.side-rail {
    background: linear-gradient(180deg, var(--chrome), var(--chrome-deep));
    border-right: 1px solid var(--chrome-line);
    box-shadow: 10px 0 34px rgba(10, 19, 33, 0.18);
    color: var(--chrome-text);
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 100vh;
    padding: 12px 12px 14px;
    position: sticky;
    top: 0;
}

.brand {
    align-items: center;
    color: var(--chrome-text);
    display: flex;
    gap: 10px;
    min-height: 44px;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, #1a78ff, #2361c8);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 8px 20px rgba(23, 103, 220, 0.35);
    color: #ffffff;
    display: inline-flex;
    font-family: var(--display);
    font-size: 17px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    letter-spacing: -0.08em;
    width: 34px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.brand small {
    color: var(--chrome-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-top: 2px;
    text-transform: uppercase;
}

.rail-cta {
    align-items: center;
    background: linear-gradient(135deg, #2071db, #1e63c4);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 24px rgba(5, 23, 57, 0.2);
    color: #ffffff;
    display: flex;
    font-weight: 900;
    gap: 10px;
    margin: 16px 0 14px;
    min-height: 48px;
    padding: 0 12px;
    text-decoration: none;
}

.rail-cta span {
    align-items: center;
    background: rgba(255, 255, 255, 0.13);
    border-radius: 7px;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.nav {
    align-content: start;
    display: grid;
    gap: 6px;
}

.nav-kicker {
    color: var(--chrome-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    padding: 0 7px 7px;
    text-transform: uppercase;
}

.nav-divider {
    border-top: 1px solid var(--chrome-line);
    margin: 16px 0 12px;
}

.rail-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #d6e1f2;
    display: grid;
    font-weight: 800;
    gap: 11px;
    grid-template-columns: 29px minmax(0, 1fr);
    min-height: 42px;
    padding: 0 9px;
    text-decoration: none;
}

.rail-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    color: #b5c6df;
    display: inline-flex;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    height: 29px;
    justify-content: center;
    width: 29px;
}

.icon-svg {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.icon-svg svg {
    fill: none;
    height: 17px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.85;
    width: 17px;
}

.rail-icon .icon-svg svg {
    height: 16px;
    width: 16px;
}

.rail-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.rail-link.active {
    background: #1f6ed4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 18px rgba(16, 69, 155, 0.24);
    color: #ffffff;
}

.rail-link.active .rail-icon {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.rail-footer {
    border-top: 1px solid var(--chrome-line);
    color: var(--chrome-muted);
    display: grid;
    font-size: 11px;
    gap: 4px;
    justify-items: center;
    padding-top: 14px;
    text-align: center;
}

.rail-footer strong {
    color: #6f83a3;
    font-weight: 700;
}

.main-stage {
    min-width: 0;
}

.command-bar {
    align-items: center;
    background: var(--chrome);
    border-bottom: 1px solid var(--chrome-line);
    box-shadow: 0 5px 18px rgba(12, 22, 38, 0.2);
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(280px, 360px) minmax(380px, 1fr) max-content;
    min-height: 60px;
    padding: 10px 18px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.global-search {
    position: relative;
}

.global-search span {
    color: #b9c7dc;
    font-size: 12px;
    font-weight: 900;
    left: 14px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.global-search input {
    background: var(--chrome-2);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: #ffffff;
    min-height: 38px;
    padding: 9px 12px 9px 70px;
    width: 100%;
}

.global-search input::placeholder {
    color: #a7b5cb;
}

.toolbar-filters {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(135px, 1fr));
}

.toolbar-filters label span {
    display: none;
}

.toolbar-filters select {
    background: var(--chrome-2);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    min-height: 36px;
    padding: 0 12px;
    width: 100%;
}

.command-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
}

.top-button {
    align-items: center;
    background: var(--chrome-2);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    gap: 7px;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    text-decoration: none;
    white-space: nowrap;
}

.top-button:hover {
    background: var(--chrome-3);
}

.top-button.primary {
    background: linear-gradient(135deg, #247af0, #176bd4);
    border-color: rgba(72, 153, 255, 0.55);
    box-shadow: var(--button-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.theme-toggle-orb {
    background: linear-gradient(135deg, #ffe8a9, #ffffff);
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(255, 230, 142, 0.52);
    display: inline-block;
    height: 15px;
    width: 15px;
}

html[data-theme="dark"] .theme-toggle-orb {
    background: linear-gradient(135deg, #85d5ff, #385c94);
    box-shadow: 0 0 12px rgba(109, 195, 255, 0.48);
}

.reports-menu,
.user-menu {
    position: relative;
}

.reports-menu summary,
.user-menu summary {
    list-style: none;
}

.reports-menu summary::-webkit-details-marker,
.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-chip {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    display: grid;
    gap: 9px;
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 40px;
    padding: 3px 12px 3px 4px;
    width: 205px;
}

.user-menu[open] .user-chip,
.user-chip:hover {
    background: var(--chrome-3);
}

.user-avatar {
    align-items: center;
    background: linear-gradient(135deg, #247af0, #176bd4);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.user-label {
    min-width: 0;
}

.user-label strong,
.user-label small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-label strong {
    font-size: 13px;
    line-height: 1.1;
}

.user-label small {
    color: #a7b5cb;
    font-size: 11px;
    line-height: 1.2;
    margin-top: 2px;
}

.reports-panel,
.user-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-high);
    color: var(--text);
    display: grid;
    gap: 12px;
    padding: 16px 12px;
    position: absolute;
    right: 0;
    top: 46px;
    width: 360px;
    z-index: 50;
}

.user-panel {
    gap: 8px;
    padding: 12px;
    width: 368px;
}

.reports-panel > div + div {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.report-kicker {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.16em;
    margin: 0 0 9px;
    padding: 0 10px;
    text-transform: uppercase;
}

.reports-panel a,
.user-panel a,
.menu-theme-button {
    align-items: start;
    border-radius: 8px;
    color: var(--text);
    display: grid;
    gap: 11px;
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 11px 12px;
    text-decoration: none;
}

.menu-separator {
    background: var(--line);
    display: block;
    height: 1px;
    margin: 4px 6px;
}

.menu-theme-button {
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
    width: 100%;
}

.reports-panel a:hover,
.user-panel a:hover,
.menu-theme-button:hover {
    background: var(--surface-3);
}

.reports-panel a span,
.user-panel a span,
.menu-theme-button > span {
    align-items: center;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--blue);
    display: inline-flex;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 900;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.reports-panel a > span,
.user-panel a > span,
.menu-theme-button > span {
    grid-row: 1 / span 2;
}

.menu-icon {
    align-items: center;
    justify-content: center;
}

.menu-icon .icon-svg svg {
    height: 18px;
    width: 18px;
}

.menu-theme-button .theme-toggle-orb {
    background: linear-gradient(135deg, #ffe8a9, #ffffff);
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(255, 230, 142, 0.52);
    height: 18px;
    justify-self: center;
    width: 18px;
}

html[data-theme="dark"] .menu-theme-button .theme-toggle-orb {
    background: linear-gradient(135deg, #85d5ff, #385c94);
    box-shadow: 0 0 12px rgba(109, 195, 255, 0.48);
}

.reports-panel strong,
.reports-panel small,
.user-panel strong,
.user-panel small,
.menu-theme-button strong,
.menu-theme-button small {
    display: block;
}

.reports-panel strong,
.user-panel strong,
.menu-theme-button strong {
    font-size: 15px;
    grid-column: 2;
    line-height: 1.2;
}

.reports-panel small,
.user-panel small,
.menu-theme-button small {
    color: var(--soft);
    font-size: 13px;
    grid-column: 2;
    line-height: 1.3;
    margin-top: 3px;
}

.shell {
    margin: 0;
    max-width: none;
    padding: 0;
}

.notice {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-tight);
    margin: 18px 22px 0;
    padding: 13px 15px;
}

.notice-error {
    background: var(--danger-soft);
    border: 1px solid rgba(195, 55, 55, 0.28);
    color: var(--red);
}

.notice-success {
    background: var(--success-soft);
    border: 1px solid rgba(17, 138, 91, 0.24);
    color: var(--green);
}

.notice-warning {
    background: var(--warn-soft);
    border: 1px solid rgba(189, 118, 24, 0.28);
    color: var(--amber);
}

.page-heading {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 18px rgba(22, 39, 66, 0.06);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin: 0;
    min-height: 72px;
    padding: 14px 22px;
}

.page-heading-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.page-heading-actions .search-form {
    min-width: min(420px, 100%);
}

.page-heading h1 {
    font-family: var(--display);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}

.page-heading .lede {
    color: #426a98;
    font-size: 13px;
    line-height: 1.35;
    margin: 6px 0 0;
}

html[data-theme="dark"] .page-heading .lede {
    color: var(--muted);
}

.worksheet-heading {
    min-height: 72px;
}

.count-badge {
    align-items: center;
    background: var(--blue-soft);
    border: 1px solid #bfd6ff;
    border-radius: 999px;
    color: #075bc1;
    display: inline-flex;
    font-weight: 900;
    min-height: 30px;
    padding: 0 13px;
    white-space: nowrap;
}

html[data-theme="dark"] .count-badge {
    border-color: var(--line-strong);
    color: #8ec3ff;
}

.hero-panel,
.panel,
.status-card,
.metric,
.table-panel,
.ops-strip article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-panel,
.panel {
    margin: 22px;
    padding: 22px;
}

.hero-panel {
    align-items: stretch;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.hero-panel h1 {
    font-family: var(--display);
    font-size: clamp(30px, 3vw, 44px);
    letter-spacing: -0.05em;
    line-height: 1;
    margin: 0;
}

.hero-panel .lede,
.panel p {
    color: var(--muted);
}

.eyebrow {
    color: #4f739b;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.panel h1,
.panel h2 {
    margin-top: 0;
}

.panel h2 {
    font-family: var(--display);
    font-size: 22px;
    letter-spacing: -0.03em;
}

.panel-accent {
    border-color: rgba(189, 118, 24, 0.34);
    box-shadow: inset 0 3px 0 var(--amber), var(--shadow);
}

.narrow {
    margin: 30px auto;
    max-width: 560px;
}

.status-card {
    align-content: center;
    display: grid;
    gap: 7px;
    margin: 0;
    min-height: 160px;
    padding: 20px;
}

.status-card span {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-card strong {
    color: var(--text);
    font-family: var(--display);
    font-size: 30px;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.status-card small {
    color: var(--muted);
}

.status-ok {
    box-shadow: inset 0 4px 0 var(--green), var(--shadow);
}

.status-warn {
    box-shadow: inset 0 4px 0 var(--amber), var(--shadow);
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 18px 22px;
}

.metric {
    min-height: 108px;
    padding: 16px;
}

.metric span,
.ops-strip span {
    color: var(--muted);
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.metric strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 30px;
}

.ops-strip {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 18px 22px;
}

.ops-strip article {
    min-height: 112px;
    padding: 16px;
}

.ops-strip strong {
    display: block;
    font-family: var(--display);
    font-size: 23px;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.ops-strip small {
    color: var(--muted);
    display: block;
    margin-top: 8px;
}

.command-grid,
.two-column {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 18px 22px;
}

.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-column .panel,
.command-grid .panel {
    margin: 0;
}

.settings-grid,
.admin-split {
    display: grid;
    gap: 16px;
    margin: 18px 22px;
}

.settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    display: grid;
    gap: 14px;
    grid-template-columns: 44px minmax(0, 1fr);
    min-height: 188px;
    padding: 22px;
    text-decoration: none;
}

.settings-card:hover {
    border-color: rgba(31, 110, 212, 0.28);
    box-shadow: 0 18px 34px rgba(22, 39, 66, 0.12);
    transform: translateY(-1px);
}

.settings-card-icon {
    align-items: center;
    background: var(--blue-soft);
    border: 1px solid #bfd6ff;
    border-radius: 12px;
    color: var(--blue);
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.settings-card-icon .icon-svg svg {
    height: 20px;
    width: 20px;
}

.settings-card-copy h2,
.settings-card-copy p,
.settings-card-copy small {
    margin: 0;
}

.settings-card-copy h2 {
    font-family: var(--display);
    font-size: 20px;
    letter-spacing: -0.03em;
}

.settings-card-copy p {
    color: var(--soft);
    line-height: 1.5;
}

.settings-card-copy small {
    color: var(--muted);
    display: block;
    margin-top: 8px;
}

.admin-split {
    align-items: start;
    grid-template-columns: minmax(0, 1.42fr) minmax(320px, 0.58fr);
}

.admin-table-panel {
    margin: 0;
}

.company-editor {
    margin: 0;
    overflow: hidden;
    position: sticky;
    top: 78px;
}

.company-editor-form {
    margin-top: 0;
    padding: 18px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 850;
    gap: 7px;
}

input,
select,
textarea {
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
}

input[type="search"] {
    min-width: 0;
}

textarea {
    min-height: 120px;
    padding: 11px 12px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #7d91aa;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(31, 110, 212, 0.14);
    outline: 0;
}

.search-form {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) auto;
}

.button {
    align-items: center;
    background: linear-gradient(135deg, #247af0, #176bd4);
    border: 1px solid rgba(31, 110, 212, 0.42);
    border-radius: var(--radius-sm);
    box-shadow: var(--button-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    text-decoration: none;
}

.button:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.button.secondary {
    background: var(--surface-2);
    border-color: var(--line);
    box-shadow: var(--shadow-tight);
    color: var(--text);
}

.button.compact {
    min-height: 32px;
    padding: 0 15px;
}

.text-link {
    color: var(--blue);
    font-weight: 900;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.debug-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    overflow: auto;
    padding: 18px;
}

.drawer-layer {
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 180ms ease;
    z-index: 80;
}

.drawer-layer:target {
    opacity: 1;
    pointer-events: auto;
}

.drawer-backdrop {
    backdrop-filter: blur(8px);
    background: rgba(16, 26, 41, 0.48);
    inset: 0;
    position: absolute;
}

.person-drawer {
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -28px 0 70px rgba(8, 17, 31, 0.28);
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    max-width: 920px;
    overflow-y: auto;
    padding: 0 22px 28px;
    position: absolute;
    right: 0;
    top: 0;
    transform: translateX(24px);
    transition: transform 180ms ease;
    width: min(48vw, 920px);
}

.drawer-layer:target .person-drawer {
    transform: translateX(0);
}

.drawer-header {
    align-items: start;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin: 0 -22px 14px;
    padding: 18px 22px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.drawer-header h2 {
    font-family: var(--display);
    font-size: 21px;
    letter-spacing: -0.03em;
    margin: 0;
}

.drawer-close {
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-tight);
    color: var(--soft);
    display: inline-flex;
    font-size: 18px;
    height: 32px;
    justify-content: center;
    text-decoration: none;
    width: 32px;
}

.drawer-form {
    display: grid;
    gap: 14px;
}

.drawer-card {
    background: var(--blue-soft);
    border: 1px solid #acd0ff;
    border-left: 3px solid var(--blue);
    border-radius: 11px;
    display: grid;
    gap: 13px;
    padding: 14px;
}

html[data-theme="dark"] .drawer-card {
    border-color: var(--line-strong);
}

.drawer-card-soft {
    background: var(--success-soft);
    border-color: rgba(17, 138, 91, 0.24);
    border-left-color: var(--green);
}

.drawer-card-title {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.drawer-card-title strong {
    color: var(--blue);
    font-size: 16px;
    font-weight: 900;
}

.drawer-card-title span {
    color: var(--muted);
    font-size: 12px;
}

.drawer-card p {
    color: var(--soft);
    line-height: 1.5;
    margin: 0;
}

.drawer-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-panel {
    margin: 18px 22px;
    overflow-x: auto;
}

.table-heading {
    align-items: center;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 14px 18px;
}

.table-heading h2 {
    font-family: var(--display);
    font-size: 19px;
    letter-spacing: -0.03em;
    margin: 0;
}

.table-heading .eyebrow {
    margin-bottom: 5px;
}

.subtle {
    color: var(--muted);
    font-size: 13px;
}

.spaced {
    margin-top: 18px;
}

table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 880px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    line-height: 1.42;
    padding: 12px 18px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-2);
    box-shadow: 0 4px 12px rgba(22, 39, 66, 0.07);
    color: #547191;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    position: static;
    text-transform: uppercase;
    white-space: nowrap;
}

html[data-theme="dark"] th {
    color: var(--muted);
}

td {
    background: var(--surface);
    color: var(--soft);
}

tbody tr:nth-child(even) td {
    background: var(--surface-2);
}

tbody tr:hover td {
    background: var(--blue-soft);
}

td strong {
    color: var(--text);
}

td small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

tr:last-child td {
    border-bottom: 0;
}

.row-link {
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.row-link:hover {
    color: var(--blue);
}

.mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.mini-stats span {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 13px;
}

.inline-action {
    margin-top: 22px;
}

.pill {
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--soft);
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    margin: 2px 4px 2px 0;
    padding: 6px 10px;
}

.pill-warning {
    background: var(--warn-soft);
    border-color: rgba(189, 118, 24, 0.26);
    color: var(--amber);
}

.pill-error {
    background: var(--danger-soft);
    border-color: rgba(195, 55, 55, 0.26);
    color: var(--red);
}

.pill-ok {
    background: var(--success-soft);
    border-color: rgba(17, 138, 91, 0.24);
    color: var(--green);
}

.pill-muted {
    background: var(--surface-3);
    color: var(--muted);
}

.pill-info {
    background: var(--info-soft);
    border-color: rgba(0, 124, 156, 0.24);
    color: var(--cyan);
}

.record-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.42fr) minmax(280px, 0.58fr);
    margin: 18px 22px;
}

.record-layout .panel {
    margin: 0;
}

.detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-list div {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
    grid-template-columns: 132px minmax(0, 1fr);
    padding-bottom: 12px;
}

.detail-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.detail-list dd {
    color: var(--soft);
    margin: 0;
    overflow-wrap: anywhere;
}

.summary-stack {
    display: grid;
    gap: 10px;
}

.summary-stack span {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 14px;
}

.summary-stack strong {
    color: var(--blue);
    font-family: var(--mono);
    font-size: 24px;
    margin-right: 8px;
}

.workspace-grid {
    display: grid;
    align-items: start;
    gap: 16px;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
    margin: 18px 22px;
}

.workspace-grid-stats {
    grid-template-columns: minmax(0, 1.72fr) minmax(240px, 0.48fr);
}

.workspace-main,
.workspace-side,
.workspace-list-body,
.site-rollup-list,
.credential-stack {
    display: grid;
    gap: 16px;
}

.workspace-side {
    align-content: start;
}

.workspace-stat-stack {
    display: grid;
    gap: 14px;
    position: sticky;
    top: 80px;
}

.workspace-metrics {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-metric,
.site-rollup,
.credential-card,
.system-card,
.workspace-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-tight);
}

.workspace-metric {
    min-height: 106px;
    padding: 16px;
}

.workspace-metric span,
.compact-detail dt {
    color: var(--muted);
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.workspace-metric strong {
    color: var(--text);
    display: block;
    font-family: var(--display);
    font-size: 30px;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-top: 12px;
}

.workspace-metric small {
    color: var(--muted);
    display: block;
    margin-top: 8px;
}

.workspace-list {
    margin: 0;
    overflow: hidden;
    padding: 0;
}

.workspace-band {
    margin: 0;
    overflow: hidden;
    padding: 0;
}

.workspace-band-body {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.workspace-list-body {
    padding: 18px;
}

.workspace-item,
.system-card {
    background: var(--surface-2);
    display: grid;
    gap: 12px;
    padding: 16px;
}

.workspace-item-head {
    align-items: start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.workspace-item h3,
.system-card h3 {
    font-family: var(--display);
    font-size: 20px;
    letter-spacing: -0.03em;
    margin: 0;
}

.workspace-meta {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    margin: 6px 0 0;
}

.workspace-columns {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.92fr);
    margin-top: 14px;
}

.rollup-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px;
}

.compact-detail {
    display: grid;
    gap: 12px;
    margin: 0;
}

.compact-detail div {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 6px;
    padding-bottom: 12px;
}

.compact-detail div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.compact-detail dd {
    color: var(--soft);
    margin: 0;
    overflow-wrap: anywhere;
}

.credential-card {
    padding: 12px 14px;
}

.credential-card strong,
.credential-card small,
.secret-value {
    display: block;
}

.credential-card strong {
    color: var(--text);
    font-size: 14px;
}

.credential-card small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    margin-top: 4px;
}

.secret-value {
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 10px;
    overflow-wrap: anywhere;
}

.site-rollup {
    color: inherit;
    display: block;
    padding: 14px;
    text-decoration: none;
}

.site-rollup.static {
    text-decoration: none;
}

.site-rollup:hover {
    border-color: rgba(31, 110, 212, 0.34);
    box-shadow: 0 12px 28px rgba(22, 39, 66, 0.1);
    transform: translateY(-1px);
}

.site-rollup strong,
.site-rollup small,
.site-rollup span {
    display: block;
}

.site-rollup strong {
    color: var(--text);
    font-size: 14px;
}

.site-rollup small,
.site-rollup span {
    color: var(--muted);
    line-height: 1.35;
    margin-top: 5px;
}

.detail-grid {
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid div {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr;
    padding: 12px 14px;
}

.detail-grid div:last-child {
    padding-bottom: 12px;
}

.workspace-table-panel {
    margin: 0;
}

.compact-table {
    min-width: 0;
    table-layout: fixed;
}

.compact-table th,
.compact-table td {
    padding: 11px 14px;
}

.compact-table td {
    overflow-wrap: anywhere;
}

.compact-table td .pill + .pill {
    margin-left: 4px;
}

.credential-inline {
    display: grid;
    gap: 6px;
}

.credential-inline span {
    color: var(--text);
    display: block;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.45;
}

.system-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px;
}

.system-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.workspace-empty {
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    color: var(--muted);
    padding: 22px;
}

.workspace-empty.tight {
    padding: 14px;
}

.note-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--soft);
    margin-top: 18px;
    padding: 14px;
}

.check-list {
    color: var(--soft);
    display: grid;
    gap: 9px;
    margin: 18px 0 0;
    padding-left: 20px;
}

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

@media (max-width: 1240px) {
    .command-bar {
        grid-template-columns: minmax(230px, 1fr) minmax(280px, 1fr);
    }

    .command-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .reports-panel,
    .user-panel {
        left: 0;
        right: auto;
        width: min(90vw, 390px);
    }
}

@media (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ops-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rollup-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .side-rail {
        min-height: auto;
        position: relative;
    }

    .nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nav-kicker,
    .nav-divider,
    .rail-footer {
        display: none;
    }

    .hero-panel,
    .record-layout,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .admin-split {
        grid-template-columns: 1fr;
    }

    .command-bar {
        position: relative;
    }

    .person-drawer {
        max-width: none;
        width: min(720px, 92vw);
    }

    .system-grid {
        grid-template-columns: 1fr;
    }

    .workspace-stat-stack {
        position: static;
    }

    .company-editor {
        position: static;
    }
}

@media (max-width: 760px) {
    .command-bar {
        grid-template-columns: 1fr;
    }

    .toolbar-filters {
        grid-template-columns: 1fr;
    }

    .command-actions {
        justify-content: stretch;
    }

    .top-button,
    .reports-menu,
    .user-menu {
        flex: 1 1 auto;
    }

    .user-chip {
        width: 100%;
    }

    .reports-panel,
    .user-panel {
        left: 0;
        right: auto;
        width: min(94vw, 360px);
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .person-drawer {
        width: 100vw;
    }

    .drawer-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .ops-strip,
    .command-grid,
    .two-column,
    .settings-grid,
    .workspace-metrics,
    .workspace-columns,
    .rollup-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .nav {
        grid-template-columns: 1fr 1fr;
    }

    .search-form,
    .detail-list div {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 760px;
    }
}
