/* Regular: warm paper, ink, and one ember accent. Light and dark. */
:root {
  --paper: #f6f1e9;
  --card: #fffdf9;
  --ink: #1d1a16;
  --muted: #7a7066;
  --line: #e7dfd3;
  --soft: #efe8de;
  --accent: #b4532a;
  --accent-ink: #fff7ec;
  --accent-soft: #f6e2d6;
  --hot-bg: #fbe1d9; --hot: #9c2f1b;
  --warm-bg: #fcefd0; --warm: #85560a;
  --calm-bg: #ddf0e2; --calm: #22693d;
  --book-bg: #e3ebf7; --book: #24508f;
  --plain-bg: #ece5da; --plain: #5b5248;
  --bubble-in: #ece6dd;
  --bubble-out: #1d1a16; --bubble-out-ink: #fbf6ee;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --radius: 16px;
  --display: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --tabs-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15120e;
    --card: #201b16;
    --ink: #f3ece2;
    --muted: #a3978a;
    --line: #342c24;
    --soft: #2a241e;
    --accent: #e0794b;
    --accent-ink: #1b120c;
    --accent-soft: #3a2519;
    --hot-bg: #43201a; --hot: #ffb4a1;
    --warm-bg: #3d2f15; --warm: #f5cf86;
    --calm-bg: #1b3524; --calm: #9fdcb2;
    --book-bg: #1d2a40; --book: #a9c6f2;
    --plain-bg: #2c2620; --plain: #cdbfae;
    --bubble-in: #2b251f;
    --bubble-out: #f3ece2; --bubble-out-ink: #1d1a16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.42 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { font-family: var(--display); letter-spacing: -.01em; margin: 0; }

.boot { height: 100dvh; }

/* ---- shell ---------------------------------------------------------------------- */
.shell {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}
.screen {
  padding: env(safe-area-inset-top) 0 calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
}
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 640px; margin: 0 auto;
  display: flex;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tab {
  flex: 1; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 6px 0; position: relative; min-height: 48px;
}
.tab.on { color: var(--accent); }
.tab-icon { font-size: 18px; line-height: 1; }
.badge {
  position: absolute; top: 2px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; line-height: 18px; text-align: center;
}

/* ---- header --------------------------------------------------------------------- */
.head { padding: 14px 18px 8px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--paper) 78%, transparent); }
.head.sub { padding-bottom: 0; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head h1 { font-size: 26px; font-weight: 800; }
.who-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); min-height: 44px;
}
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on { background: #3aa864; box-shadow: 0 0 0 3px color-mix(in srgb, #3aa864 25%, transparent); }
.live.retry { background: #d9a03a; animation: pulse 1.4s infinite; }
.menu {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding-top: 8px;
}
.menu-note { color: var(--muted); font-size: 13px; margin-right: auto; }
.back {
  border: 0; background: none; color: var(--accent);
  font-weight: 650; font-size: 16px; padding: 4px 12px 4px 0;
  min-height: 44px; min-width: 44px;
}

/* ---- triage list ---------------------------------------------------------------- */
.list { padding: 4px 12px; display: flex; flex-direction: column; gap: 10px; }
.row {
  text-align: left; width: 100%;
  border: 1px solid var(--line); background: var(--card);
  border-radius: var(--radius); padding: 13px 14px 12px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.row:active { transform: scale(.985); }
.row::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: transparent;
}
.row.urgency-3::before { background: var(--hot); }
.row.urgency-2::before { background: var(--warm); }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.who { font-weight: 700; font-size: 16px; }
.meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px; }
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 650;
  padding: 2px 9px; border-radius: 999px; border: 0;
  background: var(--plain-bg); color: var(--plain);
}
.chip.hot { background: var(--hot-bg); color: var(--hot); }
.chip.warm { background: var(--warm-bg); color: var(--warm); }
.chip.calm { background: var(--calm-bg); color: var(--calm); }
.chip.booking { background: var(--book-bg); color: var(--book); }
.chip.small { font-size: 11px; padding: 1px 7px; margin-left: 6px; }
.chip.big { font-size: 14px; padding: 8px 14px; cursor: pointer; }
.quote {
  margin: 4px 0 0; color: var(--ink); opacity: .82; font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.status-line { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; }
.status-line.good { color: var(--calm); }
.status-line.warn { color: var(--warm); }
.status-line.bad { color: var(--hot); }
.status-line.calm { color: var(--muted); }

.empty { text-align: center; padding: 56px 28px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 20px; margin: 10px 0 6px; }
.empty-mark { font-size: 40px; }
.shimmer {
  height: 92px; border-radius: var(--radius); margin: 0 0 10px;
  background: linear-gradient(90deg, var(--soft), var(--card), var(--soft));
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
.shimmer.tall { height: 240px; }

/* ---- one guest ------------------------------------------------------------------ */
.guest { padding: 4px 14px; display: flex; flex-direction: column; gap: 12px; }
.guest-name { font-size: 26px; font-weight: 800; }
.summary { margin: 0; font-size: 15px; color: var(--muted); }
.ctx-card, .card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.k, .card-k {
  color: var(--muted); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700; margin-top: 8px;
}
.k:first-child, .card-k { margin-top: 0; }
.v { margin-top: 2px; }
.v.muted { color: var(--muted); }
.v.note { font-size: 13px; color: var(--muted); }
.thread { display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 84%; padding: 9px 12px 6px; border-radius: 18px; }
.bubble.in { background: var(--bubble-in); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.out { background: var(--bubble-out); color: var(--bubble-out-ink); align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble .subject { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; }
.bubble .full-toggle { margin-top: 4px; min-height: 44px; padding: 0 2px; border: 0; background: none; font: inherit; font-size: 0.85em; color: inherit; opacity: 0.8; text-decoration: underline; cursor: pointer; }
.bubble .at { font-size: 10.5px; opacity: .6; text-align: right; margin-top: 2px; }
.card.draft { border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 35%, var(--card)); }
.card.draft .card-k { color: var(--accent); }
.card.change .card-v, .card.failed .card-v { font-weight: 650; margin-top: 2px; }
.card.failed { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); background: color-mix(in srgb, var(--hot-bg) 45%, var(--card)); }
.card.failed .card-k { color: var(--hot); }
.card.sender-warning { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); background: color-mix(in srgb, var(--hot-bg) 45%, var(--card)); color: var(--hot); font-weight: 600; }
.reason { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--warm); }
.draft-text { margin: 4px 0 0; white-space: pre-wrap; }
.draft-edit, .composer textarea {
  width: 100%; margin-top: 6px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--card); outline: none;
}
.draft-edit:focus, .composer textarea:focus, .signin input:focus, .talk input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btns { display: flex; gap: 8px; margin-top: 10px; }
.btns .btn { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; padding: 10px 14px;
  background: var(--soft); color: var(--ink);
  font-weight: 650; font-size: 14px; text-decoration: none;
  transition: transform .1s ease, opacity .1s ease;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.quiet { background: none; padding: 6px 12px; color: var(--accent); min-width: 44px; }
.btn.notice { background: var(--accent-soft); color: var(--accent); margin: 4px 0 10px; }
.card .confirm, .offer .confirm { margin: 8px 0 0; font-weight: 650; color: var(--hot); }
.btn.danger { color: var(--hot); }
.btn.wide { width: 100%; padding: 13px; font-size: 16px; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin: 4px 0 12px; }
.composer textarea { margin: 0; }

/* ---- assistant ------------------------------------------------------------------ */
.chat { padding: 4px 12px; display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 80px; }
.bub { max-width: 84%; padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; }
.bub.ai { background: var(--bubble-in); align-self: flex-start; border-bottom-left-radius: 6px; }
.bub.me { background: var(--bubble-out); color: var(--bubble-out-ink); align-self: flex-end; border-bottom-right-radius: 6px; }
.bub.typing { display: flex; gap: 4px; padding: 13px 14px; }
.bub.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.bub.typing span:nth-child(2) { animation-delay: .2s; }
.bub.typing span:nth-child(3) { animation-delay: .4s; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.offer {
  align-self: flex-start; width: 88%;
  background: var(--card); border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow);
}
.offer .btns { margin-top: 8px; }
.done-row { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 4px; }
.done-row .chip.small { margin-left: 0; }
.talk {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
  display: flex; gap: 8px; padding: 8px 12px;
  background: linear-gradient(transparent, var(--paper) 30%);
  z-index: 6;
}
.talk input {
  flex: 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 11px 16px; outline: none; box-shadow: var(--shadow);
}
.mic, .send {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: none;
  font-size: 19px; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.mic { background: var(--card); border: 1px solid var(--line); }
.mic.on { background: var(--accent); color: var(--accent-ink); animation: breathe 1.2s infinite; }
.send { background: var(--ink); color: var(--paper); font-weight: 800; }
.send:disabled { opacity: .35; }

/* ---- sign in -------------------------------------------------------------------- */
.signin {
  max-width: 420px; margin: 0 auto;
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}
.signin-mark img { border-radius: 15px; box-shadow: var(--shadow); }
.signin-title { font-size: 36px; font-weight: 800; margin-top: 18px; }
.signin-sub { color: var(--muted); font-size: 16px; margin: 6px 0 24px; }
.signin-form { display: flex; flex-direction: column; gap: 14px; }
.signin label span { display: block; font-size: 13px; font-weight: 650; margin-bottom: 5px; }
.signin input {
  width: 100%; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 12px 14px; outline: none; font-size: 16px;
}
.signin-more summary { color: var(--muted); font-size: 13px; cursor: pointer; margin-bottom: 6px; }
.signin-foot { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 18px; }
.form-error {
  margin: 0; padding: 10px 12px; border-radius: 12px;
  background: var(--hot-bg); color: var(--hot); font-size: 14px;
}

/* ---- toast ---------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 70px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes breathe { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Read by screen readers, not shown. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- incoming call -------------------------------------------------------------- */
.call-pop {
  position: fixed; inset: 0; z-index: 50;
  background: var(--paper);
  overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 18px) 14px calc(env(safe-area-inset-bottom) + 18px);
}
.call-inner { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.call-kicker {
  margin: 0; display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
}
.call-ring { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.call-name { font-size: 34px; font-weight: 800; line-height: 1.1; }
.call-sub { margin: 0; font-size: 17px; color: var(--muted); }
.call-reason { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.call-likely { font-size: 18px; font-weight: 650; margin-top: 2px; }
.chip.plain { background: var(--plain-bg); color: var(--plain); }
.call-btns .btn { min-height: 52px; font-size: 16px; }
@media (prefers-reduced-motion: reduce) { .call-ring { animation: none; } }

/* Accounts: sign-in providers, venues, settings. */
.btn.provider { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn.provider.google { background: var(--card); }
.btn.provider.apple { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.signin-email, .signin-legacy { display: flex; flex-direction: column; gap: 10px; }
.signin-more label { display: block; margin-bottom: 12px; }
.form-note { margin: 0; font-size: 13.5px; color: var(--calm); }
.chip.venue { background: var(--accent-soft); color: var(--accent); }
.venue-switch select, .settings select, .settings input[type="text"], .settings input[type="email"],
.settings input[type="date"], .settings textarea {
  font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; max-width: 100%;
}
.venue-switch select { font-size: 13px; padding: 6px 8px; max-width: 46vw; }
.banner { margin: 6px 12px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; }
.banner.warn { background: var(--warm-bg); color: var(--warm); }
.banner.invite { background: var(--accent-soft); display: flex; align-items: center; gap: 10px; }
.banner.invite p { margin: 0; flex: 1; }
.support-banner { background: var(--hot); color: var(--paper); text-align: center; font-size: 13px; font-weight: 650; padding: 6px 12px; }
.settings { padding: 4px 12px 24px; display: flex; flex-direction: column; gap: 12px; }
.settings label { display: block; }
.settings label > span { display: block; font-size: 13px; font-weight: 650; margin: 8px 0 4px; }
.settings textarea { width: 100%; min-height: 80px; }
.settings input[type="text"], .settings input[type="email"] { width: 100%; }
.list-card { padding: 0; overflow: hidden; }
.setting-row { display: flex; justify-content: space-between; width: 100%; padding: 14px 16px; border: 0;
  border-bottom: 1px solid var(--line); background: none; text-align: left; font-weight: 600; }
.setting-row:last-child { border-bottom: 0; }
.setting-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line); }
.setting-line:last-of-type { border-bottom: 0; }
.setting-line > span:first-child { flex: 1; min-width: 40%; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.shown-once { border: 1.5px dashed var(--accent); display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border-radius: 12px; margin-top: 8px; }
.secret { font-size: 13px; word-break: break-all; background: var(--soft); padding: 8px; border-radius: 8px; user-select: all; }
.snippet { font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--soft); padding: 8px;
  border-radius: 8px; margin: 0; }
.danger-card { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); }
.venue-limits { border: 0; padding: 0; margin: 8px 0; }
.venue-limits legend { font-size: 13px; font-weight: 650; }
.linkish { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.linkish.reset { display: block; font-size: 12.5px; margin: 2px 0 6px; }
.org-picker { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; font-size: 13px; }
.card.history .v { margin: 2px 0; }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; table-layout: fixed; }
.diff th { text-align: left; font-weight: 650; color: var(--muted); padding: 4px; }
.diff td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top;
  white-space: pre-wrap; word-break: break-word; }
.diff td.path { font-family: ui-monospace, monospace; font-size: 12px; }
.diff td.before { color: var(--muted); text-decoration: line-through; }
.diff td.after { color: var(--calm); font-weight: 600; }
.change-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
