/* Presentation adapted from 0xqtpie/demo-alternate. Existing app.js owns all data and workflows. */
:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #14161a;
  --panel-2: #060608;
  --border: rgba(255,255,255,.08);
  --soft-border: rgba(255,255,255,.05);
  --text: #ecedee;
  --secondary: #a7adb3;
  --muted: #7b8289;
  --gold: #c8a24b;
  --gold-highlight: #e6c76e;
  --green: #3fb950;
  --green-solid: #3fb950;
  --amber: #e5b94b;
  --red: #e5534b;
  --blue: #58a6ff;
  --overlay: rgba(255,255,255,.06);
  --overlay-soft: rgba(255,255,255,.02);
  --glow: rgba(200,162,75,.08);
  --mono: 'JetBrains Mono', monospace;
  --shadow: 0 18px 42px rgba(0,0,0,.22);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f5;
  --panel: #fff;
  --panel-2: #f0f0f2;
  --border: rgba(0,0,0,.1);
  --soft-border: rgba(0,0,0,.06);
  --text: #18181b;
  --secondary: #52525b;
  --muted: #82828c;
  --gold: #9a7b2e;
  --gold-highlight: #8a6b26;
  --green: #16823c;
  --green-solid: #16823c;
  --amber: #986f17;
  --red: #c0362e;
  --blue: #2563c9;
  --overlay: rgba(0,0,0,.05);
  --overlay-soft: rgba(0,0,0,.03);
  --glow: rgba(200,162,75,.1);
  --shadow: 0 18px 42px rgba(0,0,0,.08);
}
html { background: var(--bg); }
body {
  min-height: 100vh;
  font-family: Archivo, Arial, sans-serif;
  background: radial-gradient(ellipse at 50% -20%, var(--glow), transparent 60%), var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { color: #0b0c0e; background: var(--gold); }
a { color: var(--gold); }
button, input, select { font: inherit; }
button, a, input, select { transition: background-color 160ms, border-color 160ms, color 160ms; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.topnav {
  min-height: 68px;
  padding: 10px 24px;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-color: var(--border);
}
.nav-left { min-width: 0; }
.brand-logo { width: 32px; height: 49px; object-fit: contain; flex-shrink: 0; }
.brand-name { font-size: 14px; font-weight: 500; letter-spacing: .025em; }
.brand-sub { font: 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; }
.nav-tabs { gap: 4px; }
.nav-tabs a { position: relative; font-size: 13px; font-weight: 500; padding: 8px 12px; border-radius: 6px; color: var(--secondary); }
.nav-tabs a:hover { background: var(--overlay); color: var(--text); }
.nav-tabs a.active { background: var(--overlay); color: var(--gold); }
.nav-tabs a.active::after { content: ''; position: absolute; bottom: 0; left: 12px; right: 12px; height: 1px; background: var(--gold); opacity: .5; }
.nav-right { gap: 16px; color: var(--secondary); }
.nav-meta { font: 11px var(--mono); }
.nav-email { font: 12px Archivo, Arial, sans-serif; }
.live { font-weight: 400; color: var(--secondary); }
.live-dot { box-shadow: 0 0 12px color-mix(in srgb, var(--green) 25%, transparent); }
.theme-toggle { display: flex; gap: 3px; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--overlay-soft); color: var(--muted); cursor: pointer; }
.theme-toggle span { width: 24px; height: 24px; display: grid; place-items: center; font-size: 19px; border-radius: 50%; }
.theme-toggle[aria-checked="true"] .theme-moon, .theme-toggle[aria-checked="false"] .theme-sun { background: var(--gold); color: var(--bg); }
main { max-width: 1840px; padding: 28px 34px 60px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1, .detail-head h2, .mail-detail-head h2 { font-family: Newsreader, Georgia, serif; font-weight: 400; letter-spacing: -.035em; }
.page-head h1 { font-size: 44px; line-height: 1.1; margin-bottom: 6px; }
.page-head .sub { color: var(--secondary); font-size: 13px; }
.page-head .sub span { color: var(--muted); padding: 0 5px; }
.command-head, .typist-head, .mail-head { display: none; }
main:has(#view-command.active) .command-head,
main:has(#view-typist.active) .typist-head,
main:has(#view-mail.active) .mail-head { display: block; }
.panel, .stat-row, .table-wrap, .typist-list {
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel) 96%, var(--gold)));
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 var(--soft-border), var(--shadow);
}
.panel { padding: 20px; margin-bottom: 16px; }
.panel-title { font: 11px var(--mono); letter-spacing: .1em; color: var(--secondary); padding-bottom: 15px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.stat-row { gap: 0; border: 1px solid var(--border); overflow: hidden; margin-bottom: 20px; }
.stat-tile { background: transparent; border: none; border-right: 1px solid var(--border); border-radius: 0; padding: 18px 20px; display: flex; flex-direction: column-reverse; gap: 12px; }
.stat-tile:last-child { border-right: none; }
.stat-tile.accent-amber, .stat-tile.accent-green { border-left: none; }
.stat-tile:hover { background: var(--overlay-soft); }
.stat-num { font-size: 28px; line-height: 1; font-weight: 400; }
.stat-label { font: 11px var(--mono); color: var(--secondary); text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.accent-amber .stat-num { color: var(--gold); }
.accent-green .stat-num { color: var(--green); }
#view-command.active { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 0 20px; }
#view-command .stat-row { grid-column: 1 / -1; }
#view-command > .panel { min-width: 0; }
.activity-row { border-color: var(--soft-border); padding: 15px 0; gap: 12px; }
.activity-row .ref { color: var(--gold); }
.activity-row .who { font-weight: 500; }
.activity-row .what { color: var(--secondary); }
.flow-list { list-style: none; padding: 0; counter-reset: flow; display: grid; gap: 12px; }
.flow-list li { position: relative; counter-increment: flow; padding: 16px 16px 16px 49px; border: 1px solid var(--soft-border); border-radius: 6px; background: var(--panel-2); font-size: 12px; line-height: 1.7; }
.flow-list li::before { content: '0' counter(flow); position: absolute; left: 16px; top: 17px; font: 11px var(--mono); color: var(--gold); }
.flow-list b { font-weight: 500; }
.btn { font-size: 12px; font-weight: 500; border-radius: 6px; }
.btn-green { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.btn-green:hover { background: var(--gold-highlight); border-color: var(--gold-highlight); }
.btn-green:disabled { background: var(--overlay); color: var(--muted); border-color: var(--border); }
.btn-subtle { background: var(--overlay-soft); color: var(--secondary); }
.btn-subtle:hover { background: var(--overlay); color: var(--text); }
.btn-amber { border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); }
.btn-amber:hover { background: var(--overlay); }
.chip { border-radius: 4px; padding: 4px 8px; font: 10px var(--mono); font-weight: 400; background: var(--overlay-soft); }
.chip.green, .chip.amber, .chip.red, .chip.blue { border-color: color-mix(in srgb, currentColor 25%, transparent); background: color-mix(in srgb, currentColor 7%, transparent); }
.filter-row { padding: 14px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; gap: 8px; }
.filter-row input[type="text"], .filter-row select { background: var(--panel-2); border-radius: 5px; padding: 9px 12px; }
.filter-row input[type="text"] { flex: 1; min-width: min(240px, 100%); }
.filter-row .toggle.on { color: var(--gold); border-color: var(--gold); }
table.dark-table th { font: 10px var(--mono); letter-spacing: .08em; color: var(--secondary); background: var(--overlay-soft); padding: 15px; }
table.dark-table td { border-color: var(--soft-border); padding: 16px 15px; }
table.dark-table tbody tr:hover, .typist-item:hover, .mail-item:hover { background: var(--overlay-soft); }
table.dark-table tr.onhold td { background: color-mix(in srgb, var(--amber) 4%, transparent); }
.typist-item.onhold { border-radius: 0; }
.typist-list { flex-basis: 280px; }
.typist-list .list-head { font: 10px var(--mono); letter-spacing: .08em; padding: 16px; }
.typist-item, .mail-item { border-bottom-color: var(--soft-border); padding: 16px; }
.typist-item.selected, .mail-item.selected { background: var(--overlay); border-left-color: var(--gold); }
.typist-item .ti-ref { color: var(--gold); font-size: 11px; }
.typist-item .ti-name { font-weight: 500; font-size: 13px; margin-top: 8px; }
.typist-detail { grid-template-columns: minmax(0,1fr) minmax(260px, .8fr); }
.detail-head h2 { font-size: 32px; }
.kv-row { border-bottom: 1px solid var(--soft-border); padding: 10px 0; gap: 12px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .v { font-size: 11px; overflow-wrap: anywhere; }
.doc-row { padding: 12px; font-size: 12px; background: var(--overlay-soft); border-radius: 5px; }
.ref-box { flex-wrap: wrap; }
.ref-box .ref { color: var(--gold); border-radius: 5px; font-size: 19px; font-weight: 400; }
.ready-box { border-radius: 6px; line-height: 1.65; font-size: 12px; }
.ready-box.ok { border-color: color-mix(in srgb, var(--green) 30%, transparent); background: color-mix(in srgb, var(--green) 5%, transparent); }
.ready-box.warn { border-color: color-mix(in srgb, var(--amber) 30%, transparent); background: color-mix(in srgb, var(--amber) 5%, transparent); }
.ready-box .head { font-family: var(--mono); }
.mail-left { flex-basis: 360px; }
.mail-item .mi-subject { font-weight: 500; line-height: 1.6; }
.mail-item .mi-top { font-size: 11px; overflow-wrap: anywhere; }
.mail-detail-head h2 { font-size: 30px; }
.mail-body { background: var(--panel-2); border-radius: 6px; line-height: 1.9; }
.att-chip { border-radius: 5px; }
.empty-state { border-radius: 8px; line-height: 1.8; }
.view > .empty-state { border: 1px dashed var(--border); background: var(--overlay-soft); padding: 64px 24px; }
.toast { border-color: var(--gold); background: var(--panel); font-weight: 400; max-width: calc(100vw - 32px); }
@media (max-width: 1250px) { .nav-email { display: none; } .typist-detail { grid-template-columns: 1fr; } }
@media (max-width: 1000px) {
  .nav-right .nav-meta, .nav-right > .btn { display: none; }
  #view-command.active { grid-template-columns: 1fr; }
  .mail-left { flex-basis: 320px; }
}
@media (max-width: 760px) {
  .topnav { padding: 10px 18px; gap: 10px; }
  .brand-sub { display: none; }
  .nav-right { margin-left: auto; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .nav-tabs a { flex: 1; text-align: center; white-space: nowrap; padding: 8px; font-size: 12px; }
  main { padding: 24px 18px 40px; }
  .page-head h1 { font-size: 36px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tile { border-bottom: 1px solid var(--border); padding: 16px; }
  .stat-tile:nth-child(2) { border-right: none; }
  .stat-tile:nth-child(n+3) { border-bottom: none; }
  .stat-label { font-size: 10px; }
  .typist-layout, .mail-layout { flex-direction: column; }
  .typist-list, .mail-left, .mail-right { flex-basis: auto; width: 100%; }
  .typist-list { max-height: 240px; }
  .typist-detail { width: 100%; }
  .panel { padding: 16px; }
  .filter-row > input, .filter-row > select { min-width: 0; max-width: 100%; }
  .filter-row > input[type="text"] { flex-basis: 100%; }
  .kv-row { flex-wrap: wrap; }
  .doc-row { flex-wrap: wrap; }
  .activity-row .who { min-width: 0; }
  .activity-row .what { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
