/* Route 66 Copilot v2: premium editorial road-trip. Travelers 50-75 on phones.
   Base text 18/20/22 px (A- A+), nothing under 14 px, text contrast >= 7:1, targets >= 48 px.
   Sizes are in rem so the text-size control scales everything. Part 1: tokens, chrome, login. */
:root {
  /* Light "road by day" look (20/11): white ground, near-black text, road-sign yellow on the main button only.
     The old rust tokens now resolve to ink, so every accent stays readable with white text. */
  --cream: #FFFFFF;
  --paper: #FFFFFF;
  --sand: #F4F4F2;
  --shell: #ECECE9;
  --ink: #16171A;
  --ink-2: #4D4F55;
  --line: #E2E2DE;
  --line-strong: #8B8D93;
  --hair: rgba(22, 23, 26, 0.10);
  --rust: #16171A;
  --rust-strong: #16171A;
  --rust-deep: #000000;
  --rust-ink: #16171A;
  --yellow: #F2C230;        /* main button, Ask, "you are here" */
  --yellow-press: #E3B21C;
  --amber-ink: #8A6100;     /* yellow as text on white */
  --error-bg: #FBE3DC;
  --error-ink: #7A2414;
  --shadow-warm: 0 1px 2px rgba(22, 23, 26, 0.06), 0 8px 24px -10px rgba(22, 23, 26, 0.18);
  --shadow-float: 0 2px 6px rgba(22, 23, 26, 0.06), 0 18px 40px -18px rgba(22, 23, 26, 0.28);
  --inner-hl: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --r-shell: 22px; --r-core: 16px; --r-pill: 999px;
  --base: 18px;
  --head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: var(--cream); }
body { font-family: var(--body); font-size: 1rem; line-height: 1.6; color: var(--ink); min-height: 100dvh; }
#root { width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ico { flex-shrink: 0; }
.skip-link {
  position: fixed; left: 16px; top: -100px; z-index: 200; padding: 12px 18px; min-height: 48px;
  background: var(--ink); color: var(--paper); font-weight: 700; border-radius: 12px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 48px; padding: 10px 18px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink);
  font-size: 1rem; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  box-shadow: var(--inner-hl);
  transition: background-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn:hover { background: var(--sand); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); box-shadow: none; }
.btn-primary:hover { background: var(--yellow-press); border-color: var(--yellow-press); }
.btn-primary:disabled { background: var(--shell); border-color: var(--shell); color: var(--ink); cursor: not-allowed; box-shadow: none; }
.btn-quiet { background: transparent; box-shadow: none; }
.btn-danger { background: var(--error-ink); border-color: var(--error-ink); color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { cursor: not-allowed; }

/* ---------- Layout ---------- */
.app { display: flex; width: 100%; height: 100%; overflow: hidden; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; }
.main[hidden] { display: none; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; -webkit-overflow-scrolling: touch; }
.column { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------- Floating top bar ---------- */
.topbar { flex-shrink: 0; padding: 12px 16px 4px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.pill-bar {
  max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 12px; min-height: 64px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.94); border: 1px solid var(--hair);
  box-shadow: var(--inner-hl), var(--shadow-float);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; overflow: hidden; }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.brand-name { font-family: var(--head); font-weight: 800; font-size: 1.45rem; line-height: 1; letter-spacing: -0.005em; white-space: nowrap; }
.brand-name em, .side-brand em { font-style: normal; color: var(--rust-ink); }
.bar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.size-ctl { display: flex; border-radius: var(--r-pill); background: var(--sand); padding: 3px; gap: 2px; }
.size-btn {
  min-width: 48px; min-height: 48px; border: 0; border-radius: var(--r-pill); background: transparent;
  font-weight: 700; font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums;
}
.size-big { font-size: 1.2rem; }
.size-btn:hover:not(:disabled) { background: var(--paper); }
.size-btn:disabled { color: var(--ink-2); opacity: .55; cursor: default; }
.btn-bar { padding: 8px 14px; border-color: transparent; background: transparent; box-shadow: none; }
.btn-bar:hover { background: var(--sand); }

/* ---------- Offline banner ---------- */
.offline {
  max-width: 820px; margin: 8px auto 0; width: calc(100% - 32px); display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); font-weight: 600;
}

/* ---------- Side panel: Chats | Trips ---------- */
.side {
  width: 320px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--sand); border-right: 1px solid var(--hair);
}
.side-head { padding: 18px 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 800; font-size: 1.4rem; line-height: 1; }
.side-brand img { border-radius: 50%; }
.side-new { padding: 8px 16px 12px; }
.tabs { display: flex; margin: 0 16px 8px; padding: 4px; gap: 4px; background: var(--shell); border-radius: var(--r-pill); border: 1px solid var(--hair); }
.tabs [role="tab"] {
  flex: 1; min-height: 48px; border: 0; border-radius: var(--r-pill); background: transparent;
  font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink);
}
.tabs [role="tab"][aria-selected="true"] { background: var(--paper); box-shadow: var(--inner-hl), var(--shadow-warm); }
.side-list { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.group-label { font-weight: 700; font-size: 0.8rem; color: var(--ink-2); margin: 16px 8px 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.row { display: flex; align-items: stretch; gap: 4px; margin-bottom: 4px; }
.row-open {
  flex: 1; min-width: 0; min-height: 52px; text-align: left; padding: 10px 14px; border-radius: 14px;
  border: 1.5px solid transparent; background: transparent; font-size: 1rem; overflow-wrap: anywhere;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.row-open:hover { background: var(--paper); }
.row-open[aria-current="true"] { background: var(--paper); border-color: var(--line-strong); font-weight: 700; }
.row-sub { font-size: 0.85rem; color: var(--ink-2); font-weight: 400; }
.row-del {
  width: 48px; min-height: 48px; border-radius: 14px; border: 1.5px solid transparent; background: transparent;
  color: var(--ink-2); display: flex; align-items: center; justify-content: center;
}
.row-del:hover { border-color: var(--error-ink); color: var(--error-ink); background: var(--paper); }
.row-confirm { flex-direction: column; padding: 12px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--error-ink); }
.row-confirm-text { font-weight: 600; overflow-wrap: anywhere; }
.row-confirm-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.empty-state { text-align: center; padding: 28px 12px; color: var(--ink-2); }
.empty-state p { margin: 8px 0 0; font-weight: 700; color: var(--ink); }
.empty-state .empty-sub { font-weight: 400; color: var(--ink-2); }
.side-foot { padding: 12px 16px 16px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-2); overflow-wrap: anywhere; }
.side-panel { position: fixed; inset: 0; z-index: 50; width: 100%; border-right: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; background: var(--ink); color: var(--cream);
}

/* Legal links (login card, side panel) */
.legal-links { margin: 12px 0 0; font-size: 0.875rem; text-align: center; color: var(--ink-2); }
.legal-links a { color: var(--ink-2); display: inline-block; min-height: 48px; line-height: 48px; padding: 0 6px; text-underline-offset: 3px; }
