/* ===========================
   DISCIPLINE — HABIT TRACKER
   =========================== */

:root {
  --bg:        #0a0a0a;
  --bg2:       #111111;
  --bg3:       #191919;
  --border:    #2a2a2a;
  --border2:   #333333;
  --text:      #e8e8e0;
  --text2:     #888880;
  --text3:     #555550;
  --accent:    #c8f135;
  --accent2:   #ff5533;
  --accent3:   #33ccff;
  --health:    #a8ff78;
  --mind:      #78c7ff;
  --focus:     #ffcc33;
  --finance:   #c8f135;
  --social:    #ff88bb;
  --sleep:     #aa88ff;
  --other:     #aaaaaa;
  --sidebar-w: 220px;
  --mob-nav-h: 64px;
  --radius:    8px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --font-body:    'DM Sans', sans-serif;
}

/* ===== LOGO STYLES ===== */
.logo-accent {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--accent);
  line-height: 1;
  display: inline-block;
  margin-right: 8px;
}
.logo-rest {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--accent);
  vertical-align: bottom;
}
.logo-accent-small { font-family: var(--font-display); font-size: 40px; color: var(--accent); margin-right:6px; vertical-align: middle; }
.logo-rest-small   { font-family: var(--font-display); font-size: 26px; color: var(--accent); vertical-align: middle; }

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ===== DESKTOP LAYOUT ===== */
body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  grid-column: 1;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  z-index: 10;
}

.sidebar-header {
  padding: 28px 20px 24px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--accent);
  line-height: 1;
}


.logo-icon {
  width: 72px;
  height: 72px;
  display: block;
}

/* Smaller icon variant for mobile header */
.logo-icon--small {
  width: 48px;
  height: 48px;
}

.sidebar-header > div {
  display: flex;
  align-items: center;
  gap: 12px;
}



.logo-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #000; font-weight: 600; }
.nav-btn.active .nav-icon { color: #000; }
.nav-icon { font-size: 12px; color: var(--text3); }

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.streak-badge { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.streak-num { font-family: var(--font-display); font-size: 40px; color: var(--accent2); line-height: 1; }
.streak-label { font-family: var(--font-mono); font-size: 10px; color: var(--text3); letter-spacing: 1px; }
.today-date { font-family: var(--font-mono); font-size: 10px; color: var(--text3); letter-spacing: 1px; }

/* ===== MOBILE TOP BAR ===== */
.mobile-top-bar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo-m {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--accent);
}

.mobile-streak { display: flex; align-items: center; gap: 4px; }
.mobile-streak { flex-shrink: 0; min-width: 54px; justify-content: flex-end; }
.mob-streak-num { font-family: var(--font-display); font-size: 30px; color: var(--accent2); line-height: 1; }
.mob-streak-label { font-size: 18px; }

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mob-nav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 20;
  flex-direction: row;
}

.mob-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mob-btn.active { color: var(--accent); }
.mob-icon { font-size: 18px; line-height: 1; }
.mob-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }

/* ===== MAIN ===== */
.main {
  grid-column: 2;
  padding: 40px 48px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }
#view-review {
  overflow-x: visible;
  padding-bottom: 160px;
}

@media (min-width: 769px) {
  #view-review {
    min-width: 1120px;
  }
  #view-review .review-insights,
  #view-review .review-chart {
    overflow-x: visible;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== VIEW HEADER ===== */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.view-title {
  font-family: var(--font-display);
  font-size: 48px;
  letter-spacing: 2px;
  line-height: 1;
  color: var(--text);
}

.view-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ===== PROGRESS RING ===== */
.progress-ring-wrap { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.progress-ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border2); stroke-width: 5; }
.ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(.4,0,.2,1);
}
.ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--accent);
}

/* ===== HABIT CARDS ===== */
.habits-list { display: flex; flex-direction: column; gap: 3px; }

.habit-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: stretch;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  min-height: 68px;
  -webkit-tap-highlight-color: transparent;
}

.habit-card:hover { border-color: var(--border2); transform: translateX(2px); }
.habit-card:active { transform: scale(0.99); }

.habit-card.done { border-color: transparent; background: var(--bg3); }
.habit-card.done .habit-name { color: var(--text3); text-decoration: line-through; }

.habit-check {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border-right: 1px solid var(--border);
  transition: background 0.2s; flex-shrink: 0;
}

.habit-check-icon { font-size: 20px; color: transparent; transition: color 0.2s; }
.habit-card.done .habit-check-icon { color: #000; }

.habit-info { padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.habit-name { font-size: 15px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.habit-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.habit-cat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.habit-time { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.habit-goal-tag {
  font-family: var(--font-mono); font-size: 9px; color: var(--text3);
  background: var(--bg); padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 160px;
}

.habit-streak-mini { padding: 0 16px; text-align: right; display: flex; flex-direction: column; justify-content: center; flex-shrink: 0; }
.habit-streak-num { font-family: var(--font-display); font-size: 24px; color: var(--text3); line-height: 1; }
.habit-streak-num.streak-on { color: var(--accent); }
.habit-streak-label { font-family: var(--font-mono); font-size: 8px; color: var(--text3); letter-spacing: 1px; }
.habit-streak-label .best-streak-on { color: var(--accent3); }
.habit-card.done .habit-streak-num { color: var(--accent2); }
.habit-history-btn {
  align-self: flex-end;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text3);
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.habit-history-btn:hover { border-color: var(--border2); color: var(--text); }
.habit-history-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.habit-history-cell.done { background: var(--accent); }
.habit-history-cell.missed { background: var(--border2); opacity: .9; }
.habit-history-cell.na { opacity: .18; }
.habit-note-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.habit-note-row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.habit-note-row span {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}
.habit-note-row strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
  font-weight: 500;
}
.missed-yesterday-panel {
  margin-top: 24px;
  padding-top: 8px;
}
.missed-yesterday-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid rgba(255,204,51,.22);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.missed-yesterday-header:hover { border-color: rgba(255,204,51,.42); }
.missed-yesterday-chevron {
  color: var(--text3);
  font-size: 11px;
}
.missed-yesterday-count {
  margin-left: auto;
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,204,51,.12);
  color: #ffcc33;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}
.yesterday-missed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.yesterday-missed-card {
  cursor: default;
  border-color: rgba(255,204,51,.22);
  background: rgba(255,204,51,.04);
}
.yesterday-done-btn {
  flex-shrink: 0;
  color: var(--accent);
  border-color: rgba(200,241,53,.28);
}
.yesterday-done-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== BANNER ===== */
.day-complete-banner {
  margin-top: 24px; padding: 20px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, #a0d020 100%);
  border-radius: var(--radius); color: #000; font-weight: 600; font-size: 15px;
  display: flex; align-items: center; gap: 12px;
  animation: popIn 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.banner-icon { font-size: 24px; }
.hidden { display: none !important; }

/* ===== GOALS VIEW ===== */
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.goal-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
}

.goal-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
}

.goal-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.goal-title { font-size: 16px; font-weight: 600; color: var(--text); flex: 1; }
.goal-category-tag {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--border);
  padding: 3px 7px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.goal-why { font-size: 12px; color: var(--text2); line-height: 1.6; }
.goal-notes { font-size: 12px; color: var(--text3); font-style: italic; line-height: 1.5; }

.goal-date {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent); letter-spacing: 1px;
  display: flex; align-items: center; gap: 5px;
}

.goal-date.overdue { color: var(--accent2); }

.goal-progress-bar { height: 3px; background: var(--border2); border-radius: 2px; overflow: hidden; margin-top: 2px; }
.goal-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; }
.goal-progress-label { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 4px; }

.goal-del-btn {
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; font-size: 13px; padding: 4px; border-radius: 4px; transition: all 0.15s;
  flex-shrink: 0;
}
.goal-del-btn:hover { color: var(--accent2); background: rgba(255,85,51,.1); }

.add-goal-card {
  border: 1px dashed var(--border2); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; cursor: pointer; color: var(--text3);
  font-size: 13px; gap: 8px; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.add-goal-card:hover { border-color: var(--accent); color: var(--accent); background: rgba(200,241,53,.04); }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 14px; }
.stat-num { font-family: var(--font-display); font-size: 42px; color: var(--accent); line-height: 1; }
.stat-label { font-family: var(--font-mono); font-size: 9px; color: var(--text3); letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }

.stats-section-title {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--text3); margin-bottom: 14px; margin-top: 24px;
}

.heatmap { display: flex; flex-direction: column; gap: 8px; }
.heatmap-row { display: flex; align-items: center; gap: 8px; }
.heatmap-label { font-family: var(--font-mono); font-size: 10px; color: var(--text3); width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.heatmap-cells { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.heatmap-cell { width: 18px; height: 18px; border-radius: 3px; background: var(--border); flex-shrink: 0; opacity: 0.9; }
.heatmap-cell[data-done="1"] { opacity: 1; box-shadow: 0 0 4px rgba(200,241,53,0.3); }
.heatmap-cell[data-na="1"] { background: transparent; opacity: 0.2; }

.workout-history-cell { width: 10px; height: 10px; border-radius: 2px; }
.workout-history-missed { background: var(--border2); }
.habit-history-cell.done {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 4px rgba(200,241,53,.35);
}
.habit-history-cell.missed {
  background: var(--border2);
  opacity: .9;
}
.habit-history-cell.na {
  background: rgba(255,255,255,.04);
  opacity: .35;
}
.habit-history-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
}
.habit-history-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.habit-history-key {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.habit-history-key.done { background: var(--accent); }
.habit-history-key.missed { background: var(--border2); }
.habit-history-key.na { background: rgba(255,255,255,.08); }
.habit-history-calendar {
  margin-top: 8px;
  max-width: 520px;
}
.habit-history-weekdays,
.habit-history-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.habit-history-weekday {
  min-width: 0;
  text-align: center;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.habit-history-days {
  margin-top: 8px;
}
.habit-history-day {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.habit-history-day.done {
  background: var(--accent);
  border-color: var(--accent);
  color: #050505;
  box-shadow: 0 0 10px rgba(200,241,53,.26);
}
.habit-history-day.missed {
  background: #383833;
  border-color: #4a4a43;
  color: var(--text);
}
.habit-history-day.na {
  opacity: .38;
}
.habit-history-day.today {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
#habitHistoryGrid .habit-history-cell[data-done="1"] {
  background: var(--accent) !important;
  opacity: 1 !important;
  box-shadow: 0 0 5px rgba(200,241,53,.45);
}
#habitHistoryGrid .habit-history-cell[data-missed="1"] {
  background: #3a3a36 !important;
  opacity: 1 !important;
}
#habitHistoryGrid .habit-history-cell[data-na="1"] {
  background: rgba(255,255,255,.035) !important;
  opacity: .45 !important;
}

.workout-name-link {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.workout-name-link:hover { color: var(--accent); }

.workout-history-mini { font-size: 10px; margin-top: 4px; }

.workout-history-modal { max-width: 820px; }
.workout-history-summary {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.workout-history-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
}
.workout-history-grid {
  display: grid;
  grid-template-columns: repeat(90, 10px);
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0 2px;
}

.review-summary-line {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.review-metric-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
}
.review-insights {
  display: flex;
  gap: 10px;
  margin: 16px 0 22px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.review-insight-card {
  flex: 0 0 220px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
}
.review-insight-label {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.review-insight-value {
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-insight-meta {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 4px;
}

.review-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding: 16px 0 8px;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.review-bar-item {
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.review-bar-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}
.review-bar-value .review-bar-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  font-weight: 700;
  margin-left: 4px;
}
.review-bar-value .bar-pct { color: var(--text3); }
.review-bar-item.today .bar-pct,
.review-bar-item.today .review-bar-label {
  color: var(--accent3);
}
.review-bar-track {
  width: 16px;
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.review-bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 999px 999px 0 0;
}
.review-bar-item.today .review-bar-track {
  border-color: rgba(51,204,255,.7);
  box-shadow: 0 0 0 2px rgba(51,204,255,.12);
}
.review-bar-item.today .review-bar-fill {
  background: var(--accent3);
}
.review-bar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
}

.review-table-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.review-table-wrap .review-table-head,
.review-table-wrap .review-table-row {
  min-width: 760px;
}

.review-finance {
  padding-bottom: 80px;
}

.review-finance,
.review-fin-grid,
.review-fin-list {
  max-width: 100%;
}

.review-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.review-table-head,
.review-table-row {
  display: grid;
  grid-template-columns: minmax(190px, .82fr) 48px 48px 48px minmax(150px, .72fr);
  gap: 8px;
  align-items: center;
}
.review-table-head.month,
.review-table-head.month + .review-table-row,
.review-table-head.month ~ .review-table-row {
  grid-template-columns: 260px 48px 48px 48px;
  max-width: 428px;
}
.review-table-wrap .review-table-head.month,
.review-table-wrap .review-table-head.month + .review-table-row,
.review-table-wrap .review-table-head.month ~ .review-table-row {
  min-width: 0;
}
.review-table-head {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 4px;
}
.review-table-row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.review-table-name {
  font-size: 14px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-table-name-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-table-name-action span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-table-name-action .habit-history-btn {
  flex-shrink: 0;
}
.review-table-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
}
.review-table-cells {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  align-items: center;
}
.review-sq-head {
  min-width: 28px;
  width: 32px;
  text-align: center;
  white-space: nowrap;
}
.review-sq-head .sq-wd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.review-day-square {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--border2);
  flex-shrink: 0;
}
.review-day-square.done { background: var(--accent); }
.review-day-square.missed { background: var(--border2); opacity: 0.95; }
.review-day-square.future { background: transparent; border: 1px solid var(--border2); opacity: 0.5; }
.review-day-square.na { background: transparent; opacity: 0.18; }

.review-finance { margin-top: 24px; }
.review-fin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.review-fin-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.review-fin-num {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
  color: var(--text);
}
.review-fin-label {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
}
.review-fin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-fin-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}
.review-fin-cat strong {
  color: var(--text);
  font-size: 12px;
}
.review-fin-empty {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ===== MANAGE TABS ===== */
.manage-tabs {
  display: flex; gap: 4px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px; margin-bottom: 24px;
  width: fit-content;
}

.manage-tab {
  padding: 9px 24px;
  background: transparent; border: none; border-radius: 6px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--text3); cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.manage-tab:hover { color: var(--text); background: var(--bg3); }
.manage-tab.active { background: var(--accent); color: #000; font-weight: 600; }

.manage-panel { display: none; }
.manage-panel.active { display: block; animation: fadeIn 0.2s ease; }

.manage-panel-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 20px; gap: 16px;
}

.manage-panel-title { font-family: var(--font-display); font-size: 36px; letter-spacing: 1px; color: var(--text); line-height: 1; }
.manage-panel-sub { font-family: var(--font-mono); font-size: 10px; color: var(--text3); letter-spacing: 2px; text-transform: uppercase; margin-top: 5px; }

/* ===== MANAGE LIST ===== */
.manage-list { display: flex; flex-direction: column; gap: 6px; }

.manage-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color 0.15s;
}
.manage-card:hover { border-color: var(--border2); }

.manage-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.manage-info { flex: 1; min-width: 0; }
.manage-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 2px; }

.manage-days { display: flex; gap: 3px; flex-shrink: 0; }
.day-chip {
  width: 20px; height: 20px; border-radius: 3px; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 8px; color: var(--text3);
}
.day-chip.on { background: var(--accent); color: #000; font-weight: 600; }

.manage-actions { display: flex; gap: 6px; flex-shrink: 0; }

.schedule-subgroup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.schedule-subgroup-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 2px 2px 0;
}

.schedule-card {
  cursor: grab;
}

.schedule-card:active {
  cursor: grabbing;
}

.schedule-card.drag-source {
  opacity: 0.55;
  border-color: var(--accent);
}

.schedule-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(200,241,53,0.18) inset;
}

.manage-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manage-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.manage-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.manage-section-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
}

/* manage goal card variant */
.manage-goal-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color 0.15s; position: relative; overflow: hidden;
}
.manage-goal-card:hover { border-color: var(--border2); }
.manage-goal-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}

.mgc-health::before  { background: var(--health); }
.mgc-mind::before    { background: var(--mind); }
.mgc-focus::before   { background: var(--focus); }
.mgc-finance::before { background: var(--finance); }
.mgc-social::before  { background: var(--social); }
.mgc-sleep::before   { background: var(--sleep); }
.mgc-other::before   { background: var(--other); }

.manage-goal-info { flex: 1; min-width: 0; }
.manage-goal-name { font-size: 14px; font-weight: 500; color: var(--text); }
.manage-goal-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.manage-goal-date { color: var(--accent); }
.manage-goal-date.overdue { color: var(--accent2); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent); color: #000; border: none;
  border-radius: var(--radius); padding: 11px 20px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent; color: var(--text2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 11px 20px;
  font-family: var(--font-body); font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }

.icon-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text3); padding: 7px 11px; cursor: pointer;
  font-size: 12px; transition: all 0.15s; white-space: nowrap;
  min-height: 36px;
}
.icon-btn:hover { border-color: var(--text2); color: var(--text); }
.icon-btn.del:hover { border-color: var(--accent2); color: var(--accent2); background: rgba(255,85,51,.08); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(4px); animation: overlayIn 0.15s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; width: 100%; max-width: 460px;
  animation: modalIn 0.2s cubic-bezier(.34,1.56,.64,1);
  max-height: 90vh; display: flex; flex-direction: column;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.94) translateY(8px); } to { opacity:1; transform:scale(1) translateY(0); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  overflow: visible;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1;
  margin: 0;
  display: block;
}
.modal-close {
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; font-size: 18px; padding: 6px 8px; border-radius: 4px; transition: all 0.15s;
  min-width: 36px; min-height: 36px;
}
.modal-close:hover { color: var(--text); background: var(--bg3); }

.modal-body {
  padding: 20px 24px; display: flex; flex-direction: column;
  gap: 18px; overflow-y: auto; flex: 1;
}
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

.workout-example-copy {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.6;
}

.workout-example-query {
  padding: 14px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.4px;
  word-break: break-word;
}

.field-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text3); display: block; margin-bottom: 8px;
  white-space: normal; line-height: 1.4; word-break: break-word; max-width: 100%;
  overflow: visible; padding-top: 2px;
}
.field-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); padding: 11px 12px;
  font-family: var(--font-body); font-size: 16px; outline: none;
  transition: border-color 0.15s; appearance: none; resize: vertical;
}
.field-input:focus { border-color: var(--accent); }
.field-input option { background: var(--bg2); }

.entry-category-row { display: flex; align-items: center; gap: 8px; }
.entry-cat-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.entry-cat-toggle:hover,
.entry-cat-toggle:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.entry-cat-quickpick {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.entry-cat-chip {
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  border-radius: 999px;
  padding: 7px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.entry-cat-chip:hover,
.entry-cat-chip.active {
  border-color: var(--accent);
  color: var(--accent);
}
.entry-cat-empty {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-btn {
  width: 36px; height: 36px; border: 1px solid var(--border2);
  border-radius: 6px; background: var(--bg3); color: var(--text3);
  font-family: var(--font-mono); font-size: 11px; cursor: pointer;
  transition: all 0.15s; min-width: 36px;
}
.day-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text3); font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 1px; line-height: 2;
}
.empty-icon { font-size: 36px; margin-bottom: 12px; }

/* Make textareas and larger multi-line fields more roomy */
textarea.field-input, .modal-body textarea.field-input, textarea#goalWhy, textarea#goalNotes {
  min-height: 96px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.4;
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
    padding-top: 52px;
    padding-bottom: 0;
    overflow: hidden;
  }

  html, body { overflow-x: hidden; }
  #view-review {
    min-width: 0;
    overflow-x: hidden;
    padding-bottom: 96px;
  }
  #view-review .review-chart,
  #view-review .review-insights,
  #view-review .review-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  #view-review .review-chart {
    display: flex;
    margin-top: 14px;
    padding: 12px 0 6px;
  }
  #view-review .review-bar-item {
    min-width: 54px;
  }
  #view-review .review-bar-track {
    height: 96px;
  }
  #view-review .review-insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #view-review .review-insight-card {
    flex: none;
  }

  .sidebar { display: none; }
  .mobile-top-bar { display: flex; }
  .mobile-bottom-nav { display: flex; }

  .main {
    grid-column: 1;
    margin-left: 0;
    height: calc(100vh - 52px - var(--mob-nav-h));
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 14px calc(140px + env(safe-area-inset-bottom));
  }

  #view-manage {
    padding-bottom: 24px;
  }

  .view-title { font-size: 36px; }
  .view-header { flex-wrap: wrap; }

  .entry-cat-toggle { display: none; }

  .manage-tabs { width: 100%; }
  .manage-tab { flex: 1; text-align: center; padding: 10px 8px; font-size: 12px; }

  .manage-card { flex-wrap: wrap; gap: 10px; }
  .manage-days { order: 3; width: 100%; }
  .manage-actions { margin-left: auto; }

  .manage-panel-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .manage-panel-title { font-size: 28px; }

  .goals-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .heatmap-label { width: 80px; font-size: 9px; }
  .heatmap-cell { width: 14px; height: 14px; }
  .review-table-head,
  .review-table-row {
    grid-template-columns: minmax(0, 1fr) 34px 34px 40px minmax(76px, .5fr);
    gap: 4px;
    min-width: 0;
  }
  .review-table-head.month,
  .review-table-head.month + .review-table-row,
  .review-table-head.month ~ .review-table-row {
    grid-template-columns: minmax(0, 1fr) 34px 34px 40px;
    max-width: 100%;
    min-width: 0;
  }
  .review-table-wrap .review-table-head,
  .review-table-wrap .review-table-row {
    min-width: 0;
  }
  .review-table-head {
    font-size: 9px;
    letter-spacing: 2px;
    padding: 0;
  }
  .review-table-name {
    font-size: 13px;
  }
  .review-table-name-action {
    gap: 4px;
  }
  .review-table-name-action .habit-history-btn {
    width: 24px;
    height: 24px;
    margin-left: 0;
  }
  .review-table-num {
    font-size: 11px;
  }
  .review-fin-grid { grid-template-columns: 1fr; }
  .review-bar-track { height: 96px; }

  .modal { max-height: 85vh; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  .habit-card { min-height: 64px; }
  .habit-streak-mini { padding: 0 12px; }
  .habit-info { padding: 12px; }
}

/* ===== GOALS SECTION LABELS ===== */
.goals-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.goals-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Goal type badge */
.goal-type-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.goal-type-badge.longterm  { background: rgba(51,204,255,.15); color: var(--accent3); border: 1px solid rgba(51,204,255,.3); }
.goal-type-badge.shortterm { background: rgba(200,241,53,.12); color: var(--accent);  border: 1px solid rgba(200,241,53,.3); }

/* ===== FINANCE VIEW ===== */
.fin-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fin-action-buttons { justify-content: flex-end; }
.fin-quick-add-wrap { position: relative; display: inline-flex; }
.fin-quick-add-btn { min-width: 46px; padding: 11px 0; font-size: 20px; line-height: 1; }
.fin-quick-add-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  min-width: 200px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(18,18,18,.98);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
}
.fin-quick-add-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.fin-quick-add-item + .fin-quick-add-item { margin-top: 8px; }
.fin-quick-add-item:hover { border-color: var(--accent); color: var(--accent); }
.fin-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fin-filter-label {
  color: var(--text3);
  font-size: 13px;
  white-space: nowrap;
}
.fin-filter-select,
.fin-filter-input {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 0 12px;
  outline: none;
}
.fin-filter-select { min-width: 120px; }
.fin-filter-input { min-width: 140px; }
.fin-filter-input-day { min-width: 150px; }
.fin-filter-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fin-step-btn {
  padding: 8px 10px;
  min-width: 40px;
}
.fin-filter-select:focus,
.fin-filter-input:focus {
  border-color: rgba(200,241,53,.55);
  box-shadow: 0 0 0 3px rgba(200,241,53,.08);
}
.money-input {
  font-variant-numeric: tabular-nums;
}

/* Balance cards */
.fin-balance-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.fin-bal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
}
.fin-bal-remain { border-color: var(--border2); }

.fin-bal-num {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 1px;
}
.fin-bal-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Budget bar */
.fin-bar-wrap {
  grid-column: 1 / -1;
  padding: 4px 0 2px;
}
.fin-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
.fin-bar-spent { background: var(--accent2); height: 100%; transition: width 0.5s ease; }
.fin-bar-saved { background: var(--sleep);   height: 100%; transition: width 0.5s ease; }
.fin-bar-legend {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}

/* Entry groups */
.fin-group { margin-bottom: 6px; }
.fin-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg3);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}
.fin-group-name  { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; color: var(--text2); text-transform: uppercase; }
.fin-group-total { font-family: var(--font-display); font-size: 18px; color: var(--text); }

.fin-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: none;
  gap: 12px;
}
.fin-entry:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.fin-entry-info { flex: 1; min-width: 0; }
.fin-entry-note { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-entry-date { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 2px; }
.fin-entry-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.fin-entry-amount { font-family: var(--font-display); font-size: 20px; color: var(--text); }
.fin-entry-action-btn {
  border: 1px solid rgba(51,204,255,.22);
  background: transparent;
  color: var(--accent3);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
}
.fin-entry-action-btn:hover {
  border-color: var(--accent3);
  color: var(--accent3);
}
.fin-del-btn {
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 4px;
  transition: all 0.15s; min-width: 28px; min-height: 28px;
}
.fin-del-btn:hover { color: var(--accent2); background: rgba(255,85,51,.1); }

/* Overview */
.fin-overview-row {
  display: grid;
  grid-template-columns: 130px 1fr 120px;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.fin-ov-label { font-family: var(--font-mono); font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-ov-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.fin-ov-bar { height: 100%; background: var(--accent2); border-radius: 4px; transition: width 0.5s ease; }
.fin-ov-val { font-family: var(--font-mono); font-size: 11px; color: var(--text); text-align: right; }

/* Income rows */
.fin-income-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 6px;
}
.fin-inc-label  { font-size: 14px; font-weight: 500; color: var(--text); }
.fin-inc-period { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.fin-inc-amount { font-family: var(--font-display); font-size: 22px; color: var(--accent3); }

/* Bills */
.fin-bill-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.fin-bill-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.fin-bill-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fin-bill-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
}
.fin-bill-row.paid { border-color: rgba(200,241,53,.26); background: rgba(200,241,53,.04); }
.fin-bill-row.partial { border-color: rgba(255,204,51,.24); background: rgba(255,204,51,.04); }
.fin-bill-row.overdue { border-color: rgba(255,85,51,.22); background: rgba(255,85,51,.04); }
.fin-bill-main { flex: 1; min-width: 0; }
.fin-bill-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.fin-bill-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}
.fin-bill-meta span { white-space: nowrap; }
.fin-bill-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.fin-bill-chip.upcoming,
.fin-bill-chip.soon,
.fin-bill-chip.due { background: rgba(51,204,255,.1); color: var(--accent3); border-color: rgba(51,204,255,.2); }
.fin-bill-chip.overdue { background: rgba(255,85,51,.12); color: var(--accent2); border-color: rgba(255,85,51,.24); }
.fin-bill-chip.partial { background: rgba(255,204,51,.12); color: #ffcc33; border-color: rgba(255,204,51,.24); }
.fin-bill-chip.paid { background: rgba(200,241,53,.14); color: var(--accent); border-color: rgba(200,241,53,.24); }
.fin-bill-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fin-bill-amount {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  min-width: 92px;
  text-align: right;
}
.fin-bill-amount-sub {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.bill-pay-btn.paid { border-color: rgba(200,241,53,.3); color: var(--accent); }
.bill-pay-btn.paid:hover { border-color: var(--accent); color: var(--accent); }
.bill-payment-summary {
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 14px;
}
.bill-payment-quick,
.bill-payment-source {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 18px;
}
.bill-payment-quick .btn-ghost {
  padding: 8px 12px;
  font-size: 12px;
}
.bill-payment-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.bill-payment-choice input { accent-color: var(--accent); }
.bill-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bill-history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bill-history-amount {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
}
.bill-history-meta {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 2px;
}
.bill-history-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== FINANCE MOBILE ===== */
@media (max-width: 768px) {
  .review-insights,
  .habit-history-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-balance-row { grid-template-columns: repeat(2, 1fr); }
  .fin-bar-wrap { grid-column: 1 / -1; }
  .fin-overview-row { grid-template-columns: 80px 1fr 80px; }
  .fin-bal-num { font-size: 22px; }
  .fin-header-actions { gap: 6px; }
  .fin-filter-row { width: 100%; }
  .fin-filter-select,
  .fin-filter-input,
  .fin-filter-input-day { min-width: 0; width: 100%; }
  .fin-filter-stepper { width: 100%; }
  .fin-step-btn { flex: 0 0 auto; }
  .fin-action-buttons { width: 100%; justify-content: flex-start; }
  .fin-header-actions .btn-primary,
  .fin-header-actions .btn-ghost { padding: 9px 12px; font-size: 12px; }
  .fin-quick-add-menu { min-width: 220px; }
  .fin-bill-summary { grid-template-columns: 1fr; }
  .fin-bill-row { flex-direction: column; }
  .fin-bill-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .fin-bill-amount { min-width: 0; text-align: left; margin-right: auto; }
}

/* ===== ONBOARDING GUIDE ===== */
.onboarding-guide {
  background: linear-gradient(135deg, rgba(200,241,53,.07) 0%, rgba(200,241,53,.02) 100%);
  border: 1px solid rgba(200,241,53,.25);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease;
}
@keyframes guideOut { to { opacity:0; transform:translateY(-8px); } }

.guide-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.guide-icon {
  font-size: 24px; color: var(--accent); flex-shrink: 0;
  width: 40px; height: 40px; background: rgba(200,241,53,.12);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.guide-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; color: var(--text); line-height: 1; }
.guide-sub   { font-family: var(--font-mono); font-size: 9px; color: var(--text3); letter-spacing: 2px; text-transform: uppercase; margin-top: 3px; }
.guide-dismiss {
  margin-left: auto; flex-shrink: 0;
  background: var(--accent); color: #000; border: none; border-radius: 6px;
  padding: 8px 14px; font-family: var(--font-body); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s; white-space: nowrap;
}
.guide-dismiss:hover { opacity: 0.85; }

.guide-steps { display: flex; flex-direction: column; gap: 9px; }
.guide-step  { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text2); line-height: 1.5; }
.guide-step-num {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: rgba(200,241,53,.18); color: var(--accent);
  width: 20px; height: 20px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}

/* ===== COMPLETED GOAL CARD ===== */
.goal-card-done { opacity: 0.65; }
.goal-card-done .goal-title { text-decoration: line-through; color: var(--text2); }

/* ===== FINANCE SAVING GOALS STRIP ===== */
.fin-saving-goals {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 4px;
}
.fin-sg-card {
  background: rgba(200,241,53,.05);
  border: 1px solid rgba(200,241,53,.18);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.fin-sg-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fin-sg-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-sg-amounts { font-family: var(--font-mono); font-size: 11px; color: var(--accent); flex-shrink: 0; }
.fin-sg-pct { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 4px; }

@media (max-width: 768px) {
  .guide-header { flex-wrap: wrap; gap: 10px; }
  .guide-dismiss { margin-left: 0; }
  .onboarding-guide { padding: 14px 14px; }
}

/* ===== SAVING GOAL BUCKETS ===== */
.fin-goal-bucket {
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(200,241,53,.2);
}

.fin-general-bucket {
  border-color: var(--border);
  margin-top: 8px;
}

.fin-goal-bucket-header {
  background: rgba(200,241,53,.07);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(200,241,53,.15);
}

.fin-general-bucket .fin-goal-bucket-header {
  background: var(--bg3);
  border-bottom-color: var(--border);
}

.fin-goal-bucket-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fin-goal-bucket-icon { font-size: 16px; flex-shrink: 0; }

.fin-goal-bucket-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-goal-bucket-total {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--sleep);
  flex-shrink: 0;
}

.fin-general-bucket .fin-goal-bucket-total { color: var(--text2); }

.fin-goal-bucket-progress { margin-top: 8px; }

.fin-goal-bucket-bar {
  height: 5px;
  background: rgba(255,255,255,.08);
  border-radius: 3px;
  overflow: hidden;
}

.fin-goal-bucket-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.fin-goal-bucket-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  margin-top: 4px;
}

/* entries inside a bucket inherit fin-entry styles but no rounded corners */
.fin-goal-bucket .fin-entry { border: none; border-top: 1px solid var(--border); border-radius: 0; background: var(--bg2); }
.fin-goal-bucket .fin-entry:last-child { border-radius: 0; }

/* ===== FINANCE NEW ELEMENTS ===== */
.fin-bar-goal { background: var(--accent); height: 100%; transition: width 0.5s ease; }

.fin-bal-sublabel {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  margin-top: 2px;
}

.fin-bucket-chevron {
  font-size: 10px;
  color: var(--text3);
  flex-shrink: 0;
  width: 14px;
}

.fin-bucket-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(200,241,53,.04);
  border-top: 1px solid rgba(200,241,53,.12);
  font-size: 12px;
  font-family: var(--font-mono);
}

.fin-goal-bucket-header {
  user-select: none;
}

/* ===== HEATMAP MOBILE FIX ===== */
.heatmap-cells { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 2px; }

/* ===== STREAK BEST BADGE ===== */
.streak-best {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1px;
  margin-top: -4px;
  margin-bottom: 6px;
}

/* ===== STAT CARD BEST ===== */
.stat-best {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1px;
  margin-top: 3px;
}

/* ===== PER-HABIT STREAK ROWS ===== */
#habitStreakList { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.streak-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.streak-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.streak-row-name { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.streak-row-stats { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.streak-cur {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.streak-unit { font-family: var(--font-mono); font-size: 9px; color: var(--text3); }

.streak-best-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent2);
  background: rgba(255,85,51,.1);
  border: 1px solid rgba(255,85,51,.25);
  padding: 2px 6px;
  border-radius: 4px;
}

.streak-date-ctx {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent3);
  background: rgba(51,204,255,.08);
  border: 1px solid rgba(51,204,255,.2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ===== DATA SECTION (import/export) ===== */
.data-section-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--text);
  margin-bottom: 6px;
}

.data-section-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.data-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.data-import-label {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 11px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-block;
}
.data-import-label:hover { color: var(--text); border-color: var(--text3); }

.import-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
}
.import-ok  { background: rgba(200,241,53,.1); color: var(--accent); border: 1px solid rgba(200,241,53,.25); }
.import-err { background: rgba(255,85,51,.1);  color: var(--accent2); border: 1px solid rgba(255,85,51,.25); }

@media (max-width: 768px) {
  .streak-row-name { font-size: 12px; }
  .data-actions { flex-direction: column; align-items: stretch; }
  .data-import-label { text-align: center; }
}

/* ===== WORKOUT STYLES ===== */
.workouts-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.workouts-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

.workouts-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
}

.workout-list { display: none; border-top: 1px solid var(--border); }
.workout-list.show { display: block; }

.today-focus-group { border-top: 1px solid var(--border); }
.today-focus-group:first-child { border-top: none; }

.today-focus-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.today-focus-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.today-focus-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  white-space: nowrap;
}

.today-focus-list { display: none; border-top: 1px solid var(--border); }
.today-focus-list.show { display: block; }

.workout-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.workout-item:last-child { border-bottom: none; }

.workout-item { position: relative; }

.wi-left { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }

.workout-body {
  flex: 1;
  min-width: 0;
}

.workout-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workout-note-inline {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  color: var(--text3);
  word-break: break-word;
}

.workout-lookup-btn {
  padding: 6px 10px;
  min-height: 30px;
  font-size: 11px;
  flex-shrink: 0;
}

.workout-check {
  width: 28px; height: 28px;
  border: 2px solid var(--border2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  font-size: 14px; color: transparent;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.workout-check:hover { border-color: var(--accent); }
.workout-check.done { background: var(--health); border-color: var(--health); color: #000; }

.workout-name { font-size: 14px; font-weight: 500; color: var(--text); }
.workout-days { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: 2px; }

@media (max-width: 720px) {
  .workout-item { flex-wrap: wrap; }
  .workout-top-row {
    align-items: center;
  }
  .workout-note-inline { color: var(--text3); font-size: 11px; }
}

/* Keep the workout card content aligned without overlaying lower details */
.workout-list .workout-item { position: relative !important; }

.workout-focus-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.workout-focus-chip {
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.workout-focus-chip:hover {
  border-color: var(--accent);
  background: rgba(200,241,53,0.1);
  color: var(--accent);
}

/* ===== MANAGE BACKUP ROW ===== */
.manage-backup-row,
.manage-reminder-row {
  margin-top: 32px;
  padding: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.manage-reminder-row { margin-top: 12px; }

.manage-backup-copy {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.4;
}
.manage-reminder-status {
  margin-top: 4px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.manage-backup-actions { display: flex; gap: 8px; flex-shrink: 0; }
.manage-reminder-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.reminder-time-input { min-width: 130px; }

@media (max-width: 768px) {
  .manage-backup-row,
  .manage-reminder-row { flex-direction: column; align-items: flex-start; }
  .manage-backup-actions,
  .manage-reminder-actions { width: 100%; }
  .manage-backup-actions .btn-primary,
  .manage-backup-actions .btn-ghost,
  .manage-reminder-actions .btn-primary,
  .manage-reminder-actions .btn-ghost { flex: 1; text-align: center; }
  .reminder-time-input { width: 100%; }
}
