/* ==========================================================================
   STFU v0.39 — Dashboard ("Overzicht")
   ==========================================================================
   Hero card, the four metric cards, and the "Komende betalingen" /
   "Jullie spaardoelen" content grid. Structural page-switching lives in
   shell-v039.css; generic component primitives (buttons, .pot-row,
   .content-card) live in components-v039.css — this file is specific to
   the dashboard's own layout and its hero illustration.
   ========================================================================== */

.page-overzicht { display: flex; flex-direction: column; gap: var(--space-5); }
.page-overzicht.hidden, .page-overzicht.page-hidden { display: none; }

/* -- Hero card -------------------------------------------------------------- */
.hero-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  border-radius: var(--radius-xl);
  padding: clamp(var(--space-5), 4vw, var(--space-7));
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 62%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
:root[data-theme="dark"] .hero-card { background: linear-gradient(135deg, rgba(89, 199, 147, .14) 0%, var(--surface) 62%); }
.hero-card.negative { background: linear-gradient(135deg, var(--expense-soft) 0%, var(--surface) 62%); }
.hero-copy { position: relative; z-index: 1; max-width: 60ch; }
.hero-copy .eyebrow { color: var(--text-secondary); }
.hero-amount { display: block; font-family: var(--font-editorial); font-size: var(--text-hero); line-height: 1.05; color: var(--text-primary); margin: 2px 0 10px; }
.hero-card.negative .hero-amount { color: var(--expense); }
.hero-status { margin: 0; color: var(--text-secondary); font-size: var(--text-base); max-width: 46ch; }
/* #dashboard-scope-breakdown — only populated in "Samen" (see renderPlan()
   in app.js), spelling out that the household total already includes each
   partner's own personal money, not just what's jointly paid for. */
.hero-breakdown { margin: 6px 0 0; color: var(--text-secondary); font-size: var(--text-sm); max-width: 46ch; }
/* v0.42 Deel E: the illustration got wider and richer, so it (plus its
   optional desktop caption) now lives in its own flex child instead of
   .hero-illustration being that child directly — keeps the caption from
   disturbing the hero-card's two-column layout. */
.hero-illustration-wrap { flex: none; width: clamp(180px, 28vw, 320px); position: relative; z-index: 1; display: grid; gap: 6px; justify-items: center; }
.hero-illustration { width: 100%; }
.hero-illustration svg { width: 100%; height: auto; display: block; }
.hero-illustration-caption { margin: 0; font-family: var(--font-editorial); font-size: var(--text-sm); color: var(--text-secondary); text-align: center; }
@media (max-width: 1024px) { .hero-illustration-caption { display: none; } }
.illu-sky-orb { fill: var(--savings); opacity: .9; }
:root[data-theme="dark"] .illu-sky-orb { fill: var(--text-primary); opacity: .85; }
.illu-hill-back { fill: var(--accent-soft); }
.illu-hill-mid { fill: var(--accent-soft); opacity: .75; }
.illu-hill-front { fill: var(--accent); opacity: .55; }
.illu-cloud { fill: var(--surface); opacity: .8; }
.illu-cloud-b { opacity: .55; }
:root[data-theme="dark"] .illu-cloud { opacity: .18; }
.illu-home rect, .illu-home path { fill: var(--surface-raised); stroke: var(--text-primary); stroke-width: 1.4; stroke-linejoin: round; }
.illu-home .illu-door { fill: var(--accent-strong); stroke: none; }
.illu-home .illu-window { fill: var(--savings); stroke: none; }
.illu-leaf { fill: var(--accent); opacity: .5; }
:root[data-theme="dark"] .illu-leaf { opacity: .38; }
/* Movement stays strictly opt-in: no animation at all unless the visitor's
   system has no reduced-motion preference set, and even then it's a slow,
   few-pixel drift — never anything that could distract from the numbers
   above it. */
@media (prefers-reduced-motion: no-preference) {
  .illu-cloud-a { animation: illu-drift 22s ease-in-out infinite; }
  .illu-cloud-b { animation: illu-drift 26s ease-in-out infinite reverse; }
}
@keyframes illu-drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }
@media (max-width: 900px) {
  .hero-illustration-wrap { width: clamp(160px, 30vw, 220px); }
}
@media (max-width: 640px) {
  .hero-card { flex-direction: column; align-items: flex-start; }
  .hero-illustration-wrap { width: min(200px, 60vw); align-self: center; }
}

/* -- Greeting time-of-day icon (v0.42 Deel E) --------------------------------- */
.greeting-time-icon { display: inline-flex; width: 0.82em; height: 0.82em; margin-right: 8px; vertical-align: -0.1em; }
.greeting-time-icon svg { width: 100%; height: 100%; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.greeting-time-icon .time-icon-sun { stroke: var(--savings); }
.greeting-time-icon .time-icon-sun circle { fill: var(--savings-soft); }
.greeting-time-icon .time-icon-moon { fill: var(--text-secondary); stroke: none; }
.greeting-time-icon .time-icon-evening { stroke: var(--expense); }
.greeting-time-icon .time-icon-evening circle { fill: var(--expense-soft); }

/* -- Metric cards ------------------------------------------------------------ */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.metric-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.metric-card:hover { border-color: var(--accent); }
.metric-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.metric-icon svg { width: 19px; height: 19px; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.metric-income .metric-icon { background: var(--income-soft); } .metric-income .metric-icon svg { stroke: var(--income); }
.metric-expense .metric-icon { background: var(--expense-soft); } .metric-expense .metric-icon svg { stroke: var(--expense); }
.metric-info .metric-icon { background: var(--info-soft); } .metric-info .metric-icon svg { stroke: var(--info); }
.metric-savings .metric-icon { background: var(--savings-soft); } .metric-savings .metric-icon svg { stroke: var(--savings); }
.metric-body { display: grid; align-content: center; gap: 2px; min-width: 0; }
.metric-label { font-size: var(--text-xs); line-height: 1.25; color: var(--text-secondary); font-weight: 600; }
.metric-body strong { font-size: var(--text-lg); line-height: 1.2; font-weight: 700; color: var(--text-primary); }
.metric-compare { font-size: 11px; color: var(--text-secondary); min-height: 14px; }
.metric-compare:empty { display: none; }
.metric-compare.compare-positive { color: var(--income); }
.metric-compare.compare-negative { color: var(--expense); }
.metric-compare.compare-neutral { color: var(--text-secondary); }
@media (max-width: 1023px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .metric-card { padding: var(--space-3); gap: 8px; }
  .metric-body strong { font-size: clamp(16px, 5vw, var(--text-lg)); }
}
@media (max-width: 360px) {
  .metric-card { flex-direction: column; }
}

/* -- Content grid: Komende betalingen + Jullie spaardoelen -------------------- */
.content-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-4); align-items: start; }
@media (max-width: 900px) {
  .content-grid { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .content-grid > * { min-width: 0; width: 100%; }
}

.upcoming-list { display: flex; flex-direction: column; }
.upcoming-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center; gap: 10px; min-height: 48px; padding: 10px 0; border-top: 1px solid var(--border);
}
.upcoming-list .upcoming-row:first-child { border-top: 0; }
.upcoming-icon { flex: none; display: flex; }
.upcoming-badge {
  flex: none; min-width: 60px; text-align: center;
  padding: 4px 8px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  background: var(--surface-soft); color: var(--text-secondary);
}
.upcoming-badge.status-today, .upcoming-badge.status-late { background: var(--expense-soft); color: var(--expense); }
.upcoming-badge.status-soon { background: var(--savings-soft); color: var(--savings); }
.upcoming-info { min-width: 0; display: flex; flex-direction: column; }
.upcoming-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-info small { color: var(--text-secondary); font-size: var(--text-xs); }
.upcoming-amount { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; color: var(--text-primary); }
.upcoming-menu {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: none; background: none; border-radius: var(--radius-md); color: var(--text-secondary); cursor: pointer;
}
.upcoming-menu:hover, .upcoming-menu:focus-visible { background: var(--surface-soft); color: var(--text-primary); }
.upcoming-menu svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 480px) {
  .upcoming-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon info menu" "icon badge amount"; row-gap: 4px; }
  .upcoming-icon { grid-area: icon; }
  .upcoming-info { grid-area: info; }
  .upcoming-menu { grid-area: menu; }
  .upcoming-badge { grid-area: badge; justify-self: start; }
  .upcoming-amount { grid-area: amount; justify-self: end; }
}

/* #spaardoelen-page-list carries both "pot-list" (the dashboard's own
   single-column compact card, further down this file) and "pot-list-page"
   — with equal specificity, whichever rule is later in the file wins the
   `display` property, so .pot-list's `display: flex; flex-direction:
   column` was silently defeating this grid entirely and the full
   spaardoelen page was rendering as one always-narrow flex column instead
   of a real multi-column layout, regardless of screen width. The compound
   selector makes this grid win no matter the source order. auto-fit (not
   auto-fill) then means one or two goals share the full row width instead
   of being pinned to a narrow column with empty reserved tracks beside
   them. */
.pot-list.pot-list-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); align-items: start; }
.pot-list-page .pot-row { margin: 0; padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* -- Dashboard "Jullie spaardoelen" compact card (v0.42 Deel B) -------------- */
/* A deliberately smaller, read-only sibling of .pot-row (components-v039.css)
   — photo/icon, name, optional description, amounts and a progress bar,
   nothing else. Reuses .pot-progress (defined once in components-v039.css)
   for the bar itself so both the compact card and the pot-manager modal
   never visually drift apart. */
.pot-list { display: flex; flex-direction: column; }
.pot-row-compact {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 4px; border-top: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer;
}
.pot-list .pot-row-compact:first-child { border-top: 0; }
.pot-row-compact:hover, .pot-row-compact:focus-visible { background: var(--surface-soft); outline: none; }
.pot-compact-icon { flex: none; }
.pot-compact-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.pot-compact-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pot-compact-heading b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pot-compact-pct { flex: none; font-size: var(--text-xs); font-weight: 800; color: var(--savings); font-variant-numeric: tabular-nums; }
/* No description is simply no <p> at all (see renderPotsDashboard()) — this
   rule only ever guards wrapping of text that IS there, at any width down
   to 320px, never reserves space for text that isn't. */
.pot-compact-description { margin: 0; color: var(--text-secondary); font-size: var(--text-xs); line-height: 1.4; overflow-wrap: anywhere; }
.pot-compact-amounts { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.pot-compact-amounts strong { color: var(--text-primary); }
.pot-compact-amounts span { color: var(--text-secondary); font-size: var(--text-xs); }

/* A single stacked column rather than a side-by-side 2-column grid: the
   right-hand slot's height varies a lot (nothing to show vs. an
   actiecentrum plus a multi-step setup guide), which made a fixed-width
   left column for the always-short period-status strip look randomly cut
   short next to it, with a big dead gap underneath. Stacking removes that
   mismatch and lets the actiecentrum's own item rows use the full content
   width instead of being squeezed into ~55% of it. */
.dashboard-operations {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}
.dashboard-operations > * { min-width: 0; }
.month-check { display: grid; gap: var(--space-3); }
.month-check-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.month-check-heading h2 { margin: 0; }
.month-check-heading p { margin: 0; }
.month-check-state { font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); }
.month-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.month-check-grid button { display: flex; align-items: baseline; gap: var(--space-2); text-align: left; min-height: 44px; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); color: var(--text-primary); }
.month-check-grid button b { font-size: var(--text-xl); }
.month-check-links { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.month-check-links button { min-height: 44px; border: 0; background: transparent; color: var(--text-primary); font-weight: 700; text-align: left; }
@media (max-width: 600px) { .month-check-grid { grid-template-columns: 1fr; } }
#dashboard-guidance-slot { display: grid; gap: var(--space-3); }
#dashboard-guidance-slot > .action-center,
#dashboard-guidance-slot > .setup-guide,
#dashboard-guidance-slot > .setup-guide-launcher { margin: 0; }

.period-status { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface-soft); border: 1px solid var(--border); }
.period-status-badge { font-weight: 700; font-size: var(--text-sm); }
.period-status.closed .period-status-badge { color: var(--expense); }
.period-status-detail { grid-column: 1 / -1; grid-row: 2; margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.45; }
.period-status-actions { grid-column: 2; grid-row: 1; display: flex; gap: var(--space-2); }
@media (max-width: 700px) {
  .period-status { gap: var(--space-2); }
}
