/* ═══════════════════════════════════════════════════════════════════
   FinWise — Dedicated Bank Spending Analytics Dashboard Stylesheet
   Pastel Theme & Multi-Card Layout System
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --cream:     #F5F0E8;
  --blush:     #F4A7B9;
  --butter:    #F5E642;
  --sage:      #B8D4A8;
  --lavender:  #C9B8E8;
  --peach:     #FFD9A0;
  --teal:      #A8D4D4;
  --ink:       #1A1A2E;
  --ink2:      #2D2D44;
  --muted:     #7A7A9A;
  --white:     #FEFEFE;
  --border:    rgba(26,26,46,0.08);
  --shadow-sm: 0 4px 16px rgba(26,26,46,0.06);
  --shadow-md: 0 12px 40px rgba(26,26,46,0.1);
  --sidebar-w: 240px;
  --rsidebar-w: 280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--rsidebar-w);
  overflow-x: hidden;
}

/* ═══ LEFT SIDEBAR ═══════════════════════════════════════════════ */
.sidebar {
  background: var(--ink);
  color: var(--white);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}
.brand-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
}
.brand-logo em {
  font-style: normal;
  color: var(--blush);
}
.brand-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16,185,129,0.8);
}
.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(244,167,185,0.2);
  color: var(--blush);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 12px 10px 4px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
}
.nav-item.active {
  background: var(--blush);
  color: var(--ink);
  font-weight: 600;
}
.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar mini health gauge - Matching centered ring design */
.sidebar-health {
  background: rgba(26, 26, 46, 0.7);
  border-radius: 18px;
  padding: 20px 14px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.sidebar-health-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 8px;
}
.sidebar-health-ring-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin: 10px auto;
}
.sidebar-health-ring-wrap canvas {
  width: 96px !important;
  height: 96px !important;
  display: block;
}
.sidebar-health-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
  pointer-events: none;
}
.sidebar-health-grade-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #F5E642;
  margin-top: 8px;
}

/* ═══ MAIN CONTENT ═══════════════════════════════════════════════ */
.main {
  padding: 28px 32px;
  overflow-y: auto;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}
.topbar-sub {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-badge {
  background: rgba(26,26,46,0.06);
  color: var(--ink2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  text-decoration: none;
}
.btn-action:hover {
  background: #F8F6F0;
  transform: translateY(-1px);
}
.btn-primary-action {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}
.btn-primary-action:hover {
  background: var(--ink2);
}

/* Sections */
.dash-section {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}
.dash-section.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── KPI Stat Grid (Top Row) ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card-color, var(--white));
  border-radius: 16px;
  padding: 18px 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(26,26,46,0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 112px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(26,26,46,0.65);
}
.stat-val {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0 2px;
  letter-spacing: -0.5px;
}
.stat-sub {
  font-size: 0.74rem;
  color: rgba(26,26,46,0.55);
}
.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.3rem;
  opacity: 0.8;
}

/* ── Generic Cards & Grid Layouts ── */
.card {
  background: var(--white);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(26,26,46,0.06);
  color: var(--ink2);
}

/* Row 2: Categories Donut + Expenditure Graph */
.row-2 {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: 18px;
  margin-bottom: 22px;
}
.card-butter { background: var(--butter); }
.card-blush  { background: var(--blush); }
.card-sage   { background: var(--sage); }
.card-lavender { background: var(--lavender); }
.card-peach  { background: var(--peach); }
.card-teal   { background: var(--teal); }

/* Highlighted Week-wise Spending Card */
.card-weekly-highlight {
  background: linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%);
  color: #FEFEFE;
  border: 1.5px solid rgba(20, 184, 166, 0.4);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(13, 148, 136, 0.22), 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-weekly-highlight:hover {
  box-shadow: 0 16px 40px rgba(13, 148, 136, 0.32);
}
.card-weekly-highlight .card-title {
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 1.05rem;
}
.card-weekly-highlight .chart-wrap {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}
.badge-teal-highlight {
  background: #14B8A6;
  color: #0F172A;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.4);
  letter-spacing: 0.3px;
}

/* Donut container */
.donut-wrap {
  position: relative;
  height: 180px;
  margin-bottom: 14px;
}
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center span {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  display: block;
}
.donut-center small {
  font-size: 0.68rem;
  color: rgba(26,26,46,0.6);
  text-transform: uppercase;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 75px;
  overflow-y: auto;
}
.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.7);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
}
.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Row 3: Total Spent Sessions + Spending Trend */
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 18px;
  margin-bottom: 22px;
}
.sessions-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
}
.sess-item {
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  padding: 8px 4px;
}
.sess-val {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.sess-lbl {
  font-size: 0.66rem;
  color: rgba(26,26,46,0.6);
}
.peak-day-badge {
  display: inline-block;
  background: var(--ink);
  color: var(--butter);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  margin-top: 8px;
}

/* Row 4: Month-wise & Week-wise */
.row-4 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.toggle-group {
  display: flex;
  background: rgba(26,26,46,0.06);
  border-radius: 8px;
  padding: 2px;
}
.toggle-btn {
  background: none;
  border: none;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink2);
}
.toggle-btn.active {
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ── Section: Categories Deep Dive ── */
.cat-table {
  margin-top: 14px;
}
.cat-table-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cat-table-row:last-child { border-bottom: none; }
.cat-color-bar { width: 4px; height: 32px; border-radius: 2px; flex-shrink: 0; }
.cat-name { flex: 1; font-weight: 600; font-size: 0.85rem; }
.cat-bar-wrap { width: 140px; height: 6px; background: rgba(26,26,46,0.06); border-radius: 3px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 3px; }
.cat-amount { font-weight: 700; font-size: 0.86rem; min-width: 90px; text-align: right; }
.cat-pct { font-size: 0.74rem; color: var(--muted); min-width: 42px; text-align: right; }

/* ── Section: Anomalies ── */
.anomaly-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(244,167,185,0.12);
  margin-bottom: 8px;
  transition: background 0.2s;
}
.anomaly-row:hover { background: rgba(244,167,185,0.22); }
.anomaly-cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.anomaly-desc { flex: 1; }
.anomaly-desc-title { font-size: 0.84rem; font-weight: 600; }
.anomaly-desc-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.anomaly-amount { font-weight: 700; font-size: 0.9rem; }
.anomaly-badge {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(244,167,185,0.35);
  color: #BE123C;
  font-weight: 700;
}

/* ── Section: AI Insights ── */
.insights-grid { display: flex; flex-direction: column; gap: 14px; }
.insight-card {
  background: var(--white);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid transparent;
}
.insight-card.positive { border-color: var(--sage); background: rgba(184,212,168,0.12); }
.insight-card.neutral  { border-color: var(--lavender); background: rgba(201,184,232,0.12); }
.insight-card.warning  { border-color: var(--blush); background: rgba(244,167,185,0.12); }
.insight-card.info     { border-color: var(--butter); background: rgba(245,230,66,0.12); }
.insight-icon { font-size: 1.5rem; flex-shrink: 0; }
.insight-text { font-size: 0.88rem; line-height: 1.6; color: var(--ink); }

/* ── Section: Recommendations & Health ── */
.health-hero {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-bottom: 20px;
  background: var(--ink);
  color: var(--white);
  border-radius: 20px;
  padding: 28px;
}
.health-hero-left { flex: 1; }
.health-hero-left .card-title { color: rgba(255,255,255,0.6); margin-bottom: 12px; }
.health-big-score {
  font-family: 'Playfair Display', serif;
  font-size: 3.4rem;
  font-weight: 700;
  color: var(--butter);
  line-height: 1;
}
.health-big-grade {
  font-size: 1.15rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  margin: 6px 0 20px;
}
.health-bars { display: flex; flex-direction: column; gap: 12px; }
.health-bar-row { display: flex; flex-direction: column; gap: 5px; }
.health-bar-label {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.6);
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}
.health-bar-track { height: 7px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
.health-bar-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tip-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.tip-icon { font-size: 1.6rem; margin-bottom: 10px; }
.tip-title { font-weight: 700; font-size: 0.92rem; margin-bottom: 6px; color: var(--ink); }
.tip-text { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }

/* ── Section: Transactions ── */
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.tx-row:last-child { border-bottom: none; }
.tx-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tx-desc { flex: 1; font-weight: 600; }
.tx-cat { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.tx-date { color: var(--muted); font-size: 0.74rem; min-width: 85px; }
.tx-amount { font-weight: 700; min-width: 90px; text-align: right; }
.tx-amount.income { color: #10B981; }
.tx-amount.expense { color: #BE123C; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pg-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s;
}
.pg-btn.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.pg-btn:hover:not(.active) { border-color: var(--blush); background: #FAF7F2; }

/* ═══ RIGHT SIDEBAR ══════════════════════════════════════════════ */
.right-sidebar {
  background: var(--white);
  border-left: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rs-card {
  background: var(--cream);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(26,26,46,0.05);
}
.rs-card-sage { background: rgba(184,212,168,0.25); }
.rs-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
  margin-bottom: 12px;
}

/* Calendar */
.rs-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.rs-month-nav button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.2s;
}
.rs-month-nav button:hover { color: var(--ink); background: rgba(26,26,46,0.06); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}
.cal-day-label { text-align: center; font-size: 0.62rem; color: var(--muted); font-weight: 700; padding: 2px 0; }
.cal-day {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(26,26,46,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  color: var(--muted);
  cursor: default;
  transition: all 0.2s;
  position: relative;
}
.cal-day.has-data { color: var(--ink); font-weight: 600; cursor: pointer; }
.cal-day.today { outline: 2px solid var(--ink); }
.cal-day:hover .cal-tooltip {
  opacity: 1;
  pointer-events: none;
}
.cal-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.68rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.cal-legend { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cal-legend-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(244,167,185,0.2), var(--blush));
}

/* AI Alerts */
.alert-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid rgba(26,26,46,0.06);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink);
}
.alert-item:last-child { border-bottom: none; }
.alert-item .alert-icon { font-size: 0.95rem; flex-shrink: 0; margin-top: 1px; }

/* Savings Wins */
.win-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(26,26,46,0.06);
  font-size: 0.78rem;
  color: var(--ink);
}
.win-item:last-child { border-bottom: none; }
.win-val { font-weight: 700; color: #10B981; margin-left: auto; }

/* ═══ RESPONSIVE BREAKPOINTS ══════════════════════════════════════ */
@media (max-width: 1200px) {
  body { grid-template-columns: var(--sidebar-w) 1fr; }
  .right-sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tips-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
}

