/* ==========================================================================
   DS Weight Loss — design tokens
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --bg-soft: #eef2f0;
  --panel: #ffffff;
  --panel-strong: #fbfcfb;
  --panel-sunken: #f3f6f4;
  --text: #13201d;
  --muted: #5f6e69;
  --brand: #0f6e5a;
  --brand-strong: #0b5546;
  --brand-2: #cfe9e0;
  --accent: #d98a1f;
  --border: #e1e7e4;
  --border-strong: #cfd8d4;
  --danger: #b42318;
  --warn: #946200;
  --ok: #137a4b;
  --chart-1: #0f7d66;
  --chart-2: #e09422;
  --chart-3: #6d5fd3;
  --chart-warn: #d0592c;
  --chart-grid: #e6ece9;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(16 32 28 / 6%);
  --shadow: 0 1px 2px rgb(16 32 28 / 5%), 0 8px 24px rgb(16 32 28 / 6%);
  --shadow-lg: 0 24px 64px rgb(16 32 28 / 18%);
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1211;
  --bg-soft: #0e1715;
  --panel: #131c1b;
  --panel-strong: #152120;
  --panel-sunken: #0f1817;
  --text: #e8f1ee;
  --muted: #95a7a1;
  --brand: #4cc3a2;
  --brand-strong: #7fd8bf;
  --brand-2: #1c3a33;
  --accent: #f0b04f;
  --border: #22302d;
  --border-strong: #2e3f3b;
  --danger: #f97066;
  --warn: #f5b84a;
  --ok: #4fd18b;
  --chart-1: #4cc3a2;
  --chart-2: #f0b04f;
  --chart-3: #a397f2;
  --chart-warn: #f07a4f;
  --chart-grid: #22302d;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / 55%);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #0b1211;
    --bg-soft: #0e1715;
    --panel: #131c1b;
    --panel-strong: #152120;
    --panel-sunken: #0f1817;
    --text: #e8f1ee;
    --muted: #95a7a1;
    --brand: #4cc3a2;
    --brand-strong: #7fd8bf;
    --brand-2: #1c3a33;
    --accent: #f0b04f;
    --border: #22302d;
    --border-strong: #2e3f3b;
    --danger: #f97066;
    --warn: #f5b84a;
    --ok: #4fd18b;
    --chart-1: #4cc3a2;
    --chart-2: #f0b04f;
    --chart-3: #a397f2;
    --chart-warn: #f07a4f;
    --chart-grid: #22302d;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 55%);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.4rem); line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; margin-bottom: 0.6rem; }
h2 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; background: var(--panel-sunken); border: 1px solid var(--border); border-radius: 6px; padding: 0.05rem 0.35rem; }
small { font-size: 0.82em; }
.muted { color: var(--muted); }
.icon { width: 1.1em; height: 1.1em; flex: 0 0 auto; vertical-align: -0.15em; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app-shell { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: 0 0 auto; position: relative; z-index: 10;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  padding-top: max(0.7rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: 2.25rem; height: 2.25rem; border-radius: 10px; box-shadow: var(--shadow-sm); }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 0.98rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 0.74rem; font-weight: 500; }
.main-nav, .desktop-nav-actions { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.main-nav .mobile-nav-picker { display: none !important; }
.main-nav a:not(.button), .ghost {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border-radius: var(--radius-sm); color: var(--muted); padding: 0.5rem 0.75rem; font-weight: 600; font-size: 0.92rem;
}
.main-nav a.active, .main-nav a:not(.button):hover, .ghost:hover {
  background: var(--panel-sunken); color: var(--text); text-decoration: none;
}
.main-nav a.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.logout-form { margin-left: 0.25rem; }
.container {
  width: 100%; flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 1.75rem max(clamp(1rem, 3vw, 2.5rem), calc((100vw - 1240px) / 2)) 3rem;
}
.footer {
  flex: 0 0 auto; display: flex; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem); padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  color: var(--muted); border-top: 1px solid var(--border); font-size: 0.8rem; background: var(--panel);
}
.footer-privacy { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ==========================================================================
   Controls
   ========================================================================== */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.62rem 1rem; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1.2;
  box-shadow: var(--shadow-sm); transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}
.button:hover, button:hover { text-decoration: none; background: var(--panel-sunken); border-color: var(--border-strong); }
.button:active, button:active { transform: translateY(1px); }
.primary, button.primary, .button.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.primary:hover, button.primary:hover, .button.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
html[data-theme="dark"] .primary { color: #06201a; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .primary { color: #06201a; } }
.ghost { box-shadow: none; background: transparent; border-color: transparent; }
.icon-button { width: 2.4rem; height: 2.4rem; padding: 0; flex: 0 0 auto; }
.icon-button .icon { width: 1.15rem; height: 1.15rem; }
.danger-button { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.button.active { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.inline { display: inline; }
.inline button { padding: 0.5rem 0.75rem; }

label { display: grid; gap: 0.35rem; color: var(--text); font-weight: 600; font-size: 0.88rem; }
.label-hint { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.68rem 0.8rem;
  background: var(--panel); color: var(--text); font: inherit; font-size: 0.95rem; font-weight: 500;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
textarea { min-height: 8rem; resize: vertical; }
.theme-picker { display: flex; align-items: center; gap: 0.4rem; margin-left: 0.35rem; }
.theme-picker span { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.theme-picker select { padding: 0.4rem 0.6rem; font-size: 0.85rem; width: auto; }
.check { display: flex; grid-column: 1/-1; align-items: center; gap: 0.55rem; }
.check input { width: auto; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--panel-sunken); border: 1px solid var(--border); }
.segmented button { border: 0; box-shadow: none; background: transparent; color: var(--muted); padding: 0.32rem 0.62rem; font-size: 0.8rem; border-radius: 7px; }
.segmented button:hover { background: transparent; color: var(--text); }
.segmented button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Surfaces
   ========================================================================== */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1rem, 2.2vw, 1.4rem); box-shadow: var(--shadow);
}
.narrow { max-width: 480px; margin: 0 auto; }
.hero, .section-heading, .recipe-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading { margin-bottom: 0.9rem; flex-wrap: wrap; }
.section-heading h2 { margin: 0; }
.section-heading .eyebrow { margin-bottom: 0.15rem; }
.section-title { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.section-icon {
  display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; flex: 0 0 auto;
  background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand);
}
.section-icon .icon { width: 1.2rem; height: 1.2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; font-size: 0.7rem; margin-bottom: 0.4rem; }
.page-heading { max-width: 760px; margin-bottom: 1.4rem; }
.page-heading p:not(.eyebrow) { color: var(--muted); font-size: 1rem; margin-bottom: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand);
  padding: 0.25rem 0.6rem; font-size: 0.74rem; font-weight: 700; white-space: nowrap;
}
.pill .icon { width: 0.95em; height: 0.95em; }
.muted-pill { background: var(--panel-sunken); color: var(--muted); border: 1px solid var(--border); }
.privacy-note, .empty-state span { color: var(--muted); font-size: 0.9rem; }
.privacy-note { display: flex; gap: 0.5rem; align-items: flex-start; margin: 1rem 0 0; }
.privacy-note .icon { margin-top: 0.2rem; color: var(--brand); }
.empty-state { display: grid; gap: 0.2rem; padding: 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel-sunken); }
.flash {
  display: flex; align-items: flex-start; gap: 0.6rem;
  border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 1rem; border: 1px solid var(--border);
  background: var(--panel); box-shadow: var(--shadow-sm); font-weight: 600; font-size: 0.92rem;
}
.flash .icon { margin-top: 0.15rem; }
.flash.success { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); background: color-mix(in srgb, var(--ok) 6%, var(--panel)); }
.flash.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, var(--panel)); }
.flash.warning { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--panel-sunken); border: 1px solid var(--border); margin: 0.45rem 0; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.is-good { color: var(--ok) !important; }
.is-warn { color: var(--chart-warn) !important; }

/* ==========================================================================
   Layout grids
   ========================================================================== */
.grid.two, .dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stack, .grid-form, .mini-form { display: grid; gap: 1rem; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-form label:has(textarea), .grid-form > button, .grid-form .full { grid-column: 1/-1; }
.grid-form > button { justify-self: start; min-width: 11rem; }
.compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1rem; }
.compact-form button { grid-column: 1/-1; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.hero-panel {
  position: relative; overflow: hidden; margin-bottom: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2rem);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 55%),
    var(--panel);
  box-shadow: var(--shadow);
  align-items: stretch;
}
.hero-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.hero-lead { color: var(--muted); font-size: 1rem; max-width: 34rem; margin-bottom: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.hero-side { display: flex; align-items: stretch; flex: 0 0 auto; }
.hero-card {
  width: 100%; min-width: min(100%, 400px); display: grid; gap: 0.9rem; padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-strong);
}
.hero-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero-card-head strong { font-size: 0.9rem; }
.refresh-button { width: 2.1rem; height: 2.1rem; }
.ring-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.ring-item { display: grid; justify-items: center; text-align: center; gap: 0.15rem; min-width: 0; }
.ring-item strong { font-size: 1rem; margin-top: 0.35rem; letter-spacing: -0.01em; }
.ring-item span { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.ring {
  --p: 0; position: relative; display: grid; place-items: center; width: 4.4rem; height: 4.4rem; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--panel-sunken) 0);
  color: var(--brand);
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--panel-strong); }
.ring .icon { position: relative; width: 1.35rem; height: 1.35rem; }
.ring.complete { background: conic-gradient(var(--ok) 100%, var(--ok) 0); color: var(--ok); }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.metric-card, .stats li {
  position: relative; display: grid; align-content: start; gap: 0.15rem;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--panel); box-shadow: var(--shadow-sm);
}
.metric-card strong, .stats strong { display: block; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 750; margin: 0.15rem 0; }
.metric-card strong small { font-size: 0.85rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.metric-card > span, .stats span { color: var(--muted); font-size: 0.8rem; }
.metric-card .progress { margin: 0.35rem 0 0.2rem; }
.metric-label { text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; font-size: 0.7rem !important; }
.metric-icon { position: absolute; top: 0.95rem; right: 1rem; color: var(--muted); opacity: 0.8; }
.metric-icon .icon { width: 1.1rem; height: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; padding: 0; margin: 0; list-style: none; }
.stats strong { font-size: 1.15rem; }

.suggestion-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.suggestion-card { display: grid; align-content: start; gap: 0.55rem; box-shadow: var(--shadow-sm); }
.suggestion-card .pill { justify-self: start; }
.suggestion-card h2 { font-size: 1rem; margin: 0.15rem 0 0; }
.suggestion-card p { color: var(--muted); margin: 0; font-size: 0.9rem; }

.dashboard-stack { display: grid; gap: 1rem; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-card { width: 100%; min-width: 0; position: relative; display: flex; flex-direction: column; }
.chart-card[data-chart-card="mood"]:last-child:nth-child(odd) { grid-column: 1 / -1; }
.chart-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.chart-expand { color: var(--muted); }
.chart-expand:hover { color: var(--brand); }
.chart-frame { position: relative; height: 240px; margin-top: 0.25rem; }
.chart-frame-lg { height: 320px; }
.chart-frame canvas { cursor: zoom-in; }
canvas { display: block; width: 100%; height: 100%; border-radius: var(--radius-sm); touch-action: manipulation; }
.chart-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin-bottom: 0.75rem; }
.chart-summary:empty { display: none; }
.summary-item { display: grid; gap: 0.05rem; min-width: 7.5rem; }
.summary-item .progress { width: 7.5rem; margin: 0.25rem 0 0; }
.summary-label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.summary-item strong { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.summary-item small { color: var(--muted); font-size: 0.75rem; }
.summary-swatch { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 3px; }
.chart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0.75rem 0 0; color: var(--muted); font-size: 0.8rem; }
.legend-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--chart-1); margin-left: 0.35rem; }
.legend-swatch:first-child { margin-left: 0; }
.legend-swatch.dot { width: 7px; height: 7px; border-radius: 50%; opacity: 0.6; }
.legend-swatch.dash { height: 0; border-top: 2px dashed var(--chart-2); background: none; }

.chart-tooltip {
  position: fixed; z-index: 1000; left: 0; top: 0; display: grid; gap: 0.1rem;
  width: max-content; max-width: min(300px, calc(100vw - 16px));
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 0.7rem;
  background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg);
  font-size: 0.8rem; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity 100ms ease;
}
.chart-tooltip strong { font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-bottom: 0.1rem; }
.chart-tooltip span { font-weight: 600; }
.chart-tooltip.visible { opacity: 1; }

.chart-dialog {
  width: min(1180px, calc(100vw - 2rem)); height: min(820px, calc(100dvh - 2rem)); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-lg);
}
.chart-dialog::backdrop { background: rgb(8 16 14 / 55%); backdrop-filter: blur(3px); }
.chart-dialog[open] { display: flex; animation: dialog-in 160ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.chart-dialog-inner { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; padding: clamp(1rem, 2.5vw, 1.6rem); }
.chart-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chart-dialog-head h2 { font-size: 1.35rem; margin: 0; }
.chart-dialog-body { position: relative; flex: 1 1 0; min-height: 220px; overflow: hidden; }
.chart-dialog-body canvas, .chart-frame canvas { position: absolute; inset: 0; }
.chart-dialog .chart-foot { max-width: 760px; }
body.dialog-open { overflow: hidden; }

/* ==========================================================================
   Log page
   ========================================================================== */
.tabs {
  display: flex; gap: 0.25rem; margin: 0 0 1rem; padding: 4px; overflow-x: auto; scrollbar-width: none;
  background: var(--panel-sunken); border: 1px solid var(--border); border-radius: var(--radius);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: 0; box-shadow: none; background: transparent; color: var(--muted); padding: 0.55rem 0.85rem; border-radius: var(--radius-sm); }
.tabs button:hover { background: transparent; color: var(--text); }
.tabs button.active { background: var(--panel); color: var(--brand); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; } .tab-panel.active { display: block; animation: fade-in 140ms ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.tab-intro { color: var(--muted); margin: -0.25rem 0 1.1rem; font-size: 0.92rem; }
.weight-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.rating-field { display: grid; gap: 0.4rem; }
.rating-field > span { font-weight: 600; font-size: 0.88rem; }
.rating-group { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35rem; }
.rating-group label { position: relative; display: grid; justify-items: center; gap: 0.1rem; padding: 0.5rem 0.2rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; text-align: center; font-size: 0.75rem; color: var(--muted); background: var(--panel); transition: border-color 120ms ease, background 120ms ease; }
.rating-group label b { font-size: 1rem; color: var(--text); }
.rating-group input { position: absolute; opacity: 0; pointer-events: none; }
.rating-group label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--panel)); color: var(--brand); }
.rating-group label:has(input:focus-visible) { box-shadow: var(--focus); }

.dose-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: -0.4rem; }
.dose-chips button, .chip-check label span { padding: 0.35rem 0.7rem; font-size: 0.82rem; border-radius: 999px; box-shadow: none; }
.dose-chips button.active { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); border-color: var(--brand); color: var(--brand); }
.chip-check { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-check legend { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.45rem; padding: 0; }
.chip-check label { display: inline-flex; position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check label span { display: inline-block; border: 1px solid var(--border-strong); background: var(--panel); color: var(--muted); font-weight: 600; }
.chip-check label:has(input:checked) span { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); }
.chip-check label:has(input:focus-visible) span { box-shadow: var(--focus); }
[hidden] { display: none !important; }
.dose-history { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.dose-history h3 { margin: 0 0 0.5rem; }

/* ==========================================================================
   Me page & awards
   ========================================================================== */
.me-grid { align-items: start; margin-bottom: 1rem; }
.awards-panel { margin-top: 1rem; }
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.75rem; }
.award-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 0.85rem; align-items: center; padding: 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.award-card img { width: 56px; height: 56px; filter: grayscale(1); opacity: 0.45; }
.award-card.unlocked { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); background: color-mix(in srgb, var(--brand) 5%, var(--panel)); }
.award-card.unlocked img { filter: none; opacity: 1; }
.award-card h3 { margin: 0 0 0.15rem; font-size: 0.92rem; }
.award-card p { margin: 0 0 0.35rem; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.award-card strong { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.award-card.unlocked strong { color: var(--ok); }
.award-filter { margin-bottom: 1rem; }
.award-grid[data-filter="unlocked"] .award-card.locked, .award-grid[data-filter="locked"] .award-card.unlocked { display: none; }

/* ==========================================================================
   Recipes
   ========================================================================== */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.recipe-card { display: flex; flex-direction: column; gap: 0.7rem; }
.recipe-card h2 { margin: 0; }
.recipe-card > p { color: var(--muted); margin: 0; font-size: 0.92rem; }
.recipe-topline { justify-content: flex-start; flex-wrap: wrap; gap: 0.4rem; }
.macro-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0; }
.macro-list div { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.7rem; background: var(--panel-sunken); }
.macro-list dt { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.macro-list dd { margin: 0; font-weight: 700; }
details { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: auto; }
summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: 0.92rem; }
details h3 { margin: 0.9rem 0 0.3rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
details p { font-size: 0.92rem; }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; }
.admin-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.admin-list li:last-child { border-bottom: 0; }
.admin-list-main { display: grid; gap: 0.1rem; min-width: 0; }
.admin-list-main strong, .admin-list-main span { overflow-wrap: anywhere; }
.admin-list-actions { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-end; margin-left: auto; white-space: nowrap; }
.admin-list-summary { color: var(--muted); font-size: 0.85rem; }
.placeholder-key-table-wrap { overflow-x: auto; margin-top: 0.75rem; }
.placeholder-key-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 760px; }
.placeholder-key-table col { width: 33.333%; }
.placeholder-key-table tr { vertical-align: top; }
.placeholder-key-table td { width: 33.333%; vertical-align: top; padding: 0.7rem; border-bottom: 1px solid var(--border); }
.placeholder-key-table tr:last-child td { border-bottom: 0; }
.placeholder-key-entry { display: grid; align-content: start; gap: 0.25rem; }
.placeholder-key-token, .placeholder-key-description { display: block; overflow-wrap: anywhere; }
.placeholder-key-token { font-weight: 700; line-height: 1.25; }
.placeholder-key-token code { display: inline-block; }
.placeholder-key-description { color: var(--muted); font-size: 0.85rem; }
.admin-form-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; grid-column: 1/-1; }
.admin-sections, .admin-edit-list { display: grid; gap: 1rem; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: -0.35rem 0 1rem; }
.admin-home-grid .button { justify-self: start; }
.admin-edit-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--panel-sunken); }
.compact-admin-form textarea { min-height: 5.5rem; }
.delete-form { display: flex; justify-content: flex-end; margin: 0; }

/* ==========================================================================
   Auth & status pages
   ========================================================================== */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); align-items: center; gap: clamp(1.5rem, 6vw, 5rem); min-height: 70vh; max-width: 1080px; margin: 0 auto; }
.auth-copy h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
.auth-copy p { color: var(--muted); font-size: 1.05rem; max-width: 560px; }
.auth-card { padding: clamp(1.4rem, 3vw, 2rem); }
.auth-hero { margin: 0 0 1.5rem; }
.auth-hero img { display: block; width: 100%; height: auto; max-width: 560px; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.auth-logo { display: block; width: 3.5rem; height: 3.5rem; margin-bottom: 1rem; border-radius: 14px; box-shadow: var(--shadow-sm); }
.auth-card h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.auth-card > p { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.25rem; }
.auth-card button.primary { width: 100%; padding-block: 0.75rem; margin-top: 0.25rem; }
.auth-switch { text-align: center; color: var(--muted); font-size: 0.88rem; margin: 1.1rem 0 0; }
.check-list { display: grid; gap: 0.75rem; padding: 0; margin: 1.5rem 0 0; list-style: none; }
.check-list li { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 500; }
.check-list li .icon { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; padding: 0.25rem; border-radius: 50%; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); margin-top: 0.05rem; }
.check-list li span { display: grid; }
.check-list li small { color: var(--muted); font-size: 0.86rem; }
.status-card { text-align: center; display: grid; justify-items: center; gap: 0.75rem; }
.status-card > p { color: var(--muted); }
.status-icon { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.status-icon .icon { width: 1.6rem; height: 1.6rem; }
.status-card .empty-state { text-align: left; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .hero-panel { flex-direction: column; }
  .hero-card { min-width: 0; }
  .hero-side { width: 100%; }
}
@media (max-width: 960px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; min-height: 0; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { align-items: stretch; flex-direction: column; gap: 0.6rem; padding-block: 0.65rem; }
  .brand-text small { display: none; }
  .container { padding: 1rem 1rem 1.6rem; }
  .footer { padding: 0.65rem 1rem; font-size: 0.74rem; }
  .grid.two, .dashboard-grid, .grid-form, .stats, .compact-form { grid-template-columns: 1fr; }
  .grid-form > button { justify-self: stretch; }
  .main-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; width: 100%; gap: 0.5rem; }
  .main-nav .mobile-nav-picker { display: grid !important; gap: 0.3rem; width: 100%; }
  .mobile-nav-picker span { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
  .desktop-nav-actions { display: none !important; }
  .main-nav .inline { justify-self: end; }
  .logout-form button span { display: none; }
  .theme-picker { grid-column: 1/-1; margin: 0; }
  .theme-picker select { flex: 1; }
  .section-heading { align-items: flex-start; }
  .chart-card .section-heading { flex-direction: row; }
  .chart-frame { height: 210px; }
  .chart-frame-lg { height: 260px; }
  .chart-card .chart-tools .pill { display: none; }
  .summary-item { min-width: 6.5rem; }
  .ring { width: 3.8rem; height: 3.8rem; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .hero-actions .button { padding-inline: 0.5rem; }
  .admin-list li { align-items: flex-start; flex-direction: column; }
  .admin-list-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; margin-left: 0; }
  .chart-dialog { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; border: 0; }
  .chart-dialog-head .chart-tools { width: 100%; justify-content: space-between; }
  .award-card { grid-template-columns: 48px minmax(0, 1fr); }
  .award-card img { width: 48px; height: 48px; }
}
@media (max-width: 420px) {
  .metric-strip { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .metric-card { padding: 0.85rem; }
  .metric-card strong { font-size: 1.25rem; }
  .metric-icon { display: none; }
  .hero-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Reminders */
.reminders-card { margin: 1rem 0; }
.reminder-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.reminder { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.85rem; padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel-strong); }
.reminder-icon { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 9px; background: var(--panel-sunken); color: var(--muted); }
.reminder-text { display: grid; gap: 0.1rem; min-width: 0; }
.reminder-text strong { font-size: 0.92rem; }
.reminder-text span { color: var(--muted); font-size: 0.84rem; }
.reminder .button { padding: 0.45rem 0.8rem; font-size: 0.84rem; }
.reminder-urgent { border-left-color: var(--chart-warn); background: color-mix(in srgb, var(--chart-warn) 6%, var(--panel)); }
.reminder-urgent .reminder-icon { color: var(--chart-warn); background: color-mix(in srgb, var(--chart-warn) 12%, transparent); }
.reminder-due { border-left-color: var(--accent); }
.reminder-due .reminder-icon { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.reminder-info { border-left-color: var(--brand); }
.reminder-info .reminder-icon { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.reminder-done { display: flex; align-items: center; gap: 0.5rem; margin: 0; color: var(--ok); font-weight: 600; }
.legend-swatch.dotted { height: 0; border-top: 2px dotted var(--text); background: none; opacity: 0.6; }
@media (max-width: 560px) {
  .reminder { grid-template-columns: auto minmax(0, 1fr); }
  .reminder .button { grid-column: 2; justify-self: start; }
}
.legend-swatch.proj { height: 0; border-top: 2px dashed var(--chart-1); background: none; }
