:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #151412;
  --raised: #1c1a17;
  --gold: #c6a46a;
  --copper: #b8733f;
  --cream: #e6e0d4;
  --muted: #a8a197;
  --dim: #716b63;
  --line: #332d26;
  --success: #8fae84;
  --danger: #c67b71;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--cream); font-family: "DM Sans", system-ui, sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.shell { min-height: 100vh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; height: 76px; padding: env(safe-area-inset-top) 18px 0; display: flex; align-items: center; justify-content: space-between; background: rgba(12,12,12,.92); border-bottom: 1px solid rgba(198,164,106,.14); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 38px; height: 38px; }
.wordmark { font: 800 18px/1 "Manrope", sans-serif; letter-spacing: .18em; }
.eyebrow { color: var(--gold); font: 800 11px/1.2 "Manrope", sans-serif; letter-spacing: .19em; text-transform: uppercase; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; border: 1px solid var(--line); color: var(--cream); background: var(--surface); }
.icon-button svg { width: 20px; height: 20px; }

.content { width: min(100%, 1040px); margin: 0 auto; padding: 24px 18px 44px; }
.page-head { margin: 6px 0 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-head h1 { margin: 8px 0 0; font: 800 clamp(30px, 7vw, 52px)/1.04 "Manrope", sans-serif; letter-spacing: -.04em; }
.page-head p { margin: 9px 0 0; color: var(--muted); max-width: 540px; line-height: 1.55; }

.grid { display: grid; gap: 16px; }
.dashboard-grid { grid-template-columns: 1fr; }
.card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, var(--raised), var(--surface)); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card h2, .card h3 { font-family: "Manrope", sans-serif; }
.card h2 { font-size: 25px; line-height: 1.12; letter-spacing: -.025em; margin: 8px 0 10px; }
.card h3 { margin: 0; font-size: 18px; }
.card p { color: var(--muted); line-height: 1.55; }
.hero-card { min-height: 310px; padding: 28px 24px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 90% 10%, rgba(184,115,63,.22), transparent 42%), linear-gradient(145deg,#1d1a15,#11100e); }
.hero-card::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; bottom: -90px; border: 1px solid rgba(198,164,106,.28); border-radius: 50%; box-shadow: 0 0 0 24px rgba(198,164,106,.05), 0 0 0 56px rgba(198,164,106,.035); }
.hero-card > * { position: relative; z-index: 1; }
.meta-row { display: flex; gap: 9px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 8px 11px; color: var(--muted); border: 1px solid var(--line); background: rgba(12,12,12,.42); font-size: 12px; font-weight: 700; }
.chip.gold { color: var(--gold); border-color: rgba(198,164,106,.42); }
.primary { min-height: 52px; border: 0; border-radius: 16px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: #11100e; background: var(--gold); font-weight: 800; }
.secondary { min-height: 48px; border-radius: 15px; border: 1px solid var(--line); padding: 0 16px; color: var(--cream); background: var(--surface); font-weight: 700; }
.ghost { border: 0; background: transparent; color: var(--gold); padding: 8px 0; font-weight: 700; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.action-row .primary { flex: 1; }
.complete { background: rgba(143,174,132,.16); color: #b8d2ae; border: 1px solid rgba(143,174,132,.32); }
.ai-chip { color: var(--cream); border-color: rgba(184,115,63,.48); background: rgba(184,115,63,.14); }
.ai-generator { display: flex; flex-direction: column; align-items: flex-start; }
.ai-generate { width: 100%; margin-top: auto; }
.ai-generate:disabled { cursor: wait; opacity: .72; }
.inline-error { width: 100%; margin: 0 0 12px; padding: 11px 12px; border: 1px solid rgba(198,123,113,.34); border-radius: 12px; color: #dfaaa2 !important; background: rgba(198,123,113,.09); font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(12,12,12,.28); border-top-color: var(--bg); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.quick-card { padding: 20px; }
.quick-icon { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: rgba(198,164,106,.12); color: var(--gold); font-size: 22px; margin-bottom: 18px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 0; }
.stat { padding: 14px 8px; text-align: center; border: 1px solid var(--line); border-radius: 16px; background: rgba(12,12,12,.35); }
.stat strong { display: block; font: 800 22px/1 "Manrope", sans-serif; }
.stat span { display: block; margin-top: 7px; color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }

.section-title { margin: 34px 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title h2 { margin: 0; font: 750 21px/1.2 "Manrope", sans-serif; }
.timeline { display: grid; gap: 11px; }
.day-card { padding: 17px; display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); }
.day { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: rgba(198,164,106,.11); color: var(--gold); font-weight: 800; }
.day-card h3 { margin: 0 0 4px; font-size: 15px; }
.day-card p { margin: 0; color: var(--muted); font-size: 13px; }
.check { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--dim); background: transparent; }
.check.done { border-color: var(--success); color: var(--success); background: rgba(143,174,132,.1); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filter { white-space: nowrap; min-height: 42px; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; background: var(--surface); color: var(--muted); font-weight: 700; }
.filter.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.library { grid-template-columns: 1fr; }
.library-card { min-height: 225px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.library-card .number { position: absolute; right: 16px; top: 12px; color: rgba(198,164,106,.13); font: 800 64px/1 "Manrope"; }

.tradition { padding: 18px; display: grid; gap: 14px; grid-template-columns: 48px 1fr auto; align-items: center; }
.tradition-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: rgba(184,115,63,.14); color: var(--copper); font-size: 22px; }
.tradition h3 { margin-bottom: 4px; }
.tradition p { margin: 0; font-size: 13px; }
.streak { text-align: right; color: var(--gold); font-weight: 800; }
.streak small { display: block; margin-top: 3px; color: var(--dim); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }

.form-card { padding: 22px; }
.field { display: grid; gap: 8px; margin-top: 17px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 52px; padding: 0 15px; border-radius: 15px; border: 1px solid var(--line); color: var(--cream); background: #11100e; font-size: 16px; }
.field textarea { min-height: 92px; padding-top: 14px; resize: vertical; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }
.form-actions > * { flex: 1; }
.profile-mark { width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 20px; background: #11100e; border: 1px solid rgba(198,164,106,.35); }
.profile-mark img { width: 70px; height: 70px; }

.bottom-nav { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); height: 70px; max-width: 620px; margin: auto; display: grid; grid-template-columns: repeat(5,1fr); border: 1px solid var(--line); border-radius: 23px; background: rgba(21,20,18,.94); box-shadow: 0 20px 60px #000; backdrop-filter: blur(20px); }
.nav-item { border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; align-content: center; gap: 4px; font-size: 9px; font-weight: 700; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--gold); }

.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; padding: 18px; background: rgba(0,0,0,.76); backdrop-filter: blur(12px); }
.modal { width: min(100%, 560px); max-height: calc(100vh - 36px); overflow-y: auto; border: 1px solid rgba(198,164,106,.35); border-radius: 28px; background: var(--surface); box-shadow: 0 30px 100px #000; padding: 24px; }
.modal h1 { margin: 12px 0 9px; font: 800 32px/1.05 "Manrope"; letter-spacing: -.04em; }
.modal p { color: var(--muted); line-height: 1.55; }
.step-dots { display: flex; gap: 6px; margin: 24px 0; }
.step-dot { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.step-dot.active { background: var(--gold); }
.empty { padding: 42px 24px; text-align: center; }
.empty .quick-icon { margin: 0 auto 16px; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 100px; transform: translate(-50%, 30px); max-width: calc(100% - 36px); padding: 13px 17px; border-radius: 14px; color: var(--cream); background: #29251f; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: var(--shadow); font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  .content { padding: 38px 28px 70px; }
  .dashboard-grid { grid-template-columns: 1.35fr .65fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .library { grid-template-columns: repeat(2, 1fr); }
  .modal-wrap { place-items: center; }
}

@media (min-width: 1100px) {
  .shell { padding-left: 240px; padding-bottom: 0; }
  .topbar { padding-left: 32px; }
  .bottom-nav { inset: 0 auto 0 0; width: 220px; height: 100vh; max-width: none; margin: 0; padding: 110px 16px 26px; grid-template-columns: 1fr; grid-template-rows: repeat(5, 64px); border-width: 0 1px 0 0; border-radius: 0; background: #11100e; }
  .nav-item { display: flex; justify-content: flex-start; padding: 0 18px; border-radius: 15px; gap: 13px; font-size: 13px; }
  .nav-item.active { color: var(--bg); background: var(--gold); }
  .library { grid-template-columns: repeat(3, 1fr); }
}

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