/* ============================================================
   Order Tracker — white-label theme system
   Three directions selected via [data-theme] on .phone:
     mono · warm · cool
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --tab-h: 64px;
  --status-h: 30px;
}

/* ---------- loading + empty/error states ---------- */
.ot-loading {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: var(--bg);
}
.ot-spin { width: 34px; height: 34px; color: var(--accent); animation: ot-rot 0.8s linear infinite; }
.ot-spin svg { width: 100%; height: 100%; }
@keyframes ot-rot { to { transform: rotate(360deg); } }
.ot-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 60px 28px;
}
.ot-empty-ic {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface-2); color: var(--faint);
  display: grid; place-items: center; margin-bottom: 18px;
}
.ot-empty-ic svg { width: 28px; height: 28px; }
.ot-empty-t { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 19px; color: var(--ink); }
.ot-empty-d { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.5; max-width: 260px; }
.ot-empty .btn { width: auto; padding-left: 22px; padding-right: 22px; }

/* ---------- base reset for the iframe document ---------- */
html, body {
  height: 100%;
  background: #d9d6d1;
}
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   THEME TOKENS
   ============================================================ */

.phone[data-theme="mono"] {
  --bg: #ffffff;
  --canvas: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --ink: #1a1715;
  --ink-soft: #4b4742;
  --muted: #8c857d;
  --faint: #b8b2aa;
  --border: #e9e6e1;
  --border-strong: #ddd8d1;
  --accent: #1a1715;
  --accent-ink: #ffffff;
  --accent-soft: #f0eeea;
  --ok: #3f7d52;
  --ok-soft: #eef4ee;
  --warn: #9a6b2f;
  --warn-soft: #f6efe3;
  --info: #4b4742;
  --info-soft: #f0eeea;
  --font-head: "Newsreader", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(26,23,21,.05), 0 1px 0 rgba(26,23,21,.02);
  --shadow-lg: 0 8px 30px rgba(26,23,21,.10);
  --head-weight: 500;
  --head-spacing: -0.01em;
}

.phone[data-theme="warm"] {
  --bg: #faf6f0;
  --canvas: #efe7db;
  --surface: #fffdfa;
  --surface-2: #fbf6ee;
  --ink: #2c2419;
  --ink-soft: #5b4f40;
  --muted: #948674;
  --faint: #c3b6a2;
  --border: #ece2d3;
  --border-strong: #e1d4c0;
  --accent: #c0613b;
  --accent-ink: #fffaf5;
  --accent-soft: #f7e7dc;
  --ok: #4f7a4a;
  --ok-soft: #ebf2e7;
  --warn: #b07b2f;
  --warn-soft: #f7ecd8;
  --info: #b56a43;
  --info-soft: #f7e7dc;
  --font-head: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-pill: 999px;
  --shadow: 0 2px 8px rgba(120,86,52,.07);
  --shadow-lg: 0 14px 40px rgba(120,86,52,.16);
  --head-weight: 700;
  --head-spacing: -0.02em;
}

.phone[data-theme="cool"] {
  --bg: #ffffff;
  --canvas: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #0f1b2d;
  --ink-soft: #3a4658;
  --muted: #6b7688;
  --faint: #aab2c0;
  --border: #e5e9f0;
  --border-strong: #d6dce6;
  --accent: #2f53d9;
  --accent-ink: #ffffff;
  --accent-soft: #e9eefc;
  --ok: #1f8a5b;
  --ok-soft: #e6f5ee;
  --warn: #c07a14;
  --warn-soft: #fbf0db;
  --info: #2f53d9;
  --info-soft: #e9eefc;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow: 0 1px 3px rgba(15,27,45,.06), 0 1px 1px rgba(15,27,45,.03);
  --shadow-lg: 0 12px 36px rgba(15,27,45,.14);
  --head-weight: 600;
  --head-spacing: -0.02em;
}

/* dark mode overrides (applied per theme via .phone.dark) */
.phone.dark[data-theme="mono"] {
  --bg: #161412; --canvas:#0e0d0c; --surface:#1f1c1a; --surface-2:#242120;
  --ink:#f3f0ec; --ink-soft:#c7c1ba; --muted:#928b83; --faint:#5f5953;
  --border:#322e2b; --border-strong:#3d3936; --accent:#f3f0ec; --accent-ink:#161412;
  --accent-soft:#2a2724; --ok-soft:#1c2a1f; --warn-soft:#2c2418; --info-soft:#2a2724;
}
.phone.dark[data-theme="warm"] {
  --bg:#1f1812; --canvas:#140f0a; --surface:#2a2018; --surface-2:#312619;
  --ink:#f6ece0; --ink-soft:#d3c3b0; --muted:#9c8c78; --faint:#6b5d4c;
  --border:#3a2e22; --border-strong:#473828; --accent:#e07a4c; --accent-ink:#1f1812;
  --accent-soft:#3a2418; --ok-soft:#1d2818; --warn-soft:#332714; --info-soft:#3a2418;
}
.phone.dark[data-theme="cool"] {
  --bg:#0d1320; --canvas:#070b13; --surface:#141c2c; --surface-2:#1a2334;
  --ink:#eef2f8; --ink-soft:#c0cad9; --muted:#7d8a9d; --faint:#4d5a6f;
  --border:#243049; --border-strong:#2e3b56; --accent:#5b7bf0; --accent-ink:#0d1320;
  --accent-soft:#1a2540; --ok-soft:#102619; --warn-soft:#2a2110; --info-soft:#1a2540;
}

/* ============================================================
   PHONE SHELL
   ============================================================ */
.phone {
  position: relative;
  width: 100%;
  max-width: 390px;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* status bar */
.statusbar {
  height: var(--status-h);
  flex: 0 0 var(--status-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--bg);
  z-index: 5;
}
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { display: block; }

/* app header (brand + order) */
.appbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 4;
}
.brandmark {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  flex: 0 0 auto;
}
.appbar .brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.appbar .brand-name {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: 16px;
  letter-spacing: var(--head-spacing);
  color: var(--ink);
}
.appbar .brand-sub { font-size: 12px; color: var(--muted); }
.appbar .appbar-action {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  display: grid; place-items: center;
  cursor: pointer;
}

/* scrollable screen area */
.screens { position: relative; flex: 1 1 auto; min-height: 0; }
.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tab-h) + 18px);
  display: none;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { display: block; }
/* chat fills the area above the tab bar; its own input bar sits at the bottom */
#screen-chat { top: 0; bottom: var(--tab-h); padding: 0; }

/* ============================================================
   SHARED PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 22px 4px 10px;
}
.section-label:first-child { margin-top: 4px; }

.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  transition: transform .12s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn svg { width: 17px; height: 17px; }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 5px 11px 5px 9px;
  border-radius: var(--r-pill);
  letter-spacing: .01em;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.is-info { color: var(--info); background: var(--info-soft); }
.pill.is-warn { color: var(--warn); background: var(--warn-soft); }
.pill.is-ok { color: var(--ok); background: var(--ok-soft); }

/* ============================================================
   ORDER SCREEN
   ============================================================ */
.status-hero {
  border-radius: var(--r-lg);
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.status-hero .hero-icon {
  width: 46px; height: 46px; border-radius: var(--r-md);
  display: grid; place-items: center; margin-bottom: 14px;
}
.status-hero .hero-icon svg { width: 24px; height: 24px; }
.status-hero h1 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-spacing);
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 5px;
}
.status-hero p { color: var(--muted); font-size: 14px; }
.status-hero .eta {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.status-hero .eta .eta-k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.status-hero .eta .eta-v { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 17px; }

/* mini progress track */
.track-mini { display: flex; gap: 5px; margin-top: 16px; }
.track-mini .seg { flex: 1; height: 4px; border-radius: 999px; background: var(--border-strong); }
.track-mini .seg.on { background: var(--accent); }

.order-meta {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 14px 16px;
  margin-top: 14px;
}
.order-meta .om { display: flex; flex-direction: column; gap: 2px; }
.order-meta .om .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.order-meta .om .v { font-size: 14px; font-weight: 600; color: var(--ink); }

/* item line */
.item {
  display: flex; gap: 13px; align-items: center;
  padding: 13px 14px;
}
.item + .item { border-top: 1px solid var(--border); }
.thumb {
  width: 54px; height: 54px; border-radius: var(--r-sm);
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--faint);
  overflow: hidden;
}
.thumb svg { width: 24px; height: 24px; }
.item .info { flex: 1; min-width: 0; }
.item .info .nm { font-weight: 600; font-size: 14px; color: var(--ink); }
.item .info .var { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.item .price { font-weight: 600; font-size: 14px; white-space: nowrap; }
.item .qty { font-size: 12.5px; color: var(--muted); }

/* totals */
.totals { padding: 14px 16px; }
.totals .tr { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; color: var(--ink-soft); }
.totals .tr.grand {
  margin-top: 8px; padding-top: 13px; border-top: 1px solid var(--border);
  font-family: var(--font-head); font-weight: var(--head-weight);
  font-size: 18px; color: var(--ink);
}

/* address */
.address { padding: 15px 16px; display: flex; gap: 12px; }
.address .pin { color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.address .pin svg { width: 18px; height: 18px; }
.address .addr-body .nm { font-weight: 600; font-size: 14px; }
.address .addr-body .ln { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ============================================================
   TRACKING SCREEN
   ============================================================ */
.carrier {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
}
.carrier .clogo {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: 0 0 auto;
}
.carrier .clogo svg { width: 22px; height: 22px; }
.carrier .cinfo { flex: 1; min-width: 0; }
.carrier .cinfo .cn { font-weight: 600; font-size: 14px; }
.carrier .cinfo .ct { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.carrier .copy {
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink-soft); border-radius: var(--r-sm);
  padding: 7px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center;
}
.carrier .copy svg { width: 14px; height: 14px; }

/* timeline */
.timeline { padding: 6px 18px 18px; }
.tl-step { display: flex; gap: 14px; position: relative; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; width: 22px; }
.tl-node {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface);
  flex: 0 0 auto; margin-top: 14px; display: grid; place-items: center;
  z-index: 1;
}
.tl-node svg { width: 11px; height: 11px; color: var(--accent-ink); }
.tl-line { width: 2px; flex: 1; background: var(--border-strong); margin: 2px 0; min-height: 18px; }
.tl-step:last-child .tl-line { display: none; }
.tl-body { padding: 12px 0 14px; flex: 1; min-width: 0; }
.tl-body .tl-title { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.tl-body .tl-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* done */
.tl-step.done .tl-node { background: var(--accent); border-color: var(--accent); }
.tl-step.done .tl-line { background: var(--accent); }
/* current */
.tl-step.current .tl-node {
  border-color: var(--accent); background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.tl-step.current .tl-body .tl-title { color: var(--accent); }
.tl-step.current .tl-meta-now { color: var(--accent); font-weight: 600; }
/* upcoming */
.tl-step.upcoming .tl-body .tl-title { color: var(--faint); }
.tl-step.upcoming .tl-body .tl-meta { color: var(--faint); }

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.tl-step.current .tl-node { animation: pulse-ring 2.2s ease-out infinite; }

.return-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 16px; margin-bottom: 14px;
  background: var(--warn-soft); border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.return-banner .rb-ic { color: var(--warn); flex: 0 0 auto; margin-top: 1px; }
.return-banner .rb-ic svg { width: 20px; height: 20px; }
.return-banner .rb-t { font-weight: 700; font-size: 14px; color: var(--ink); }
.return-banner .rb-d { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* proactive exception banner */
.alert-banner {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; margin-bottom: 14px;
  background: var(--warn-soft); border: 1px solid var(--warn);
  border-radius: var(--r-lg);
}
.alert-banner .ab-ic {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--warn); color: var(--bg);
  display: grid; place-items: center;
}
.alert-banner .ab-body { flex: 1 1 auto; min-width: 0; }
.alert-banner .ab-ic svg { width: 17px; height: 17px; }
.alert-banner .ab-t { font-weight: 700; font-size: 14.5px; color: var(--ink); line-height: 1.32; }
.alert-banner .ab-d { font-size: 13px; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }
.alert-banner .ab-d b { color: var(--ink); }
.alert-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-mini {
  font-family: var(--font-body); font-weight: 600; font-size: 12.5px;
  padding: 8px 13px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
.btn-mini.solid { background: var(--warn); color: var(--bg); border-color: var(--warn); }

/* route map */
.route-card { padding: 0; overflow: hidden; margin-bottom: 14px; }
.route-map {
  position: relative; height: 152px;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 15px 15px,
    var(--surface-2);
}
.route-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.route-map .rm-pulse { animation: rmpulse 2.4s ease-out infinite; transform-origin: center; }
@keyframes rmpulse { 0% { transform: scale(.5); opacity: .35; } 70% { transform: scale(1.4); opacity: 0; } 100% { opacity: 0; } }
.route-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.route-foot .rf .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.route-foot .rf .v { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.route-foot .rf.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 5px 11px; border-radius: var(--r-pill);
}
.route-foot .rf.live .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: livedot 1.6s ease-in-out infinite; }
@keyframes livedot { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ============================================================
   CHAT SCREEN
   ============================================================ */
.chat-screen { display: flex; flex-direction: column; height: 100%; }
.chat-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.chat-head .agent-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: 0 0 auto; position: relative;
  font-weight: 700; font-family: var(--font-head);
}
.chat-head .agent-av .online {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2.5px solid var(--bg);
}
.chat-head .agent-meta .an { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.chat-head .agent-meta .ai-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 6px; border-radius: 999px; text-transform: uppercase;
}
.chat-head .agent-meta .as { font-size: 12.5px; color: var(--ok); font-weight: 600; }

.chat-ctx {
  flex: 0 0 auto;
  margin: 10px 16px 0;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--ink-soft);
}
.chat-ctx .cx-th {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--faint); flex: 0 0 auto;
}
.chat-ctx .cx-th svg { width: 15px; height: 15px; }
.chat-ctx b { color: var(--ink); font-weight: 700; }
.chat-ctx .cx-go { margin-left: auto; color: var(--muted); }

.chat-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: none;
}
.chat-log::-webkit-scrollbar { display: none; }
.chat-day { text-align: center; font-size: 11.5px; color: var(--faint); font-weight: 600; margin: 4px 0; }

.msg { max-width: 80%; display: flex; flex-direction: column; gap: 3px; }
.msg .bubble {
  padding: 10px 13px; font-size: 14.5px; line-height: 1.42;
  border-radius: var(--r-md);
}
.msg .stamp { font-size: 10.5px; color: var(--faint); padding: 0 4px; }
.msg.them { align-self: flex-start; }
.msg.them .bubble {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); border-bottom-left-radius: 4px;
}
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble {
  background: var(--accent); color: var(--accent-ink);
  border-bottom-right-radius: 4px;
}
.msg.me .stamp { display: flex; align-items: center; gap: 4px; }
.msg.me .stamp .read { color: var(--accent); }
.msg.me .stamp .read svg { width: 13px; height: 13px; display: block; }
.msg .img-att {
  border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border);
  width: 150px; height: 110px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--faint);
}
.msg .img-att svg { width: 28px; height: 28px; }

/* typing */
.typing { align-self: flex-start; }
.typing .bubble {
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 14px; border-radius: var(--r-md); border-bottom-left-radius: 4px;
  display: inline-flex; gap: 4px;
}
.typing .bubble i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint);
  animation: blink 1.3s infinite both;
}
.typing .bubble i:nth-child(2) { animation-delay: .2s; }
.typing .bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100%{opacity:.3; transform:translateY(0);} 30%{opacity:1; transform:translateY(-2px);} }

/* quick replies */
.quick-row {
  flex: 0 0 auto;
  display: flex; gap: 8px; padding: 8px 16px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.quick-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 8px 13px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--ink-soft); cursor: pointer;
  transition: background .15s, color .15s;
}
.chip:active { background: var(--accent-soft); color: var(--accent); }

/* input bar */
.chat-input {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px 12px; border-top: 1px solid var(--border);
  background: var(--bg);
}
.chat-input .attach {
  width: 38px; height: 38px; border-radius: var(--r-pill); flex: 0 0 auto;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink-soft); display: grid; place-items: center; cursor: pointer;
}
.chat-input .attach svg { width: 19px; height: 19px; }
.chat-input .field {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 0 6px 0 15px;
}
.chat-input input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink);
  padding: 10px 0; min-width: 0;
}
.chat-input input::placeholder { color: var(--faint); }
.chat-input .send {
  width: 34px; height: 34px; border-radius: var(--r-pill); flex: 0 0 auto;
  background: var(--accent); color: var(--accent-ink);
  border: none; display: grid; place-items: center; cursor: pointer;
  transition: opacity .15s, transform .12s;
}
.chat-input .send:active { transform: scale(.9); }
.chat-input .send svg { width: 17px; height: 17px; }

/* ============================================================
   BOTTOM TAB BAR
   ============================================================ */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--tab-h);
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-top: 1px solid var(--border);
  z-index: 10;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-family: var(--font-body);
  font-size: 11px; font-weight: 600; position: relative;
  padding-top: 6px;
}
.tab svg { width: 23px; height: 23px; }
.tab .badge {
  position: absolute; top: 6px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.tab.active { color: var(--accent); }
.tab.active svg { stroke-width: 2.2; }

/* ============================================================
   DEMO STATE BAR (scaffolding, sits above the phone)
   ============================================================ */
.demobar {
  width: 100%; max-width: 390px;
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: #16181d; color: #aeb4c0;
  font-family: "Manrope", system-ui, sans-serif;
}
.demobar .dl { font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #6c7488; flex: 0 0 auto; }
.demobar .seg { display: flex; background: #0d0f13; border-radius: 8px; padding: 3px; flex: 1; }
.demobar .seg button {
  flex: 1; border: none; background: none; cursor: pointer;
  color: #aeb4c0; font-size: 10px; font-weight: 600; padding: 5px 2px;
  border-radius: 6px; font-family: inherit; transition: background .15s, color .15s; white-space: nowrap;
}
.demobar .seg button.on { background: #2c313c; color: #fff; }
