:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1c2330; --muted: #5d6878; --line: #dfe3ea; --accent: #1f5fae; --accent-ink: #ffffff;
  --ok: #1d7a46; --warn: #9a6400; --bad: #b3261e; --chip: #e9eef6; --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 15px; color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14181f; --panel: #1c222c; --ink: #e7ebf2; --muted: #9aa6b8; --line: #2e3745; --accent: #6ea8ef; --accent-ink: #0d1520;
    --ok: #5fcf8e; --warn: #e6b450; --bad: #f08a80; --chip: #283244; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: .25rem 0 .75rem; line-height: 1.45; }
button { font: inherit; color: inherit; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius); padding: .55rem 1rem; cursor: pointer; font-weight: 600; }
button.plain { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .8rem; cursor: pointer; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: .25rem; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gate { min-height: 100%; display: grid; place-items: center; padding: 1rem; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; max-width: 26rem; width: 100%; }
.msg { color: var(--muted); min-height: 1.4em; }
.msg.bad { color: var(--bad); }
.shell { min-height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; flex: 1; min-width: 0; }
.who { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; color: var(--muted); }
.chips { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.chip { background: var(--chip); color: var(--ink); border-radius: 999px; padding: .1rem .55rem; font-size: .8rem; white-space: nowrap; }
.icon-btn { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem .55rem; cursor: pointer; }
.body { flex: 1; display: flex; min-height: 0; }
.nav { width: 14rem; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: .75rem .5rem; }
.nav button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--radius); padding: .5rem .75rem; cursor: pointer; }
.nav button:hover { background: var(--chip); }
.nav button[aria-current="page"] { background: var(--chip); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 2rem; outline: none; }
.foot { padding: .4rem 1rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); background: var(--panel); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; max-width: 62rem; }
.muted { color: var(--muted); }
.rows { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; overflow-wrap: anywhere; }
.state-ok { color: var(--ok); font-weight: 600; } .state-warn { color: var(--warn); font-weight: 600; } .state-bad { color: var(--bad); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
td.wrap { overflow-wrap: break-word; }
form.inline { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-top: .75rem; }
label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
input[type="text"], input[type="email"], select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .55rem; min-width: 14rem; }
select[multiple] { min-height: 9rem; min-width: 20rem; }
@media (max-width: 760px) {
  .icon-btn { display: inline-block; }
  .nav { position: fixed; z-index: 5; top: 3.1rem; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .15s; box-shadow: 4px 0 16px rgba(0,0,0,.2); }
  .nav.open { transform: none; }
  .main { padding: 1rem; }
  .who #who-name { display: none; }
  select[multiple], input[type="text"], input[type="email"] { min-width: 0; width: 100%; }
  label { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; line-height: 1.45; }
.card > button { margin-top: .25rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 1rem; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .8rem; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
tr.ended td { color: var(--muted); }
.split-wrap { display: grid; gap: .4rem; width: 100%; }
.split-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
input.pct { min-width: 0; width: 6rem; }
input[type="date"] { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .5rem; }
td select { min-width: 0; max-width: 22rem; }
select:disabled, input:disabled { opacity: .7; }
h2 { margin-top: .25rem; }
