/*
 * FiyoEvent staff panel. Hand-written, no build step.
 * Tokens first; dark mode swaps the tokens only (data-theme on <html>,
 * else the system setting).
 */
:root {
  color-scheme: light;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --text: #0e1328;
  --text-2: #3a4160;
  --muted: #6b7290;
  --line: #e4e7f0;
  --line-strong: #d3d8e6;
  --brand: #5046e5;
  --brand-2: #4036c9;
  --brand-soft: #eeedfd;
  --brand-ink: #3a30b8;
  --ok: #0f8a5f; --ok-soft: #e7f7f0;
  --warn: #a8610a; --warn-soft: #fdf3e2;
  --bad: #d23a3a; --bad-soft: #fdecec;
  --info: #2f62d8; --info-soft: #e9f0fe;
  --side: #0b1022;
  --side-2: #141a33;
  --side-text: #aab1cc;
  --side-muted: #646c8c;
  --shadow-sm: 0 1px 2px rgba(14, 19, 40, .06);
  --shadow: 0 1px 2px rgba(14, 19, 40, .05), 0 6px 20px -8px rgba(14, 19, 40, .12);
  --shadow-lg: 0 24px 60px -20px rgba(14, 19, 40, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d1a; --surface: #11152a; --surface-2: #151a31; --surface-3: #1b2140;
    --text: #e8eaf5; --text-2: #c2c7de; --muted: #8890b0; --line: #232a48; --line-strong: #2e3658;
    --brand: #7c74ff; --brand-2: #958eff; --brand-soft: #211f4d; --brand-ink: #b4afff;
    --ok: #3ccf97; --ok-soft: #0f2a22; --warn: #f0b155; --warn-soft: #2d2212; --bad: #ff7b7b; --bad-soft: #321718; --info: #7aa5ff; --info-soft: #14203f;
    --side: #070914; --side-2: #12162b; --side-text: #a0a7c4; --side-muted: #5d6585;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02); --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d1a; --surface: #11152a; --surface-2: #151a31; --surface-3: #1b2140;
  --text: #e8eaf5; --text-2: #c2c7de; --muted: #8890b0; --line: #232a48; --line-strong: #2e3658;
  --brand: #7c74ff; --brand-2: #958eff; --brand-soft: #211f4d; --brand-ink: #b4afff;
  --ok: #3ccf97; --ok-soft: #0f2a22; --warn: #f0b155; --warn-soft: #2d2212; --bad: #ff7b7b; --bad-soft: #321718; --info: #7aa5ff; --info-soft: #14203f;
  --side: #070914; --side-2: #12162b; --side-text: #a0a7c4; --side-muted: #5d6585;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02); --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: -0.005em; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: .93em; }
.icon { flex-shrink: 0; vertical-align: middle; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text); padding: 18px 12px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--side-2) transparent;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; padding: 2px 8px 18px; }
.brand .logo {
  display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 10px; color: #fff; font-weight: 800;
  background: linear-gradient(140deg, #7a70ff 0%, #5046e5 55%, #2f27a8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px -6px rgba(80, 70, 229, .8);
}
.brand small { display: block; color: var(--side-muted); font-weight: 500; font-size: 11.5px; letter-spacing: .01em; }
.side .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 16px 12px 6px; font-weight: 650; }
.side a {
  position: relative; display: flex; align-items: center; gap: 11px; color: var(--side-text); padding: 7px 10px; border-radius: 9px; margin-bottom: 1px; font-weight: 500;
  transition: background .12s, color .12s;
}
.side a .icon { color: var(--side-muted); transition: color .12s; }
.side a span.text { flex: 1; min-width: 0; }
.side a:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.side a:hover .icon { color: #d6d9ec; }
.side a.active { background: linear-gradient(90deg, rgba(124, 116, 255, .22), rgba(124, 116, 255, .06)); color: #fff; }
.side a.active .icon { color: #a9a3ff; }
.side a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8d86ff; }
.count {
  margin-left: auto; min-width: 20px; text-align: center; background: #f59e0b; color: #1d1302; border-radius: 999px; font-size: 11px; line-height: 18px; padding: 0 6px; font-weight: 750;
}
.side .foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--side-2); font-size: 12px; color: var(--side-muted); }
.side .foot .env { display: inline-flex; align-items: center; gap: 6px; }
.side .foot .env::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3ccf97; box-shadow: 0 0 0 3px rgba(60, 207, 151, .18); }

.main { min-width: 0; display: flex; flex-direction: column; }
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 32px; min-height: 58px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: .5; }
.bar .spacer { flex: 1; }
.jump {
  display: inline-flex; align-items: center; gap: 10px; min-width: 260px; padding: 7px 10px 7px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.jump:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); color: var(--text-2); }
.jump span { flex: 1; text-align: left; }
kbd {
  font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.theme-dark-only { display: none; }
:root[data-theme="dark"] .theme-dark-only { display: inline; }
:root[data-theme="dark"] .theme-light-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-dark-only { display: inline; }
  :root:not([data-theme="light"]) .theme-light-only { display: none; }
}
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; letter-spacing: .02em;
}
.who .name { display: flex; flex-direction: column; line-height: 1.2; }
.who .name b { color: var(--text); font-weight: 600; font-size: 13px; }
.who .name small { font-size: 11.5px; text-transform: capitalize; }
.menu-btn { display: none; }

.page { padding: 26px 32px 56px; width: 100%; max-width: 1480px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top .muted { margin: 6px 0 0; font-size: 14px; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card > h2:first-child, .card > .row:first-child > h2 { margin-bottom: 14px; }
.card .row > h2 { margin: 0; flex: 1; }
section.card > table, .card > table { margin: -4px -8px 0; width: calc(100% + 16px); }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 0; }
.grid.two, .grid.stats { margin-bottom: 18px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.two { grid-template-columns: 1fr; } }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.lead { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); margin-bottom: 18px; }
@media (max-width: 1100px) { .grid.lead { grid-template-columns: 1fr; } }

.stat { display: block; position: relative; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); transform: translateY(-1px); }
.stat .n { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; }
.stat .l { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stat .chip { display: inline-flex; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand-ink); }
.stat .chip.ok { background: var(--ok-soft); color: var(--ok); }
.stat .chip.warn { background: var(--warn-soft); color: var(--warn); }
.stat .chip.info { background: var(--info-soft); color: var(--info); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; border-radius: 999px; padding: 1px 7px 1px 4px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); padding-left: 7px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tr:last-child td { border-bottom: 0; }
td a:not(.btn) { font-weight: 600; }
.card td.muted:last-child, td time { white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; box-shadow: var(--shadow); }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap th:first-child { border-top-left-radius: var(--radius); }
.table-wrap th:last-child { border-top-right-radius: var(--radius); }
td[colspan] { text-align: center; padding: 36px 16px; }
td.right, th.right, .right { text-align: right; }
td.right, .num { font-variant-numeric: tabular-nums; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 9px 2px 8px; font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; vertical-align: middle;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* ---------- Forms ---------- */
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.row.card { gap: 10px; padding: 12px; }
form.row.card input[type=search], form.row.card input[type=text] { flex: 1 1 240px; }
form.row.card input[type=search] {
  padding-left: 36px;
  background: var(--surface) no-repeat 11px 50% / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7290' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4-4'/%3E%3C/svg%3E");
}
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=tel], select, textarea {
  font: inherit; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; background: var(--surface); color: var(--text); min-width: 0;
  transition: border-color .12s, box-shadow .12s; min-height: 38px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background: var(--surface) no-repeat right 10px center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7290' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
}
textarea { width: 100%; min-height: 72px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--muted) 55%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
label.stack > span:first-child, label.stack > span:only-child { font-weight: 600; font-size: 13px; color: var(--text-2); }
label.stack { display: flex; flex-direction: column; }
label.stack > * + * { margin-top: 6px; }
label.row { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.3;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 14px; min-height: 38px; cursor: pointer; text-decoration: none;
  background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 1px 2px rgba(20, 16, 90, .25);
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--muted) 50%, var(--line-strong)); }
.btn.danger { background: var(--bad); box-shadow: 0 1px 2px rgba(120, 20, 20, .25); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); }
.btn.small { padding: 5px 10px; font-size: 12.5px; min-height: 30px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Messages ---------- */
.flash {
  display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; padding: 11px 14px; margin-bottom: 18px; font-weight: 500;
  border: 1px solid transparent;
}
.flash .icon { margin-top: 1px; }
.flash .close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0 2px; }
.flash .close:hover { opacity: 1; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.error { color: var(--bad); font-size: 13px; margin-top: 6px; }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0; margin: 0; }
dl.facts dt, dl.facts dd { padding: 8px 0; border-bottom: 1px dashed var(--line); }
dl.facts dt { color: var(--muted); padding-right: 20px; font-size: 13px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
dl.facts dt:last-of-type, dl.facts dd:last-of-type { border-bottom: 0; }
.decision { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; color: var(--muted); font-size: 13px; }
.pager span { margin-right: auto; }

/* ---------- Dashboard ---------- */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.queue a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 -8px; border-radius: 10px; color: var(--text); font-weight: 550;
}
.queue a:hover { background: var(--surface-2); text-decoration: none; }
.queue .chip { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: var(--warn-soft); color: var(--warn); }
.queue .clear .chip { background: var(--ok-soft); color: var(--ok); }
.queue .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.queue .what small { color: var(--muted); font-weight: 450; font-size: 12.5px; }
.queue .num { font-size: 18px; font-weight: 720; }
.queue .clear .num { color: var(--muted); font-weight: 600; font-size: 14px; }
.queue .go { color: var(--muted); }

.chart { width: 100%; height: 260px; display: block; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.chart .bar-rect { fill: var(--brand); opacity: .85; transition: opacity .1s; }
.chart .bar-rect.today { fill: var(--brand-2); opacity: 1; }
.chart g:hover .bar-rect { opacity: 1; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.chart-head .big { font-size: 28px; font-weight: 740; letter-spacing: -0.02em; line-height: 1.1; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .what { flex: 1; min-width: 0; line-height: 1.35; }
.feed .what small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.split { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin: 6px 0 10px; }
.seg-0 { fill: var(--brand); background: var(--brand); }
.seg-1 { fill: #22b5a0; background: #22b5a0; }
.seg-2 { fill: #f2a33a; background: #f2a33a; }
.seg-3 { fill: #e5609b; background: #e5609b; }
.seg-4 { fill: #5aa6ee; background: #5aa6ee; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.keys i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }

.empty { text-align: center; padding: 26px 12px; color: var(--muted); }

/* ---------- Document viewer ---------- */
dialog.doc-viewer {
  width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 48px); max-height: none; padding: 0; border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.doc-viewer[open] { display: flex; flex-direction: column; }
dialog.doc-viewer::backdrop { background: rgba(8, 10, 24, .55); backdrop-filter: blur(3px); }
.doc-viewer header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.doc-viewer header > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.doc-viewer header .muted { font-size: 12.5px; }
.doc-viewer .icon-only { padding: 5px 7px; }
.doc-viewer-body { flex: 1; min-height: 0; overflow: auto; background: var(--surface-2); display: flex; }
.doc-viewer-body iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.doc-viewer-body img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; padding: 16px; box-sizing: border-box; }
.doc-viewer.zoomed .doc-viewer-body { display: block; }
.doc-viewer.zoomed .doc-viewer-body img { max-width: none; max-height: none; }

/* ---------- Jump palette ---------- */
dialog.palette {
  width: min(620px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); margin-top: 12vh;
}
dialog.palette::backdrop { background: rgba(8, 10, 24, .45); backdrop-filter: blur(3px); }
.palette .field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette .field input { flex: 1; border: 0; box-shadow: none; padding: 4px 0; font-size: 16px; background: transparent; min-height: 0; }
.palette .field input:focus { box-shadow: none; }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow-y: auto; }
.palette li.group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 10px 4px; font-weight: 650; }
.palette li a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.palette li a .icon { color: var(--muted); }
.palette li a small { margin-left: auto; color: var(--muted); }
.palette li a[aria-selected="true"], .palette li a:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.palette li a[aria-selected="true"] .icon { color: var(--brand-ink); }
.palette .hint { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---------- Sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login .art {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 90% at 0% 0%, #3b33c9 0%, transparent 60%), radial-gradient(90% 80% at 100% 100%, #1a6e8f 0%, transparent 55%), #0b1022;
}
.login .art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .14;
  background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
}
.login .art h2 { font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 750; max-width: 15ch; margin: 0 0 14px; }
.login .art p { color: #c3c8e6; max-width: 42ch; font-size: 15px; }
.login .art .ticks { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: #dfe2f5; }
.login .art .ticks li { display: flex; gap: 10px; align-items: center; }
.login .art .ticks .icon { color: #8ef0c9; }
.login .art > * { position: relative; z-index: 1; }
.login .art small { color: #8189b0; }
.login .panel { display: grid; place-items: center; padding: 32px 24px; background: var(--surface); }
.login form { width: 100%; max-width: 380px; }
.login form h1 { font-size: 26px; margin: 26px 0 6px; }
.login label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; color: var(--text-2); }
.login input { width: 100%; min-height: 44px; }
.login .btn { min-height: 44px; font-size: 14.5px; }
.brand.on-light { color: var(--text); padding: 0; }
.brand.on-light small { color: var(--muted); }

/* ---------- Helpers ---------- */
.full { width: 100%; }
.mt { margin-top: 14px; }
.narrow { max-width: 380px; }
.stack > * + * { margin-top: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Menu: groups, pins, filter, rail ---------- */
.shell { transition: grid-template-columns .18s ease; }
.brand { position: relative; }
.brand-name { flex: 1; min-width: 0; }
.rail-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--side-muted); cursor: pointer; transition: background .12s, color .12s;
}
.rail-btn:hover { background: var(--side-2); color: #fff; }
.nav-filter { padding: 0 4px 6px; }
.nav-filter input {
  width: 100%; border: 1px solid var(--side-2); background: var(--side-2); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px;
}
.nav-filter input::placeholder { color: var(--side-muted); }
.nav-filter input:focus { outline: none; border-color: #7c74ff; }
.side button.label {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font-family: inherit;
  border-radius: 6px; transition: color .12s;
}
.side button.label:hover { color: var(--side-text); }
.side button.label > span:first-child { flex: 1; }
.side button.label .icon { transition: transform .18s ease; }
.nav-group.collapsed button.label .icon { transform: rotate(-90deg); }
.group-count { display: none; background: #f59e0b; color: #1d1302; border-radius: 999px; font-size: 10px; line-height: 16px; padding: 0 6px; letter-spacing: 0; }
.nav-group.collapsed .group-count { display: inline-block; }
.nav-group .links { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .18s ease, opacity .18s ease; }
.nav-group .links-inner { min-height: 0; overflow: hidden; }
.nav-group.collapsed .links { grid-template-rows: 0fr; opacity: 0; overflow: hidden; }
.nav-group.collapsed .links-inner { visibility: hidden; }
.side.filtering .nav-group.collapsed .links { grid-template-rows: 1fr; opacity: 1; }
.side.filtering .nav-group.collapsed .links-inner { visibility: visible; }
.side .item { position: relative; }
.side .item .pin {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 0; border-radius: 6px; background: var(--side-2); color: var(--side-muted); cursor: pointer; opacity: 0; transition: opacity .12s, color .12s;
}
.side .item:hover .pin, .side .item .pin:focus-visible { opacity: 1; }
.side .item .pin:hover { color: #fff; }
.side .item .pin[aria-pressed=true] { color: #f5b544; }
.side .item:hover .count { visibility: hidden; }
.side .item.hidden-by-filter, .nav-group.hidden-by-filter { display: none; }
.side .nav-top { margin: 2px 0 4px; }
.side.settling .links, .side.settling button.label .icon { transition: none; }
.side mark { background: rgba(124, 116, 255, .35); color: #fff; border-radius: 3px; }
.nav-empty { padding: 8px 12px; font-size: 13px; }
.side a .count { transition: transform .2s; }
.side a .count.bump { animation: count-bump .6s ease; }
@keyframes count-bump { 30% { transform: scale(1.25); } }

/* Collapsed to icons (wide screens only). */
@media (min-width: 901px) {
  :root.rail .shell { grid-template-columns: 68px minmax(0, 1fr); }
  :root.rail .side { padding: 18px 10px 16px; overflow-x: hidden; }
  :root.rail .brand { flex-direction: column; padding: 2px 0 14px; gap: 10px; }
  :root.rail .brand-name, :root.rail .nav-filter, :root.rail .side a .text, :root.rail .side .pin, :root.rail .side .foot, :root.rail .nav-empty { display: none; }
  :root.rail .side button.label { justify-content: center; padding: 12px 0 4px; font-size: 0; }
  :root.rail .side button.label > span:first-child { display: none; }
  :root.rail .side button.label::before { content: ""; width: 18px; height: 1px; background: var(--side-2); }
  :root.rail .side button.label .icon, :root.rail .group-count { display: none; }
  :root.rail .nav-group.collapsed .links { grid-template-rows: 1fr; opacity: 1; }
  :root.rail .nav-group.collapsed .links-inner { visibility: visible; }
  :root.rail .side a { justify-content: center; padding: 9px 0; }
  :root.rail .side a .count { position: absolute; top: 2px; right: 4px; min-width: 16px; padding: 0 4px; font-size: 9.5px; line-height: 15px; }
  :root.rail .side a.active::before { left: -10px; }
  :root.rail .rail-btn .icon { transform: scaleX(-1); }
}

/* ---------- Small screens ---------- */
@media (max-width: 1100px) {
  .jump { min-width: 0; }
  .jump span, .jump kbd { display: none; }
  .who .name { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; height: 100vh; transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 10, 24, .5); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .bar { padding: 8px 16px; }
  .page { padding: 18px 16px 40px; }
  h1 { font-size: 21px; }
  .crumbs .group, .crumbs .sep { display: none; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid.stats .card { padding: 14px; }
  .stat .n { font-size: 20px; }
  .stat .sub { display: none; }
  .stat .chip { width: 28px; height: 28px; }
  .chart { height: 180px; }
  .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .side, .bar, .pager, form.row.card, .btn { display: none !important; }
  .shell { display: block; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}
.card .table-wrap { box-shadow: none; margin-bottom: 0; }

/* Two-step sign-in */
.codes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.codes code, code.secret { display: inline-block; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; letter-spacing: .04em; }
code.secret { font-size: 16px; word-break: break-all; }
.steps { padding-left: 20px; margin: 10px 0 0; display: grid; gap: 10px; }
.login details summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }

/* Satisfaction: the spread of ratings */
.satisfaction-bar { display: grid; grid-template-columns: 34px 1fr 32px; align-items: center; gap: 8px; font-size: 13px; margin-top: 4px; }
.satisfaction-bar .bar { height: 8px; border-radius: 999px; background: var(--line, #e5e7eb); overflow: hidden; }
.satisfaction-bar .bar > span { display: block; height: 100%; background: #f59e0b; border-radius: inherit; }
.satisfaction-bar > span:last-child { text-align: right; }

/* ---------- Website: ads ---------- */
.ad-thumb { width: 72px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.ad-preview { max-width: 100%; max-height: 160px; border-radius: 8px; object-fit: cover; }
.nowrap { flex-wrap: nowrap; }
.order-input { width: 70px; }
td.w-order { width: 90px; }
td.w-show { width: 60px; }
.mt { margin-top: 12px; }

/* Brand mark (partials/logo) and the page-change bar (page-loader.js) */
.brand svg.logo { flex-shrink: 0; width: 34px; height: 34px; background: none; box-shadow: none; border-radius: 0; filter: drop-shadow(0 6px 10px rgba(79, 70, 229, .35)); }
.page-loader { position: fixed; top: 0; left: 0; z-index: 1000; height: 3px; width: 0; background: #4f46e5; box-shadow: 0 0 8px rgba(79, 70, 229, .6); border-radius: 0 999px 999px 0; pointer-events: none; opacity: 0; }
.page-loader::after { content: ""; position: absolute; right: -1px; top: -1.5px; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.page-loader.is-running { opacity: 1; animation: page-loader 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes page-loader { 0% { width: 0; } 10% { width: 35%; } 100% { width: 92%; } }
@media (prefers-reduced-motion: reduce) { .page-loader.is-running { animation: none; width: 60%; } }

/* ---------- Website: banner styles, colours, sortable sections ---------- */
[data-ad-form] [hidden] { display: none !important; }
.ad-styles { border: 0; padding: 0; margin: 0; grid-column: 1 / -1; }
fieldset.stack { border: 0; padding: 0; margin: 0; }
fieldset legend { font-weight: 600; margin-bottom: 6px; }
.style-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.style-option { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.style-option:has(input:checked) { border-color: var(--brand); box-shadow: var(--ring); }
.style-option input { margin-top: 3px; }
.style-option > span:last-child { grid-column: 1 / -1; }
.style-sample { display: grid; gap: 3px; height: 44px; padding: 6px; border-radius: 8px; background: var(--surface-3); }
.style-sample i { display: block; border-radius: 3px; background: var(--brand); opacity: .75; }
.s-wide { grid-template-rows: 1fr; } .s-wide i:nth-child(n+2) { display: none; }
.s-split { grid-template-columns: 1fr 1fr; } .s-split i:nth-child(2) { opacity: .3; } .s-split i:nth-child(3) { display: none; }
.s-card { grid-template-columns: 1fr 1fr 1fr; }
.s-strip { align-content: center; } .s-strip i { height: 10px; } .s-strip i:nth-child(n+2) { display: none; }
.s-countdown { grid-template-columns: 1fr 1fr 1fr; } .s-countdown i { opacity: .55; }
.swatch-option { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; cursor: pointer; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; }
.t-indigo { background: linear-gradient(135deg, #4f46e5, #c026d3); }
.t-rose { background: linear-gradient(135deg, #f43f5e, #fb923c); }
.t-amber { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.t-emerald { background: linear-gradient(135deg, #059669, #14b8a6); }
.t-sky { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.t-dark { background: linear-gradient(135deg, #0f172a, #334155); }
.sort-tools { display: none; align-items: center; gap: 2px; }
.sortable-on .sort-tools { display: inline-flex; }
.sortable-on .order-input { display: none; }
.drag-handle, .sort-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.drag-handle { cursor: grab; touch-action: none; }
.drag-handle:hover, .sort-btn:hover { background: var(--surface-3); color: var(--text); }
.drag-handle:focus-visible, .sort-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.sort-btn:disabled { opacity: .3; cursor: default; }
tr.dragging { background: var(--brand-soft); box-shadow: var(--shadow); }
tr.dragging .drag-handle { cursor: grabbing; }
tr.moved { animation: moved .6s ease; }
@keyframes moved { from { background: var(--brand-soft); } to { background: transparent; } }
.sorting, .sorting * { cursor: grabbing !important; user-select: none; }
@media (prefers-reduced-motion: reduce) { tr.moved { animation: none; } }

/* Settings › Event categories */
.category-dot { display: inline-block; margin-right: 8px; vertical-align: 0; }
td.type-name { padding-left: 2.25rem; }
