/*
 * Nexus visual system
 * -------------------
 * A focused presentation layer over the application's durable layout and
 * workflow styles. Keep product-specific layout rules in app.css; keep shared
 * visual language, responsive polish, and accessibility affordances here.
 */

@font-face {
    font-family: "Manrope";
    src: url("/fonts/manrope-latin-variable.woff2") format("woff2-variations");
    font-display: swap;
    font-style: normal;
    font-weight: 200 800;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("/fonts/jetbrains-mono-latin-variable.woff2") format("woff2-variations");
    font-display: swap;
    font-style: normal;
    font-weight: 100 800;
}

:root {
    color-scheme: dark;
    --canvas: #0d100f;
    --canvas-deep: #090b0a;
    --surface: #151918;
    --surface-raised: #1b201e;
    --surface-hover: #212725;
    --surface-quiet: #111513;
    --surface-accent: #222117;
    --line: #29302d;
    --line-strong: #3b4540;
    --line-accent: #6f5a2f;
    --text: #f2f3ee;
    --text-muted: #abb2ac;
    --text-faint: #747e78;
    --accent: #d1a84f;
    --accent-strong: #ecc76e;
    --accent-soft: #8c713c;
    --accent-ink: #18150d;
    --danger: #e28a83;
    --warning: #d7ad55;
    --safe: #81c49d;
    --info: #81b4cb;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-md: 11px;
    --radius-lg: 16px;
    --control-height: 40px;
    --sidebar-width: 248px;
    --font-sans: "Manrope", "Avenir Next", ui-sans-serif, system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    --shadow-surface: 0 18px 44px rgb(2 5 4 / 22%);
    --shadow-raised: 0 24px 70px rgb(2 5 4 / 42%);
    --ring: 0 0 0 3px rgb(209 168 79 / 19%);
}

html {
    max-width: 100%;
    overflow-x: clip;
    background: var(--canvas);
    scrollbar-color: var(--line-strong) var(--canvas-deep);
    scroll-behavior: smooth;
}

body {
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 78% -20%, rgb(209 168 79 / 8%), transparent 34rem),
        radial-gradient(circle at 24% 110%, rgb(84 124 105 / 7%), transparent 42rem),
        var(--canvas);
    font-family: var(--font-sans);
    font-size: 13.5px;
    line-height: 1.55;
    letter-spacing: -.006em;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 1.4%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 1.4%) 1px, transparent 1px);
    background-size: 56px 56px;
    content: "";
    mask-image: radial-gradient(circle at 72% 18%, black, transparent 68%);
    pointer-events: none;
}

::selection {
    background: rgb(209 168 79 / 34%);
    color: var(--text);
}

h1,
h2,
h3,
h4 {
    letter-spacing: -.025em;
    text-wrap: balance;
}

h1,
h2,
h3,
p {
    text-wrap: pretty;
}

h1[id],
h2[id],
h3[id],
[id] {
    scroll-margin-top: 6rem;
}

a,
button,
summary,
label,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgb(209 168 79 / 14%);
    touch-action: manipulation;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    border-color: var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-raised);
    box-shadow: inset 0 1px rgb(255 255 255 / 3%);
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -.005em;
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease,
        transform 140ms ease;
}

@media (hover: hover) {
    button:hover,
    .button:hover {
        border-color: #59645e;
        background: var(--surface-hover);
        box-shadow: inset 0 1px rgb(255 255 255 / 5%), 0 8px 22px rgb(2 5 4 / 18%);
        transform: translateY(-1px);
    }
}

button:active,
.button:active {
    transform: translateY(0) scale(.985);
}

.button-primary {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: inset 0 1px rgb(255 255 255 / 24%), 0 9px 24px rgb(88 66 21 / 24%);
    color: var(--accent-ink);
    font-weight: 720;
}

@media (hover: hover) {
    .button-primary:hover {
        border-color: var(--accent-strong);
        background: var(--accent-strong);
        box-shadow: inset 0 1px rgb(255 255 255 / 28%), 0 12px 30px rgb(88 66 21 / 28%);
    }
}

.button-danger {
    border-color: rgb(226 138 131 / 42%);
    background: rgb(93 42 39 / 38%);
    color: #f0aaa4;
}

.text-button {
    border-radius: 0;
    box-shadow: none;
    font-weight: 560;
}

@media (hover: hover) {
    .text-button:hover {
        box-shadow: none;
        color: var(--accent-strong);
        transform: none;
    }
}

button:disabled,
.button[aria-disabled="true"] {
    box-shadow: none;
    opacity: .45;
}

:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 3px;
}

.page-header h1:focus-visible,
.workspace:focus-visible {
    outline: none;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 10px;
    left: 12px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    padding: 9px 13px;
    color: var(--accent-ink);
    font-weight: 720;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.app-frame {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    background: transparent;
}

.sidebar {
    z-index: 20;
    border-right-color: var(--line);
    background: rgb(13 17 15 / 92%);
    box-shadow: 12px 0 40px rgb(2 5 4 / 12%);
    backdrop-filter: blur(18px);
}

.brand {
    height: 76px;
    gap: 12px;
    border-bottom-color: var(--line);
    padding: 0 17px;
    font-size: inherit;
}

.brand-mark {
    display: grid;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background:
        radial-gradient(circle at 50% 20%, rgb(236 199 110 / 14%), transparent 72%),
        var(--surface-raised);
    place-items: center;
    box-shadow: inset 0 1px rgb(255 255 255 / 5%);
}

.brand img {
    width: 25px;
    height: 25px;
}

.brand-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.brand-copy strong {
    font-size: 17px;
    font-weight: 720;
    letter-spacing: -.025em;
}

.brand-copy small {
    overflow: hidden;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 520;
    letter-spacing: .08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.primary-nav {
    gap: 4px;
    overflow-y: auto;
    padding: 16px 11px 22px;
    scrollbar-width: thin;
}

.nav-group {
    gap: 3px;
    padding-bottom: 14px;
}

.nav-group + .nav-group {
    border-top-color: var(--line);
    padding-top: 14px;
}

.nav-group-label {
    padding: 0 11px 7px;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 620;
    letter-spacing: .12em;
}

.primary-nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    gap: 11px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 12.5px;
    font-weight: 560;
    transition:
        background-color 170ms ease,
        border-color 170ms ease,
        color 170ms ease,
        transform 170ms ease;
}

.nav-glyph {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: var(--text-faint);
    transition: color 170ms ease, transform 170ms ease;
}

@media (hover: hover) {
    .primary-nav a:hover {
        border-color: rgb(255 255 255 / 3%);
        background: rgb(255 255 255 / 3.5%);
        transform: translateX(2px);
    }

    .primary-nav a:hover .nav-glyph {
        color: var(--text-muted);
        transform: translateX(1px);
    }
}

.primary-nav a.active {
    border-color: rgb(209 168 79 / 19%);
    background: rgb(209 168 79 / 10%);
    box-shadow: inset 3px 0 var(--accent);
    color: var(--accent-strong);
}

.primary-nav a.active::before {
    display: none;
}

.primary-nav a.active .nav-glyph {
    color: var(--accent-strong);
}

.sidebar-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-top-color: var(--line);
    background: rgb(9 12 10 / 38%);
    padding: 15px 17px calc(17px + env(safe-area-inset-bottom));
}

.staff-identity {
    position: relative;
    grid-template-columns: 8px minmax(0, 1fr);
    column-gap: 8px;
}

.staff-presence {
    width: 7px;
    height: 7px;
    grid-row: 1 / 3;
    align-self: center;
    border-radius: 50%;
    background: var(--safe);
    box-shadow: 0 0 0 3px rgb(129 196 157 / 10%), 0 0 14px rgb(129 196 157 / 32%);
}

.staff-name,
.staff-access {
    grid-column: 2;
}

.staff-name {
    font-size: 11.5px;
    font-weight: 660;
}

.staff-access {
    font-size: 8.5px;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.sidebar-footer .text-button {
    min-height: 32px;
    padding: 6px;
    color: var(--text-faint);
    font-size: 10px;
}

.workspace {
    position: relative;
    min-height: 100dvh;
    isolation: isolate;
}

.workspace::before {
    position: fixed;
    z-index: -1;
    top: 76px;
    right: 0;
    width: min(64vw, 980px);
    height: min(55vw, 760px);
    background: radial-gradient(circle at 60% 15%, rgb(209 168 79 / 5%), transparent 68%);
    content: "";
    pointer-events: none;
}

.workspace-bar {
    z-index: 10;
    height: 76px;
    border-bottom-color: var(--line);
    background: rgb(13 16 15 / 80%);
    padding: 0 clamp(24px, 3vw, 44px);
    backdrop-filter: blur(22px) saturate(115%);
}

.workspace-product {
    display: flex;
    align-items: center;
    gap: 11px;
}

.workspace-product > span:last-child {
    display: grid;
    gap: 1px;
}

.workspace-product strong {
    color: var(--text);
    font-size: 11.5px;
    font-weight: 650;
}

.workspace-product small {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .035em;
}

.workspace-signal {
    width: 8px;
    height: 8px;
    border: 1px solid var(--accent);
    background: rgb(209 168 79 / 16%);
    box-shadow: 0 0 14px rgb(209 168 79 / 24%);
    transform: rotate(45deg);
}

.workspace-context {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 8px;
    border-left: 1px solid var(--line-strong);
    padding-left: 16px;
}

.workspace-context span {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.workspace-context strong {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 520;
}

.workspace-content {
    width: min(100%, 1580px);
    padding:
        clamp(34px, 4vw, 58px)
        clamp(24px, 4vw, 52px)
        calc(clamp(42px, 5vw, 72px) + env(safe-area-inset-bottom));
}

.page-header {
    align-items: end;
    margin-bottom: 30px;
}

.page-heading {
    position: relative;
    display: grid;
    max-width: 860px;
    gap: 0;
    padding-left: 17px;
}

.page-heading::before {
    position: absolute;
    top: .28em;
    bottom: .2em;
    left: 0;
    width: 3px;
    background: var(--accent);
    box-shadow: 0 0 18px rgb(209 168 79 / 20%);
    content: "";
}

.page-header h1 {
    font-size: clamp(32px, 3.8vw, 48px);
    font-weight: 690;
    letter-spacing: -.052em;
    line-height: .98;
}

.page-header p {
    max-width: 64ch;
    margin-top: 11px;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.page-actions,
.filter-bar {
    gap: 10px;
}

.workspace-content > .filter-bar {
    align-items: end;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 100% 0%, rgb(209 168 79 / 4%), transparent 50%),
        var(--surface-quiet);
    box-shadow: var(--shadow-surface);
    margin-bottom: 18px;
    padding: 14px;
}

.read-only-banner,
.source-banner {
    align-items: center;
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px rgb(255 255 255 / 3%);
    padding: 11px 14px;
}

.source-banner {
    border-color: rgb(209 168 79 / 34%);
    background: rgb(55 46 25 / 45%);
    color: #d8c99f;
}

.source-banner::before {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgb(209 168 79 / 36%);
    content: "";
}

.read-only-banner {
    border-color: rgb(129 180 203 / 31%);
    background: rgb(28 53 62 / 42%);
}

.metrics-grid {
    grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
    gap: 12px;
    border: 0;
    margin-bottom: 28px;
}

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

.metric-tile {
    position: relative;
    min-height: 132px;
    overflow: hidden;
    align-content: space-between;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 100% 0%, rgb(255 255 255 / 3%), transparent 52%),
        var(--surface);
    box-shadow: var(--shadow-surface);
    padding: 18px 19px;
}

.metric-tile::before {
    position: absolute;
    top: 0;
    left: 18px;
    width: 34px;
    height: 2px;
    background: var(--accent-soft);
    content: "";
}

.metrics-grid:not(.analysis-metrics) .metric-tile:first-child {
    border-color: rgb(209 168 79 / 28%);
    background:
        radial-gradient(circle at 90% 0%, rgb(209 168 79 / 11%), transparent 62%),
        var(--surface-accent);
}

.metrics-grid:not(.analysis-metrics) .metric-tile:first-child::before {
    width: 64px;
    background: var(--accent);
}

.metric-label {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: .02em;
}

.metric-context {
    color: var(--text-faint);
    font-size: 10.5px;
}

.metric-value {
    margin: 6px 0;
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 560;
    letter-spacing: -.06em;
    line-height: 1;
}

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

.analysis-metrics .metric-tile,
.analysis-metrics .metric-tile:nth-child(4n),
.analysis-metrics .metric-tile:nth-child(-n + 4) {
    border: 1px solid var(--line);
}

.content-grid {
    grid-template-columns: minmax(0, 1.72fr) minmax(300px, .72fr);
    gap: 18px;
}

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

.section-stack {
    gap: 34px;
}

.panel,
.chart {
    border-color: var(--line);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 100% 0%, rgb(255 255 255 / 2.5%), transparent 44%),
        var(--surface);
    box-shadow: var(--shadow-surface);
}

.panel {
    overflow: clip;
}

.panel-header {
    min-height: 58px;
    border-bottom-color: var(--line);
    padding: 12px 17px;
}

.panel-header h2,
.panel-header h3 {
    font-size: 13.5px;
    font-weight: 690;
    letter-spacing: -.015em;
}

.panel-header a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 620;
}

.panel-meta {
    font-size: 8.5px;
    letter-spacing: .015em;
}

.panel-body {
    padding: 17px;
}

.table-wrap,
.performance-table-wrap {
    overscroll-behavior-x: contain;
    scrollbar-color: var(--line-strong) var(--surface-quiet);
}

.data-table,
.performance-table {
    font-size: 12.5px;
}

.data-table th,
.performance-table thead th {
    height: 42px;
    border-bottom-color: var(--line-strong);
    background: rgb(8 11 9 / 19%);
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8.5px;
    font-weight: 580;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.data-table td,
.performance-table td,
.performance-table tbody th {
    height: 51px;
    border-bottom-color: var(--line);
}

.data-table tbody tr,
.performance-table tbody tr {
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th,
.performance-table tbody tr:hover td,
.performance-table tbody tr:hover th {
    background: rgb(209 168 79 / 4.5%);
}

.data-table tbody tr:hover,
.performance-table tbody tr:hover {
    box-shadow: inset 2px 0 var(--accent-soft);
}

.data-table a,
.table-primary-link,
.record-title {
    font-weight: 660;
    text-decoration-color: rgb(209 168 79 / 32%);
}

.data-table a:not(.button) {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
}

.statement-cell,
.record-meta,
.muted-value {
    color: var(--text-muted);
}

.numeric,
.identifier,
.timestamp,
.data-table td.numeric,
.performance-table tbody td {
    font-variant-numeric: tabular-nums slashed-zero;
}

.identifier {
    color: var(--text-faint);
    font-size: 10px;
}

.timestamp {
    font-size: 10.5px;
}

.status-badge {
    min-height: 21px;
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 8px;
    font-weight: 590;
    letter-spacing: .02em;
}

.status-danger {
    border-color: rgb(226 138 131 / 38%);
    background: rgb(92 40 38 / 34%);
}

.status-warning {
    border-color: rgb(209 168 79 / 38%);
    background: rgb(83 65 26 / 30%);
}

.status-safe {
    border-color: rgb(129 196 157 / 35%);
    background: rgb(35 82 56 / 29%);
}

.status-info {
    border-color: rgb(129 180 203 / 35%);
    background: rgb(34 68 82 / 30%);
}

.record-row {
    padding: 15px 17px;
    transition: background-color 150ms ease;
}

.record-row:hover {
    background: rgb(255 255 255 / 2%);
}

.chart {
    padding: 17px;
}

.chart figcaption {
    margin-bottom: 13px;
}

.chart figcaption strong {
    font-size: 13.5px;
    font-weight: 690;
}

.chart figcaption span {
    color: var(--text-muted);
    font-size: 11px;
}

.chart svg {
    height: 240px;
}

.chart-gridline {
    stroke: rgb(116 126 120 / 24%);
}

.chart-line {
    stroke: var(--accent-strong);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

.chart-point {
    fill: var(--surface);
    stroke: var(--accent-strong);
    stroke-width: 2;
}

.multi-line-series {
    stroke-width: 2.25;
}

.chart-axis,
.chart-y-scale {
    color: var(--text-faint);
    font-size: 8px;
}

.multi-line-legend {
    border-top-color: var(--line);
    gap: 8px 16px;
    padding-top: 12px;
}

.multi-line-legend span {
    font-size: 9px;
}

.multi-line-legend i {
    height: 2px;
    border-radius: 1px;
}

.distribution-bars {
    border-bottom-color: var(--line-strong);
}

.distribution-bar,
.metric-bar-track i {
    background: var(--accent);
    box-shadow: 0 0 12px rgb(209 168 79 / 12%);
}

.metric-bar-track {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--surface-hover);
}

.donut-track {
    stroke: var(--surface-hover);
}

.analysis-toolbar,
.analysis-filter-panel {
    border-color: var(--line);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 100% 0%, rgb(209 168 79 / 4%), transparent 48%),
        var(--surface-quiet);
    box-shadow: var(--shadow-surface);
}

.analysis-toolbar {
    min-height: 64px;
    padding: 13px 16px;
}

.analysis-filter-panel {
    gap: 16px;
    margin-top: -5px;
    padding: 17px;
}

.analysis-filter-grid {
    gap: 12px;
}

.analysis-scope span,
.section-kicker {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 580;
    letter-spacing: .08em;
}

.analysis-scope strong {
    font-size: 13px;
    font-weight: 660;
}

.field {
    gap: 6px;
}

.field label,
.field > span,
.workflow-form .field > span,
.auth-form label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 620;
    letter-spacing: .015em;
}

.field input,
.field select,
.auth-form input,
.workflow-form .field input,
.workflow-form .field select,
.workflow-form .field textarea,
.sidebar-control .field input,
.sidebar-control .field select,
.sidebar-control .field textarea,
.note-composer textarea,
.review-form textarea,
.staff-invite-form input,
.staff-member-form input,
.staff-member-form select,
.performance-controls select,
.matchup-class-picker select {
    min-height: var(--control-height);
    border-color: var(--line-strong);
    border-radius: var(--radius);
    background-color: var(--surface-raised);
    color: var(--text);
    box-shadow: inset 0 1px rgb(255 255 255 / 2%);
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.field input:hover,
.field select:hover,
.auth-form input:hover,
textarea:hover {
    border-color: #526059;
}

.field:focus-within label,
.field:focus-within > span,
.auth-form:focus-within label {
    color: var(--accent-strong);
}

.field input:focus,
.field select:focus,
.auth-form input:focus,
textarea:focus,
.performance-controls select:focus,
.matchup-class-picker select:focus {
    border-color: var(--accent);
    box-shadow: var(--ring);
    outline: none;
}

input::placeholder,
textarea::placeholder,
.field input::placeholder {
    color: #69736d;
}

select {
    background-color: var(--surface-raised);
    color: var(--text);
}

.version-multi-select > summary {
    min-height: var(--control-height);
    border-color: var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-raised);
    box-shadow: inset 0 1px rgb(255 255 255 / 2%);
}

.version-multi-select[open] > summary,
.version-multi-select > summary:focus-visible {
    border-color: var(--accent);
    box-shadow: var(--ring);
}

.version-picker-popover {
    z-index: 40;
    overflow: hidden;
    border-color: var(--line-strong);
    border-radius: var(--radius-md);
    background: #1b201e;
    box-shadow: var(--shadow-raised);
}

.version-all-button {
    min-height: 32px;
    padding: 6px 8px;
}

.version-option:has(input:checked) {
    background: rgb(209 168 79 / 9%);
}

.version-option:focus-within {
    box-shadow: inset 2px 0 var(--accent);
}

.analysis-section {
    gap: 15px;
}

.analysis-section-header h2 {
    font-size: 20px;
    font-weight: 680;
    letter-spacing: -.035em;
}

.analysis-section-header p {
    font-size: 11.5px;
}

.section-count {
    font-size: 8.5px;
}

.performance-controls {
    min-height: 58px;
    border-bottom-color: var(--line);
    padding: 10px 14px;
}

.table-sort-button {
    min-height: 42px;
    font-family: inherit;
    font-size: inherit;
    transition: background-color 140ms ease, color 140ms ease;
}

.table-sort-button:hover {
    background: rgb(209 168 79 / 6%);
}

.empty-state,
.class-matchup-empty {
    position: relative;
    min-height: 240px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 88% 12%, rgb(209 168 79 / 7%), transparent 42%),
        var(--surface-quiet);
    padding: 34px;
}

.empty-state::before,
.class-matchup-empty::before {
    width: 38px;
    height: 3px;
    margin-bottom: 17px;
    background: var(--accent-soft);
    content: "";
}

.empty-state h2,
.class-matchup-empty strong {
    font-size: 18px;
    font-weight: 680;
    letter-spacing: -.025em;
}

.empty-state p,
.class-matchup-empty p {
    font-size: 12px;
}

.loading-block {
    min-height: 220px;
    align-content: center;
    gap: 12px;
    padding: 28px;
}

.loading-block > span:not(.visually-hidden) {
    height: 16px;
    border-radius: 5px;
    background:
        linear-gradient(90deg, var(--surface-raised), #252b28, var(--surface-raised));
    background-size: 240% 100%;
}

.loading-block .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
    .loading-block > span:not(.visually-hidden) {
        animation: nexus-skeleton 1.8s ease-in-out infinite;
    }
}

@keyframes nexus-skeleton {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.error-panel {
    border-color: rgb(226 138 131 / 38%);
    border-radius: var(--radius-md);
    background: rgb(83 37 34 / 35%);
    box-shadow: var(--shadow-surface);
    color: #efaaa4;
}

.system-state {
    display: grid;
    grid-template-columns: minmax(190px, .6fr) minmax(0, 1.4fr);
    align-items: center;
    min-height: min(620px, calc(100dvh - 190px));
    gap: clamp(34px, 7vw, 96px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 12% 50%, rgb(209 168 79 / 10%), transparent 34%),
        radial-gradient(circle at 100% 0%, rgb(255 255 255 / 3%), transparent 48%),
        var(--surface);
    box-shadow: var(--shadow-surface);
    padding: clamp(32px, 6vw, 84px);
}

.system-state-code {
    color: transparent;
    font-family: var(--font-mono);
    font-size: clamp(88px, 14vw, 190px);
    font-weight: 720;
    letter-spacing: -.11em;
    line-height: .8;
    -webkit-text-stroke: 1px rgb(209 168 79 / 38%);
    user-select: none;
}

.system-state > div {
    display: grid;
    justify-items: start;
}

.system-state h1 {
    max-width: 12ch;
    margin: 10px 0 15px;
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 700;
    letter-spacing: -.055em;
    line-height: .98;
}

.system-state p {
    max-width: 56ch;
    margin: 0 0 26px;
    color: var(--text-muted);
    font-size: 14px;
}

.system-state-reference {
    display: grid;
    width: 100%;
    gap: 4px;
    border-left: 2px solid var(--danger);
    margin: -8px 0 26px;
    background: rgb(226 138 131 / 5%);
    padding: 10px 12px;
}

.system-state-reference span {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.system-state-reference code {
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 10px;
}

.system-state-error .system-state-code {
    -webkit-text-stroke-color: rgb(226 138 131 / 38%);
}

.analysis-note,
.decision-warning,
.server-boundary-note,
.game-access-boundary-note,
.game-role-boundary-note {
    border: 1px solid rgb(209 168 79 / 20%);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background:
        radial-gradient(circle at 100% 0%, rgb(209 168 79 / 7%), transparent 48%),
        rgb(31 31 24 / 72%);
    box-shadow: var(--shadow-surface);
    padding: 15px 17px;
}

.form-panel,
.workflow-form,
.finding-dismiss-form {
    border-radius: var(--radius-md);
}

.case-summary-strip,
.server-summary-strip,
.incident-priority-strip,
.incident-stat-grid,
.game-access-summary-grid,
.steam-context-grid,
.matchup-insight-grid {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--line);
    box-shadow: var(--shadow-surface);
}

.case-summary-strip > div,
.server-summary-strip > div,
.incident-priority-strip > div,
.incident-stat-grid > div,
.game-access-summary-block,
.steam-context-grid > div,
.matchup-insight {
    background:
        radial-gradient(circle at 100% 0%, rgb(255 255 255 / 2.5%), transparent 50%),
        var(--surface);
}

.game-role-list-item,
.decision-choice,
.role-capability-option,
.effective-capability-item,
.role-membership-item,
.incident-report-card {
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 150ms ease;
}

@media (hover: hover) {
    .game-role-list-item:hover,
    .decision-choice:hover,
    .role-capability-option:hover,
    .effective-capability-item:hover,
    .role-membership-item:hover,
    .incident-report-card:hover {
        background: rgb(255 255 255 / 2.5%);
    }
}

.decision-choice:has(input:checked),
.role-capability-option:has(input:checked),
.game-role-list-item.selected {
    border-color: rgb(209 168 79 / 30%);
    background: rgb(209 168 79 / 8%);
    box-shadow: inset 3px 0 var(--accent);
}

.class-matchup-visuals {
    gap: 16px;
}

.matchup-insight {
    padding: 15px 17px;
}

.matchup-insight span {
    font-family: var(--font-mono);
    font-size: 8px;
}

.matchup-insight strong {
    font-size: 13.5px;
}

.radzen-chart-shell {
    --rz-base-background-color: transparent;
    --rz-text-color: var(--text-muted);
    --rz-text-title-color: var(--text);
    --rz-text-secondary-color: var(--text-muted);
    --rz-text-tertiary-color: var(--text-faint);
    --rz-primary: var(--accent-strong);
    min-height: 440px;
}

.radzen-chart-shell svg text,
.radzen-chart-shell .rz-spider-chart-label {
    font-family: var(--font-sans);
    font-size: 10px;
}

.class-matchup-radar .rz-series-0 { fill: #e0b952; stroke: #e0b952; }
.class-matchup-radar .rz-series-1 { fill: #73b6c7; stroke: #73b6c7; }
.class-matchup-radar .rz-series-2 { fill: #cf8077; stroke: #cf8077; }
.class-matchup-radar .rz-series-3 { fill: #81b879; stroke: #81b879; }
.class-matchup-radar .rz-series-4 { fill: #a58cc3; stroke: #a58cc3; }

.matchup-scale i {
    border-radius: 3px;
    background: linear-gradient(90deg, #252b28, #e0b952);
}

.sample-confidence {
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 8px;
}

.server-console-log,
.server-command-history pre,
.json-block {
    background: #090c0b;
    box-shadow: inset 0 1px 20px rgb(0 0 0 / 24%);
    scrollbar-color: var(--line-strong) #090c0b;
}

.server-panels,
.server-panels .panel,
.server-panels .table-wrap {
    min-width: 0;
    max-width: 100%;
}

.server-panels .panel {
    overflow: hidden;
}

.server-actions .text-button,
.server-refresh-bar .text-button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 3px;
}

.server-console-line:hover {
    background: rgb(209 168 79 / 4%);
}

.auth-body {
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(circle at 30% 20%, rgb(209 168 79 / 11%), transparent 32rem),
        radial-gradient(circle at 75% 90%, rgb(73 121 98 / 9%), transparent 36rem),
        var(--canvas-deep);
    padding:
        calc(24px + env(safe-area-inset-top))
        calc(24px + env(safe-area-inset-right))
        calc(24px + env(safe-area-inset-bottom))
        calc(24px + env(safe-area-inset-left));
}

.auth-body::before {
    z-index: -1;
    opacity: .8;
    mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.auth-shell {
    width: min(100%, 470px);
}

.auth-panel {
    position: relative;
    overflow: hidden;
    border-color: rgb(255 255 255 / 10%);
    border-radius: 20px;
    background:
        radial-gradient(circle at 100% 0%, rgb(209 168 79 / 10%), transparent 45%),
        rgb(21 25 24 / 92%);
    box-shadow: 0 34px 110px rgb(0 0 0 / 48%), inset 0 1px rgb(255 255 255 / 5%);
    padding: 39px;
    backdrop-filter: blur(24px);
}

.auth-panel::before {
    position: absolute;
    top: 0;
    left: 39px;
    width: 74px;
    height: 3px;
    background: var(--accent);
    content: "";
}

.auth-mark {
    width: 50px;
    height: 50px;
    margin-bottom: 30px;
    filter: drop-shadow(0 8px 18px rgb(0 0 0 / 32%));
}

.auth-panel .auth-context {
    margin-bottom: 7px;
    font-size: 9px;
    font-weight: 620;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-panel h1 {
    margin-bottom: 12px;
    font-size: clamp(30px, 8vw, 38px);
    font-weight: 700;
    letter-spacing: -.052em;
}

.auth-panel p {
    line-height: 1.58;
}

.auth-form {
    gap: 10px;
    margin: 25px 0 19px;
}

.auth-form input {
    height: 44px;
}

.auth-form button {
    height: 44px;
    border-radius: var(--radius);
    box-shadow: inset 0 1px rgb(255 255 255 / 24%), 0 10px 26px rgb(88 66 21 / 23%);
}

.auth-panel > .development-login {
    min-height: 44px;
    border-color: var(--line-strong);
    background: var(--surface-raised);
    color: var(--text);
}

.auth-panel .auth-footnote {
    border-top: 1px solid var(--line);
    margin-top: 25px;
    padding-top: 19px;
    font-size: 10px;
}

.auth-qr {
    border-width: 12px;
    border-radius: 8px;
    box-shadow: 0 22px 50px rgb(0 0 0 / 35%);
}

#blazor-error-ui {
    right: calc(18px + env(safe-area-inset-right));
    bottom: calc(18px + env(safe-area-inset-bottom));
    border-color: rgb(226 138 131 / 42%);
    border-radius: var(--radius-md);
    background: #3a211f;
    box-shadow: var(--shadow-raised);
    padding: 13px 15px;
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 224px;
    }

    .workspace-content {
        padding-inline: 28px;
    }

    .content-grid,
    .content-grid.equal {
        grid-template-columns: 1fr;
    }

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

    .metric-tile,
    .metric-tile:nth-child(2),
    .analysis-metrics .metric-tile:nth-child(4n),
    .analysis-metrics .metric-tile:nth-child(2n),
    .analysis-metrics .metric-tile:nth-child(-n + 4) {
        border: 1px solid var(--line);
    }
}

@media (max-width: 820px) {
    .app-frame {
        display: block;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 14px 34px rgb(2 5 4 / 28%);
    }

    .brand {
        height: 59px;
        padding:
            env(safe-area-inset-top)
            calc(14px + env(safe-area-inset-right))
            0
            calc(14px + env(safe-area-inset-left));
    }

    .brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 9px;
    }

    .brand img {
        width: 22px;
        height: 22px;
    }

    .brand-copy strong {
        font-size: 15px;
    }

    .primary-nav {
        display: flex;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        gap: 6px;
        border-top: 1px solid rgb(255 255 255 / 2%);
        padding:
            8px
            calc(10px + env(safe-area-inset-right))
            9px
            calc(10px + env(safe-area-inset-left));
        scroll-snap-type: x proximity;
    }

    .nav-group {
        display: flex;
        flex: 0 0 auto;
        gap: 4px;
        padding: 0;
    }

    .nav-group + .nav-group {
        border-top: 0;
        border-left: 1px solid var(--line);
        margin-left: 3px;
        padding: 0 0 0 7px;
    }

    .nav-group-label {
        display: none;
    }

    .primary-nav a {
        min-height: 38px;
        flex: 0 0 auto;
        scroll-snap-align: start;
        padding: 7px 10px;
    }

    .primary-nav a:hover {
        transform: none;
    }

    .sidebar-footer,
    .workspace-bar {
        display: none;
    }

    .workspace-content {
        padding:
            29px
            calc(16px + env(safe-area-inset-right))
            calc(42px + env(safe-area-inset-bottom))
            calc(16px + env(safe-area-inset-left));
    }

    .page-header,
    .dossier-heading {
        display: grid;
        align-items: start;
    }

    .page-header h1 {
        font-size: clamp(32px, 10vw, 42px);
    }

    .page-actions {
        justify-content: start;
    }

    .analysis-toolbar,
    .analysis-section-header {
        display: grid;
        align-items: start;
    }

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

    .class-matchup-visuals {
        grid-template-columns: 1fr;
    }

    .panel,
    .chart,
    .metric-tile {
        box-shadow: 0 12px 32px rgb(2 5 4 / 17%);
    }

    .system-state {
        grid-template-columns: 1fr;
        min-height: 540px;
        gap: 28px;
    }

    .system-state-code {
        font-size: clamp(76px, 24vw, 130px);
    }
}

@media (max-width: 560px) {
    .brand-copy small {
        display: none;
    }

    .primary-nav a {
        min-width: 66px;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 6px 8px;
        font-size: 9px;
    }

    .nav-glyph {
        width: 17px;
        height: 17px;
    }

    .page-heading {
        padding-left: 13px;
    }

    .page-header {
        margin-bottom: 24px;
    }

    .page-header h1 {
        font-size: 32px;
    }

    .page-header p {
        font-size: 12px;
    }

    .metrics-grid,
    .metrics-grid.two-up,
    .analysis-metrics,
    .analysis-filter-grid,
    .match-toolbar .filter-bar {
        grid-template-columns: 1fr;
    }

    .metric-tile,
    .metric-tile:nth-child(2),
    .analysis-metrics .metric-tile:nth-child(4n),
    .analysis-metrics .metric-tile:nth-child(2n),
    .analysis-metrics .metric-tile:nth-child(-n + 4) {
        min-height: 118px;
        border: 1px solid var(--line);
    }

    .analysis-filter-panel,
    .analysis-toolbar {
        padding: 14px;
    }

    .filter-bar {
        align-items: stretch;
    }

    .filter-bar .field,
    .filter-bar button,
    .filter-bar .button,
    .field input,
    .field select,
    .search-field input {
        width: 100%;
        min-width: 0;
    }

    .workspace-content > .filter-bar {
        display: grid;
        width: 100%;
    }

    .data-table a:not(.button),
    .server-actions .text-button {
        min-height: 36px;
    }

    .data-table a:not(.button) {
        min-width: 32px;
    }

    .text-button,
    .server-action-cell .text-button,
    .staff-recovery-form .text-button,
    .row-actions .text-button,
    .server-console-pause {
        min-width: 36px;
        min-height: 36px;
        padding-block: 8px;
    }

    .report-actions-cell .button,
    .button-compact {
        min-height: 36px;
        padding-block: 7px;
    }

    .panel-header {
        align-items: flex-start;
    }

    .auth-body {
        padding:
            calc(14px + env(safe-area-inset-top))
            calc(14px + env(safe-area-inset-right))
            calc(14px + env(safe-area-inset-bottom))
            calc(14px + env(safe-area-inset-left));
    }

    .auth-panel {
        border-radius: var(--radius-lg);
        padding: 30px 24px;
    }

    .auth-panel::before {
        left: 24px;
    }

    .auth-mark {
        margin-bottom: 24px;
    }
}

@media print {
    :root {
        color-scheme: light;
    }

    body {
        background: #fff;
        color: #111;
    }

    body::before,
    .workspace::before,
    .skip-link {
        display: none;
    }

    .panel,
    .chart,
    .metric-tile {
        background: #fff;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body::before,
    .workspace::before {
        display: none;
    }
}
