/* ── Looking Forward ─────────────────────────────────────── */
.forward-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 28px;
}
/* Holds the controls + estimates so they can collapse as one unit on mobile.
   The 18px gap used to come from .forward-card's own gap, which now sits
   between the (mobile-only) toggle and this panel. */
.forward-assumptions { display: flex; flex-direction: column; gap: 18px; }
.forward-assumptions-toggle { display: none; }
.forward-controls { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.forward-maxcash { display: flex; flex-direction: column; gap: 8px; }
.forward-timeframe { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.forward-timeframe-row { display: flex; align-items: center; gap: 12px; }
.forward-slider {
  flex: 1;
  max-width: 220px;
  accent-color: var(--accent);
  cursor: pointer;
}
.forward-timeframe-val {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  min-width: 56px;
}
.forward-maxcash-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.forward-maxcash-field {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  max-width: 200px;
}
.forward-maxcash-field:focus-within { border-color: var(--accent-border); }
.forward-maxcash-prefix { font-family: var(--font-mono); color: var(--text-dim); }
.forward-maxcash-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}
.forward-maxcash-hint { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--muted); }
.forward-estimates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 32px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
@media (max-width: 1000px) { .forward-estimates { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* No 1-column rule below this: the mobile block at the end of this section
   deliberately keeps two columns, to halve the panel's height. */
.forward-estimate { display: flex; flex-direction: column; gap: 2px; }
.forward-estimate-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.forward-estimate-note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  font-size: var(--text-sm);
}
.forward-estimate-value-wrap { display: flex; align-items: baseline; gap: 1px; }
.forward-estimate-prefix,
.forward-estimate-input {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: inherit;
}
.forward-estimate-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  outline: none;
  padding: 0;
}
.forward-estimate-input:hover  { border-bottom-color: var(--border); }
.forward-estimate-input:focus  { border-bottom-color: var(--accent); }
.forward-estimate-input::-webkit-outer-spin-button,
.forward-estimate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.forward-estimate-input[type=number] { -moz-appearance: textfield; }
.forward-val--pos    { color: var(--green); }
.forward-val--neg    { color: var(--red); }
.forward-val--accent { color: var(--accent-text); }
.forward-estimate-sub { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--muted); }

.forward-projection {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 32px 16px;
}
.forward-projection-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.forward-projection-title {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.forward-projection-end {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.forward-projection-chart { position: relative; height: 460px; }

/* ── Looking Forward, mobile ─────────────────────────────────
   Four sliders at min-width 240px each take a row apiece, and the four
   estimate fields stack below them — together about 700px before the chart
   even starts, so the projection was entirely below the fold. Collapse the
   assumptions behind a toggle so the chart is what you land on, and tighten
   what's inside for when it's open. */
@media (max-width: 768px) {
  .forward-assumptions-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  /* Collapsed, the toggle carries the two assumptions most worth seeing at a
     glance, so a shut panel isn't opaque. */
  .forward-assumptions-summary {
    margin-left: auto;
    font-family: var(--font-mono);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
  }
  .forward-assumptions-chevron { transition: transform 0.2s; line-height: 1; }
  .forward-card.assumptions-open .forward-assumptions-chevron { transform: rotate(180deg); }

  .forward-assumptions { display: none; }
  .forward-card.assumptions-open .forward-assumptions { display: flex; }

  .forward-card { padding: 14px 16px; gap: 14px; }

  /* Two compact columns rather than four full-width stacks. */
  .forward-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .forward-maxcash, .forward-timeframe { min-width: 0; gap: 4px; }
  .forward-maxcash-field { max-width: none; padding: 6px 10px; }
  .forward-timeframe-row { gap: 8px; }
  .forward-slider { max-width: none; }
  .forward-timeframe-val { min-width: 0; font-size: var(--text-sm); }
  /* The hints restate their labels — not worth a line each at this width. */
  .forward-maxcash-hint { display: none; }

  .forward-estimates { gap: 12px 16px; padding-top: 12px; }
  .forward-estimate-prefix, .forward-estimate-input { font-size: var(--text-lg); }
  /* Parentheticals like "comes out of your income" wrap to three lines in a
     half-width column and push everything down. */
  .forward-estimate-note { display: none; }

  .forward-projection { padding: 14px 16px 12px; }
  .forward-projection-header { flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 12px; }
  .forward-projection-chart { height: 300px; }
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 300;
  color: var(--text-bright);
  font-style: italic;
}

#overviewGreeting, #investmentsTitle, #accountsTitle, #transactionsTitle, #settingsTitle, #forwardTitle,
[data-custom-page] .page-title {
  font-style: normal;
  font-weight: 500;
  font-size: var(--text-4xl);
  letter-spacing: -0.01em;
}

.page-date { color: var(--muted); font-size: var(--text-caption); }

.page-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
}

.page-header-right select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  padding: 4px 8px;
  cursor: pointer;
}

/* ── Cards & stat grid ───────────────────────────────────── */
.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.stat-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover::before { opacity: 1; }
.stat-card.clickable { cursor: pointer; }
.stat-edit-pencil {
  position: absolute;
  bottom: 10px;
  right: 12px;
  opacity: 0;
  color: var(--accent);
  transition: opacity 0.2s;
  font-size: 22px;
}
.stat-card:hover .stat-edit-pencil { opacity: 1; }

.stat-label {
  color: var(--text-dim);
  font-size: var(--text-caption);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

.stat-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-caption);
}

/* ── Stat card drag ──────────────────────────────────────── */
.stat-label.drag-target { cursor: grab; }
.stat-card .drag-handle {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  color: var(--muted);
  cursor: grab;
  font-size: var(--text-base);
  transition: opacity 0.15s;
}
.stat-card:hover .drag-handle { opacity: 1; }
.stat-card--ghost  { opacity: 0.4; border: 1px dashed var(--border) !important; }
.stat-card--chosen { box-shadow: 0 0 0 2px var(--accent); }

/* ── Overview zero state ─────────────────────────────────── */
.overview-setup {
  border: 1px solid var(--accent-border);
  background: var(--surface);
  padding: 28px 32px;
  margin-bottom: 32px;
  animation: fadeIn 0.3s ease;
}

.setup-prompt {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-caption);
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.setup-desc {
  color: var(--text);
  font-size: var(--text-md);
  line-height: 1.55;
  margin: 0 0 20px;
  max-width: 520px;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 24px;
}

.setup-step {
  display: flex;
  gap: 14px;
  align-items: baseline;
}

.setup-step-num {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--accent);
  flex-shrink: 0;
  min-width: 20px;
  letter-spacing: 0.05em;
}

.setup-step-text {
  font-size: var(--text-base);
  color: var(--text-dim);
}

.setup-cta {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.setup-cta:hover { background: var(--accent-dim); }

/* ── Mobile widget edit mode ──────────────────────────────── */
@keyframes widgetWobble {
  0%, 100% { rotate: 0deg; }
  25%       { rotate: -0.7deg; }
  75%       { rotate: 0.7deg; }
}

.widget-grid.edit-mode [data-widget] {
  animation: widgetWobble 0.22s ease-in-out infinite;
}

/* Stop wobble while actively dragging so transform: translate3d has no competition */
.widget-grid.edit-mode [data-widget].chart-card--chosen {
  animation: none;
}

#widgetEditDoneBtn {
  display: none !important;
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 11px 40px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 500;
  white-space: nowrap;
  box-shadow: 0 4px 20px var(--shadow-color);
}

/* ── Accounts empty state extras ─────────────────────────── */
.accounts-empty { padding: 52px 20px; }

.accounts-empty-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.setup-cta--secondary {
  border-color: var(--border);
  color: var(--text-dim);
}

.setup-cta--secondary:hover {
  border-color: var(--muted);
  color: var(--text);
  background: transparent;
}

.accounts-empty-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.accounts-empty-types span {
  font-size: var(--text-caption);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  letter-spacing: 0.04em;
}
