/* ============================================================
   FINANCE IQ — STYLE SHEET
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Soft neutral gray aesthetic gradient */
  --app-gradient: linear-gradient(160deg, #e8eaed 0%, #eceef1 35%, #e6e8eb 70%, #dfe1e5 100%);
  --bg: #e8eaed;
  /* Frosted-glass surfaces */
  --surface: rgba(255, 255, 255, 0.55);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.35);
  --border: rgba(255, 255, 255, 0.6);
  --text-primary: #0f1123;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-light: #ede9fe;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --pink: #f472b6;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --gold: #f59e0b;
  --nav-h: 72px;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(60, 70, 90, 0.10);
  --shadow-sm: 0 4px 16px rgba(60, 70, 90, 0.08);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--app-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; outline: none; border: none; }

/* ---------- App Shell ---------- */
.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--app-gradient);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + 12px);
  min-height: 100vh;
}
.screen.active { display: flex; }

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 16px 0;
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 52px 20px 16px;
}

.topbar-inner {
  padding-top: 52px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
  flex-shrink: 0;
}

.greeting-block {
  display: flex;
  flex-direction: column;
}
.greeting-sub { font-size: 11px; color: var(--text-muted); }
.greeting-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  position: relative;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--border); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

/* ---------- Balance Hero ---------- */
.balance-hero {
  margin: 4px 20px 0;
  background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 60%, #e8e4ff 100%);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.balance-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(99,102,241,.12), transparent 70%);
  border-radius: 50%;
}

.balance-label {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.balance-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 12px;
}
.balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.balance-amount {
  font-size: 40px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: var(--green-light); color: var(--green); }

.balance-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.balance-meta-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}

.balance-status {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 14px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.balance-bar {
  height: 5px;
  background: rgba(99,102,241,.12);
  border-radius: 10px;
  margin-top: 10px;
  overflow: hidden;
}
.balance-bar-fill {
  height: 100%;
  width: 72%;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  border-radius: 10px;
  animation: barGrow .8s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes barGrow { from { width: 0; } }

/* ---------- Section Header ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 10px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.period-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Overview Grid ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px;
}

.overview-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.overview-card:hover { transform: translateY(-2px); }

.ov-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.ov-green { background: var(--green-light); color: var(--green); }
.ov-red   { background: var(--red-light);   color: var(--red); }
.ov-blue  { background: var(--blue-light);  color: var(--blue); }
.ov-purple{ background: var(--purple-light);color: var(--purple); }

.ov-label { font-size: 12px; color: var(--text-muted); }
.ov-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.ov-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
}
.ov-change.positive { color: var(--green); }
.ov-change.negative { color: var(--red); }

/* ---------- Transaction History ---------- */
.tx-group-label {
  padding: 4px 20px 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 20px;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: background .15s;
}
.tx-item:hover { background: var(--surface-2); }

.tx-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-starbucks { background: #00704a; }
.tx-amazon    { background: #ff9900; }
.tx-salary    { background: var(--green); }
.tx-netflix   { background: #e50914; }

.tx-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tx-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tx-time { font-size: 11px; color: var(--text-muted); }

.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tx-amount { font-size: 14px; font-weight: 700; }
.tx-amount.positive { color: var(--green); }
.tx-amount.negative { color: var(--text-primary); }
.tx-type { font-size: 10px; color: var(--text-muted); }

/* ---------- Analytics Screen ---------- */
.analytics-tabs {
  display: flex;
  gap: 6px;
  padding: 0 20px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.analytics-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  transition: all .2s;
}
.tab-btn.active {
  background: var(--text-primary);
  color: white;
  font-weight: 600;
}

.analytics-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 20px 16px;
  box-shadow: var(--shadow-sm);
}

.analytics-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.analytics-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.spending-amount {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.spending-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  margin-bottom: 16px;
}

.donut-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-info { display: flex; flex-direction: column; }
.legend-cat { font-size: 12px; color: var(--text-secondary); }
.legend-val { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.donut-chart-wrap {
  width: 150px; height: 150px;
  flex-shrink: 0;
  position: relative;
}

/* ---------- Line Chart ---------- */
.trend-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.trend-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  margin-bottom: 16px;
}
.line-chart-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
}
.line-chart-xaxis {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.bar-chart-wrap {
  width: 100%;
  padding-top: 8px;
}

/* ---------- AI Finance Coach Screen ---------- */
.coach-screen-scroll {
  padding-bottom: 90px !important;
}

.coach-hero {
  padding: 12px 20px 24px;
}
.coach-sparkle {
  margin-bottom: 12px;
}
.coach-headline {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -.5px;
}

.coach-section-label {
  padding: 0 20px 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .3px;
}

.coach-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px;
}

.coach-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: all .2s;
}
.coach-action-card:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow);
}

.coa-icon {
  width: 36px; height: 36px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.coa-text { display: flex; flex-direction: column; gap: 2px; }
.coa-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.coa-desc  { font-size: 12px; color: var(--text-muted); }

.coach-chat {
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  animation: bubbleIn .2s ease;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble.ai {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 4px;
}

.coach-input-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(390px, calc(100vw - 32px));
  background: var(--text-primary);
  border-radius: 28px;
  padding: 8px 8px 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 100;
}

.chat-add-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: transparent;
  color: white;
  font-size: 14px;
  caret-color: white;
}
.chat-input::placeholder { color: rgba(255,255,255,.5); }

.chat-mic-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.chat-mic-btn:hover { background: rgba(255,255,255,.25); }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100vw);
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: all .2s;
  flex: 1;
}
.nav-btn span { display: block; }
.nav-btn.active {
  color: var(--accent);
}
.nav-btn.active svg { stroke: var(--accent); }

.nav-center-btn {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,.4);
  flex: 0 0 auto;
  flex-direction: row;
  gap: 0;
  padding: 0;
  justify-content: center;
}
.nav-center-btn span { display: none; }

/* ---------- Add Transaction Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 24px 24px 40px;
  width: min(430px, 100vw);
  box-shadow: 0 -8px 40px rgba(0,0,0,.15);
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-type-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.type-btn {
  flex: 1;
  padding: 8px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
}
.type-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
}
.currency-sign {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 4px;
}
.amount-input-wrap input {
  width: 100%;
  padding: 12px 0;
  font-size: 18px;
  font-weight: 700;
  background: transparent;
  color: var(--text-primary);
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color .2s;
}
.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.modal-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(99,102,241,.35);
  transition: opacity .2s;
  margin-top: 4px;
}
.modal-submit-btn:hover { opacity: .9; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (min-width: 431px) {
  .app-shell {
    box-shadow: 0 0 60px rgba(0,0,0,.12);
    border-radius: 0;
  }
}

@media (max-width: 380px) {
  .balance-amount { font-size: 34px; }
  .overview-grid { gap: 8px; }
  .ov-value { font-size: 16px; }
}

/* ---------- Typing indicator ---------- */
.typing-bubble {
  display: flex; gap: 4px;
  align-items: center;
  padding: 12px 14px;
}
.typing-bubble span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: .2s; }
.typing-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
  0%, 80%, 100% { transform: scale(1); opacity: .5; }
  40%            { transform: scale(1.3); opacity: 1; }
}

/* ---------- Scrollbar (desktop) ---------- */
@media (pointer: fine) {
  .screen-scroll::-webkit-scrollbar { display: block; width: 4px; }
  .screen-scroll::-webkit-scrollbar-track { background: transparent; }
  .screen-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
}


/* ============================================================
   SUPABASE INTEGRATION — ADDITIONAL STYLES
   ============================================================ */

/* ---------- Utility ---------- */
.hidden { display: none !important; }

/* ---------- Config Banner ---------- */
.config-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: #fef3c7;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #fde68a;
}
.config-banner strong { font-weight: 700; }
.config-banner ~ .auth-screen,
.config-banner ~ #appRoot {
  padding-top: 44px;
}

/* ---------- Auth Screen ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--app-gradient);
  background-attachment: fixed;
}

.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 28px;
  padding: 36px 28px 32px;
  box-shadow: 0 8px 40px rgba(99,102,241,.12);
}

.auth-logo {
  width: 56px; height: 56px;
  background: var(--accent-light);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 8px;
}

.auth-toggle-btn {
  width: 100%;
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  text-align: center;
  padding: 8px;
}

/* ---------- App Root ---------- */
.app-root { display: contents; }
.app-root.hidden { display: none !important; }

/* ---------- Topbar right buttons ---------- */
.topbar-right-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sign-out-btn { color: var(--text-muted); }
.sign-out-btn:hover { color: var(--red); background: var(--red-light); }

/* ---------- Transaction skeleton loading ---------- */
.tx-skeleton-wrap {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-skeleton {
  height: 64px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.tx-skeleton:nth-child(2) { animation-delay: .15s; }
.tx-skeleton:nth-child(3) { animation-delay: .3s; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Empty state ---------- */
.tx-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.tx-empty strong { color: var(--accent); }

/* ---------- Delete button on tx rows ---------- */
.tx-delete-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  flex-shrink: 0;
}
.tx-item:hover .tx-delete-btn {
  opacity: 1;
}
.tx-delete-btn:hover {
  background: var(--red-light);
  color: var(--red);
}

/* ---------- Legend skeleton ---------- */
.legend-skeleton {
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 8px;
}

/* ---------- Supabase badge on balance hero ---------- */
.balance-meta-tag {
  background: linear-gradient(90deg, #3ecf8e, #1a9b6c);
  color: white;
}

/* ---------- Empty chart overlay ---------- */
.chart-empty-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
  pointer-events: none;
}

/* ---------- Analytics tab panels ---------- */
.tab-panel { display: flex; flex-direction: column; }
.tab-panel.hidden { display: none !important; }

/* ---------- Overview stat row ---------- */
.overview-stat-row {
  display: flex;
  gap: 10px;
  padding: 4px 20px 16px;
}
.overview-stat-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.overview-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.overview-stat-value {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.overview-stat-value.green  { color: var(--green); }
.overview-stat-value.red    { color: var(--red); }
.overview-stat-value.accent { color: var(--accent); }

/* ---------- Top list (spending / income / investments) ---------- */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.top-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.top-list-row:last-child { border-bottom: none; }
.top-list-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.top-list-left .tx-name  { font-size: 13px; }
.top-list-left .tx-time  { font-size: 11px; color: var(--text-muted); }

/* ---------- Dropdown ---------- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown.open .dropdown-trigger {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}
/* Rotate chevron when open */
.dropdown.open .dropdown-trigger svg {
  transform: rotate(180deg);
  transition: transform .2s;
}
.dropdown-trigger svg { transition: transform .2s; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  border: 1px solid var(--border);
  min-width: 150px;
  z-index: 500;
  overflow: hidden;
  animation: dropIn .15s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.dropdown-item.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
}

/* ============================================================
   PROFILE SCREEN + DASHBOARD DROPDOWN COMPLETIONS
   ============================================================ */

/* ---------- Profile hero ---------- */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 24px;
  text-align: center;
}

.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 28px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,.35);
  margin-bottom: 14px;
}

.profile-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -.3px;
}

.profile-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.profile-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ---------- Profile stats row ---------- */
.profile-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 0;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.profile-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.5px;
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.profile-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ---------- Profile sign-out button ---------- */
.profile-signout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--red-light);
  color: var(--red);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  transition: opacity .15s;
}
.profile-signout-btn:hover { opacity: .85; }

/* ---------- Dashboard overview section header fix ---------- */
/* Make the dropdown sit flush with the section-header flex row */
.section-header .dropdown { display: inline-flex; }

/* ============================================================
   NOTIFICATIONS / INSIGHTS
   ============================================================ */

/* Badge count on the bell */
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
  line-height: 1;
}

/* The icon-btn needs relative positioning for the badge */
.topbar-right-btns .icon-btn { position: relative; }

/* Panel — fixed to viewport so parent overflow:hidden can't clip it */
.notif-panel {
  position: fixed;
  top: 92px;
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  max-height: 420px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  border: 1px solid var(--border);
  z-index: 900;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: dropIn .16s ease;
}
.notif-panel.open { display: flex; }

/* Keep it aligned with the app shell on wide screens */
@media (min-width: 431px) {
  .notif-panel {
    right: max(16px, calc(50vw - 215px));
  }
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.notif-clear {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.notif-list {
  overflow-y: auto;
  max-height: 360px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-accent { background: var(--accent-light); color: var(--accent); }
.notif-green  { background: var(--green-light);  color: var(--green); }
.notif-red    { background: var(--red-light);    color: var(--red); }
.notif-amber  { background: #fef3c7;             color: #d97706; }

.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.notif-body  { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   GLASSMORPHISM — FROSTED GLASS AESTHETIC
   Applied app-wide for the soft translucent look
   ============================================================ */

/* Frosted cards — semi-transparent white + blur */
.overview-card,
.tx-item,
.analytics-card,
.overview-stat-card,
.icon-btn,
.period-btn,
.dropdown-trigger,
.tab-btn:not(.active),
.notif-panel,
.modal-card,
.auth-card {
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.65);
}

/* Balance hero — brighter frosted panel with a soft neutral tint */
.balance-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.65) 0%, rgba(238,240,243,0.5) 55%, rgba(228,231,235,0.45) 100%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* Bottom nav — frosted bar */
.bottom-nav {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
}

/* Profile avatar hero area sits directly on the gradient */
.profile-hero { background: transparent; }

/* Transaction rows: keep them lighter so grouped lists breathe */
.tx-item {
  background: rgba(255, 255, 255, 0.5);
}
.tx-item:hover {
  background: rgba(255, 255, 255, 0.72);
}

/* Form inputs on frosted surfaces */
.amount-input-wrap,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Modal type toggle track */
.modal-type-toggle {
  background: rgba(255, 255, 255, 0.4);
}
.type-btn.active {
  background: rgba(255, 255, 255, 0.85);
}

/* Skeleton loaders tinted for glass bg */
.tx-skeleton, .legend-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.3) 25%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0.3) 75%);
  background-size: 200% 100%;
}

/* Modal overlay backdrop — dim the gradient behind sheets */
.modal-overlay {
  background: rgba(40, 45, 55, 0.38);
}

/* Dropdown menus frosted */
.dropdown-menu {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* Slightly stronger text contrast on the softer background */
.section-title, .balance-label, .balance-amount { color: #16182e; }

/* ---------- Chart view toggle (Daily / Per entry) ---------- */
.chart-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin: 4px 0 12px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.view-toggle-btn {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all .18s;
}
.view-toggle-btn.active {
  background: var(--text-primary);
  color: #fff;
}

/* ---------- Profile "Powered by" credit ---------- */
.powered-by {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .3px;
  padding: 0 20px 12px;
  margin-top: -2px;
}

/* ============================================================
   ✦ MODERN POLISH LAYER
   Typography, depth, motion & micro-interactions
   ============================================================ */

/* ---------- Typography ---------- */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
}

/* Display numerals & headings get the Sora treatment */
.balance-amount,
.spending-amount,
.trend-amount,
.overview-stat-value,
.profile-stat-value,
.auth-title,
.coach-headline {
  font-family: 'Sora', 'Inter', sans-serif;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum" 1;
}

/* Tabular figures so money never jitters */
.ov-value, .tx-amount, .legend-val, .heroBalance {
  font-variant-numeric: tabular-nums;
}

/* ---------- Refined depth & gradient ---------- */
:root {
  --app-gradient: linear-gradient(155deg, #eef0f4 0%, #e7e9ee 40%, #e2e4ea 72%, #dcdee6 100%);
  --shadow-sm: 0 2px 10px rgba(40, 50, 80, 0.06);
  --shadow: 0 10px 34px rgba(40, 50, 80, 0.10);
  --shadow-lg: 0 20px 50px rgba(40, 50, 80, 0.14);
}

/* Subtle ambient glow blobs behind the frosted UI for depth */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 320px; height: 320px;
  top: -80px; left: -60px;
  background: radial-gradient(circle, rgba(99,102,241,0.28), transparent 70%);
}
body::after {
  width: 300px; height: 300px;
  bottom: 40px; right: -80px;
  background: radial-gradient(circle, rgba(139,92,246,0.22), transparent 70%);
}
.app-shell, .auth-screen { position: relative; z-index: 1; }

/* ---------- Cards: crisper glass, soft ring, lift on hover ---------- */
.overview-card,
.analytics-card,
.overview-stat-card {
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease;
}
.overview-card:hover,
.analytics-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* ---------- Balance hero: richer, glossier ---------- */
.balance-hero {
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.7);
  position: relative;
  overflow: hidden;
}
.balance-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 80% -10%, rgba(139,92,246,0.14), transparent 60%);
  pointer-events: none;
}
.balance-amount { font-weight: 800; }

/* ---------- Overview icon chips: gradient fills ---------- */
.ov-green  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #059669; }
.ov-red    { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #dc2626; }
.ov-blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; }
.ov-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #7c3aed; }
.ov-icon {
  box-shadow: 0 4px 12px rgba(99,102,241,0.10);
}

/* ---------- Transaction rows: smoother, tactile ---------- */
.tx-item {
  border: 1px solid transparent;
  transition: background .2s ease, transform .15s ease, border-color .2s ease;
}
.tx-item:hover {
  transform: translateX(3px);
  border-color: rgba(255,255,255,0.7);
}
.tx-logo { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

/* ---------- Buttons & pills: springy press ---------- */
.icon-btn, .period-btn, .dropdown-trigger, .tab-btn,
.view-toggle-btn, .coach-action-card, .nav-btn,
.modal-submit-btn, .profile-signout-btn, .auth-toggle-btn {
  transition: transform .18s cubic-bezier(.2,.8,.2,1), background .2s ease, color .2s ease, box-shadow .2s ease;
}
.icon-btn:active, .period-btn:active, .dropdown-trigger:active,
.tab-btn:active, .view-toggle-btn:active, .nav-btn:active,
.coach-action-card:active, .modal-submit-btn:active {
  transform: scale(0.95);
}

/* ---------- Tabs: pill highlight ---------- */
.tab-btn.active {
  box-shadow: 0 6px 18px rgba(15,17,35,0.28);
}

/* ---------- Primary buttons: gradient + glow ---------- */
.modal-submit-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 8px 22px rgba(99,102,241,0.35);
  letter-spacing: 0.01em;
}
.modal-submit-btn:hover { box-shadow: 0 10px 28px rgba(99,102,241,0.45); transform: translateY(-1px); }

/* ---------- Center FAB: bolder, floating ---------- */
.nav-center-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 8px 24px rgba(99,102,241,0.45);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
}
.nav-center-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 30px rgba(99,102,241,0.55); }
.nav-center-btn:active { transform: scale(0.94); }

/* ---------- Bottom nav: floating dock feel ---------- */
.bottom-nav {
  box-shadow: 0 -6px 30px rgba(40,50,80,0.10);
}
.nav-btn.active {
  position: relative;
}
.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 2px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(99,102,241,0.6);
}

/* ---------- Avatar: gradient ring ---------- */
.avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
.profile-avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  box-shadow: 0 10px 30px rgba(99,102,241,0.4);
}

/* ---------- Badges & status pills ---------- */
.badge-green { box-shadow: 0 2px 8px rgba(16,185,129,0.18); }
.balance-status {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}

/* ---------- Dropdown menu: refined ---------- */
.dropdown-menu {
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  padding: 6px;
}
.dropdown-item { border-radius: 10px; }
.dropdown-item.active { box-shadow: inset 0 0 0 1px rgba(99,102,241,0.25); }

/* ---------- Section titles: tighter, bolder ---------- */
.section-title { font-weight: 700; letter-spacing: -0.02em; }

/* ---------- Screen entrance animation ---------- */
.screen.active { animation: screenIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger cards in on the dashboard/analytics */
.overview-grid .overview-card,
.analytics-card,
.tx-item {
  animation: cardIn .4s cubic-bezier(.2,.8,.2,1) backwards;
}
.overview-grid .overview-card:nth-child(1) { animation-delay: .04s; }
.overview-grid .overview-card:nth-child(2) { animation-delay: .08s; }
.overview-grid .overview-card:nth-child(3) { animation-delay: .12s; }
.overview-grid .overview-card:nth-child(4) { animation-delay: .16s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Coach cards: gradient icon + hover ---------- */
.coa-icon {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  box-shadow: 0 4px 12px rgba(99,102,241,0.12);
}
.coach-action-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

/* ---------- Chat input bar: floating glass ---------- */
.coach-input-bar {
  box-shadow: 0 10px 30px rgba(15,17,35,0.28);
}

/* ---------- Notification badge: pulse when present ---------- */
.notif-badge:not(.hidden) {
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ---------- Toast: modern pill ---------- */
.toast {
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15,17,35,0.35);
  backdrop-filter: blur(10px);
  background: rgba(15,17,35,0.92);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- Auth card: elevated glass ---------- */
.auth-card {
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.7);
}
.auth-logo {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  box-shadow: 0 8px 20px rgba(99,102,241,0.2);
}

/* ---------- Inputs: focus ring glow ---------- */
.amount-input-wrap:focus-within,
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* ---------- Profile badge shimmer ---------- */
.profile-badge {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
}

/* ---------- Smooth scrolling ---------- */
.screen-scroll { scroll-behavior: smooth; }

/* ---------- Reduced-motion respect ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   CATEGORY ICON CHIPS + CUSTOM CATEGORY PICKER
   ============================================================ */

/* Reusable colored icon chip */
.cat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* Legend chip sizing tweak */
.legend-item .cat-chip { border-radius: 10px; }

/* ---------- Custom category select ---------- */
.cat-select { position: relative; }

.cat-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  transition: border-color .2s, box-shadow .2s;
}
.cat-select.open .cat-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.cat-select-trigger svg { transition: transform .2s; color: var(--text-muted); }
.cat-select.open .cat-select-trigger svg { transform: rotate(180deg); }

.cat-select-current {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.cat-select-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 400;
  max-height: 260px;
  overflow-y: auto;
  animation: dropIn .16s ease;
}
.cat-select.open .cat-select-menu { display: block; }

.cat-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  transition: background .15s, color .15s;
}
.cat-option:hover { background: rgba(99,102,241,0.08); color: var(--text-primary); }
.cat-option.active {
  background: var(--accent-light);
  color: var(--accent);
}

.cat-name { line-height: 1; }
