:root {
  color-scheme: dark;
  --bg: #10141a;
  --sidebar: #11161d;
  --panel: #171d26;
  --raised: #1d2531;
  --line: #2d3644;
  --text: #f1f4fa;
  --muted: #a8b2c3;
  --accent: #ffb15a;
  --accent-ink: var(--accent);
  --accent-fg: #23180e;
  --input-bg: #11161e;
  --input-line: #465167;
  --topbar: #12171f;
  --selected: #2e261e;
  --green: #77e2ad;
  --red: #f18c88;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; color: var(--text); background: var(--raised); border: 1px solid var(--line); padding: .55rem .85rem; border-radius: 7px; font-weight: 650; white-space: nowrap; }
button:hover, .button:hover { border-color: #738097; text-decoration: none; }
button:disabled { cursor: wait; opacity: .55; }
.primary { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent-fg); }
.quiet { background: transparent; }
.danger { color: var(--red); }
input, select, textarea { background: var(--input-bg); color: var(--text); padding: .58rem .72rem; border: 1px solid var(--input-line); border-radius: 7px; min-width: 0; }
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
input[type=checkbox] { accent-color: var(--accent); }
label { color: var(--muted); font-size: .92rem; display: grid; gap: .35rem; }
label.check { display: flex; align-items: center; }
form { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.13; letter-spacing: -.055em; }
h2 { font-size: 1.13rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.3; }
p + p { margin-top: .6rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.numeric { font-variant-numeric: tabular-nums; }
.shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); display: flex; flex-direction: column; gap: 1.5rem; padding: 1.45rem 1rem; border-right: 1px solid var(--line); }
.brand { color: var(--text); display: flex; gap: .75rem; align-items: center; font-size: 1.3rem; font-weight: 850; line-height: 1; letter-spacing: .05em; }
.brand:hover { text-decoration: none; }
.brand small { display: block; margin-top: .3rem; color: var(--muted); font-size: .63rem; letter-spacing: .125em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: var(--accent-fg); background: var(--accent); font-size: 1.55rem; font-style: italic; font-weight: 950; }
.faction { padding: .75rem; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.faction strong { display: block; }
nav { display: grid; gap: .35rem; }
nav a { display: flex; gap: .8rem; color: var(--muted); padding: .64rem .72rem; border-radius: 7px; font-weight: 650; }
nav a span { width: 1.1rem; text-align: center; font-size: 1rem; }
nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
nav a[aria-current] { background: var(--selected); color: var(--accent-ink); }
.sidebar-bottom { display: grid; gap: .7rem; margin-top: auto; }
#account { padding: 0 .4rem; font-weight: 650; }
#account span { display: block; }
.topbar { display: flex; min-height: 65px; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2.25rem); border-bottom: 1px solid var(--line); background: var(--topbar); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: .8rem; }
.content { padding: clamp(1.1rem, 4vw, 2.25rem); max-width: 1670px; margin: 0 auto; }
.faction-banner { padding-inline: clamp(1.1rem, 4vw, 2.25rem); padding-top: 1rem; max-width: 1670px; margin: 0 auto; }
.faction-banner img { display: block; width: 100%; max-height: clamp(110px, 24vw, 240px); object-fit: contain; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.hero p { margin-top: .4rem; color: var(--muted); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid .wide { grid-column: span 2; }
.stack { display: grid; gap: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 1.1rem; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.panel h3 + p, .panel h2 + p { margin-top: .4rem; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 .65rem; }
.scores > :nth-child(2) { text-align: right; }
.big { display: block; font-size: clamp(1.55rem, 4.5vw, 2.8rem); font-weight: 800; letter-spacing: -.055em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent-ink); }
progress { appearance: none; width: 100%; height: 7px; border: none; border-radius: 20px; display: block; overflow: hidden; background: #344055; }
progress::-webkit-progress-bar { background: #344055; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--raised); border-radius: 99px; padding: .15rem .56rem; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.chip.good { color: var(--green); border-color: #31594c; background: #19312b; }
.chip.warn { color: var(--orange); border-color: #6f5236; background: #362a20; }
.chip.alert { color: var(--red); border-color: #633c48; background: #38252c; }
.dot::before { content: ""; width: .43rem; height: .43rem; border-radius: 50%; background: currentColor; display: inline-block; }
.kpis { display: flex; flex-wrap: wrap; gap: .6rem 1.3rem; margin-top: .85rem; }
.kpis div { min-width: 90px; }
.kpis strong { display: block; font-size: 1.23rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; }
.toolbar input { width: min(100%, 13rem); }
.toolbar .check { white-space: nowrap; }
.toolbar input[type="checkbox"] { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: .66rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .84rem; color: var(--muted); white-space: nowrap; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ffffff04; }
td a { color: var(--text); font-weight: 700; }
td small { display: block; color: var(--muted); white-space: nowrap; }
td .toolbar { flex-wrap: nowrap; }
td .button, td button { padding: .35rem .5rem; font-size: .85rem; }
.empty { color: var(--muted); padding: .8rem 0; }
.event { padding: .65rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .15rem; }
.event:last-child { border: none; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: .85rem; }
.oc-overview { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.oc-tabs { display: flex; flex-wrap: wrap; margin: 0 0 1rem; }
.oc-tabs button[aria-pressed="true"] { border-color: var(--accent-ink); color: var(--accent-ink); }
.oc-counts { display: flex; flex-wrap: wrap; gap: .65rem 2rem; margin: 0; }
.oc-counts dt, .oc-role-name, .oc-cpr { color: var(--muted); font-size: .9rem; }
.oc-counts dd { margin: 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.oc-scenario .panel-head { margin-bottom: .35rem; }
.oc-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.oc-meta strong, .oc-cpr strong { color: var(--text); }
.oc-roles, .oc-unassigned { list-style: none; padding: 0; }
.oc-roles { margin: .9rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); gap: .6rem; }
.oc-role { display: grid; align-content: start; gap: .2rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.oc-role-open { border-style: dashed; color: var(--muted); }
.oc-unassigned { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.oc-unassigned li { border: 1px solid var(--line); border-radius: 7px; padding: .35rem .65rem; overflow-wrap: anywhere; max-width: 100%; }
.criteria-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); }
.criteria-fields label { align-content: space-between; }
.criteria-hint { margin-bottom: .75rem; }
.form-stack { display: grid; gap: .8rem; }
.brand-controls { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; }
.brand-controls input[type="color"] { width: 100%; min-width: 5rem; height: 2.5rem; padding: .25rem; cursor: pointer; }
.brand-controls input[type="file"] { width: auto; max-width: 100%; }
.notice { padding: .65rem .8rem; border: 1px solid #6f5236; border-radius: 8px; color: #ffd2a1; background: #2c231b; }
summary { cursor: pointer; color: var(--text); font-weight: 650; }
details[open] summary { margin-bottom: .6rem; }
.login { display: grid; place-items: center; min-height: 100vh; padding: 1.2rem; background: radial-gradient(ellipse at 50% 0%, #29333e, var(--bg) 67%); }
.login .panel { width: min(100%, 35rem); padding: clamp(1.1rem, 5vw, 2.15rem); }
.login .brand { margin-bottom: 1.75rem; }
#toast { position: fixed; z-index: 2; right: 1rem; bottom: 1rem; max-width: min(32rem, calc(100% - 2rem)); padding: .75rem 1rem; background: var(--raised); border: 1px solid #5f6c80; border-radius: 8px; box-shadow: 0 .4rem 1.5rem #0005; }
#toast:empty { display: none; }
.result-code { overflow-wrap: anywhere; font-family: ui-monospace, monospace; user-select: all; }
.custom-branding {
  --text: var(--bg-text);
  --accent-ink: var(--bg-accent-ink);
  --theme-base: var(--bg);
  --muted: color-mix(in srgb, var(--text) 85%, var(--theme-base));
  --raised: color-mix(in srgb, var(--theme-base) 93%, var(--text));
  --line: color-mix(in srgb, var(--theme-base) 78%, var(--text));
  --input-bg: var(--theme-base);
  --input-line: color-mix(in srgb, var(--theme-base) 62%, var(--text));
  --topbar: var(--panel);
  --sidebar: var(--panel);
}
.custom-branding :is(.sidebar, .topbar, .panel, #toast) {
  --text: var(--panel-text);
  --accent-ink: var(--panel-accent-ink);
  --theme-base: var(--panel);
  --muted: color-mix(in srgb, var(--text) 85%, var(--theme-base));
  --raised: color-mix(in srgb, var(--theme-base) 93%, var(--text));
  --line: color-mix(in srgb, var(--theme-base) 78%, var(--text));
  --input-bg: var(--theme-base);
  --input-line: color-mix(in srgb, var(--theme-base) 62%, var(--text));
  --selected: color-mix(in srgb, var(--theme-base) 94%, var(--accent-ink));
  color: var(--text);
}
.custom-branding #toast { background: var(--panel); }
.custom-branding .primary { color: var(--accent-fg); }
@media (max-width: 1050px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
}
@media (max-width: 710px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; overflow: visible; border-right: none; border-bottom: 1px solid var(--line); padding: 1rem; gap: .65rem; }
  .sidebar .faction, #account { display: none; }
  .sidebar-bottom { position: absolute; right: .75rem; top: 1rem; }
  nav { display: flex; overflow-x: auto; }
  nav a { flex: 0 0 auto; }
  .grid, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .grid .wide { grid-column: auto; }
  .hero { align-items: start; }
}
