/* BudConcierge — Polished UI */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:        #1a9968;
  --green-dark:   #0d7a52;
  --green-light:  #e8f7f1;
  --green-mid:    #a8dfc9;
  --green-text:   #0a5c3a;
  --surface:      #ffffff;
  --surface-2:    #f7f8f6;
  --surface-3:    #f0f1ee;
  --border:       rgba(0,0,0,0.07);
  --border-mid:   rgba(0,0,0,0.13);
  --text-1:       #111310;
  --text-2:       #5a5c57;
  --text-3:       #9a9c97;
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    20px;
  --radius-xl:    28px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08),0 2px 4px rgba(0,0,0,0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #22b57a; --green-dark: #1a9968; --green-light: #0d2e1f;
    --green-mid: #1a4a32; --green-text: #5dcaa5;
    --surface: #1c1e1b; --surface-2: #232520; --surface-3: #2a2c27;
    --border: rgba(255,255,255,0.07); --border-mid: rgba(255,255,255,0.12);
    --text-1: #e8ebe4; --text-2: #9a9c97; --text-3: #5a5c57;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  }
}

html,body { height:100%; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size:15px; background:var(--surface-2); color:var(--text-1); -webkit-font-smoothing:antialiased; }

#app { max-width:430px; margin:0 auto; min-height:100vh; display:flex; flex-direction:column; background:var(--surface); overflow-x:hidden; }

.screen { display:none; }
.screen.active { display:flex; flex-direction:column; flex:1; min-height:0; }

/* Top bar */
.topbar { display:flex; align-items:center; gap:10px; padding:13px 16px; background:var(--surface); border-bottom:1px solid var(--border); min-height:58px; flex-shrink:0; }
.topbar-avatar { width:36px; height:36px; border-radius:50%; background:var(--green-light); display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; color:var(--green-text); flex-shrink:0; cursor:pointer; border:1.5px solid var(--green-mid); }
.topbar-title { font-size:15px; font-weight:700; color:var(--text-1); letter-spacing:-0.2px; }
.topbar-sub { font-size:11px; color:var(--text-3); margin-top:1px; }
.topbar-badge { font-size:10px; background:var(--green-light); color:var(--green-text); padding:3px 9px; border-radius:20px; font-weight:700; border:1px solid var(--green-mid); }
.online-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex-shrink:0; box-shadow:0 0 0 2px var(--green-light); }
.back-btn { width:32px; height:32px; display:flex; align-items:center; justify-content:center; border:none; background:transparent; cursor:pointer; border-radius:50%; color:var(--text-2); }
.back-btn:hover { background:var(--surface-2); }

/* Nav */
.navbar { display:flex; border-top:1px solid var(--border); background:var(--surface); flex-shrink:0; }
.nav-item { flex:1; padding:8px 1px 7px; display:flex; flex-direction:column; align-items:center; gap:2px; font-size:8.5px; font-weight:600; color:var(--text-3); cursor:pointer; border:none; background:transparent; letter-spacing:0; min-width:0; overflow:hidden; white-space:nowrap; }
.nav-item svg { width:19px; height:19px; }
.nav-item.active { color:var(--green); }

/* Content */
.content { flex:1; overflow-y:auto; padding:18px 16px; display:flex; flex-direction:column; gap:16px; }

/* Cards */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px 18px; box-shadow:var(--shadow-sm); }

/* Buttons */
.btn-primary { width:100%; padding:14px; background:var(--green); color:#fff; border:none; border-radius:var(--radius-sm); font-size:15px; font-weight:700; cursor:pointer; box-shadow:0 2px 8px rgba(26,153,104,0.3); }
.btn-primary:hover { background:var(--green-dark); }
.btn-secondary { width:100%; padding:12px; background:transparent; color:var(--text-2); border:1px solid var(--border-mid); border-radius:var(--radius-sm); font-size:14px; font-weight:500; cursor:pointer; }
.btn-secondary:hover { background:var(--surface-2); }

/* Option buttons */
.opt-btn { padding:11px 13px; border:1px solid var(--border-mid); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-1); font-size:13px; font-weight:500; cursor:pointer; text-align:left; }
.opt-btn:hover { background:var(--surface-2); border-color:var(--green-mid); }
.opt-btn.on { border-color:var(--green); background:var(--green-light); color:var(--green-text); font-weight:600; }

/* Pills */
.pill { display:inline-block; font-size:11px; padding:3px 10px; border-radius:20px; font-weight:600; }
.pill-green  { background:var(--green-light); color:var(--green-text); border:1px solid var(--green-mid); }
.pill-purple { background:#EEEDFE; color:#26215C; }
.pill-amber  { background:#FAEEDA; color:#412402; }

/* Section label */
.section-label { font-size:11px; font-weight:700; color:var(--text-3); letter-spacing:.08em; text-transform:uppercase; }

/* Welcome banner */
.welcome-banner { display:flex; align-items:flex-start; gap:14px; padding:18px; background:var(--green-light); border:1px solid var(--green-mid); border-radius:var(--radius-lg); }
.wb-avatar { width:50px; height:50px; border-radius:50%; background:var(--surface); display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:700; color:var(--green-text); flex-shrink:0; border:2px solid var(--green-mid); }
.wb-title { font-size:16px; font-weight:700; margin-bottom:4px; letter-spacing:-0.2px; }
.wb-sub   { font-size:13px; color:var(--text-2); line-height:1.55; }

/* Quick cards */
.quick-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:14px 16px; cursor:pointer; box-shadow:var(--shadow-sm); }
.quick-card:hover { border-color:var(--green-mid); box-shadow:var(--shadow-md); }
.quick-card-title { font-size:14px; font-weight:650; color:var(--text-1); margin-bottom:3px; }
.quick-card-sub   { font-size:12px; color:var(--text-2); line-height:1.4; }

/* ── CHAT ── */
.messages { flex:1; overflow-y:auto; padding:16px 14px; display:flex; flex-direction:column; gap:14px; }

.msg { display:flex; flex-direction:column; max-width:88%; }
.msg.bot  { align-self:flex-start; }
.msg.user { align-self:flex-end; align-items:flex-end; }

/* Bot bubble */
.msg.bot .bubble {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md); border-bottom-left-radius:4px;
  padding:12px 15px;
  font-size:14px; line-height:1.7;
  color:var(--text-1);
  box-shadow:var(--shadow-sm);
}

/* Spaced paragraphs in bot bubble */
.msg.bot .bubble p { margin:0; }
.msg.bot .bubble p + p { margin-top:11px; }

/* User bubble */
.msg.user .bubble {
  background:var(--green);
  border-radius:var(--radius-md); border-bottom-right-radius:4px;
  padding:12px 15px;
  font-size:14px; line-height:1.7;
  color:#fff;
}

.msg-time { font-size:10px; color:var(--text-3); margin-top:4px; padding:0 3px; font-weight:500; }

/* Chips */
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.chip { font-size:12px; font-weight:600; padding:6px 14px; border-radius:20px; border:1.5px solid var(--green); color:var(--green-text); background:var(--green-light); cursor:pointer; }
.chip:hover { background:var(--green-mid); }
.chip.used  { opacity:.4; pointer-events:none; }

/* Rec card */
.rec-card { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:13px 15px; margin-top:10px; box-shadow:var(--shadow-sm); }
.rec-header { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; margin-bottom:6px; }
.rec-name   { font-size:14px; font-weight:700; color:var(--text-1); }
.rec-badge  { font-size:10px; padding:3px 9px; border-radius:12px; font-weight:700; flex-shrink:0; }
.rec-stats  { display:flex; gap:10px; flex-wrap:wrap; margin:6px 0 8px; }
.rec-stat   { font-size:11px; color:var(--text-2); font-weight:500; }
.rec-stat strong { color:var(--text-1); font-weight:700; }
.rec-desc   { font-size:13px; color:var(--text-2); line-height:1.55; margin-bottom:7px; }
.rec-why    { font-size:12px; color:var(--green-text); background:var(--green-light); border:1px solid var(--green-mid); border-radius:6px; padding:5px 10px; margin-bottom:8px; line-height:1.45; font-weight:500; }
.rec-terps  { display:flex; gap:4px; flex-wrap:wrap; }
.terp { font-size:10px; font-weight:600; background:var(--surface-3); color:var(--text-3); padding:2px 8px; border-radius:8px; text-transform:capitalize; }
.save-btn { font-size:12px; font-weight:600; padding:6px 12px; margin-top:9px; border:1.5px solid var(--border-mid); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-2); cursor:pointer; }
.save-btn:hover { border-color:var(--green); color:var(--green-text); background:var(--green-light); }
.save-btn.saved { color:var(--green-text); border-color:var(--green); background:var(--green-light); }

/* Typing */
.typing { display:flex; align-items:center; gap:5px; padding:12px 15px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); border-bottom-left-radius:4px; width:fit-content; box-shadow:var(--shadow-sm); }
.typing span { width:6px; height:6px; border-radius:50%; background:var(--green-mid); animation:bounce 1.3s ease infinite; }
.typing span:nth-child(2) { animation-delay:.18s; }
.typing span:nth-child(3) { animation-delay:.36s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.6} 30%{transform:translateY(-5px);opacity:1} }

/* Input row */
.input-row { border-top:1px solid var(--border); padding:10px 12px 12px; background:var(--surface); display:flex; gap:9px; align-items:flex-end; flex-shrink:0; }
.chat-input { flex:1; border:1.5px solid var(--border-mid); border-radius:var(--radius-xl); padding:10px 16px; font-size:14px; resize:none; min-height:42px; max-height:100px; background:var(--surface-2); color:var(--text-1); font-family:var(--font); line-height:1.4; }
.chat-input:focus { outline:none; border-color:var(--green); background:var(--surface); }
.chat-input::placeholder { color:var(--text-3); }
.send-btn { width:42px; height:42px; border-radius:50%; background:var(--green); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; box-shadow:0 2px 8px rgba(26,153,104,0.35); }
.send-btn:hover { background:var(--green-dark); }

/* Disclaimer */
.disclaimer { font-size:10px; color:var(--text-3); text-align:center; padding:5px 16px 7px; border-top:1px solid var(--border); line-height:1.5; flex-shrink:0; font-weight:500; }

/* Profile */
.pref-row { display:flex; justify-content:space-between; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--border); }
.pref-row:last-child { border-bottom:none; padding-bottom:0; }
.pref-label { font-size:13px; color:var(--text-2); flex-shrink:0; margin-right:12px; font-weight:500; }
.pref-val   { font-size:13px; font-weight:600; text-align:right; }
.pref-val.empty { color:var(--text-3); font-weight:400; font-style:italic; }

/* History */
.h-item { display:flex; align-items:center; gap:11px; padding:11px 16px; border-bottom:1px solid var(--border); }
.h-item:last-child { border-bottom:none; }
.h-item:hover { background:var(--surface-2); }
.h-dot  { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.h-name { font-size:13px; font-weight:600; }
.h-meta { font-size:11px; color:var(--text-3); margin-top:1px; }
.h-stars { margin-left:auto; font-size:12px; color:#EF9F27; }
.no-history { padding:20px; text-align:center; font-size:13px; color:var(--text-3); line-height:1.5; }

/* Toast */
.toast { background:var(--green); color:#fff; font-size:13px; font-weight:600; padding:10px 18px; border-radius:var(--radius-sm); text-align:center; opacity:0; transition:opacity .25s; pointer-events:none; }
.toast.show { opacity:1; }
