/* ============ Money HQ — dark purple theme ============ */
:root {
  --bg: #050510;
  --bg-soft: #0a0a18;
  --card: #0d0d1c;
  --card-2: #12122200;
  --border: #1e1b33;
  --border-bright: #2e2952;
  --purple: #8b5cf6;
  --purple-bright: #a855f7;
  --purple-soft: rgba(139, 92, 246, 0.12);
  --pink: #d946ef;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --text: #ececf4;
  --text-dim: #a3a1b8;
  --text-faint: #6b6980;
  --radius: 14px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 40%, rgba(217, 70, 239, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  padding: 28px 16px;
  border-right: 1px solid var(--border);
  background: rgba(8, 8, 18, 0.6);
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 8px;
}

.logo-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 17px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
}

.logo-accent { color: var(--purple-bright); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover { background: var(--purple-soft); color: var(--text); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(217, 70, 239, 0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.nav-icon { font-size: 15px; width: 18px; text-align: center; color: var(--purple-bright); }

.sidebar-footer { padding: 0 8px; }

.strategy-pill {
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  text-align: center;
  background: var(--bg-soft);
}

/* ============ Main ============ */
.main {
  flex: 1;
  padding: 36px 44px 80px;
  max-width: 1200px;
  min-width: 0;
}

.view { display: none; flex-direction: column; gap: 20px; }
.view.active { display: flex; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; }
.subtitle { color: var(--text-dim); margin-top: 5px; font-size: 14.5px; }
.muted { color: var(--text-faint); font-size: 13px; }

/* ============ Cards ============ */
.card {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.05), rgba(13, 13, 28, 0)) , var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ============ Stat grid ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  opacity: 0.7;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.stat-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--purple-soft);
  font-size: 13px;
}

.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.stat-sub.good { color: var(--green); }
.stat-sub.bad { color: var(--red); }

.dash-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .dash-columns { grid-template-columns: 1fr; }
  .main { padding: 24px 20px 80px; }
  .sidebar { width: 74px; padding: 28px 12px; }
  .sidebar .logo > span, .nav-label, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; }
}

/* ============ Buttons ============ */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-bright));
  color: #fff;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-secondary {
  background: var(--purple-soft);
  color: var(--purple-bright);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.btn-secondary:hover { background: rgba(139, 92, 246, 0.2); }

.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); }

.btn-danger { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }

/* ============ Forms ============ */
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

input:focus, textarea:focus { border-color: var(--purple); }

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input[type="month"] { color-scheme: dark; }
input[type="number"] { -moz-appearance: textfield; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.field.grow { flex: 1; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.add-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.add-row input[type="text"] { flex: 2; min-width: 160px; }
.add-row input[type="number"] { flex: 1; min-width: 110px; }
.add-row input[type="password"] { flex: 1; min-width: 220px; }

.money-input {
  display: flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding-left: 13px;
  transition: border-color 0.15s;
}
.money-input:focus-within { border-color: var(--purple); }
.money-input span { color: var(--text-dim); font-weight: 600; }
.money-input input { border: none; background: transparent; flex: 1; font-size: 17px; font-weight: 600; }

/* ============ Item lists ============ */
.item-list { display: flex; flex-direction: column; gap: 8px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.item-name { font-weight: 600; font-size: 14px; flex: 1; }
.item-detail { color: var(--text-dim); font-size: 13px; }
.item-amount { font-weight: 700; font-size: 14.5px; }

.item-del {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 7px;
  border-radius: 7px;
}
.item-del:hover { color: var(--red); background: rgba(248, 113, 113, 0.1); }

.empty-hint { color: var(--text-faint); font-size: 13.5px; padding: 8px 2px; }

/* ============ Progress bars ============ */
.progress-item { padding: 12px 2px; border-bottom: 1px solid var(--border); }
.progress-item:last-child { border-bottom: none; }

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 10px;
}

.progress-name { font-weight: 600; font-size: 14px; }
.progress-figures { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  transition: width 0.5s ease;
}

.progress-fill.debt { background: linear-gradient(90deg, #f87171, #fbbf24); }

/* Chunkier bar for money-towards-a-target */
.progress-track.big { height: 14px; background: rgba(139, 92, 246, 0.13); }
.progress-track.big .progress-fill {
  background: linear-gradient(90deg, var(--purple), var(--pink));
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.45);
  position: relative;
}

.goal-pct {
  font-size: 17px;
  font-weight: 700;
  color: var(--purple-bright);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.goal-figures {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 7px;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.goal-figures strong { color: var(--text); font-size: 14.5px; }
.goal-togo { color: var(--purple-bright); font-weight: 600; }

.check-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 13px;
  cursor: pointer;
  white-space: nowrap;
}
.check-inline input { width: 16px; height: 16px; accent-color: var(--purple); cursor: pointer; }

.progress-eta { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.progress-eta strong { color: var(--purple-bright); }

.badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-bright);
}
.badge.focus { background: rgba(217, 70, 239, 0.15); color: var(--pink); }

/* ============ Goals list ============ */
.goal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
}

.goal-priority {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-priority button {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 11px; padding: 1px 6px; border-radius: 5px;
}
.goal-priority button:hover { color: var(--purple-bright); background: var(--purple-soft); }

.goal-body { flex: 1; min-width: 0; }

.goals-add-row input[type="month"] { flex: 1; min-width: 140px; }

.field-inline { display: flex; flex-direction: column; gap: 3px; }
.field-inline label { font-size: 10.5px; color: var(--text-faint); padding-left: 2px; }
.field-inline input { min-width: 130px; }

.item-row.completed { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.05); }
.item-row.completed .item-name { color: var(--green); }

.badge.done { background: rgba(52, 211, 153, 0.14); color: var(--green); }

.btn-complete-del {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-complete-del:hover { background: rgba(248, 113, 113, 0.12); color: var(--red); border-color: rgba(248, 113, 113, 0.4); }

/* ============ Strategy toggle ============ */
.strategy-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.strategy-btn {
  font-family: inherit;
  text-align: left;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.15s;
}

.strategy-btn strong { color: var(--text); font-size: 15px; }
.strategy-btn span { font-size: 12.5px; }

.strategy-btn.active {
  border-color: var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 0 0 1px var(--purple);
}
.strategy-btn.active strong { color: var(--purple-bright); }

/* ============ Check-in / plan ============ */
.checkin-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.checkin-row .btn { margin-bottom: 1px; }

.plan-section { margin-top: 18px; }

.plan-banner {
  border-radius: var(--radius);
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(217, 70, 239, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.plan-banner h3 { font-size: 17px; margin-bottom: 4px; }
.plan-banner p { color: var(--text-dim); font-size: 13.5px; }

.plan-banner.warn {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(248, 113, 113, 0.07));
  border-color: rgba(251, 191, 36, 0.35);
}

.alloc-group { margin-top: 16px; }

.alloc-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.alloc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 14px;
}

.alloc-row .why { color: var(--text-faint); font-size: 12px; margin-top: 2px; }
.alloc-amount { font-weight: 700; white-space: nowrap; margin-left: 12px; }
.alloc-amount.green { color: var(--green); }
.alloc-amount.purple { color: var(--purple-bright); }

.plan-projection {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.projection-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.projection-card .muted { margin-bottom: 6px; display: block; }
.projection-card strong { font-size: 16px; }

.save-plan-row { margin-top: 18px; display: flex; gap: 12px; align-items: center; }

/* ============ Chat ============ */
.chat-container {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: calc(100vh - 210px);
  min-height: 420px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.chat-empty-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 16px;
  background: var(--purple-soft);
  color: var(--purple-bright);
}

.chat-suggestions { display: flex; flex-direction: column; gap: 8px; }

.chip {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--purple); color: var(--text); }

.msg { max-width: 78%; line-height: 1.55; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple), var(--purple-bright));
  color: #fff;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
}

.msg.assistant .actions-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--purple-bright);
}

.msg.thinking { color: var(--text-faint); font-style: italic; }

.attach-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: rgba(139, 92, 246, 0.06);
}

.attach-preview[hidden] { display: none; }

.attach-preview img {
  height: 44px;
  width: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: rgba(10, 10, 24, 0.6);
}

.chat-input-bar textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

.mic-btn {
  width: 42px; height: 42px;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 17px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.mic-btn:hover { border-color: var(--purple); }
.mic-btn.listening {
  background: rgba(248, 113, 113, 0.15);
  border-color: var(--red);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}

.chat-note { font-size: 12px; color: var(--text-faint); margin-top: 8px; text-align: center; }

/* ============ Settings ============ */
.settings-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

.apply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 10px;
  background: var(--purple-soft);
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 13.5px;
  flex-wrap: wrap;
}

/* ============ Roadmap ============ */
.road-step {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.road-step:last-child { border-bottom: none; }

.road-num {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--border-bright);
  color: var(--text-faint);
}

.road-step.now .road-num {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.5);
}

.road-step.done .road-num { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: var(--green); }
.road-step.done .progress-name { color: var(--text-dim); }
.road-step.locked { opacity: 0.65; }

.road-body { flex: 1; min-width: 0; }
.road-why { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-top: 7px; }
.road-action { font-size: 13.5px; line-height: 1.5; margin-top: 6px; color: var(--text); }
.road-step.now .road-action { color: var(--purple-bright); font-weight: 500; }

.road-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ============ Bank balance ============ */
.balance-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(217, 70, 239, 0.04)), var(--card);
  border-color: rgba(139, 92, 246, 0.28);
}

.balance-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.balance-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 3px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.account-row:last-of-type { border-bottom: none; }
.account-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 110px; }
.account-when { font-size: 11.5px; color: var(--text-faint); }
.account-money { max-width: 130px; }
.account-money input { font-size: 15px; padding: 7px 10px; font-weight: 600; }
.account-add-row { margin-top: 12px; }
.account-add-row input[type="text"] { flex: 2; min-width: 150px; }
.account-add-row input[type="number"] { flex: 1; min-width: 90px; }

.balance-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--green);
  margin-top: 16px;
}

.balance-bar-fill {
  background: var(--amber);
  border-right: 2px solid var(--card);
}

.balance-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.balance-legend span { display: flex; align-items: center; gap: 6px; }
.balance-legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.balance-legend i.committed { background: var(--amber); }
.balance-legend i.spare { background: var(--green); }
.balance-legend i.over { background: var(--red); }
.balance-legend .spare { color: var(--green); font-weight: 600; }
.balance-legend .over { color: var(--red); font-weight: 600; }

.whatnow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(217, 70, 239, 0.06));
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.whatnow-row[hidden] { display: none; }
.whatnow-row strong { color: var(--purple-bright); font-size: 15px; }

.whatnow-move {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.whatnow-move:last-child { border-bottom: none; }

.whatnow-num {
  width: 26px; height: 26px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
}
.whatnow-body { flex: 1; min-width: 0; }
.whatnow-body .progress-name { font-size: 15px; }

.kind-key { line-height: 1.6; margin-top: -4px; margin-bottom: 12px; font-size: 12px; }
.kind-key strong { color: var(--purple-bright); }

/* ============ Wealth target ============ */
.wealth-card {
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.1), rgba(139, 92, 246, 0.05)), var(--card);
  border-color: rgba(217, 70, 239, 0.28);
}
.wealth-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wealth-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 3px; }
.wealth-target { text-align: right; }
.wealth-target .money-input { max-width: 150px; margin-top: 4px; }
.wealth-target .money-input input { font-size: 15px; padding: 8px 10px; font-weight: 600; }
#wealthNote { margin-top: 12px; line-height: 1.5; }

/* ============ The journey ============ */
.journey-card { padding: 26px 22px; }

.journey { position: relative; }

.journey-stop {
  display: flex;
  gap: 16px;
  position: relative;
}

/* the road running through every stop */
.journey-rail {
  position: relative;
  width: 40px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.journey-rail::before {
  content: "";
  position: absolute;
  top: 0; bottom: -28px;
  width: 3px;
  background: linear-gradient(180deg, var(--border-bright), var(--border));
  border-radius: 2px;
}
.journey-stop:last-child .journey-rail::before { display: none; }
.journey-stop.done .journey-rail::before { background: linear-gradient(180deg, var(--green), rgba(52,211,153,0.35)); }

.journey-dot {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 17px;
  background: var(--bg-soft);
  border: 2px solid var(--border-bright);
  z-index: 1;
}

.journey-stop.done .journey-dot {
  background: rgba(52, 211, 153, 0.14);
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}

.journey-stop.now .journey-dot {
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.18), 0 0 22px rgba(168, 85, 247, 0.55);
  animation: journeyPulse 2.4s ease-in-out infinite;
}

@keyframes journeyPulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(139,92,246,0.18), 0 0 22px rgba(168,85,247,0.5); }
  50%      { box-shadow: 0 0 0 9px rgba(139,92,246,0.07), 0 0 30px rgba(168,85,247,0.75); }
}

.journey-stop.horizon .journey-dot { border-style: dashed; }

.journey-body { flex: 1; min-width: 0; padding-bottom: 28px; }

.journey-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

.journey-name { font-weight: 600; font-size: 15px; }
.journey-stop.done .journey-name { color: var(--text-dim); }
.journey-stop.now .journey-name { color: #fff; }

.journey-detail { color: var(--text-dim); font-size: 13px; margin-top: 4px; line-height: 1.45; }
.journey-body .progress-track { margin-top: 9px; }

.journey-youarehere {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
  padding-left: 4px;
}
.journey-youarehere span {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pink);
  background: rgba(217, 70, 239, 0.13);
  border: 1px solid rgba(217, 70, 239, 0.35);
  border-radius: 999px;
  padding: 4px 11px;
}
.journey-youarehere::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(217,70,239,0.35), transparent);
}

/* ============ Nudge pop-up ============ */
.nudge-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(3, 3, 10, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: nudgeFade 0.2s ease;
}
.nudge-overlay[hidden] { display: none; }

@keyframes nudgeFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nudgePop {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.nudge-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 22px 24px 20px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  animation: nudgePop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.nudge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 4px;
}

.nudge-count { font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.03em; }

.nudge-icon {
  width: 52px; height: 52px;
  margin: 4px auto 12px;
  display: grid; place-items: center;
  font-size: 25px;
  border-radius: 16px;
  background: var(--purple-soft);
}

.nudge-card h2 { font-size: 18px; line-height: 1.35; letter-spacing: -0.01em; }

.nudge-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.55;
  margin-top: 9px;
}

.nudge-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}
.nudge-actions .btn { width: 100%; }

.nudge-later {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px;
}
.nudge-later:hover { color: var(--text-dim); }

/* ============ Progress chart ============ */
.chart-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.chart-legend span { display: flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend strong { color: var(--text); }
.chart-legend em { font-style: normal; font-size: 12px; }
.chart-legend em.good { color: var(--green); }
.chart-legend em.bad { color: var(--red); }

.progress-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }

#progressCard { position: relative; }

.chart-tooltip {
  position: absolute;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(5, 5, 16, 0.96);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip strong { color: var(--text); font-size: 13px; }
.chart-tooltip span { display: flex; align-items: center; gap: 6px; }
.chart-tooltip i { width: 8px; height: 8px; border-radius: 2px; }

/* ============ Suggestion triage ============ */
.suggest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.suggest-info { display: flex; flex-direction: column; gap: 4px; min-width: 200px; flex: 1; }

.suggest-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.recurrence {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 5px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(139, 92, 246, 0.09);
  color: var(--text-dim);
  border-left: 2px solid var(--purple);
}
.recurrence.one_off, .recurrence.stopped, .recurrence.spending {
  background: rgba(251, 191, 36, 0.09);
  border-left-color: var(--amber);
  color: var(--amber);
}
.recurrence.unknown { border-left-color: var(--text-faint); }

.badge.warn { background: rgba(251, 191, 36, 0.15); color: var(--amber); }

/* ============ Lock screen ============ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 70% 10%, rgba(139, 92, 246, 0.16), transparent 60%),
    var(--bg);
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.lock-screen[hidden] { display: none; }

.lock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(340px, 100%);
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lock-logo { width: 54px; height: 54px; font-size: 26px; border-radius: 16px; }

.lock-card input {
  width: 100%;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.4em;
  padding: 13px;
}

.lock-card .btn { width: 100%; }

.lock-error { color: var(--red); min-height: 18px; }

.lock-card.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* iPhone standalone safe areas */
@supports (padding: env(safe-area-inset-top)) {
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .sidebar { padding-top: calc(28px + env(safe-area-inset-top)); }
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--purple);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Mobile drawer nav ============ */
.menu-btn {
  display: none;
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 160;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border-bright);
  background: rgba(13, 13, 28, 0.92);
  color: var(--purple-bright);
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 158;
  background: rgba(3, 3, 10, 0.6);
}

.drawer-backdrop.show { display: block; }

@media (max-width: 700px) {
  .menu-btn { display: grid; place-items: center; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: 250px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) 16px 24px;
    background: var(--bg-soft);
    border-right: 1px solid var(--border-bright);
    z-index: 159;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open { transform: translateX(0); }

  /* Drawer is full width — bring the labels back */
  .sidebar .logo > span, .nav-label, .sidebar-footer { display: block; }
  .sidebar .logo > span { display: inline; }
  .nav-item { justify-content: flex-start; }

  .main { padding: calc(66px + env(safe-area-inset-top, 0px)) 16px 90px; }

  .view-header { flex-direction: column; }
  .view-header .btn { align-self: flex-start; }

  .chat-container { height: calc(100vh - 230px); }
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 999px; }

/* ============ Dismissed-merchants chips ============ */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.key-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 12px;
}
.chip-x {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
}
.chip-x:hover { color: var(--red); background: rgba(248, 113, 113, 0.12); }

/* ---- Category breakdown & merchant corrections (Documents upload) ---- */
.cat-breakdown { margin: 6px 0 4px 2px; }
.cat-breakdown summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  user-select: none;
}
.cat-breakdown summary:hover { color: var(--text); }
.merchant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 6px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.merchant-row:last-child { border-bottom: none; }
.merchant-row .m-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-row .m-avg { color: var(--text-dim); white-space: nowrap; font-size: 12.5px; }
.mcat-select {
  width: auto;
  max-width: 175px;
  padding: 4px 8px;
  font-size: 12.5px;
  border-radius: 8px;
}
@media (max-width: 700px) {
  .merchant-row { flex-wrap: wrap; padding-left: 8px; }
  .mcat-select { max-width: 100%; }
}

/* ---- Outgoings: merged direct-debits card + insight cards ---- */
.dd-subhead {
  margin: 20px 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.dd-subhead span { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text-faint); }
.cat-pct { color: var(--text-faint); font-weight: 400; }

/* ---- One-offs stripped from averages ---- */
.excluded-list { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.merchant-row .m-why { flex-basis: 100%; padding-left: 0; font-size: 12px; }
@media (min-width: 701px) {
  .merchant-row .m-why { flex-basis: auto; max-width: 45%; text-align: right; }
}

/* ---- Money in & out tabs ---- */
.money-tabs { display: flex; gap: 8px; margin: -8px 0 18px; flex-wrap: wrap; }

/* iPhone: inputs under 16px make Safari zoom in on focus and stay zoomed.
   16px on touch screens kills the zoom at the source. */
@media (max-width: 700px) {
  input, textarea, select { font-size: 16px; }
}

/* ---- Collapse blocks & add-toggles: calm by default, open on tap ---- */
.collapse-block > summary, .add-toggle > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
  user-select: none;
  list-style: none;
}
.collapse-block > summary::before, .add-toggle > summary::before { content: "▸ "; color: var(--text-faint); }
.collapse-block[open] > summary::before, .add-toggle[open] > summary::before { content: "▾ "; }
.collapse-block > summary:hover, .add-toggle > summary:hover { color: var(--text); }
.add-toggle { margin-top: 6px; }

/* ---- Chat starter chips ---- */
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }

/* Phone: slim the chat-bar buttons so the typing area gets the width */
@media (max-width: 700px) {
  .chat-input-bar { gap: 6px; }
  .chat-input-bar .mic-btn { width: 38px; min-width: 38px; height: 38px; padding: 4px; font-size: 16px; }
  .chat-input-bar #sendBtn { padding: 10px 14px; }
}

/* Phone: long bar figures (— £X SHORT) wrap inside the card, never overflow */
@media (max-width: 700px) {
  .progress-top { flex-wrap: wrap; gap: 2px 8px; }
  .progress-figures { white-space: normal; text-align: left; }
}

/* ============ Engaging progress system ============ */
/* Rings (goals) */
.goal-ringwrap { display:flex; align-items:center; gap:18px; }
.goal-ring { transform:rotate(-90deg); flex-shrink:0; }
.goal-ring .ring-track { stroke:rgba(255,255,255,.08); }
.goal-ring .ring-fill { stroke:url(#ringGrad); stroke-linecap:round; transition:stroke-dashoffset 1.2s ease-out; }
.ring-holder { position:relative; }
.ring-centre { position:absolute; inset:0; display:grid; place-items:center; text-align:center; }
.ring-centre b { font-size:19px; display:block; }
.ring-centre span { font-size:10px; color:var(--text-dim); }

/* Melting debt bars */
.melt-track { height:22px; border-radius:7px; background:rgba(255,255,255,.05); position:relative; overflow:hidden; margin-top:8px; }
.melt-fill { position:absolute; top:0; bottom:0; left:0; border-radius:7px; background:linear-gradient(90deg,#7f1d1d,#ef4444); transition:width 1s ease-out; }
.melt-row { display:flex; justify-content:space-between; font-size:12px; color:var(--text-dim); margin-top:5px; flex-wrap:wrap; gap:2px 10px; }
.melt-flame { color:var(--red); }

/* Countdown tiles */
.count-tiles { display:flex; gap:10px; margin-bottom:16px; }
.count-tile { flex:1; background:rgba(168,85,247,.07); border:1px solid rgba(168,85,247,.22); border-radius:13px; padding:12px 8px; text-align:center; }
.count-tile b { font-size:26px; display:block; color:var(--purple-bright); }
.count-tile span { font-size:10.5px; color:var(--text-dim); line-height:1.3; display:block; margin-top:2px; }

/* Streak dots */
.streak-dots { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 4px; }
.sdot { width:16px; height:16px; border-radius:50%; background:rgba(255,255,255,.07); }
.sdot.hit { background:var(--green); box-shadow:0 0 7px rgba(74,222,128,.35); }
.sdot.miss { background:rgba(248,113,113,.35); }
.sdot.today { border:2px solid var(--purple-bright); background:rgba(168,85,247,.2); }

/* Jar */
.jar-widget { width:72px; height:92px; border:2.5px solid rgba(255,255,255,.25); border-top-width:0; border-radius:5px 5px 15px 15px; position:relative; overflow:hidden; flex-shrink:0; }
.jar-widget::before { content:""; position:absolute; top:0; left:-5px; right:-5px; height:7px; border:2.5px solid rgba(255,255,255,.25); border-radius:4px; }
.jar-liquid { position:absolute; left:0; right:0; bottom:0; background:linear-gradient(180deg,#a855f7,#6d28d9); transition:height 1.2s ease-out; }
.jar-goalline { position:absolute; left:0; right:0; border-top:2px dashed rgba(255,255,255,.3); }

/* Winding road */
.road-svg text { font-size:9.5px; fill:var(--text-dim); }
.road-stop { fill:var(--bg-soft); stroke:rgba(255,255,255,.3); stroke-width:1.5; }
.road-stop.done { fill:var(--green); stroke:var(--green); }
.road-stop.now { fill:var(--purple-bright); stroke:#fff; stroke-width:2; animation:roadpulse 1.6s ease-in-out infinite; }
@keyframes roadpulse { 50% { opacity:.45; } }

/* Confetti */
.confetti-piece { position:fixed; width:8px; height:13px; top:-16px; z-index:9999; pointer-events:none; animation:confall 2.4s linear forwards; }
@keyframes confall { to { transform:translateY(105vh) rotate(360deg); opacity:.1; } }

/* ---- Home dropdowns: one calm line each, tap to open ---- */
.home-drop { margin-bottom: 12px; }
.home-drop > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 16px;
  font-size: 14.5px;
  font-weight: 600;
}
.home-drop > summary::-webkit-details-marker { display: none; }
.home-drop > summary::after { content: "▸"; float: right; color: var(--text-faint); transition: transform .2s; }
.home-drop[open] > summary::after { transform: rotate(90deg); }
.home-drop[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.home-drop[open] > div > .card, .home-drop[open] > .card { border-top-left-radius: 0; border-top-right-radius: 0; }

/* ---- Sticky top bar (phones): logo + menu, safe-area aware ---- */
@media (max-width: 700px) {
  .topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center;
    height: calc(50px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: rgba(5, 5, 16, .82);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 16.5px;
  }
  .topbar .menu-btn { position: absolute; left: 10px; top: calc(env(safe-area-inset-top) + 7px); margin: 0; }
  .topbar-logo { display: flex; align-items: center; gap: 7px; }
  .logo-mark.small { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; display: grid; place-items: center; }
  .main { padding-top: calc(62px + env(safe-area-inset-top)) !important; }
  .view-header h1 { font-size: 21px; }
  .view-header { margin-bottom: 14px; }
}
@media (min-width: 701px) {
  .topbar { display: none; }
  .topbar .menu-btn { display: none; }
}

/* ---- Hero dashboard: rings, mini road, needle line, stat squares ---- */
.hero-rings { display: flex; justify-content: space-around; gap: 6px; margin-bottom: 4px; }
.hero-ring { text-align: center; flex: 1; min-width: 0; }
.hero-ring .ring-holder { display: inline-block; }
.hero-ring .ring-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.25; }
.hero-ring .ring-fill2 { stroke-linecap: round; transition: stroke-dashoffset 1.3s cubic-bezier(.22,1,.36,1); }
.needle-line { text-align: center; font-size: 14px; line-height: 1.5; margin: 10px 4px 14px; }
.sq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.sq { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 13px; padding: 11px 13px; }
.sq .sq-label { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.sq .sq-value { font-size: 17px; font-weight: 700; margin-top: 2px; }
.hero-road { margin: 2px 0 0; }

/* Hero entrance: road draws itself, stops light up one by one */
.hero-road path { stroke-dasharray: 430; stroke-dashoffset: 430; animation: roadDraw 1.5s ease-out forwards .2s; }
@keyframes roadDraw { to { stroke-dashoffset: 0; } }
.hero-road .road-stop, .hero-road text {
  opacity: 0; animation: stopIn .5s ease-out forwards;
  transform-box: fill-box; transform-origin: center;
}
@keyframes stopIn { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }

/* Topbar refinement: bare bigger burger, centred; tighter page start */
@media (max-width: 700px) {
  .topbar .menu-btn {
    background: none; border: none; box-shadow: none;
    font-size: 26px; width: 44px; height: 44px; line-height: 44px;
    padding: 0; top: calc(env(safe-area-inset-top) + 3px);
    display: grid; place-items: center; color: var(--text);
  }
  .main { padding-top: calc(56px + env(safe-area-inset-top)) !important; }
  .view-header { margin-top: 0; margin-bottom: 12px; }
  .view-header h1 { font-size: 20px; }
}

/* ---- Busy overlay: the app is working, loudly ---- */
.busy-overlay {
  position: fixed; left: 12px; right: 12px; z-index: 300;
  bottom: calc(18px + env(safe-area-inset-bottom));
  background: rgba(18, 16, 29, .97); border: 1px solid var(--purple-bright);
  border-radius: 16px; padding: 16px 18px; display: flex; gap: 14px; align-items: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.5); font-size: 14px; line-height: 1.45;
}
.busy-spin {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  border: 3px solid rgba(168,85,247,.25); border-top-color: var(--purple-bright);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Vertical road: labels always readable, never overlapping ---- */
.vroad { margin: 6px 0 4px; }
.vroad-row { display: flex; gap: 14px; align-items: center; position: relative; min-height: 44px; opacity: 0; animation: vradeIn .45s ease-out forwards; }
@keyframes vradeIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.vroad-rail { width: 26px; align-self: stretch; position: relative; flex-shrink: 0; }
.vroad-rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; transform: translateX(-50%); background: rgba(255,255,255,.1); border-radius: 2px; }
.vroad-row:first-child .vroad-rail::before { top: 50%; }
.vroad-row:last-child .vroad-rail::before { bottom: 50%; }
.vroad-row.done .vroad-rail::before { background: rgba(74,222,128,.35); }
.vroad-dot {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-soft); border: 2px solid rgba(255,255,255,.3);
  display: grid; place-items: center; font-size: 10px;
}
.vroad-row.done .vroad-dot { background: var(--green); border-color: var(--green); color: #06220f; }
.vroad-row.now .vroad-dot { width: 24px; height: 24px; background: var(--purple-bright); border-color: #fff; animation: roadpulse 1.6s ease-in-out infinite; }
.vroad-label { font-size: 13.5px; line-height: 1.35; padding: 4px 0; min-width: 0; }
.vroad-row.done .vroad-label { color: var(--text-dim); }
.vroad-row.now .vroad-label { font-weight: 600; }
.vroad-sub { font-size: 11.5px; color: var(--text-faint); }

/* Current road stop = IN PROGRESS, not done: hollow pulsing ring */
.vroad-row.now .vroad-dot {
  background: transparent !important;
  border: 3px solid var(--purple-bright);
  box-shadow: 0 0 12px rgba(168,85,247,.5);
}

/* ---- The Daily Brief: the plan, talking ---- */
.brief-card {
  background: linear-gradient(135deg, rgba(168,85,247,.14), rgba(109,40,217,.07));
  border: 1px solid rgba(168,85,247,.35);
  border-radius: 18px; padding: 18px; margin-bottom: 16px;
  font-size: 15px; line-height: 1.6;
}
.brief-card .brief-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.brief-card .brief-head h2 { font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: var(--purple-bright); }
.brief-card .brief-date { font-size: 11px; color: var(--text-faint); }

/* ---- The Master Plan: the AI's route, staged ---- */
.mp-stage { border-left: 3px solid var(--purple-bright); padding: 16px 18px; margin: 16px 0; background: var(--bg-soft); border-radius: 0 12px 12px 0; }
.mp-stage-head { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.mp-stage .mp-n {
  flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 999px; background: var(--purple-soft); color: var(--purple-bright);
  font-weight: 800; font-size: 13px;
}
.mp-stage .mp-time { font-size: 12px; color: var(--text-faint); margin: 5px 0 0 38px; }
.mp-stage .mp-split { margin-left: 38px; }
.mp-move { font-size: 13.5px; line-height: 1.55; margin: 8px 0 0 38px; color: var(--text-dim); }
.mp-stage ul { margin: 8px 0 0 18px; font-size: 13.5px; line-height: 1.55; }
.mp-head { font-size: 15px; line-height: 1.6; margin-bottom: 6px; }
.mp-split { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mp-pill { background: rgba(168, 85, 247, 0.13); border: 1px solid rgba(168, 85, 247, 0.3); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-dim); }
.mp-pill strong { color: var(--purple-bright); }

/* ---- Pull-to-refresh pill ---- */
.ptr-pill {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%;
  transform: translate(-50%, 0); z-index: 300;
  background: var(--bg-soft); border: 1px solid var(--border-bright);
  border-radius: 999px; padding: 7px 16px; font-size: 12.5px; color: var(--text-dim);
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.ptr-busy { animation: ptrPulse 0.9s ease-in-out infinite; }
@keyframes ptrPulse { 50% { opacity: 0.55; } }
/* Our pull IS the rubber-band — stop the webview doing its own on top.
 * NOTE: .app must carry NO transform/will-change at rest — a transformed
 * ancestor re-anchors the position:fixed menu drawer to the page, not the
 * screen (menu opens off-screen when scrolled down). The pull gesture sets
 * the transform inline and removes it completely once settled. */
html, body { overscroll-behavior-y: none; }

/* ---- Stat square breakdowns ---- */
.sq { cursor: pointer; transition: border-color 0.15s; }
.sq:hover { border-color: var(--border-bright); }
.sq.active { border-color: var(--purple-bright); }
.sq-bd {
  margin-top: 10px; padding: 12px 14px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; animation: fadeSlideIn 0.22s ease;
}
.sq-bd-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13.5px; }
.sq-bd-head strong { color: var(--purple-bright); }
.sq-bd-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--border); }
.sq-bd-row:first-of-type { border-top: none; }
.sq-bd-note { margin-top: 8px; font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-4px); } }
