:root {
  --bg: #ffffff;
  --bg-subtle: #f4f7f3;
  --card: #ffffff;
  --text: #102010;
  --text-muted: #5b6b5b;
  --text-faint: #879287;
  --border: #dce5dc;
  --accent: #2d6b3a;
  --accent-2: #5a9e6f;
  --danger: #c0392b;
  --shadow: 0 12px 30px rgba(20, 50, 20, 0.08);
  /* Aliases used by components ported verbatim from the original app */
  --header-bg: #ffffff;
  --input-bg: #ffffff;
}

html.dark {
  --bg: #050705;
  --bg-subtle: #101510;
  --card: #0d120d;
  --text: #f3f7f3;
  --text-muted: #bdc8bd;
  --text-faint: #7f8b7f;
  --border: #263026;
  --accent: #f3f7f3;
  --accent-2: #72bd80;
  --shadow: none;
  --header-bg: #0d120d;
  --input-bg: #101510;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }

.app-shell { min-height: 100vh; background: var(--bg); }
.container { width: min(720px, 100%); margin: 0 auto; padding: 1rem; }
.home-bg { min-height: 100vh; background: linear-gradient(180deg, #e8f2e8 0%, var(--bg) 55%); }
html.dark .home-bg { background: var(--bg); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.4rem 1rem 0.8rem; }
.wordmark { font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; letter-spacing: -0.06em; color: #1a3a1a; }
html.dark .wordmark { color: var(--text); }
.icon-button, .button { border: 0; border-radius: 12px; cursor: pointer; font-weight: 700; }
.icon-button { background: var(--bg-subtle); color: var(--text-muted); padding: 0.55rem 0.8rem; border: 1px solid var(--border); }
.button { background: var(--accent); color: var(--bg); padding: 0.75rem 1rem; }
.button.secondary { background: var(--bg-subtle); color: var(--text); border: 1.5px solid var(--border); }
.button.danger { background: var(--danger); color: #fff; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.full { width: 100%; }

.grid { display: grid; gap: 1rem; }
.home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 1rem; }
.tile { background: #2d6b3a; color: #fff; border-radius: 22px; min-height: 150px; padding: 1rem; display: flex; flex-direction: column; justify-content: flex-end; border: 0; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.tile:nth-child(2n) { background: #347844; }
html.dark .tile { background: #222; }
.tile .emoji { font-size: 2.3rem; margin-bottom: auto; }
.tile-title { font-size: 1rem; font-weight: 800; }
.tile-sub { opacity: .72; font-size: .78rem; margin-top: .2rem; line-height: 1.4; }

.header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { width: min(720px, 100%); margin: 0 auto; padding: .85rem 1rem; display: flex; align-items: center; gap: .8rem; }
.header-title { font-weight: 800; }
.header-subtitle { color: var(--text-faint); font-size: .78rem; margin-top: .1rem; }

.card { background: var(--card); border: 1.5px solid var(--border); border-radius: 16px; padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card-title { font-weight: 800; margin-bottom: .65rem; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .82rem; }

.form-grid { display: grid; gap: .8rem; }
label { display: grid; gap: .35rem; color: var(--text-muted); font-size: .82rem; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--text); background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; padding: .75rem; }
textarea { resize: vertical; line-height: 1.5; }

.phase-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.task { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem; border: 1.5px solid var(--border); border-radius: 13px; background: var(--bg); cursor: pointer; }
.task.done { opacity: .62; text-decoration: line-through; background: var(--bg-subtle); }
.checkbox { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--border); display: inline-grid; place-items: center; flex: 0 0 auto; }
.task.done .checkbox { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.grow-list { display: grid; gap: .8rem; }
.grow-row { text-align: left; width: 100%; background: var(--card); color: var(--text); border: 1.5px solid var(--border); border-radius: 16px; padding: 1rem; cursor: pointer; box-shadow: var(--shadow); }
.button:focus-visible, .icon-button:focus-visible, .grow-row:focus-visible, .tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.row-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.progress { height: 9px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden; margin-top: .8rem; }
.progress > span { display: block; height: 100%; background: var(--accent-2); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.tab-strip { display: flex; gap: .5rem; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; scroll-snap-type: x proximity; }
.tab-strip .button { white-space: nowrap; scroll-snap-align: start; }
.tab-strip::-webkit-scrollbar { height: 4px; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-faint); }

@media (max-width: 480px) {
  .home-grid { gap: .8rem; }
  .tile { min-height: calc((100vw - 3rem) / 2); }
  .actions .button { flex: 1; }
  .tab-strip .button { flex: 0 0 auto; }
  .form-grid[style] { grid-template-columns: 1fr !important; }
  .topbar { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Dashboard tab bar — mirrors the original app's underline tabs (original line 7415) */
.dash-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--header-bg); overflow-x: auto; margin: 0 -1rem 1rem; padding: 0 .25rem; position: sticky; top: 0; z-index: 9; }
.dash-tab { flex: 1; padding: .85rem .3rem; background: none; border: none; border-bottom: 3px solid transparent; color: var(--text-faint); font-size: .82rem; font-weight: 400; cursor: pointer; white-space: nowrap; min-width: 60px; }
.dash-tab.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }
.dash-tabs::-webkit-scrollbar { height: 3px; }

/* ── Home beginner/experienced toggle (restored from original) ── */
.mode-pill-wrap { display: flex; justify-content: center; padding: .2rem 1rem .4rem; }
.mode-pill { display: inline-flex; background: var(--bg-subtle); border: 1.5px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.mode-pill-btn { background: none; border: none; border-radius: 999px; padding: .5rem 1.1rem; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.mode-pill-btn.on { background: var(--accent); color: var(--bg); }

/* ── Setup wizard ── */
.wizard-progress { display: flex; gap: 3px; padding-top: .8rem; padding-bottom: .2rem; }
.wizard-progress span { flex: 1; height: 5px; border-radius: 2px; background: var(--border); transition: background .3s; }
.wizard-progress span.on { background: var(--accent-2); }
.seg { display: flex; flex-wrap: wrap; gap: .5rem; }
.seg-btn { flex: 1 1 auto; min-width: 84px; background: var(--bg); color: var(--text); border: 1.5px solid var(--border); border-radius: 12px; padding: .7rem .8rem; font-weight: 700; cursor: pointer; }
.seg-btn.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.choice { display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: 14px; padding: 1.05rem 1.15rem; cursor: pointer; }
.choice.on { border-color: var(--accent-2); background: var(--bg-subtle); }
