:root {
  color-scheme: dark;
  --bg: #0b1320; --surface: #111b2a; --raised: #17233a; --sunken: #0d1624; --line: #213049; --line-strong: #2e4263; --hover: #3a5480;
  --text: #e9eef6; --soft: #b8c2d3; --muted: #8e9cb3; --faint: #6f7d94; --accent: #e0b85a; --accent-strong: #f0cd78; --accent-ink: #1d1406; --accent-bg: #2a2312;
  --good: #2fbf84; --good-bg: #10342a; --good-line: #1f6b4d; --bad: #f0716b; --bad-bg: #2c1517; --bad-line: #6b3336;
  --warn: #e7a93b; --warn-bg: #33270f; --warn-line: #6b5420; --info: #8fc1ff; --info-bg: #13263f; --info-line: #26476e;
  --radius: 12px; --radius-small: 8px; --shadow: 0 1px 0 #ffffff08 inset, 0 8px 24px #00000033;
  --top: 104px;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
main { min-height: 100%; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h2 { margin: 0 0 6px; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
h3 { margin: 24px 0 10px; font-size: 14px; font-weight: 650; }
ul { margin: 6px 0; padding-left: 20px; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0; }
.meta.id { font: 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.meta.count { margin: 0 0 12px; font-weight: 550; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nowrap { white-space: nowrap; }

/* Notices: bottom right, above everything, with what they mean in words. */
#notice:empty { display: none; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: grid; grid-template-columns: auto 1fr auto; gap: 1px 12px; align-items: start; width: min(440px, calc(100vw - 32px)); padding: 14px 12px 14px 14px; background: var(--raised); border: 1px solid var(--line-strong); border-left: 4px solid var(--info); border-radius: 12px; box-shadow: 0 18px 48px #000a; animation: rise .2s ease-out; }
.toast-icon { grid-row: 1 / span 3; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; background: var(--info-bg); color: var(--info); font-size: 13px; font-weight: 800; }
.toast-title { grid-column: 2; font-size: 14px; font-weight: 650; }
.toast-text { grid-column: 2; color: var(--soft); overflow-wrap: anywhere; }
.toast-code { grid-column: 2; color: var(--muted); font: 11px ui-monospace, Consolas, monospace; }
.toast-close { grid-column: 3; grid-row: 1 / span 3; height: 28px; width: 28px; padding: 0; color: var(--muted); background: transparent; font-size: 19px; line-height: 1; }
.toast-close:hover { color: var(--text); background: var(--surface); }
.toast.good { border-left-color: var(--good); }
.toast.good .toast-icon { background: var(--good-bg); color: var(--good); }
.toast.bad { border-left-color: var(--bad); background: #24161b; }
.toast.bad .toast-icon { background: var(--bad-bg); color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.warn .toast-icon { background: var(--warn-bg); color: var(--warn); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Sign in. */
.signin-brand { display: none; }
main:has(#desk[hidden]) {
  display: grid; place-content: center; gap: 18px; justify-items: stretch; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, #1b2c4a 0%, transparent 65%), var(--bg);
}
main:has(#desk[hidden]) .signin-brand { display: flex; align-items: center; gap: 14px; }
.signin-brand h2 { margin: 0; font-size: 20px; }
.signin-brand p { margin: 0; color: var(--muted); }
main:has(#desk[hidden]) form { width: 380px; max-width: calc(100vw - 48px); padding: 24px; gap: 14px; box-shadow: 0 24px 60px #0008; }
main:has(#desk[hidden]) form h3 { margin: 0 0 2px; font-size: 16px; }
main:has(#desk[hidden]) form button[type=submit] { justify-self: stretch; height: 40px; }
.signin-note { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.brand-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.qr { display: grid; place-items: center; margin: 12px 0 4px; }
.qr:empty { display: none; }
.qr svg { width: 200px; height: 200px; border-radius: 10px; }
.key-box { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--warn-line); border-radius: 9px; }
#mfa-secret { flex: 1; overflow-wrap: anywhere; font: 13px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .05em; user-select: all; }

/* Controls. */
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 15px; border: 0; border-radius: var(--radius-small); background: linear-gradient(180deg, var(--accent-strong), var(--accent)); color: var(--accent-ink); font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; transition: filter .12s, background .12s, border-color .12s, color .12s; }
button:hover { filter: brightness(1.06); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button.quiet { background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); }
button.quiet:hover:not(:disabled) { border-color: var(--hover); background: #1c2a44; filter: none; }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad-line); }
button.danger:hover:not(:disabled) { background: var(--bad-bg); filter: none; }
button.danger.solid { background: #b8433f; color: #fff; border: 0; }
button.danger.solid:hover { background: #c94d48; }
button.link { height: auto; padding: 2px 0; background: none; color: var(--accent); font-weight: 600; border-radius: 4px; }
button.link::after { content: "→"; }
button.link:hover { filter: none; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
button.small { height: 30px; padding: 0 11px; font-size: 13px; }
button.icon-button { width: 32px; height: 32px; padding: 0; font-size: 17px; line-height: 1; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 11px; background: var(--sunken); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-small); font: inherit; transition: border-color .12s, box-shadow .12s; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--hover); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #e0b85a22; outline: none; }
input:disabled, select:disabled, textarea:disabled { color: var(--soft); background: var(--surface); border-style: dashed; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=color] { padding: 3px; height: 38px; }
input[type=file] { padding: 6px; }
select[multiple] { padding: 4px; }
textarea { resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.5; }
/* Checkboxes are switches. */
input[type=checkbox] { appearance: none; position: relative; width: 36px; min-height: 0; height: 20px; flex: none; padding: 0; margin: 0; border-radius: 999px; background: var(--line-strong); border: 0; cursor: pointer; transition: background .15s; }
input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c9d2e0; transition: transform .15s, background .15s; }
input[type=checkbox]:checked { background: var(--accent); }
input[type=checkbox]:checked::after { transform: translateX(16px); background: var(--accent-ink); }
input[type=checkbox]:disabled { opacity: .5; border: 0; }
input[type=radio] { width: 16px; min-height: 16px; accent-color: var(--accent); }
label { display: grid; gap: 6px; align-content: start; color: var(--soft); font-size: 13px; font-weight: 550; }
label:has(> input[type=checkbox]) { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 10px; min-height: 38px; color: var(--text); font-weight: 500; cursor: pointer; }
label.match { padding: 6px 8px; margin: -6px -8px; border-radius: 8px; background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
form { display: grid; gap: 14px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
form button[type=submit] { justify-self: start; }
.panel-form, form.report { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; max-width: none; align-items: start; }
/* Labelled boxes share the grid; everything else in a form takes the full width. */
.panel-form > button, form.report > :not(label, .field), form.report > .field.wide, .field-group { grid-column: 1 / -1; }
form.report > h2 { margin-bottom: -6px; }
form.report > h3 { margin: 10px 0 -4px; padding-top: 16px; border-top: 1px solid var(--line); }
form.report > h2 + h3, form.report > h3:first-child { padding-top: 0; border-top: 0; margin-top: 0; }
form.report > button, label > button, .panel-form > button { justify-self: start; }
.field-group { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; padding: 12px; }
form .toolbar { margin: 0; padding: 0; }
.toolbar input { flex: 1; }

/* Layout. */
#desk { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 16px 12px 12px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 16px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand .brand-icon { width: 34px; height: 34px; border-radius: 9px; }
.brand strong { display: block; font-size: 14px; font-weight: 650; line-height: 1.25; }
.brand small { color: var(--muted); font-size: 12px; }
#sections { display: grid; gap: 2px; flex: 1; align-content: start; }
#sections button { justify-content: flex-start; gap: 12px; height: 40px; width: 100%; padding: 0 12px; text-align: left; background: transparent; color: var(--soft); font-weight: 550; font-size: 14px; border-radius: 9px; }
#sections button .icon { width: 18px; height: 18px; color: #7d8ba3; }
#sections button:hover { background: var(--raised); color: var(--text); filter: none; }
#sections button.active { background: linear-gradient(90deg, var(--accent-bg), var(--raised) 75%); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
#sections button.active .icon { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 8px 2px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: linear-gradient(145deg, #2a3f66, #15243c); color: var(--accent); font-weight: 700; }
.avatar.small { width: 24px; height: 24px; font-size: 11px; }
.who-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.who-text strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: var(--muted); font-size: 12px; }
.signout { width: 34px; padding: 0; flex: none; }
.work { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; padding: 18px 32px 0; background: #0b1320eb; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.page-note { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.page-note:empty { display: none; }
.site-chip { padding: 4px 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; white-space: nowrap; }
.site-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--good); vertical-align: 1px; }
.tabs { display: flex; gap: 2px; margin: 0 -4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.single { display: none; }
.tabs button { flex: none; gap: 7px; height: 42px; padding: 0 12px; background: transparent; color: var(--muted); font-weight: 550; border-radius: 0; border-bottom: 2px solid transparent; }
.tabs button .icon { width: 15px; height: 15px; }
.tabs button:hover { color: var(--text); filter: none; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button.active .icon { color: var(--accent); }
.tabs button.off { display: none; }
#content { max-width: 1240px; padding: 24px 32px 96px; }
#content > h1:first-child, #content > h2:first-child { display: none; }
/* The first line a page writes is its description, under the header. */
#content > :is(h1, h2):first-child + p.meta { max-width: 80ch; margin: -6px 0 20px; color: var(--soft); font-size: 14px; }
#content > * + h3 { margin-top: 28px; }
#content > details, #content > section, #content > article, #content > form { scroll-margin-top: calc(var(--top) + 12px); }

/* Building blocks (ui.js). */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head > .meta { flex: 1 1 320px; margin: 0; max-width: 80ch; color: var(--soft); font-size: 14px; }
.page-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.card, .panel { margin-bottom: 16px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-title { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2 { margin: 0; font-size: 15px; }
.card-title .meta { margin: 2px 0 0; }
.drawer .card { padding: 16px 18px; background: var(--surface); }
.field { display: grid; gap: 6px; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field-label { color: var(--soft); font-weight: 550; }
.field-error { color: var(--bad); font-size: 12px; }
.field-error:empty { display: none; }
[aria-invalid] { border-color: var(--bad) !important; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; align-items: start; }
.form-grid > .wide, .form-grid > h3, .form-grid > p, .form-grid > .callout, .form-grid > .actions, .form-grid > .save-bar { grid-column: 1 / -1; }
.form-grid > .actions { margin: 0; }
.form-grid > h3 { margin: 8px 0 -4px; }
.form-grid > p.hint { margin: -4px 0 0; }
/* Save bars: the reason and the buttons that commit a form, kept together on one line. */
.save-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.save-bar > label, .save-bar > .field, .save-bar > input { flex: 1 1 280px; max-width: 520px; }
.save-bar > input { width: auto; }
.save-bar > button { flex: none; }
.save-bar.sticky, form.save-bar { position: sticky; bottom: 0; z-index: 4; margin: 16px 0 0; padding: 14px 18px; background: #131e30f2; backdrop-filter: blur(8px); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 -10px 30px #0007; }
form.save-bar { display: flex; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; color: var(--soft); background: var(--raised); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; font-weight: 550; line-height: 1.5; white-space: nowrap; }
.chip.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.chip.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.chip.info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { border: 0; border-radius: 0; }
.report .table-wrap, .card .table-wrap { background: var(--sunken); }
td.num, th.num { text-align: right; white-space: nowrap; }
td .actions button { white-space: nowrap; }
td .actions { margin: 0; flex-wrap: nowrap; justify-content: flex-end; }
.segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.segments button { height: 30px; padding: 0 14px; background: transparent; color: var(--muted); font-weight: 550; border-radius: 7px; }
.segments button:hover { color: var(--text); filter: none; }
.segments button.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.rows { display: grid; gap: 6px; }
.rows-head, .rows-row { display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: center; }
.rows-head { padding: 0 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.rows-list { display: grid; gap: 6px; }
.rows-first { display: flex; align-items: center; gap: 8px; }
.rows-number { width: 22px; flex: none; color: var(--faint); font-size: 12px; text-align: right; }
.rows-head > span:first-child { padding-left: 30px; }
.rows-tools { display: flex; gap: 4px; }
.rows > button { justify-self: start; }
.rows input { min-height: 32px; padding: 5px 9px; }

dialog.ask { width: min(460px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 30px 80px #000a; }
dialog.ask::backdrop { background: #050a12b3; backdrop-filter: blur(2px); }
.ask-form { display: grid; gap: 12px; padding: 22px; background: none; border: 0; }
.ask-form h2 { margin: 0; font-size: 17px; }
.ask-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.drawer-shade { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; background: #050a1299; animation: fade .15s ease-out; }
.drawer { display: flex; flex-direction: column; width: min(780px, 100vw); height: 100%; background: var(--bg); border-left: 1px solid var(--line-strong); box-shadow: -24px 0 60px #0008; animation: slide .2s ease-out; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-head .meta { margin: 2px 0 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.drawer-body > * + * { margin-top: 16px; }
.drawer-body form { padding: 0; background: none; border: 0; }
body.drawer-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(32px); opacity: .4; } }

.steps { display: flex; gap: 6px; margin-bottom: 20px; counter-reset: step; }
.steps button { flex: 1; justify-content: flex-start; height: auto; min-height: 38px; padding: 8px 10px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 9px; font-weight: 550; font-size: 13px; text-align: left; white-space: normal; counter-increment: step; }
.steps button::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--raised); font-size: 12px; }
.steps button:hover { filter: none; color: var(--text); }
.steps button.on { color: var(--text); border-color: var(--accent); }
.steps button.on::before { background: var(--accent); color: var(--accent-ink); }
.steps button.bad { border-color: var(--bad-line); }
.steps button.bad::before { background: var(--bad); color: #fff; }
.step-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.step-foot > div { display: flex; flex-wrap: wrap; gap: 8px; }
.preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 4px; }
.preview .stat { padding: 12px 14px; }
.preview .stat strong { font-size: 19px; }
.callout { margin: 0 0 16px; padding: 11px 14px; color: var(--soft); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-small); font-size: 13px; }
.callout.bad { border-left-color: var(--bad); color: #f3b3af; }
.callout.good { border-left-color: var(--good); }
.list-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 18px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.report .list-card { background: var(--sunken); }
.list-card h3 { margin: 0; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.list-card .meta { margin: 0; }
.list-card > .actions { margin: 0; grid-row: 1 / span 2; grid-column: 2; }
.list-card > button { grid-row: 1 / span 2; grid-column: 2; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h3 { margin: 0; }
.results { display: grid; gap: 0; }
.results:empty { display: none; }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* Calendar. */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h3 { margin: 0 8px 0 0; font-size: 16px; min-width: 150px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { padding: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 600; background: var(--raised); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; align-content: start; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: #0e1726; }
.cal-day.other .cal-date { opacity: .45; }
.cal-day.today .cal-date { background: var(--accent); color: var(--accent-ink); }
.cal-date { justify-self: start; min-width: 22px; padding: 0 6px; margin-bottom: 2px; border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 600; }
.cal-event { display: block; width: 100%; height: auto; padding: 3px 6px; overflow: hidden; color: var(--text); background: #1a2a40; border: 0; border-left: 3px solid #4d7fbf; border-radius: 5px; font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; text-overflow: ellipsis; }
.cal-event:hover { filter: brightness(1.25); }
.cal-event.live { background: #12352a; }
.cal-event.ended { opacity: .5; }
.cal-event.staff { border-left-color: var(--accent); }
.cal-event.mtt { border-left-color: #b07de0; }
.cal-more { color: var(--muted); font-size: 11px; padding-left: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; background: var(--dot); vertical-align: -1px; }

/* Updates. */
.meter { height: 6px; margin-top: 12px; overflow: hidden; background: var(--line); border-radius: 6px; }
.meter span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #b88a2e, var(--accent)); border-radius: 6px; transition: width .3s ease; }
.actions input[type=file] { flex: 1 1 260px; padding: 6px; }

/* Dashboard. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; align-content: start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat strong { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; overflow-wrap: anywhere; }
.stat-hint { color: var(--faint); font-size: 12px; }
.panel > h2 { margin-bottom: 12px; }
.status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; }
.status.ok { background: var(--good-bg); border: 1px solid var(--good-line); }
.status.ok strong { color: var(--good); }
.status.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.status.warn strong { color: var(--warn); }
.status span { color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.drawer-body > .facts { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.report .facts { grid-template-columns: repeat(auto-fill, minmax(120px, max-content) minmax(90px, 1fr)); margin: 10px 0; }
.empty { margin: 0; padding: 22px 16px; color: var(--muted); text-align: center; background: var(--sunken); border: 1px dashed var(--line-strong); border-radius: 10px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-head h2, .card-head h3 { margin: 0 6px 0 0; }
form.report > .card-head { margin-top: -4px; }

/* Cards: every page's sections. */
.report, table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.report { padding: 18px 22px; margin-bottom: 16px; }
.report h2, .report h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.report > * + h3 { margin-top: 18px; }
.report > button { margin: 10px 8px 0 0; }
.report > input, .report > label, .report > select { margin-top: 8px; }
details.report { padding: 0; overflow: clip; }
details.report > summary { display: flex; align-items: center; gap: 10px; padding: 15px 22px; cursor: pointer; font-weight: 650; list-style: none; }
details.report > summary::-webkit-details-marker { display: none; }
details.report > summary::before { content: ""; width: 7px; height: 7px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details.report[open] > summary::before { transform: rotate(45deg); }
details.report > summary:hover { background: var(--raised); }
details.report[open] > summary { border-bottom: 1px solid var(--line); }
details.report > :not(summary) { margin-left: 22px; margin-right: 22px; }
details.report > :not(summary):last-child { margin-bottom: 20px; }
details.report > :nth-child(2) { margin-top: 16px; }
details.report > form { padding: 0; background: none; border: 0; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; padding: 10px 12px; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-small); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.actions input { flex: 1 1 220px; width: auto; }
.actions input[type=number] { flex: 0 0 100px; }
.actions .divider { width: 1px; height: 24px; margin: 0 4px; background: var(--line-strong); }
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: 13px; vertical-align: middle; }
th { position: sticky; top: 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; background: var(--raised); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #15213366; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.themes .report { display: grid; gap: 10px; align-content: start; margin: 0; padding: 12px; }
.themes .report.live { border-color: var(--good-line); box-shadow: 0 0 0 1px var(--good-line); }
.themes .report > button { margin: 0; justify-self: start; }
.themes img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.reported-photo { width: 96px; height: 96px; flex: none; object-fit: cover; border-radius: 50%; background: var(--raised); }
.content-preview { width: 180px; height: 150px; object-fit: contain; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; }
.content-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; padding: 16px 0; }
.fair-settings { max-width: none; }
.copy-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.copy-row:last-child { border-bottom: 0; }
.copy-swatch { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

/* Reports. */
.report-card .card-head { margin-bottom: 2px; }
.photo-review { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; margin-top: 14px; padding: 14px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; }
.photo-controls { display: grid; gap: 10px; flex: 1 1 280px; }
.photo-controls > button { justify-self: start; }
.report-card > button { margin-top: 12px; }
.chat-log { display: grid; gap: 4px; margin-top: 8px; }
.chat-log:empty { display: none; }
.chat-line { padding: 4px 12px; color: var(--soft); font-size: 13px; }
.decision { display: grid; grid-template-columns: minmax(220px, 1fr) 150px; gap: 12px 16px; align-items: end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.decision > .actions { grid-column: 1 / -1; margin: 0; }

/* Integrations. */
.secret-row, .copy-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.copy-field input { flex: 1 1 260px; width: auto; color: var(--soft); font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace; }
.field.wide > input[type=password], .field.wide > textarea { margin-top: 4px; }

/* Economy. */
.economy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; align-items: start; }
details.report > .economy-grid { margin-bottom: 20px; }
.economy-grid > p, .economy-grid > .actions, .economy-grid > .economy-grid, .economy-grid > button.link { grid-column: 1 / -1; }
.economy-grid > p.meta { margin: 0; }
.economy-grid > label:has(> input[type=checkbox]) { grid-column: 1 / -1; }
.economy-grid > .actions { margin: 0; }
.economy-grid > button { justify-self: start; align-self: end; }
.economy-field { display: grid; gap: 6px; }
.economy-sector { display: grid; gap: 10px; align-content: start; padding: 14px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; }
.economy-sector > strong { color: var(--accent); font-size: 13px; }
.economy-sector > button { justify-self: start; }
.economy-metrics { margin: 12px 0 8px; padding: 10px 14px; color: var(--text); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-small); font-weight: 550; }
.economy-odds { display: flex; flex-wrap: wrap; gap: 6px; }
.economy-odds .meta { margin: 0; padding: 2px 9px; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.economy-review:empty { display: none; }
.economy-review { padding: 18px 22px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--warn-line); border-radius: var(--radius); scroll-margin-bottom: 120px; }
.economy-review h3 { margin-top: 0; }
.economy-review ul { max-height: 320px; overflow: auto; font: 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.settings-finder { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 10px; margin-top: 14px; }
.history-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }

/* Audit log. */
.filters { grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(150px, 1fr)) repeat(2, minmax(130px, 150px)) auto; align-items: end; gap: 12px; margin-bottom: 16px; padding: 16px 18px; }
.filter-tools { display: flex; gap: 8px; }
.audit-results { transition: opacity .15s; }
.audit-results.loading { opacity: .5; pointer-events: none; }
.audit-results td.summary { max-width: 360px; overflow: hidden; color: var(--soft); text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.audit-results td:first-child { color: var(--soft); white-space: nowrap; }
.audit-results td .chip { font-size: 11.5px; }
.person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.pager > .meta { margin: 0 auto 0 0; }
.pager-size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.pager-size select { width: 76px; min-height: 30px; padding: 4px 8px; }
.change-list { margin: 0; padding-left: 18px; max-height: 420px; overflow: auto; font: 12.5px/1.7 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.outline { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 6px 18px; margin: 0; }
.outline .outline { padding: 8px 0 4px 12px; border-left: 2px solid var(--line); }
.outline dt { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.outline dd { margin: 0; min-width: 0; }
.outline details > summary { cursor: pointer; }
.outline-value { overflow-wrap: anywhere; }
.outline-value.number { color: var(--info); }
.outline-value.boolean { color: var(--warn); }
.outline-value.null { color: var(--faint); font-style: italic; }

/* Tablets: the sidebar keeps only its icons. */
@media (max-width: 1100px) {
  #desk { grid-template-columns: 68px minmax(0, 1fr); }
  .side { padding: 14px 10px 10px; }
  .brand { justify-content: center; padding: 2px 0 14px; }
  .brand span, .who-text { display: none; }
  #sections button { justify-content: center; padding: 0; font-size: 0; gap: 0; }
  #sections button .icon { width: 20px; height: 20px; }
  .who { flex-direction: column; padding: 10px 0 2px; }
  .topbar { padding: 14px 24px 0; }
  #content { padding: 20px 24px 96px; }
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters > .field:first-child { grid-column: 1 / 4; }
  .filters > .filter-tools { grid-column: 4; grid-row: 1; }
  .audit-results td.summary { max-width: 220px; }
}
@media (max-width: 820px) {
  #desk { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 6; flex-direction: row; align-items: center; gap: 8px; height: auto; padding: 8px 12px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; margin: 0; border: 0; }
  #sections { display: flex; flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  #sections button { flex: none; width: auto; height: 36px; padding: 0 10px; gap: 7px; font-size: 13px; }
  #sections button.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .who { flex-direction: row; margin: 0; padding: 0; border: 0; }
  .who-text, .avatar:not(.small) { display: none; }
  .topbar { position: static; padding: 10px 16px 0; }
  #content { padding: 16px 16px 96px; }
  .site-chip { display: none; }
  .copy-row { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .steps button { font-size: 0; justify-content: center; }
  .steps button::before { font-size: 12px; }
  .list-card { grid-template-columns: 1fr; }
  .list-card > .actions, .list-card > button { grid-row: auto; grid-column: 1; }
  .cal-day { min-height: 64px; }
  .cal-event { font-size: 0; height: 6px; padding: 0; }
  .table-wrap table { min-width: 760px; }
  .rows { overflow-x: auto; }
  .rows-head, .rows-list { min-width: 520px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > .field:first-child { grid-column: 1 / -1; }
  .filters > .filter-tools { grid-column: auto; grid-row: auto; }
  .decision { grid-template-columns: 1fr; }
  .settings-finder { grid-template-columns: 1fr; }
  .outline { grid-template-columns: 1fr; gap: 2px; }
  .outline dd { margin-bottom: 6px; }
  .toast { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
