/* ── Stark OS — Iron Man Steel & Ember ─────────────────────────────────────── */

:root {
  --bg:            #111214;
  --surface:       #16171b;
  --surface-2:     #1c1d23;
  --border:        #2a2a30;
  --border-bright: #3a3a44;

  --ember:   #fb923c;   /* primary accent — orange */
  --cyan:    #00cfff;   /* secondary — arc reactor */
  --crimson: #dc2626;   /* alerts / danger */
  --gold:    #f59e0b;   /* financial metrics */

  --text:      #e8e8ec;
  --text-muted: #7a7a8a;
  --text-dim:   #4a4a58;

  --radius:  6px;
  --radius-lg: 10px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  height: 52px;
  background: rgba(17, 18, 20, 0.92);
  border-bottom: 0.5px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* Arc reactor SVG icon */
.arc-reactor {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.topbar-subtitle {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: auto;
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* ── Navigation tabs ───────────────────────────────────────────────────────── */
.nav {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
}

.nav-tab {
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.nav-tab:hover { color: var(--text); }

.nav-tab.active {
  color: var(--ember);
  border-bottom-color: var(--ember);
}

/* ── Main layout ───────────────────────────────────────────────────────────── */
.main {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.section { display: none; }
.section.active { display: block; }

/* ── Section label ─────────────────────────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.section-label span {
  color: var(--ember);
  margin-right: 8px;
}

/* ── Grid layouts ──────────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.col-span-2 { grid-column: span 2; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
}

/* ── Base card ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.card-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Featured card — Iron Man corner brackets ──────────────────────────────── */
.card-featured {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
}

.card-featured::before,
.card-featured::after,
.card-featured .corner-br,
.card-featured .corner-bl {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--ember);
  border-style: solid;
  opacity: 0.7;
}

.card-featured::before {
  top: -0.5px; left: -0.5px;
  border-width: 2px 0 0 2px;
  border-radius: var(--radius-lg) 0 0 0;
}

.card-featured::after {
  top: -0.5px; right: -0.5px;
  border-width: 2px 2px 0 0;
  border-radius: 0 var(--radius-lg) 0 0;
}

.card-featured .corner-br {
  bottom: -0.5px; right: -0.5px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 var(--radius-lg) 0;
}

.card-featured .corner-bl {
  bottom: -0.5px; left: -0.5px;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 var(--radius-lg);
}

.card-featured .card-title {
  color: var(--ember);
  opacity: 0.9;
}

/* ── Stat block ────────────────────────────────────────────────────────────── */
.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.stat-value.gold { color: var(--gold); }
.stat-value.cyan { color: var(--cyan); }
.stat-value.ember { color: var(--ember); }
.stat-value.crimson { color: var(--crimson); }

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

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--ember);
  transition: width 0.4s ease;
}

.progress-fill.cyan   { background: var(--cyan); }
.progress-fill.gold   { background: var(--gold); }
.progress-fill.crimson { background: var(--crimson); }

/* ── Checklist / task item ─────────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s;
}

.task-item:last-child { border-bottom: none; }

.task-item.done { opacity: 0.4; }
.task-item.done .task-title { text-decoration: line-through; }

.task-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1.5px solid var(--border-bright);
  border-radius: 3px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.task-item.done .task-checkbox {
  background: var(--ember);
  border-color: var(--ember);
}

.task-checkbox-inner {
  width: 8px;
  height: 8px;
  display: none;
}

.task-item.done .task-checkbox-inner { display: block; }

.task-title {
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

.task-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Habit grid ────────────────────────────────────────────────────────────── */
.habit-row {
  display: grid;
  grid-template-columns: 160px repeat(7, 32px);
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--border);
}

.habit-row:last-child { border-bottom: none; }

.habit-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}

.habit-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.habit-cell {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 0.5px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
  background: var(--surface-2);
}

.habit-cell:hover { border-color: var(--border-bright); }

.habit-cell.done {
  background: var(--ember);
  border-color: var(--ember);
  color: #fff;
}

.habit-day-header {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  padding: 0 0 4px;
}

.habit-day-header.today { color: var(--ember); }

.habit-score {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* ── Finance card ──────────────────────────────────────────────────────────── */
.finance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}

.finance-row:last-child { border-bottom: none; }

.finance-account-name {
  font-size: 13px;
  color: var(--text);
}

.finance-account-type {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.finance-amount {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

.finance-amount.debt { color: var(--crimson); }
.finance-amount.savings { color: var(--cyan); }

/* ── Quarterly goal item ───────────────────────────────────────────────────── */
.goal-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
}

.goal-item:last-child { border-bottom: none; }

.goal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ember);
  flex-shrink: 0;
  margin-top: 6px;
}

.goal-item.done .goal-dot { background: var(--text-dim); }
.goal-item.done .goal-title { text-decoration: line-through; opacity: 0.45; }

.goal-title {
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

.goal-category-pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Reading card ──────────────────────────────────────────────────────────── */
.book-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}

.book-item:last-child { border-bottom: none; }

.book-spine {
  width: 4px;
  border-radius: 2px;
  background: var(--ember);
  align-self: stretch;
  flex-shrink: 0;
}

.book-title { font-size: 14px; font-weight: 600; color: var(--text); }
.book-author { font-size: 12px; color: var(--text-muted); }
.book-status {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 4px;
}

/* ── Gym tracker dots ──────────────────────────────────────────────────────── */
.gym-week {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gym-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.gym-day-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.gym-day.today .gym-day-label { color: var(--ember); }

.gym-dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s, border-color 0.15s;
}

.gym-dot.active {
  background: rgba(251, 146, 60, 0.15);
  border-color: var(--ember);
}

.gym-dot:hover { border-color: var(--border-bright); }

/* ── Focus text ────────────────────────────────────────────────────────────── */
.focus-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  border: none;
  background: transparent;
  width: 100%;
  resize: none;
  font-family: var(--font);
}

.focus-text:focus { outline: none; }
.focus-text::placeholder { color: var(--text-dim); }

/* ── Inline add form ───────────────────────────────────────────────────────── */
.add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.input {
  flex: 1;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--ember); }
.input::placeholder { color: var(--text-dim); }

.btn {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; }

.btn-ember { background: var(--ember); color: #111; }
.btn-ghost {
  background: transparent;
  border: 0.5px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover { border-color: var(--border-bright); color: var(--text); }

/* ── HUD divider ───────────────────────────────────────────────────────────── */
.hud-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.hud-divider::before,
.hud-divider::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

.hud-divider-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Badge ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-ember { background: rgba(251,146,60,0.15); color: var(--ember); }
.badge-cyan  { background: rgba(0,207,255,0.12);  color: var(--cyan);  }
.badge-gold  { background: rgba(245,158,11,0.15); color: var(--gold);  }
.badge-crimson { background: rgba(220,38,38,0.15); color: var(--crimson); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty {
  padding: 28px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.mono { font-family: var(--font-mono); }
