/* dispatch look: dark, monospace, hard edges, one amber accent */
/* self-hosted variable font (latin subset), preloaded from index.html and precached by the SW */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/jetbrains-mono.woff2?v=f34c325640) format("woff2"); }
:root {
  --bg: #0e1116;
  --panel: #151920;
  --line: #232830;
  --border: #3a404a;
  --ink: #e8e6df;
  --muted: #8f948f;
  --dim: #5c6169;
  --accent: #f5b642;
  --ok: #7ee787;
  --danger: #ff6b6b;
  --font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.4; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea, select { outline: 0; }
input:focus, textarea:focus, select:focus, .prompt:focus-within { border-color: var(--accent) !important; }
[hidden] { display: none !important; }
.grow { flex: 1; }
a { color: var(--ink); }

.app { max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
@media (max-width: 659px) { .app { border-left: 0; border-right: 0; } }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 5; flex-shrink: 0; background: var(--bg); display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-t)) 8px 8px; border-bottom: 1px solid var(--line); min-height: 56px; }
.logo { margin: 0 0 0 12px; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: none; cursor: pointer; user-select: none; }
.logo span { color: var(--accent); }
.logo::after { content: "_"; color: var(--accent); }
.clock { font-size: 11px; color: var(--muted); }
.topbar.sub { justify-content: space-between; padding-right: 16px; }
.topbar.sub .grow { display: none; }
.crumb { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.top-right { display: flex; align-items: center; justify-content: flex-end; min-width: 44px; }
.top-right .icon-btn { margin-right: -10px; }
.top-spacer { width: 44px; }
.toplink { font-size: 12px; color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.toplink:hover { color: var(--ink); }
a.icon-btn { text-decoration: none; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn:disabled { color: var(--dim); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
svg.i { width: 1em; height: 1em; vertical-align: -0.15em; }

.view { flex: 1; padding: 0 0 calc(24px + var(--safe-b)); display: flex; flex-direction: column; }
.view.with-composer { padding-bottom: calc(160px + var(--safe-b)); }

/* labels / text */
.label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.accent { color: var(--accent); }
.center { text-align: center; }
.section { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.section.rule { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.section.settings { margin: 0 20px; padding-left: 0; padding-right: 0; gap: 12px; }
.examples { display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.kv > .label { line-height: 20px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; }
button.kv-row.edit { width: 100%; border: 0; background: transparent; padding: 0; font: inherit; color: inherit; text-align: left; min-height: 20px; }
.kv input.inline { height: 40px; font-size: 13px; padding: 0 10px; }
.dot { display: inline-block; width: 8px; height: 8px; background: var(--accent); vertical-align: middle; margin-right: 8px; }
.dot.ok { background: var(--ok); }
.dot.off { background: var(--dim); }
.link { border: 0; background: transparent; padding: 0; min-height: 44px; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; display: inline-flex; align-items: center; }
.link.danger { color: var(--danger); }

/* buttons */
.btn { height: 52px; padding: 0 16px; border: 1px solid var(--border); background: var(--panel); color: var(--ink); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--bg); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding-left: 18px; }
.btn.light { border-color: var(--ink); background: var(--ink); color: var(--bg); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding-left: 18px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.outline { background: transparent; border-color: var(--accent); color: var(--accent); letter-spacing: 1px; text-transform: uppercase; padding-left: 17px; }
.btn.big { height: 60px; width: 100%; font-size: 15px; gap: 12px; }
.btn.h48 { height: 48px; }
.btn.h44 { height: 44px; }
.btn.snooze { height: 52px; font-size: 15px; font-weight: 700; }
.btn.sq { width: 52px; padding: 0; flex-shrink: 0; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.rec { border-color: var(--danger); color: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }
.btn:active { filter: brightness(1.2); }

.row { display: flex; gap: 8px; align-items: center; }
.row > input:not([type=checkbox]), .row > select { flex: 1; width: auto; min-width: 0; }
.row > select { flex: 0 1 140px; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mt { margin-top: 12px; }

/* inputs */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], textarea, select { height: 52px; border: 1px solid var(--border); background: var(--panel); padding: 0 14px; font-size: 13px; width: 100%; border-radius: 0; -webkit-appearance: none; appearance: none; color-scheme: dark; }
textarea { height: auto; min-height: 110px; padding: 12px 14px; font-size: 13px; line-height: 1.6; resize: vertical; }
input[type=checkbox] { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin: 0; padding: 0; border: 2px solid var(--ink); background: transparent; border-radius: 0; position: relative; cursor: pointer; flex-shrink: 0; }
input[type=checkbox]::before { content: ""; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; background: var(--accent); transform: scale(0); }
input[type=checkbox]:checked::before { transform: scale(1); }
.prompt { display: flex; align-items: center; gap: 8px; min-height: 52px; border: 1px solid var(--border); background: var(--panel); padding: 0 12px; flex: 1 1 auto; min-width: 0; cursor: text; }
.prompt::before { content: ">"; color: var(--accent); font-weight: 700; }
.prompt input, .prompt textarea { border: 0; background: transparent; padding: 0; height: auto; min-height: 0; font-size: 13px; flex: 1; width: auto; min-width: 0; }
.prompt .btn { border: 0; background: transparent; width: 40px; height: 44px; margin-right: -10px; color: var(--muted); }
.prompt .btn.rec { color: var(--danger); }
.prompt textarea { resize: none; line-height: 18px; padding: 16px 0; max-height: 152px; box-sizing: border-box; display: block; }
.field { display: flex; flex-direction: column; gap: 8px; }
.form { flex: 1; gap: 22px; padding-top: 24px; padding-bottom: 32px; }
.form textarea { resize: none; }
.form input.time { font-weight: 700; text-align: center; padding: 0 8px; }
.form input.title { font-size: 15px; font-weight: 700; }
.when-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.form input[type=text] { font-size: 15px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chip { height: 44px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 12px; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { border-color: var(--accent); background: var(--accent); color: var(--bg); font-weight: 700; }

/* firing banner */
.banner { margin: 12px 16px 0; border: 1px solid var(--accent); color: var(--accent); padding: 12px 14px; display: flex; align-items: center; gap: 12px; font-size: 13px; cursor: pointer; }
.banner b { font-weight: 700; letter-spacing: 1.5px; }
.banner .t { color: var(--ink); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* list */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 0; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 14px; }
.tab { border: 0; background: transparent; padding: 0; min-height: 44px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.toolbar label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.list { list-style: none; margin: 0; padding: 0 16px; display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 64px 18px minmax(0, 1fr) 24px; gap: 12px; align-items: center; padding: 16px 4px; border-top: 1px solid var(--line); user-select: none; -webkit-user-select: none; }
.item.dragging { opacity: .4; }
.item.over { box-shadow: 0 -2px 0 var(--accent); }
.item.over-after { box-shadow: 0 2px 0 var(--accent); position: relative; z-index: 1; }
.item .when { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.item .when b { font-size: 15px; color: var(--ink); }
.item.firing .when, .item.firing .when b, .item.due .when b { color: var(--accent); }
.check { width: 18px; height: 18px; border: 1.5px solid var(--ink); background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.check::after { content: ""; position: absolute; inset: -14px; }
.check svg { width: 12px; height: 12px; }
.item .main { min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.item .title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; }
.item.firing .meta { color: var(--accent); }
.item .body-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handle { width: 24px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--border); cursor: grab; touch-action: none; }
.handle.off { visibility: hidden; }
.item.done { color: var(--dim); }
.item.done .when, .item.done .when b, .item.done .meta { color: var(--dim); }
.item.done .when span { font-size: 12px; }
.item.done .title { text-decoration: line-through; color: var(--dim); }
.item.done .body-preview { color: var(--dim); }
.item.done .check { border-color: var(--dim); background: var(--dim); }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 13px; line-height: 1.8; }
.anno { font-size: 11px; color: var(--dim); text-align: center; padding: 16px 20px 0; margin: 0; }

/* composer */
.composer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; }
.composer .inner { position: relative; max-width: 640px; margin: 0 auto; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 16px; padding-bottom: max(12px, var(--safe-b)); display: flex; flex-direction: column; }
.composer .bar { display: flex; gap: 8px; align-items: flex-end; }
.composer .bar .btn.sq { width: 48px; height: 48px; }
.composer .prompt { min-height: 48px; }
.composer .prompt textarea { font-size: 14px; padding: 14px 0; }
.fab { position: absolute; right: 16px; bottom: 100%; margin-bottom: 12px; width: 48px; height: 48px; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; }
.fab svg { width: 22px; height: 22px; }
.composer .preview { display: block; padding: 0 4px 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .preview > * { margin-right: 10px; }
.composer .preview b { color: var(--ink); font-weight: 500; }
.composer .preview::before { content: "›"; color: var(--accent); margin-right: 10px; }

/* notify / detail heads */
.head { display: flex; flex-direction: column; gap: 14px; padding: 28px 20px 24px; border-bottom: 1px solid var(--line); }
.head.notify h1 { font-size: 30px; }
.head h1 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.5px; overflow-wrap: anywhere; }
.head p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); white-space: pre-wrap; }
.status { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
.status .dot { margin: 0; }
.status.muted { color: var(--muted); }
.status b { font-weight: 700; }
.status span.n { color: var(--muted); letter-spacing: 0; text-transform: none; }
.section.others { margin: 20px 20px 0; padding: 14px 0 0; border-top: 1px solid var(--line); gap: 6px; }
.others a { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 48px; text-decoration: none; }
.others a b { color: var(--accent); }
.others a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.footer-row { display: flex; justify-content: space-between; align-items: center; padding: 24px 20px 8px; }

/* login */
.login { padding: 40px 20px; display: flex; flex-direction: column; gap: 16px; }

.toast { position: fixed; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 14px; z-index: 20; font-size: 12px; max-width: 90vw; }
kbd { font-family: inherit; color: var(--muted); }
kbd::before { content: "> "; color: var(--accent); }
.hr { border-top: 1px solid var(--line); margin: 0; }

/* desktop: framed column with 24px margin all around */
@media (min-width: 660px) {
  body { display: flex; flex-direction: column; align-items: center; padding: 80px 0; overflow: hidden; }
  .app { width: 100%; height: 100%; min-height: 0; margin: 0; overflow-y: auto; scrollbar-gutter: stable; border: 1px solid var(--line); }
  .composer { bottom: 80px; }
  .composer .inner { border: 1px solid var(--line); padding-bottom: 12px; }
  .toast { top: 144px; }
}
