:root {
  --board: #0E0F11; --flap: #17191D; --seam: #26292F; --letter: #F2EFE6; --letter-dim: #9A9A94;
  --amber: #F5B400; --amber-pressed: #E0A400; --amber-ink: #1A1200;
  --card: #F7F4EC; --card-2: #EFEBE0; --ink: #1B1B1B; --ink-2: #5C5A54; --rule: #D9D3C4;
  --sans: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --cond: "Barlow Semi Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --safe-top: 16px; --safe-bottom: 0px;
}
@media (display-mode: standalone) { :root { --safe-top: max(54px, calc(env(safe-area-inset-top) + 12px)); --safe-bottom: env(safe-area-inset-bottom); } }
@supports (padding: env(safe-area-inset-top)) { :root { --safe-top: max(16px, env(safe-area-inset-top)); } @media (display-mode: standalone) { :root { --safe-top: max(54px, calc(env(safe-area-inset-top) + 12px)); } } }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--board); font-family: var(--sans); color: var(--letter); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body.paper { background: var(--card); color: var(--ink); }
a { color: var(--amber); }
::selection { background: var(--amber); color: var(--amber-ink); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a.row, a.key, .nav a, .zone a, .chips a { text-decoration: none; color: inherit; }
button:focus-visible, a:focus-visible, [contenteditable]:focus-visible, textarea:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.app { width: 100%; max-width: 480px; margin: 0 auto; height: 100dvh; overflow: hidden; position: relative; background: var(--board); display: flex; flex-direction: column; }
.paper .app { background: var(--card); color: var(--ink); }
.safe-top { height: var(--safe-top); flex: none; }
.scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { display: none; }

.strip { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 20px 14px; border-bottom: 1px solid var(--seam); }
.strip .name { font-family: var(--cond); font-weight: 600; font-size: 20px; letter-spacing: 0.10em; text-transform: uppercase; white-space: nowrap; }
.strip .meta { font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--letter-dim); font-variant-numeric: tabular-nums; text-align: right; }
.strip .meta b { color: var(--amber); font-weight: 600; }
.strip .back { display: flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; margin-left: -8px; padding: 0 8px; font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; color: inherit; }
.strip .back:active { color: var(--letter-dim); }

.zone { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 20px 0; border: 1px solid var(--seam); border-radius: 6px; overflow: hidden; }
.zone a, .zone button { min-height: 44px; display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-weight: 600; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--letter-dim); }
.zone .on { background: var(--flap); color: var(--letter); }
.zone a:active { color: var(--letter); }

.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 20px 8px; }
.counter { display: flex; flex-direction: column; gap: 8px; }
.counter .lab { font-family: var(--cond); font-weight: 500; font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); white-space: nowrap; }
.counter .lab.hot { color: var(--amber); }
.tile { position: relative; height: 64px; background: var(--flap); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-weight: 600; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; box-shadow: 0 1px 0 var(--seam) inset, 0 6px 14px -8px rgba(0,0,0,0.9); }
.tile::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--board); opacity: 0.9; }
.tile.hot { color: var(--amber); }
.tile.flip { animation: flap 520ms cubic-bezier(0.16, 1, 0.3, 1) both; transform-origin: 50% 50%; }

.section-lab { font-family: var(--cond); font-weight: 500; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--letter-dim); padding: 22px 20px 6px; }
.section-lab.hot { color: var(--amber); }
.legend { padding: 0 20px 6px; font-family: var(--cond); font-weight: 500; font-size: 11px; letter-spacing: 0.06em; color: var(--letter-dim); line-height: 1.6; }
.legend b { color: var(--letter); font-weight: 600; letter-spacing: 0.10em; }
.gap { height: 28px; }
.rows { display: flex; flex-direction: column; padding: 0 12px; }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 60px; padding: 8px 8px; text-align: left; border-radius: 4px; border-top: 1px solid var(--seam); }
.row:first-child { border-top: 0; }
.row:active { background: var(--flap); }
.row .code { font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.10em; color: var(--letter-dim); display: flex; flex-direction: column; line-height: 1.1; }
.row .code b { font-size: 22px; color: var(--letter); font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.row .code i { font-style: normal; font-size: 11px; }
.row .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .from { font-size: 17px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .subj { font-size: 15px; color: var(--letter-dim); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flapc { position: relative; font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase; background: var(--flap); padding: 8px 8px; border-radius: 3px; min-width: 84px; text-align: center; color: var(--letter); }
.flapc::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--board); opacity: 0.9; }
.flapc.needs, .flapc.escalated { color: var(--amber); }
.flapc.draft { color: var(--letter); }
.flapc.chasing, .flapc.waiting { color: var(--letter-dim); }
.flapc.newsender { color: var(--letter); border: 1px dashed var(--letter-dim); background: transparent; }
.flapc.newsender::after { display: none; }

.thumb { flex: none; padding: 12px 20px calc(22px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--seam); background: var(--board); }
.key { min-height: 56px; border-radius: 6px; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--cond); font-weight: 600; font-size: 18px; letter-spacing: 0.12em; text-transform: uppercase; width: 100%; }
.key.amber { background: var(--amber); color: var(--amber-ink); box-shadow: 0 8px 20px -10px rgba(245,180,0,0.55); }
.key.amber:active { background: var(--amber-pressed); }
.key.outline { border: 1px solid var(--seam); color: var(--letter); min-height: 48px; }
.key.outline:active { background: var(--flap); }
.key[disabled], .key.disabled { opacity: 0.45; pointer-events: none; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--seam); border-radius: 6px; overflow: hidden; }
.seg button { min-height: 44px; font-family: var(--cond); font-weight: 600; font-size: 14px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); }
.seg button.on { background: var(--flap); color: var(--letter); }
.sched { min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); font-variant-numeric: tabular-nums; }
.sched .shadow { color: var(--amber); border: 1px solid var(--amber); border-radius: 3px; padding: 4px 8px; }
.nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nav a, .nav button { min-height: 44px; display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--letter-dim); border-radius: 4px; }
.nav .on { color: var(--letter); background: var(--flap); }
.nav a:active { color: var(--letter); }

.chips { display: flex; gap: 8px; padding: 14px 20px 4px; }
.chips a { min-height: 44px; padding: 0 14px; display: flex; align-items: center; border-radius: 4px; border: 1px solid var(--seam); font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); }
.chips .on { background: var(--flap); color: var(--letter); border-color: var(--flap); }

.paper .strip { border-bottom-color: var(--rule); }
.paper .strip .meta { color: var(--ink-2); }
.pass { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 18px; }
.stub { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stub .code { font-family: var(--cond); font-weight: 600; font-size: 22px; letter-spacing: 0.10em; text-transform: uppercase; }
.stub .box { font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); text-align: right; }
.pass h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.pass .from { font-size: 15px; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pass .from b { color: var(--ink); font-weight: 600; }
.pass p { margin: 0; font-size: 17px; line-height: 1.5; max-width: 66ch; }
.pass .rec { font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.notice { font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber-ink); background: var(--amber); padding: 10px 12px; border-radius: 4px; }
.perf { height: 0; border-top: 2px dashed var(--rule); margin: 4px -20px; position: relative; }
.perf::before, .perf::after { content: ""; position: absolute; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--board); }
.perf::before { left: -9px; } .perf::after { right: -9px; }
.draftlab { display: flex; justify-content: space-between; align-items: center; min-height: 20px; }
.draftlab span { font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.draftlab .saved { color: #2F7D4E; display: flex; gap: 6px; align-items: center; }
.draftlab .saved:empty { display: none; }
.draft { min-height: 150px; font-size: 17px; line-height: 1.5; padding: 14px; background: var(--card-2); border-radius: 4px; border: 1px solid var(--rule); white-space: pre-wrap; font-family: var(--sans); color: var(--ink); width: 100%; resize: vertical; }
.draft:focus { border-color: var(--ink-2); outline: none; }
.draft:empty::before { content: attr(data-placeholder); color: var(--ink-2); }
.mic { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--ink); display: flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }
.mic:active { background: var(--ink); color: var(--card); }
.actions { flex: none; padding: 12px 20px calc(22px + var(--safe-bottom)); background: var(--card); border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 10px; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) 36px 128px; align-items: stretch; }
.main .send { grid-column: 3; }
.ikey { min-height: 52px; border-radius: 6px; border: 1px solid var(--ink); color: var(--ink); font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.10em; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.ikey:active { background: var(--ink); color: var(--card); }
.ikey.send { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.ikey.send:active { background: var(--amber-pressed); }
.ikey.send.armed { background: var(--ink); border-color: var(--ink); color: var(--card); }
.ikey[disabled], .ikey.disabled { opacity: 0.4; pointer-events: none; }
.ikey.busy { opacity: 0.6; pointer-events: none; }
.small { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.small.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.small button { min-height: 44px; border-radius: 4px; font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--rule); }
.small button:active { background: var(--card-2); color: var(--ink); }
.small button.busy { opacity: 0.5; pointer-events: none; }

.talk { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.ctx { display: inline-flex; align-self: flex-start; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 999px; font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); max-width: 100%; }
.ctx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.said { font-size: 17px; line-height: 1.5; color: var(--ink-2); font-style: italic; }
.said b { font-style: normal; font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; display: block; margin-bottom: 6px; }
.said textarea { width: 100%; min-height: 96px; font: inherit; font-style: normal; color: var(--ink); background: var(--card-2); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; resize: vertical; }
.said textarea:focus { border-color: var(--ink-2); outline: none; }
.vocab { display: flex; flex-wrap: wrap; gap: 8px; }
.vocab span { font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.04em; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px; padding: 6px 10px; }
.hint { text-align: center; font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-2); }
.hint.left { text-align: left; }

.prog { padding: 18px 20px 0; display: flex; justify-content: space-between; font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); font-variant-numeric: tabular-nums; }
.bar { margin: 10px 20px 0; height: 2px; background: var(--seam); }
.bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1); }
.logrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 56px; padding: 8px; border-top: 1px solid var(--seam); }
.logrow:first-child { border-top: 0; }
.logrow .code { font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.10em; color: var(--letter-dim); }
.logrow .name { font-size: 15px; color: var(--letter); }
.logrow .st { font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); background: var(--flap); padding: 8px 8px; border-radius: 3px; min-width: 118px; text-align: center; position: relative; }
.logrow .st::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--board); opacity: 0.9; }
.logrow .st.hot { color: var(--amber); }
.logrow .st.flip { animation: flap 520ms cubic-bezier(0.16, 1, 0.3, 1) both; transform-origin: 50% 50%; }
.ticker { margin: 18px 20px 0; padding-top: 12px; border-top: 1px solid var(--seam); font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.04em; color: var(--letter-dim); line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.ticker div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker .say { color: var(--letter); white-space: normal; }
.ticker .err { color: var(--amber); white-space: normal; }

.empty { padding: 40px 20px; text-align: center; color: var(--letter-dim); font-size: 17px; line-height: 1.5; }
.empty b { display: block; color: var(--letter); font-family: var(--cond); font-weight: 600; font-size: 20px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.handled { margin: 0 20px; padding: 14px 0 0; color: var(--letter-dim); font-size: 15px; line-height: 1.45; }
.handled b { color: var(--letter); font-weight: 500; }
.handled + .handled { padding-top: 10px; }
.days { font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); white-space: nowrap; }
.days.hot { color: var(--amber); }
.toast { position: fixed; left: 50%; bottom: calc(120px + var(--safe-bottom)); transform: translateX(-50%); background: var(--flap); color: var(--letter); border: 1px solid var(--seam); border-radius: 4px; padding: 10px 14px; font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; max-width: 90vw; z-index: 9; }
.paper .toast { background: var(--ink); color: var(--card); border-color: var(--ink); }
.login { padding: 40px 20px 0; display: flex; flex-direction: column; gap: 18px; }
.login h1 { margin: 0; font-family: var(--cond); font-weight: 600; font-size: 28px; letter-spacing: 0.10em; text-transform: uppercase; }
.login p { margin: 0; color: var(--letter-dim); font-size: 17px; line-height: 1.5; }
.login .status { font-family: var(--cond); font-weight: 500; font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--letter-dim); min-height: 20px; }
.login .status.hot { color: var(--amber); }
.actlog { padding: 0 20px; }
.actlog div { border-top: 1px solid var(--seam); padding: 10px 0; font-size: 15px; color: var(--letter); display: flex; justify-content: space-between; gap: 12px; }
.actlog div span:last-child { color: var(--letter-dim); font-family: var(--cond); font-size: 13px; letter-spacing: 0.06em; white-space: nowrap; }

@keyframes flap { 0% { transform: perspective(700px) rotateX(-88deg); opacity: 0.2; } 100% { transform: perspective(700px) rotateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tile.flip, .logrow .st.flip { animation: none; } .bar i { transition: none; } }
