/* Stark OS — base.css — theme vars injected by theme.js */

:root {
  --bg:            #111214;
  --surface:       #16171b;
  --surface-2:     #1c1d23;
  --border:        #2a2a30;
  --border-bright: #3a3a44;
  --accent-1:      #fb923c;
  --accent-2:      #00cfff;
  --accent-3:      #f59e0b;
  --alert:         #dc2626;
  --text:          #e8e8ec;
  --text-muted:    #7a7a8a;
  --text-dim:      #4a4a58;
  --font-heading:  'Rajdhani', sans-serif;
  --font-body:     'DM Sans', 'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;
  --radius:        6px;
  --radius-lg:     10px;
  --radius-xl:     18px;
}

*, *::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-body);
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 52px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 0.5px solid var(--border);
  backdrop-filter: blur(12px);
}

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

.arc-reactor { width: 26px; height: 26px; flex-shrink: 0; }

.topbar-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}

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

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

.topbar-spacer { flex: 1; }

.topbar-household-link {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.topbar-household-link:hover { color: var(--accent-1); border-color: var(--accent-1); }

.topbar-settings-link {
  font-size: 18px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: color 0.15s;
  line-height: 1;
}
.topbar-settings-link:hover { color: var(--accent-1); }

/* Hamburger (mobile) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: transparent;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Navigation ────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-tab {
  padding: 10px 16px;
  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;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent-1); border-bottom-color: var(--accent-1); }

/* ── Main layout ───────────────────────────────────────────────────────────── */
.main {
  padding: 20px;
  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(--accent-1); margin-right: 6px; }

/* ── 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(280px, 1fr)); gap: 16px; }
.col-span-2 { grid-column: span 2; }

/* ── 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 — Jarvis (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;
}

body.ts-jarvis .card-featured::before,
body.ts-jarvis .card-featured::after,
body.ts-jarvis .card-featured .corner-br,
body.ts-jarvis .card-featured .corner-bl {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--accent-1);
  border-style: solid;
  opacity: 0.7;
}
body.ts-jarvis .card-featured::before  { top:-0.5px;    left:-0.5px;  border-width: 2px 0 0 2px; border-radius: var(--radius-lg) 0 0 0; }
body.ts-jarvis .card-featured::after   { top:-0.5px;    right:-0.5px; border-width: 2px 2px 0 0; border-radius: 0 var(--radius-lg) 0 0; }
body.ts-jarvis .card-featured .corner-br { bottom:-0.5px; right:-0.5px; border-width: 0 2px 2px 0; border-radius: 0 0 var(--radius-lg) 0; }
body.ts-jarvis .card-featured .corner-bl { bottom:-0.5px; left:-0.5px;  border-width: 0 0 2px 2px; border-radius: 0 0 0 var(--radius-lg); }

/* Blush — soft gradient glow border */
body.ts-blush .card-featured {
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-1) 30%, transparent),
              inset 0 0 20px color-mix(in srgb, var(--accent-1) 4%, transparent);
  border-radius: var(--radius-xl);
}

.card-featured .card-title { color: var(--accent-1); 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.a1 { color: var(--accent-1); }
.stat-value.a2 { color: var(--accent-2); }
.stat-value.a3 { color: var(--accent-3); }
.stat-value.alert { color: var(--alert); }

.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(--accent-1);
  transition: width 0.4s ease;
}
.progress-fill.a2   { background: var(--accent-2); }
.progress-fill.a3   { background: var(--accent-3); }
.progress-fill.alert { background: var(--alert); }

/* Split progress (household savings) */
.progress-split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--border); margin-top: 10px; }
.progress-split-a { height: 100%; background: var(--accent-1); transition: width 0.4s ease; }
.progress-split-b { height: 100%; background: var(--accent-2); transition: width 0.4s ease; }

/* ── Task item ─────────────────────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s;
  min-height: 44px;
}
.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: 20px; height: 20px;
  min-width: 20px;
  border: 1.5px solid var(--border-bright);
  border-radius: 4px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.task-item.done .task-checkbox { background: var(--accent-1); border-color: var(--accent-1); }
.task-checkbox-inner { width: 10px; height: 10px; display: none; }
.task-item.done .task-checkbox-inner { display: block; }

.task-title { font-size: 14px; color: var(--text); flex: 1; line-height: 1.4; }
.task-meta  { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.task-delete {
  font-size: 16px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  border: none;
  background: transparent;
  line-height: 1;
  min-width: 28px;
  text-align: center;
}
.task-item:hover .task-delete { opacity: 1; }
.task-delete:hover { color: var(--alert); }

/* ── Habit grid ────────────────────────────────────────────────────────────── */
.habit-row {
  display: grid;
  grid-template-columns: 1fr repeat(7, 36px);
  align-items: center;
  gap: 5px;
  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: 36px; height: 36px;
  min-width: 36px;
  border-radius: 6px;
  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);
  user-select: none;
}
.habit-cell:hover { border-color: var(--border-bright); }
.habit-cell.done { background: var(--accent-1); border-color: var(--accent-1); 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-bottom: 4px;
}
.habit-day-header.today { color: var(--accent-1); }

/* ── Finance ───────────────────────────────────────────────────────────────── */
.finance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
  gap: 10px;
}
.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: 15px; font-weight: 700; color: var(--accent-3); white-space: nowrap; }
.finance-amount.debt { color: var(--alert); }
.finance-amount.savings { color: var(--accent-2); }

/* ── Goal item ─────────────────────────────────────────────────────────────── */
.goal-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
  min-height: 44px;
}
.goal-item:last-child { border-bottom: none; }

.goal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-1);
  flex-shrink: 0;
  margin-top: 7px;
  cursor: pointer;
}
.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;
  align-self: center;
}

/* ── Reading ───────────────────────────────────────────────────────────────── */
.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(--accent-1); 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(--accent-2); margin-top: 3px; }

/* ── Gym ───────────────────────────────────────────────────────────────────── */
.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(--accent-1); }
.gym-dot {
  width: 38px; height: 38px;
  min-width: 38px;
  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: color-mix(in srgb, var(--accent-1) 15%, transparent); border-color: var(--accent-1); }
.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-body);
}
.focus-text:focus { outline: none; }
.focus-text::placeholder { color: var(--text-dim); }

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

.input {
  flex: 1;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  min-height: 44px;
}
.input:focus { border-color: var(--accent-1); }
.input::placeholder { color: var(--text-dim); }

select.input { cursor: pointer; }

.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: opacity 0.15s, transform 0.1s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; transform: scale(0.98); }

.btn-primary { background: var(--accent-1); color: #111; }
.btn-secondary { background: var(--accent-2); 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); }
.btn-danger { background: var(--alert); color: #fff; }

/* ── 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);
  white-space: nowrap;
}

/* ── 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-a1 { background: color-mix(in srgb, var(--accent-1) 15%, transparent); color: var(--accent-1); }
.badge-a2 { background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: var(--accent-2); }
.badge-a3 { background: color-mix(in srgb, var(--accent-3) 15%, transparent); color: var(--accent-3); }

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

/* ── PIN Modal ─────────────────────────────────────────────────────────────── */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.pin-modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  width: 100%;
  max-width: 340px;
}

.pin-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
}

.pin-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  transition: background 0.15s, border-color 0.15s;
}
.pin-dot.filled { background: var(--accent-1); border-color: var(--accent-1); }

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

.pin-key {
  height: 60px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:hover { background: var(--border); border-color: var(--border-bright); }
.pin-key:active { transform: scale(0.94); background: color-mix(in srgb, var(--accent-1) 20%, var(--surface-2)); }
.pin-key.del { font-size: 18px; color: var(--text-muted); }

.pin-error { color: var(--alert); font-size: 13px; min-height: 20px; }

/* ── Landing page ──────────────────────────────────────────────────────────── */
.landing-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.landing-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}

.landing-subtitle {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 56px;
}

.profile-cards {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 700px;
}

.profile-card {
  flex: 1;
  min-width: 240px;
  max-width: 300px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.profile-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.profile-card:hover { transform: translateY(-4px); }
.profile-card:hover::before { opacity: 1; }

.profile-card.eyouel { --card-accent: #fb923c; }
.profile-card.eyouel:hover { border-color: #fb923c; box-shadow: 0 8px 32px color-mix(in srgb, #fb923c 20%, transparent); }

.profile-card.wife { --card-accent: #f472b6; }
.profile-card.wife:hover { border-color: #f472b6; box-shadow: 0 8px 32px color-mix(in srgb, #f472b6 20%, transparent); }

.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid var(--card-accent);
  color: var(--card-accent);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.05em;
}

.profile-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
}

.profile-tag {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.household-link-landing {
  margin-top: 40px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  padding: 10px 20px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  transition: color 0.15s, border-color 0.15s;
}
.household-link-landing:hover { color: var(--text-muted); border-color: var(--border-bright); }

/* ── Settings page ─────────────────────────────────────────────────────────── */
.settings-main {
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

.theme-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.theme-preset-btn {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 44px;
}
.theme-preset-btn:hover { border-color: var(--border-bright); color: var(--text); }
.theme-preset-btn.active { border-color: var(--accent-1); color: var(--accent-1); }

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

.color-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.color-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding: 2px;
  background: transparent;
}

.color-hex {
  flex: 1;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  min-height: 44px;
}
.color-hex:focus { border-color: var(--accent-1); }

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

.font-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Widget drag list */
.widget-list { display: flex; flex-direction: column; gap: 8px; }

.widget-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: grab;
  min-height: 52px;
  user-select: none;
}
.widget-item:active { cursor: grabbing; }
.widget-item.sortable-ghost { opacity: 0.4; }
.widget-item.sortable-chosen { background: var(--border); }

.widget-drag-handle { color: var(--text-dim); font-size: 16px; flex-shrink: 0; cursor: grab; }
.widget-label { flex: 1; font-size: 14px; color: var(--text); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent-1); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* Image upload area */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.upload-card {
  background: var(--surface-2);
  border: 0.5px dashed var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  position: relative;
}

.upload-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}

.upload-preview {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 10px;
  display: none;
}
.upload-preview.visible { display: block; }

.upload-btn-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Settings preview bar */
.theme-preview {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
}

/* ── Household panel ───────────────────────────────────────────────────────── */
.household-header {
  background: linear-gradient(135deg, #fb923c, #f472b6);
  padding: 24px 20px;
  margin: -20px -20px 20px;
}
.household-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 4px;
}
.household-subtitle { font-size: 12px; color: rgba(255,255,255,0.7); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── 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; }
.text-dim { color: var(--text-dim); font-size: 12px; }
.mono { font-family: var(--font-mono); }
.heading-font { font-family: var(--font-heading); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

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

  .topbar-subtitle { display: none; }
  .topbar-date { display: none; }
  .topbar { padding: 0 14px; }

  .nav { padding: 0 14px; }
  .nav-tab { padding: 10px 12px; font-size: 10px; }

  .main { padding: 14px; }
  .settings-main { padding: 14px; }

  .habit-row {
    grid-template-columns: minmax(80px, 1fr) repeat(7, 34px);
    gap: 3px;
  }
  .habit-cell { width: 34px; height: 34px; min-width: 34px; }

  .add-row { flex-direction: column; }
  .add-row .input, .add-row .btn { width: 100%; flex: none; }

  .finance-row { flex-wrap: wrap; }

  .color-grid { grid-template-columns: 1fr; }
  .font-grid { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }

  .pin-key { height: 68px; }

  .profile-cards { flex-direction: column; align-items: center; }
  .profile-card { max-width: 100%; width: 100%; }

  .theme-preview { flex-direction: column; align-items: flex-start; }

  .household-header { margin: -14px -14px 14px; padding: 20px 14px; }
}

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .topbar-household-link { display: none; }
  .hamburger { display: flex; }
  .topbar-settings-link { display: none; }
}
