:root {
  --bg: #0a0a0b;
  --panel: #131315;
  --panel-2: #1a1a1d;
  --line: #2a2a2e;
  --text: #f3f0e8;
  --muted: #9b978d;
  --gold: #c9a54c;
  --gold-2: #e3c579;
  --gold-dim: rgba(201, 165, 76, 0.12);
  --error: #e07a6a;
  --success: #7fbf8e;
  --radius: 14px;
  --head: 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); font-weight: 500; letter-spacing: 0.02em; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); text-transform: uppercase; }
h2 { font-size: 1.5rem; text-transform: uppercase; }
h3 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow, .narrow { max-width: 760px; }
.gold { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.eyebrow { color: var(--gold); font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 0.8em; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.clean li:last-child { border-bottom: 0; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(10, 10, 11, 0.92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { font-family: var(--head); font-size: 1.4rem; letter-spacing: 0.12em; color: var(--text); font-weight: 600; }
.logo span { color: var(--gold); }
.logo:hover { text-decoration: none; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: var(--text); padding: 8px 12px; border-radius: 999px; font-size: 0.9rem; }
.main-nav a:hover { background: var(--panel-2); text-decoration: none; }
.main-nav a.active { background: var(--gold-dim); color: var(--gold-2); }
.main-nav a.nav-muted { color: var(--muted); }
@media (max-width: 600px) {
  .header-inner { padding-top: 10px; padding-bottom: 6px; }
  .main-nav { width: 100%; justify-content: space-between; }
  .main-nav a { padding: 6px 8px; font-size: 0.85rem; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 0.95rem var(--body); letter-spacing: 0.04em;
  padding: 13px 24px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #15120a; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Cards & flash */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.flash { border: 1px solid var(--line); background: var(--panel-2); padding: 12px 16px; border-radius: 10px; margin: 16px 0; }
.flash-error { border-color: rgba(224, 122, 106, 0.5); color: #f3c3ba; }
.flash-success { border-color: rgba(127, 191, 142, 0.5); color: #c5e6cd; }

/* Hero */
.hero { padding: 72px 0 56px; background: radial-gradient(ellipse at 80% 0%, rgba(201, 165, 76, 0.16), transparent 55%), var(--bg); border-bottom: 1px solid var(--line); }
.hero .lead { font-size: 1.15rem; color: #cfcbc1; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 40px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hero-points li { border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 0.9rem; }
.hero-points span { color: var(--gold); font-family: var(--head); margin-right: 6px; }
@media (max-width: 700px) { .hero { padding: 48px 0 40px; } .hero-points { grid-template-columns: 1fr 1fr; } }

/* Survey */
.survey-section { padding: 56px 0; }
.survey { padding: 28px; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.3s; }
.step-count { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 12px 0 18px; }
.step { border: 0; padding: 0; margin: 0; min-width: 0; }
.step legend { font-family: var(--head); font-size: 1.7rem; text-transform: uppercase; margin-bottom: 18px; padding: 0; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 18px 0 8px; }
.choices { display: grid; gap: 10px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 600px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .compact.cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .compact.cols-3 .choice:last-child:nth-child(odd) { grid-column: span 2; }
}
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); transition: border-color 0.15s, background 0.15s; }
.compact .choice-body { min-height: 0; padding: 12px; text-align: center; }
.choice-body strong { font-weight: 600; }
.choice-body small { color: var(--muted); font-size: 0.82rem; }
.choice:hover .choice-body { border-color: #4a4740; }
.choice input:checked + .choice-body { border-color: var(--gold); background: var(--gold-dim); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--gold); outline-offset: 2px; }

.units-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 16px; }
.units-toggle label { padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.units-toggle input { position: absolute; opacity: 0; }
.units-toggle label:has(input:checked) { background: var(--gold-dim); color: var(--gold-2); }

.field { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; flex: 1; min-width: 0; }
.field > input, .field > select, .field > textarea { display: block; margin-top: 6px; }
.field em { font-style: normal; opacity: 0.7; }
.field.grow { flex: 3; }
.field-row { display: flex; gap: 12px; }
.field-row.four .field { min-width: 0; }
@media (max-width: 600px) { .field-row { flex-wrap: wrap; } .field-row .field { flex: 1 1 calc(50% - 6px); } .field.grow { flex-basis: 100%; } }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font: 16px var(--body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
input[type=date] { color-scheme: dark; }
textarea { resize: vertical; }

.step-error { color: var(--error); margin: 12px 0 0; }
.survey-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.survey-nav #next-btn, .survey-nav #submit-btn { margin-left: auto; }

/* About */
.about { padding: 64px 0; border-top: 1px solid var(--line); }
.about-inner { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: start; }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--panel); }
.feature h3 { color: var(--gold-2); }
.feature p { color: var(--muted); font-size: 0.92rem; margin: 0; }
@media (max-width: 800px) { .about-inner { grid-template-columns: 1fr; gap: 28px; } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }

/* Plan */
.page-head { padding: 48px 0 24px; }
.save-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border: 1px solid var(--gold); background: var(--gold-dim); border-radius: var(--radius); margin-top: 16px; }
.save-banner span { display: block; font-size: 0.9rem; }
.section-title { margin: 40px 0 16px; }
.stat-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }
.stat-value { font-family: var(--head); font-size: 2.2rem; line-height: 1.2; }
.stat-main { border-color: var(--gold); background: linear-gradient(160deg, var(--gold-dim), var(--panel) 70%); }
.stat-main .stat-value { color: var(--gold-2); font-size: 2.8rem; }
.stat-unit { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } .stat-main { grid-column: 1 / -1; } .stat { padding: 14px; } .stat-value { font-size: 1.6rem; } }
.food-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.food-grid .card { margin: 0; padding: 20px; }
.food-grid h3 { color: var(--gold-2); }
@media (max-width: 900px) { .food-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .food-grid { grid-template-columns: 1fr; } }
.workout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 12px; }
.workout-grid .card { margin: 0; }
@media (max-width: 400px) { .workout-grid { grid-template-columns: 1fr; } }
.workout-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.workout-head h3 { margin: 0; }
.day-num { color: var(--gold); font-family: var(--head); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; }
.ex-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ex-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ex-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.ex-table td:not(:first-child), .ex-table th:not(:first-child) { text-align: center; white-space: nowrap; }
.ex-table tr:last-child td { border-bottom: 0; }
.notes { margin-top: 12px; }
.tips { display: grid; gap: 10px; }
.tip { border-left: 3px solid var(--gold); background: var(--panel); padding: 14px 18px; border-radius: 0 10px 10px 0; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 40px 0 64px; }

/* Auth */
.auth { display: flex; justify-content: center; padding: 56px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 2rem; }

/* Tracker */
.date-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-form input { padding: 8px 12px; }
.macro-bars { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.macro { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.macro-main { border-color: var(--gold); }
.macro-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; margin-bottom: 8px; flex-wrap: wrap; }
.macro-top strong { font-family: var(--head); font-size: 1.2rem; font-weight: 500; }
.bar { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 8px; }
.bar-fill.over { background: var(--error); }
.macro-left { margin-top: 6px; }
@media (max-width: 700px) { .macro-bars { grid-template-columns: 1fr 1fr; } .macro-main { grid-column: 1 / -1; } }
.tracker-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; margin-bottom: 64px; }
@media (max-width: 900px) { .tracker-grid { grid-template-columns: 1fr; } }
.add-food h2, aside h2 { font-size: 1.2rem; }
.recent { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font: 0.85rem var(--body); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--gold); }
.meal-card { padding: 18px 20px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; }
.meal-head h3 { margin-bottom: 6px; }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.entries li strong { display: block; font-weight: 500; }
.entry-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.entry-right form { margin: 0; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--muted); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; }
.icon-btn:hover { color: var(--error); border-color: var(--error); }
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.mini-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.75rem; padding: 4px; }
.mini-table td { padding: 6px 4px; border-top: 1px solid var(--line); }
.coach-promo { display: block; color: var(--text); border-color: var(--gold); }
.coach-promo:hover { text-decoration: none; background: var(--gold-dim); }
.coach-promo strong, .coach-promo span { display: block; }

/* Coach */
.chat { padding: 0; overflow: hidden; margin-bottom: 64px; }
.chat-log { max-height: 60vh; min-height: 300px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 16px; font-size: 0.95rem; overflow-wrap: anywhere; }
.msg p { margin: 0 0 0.6em; }
.msg p:last-child, .msg ul:last-child { margin-bottom: 0; }
.msg ul { margin: 0 0 0.6em; padding-left: 1.2em; }
.msg-user { align-self: flex-end; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #15120a; border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-error { border-color: rgba(224, 122, 106, 0.5); color: #f3c3ba; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.suggestions { padding: 0 20px 16px; }
.chat-form { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { min-height: 48px; max-height: 160px; resize: none; }
.chat-meta { padding: 0 20px 16px; margin: 0; }

/* Admin */
.table-wrap { overflow-x: auto; padding: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 760px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; margin-top: 24px; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-inner p { margin: 6px 0 0; }
.disclaimer { max-width: 520px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
