:root {
  --bg: #0e1116;
  --card: #171c24;
  --ink: #e8eef6;
  --muted: #8b97a8;
  --line: #2a3340;
  --accent: #7dd3fc;
  --go: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --pad: max(16px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif; }
body { padding: 12px var(--pad) 40px; max-width: 720px; margin: 0 auto; }
@media (min-width: 900px) {
  body { max-width: 1100px; }
}
button, input, textarea { font: inherit; color: inherit; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 0; font-size: 28px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
button, .ghost { background: #243041; border: 0; border-radius: 12px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
button:active { transform: scale(.98); }
button.danger { background: #3b1d22; color: #fecaca; }
.compose, .card, .needs-you, .login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.kind-row { display: flex; gap: 16px; margin-bottom: 8px; color: var(--muted); }
textarea, input, select, input[type=password], input[type=datetime-local] {
  width: 100%; background: #0e1116; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.critical { background: #7f1d1d; color: #fecaca; }
.open { background: #1e293b; color: #93c5fd; }
.waiting { background: #713f12; color: #fde68a; }
.in_progress { background: #14532d; color: #86efac; }
.compose-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.compose-row .meta { flex: 1; }
.compose-row button { background: var(--accent); color: #082f49; font-weight: 700; min-width: 96px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.hist { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.hist th, table.hist td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.hist th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.hist tr.clickable { cursor: pointer; background: transparent; color: inherit; }
table.hist tr.clickable:hover { background: #1a222d; }
table.hist tr.selected { background: #1e3a4c; }
table.hist td.last-note { color: var(--muted); max-width: 280px; }
@media (min-width: 900px) {
  table.hist { min-width: 0; }
}
.track { background: #422006; color: #fdba74; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; overflow-x: visible; }
.tabs button { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tabs button.on { background: #243041; color: var(--ink); }
.tabs.subtabs { margin-top: 0; }
.view-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.view-bar label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.view-bar select { width: auto; min-width: 220px; }
.view-bar .ghost { padding: 8px 12px; }
.view-bar .danger, .view-bar #btn-archive-page { min-width: auto; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; min-width: 0; }
#detail .thread-log { max-height: 36vh; overflow: auto; margin: 8px 0; }
#detail h3 { margin: 4px 0 8px; font-size: 18px; }
.read-body {
  max-height: min(56vh, 640px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  margin: 8px 0;
  padding: 4px 2px 10px;
  user-select: text;
  -webkit-user-select: text;
}
.read-body p { margin: 0; white-space: inherit; }
.page-add { margin-top: 12px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.job { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.job.clickable { cursor: pointer; }
.job h3 { margin: 0 0 4px; font-size: 16px; }
.meta { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11px; margin-right: 6px; }
.queued { background: #1e293b; color: #93c5fd; }
.in_progress { background: #14532d; color: #86efac; }
.awaiting_input { background: #713f12; color: #fde68a; }
.done { background: #1e3a5f; color: #bae6fd; }
.ready { background: #3f3c16; color: #fde68a; }
.stopped, .cancelled { background: #3f1d1d; color: #fecaca; }
.reminder { background: #312e81; color: #c7d2fe; }
.hidden { display: none !important; }
body.on-talk #current-card { display: none !important; }
.needs-you { border-color: var(--warn); }
.q { margin: 8px 0; }
.q textarea { margin: 6px 0; }
.thread-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 50vh; overflow: auto; }
.bubble { border-radius: 14px; padding: 10px 12px; }
.bubble.greg { background: #1e3a4c; }
.bubble.grok { background: #1f2937; }
.bubble.system { background: #111827; color: var(--muted); font-size: 13px; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, 92vw); }
.login-card h1 { margin-bottom: 8px; }
.login-card button { width: 100%; margin-top: 12px; background: var(--accent); color: #082f49; font-weight: 700; }
.login-card details { margin-top: 18px; color: var(--muted); }
.login-card summary { cursor: pointer; }
.login-card #btn-passkey { margin-top: 8px; }
.passkey-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.passkey-row button { min-width: auto; width: auto; }
#passkey-banner { border-color: var(--accent); }
.keep-awake-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
}
.keep-awake-row input[type=checkbox] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.keep-awake-row .meta { display: block; margin-top: 2px; }
.gigs-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.gigs-head .stat { color: var(--muted); font-size: 13px; }
.gigs-head button.primary { background: var(--accent); color: #082f49; font-weight: 700; }
.gigs-grid { display: grid; gap: 10px; }
@media (min-width: 900px) {
  .gigs-grid.two { grid-template-columns: 1fr 1fr; }
}
.gigs-form label { display: block; color: var(--muted); font-size: 12px; margin: 8px 0 4px; }
.gigs-form .row { display: flex; gap: 8px; flex-wrap: wrap; }
.gigs-form .row > * { flex: 1; min-width: 120px; }
.pill.matched, .pill.drafted, .pill.approved { background: #14532d; color: #86efac; }
.pill.bid, .pill.won { background: #1e3a5f; color: #bae6fd; }
.pill.skipped, .pill.lost { background: #3f1d1d; color: #fecaca; }
.pill.error { background: #7f1d1d; color: #fecaca; }
.pill.score { background: #312e81; color: #c7d2fe; }
.pill.p1 { background: #14532d; color: #86efac; font-weight: 700; }
.pill.p2 { background: #1e3a5f; color: #bae6fd; }
.pill.p3 { background: #713f12; color: #fde68a; }
.pill.p4 { background: #1f2937; color: #9ca3af; }
.pill.p9 { background: #3f1d1d; color: #fecaca; }
.pill.sent { background: #14532d; color: #86efac; font-weight: 700; }
.pill.you-apply { background: #713f12; color: #fde68a; font-weight: 700; }
.pill.queued { background: #1e3a5f; color: #bae6fd; }
.pursue { background: #14532d; color: #86efac; }
.maybe { background: #713f12; color: #fde68a; }
.skip, .skipped, .lost { background: #3b1d22; color: #fecaca; }
.submitted, .approved, .drafted { background: #1e3a5f; color: #93c5fd; }
.won, .in_progress, .delivered { background: #134e4a; color: #99f6e4; }
.invoiced { background: #4c1d95; color: #ddd6fe; }
.paid { background: #14532d; color: #bbf7d0; }
.retainer { background: #1e1b4b; color: #c7d2fe; }
.gigs-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.gigs-actions button { min-width: auto; padding: 8px 12px; }
.hint-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.banner.err { background: #3b1d22; color: #fecaca; padding: 8px 10px; border-radius: 10px; margin: 8px 0; }
.job-actions { display: flex; gap: 8px; margin-top: 8px; }
.job-actions button { flex: 1; }

#btn-call { background: var(--accent); color: #082f49; font-weight: 700; }
.pickup-overlay {
  position: sticky; top: 0; z-index: 20; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.pickup-overlay #btn-pickup {
  width: 100%; background: #14532d; color: #bbf7d0; text-align: left;
  padding: 16px; border-radius: 16px; display: flex; flex-direction: column; gap: 4px;
}
.pickup-overlay #btn-pickup strong { font-size: 18px; color: #fff; }
.pickup-overlay #btn-pickup-later { align-self: flex-end; min-width: auto; }
.voice-status { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.voice-bar {
  display: flex; gap: 8px; align-items: center; margin: 8px 0 10px;
  position: sticky; bottom: 0;
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  z-index: 6;
}
.voice-bar .mic {
  flex: 1; min-width: 0; min-height: 56px; border-radius: 999px; font-weight: 700;
  background: var(--accent); color: #082f49; font-size: 18px;
}
.voice-bar .mic.listening { background: #7f1d1d; color: #fecaca; animation: pulse 1.2s ease-in-out infinite; }
.voice-bar .mic.thinking { background: #713f12; color: #fde68a; }
.voice-bar .mic.speaking { background: #14532d; color: #bbf7d0; }
.voice-bar .mic.skipped { background: #422006; color: #fdba74; animation: none; }
.voice-skip {
  background: #422006;
  color: #fdba74;
  border: 1px solid #854d0e;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 0 0 8px;
}
.voice-skip.hidden { display: none; }
.voice-awake {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #86efac;
  background: #14532d;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
#btn-voice-end { flex-shrink: 0; }
@keyframes pulse { 50% { transform: scale(.98); opacity: .85; } }
.thread { padding-bottom: 12px; }
#c-talk.has { background: #713f12; color: #fde68a; border-radius: 999px; padding: 0 6px; }
@media (max-width: 640px) {
  .thread-log { max-height: 42vh; }
  .voice-bar .mic { min-height: 64px; }
  .voice-awake { display: none; }
}
