/* ═══════════════════════════════════════
   CashCoachAI — Styles
   ═══════════════════════════════════════ */

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

:root {
  --green:        #059669;
  --green-hover:  #047857;
  --green-light:  #d1fae5;
  --green-50:     #ecfdf5;
  --yellow:       #d97706;
  --yellow-light: #fef3c7;
  --red:          #dc2626;
  --red-light:    #fee2e2;
  --blue:         #2563eb;
  --blue-light:   #dbeafe;
  --bg:           #f0fdf4;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --r:            12px;
  --r-sm:         8px;
  --r-lg:         16px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Navbar ─────────────────────────── */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-logo  { font-size: 26px; }
.nav-title { font-size: 20px; font-weight: 800; color: var(--text); }
.nav-title .accent { color: var(--green); }

.nav-tabs { display: flex; gap: 4px; flex: 1; }
.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: none; background: none;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.nav-tab:hover  { background: var(--surface-2); color: var(--text); }
.nav-tab.active { background: var(--green-50); color: var(--green); font-weight: 600; }

.btn-reset {
  padding: 7px 14px; border: 1px solid var(--border);
  background: white; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: all .15s; flex-shrink: 0; font-family: inherit;
}
.btn-reset:hover { border-color: var(--red); color: var(--red); }

/* ─── Views ──────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Setup Wizard ───────────────────── */
.setup-container { max-width: 640px; margin: 0 auto; padding: 48px 24px; }

.progress-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 40px; }
.progress-step  { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.progress-step span { font-size: 12px; font-weight: 500; color: var(--text-3); }
.progress-step.active span { color: var(--green); }
.progress-step.done   span { color: var(--text-2); }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--border); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; transition: all .3s;
}
.progress-step.active .step-dot { background: var(--green); color: white; box-shadow: 0 0 0 4px var(--green-light); }
.progress-step.done   .step-dot { background: var(--green); color: white; }
.progress-line { width: 80px; height: 2px; background: var(--border); margin-bottom: 22px; transition: background .3s; }
.progress-line.done { background: var(--green); }

.setup-step { display: none; }
.setup-step.active { display: block; animation: fadeUp .3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.setup-card {
  background: white; border-radius: var(--r-lg);
  padding: 44px; box-shadow: var(--shadow-lg); text-align: center;
}
.setup-card-wide { text-align: left; }
.setup-icon { font-size: 52px; margin-bottom: 16px; }
.setup-card h2 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.setup-sub { color: var(--text-2); font-size: 15px; margin-bottom: 32px; }

.input-group-dollar {
  display: flex; align-items: center; max-width: 280px;
  margin: 0 auto 32px; border-radius: var(--r-sm); overflow: hidden;
  border: 2px solid var(--border); transition: border-color .15s;
}
.input-group-dollar:focus-within { border-color: var(--green); }
.dollar-prefix {
  padding: 12px 16px; font-size: 22px; font-weight: 700;
  color: var(--green); background: var(--green-50); border-right: 2px solid var(--border);
}
.input-large {
  flex: 1; padding: 12px 16px; font-size: 24px; font-weight: 700;
  border: none; outline: none; font-family: inherit;
}

.bill-form {
  display: grid; grid-template-columns: 2fr 1.5fr 1.5fr auto;
  gap: 10px; margin-bottom: 12px;
}
.input-field {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; outline: none; background: white; font-family: inherit;
  transition: border-color .15s; width: 100%;
}
.input-field:focus { border-color: var(--green); }
select.input-field { cursor: pointer; }

.input-prefix-wrap {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; transition: border-color .15s;
}
.input-prefix-wrap:focus-within { border-color: var(--green); }
.input-prefix-wrap > span {
  padding: 0 10px; background: var(--surface-2); color: var(--text-3);
  font-weight: 500; border-right: 1.5px solid var(--border);
  align-self: stretch; display: flex; align-items: center; white-space: nowrap;
}
.input-field.bare { border: none; outline: none; padding: 10px 12px; flex: 1; font-family: inherit; }

.items-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; margin: 8px 0; }
.item-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 14px;
}
.item-name     { flex: 1; font-weight: 500; font-size: 14px; }
.item-badge    { font-size: 12px; color: var(--text-3); background: var(--border); padding: 2px 8px; border-radius: 20px; }
.item-amount   { font-weight: 600; font-size: 14px; min-width: 72px; text-align: right; }
.item-remove   { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 2px 4px; border-radius: 4px; line-height: 1; transition: color .15s; }
.item-remove:hover { color: var(--red); }

.habits-grid  { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.habit-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 2px solid var(--border); border-radius: 24px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: white; color: var(--text-2); transition: all .15s; font-family: inherit;
}
.habit-chip:hover    { border-color: var(--green); color: var(--green); }
.habit-chip.selected { border-color: var(--green); background: var(--green-50); color: var(--green); }
.chip-amount { font-size: 11px; opacity: .75; }

.custom-habit-form { display: grid; grid-template-columns: 2fr 1.5fr auto; gap: 10px; margin-top: 12px; }
.setup-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

/* ─── Buttons ────────────────────────── */
.btn-primary {
  background: var(--green); color: white; border: none;
  padding: 10px 24px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.btn-primary:hover { background: var(--green-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-lg { padding: 14px 36px; font-size: 16px; }

.btn-secondary {
  background: white; color: var(--green); border: 2px solid var(--green);
  padding: 9px 20px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-secondary:hover { background: var(--green-50); }

.btn-ghost {
  background: none; color: var(--text-2); border: none;
  padding: 8px 16px; border-radius: var(--r-sm);
  font-size: 14px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-ghost-sm {
  background: none; color: var(--text-3); border: none;
  font-size: 13px; cursor: pointer; padding: 4px 10px;
  border-radius: var(--r-sm); transition: all .15s; font-family: inherit;
}
.btn-ghost-sm:hover { background: var(--surface-2); color: var(--text); }

/* ─── Loading ─────────────────────────── */
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100vh - 64px); gap: 16px; text-align: center;
}
.coin-spin { font-size: 72px; animation: spinY 1.4s linear infinite; display: inline-block; }
@keyframes spinY {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}
.loading-screen h2 { font-size: 24px; font-weight: 700; }
.loading-screen p  { color: var(--text-2); }
.loading-dots { display: flex; gap: 8px; margin-top: 6px; }
.loading-dots span {
  width: 8px; height: 8px; background: var(--green); border-radius: 50%;
  animation: blink 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 60%, 100% { opacity: .3; transform: scale(1); }
  30%            { opacity: 1;  transform: scale(1.3); }
}

/* ─── Main container ──────────────────── */
.main-container {
  max-width: 1100px; margin: 0 auto;
  padding: 32px 24px; display: flex; flex-direction: column; gap: 24px;
}

/* ─── Score hero ──────────────────────── */
.score-hero {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  border-radius: var(--r-lg); padding: 36px;
  color: white; display: flex; gap: 32px; align-items: center;
  box-shadow: var(--shadow-lg);
}
.score-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 4px solid rgba(255,255,255,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color .5s;
}
.score-number   { font-size: 38px; font-weight: 800; line-height: 1; }
.score-label-sm { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; opacity: .85; }
.score-content  { flex: 1; }
.score-content h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.plan-summary { font-size: 15px; opacity: .9; line-height: 1.6; margin-bottom: 12px; }
.red-flag {
  background: rgba(220,38,38,.2); border: 1px solid rgba(220,38,38,.4);
  border-radius: var(--r-sm); padding: 6px 12px; font-size: 13px;
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}

/* ─── Stats row ───────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.stat-card {
  background: white; border-radius: var(--r); padding: 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.si-green  { background: var(--green-light); }
.si-red    { background: var(--red-light); }
.si-yellow { background: var(--yellow-light); }
.si-blue   { background: var(--blue-light); }
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); }

/* ─── Card ────────────────────────────── */
.card { background: white; border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.card-header {
  padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--text-3); }

/* ─── Two-col grid ────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ─── Charts ──────────────────────────── */
.chart-wrap    { padding: 24px; height: 300px; display: flex; align-items: center; justify-content: center; }
.chart-wrap canvas { max-height: 100%; }
.chart-sm      { height: 240px; }

/* ─── Budget table ────────────────────── */
.table-scroll { overflow-x: auto; }
.budget-table { width: 100%; border-collapse: collapse; }
.budget-table th {
  padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.budget-table td { padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
.budget-table tr:last-child td { border-bottom: none; }
.budget-table tr:hover td { background: var(--surface-2); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-good { background: var(--green-light); color: #065f46; }
.badge-warn { background: var(--yellow-light); color: #92400e; }
.badge-over { background: var(--red-light); color: #991b1b; }
.tip-cell { font-size: 12px; color: var(--text-2); max-width: 240px; }

/* ─── Savings plan ────────────────────── */
.savings-body  { padding: 24px; }
.savings-big   { font-size: 44px; font-weight: 800; color: var(--green); line-height: 1; }
.savings-sub   { font-size: 13px; color: var(--text-3); margin: 4px 0 20px; }
.proj-row      { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.proj-row:last-of-type { border-bottom: none; }
.proj-label    { font-size: 14px; color: var(--text-2); }
.proj-value    { font-size: 16px; font-weight: 700; }
.savings-tip   { background: var(--green-50); border-left: 3px solid var(--green); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 12px 14px; font-size: 13px; color: #065f46; margin-top: 16px; }

/* ─── Tips ────────────────────────────── */
.tips-grid { padding: 20px 24px; display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.tip-card { background: var(--surface-2); border-radius: var(--r); padding: 16px; border-left: 3px solid var(--green); }
.tip-num  { font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.tip-text { font-size: 14px; line-height: 1.5; }

/* ─── Page header ─────────────────────── */
.page-header { padding: 4px 0 0; }
.page-header h2 { font-size: 24px; font-weight: 700; }
.page-header p  { color: var(--text-2); font-size: 15px; margin-top: 2px; }

/* ─── Expense form ────────────────────── */
.expense-form {
  padding: 20px 24px;
  display: grid; grid-template-columns: 150px 1fr 160px 150px auto; gap: 10px; align-items: end;
}

/* ─── Progress bars ───────────────────── */
.progress-container { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.prog-item   { display: flex; flex-direction: column; gap: 6px; }
.prog-head   { display: flex; justify-content: space-between; align-items: center; }
.prog-cat    { font-size: 14px; font-weight: 500; }
.prog-amt    { font-size: 13px; color: var(--text-2); }
.prog-spent  { font-weight: 700; color: var(--text); }
.prog-bg     { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.prog-fill   { height: 100%; border-radius: 4px; transition: width .5s ease; }
.prog-good   { background: var(--green); }
.prog-warn   { background: var(--yellow); }
.prog-over   { background: var(--red); }

/* ─── Transactions ────────────────────── */
.txn-list    { padding: 0 24px 20px; display: flex; flex-direction: column; max-height: 400px; overflow-y: auto; }
.txn-item    { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.txn-item:last-child { border-bottom: none; }
.txn-icon    { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.txn-info    { flex: 1; }
.txn-desc    { font-size: 14px; font-weight: 500; }
.txn-meta    { font-size: 12px; color: var(--text-3); }
.txn-amount  { font-size: 15px; font-weight: 700; color: var(--red); }
.txn-del     { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 4px; font-size: 15px; transition: color .15s; }
.txn-del:hover { color: var(--red); }
.empty-state { text-align: center; color: var(--text-3); font-size: 14px; padding: 32px 0; }

/* ─── Modal ───────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: white; border-radius: var(--r-lg); box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 440px; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: var(--text-3); cursor: pointer; padding: 0 4px; border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body {
  padding: 20px 24px; display: flex; flex-direction: column; gap: 12px;
}
.modal-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: -4px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

/* ─── Advisor ─────────────────────────── */
.advisor-wrap {
  max-width: 800px; margin: 0 auto; padding: 32px 24px;
  height: calc(100vh - 64px); display: flex; flex-direction: column; gap: 16px;
}
.advisor-header { text-align: center; flex-shrink: 0; }
.advisor-header h2 { font-size: 24px; font-weight: 700; }
.advisor-header p  { color: var(--text-2); font-size: 14px; margin-top: 4px; }

.suggested-prompts { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.prompt-chip {
  padding: 8px 14px; background: white; border: 1.5px solid var(--border);
  border-radius: 20px; font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.prompt-chip:hover { border-color: var(--green); color: var(--green); background: var(--green-50); }

.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 2px; scroll-behavior: smooth; }
.chat-msg      { display: flex; gap: 10px; align-items: flex-start; animation: fadeUp .2s ease; }
.chat-msg.user { flex-direction: row-reverse; }
.msg-avatar    { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.chat-msg.user .msg-avatar { background: var(--green); font-size: 15px; }
.msg-bubble {
  max-width: 74%; background: white; border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 16px;
  font-size: 14px; line-height: 1.65; box-shadow: var(--shadow);
}
.chat-msg.user .msg-bubble { background: var(--green); color: white; border-color: var(--green); }
.msg-bubble p + p { margin-top: 8px; }

.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span { width: 6px; height: 6px; background: var(--text-3); border-radius: 50%; animation: blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

.chat-input-row {
  display: flex; gap: 10px; align-items: flex-end;
  background: white; border: 1.5px solid var(--border); border-radius: var(--r);
  padding: 10px 12px; box-shadow: var(--shadow-md); flex-shrink: 0;
  transition: border-color .15s;
}
.chat-input-row:focus-within { border-color: var(--green); }
.chat-textarea {
  flex: 1; border: none; outline: none; font-size: 15px; font-family: inherit;
  resize: none; line-height: 1.5; max-height: 120px; overflow-y: auto;
}
.btn-send {
  width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--green);
  color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.btn-send:hover    { background: var(--green-hover); }
.btn-send:disabled { background: var(--text-3); cursor: not-allowed; }

/* ─── Toast ───────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text); color: white;
  padding: 12px 20px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  z-index: 9999; animation: slideUp .25s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Subscribe Page ─────────────────── */
.sub-body {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.sub-page {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.sub-page-wide  { max-width: 860px; }
.sub-page-3col  { max-width: 1060px; }

.sub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sub-logo  { font-size: 32px; }
.sub-title { font-size: 26px; font-weight: 800; color: var(--text); }
.sub-title .accent { color: var(--green); }

/* Header above plans */
.sub-header { text-align: center; }
.trial-badge {
  display: inline-block;
  background: var(--green-50);
  color: var(--green);
  border: 1.5px solid var(--green-light);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.sub-headline {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}
.sub-tagline {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
}

/* Plans grid */
.plans-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.plans-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Individual plan card */
.plan-card {
  background: white;
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.plan-card-pro {
  border-color: var(--green);
  box-shadow: 0 8px 30px rgba(5,150,105,.18), var(--shadow-lg);
  position: relative;
}
.plan-popular-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.plan-tier {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.plan-tier-pro { color: var(--green); }
.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}
.plan-price     { font-size: 42px; font-weight: 800; color: var(--text); line-height: 1; }
.plan-price-pro { color: var(--green); }
.plan-period    { font-size: 15px; color: var(--text-2); font-weight: 500; }
.plan-after     { font-size: 12px; color: var(--text-3); margin-bottom: 24px; }

/* Feature lists */
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 28px;
  flex: 1;
}
.plan-features li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text-2);
}
.feat-check {
  width: 20px;
  height: 20px;
  background: var(--green);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.feat-check-gray { background: #94a3b8; }
.feat-absent {
  color: var(--text-3) !important;
  font-size: 13px !important;
}
.feat-absent::before { content: ''; }

/* Plan CTAs */
.plan-btn {
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  letter-spacing: .01em;
}
.plan-btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }
.plan-btn-basic {
  background: var(--surface-2);
  color: var(--text);
  border: 2px solid var(--border);
}
.plan-btn-basic:hover:not(:disabled) { background: var(--border); }
.plan-btn-pro {
  background: var(--green);
  color: white;
}
.plan-btn-pro:hover:not(:disabled) { background: var(--green-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.plan-note     { font-size: 11px; color: var(--text-3); margin-top: 8px; text-align: center; }
.plan-note-pro { color: #059669; }

/* Shared sub-page elements */
.sub-error {
  width: 100%;
  padding: 10px 14px;
  background: var(--red-light);
  color: var(--red);
  border-radius: var(--r-sm);
  font-size: 13px;
  display: none;
  text-align: center;
}
.sub-error:not(:empty) { display: block; }
.sub-note {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}
.sub-footer-note {
  font-size: 13px;
  color: var(--text-2);
}
.sub-link {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}
.sub-link:hover { text-decoration: underline; }

/* ─── Investor Plan Card ──────────────── */
.plan-card-investor {
  border-color: var(--yellow);
  box-shadow: 0 8px 30px rgba(217,119,6,.16), var(--shadow-lg);
  position: relative;
}
.plan-popular-badge-gold { background: var(--yellow); }
.plan-tier-investor      { color: var(--yellow); }
.plan-price-investor     { color: var(--yellow); }
.feat-check-gold { background: var(--yellow); }
.plan-btn-investor {
  background: var(--yellow);
  color: white;
}
.plan-btn-investor:hover:not(:disabled) {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.plan-note-investor { color: var(--yellow); }

/* ─── Investor Hub View ───────────────── */
.invest-chat-wrap {
  display: flex;
  flex-direction: column;
  height: 500px;
}
.invest-chat-wrap .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.invest-chat-wrap .chat-input-row { margin: 0 16px 16px; flex-shrink: 0; }

/* Market News */
.news-list    { padding: 8px 0; }
.news-loading,
.news-empty   { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }
.news-item {
  display: block;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover      { background: var(--surface-2); }
.news-title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 4px; }
.news-desc  { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 4px; }
.news-date  { font-size: 11px; color: var(--text-3); }

/* Education */
.edu-grid { padding: 12px 16px; display: flex; flex-direction: column; gap: 0; }
.edu-card {
  display: flex;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.edu-card:last-child { border-bottom: none; }
.edu-icon    { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; margin-top: 1px; }
.edu-title   { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.edu-body    { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }

/* Portfolio */
.portfolio-form {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 140px 120px 1fr auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--border);
}
.portfolio-table-wrap { overflow-x: auto; }
.port-gain { color: #059669; font-weight: 600; }
.port-loss { color: var(--red); font-weight: 600; }

/* Compound Calculator */
.calc-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 20px 24px;
  align-items: start;
}
.calc-inputs     { display: flex; flex-direction: column; gap: 14px; }
.calc-field      { display: flex; flex-direction: column; gap: 6px; }
.calc-label      { font-size: 13px; font-weight: 600; color: var(--text-2); }
.calc-slider     { width: 100%; accent-color: var(--green); cursor: pointer; }
.calc-results    { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding: 14px; background: var(--surface-2); border-radius: var(--r); }
.calc-result-item  { display: flex; justify-content: space-between; align-items: center; }
.calc-result-label { font-size: 12px; color: var(--text-2); }
.calc-result-value { font-size: 18px; font-weight: 800; }
.calc-value-green  { color: var(--green); }
.calc-chart-wrap   { height: 280px; }

@media (max-width: 760px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-chart-wrap { height: 220px; }
  .portfolio-form { grid-template-columns: 1fr 1fr; }
  .portfolio-form .btn-secondary { grid-column: 1/-1; }
}

/* ─── Goal Planner ───────────────────── */
.goal-stat-row       { display: flex; gap: 8px; margin-top: 4px; }
.goal-stat           { flex: 1; background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; text-align: center; }
.goal-stat-label     { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.goal-stat-value     { font-size: 22px; font-weight: 800; color: var(--green); line-height: 1.1; }
.goal-stat-rate      { color: var(--text); }
.goal-stat-unit      { font-size: 12px; font-weight: 500; color: var(--text-2); }
.goal-motiv          { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--text); background: rgba(5,150,105,.08); border-left: 3px solid var(--green); border-radius: 0 var(--r) var(--r) 0; padding: 10px 14px; line-height: 1.5; }
.goal-result-note    { font-size: 12px; color: var(--text-2); margin: 10px 0 0; line-height: 1.5; }

/* ─── Tax Estimator ──────────────────── */
.tax-layout          { display: grid; grid-template-columns: 300px 1fr; gap: 24px; padding: 20px 24px; align-items: start; }
.tax-inputs          { display: flex; flex-direction: column; gap: 14px; }
.tax-results-wrap    { }
.tax-results-grid    { display: flex; flex-direction: column; gap: 6px; }
.tax-result-item     { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-2); border-radius: var(--r); }
.tax-result-highlight { background: rgba(5,150,105,.08); }
.tax-result-label    { font-size: 13px; color: var(--text-2); font-weight: 500; }
.tax-result-value    { font-size: 18px; font-weight: 800; }
.tax-val-red         { color: #dc2626; }
.tax-val-green       { color: var(--green); }
.tax-tips-list       { padding: 0 24px 20px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 16px; }
.tax-tips-header     { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.tax-tip-item        { display: flex; gap: 12px; align-items: flex-start; }
.tax-tip-icon        { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.tax-tip-title       { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.tax-tip-body        { font-size: 13px; color: var(--text-2); line-height: 1.55; }

@media (max-width: 760px) {
  .tax-layout { grid-template-columns: 1fr; }
}

/* ─── Account Settings ───────────────── */
.acct-rows       { display: flex; flex-direction: column; padding: 4px 20px 16px; }
.acct-row        { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.acct-row:last-child { border-bottom: none; }
.acct-label      { font-size: 13px; font-weight: 600; color: var(--text-2); }
.acct-value      { font-size: 14px; color: var(--text); font-weight: 500; }
.acct-plan-badge { background: rgba(5,150,105,.12); color: var(--green); font-size: 13px; font-weight: 700; padding: 3px 12px; border-radius: 20px; }
.btn-danger      { background: transparent; border: 1.5px solid #dc2626; color: #dc2626; padding: 10px 20px; border-radius: var(--r); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s, color .15s; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Investor Hub spacing overrides ─── */
#view-investor .main-container { padding: 20px 24px; gap: 16px; }
#view-investor .page-header    { padding: 0; margin-bottom: -4px; }
#view-investor .calc-layout    { padding: 16px 20px; gap: 20px; }
#view-investor .calc-inputs    { gap: 10px; }
#view-investor .portfolio-form { padding: 12px 16px; }
#view-investor .tax-layout     { padding: 16px 20px; gap: 20px; }
#view-investor .tax-inputs     { gap: 10px; }
#view-investor .tax-tips-list  { padding: 0 20px 16px; padding-top: 14px; }

@media (max-width: 640px) {
  .plans-grid, .plans-grid-3 { grid-template-columns: 1fr; }
  .plan-card-pro, .plan-card-investor { margin-top: 16px; }
}

/* ─── Demo Banner ────────────────────── */
.demo-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  padding: 8px 20px;
  font-size: 13px;
  color: #92400e;
}
.demo-banner-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-banner-label { font-size: 13px; flex-shrink: 0; white-space: nowrap; }
.demo-banner-label strong { font-weight: 700; }
.demo-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}
.demo-tab {
  padding: 5px 14px;
  border: 1.5px solid #fde68a;
  background: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.demo-tab:hover  { border-color: var(--yellow); background: #fffbeb; }
.demo-tab.active { background: var(--yellow); color: white; border-color: var(--yellow); }
.demo-banner-cta {
  background: var(--yellow);
  color: white;
  padding: 5px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .15s;
  flex-shrink: 0;
}
.demo-banner-cta:hover { opacity: .88; }
.demo-banner-close {
  background: none;
  border: none;
  color: #92400e;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.demo-banner-close:hover { background: #fde68a; }

/* ─── Admin Plan Selector ────────────── */
.admin-plans {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-plan-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  font-family: inherit;
}
.admin-plan-btn:hover        { border-color: var(--text-3); background: white; transform: translateX(3px); }
.admin-plan-btn-pro          { border-color: var(--green-light); background: var(--green-50); }
.admin-plan-btn-pro:hover    { border-color: var(--green); }
.admin-plan-btn-investor     { border-color: #fde68a; background: #fffbeb; }
.admin-plan-btn-investor:hover { border-color: var(--yellow); }

.admin-plan-icon  { font-size: 28px; flex-shrink: 0; }
.admin-plan-info  { flex: 1; }
.admin-plan-name  { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.admin-plan-price { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 2px 0 4px; }
.admin-plan-desc  { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.admin-plan-arrow { font-size: 18px; color: var(--text-3); flex-shrink: 0; }

.admin-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--green);
  color: white;
}
.admin-badge-gold { background: var(--yellow); }

/* ─── Subscribe demo button ───────────── */
.sub-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 13px;
  margin: 16px 0 12px;
}
.sub-divider::before,
.sub-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.sub-btn-demo {
  width: 100%;
  background: white;
  color: var(--text-2);
  border: 2px solid var(--border);
  padding: 13px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.sub-btn-demo:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: #fffbeb;
}

/* ─── Contact Form ────────────────────── */
.contact-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.contact-field  { display: flex; flex-direction: column; gap: 6px; }
.contact-label  { font-size: 13px; font-weight: 600; color: var(--text-2); }
.contact-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}
.contact-status {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
}
.contact-success { background: var(--green-light); color: #065f46; }
.contact-error   { background: var(--red-light); color: #991b1b; }

/* ─── Responsive ──────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .two-col   { grid-template-columns: 1fr; }
  .tips-grid { grid-template-columns: 1fr; }
  .score-hero { flex-direction: column; text-align: center; gap: 20px; }
}
@media (max-width: 680px) {
  .bill-form      { grid-template-columns: 1fr 1fr; }
  .bill-form .btn-secondary { grid-column: 1 / -1; }
  .expense-form   { grid-template-columns: 1fr 1fr; }
  .expense-form .btn-primary { grid-column: 1 / -1; }
  .custom-habit-form { grid-template-columns: 1fr 1fr; }
  .custom-habit-form .btn-secondary { grid-column: 1 / -1; }
  .main-container { padding: 16px; }
  .budget-table th:nth-child(6),
  .budget-table td:nth-child(6) { display: none; }
  .nav-tabs .nav-tab { padding: 8px 10px; font-size: 13px; }
}

/* ─── Admin Dashboard ────────────────── */
.adm-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  font-family: 'Inter', sans-serif;
}

.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.adm-brand { display: flex; align-items: center; gap: 10px; }
.adm-badge-title {
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}
.adm-header-actions { display: flex; gap: 10px; align-items: center; }
.adm-link-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text-2);
  text-decoration: none;
  transition: background .15s;
}
.adm-link-btn:hover        { background: var(--surface-2); }
.adm-link-btn-red          { color: var(--red); border-color: var(--red-light); }
.adm-link-btn-red:hover    { background: var(--red-light); }

/* Summary stat cards */
.adm-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.adm-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.adm-stat-green    { border-left: 4px solid var(--green); }
.adm-stat-pro      { border-left: 4px solid var(--green); }
.adm-stat-investor { border-left: 4px solid var(--yellow); }
.adm-stat-label    { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.adm-stat-value    { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.adm-stat-sub      { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 4px; }

/* Legend */
.adm-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
  font-size: 12px;
  flex-wrap: wrap;
}
.adm-legend-item { color: var(--text-2); }

/* Table */
.adm-table-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.adm-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.adm-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: var(--surface-2); }

/* Row highlight states */
.adm-row-new td  { background: #f0fdf4; }
.adm-row-new:hover td { background: #dcfce7 !important; }
.adm-row-bad td  { background: #fff5f5; }
.adm-row-bad:hover td { background: #fee2e2 !important; }
.adm-row-admin td { color: var(--text-3); }

/* Columns */
.adm-col-num   { width: 44px; color: var(--text-3); font-size: 12px; }
.adm-col-email { font-weight: 500; }
.adm-col-name  { color: var(--text-2); }

/* Plan badges */
.adm-plan-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.adm-plan-basic    { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.adm-plan-pro      { background: var(--green-50); color: #059669; border: 1px solid var(--green-light); }
.adm-plan-investor { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Status badges */
.adm-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: capitalize;
  background: var(--surface-2);
  color: var(--text-2);
}
.adm-status-active    { background: #f0fdf4; color: #059669; }
.adm-status-trialing  { background: #eff6ff; color: #2563eb; }
.adm-status-canceled,
.adm-status-cancelled { background: var(--red-light); color: var(--red); }
.adm-status-past_due,
.adm-status-unpaid    { background: #fff7ed; color: #c2410c; }

.adm-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 20px;
}

@media (max-width: 900px) {
  .adm-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
  .adm-wrap  { padding: 16px; }
}
