/* AirFit Finance Owner Dashboard — dark theme */

:root {
  --bg:        #0f0f23;
  --card:      #1a1a2e;
  --card2:     #16213e;
  --accent:    #e94560;
  --accent2:   #533483;
  --green:     #4ade80;
  --red:       #f87171;
  --blue:      #60a5fa;
  --yellow:    #fbbf24;
  --text:      #e8e8e8;
  --muted:     #888;
  --border:    #2a2a4a;
  --radius:    12px;
  --radius-sm: 8px;
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  padding-bottom: 32px;
}

/* ---- Period tabs ---- */
.period-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.period-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.period-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---- Sections ---- */
.section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 4px;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

.card-row {
  display: flex;
  gap: 10px;
}

.card-row .card { flex: 1; }

.card-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.card-delta {
  font-size: 0.78rem;
  margin-top: 4px;
}

.delta-pos { color: var(--green); }
.delta-neg { color: var(--red); }
.delta-neu { color: var(--muted); }

/* ---- Savings rate big number ---- */
.savings-big {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

/* ---- FIRE progress ---- */
.fire-track { margin-bottom: 14px; }
.fire-track:last-child { margin-bottom: 0; }

.fire-track-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.fire-track-label { font-size: 0.85rem; font-weight: 600; }
.fire-track-pct   { font-size: 1.1rem;  font-weight: 700; color: var(--accent); }

.progress-bar-bg {
  height: 10px;
  background: var(--card2);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 5px;
  transition: width 0.4s ease;
}

.fire-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.fire-meta span b { color: var(--text); }

/* ---- Balances ---- */
.balance-rows { display: flex; flex-direction: column; gap: 8px; }

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.balance-row .bal-type { color: var(--muted); text-transform: capitalize; }
.balance-row .bal-val  { font-weight: 600; }

.balance-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 700;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

/* ---- Family buckets ---- */
.bucket-rows { display: flex; flex-direction: column; gap: 8px; }

.bucket-row { display: flex; flex-direction: column; gap: 4px; }

.bucket-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.bucket-name { color: var(--text); }
.bucket-val  { font-weight: 600; }

.bucket-bar-bg {
  height: 6px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
}

.bucket-bar-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 3px;
}

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

.chart-wrap-sm { height: 170px; }

.svg-chart {
  width: 100%;
  height: 100%;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chart-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-leg-line {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
}

/* ---- ListOk placeholder ---- */
.listok-placeholder {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

.listok-placeholder .listok-icon { font-size: 2rem; margin-bottom: 8px; }
.listok-placeholder .listok-label { font-size: 0.95rem; color: var(--text); margin-bottom: 4px; }
.listok-placeholder .listok-desc  { font-size: 0.8rem; }

/* ---- Refresh button ---- */
.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}

.refresh-btn:hover { background: var(--card); }
.refresh-btn.loading { opacity: 0.6; pointer-events: none; }

/* ---- Status bar ---- */
.status-bar {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 8px 16px 0;
}

/* ---- Error state ---- */
.error-card {
  background: #2a1010;
  border: 1px solid #5a2020;
  border-radius: var(--radius);
  padding: 16px;
  color: var(--red);
  font-size: 0.88rem;
  text-align: center;
}

/* ---- Loading skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

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

.sk-line { height: 16px; margin-bottom: 8px; }
.sk-card { height: 80px; }

/* ---- CPI note ---- */
.cpi-note {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

/* ---- Separator ---- */
.sep { height: 1px; background: var(--border); margin: 0 16px; }
