/* Dark: near-black surfaces, hairline borders, tight type, restrained indigo accent (Linear-style).
   Light: white and soft grey, large confident type, pill buttons, blue accent (Apple-style). */
:root, :root[data-theme="dark"] {
  --bg: #08090a;
  --bg-soft: #0e0f11;
  --card: #111214;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f7f8f8;
  --muted: #8b909a;
  --accent: #6b72e8;
  --accent-hover: #7b82f0;
  --accent-ink: #ffffff;
  --good: #4cc38a;
  --warn: #e9a23b;
  --nav-bg: rgba(8, 9, 10, 0.72);
  --radius: 10px;
  --radius-btn: 8px;
  --h1-size: clamp(2.5rem, 7vw, 4.25rem);
  --h1-weight: 600;
  --h1-track: -0.035em;
  --hero-glow: radial-gradient(60% 55% at 50% 0%, rgba(107, 114, 232, 0.28), transparent 70%);
  --shadow: 0 0 0 1px var(--border), 0 24px 60px -24px rgba(0, 0, 0, 0.8);
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --good: #1f9d55;
  --warn: #b7791f;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --radius: 18px;
  --radius-btn: 980px;
  --h1-size: clamp(2.75rem, 8vw, 5rem);
  --h1-weight: 700;
  --h1-track: -0.045em;
  --hero-glow: none;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 24px 48px -24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
html[data-theme="light"] { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

/* Navigation */
.nav { position: sticky; top: 0; z-index: 10; background: var(--nav-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--border); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; font-size: 1.05rem; }
.mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--text)); opacity: 0.95; }
.nav-links { display: flex; gap: 24px; color: var(--muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 640px) { .nav-links { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-btn); border: 1px solid transparent; font: inherit; font-weight: 500; font-size: 0.95rem; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hero */
.hero { position: relative; text-align: center; padding: 88px 0 56px; background: var(--hero-glow); }
.pill { display: inline-block; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font-size: 0.8rem; margin-bottom: 24px; }
.hero h1 { font-size: var(--h1-size); font-weight: var(--h1-weight); letter-spacing: var(--h1-track); line-height: 1.04; max-width: 14ch; margin: 0 auto; }
.hero p { color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.35rem); max-width: 34em; margin: 22px auto 32px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Preview */
.preview { margin: 8px auto 0; max-width: 760px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: left; }
.preview-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 0.85rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 14px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 4px); }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.fill-62 { width: 62%; }
.caption { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

/* Sections */
section.block { padding: 72px 0; }
section.soft { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(1.8rem, 4.5vw, 2.75rem); font-weight: 600; letter-spacing: -0.035em; }
.section-head p { color: var(--muted); font-size: 1.1rem; margin: 12px 0 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.step-n { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-strong); align-items: center; justify-content: center; font-size: 0.85rem; margin-bottom: 12px; color: var(--muted); }
.closing { text-align: center; }
footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: 0.85rem; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Sign-in */
.center-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--hero-glow), var(--bg); }
.center-page main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 4px; }
label { display: block; font-size: 0.85rem; margin: 16px 0 6px; color: var(--muted); }
input[type=text], input[type=password], input[type=number] { width: 100%; padding: 11px 12px; border-radius: calc(var(--radius-btn) > 12px ? 12px : var(--radius-btn)); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.error { color: #ff6b6b; font-size: 0.9rem; min-height: 1.3em; margin-top: 12px; }
:root[data-theme="light"] .error { color: #d70015; }
.auth-card .btn { margin-top: 18px; }

/* App */
.app-main { max-width: 680px; margin: 0 auto; padding: 16px; }
.app-main .card { margin-bottom: 14px; }
.app-main h2 { font-size: 1rem; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .stat { flex: 1 1 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check label { margin: 0; color: var(--text); font-size: 0.95rem; }
.win { margin-top: 8px; }
.nudge { border-color: var(--warn); }
.ok { color: var(--good); font-size: 0.9rem; margin-top: 8px; min-height: 1.3em; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
td { padding: 7px 0; border-bottom: 1px solid var(--border); }
td:last-child { text-align: right; }
svg.spark { width: 100%; height: 60px; color: var(--accent); }
.hidden { display: none; }
.mt-lg { margin-top: 56px; }
.app-main .btn-block { margin-top: 16px; }
.section-head h2 { line-height: 1.12; }
.app-main ul { margin: 0; padding-left: 18px; }
