:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
a { color: inherit; }

body,
body[data-theme="light"] {
  --bg: #f2f5f1; --surface: #fff; --surface-2: #f8faf7; --surface-3: #eef2ec;
  --text: #17241e; --muted: #69776f; --line: #dce5dc; --accent: #a7d843;
  --accent-strong: #4d750d; --accent-ink: #18260b; --shadow: 0 16px 42px rgba(36, 53, 39, .08);
  --chart-grid: #e0e8df; --input: #fff; --danger: #ad3d39;
  background: var(--bg); color: var(--text); color-scheme: light;
}
body[data-theme="dark"] {
  --bg: #0d1420; --surface: #152131; --surface-2: #1a2939; --surface-3: #233447;
  --text: #edf5ee; --muted: #a1b1ac; --line: #2a3a48; --accent: #c8f45c;
  --accent-strong: #c8f45c; --accent-ink: #14210a; --shadow: 0 20px 45px rgba(0, 0, 0, .16);
  --chart-grid: #2b3c49; --input: #101c2a; --danger: #ff9a91;
  background: var(--bg); color: var(--text); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  body[data-theme="system"] {
    --bg: #0d1420; --surface: #152131; --surface-2: #1a2939; --surface-3: #233447;
    --text: #edf5ee; --muted: #a1b1ac; --line: #2a3a48; --accent: #c8f45c;
    --accent-strong: #c8f45c; --accent-ink: #14210a; --shadow: 0 20px 45px rgba(0, 0, 0, .16);
    --chart-grid: #2b3c49; --input: #101c2a; --danger: #ff9a91;
    background: var(--bg); color: var(--text); color-scheme: dark;
  }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 34px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 11px; font-weight: 950; font-size: 24px; line-height: 1; }
.brand-name { font-size: 26px; font-weight: 850; letter-spacing: -.075em; }
.brand-tagline { margin: 4px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .01em; }
.side-nav { display: grid; gap: 6px; }
.nav-btn { border: 0; background: transparent; color: var(--muted); width: 100%; min-height: 47px; padding: 10px 13px; border-radius: 13px; display: flex; align-items: center; gap: 12px; text-align: left; font-size: 14px; font-weight: 650; }
.nav-btn:hover, .nav-btn:focus-visible { background: var(--surface-3); color: var(--text); }
.nav-btn.active { background: var(--accent); color: var(--accent-ink); }
.nav-btn svg { flex: 0 0 19px; width: 19px; height: 19px; }
.side-bottom { margin-top: auto; padding: 14px 11px 0; border-top: 1px solid var(--line); }
.side-user { font-size: 13px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-email { margin-top: 3px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-column { min-width: 0; }
.topbar { height: 82px; padding: 0 clamp(24px,4.5vw,70px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-date { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: capitalize; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: var(--surface-3); font-weight: 750; font-size: 12px; color: var(--text); }
.content { width: min(1340px, 100%); margin: 0 auto; padding: 34px clamp(24px,4.5vw,70px) 85px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 0 0 30px; }
.eyebrow { margin: 0 0 10px; color: var(--accent-strong); font-size: 11px; font-weight: 850; letter-spacing: .15em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px,4vw,43px); line-height: 1.08; letter-spacing: -.055em; }
.page-sub { color: var(--muted); margin: 0; line-height: 1.5; font-size: 14px; }
h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.025em; margin-bottom: 4px; }
h3 { font-size: 15px; letter-spacing: -.015em; margin-bottom: 0; }
.section-sub { font-size: 12px; color: var(--muted); margin: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; }
.charts-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); margin-bottom: 20px; }
.bottom-grid { grid-template-columns: minmax(0, 1.5fr) minmax(240px, .75fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.stat-card { padding: 20px 22px; min-height: 143px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 680; }
.stat-icon { width: 30px; height: 30px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-strong); border-radius: 9px; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-value { font-size: clamp(25px,2.8vw,34px); font-weight: 780; letter-spacing: -.05em; line-height: 1; }
.stat-unit { font-size: 14px; font-weight: 550; letter-spacing: 0; color: var(--muted); }
.stat-foot { font-size: 11px; color: var(--muted); margin-top: 7px; }
.chart-card { padding: 22px 24px 16px; min-height: 296px; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.one-rm-card { grid-column: 1 / -1; }
.chart-exercise { width: min(230px, 100%); }
.chart-key { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.chart-key::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.chart-wrap { height: 209px; margin-top: 14px; }
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-average { fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-dasharray: 5 5; opacity: .85; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-bar { fill: var(--accent); }
.chart-empty { height: 205px; display: grid; place-items: center; color: var(--muted); text-align: center; font-size: 13px; }
.list-card { padding: 23px 24px; min-height: 220px; }
.list { display: grid; }
.list-row { min-width: 0; padding: 14px 0; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.list-row:first-child { border-top: 0; }
.row-main { min-width: 0; }
.row-title { font-size: 13px; font-weight: 740; margin: 0 0 4px; overflow-wrap: anywhere; }
.row-sub { font-size: 11px; color: var(--muted); margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.row-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row-value { font-size: 14px; font-weight: 750; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 9px; background: var(--surface-3); font-size: 10px; font-weight: 750; color: var(--muted); }
.pill.accent { color: var(--accent-ink); background: var(--accent); }
.feature-card { padding: 24px; background: linear-gradient(143deg, var(--surface), var(--surface-2)); }
.feature-art { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--accent); color: var(--accent-ink); margin-bottom: 22px; }
.feature-art svg { width: 25px; height: 25px; }
.feature-card p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 7px 0 17px; }
.daily-budget-card .budget-mini-value { margin-top: 16px; font-size: 28px; font-weight: 800; letter-spacing: -.05em; }
.daily-budget-card p { margin-bottom: 8px; }
.day-picker { display: flex; align-items: center; gap: 8px; margin: -4px 0 18px; }
.day-picker .input { width: 180px; text-align: center; }
.day-picker .button { min-width: 42px; font-size: 20px; padding-inline: 10px; }
.nutrition-summary { padding: 24px; display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 20px; margin-bottom: 17px; }
.budget-ring { position: relative; width: 160px; height: 160px; }
.budget-ring svg { width: 100%; height: 100%; }
.budget-ring-track, .budget-ring-progress { fill: none; stroke-width: 12; }
.budget-ring-track { stroke: var(--surface-3); }
.budget-ring-progress { stroke: var(--accent); stroke-linecap: round; }
.budget-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.budget-ring-label strong { font-size: 29px; letter-spacing: -.05em; }
.budget-ring-label span { color: var(--muted); font-size: 11px; }
.nutrition-summary-main h2 { font-size: clamp(22px,3vw,33px); margin-bottom: 3px; }
.macro-list { display: grid; gap: 12px; margin-top: 20px; }
.macro-progress-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 11px; }
.macro-progress-label span { color: var(--muted); }
.macro-progress progress { display: block; width: 100%; height: 7px; appearance: none; border: 0; border-radius: 8px; overflow: hidden; }
.macro-progress progress::-webkit-progress-bar { background: var(--surface-3); }
.macro-progress progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
.macro-progress progress::-moz-progress-bar { background: var(--accent); border-radius: 8px; }
.insights-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-bottom: 17px; }
.insight-card { min-width: 0; }
.insight-card .macro-list { margin-top: 13px; }
.insight-footer { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.insight-footer strong { display: block; font-size: 12px; margin-bottom: 4px; }
.insight-footer .row-sub { margin-top: 4px; }
.balance-grid { display: grid; gap: 20px; margin-top: 18px; }
.balance-value { display: block; font-size: 23px; letter-spacing: -.04em; margin-top: 5px; }
.balance-grid .row-sub { margin-top: 5px; }
.meal-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-bottom: 18px; }
.meal-group { padding: 22px; min-width: 0; }
.meal-group .section-heading { margin-bottom: 10px; }
.meal-group .section-heading .button { min-width: 40px; }
.meal-card { padding: 13px 0; border-top: 1px solid var(--line); }
.meal-card-top, .meal-card-bottom { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.meal-card-top strong { font-size: 13px; }
.meal-card-top .row-sub { margin-top: 4px; }
.meal-kcal { font-size: 13px; font-weight: 750; white-space: nowrap; }
.meal-card-bottom { align-items: center; margin-top: 7px; }
.meal-empty { color: var(--muted); font-size: 12px; margin: 0; padding: 16px 0; }
.quick-foods { display: flex; gap: 9px; flex-wrap: wrap; }
.quick-foods .button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.food-catalog { margin-top: 18px; }
.food-catalog .section-heading { flex-wrap: wrap; }
.food-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 13px; }
.food-search { display: flex; gap: 8px; min-width: min(100%,260px); flex: 1; }
.food-search .input { min-width: 0; flex: 1; }
.food-results { display: grid; }
.food-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); padding: 15px 0; }
.food-card:first-child { border-top: 0; }
.food-card .row-end { flex-wrap: wrap; justify-content: flex-end; }
.food-macros { color: var(--muted); font-size: 11px; margin: 6px 0 0; }
.selected-foods { display: grid; gap: 8px; }
.meal-item-row { display: grid; grid-template-columns: minmax(0,1fr) 110px 35px; align-items: end; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.meal-item-row strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.meal-search-box { margin-top: 16px; }
.meal-food-results { max-height: 220px; overflow: auto; border-top: 1px solid var(--line); margin-top: 9px; }
.meal-food-choice { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 10px 4px; }
.meal-food-choice strong { display: block; font-size: 12px; }
.meal-food-choice small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.meal-food-choice svg { width: 18px; height: 18px; color: var(--accent-strong); flex-shrink: 0; }
.form-error { color: var(--danger); font-size: 12px; line-height: 1.5; }
.form-help { color: var(--muted); font-size: 12px; margin: 16px 0 0; line-height: 1.5; }
.health-filter { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin: 24px 0 12px; }
.health-filter .section-heading { margin: 0; }
.health-filter .field { width: min(230px,100%); }
.health-timeline { display: grid; gap: 14px; }
.health-record { padding: 22px; min-width: 0; }
.health-record-top { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.health-record-top h3 { margin-top: 9px; font-size: 17px; overflow-wrap: anywhere; }
.health-record-meta { display: flex; align-items: center; gap: 9px; }
.health-note { color: var(--muted); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; margin: 13px 0 0; }
.health-lab-list { margin-top: 16px; border-top: 1px solid var(--line); }
.lab-result-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.lab-parameter { padding: 0; border: 0; background: transparent; color: var(--accent-strong); font-weight: 750; text-align: left; }
.status-in_range { background: #d7f3c4; color: #205c1a; }
.status-borderline { background: #ffefbc; color: #705113; }
.status-outside { background: #ffd9d4; color: #922b29; }
.status-unrated { background: var(--surface-3); color: var(--muted); }
.health-attachments { display: grid; margin-top: 13px; gap: 8px; }
.attachment-row { border: 1px solid var(--line); border-radius: 11px; padding: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachment-row strong { font-size: 12px; overflow-wrap: anywhere; }
.attachment-row .row-end { flex-wrap: wrap; justify-content: flex-end; }
.attachment-row .button { min-height: 34px; padding: 6px 9px; }
.lab-trend-card { margin-bottom: 18px; }
.lab-trend-card .field { width: min(230px,100%); }
.lab-input-list { display: grid; gap: 10px; }
.lab-input-row { display: grid; grid-template-columns: minmax(115px,1.4fr) repeat(4,minmax(55px,.7fr)) 35px; align-items: end; gap: 7px; padding: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.lab-input-row .field span { font-size: 10px; }
.lab-input-row .input { padding: 7px; min-height: 37px; }
.button { min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.button svg { width: 16px; height: 16px; }
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(.96); }
.button.secondary { background: var(--surface-3); color: var(--text); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.button.text { padding-inline: 0; background: transparent; color: var(--accent-strong); }
.button.danger { color: var(--danger); background: transparent; }
.icon-button { width: 35px; height: 35px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); display: grid; place-items: center; }
.icon-button:hover { color: var(--text); background: var(--surface-3); }
.icon-button svg { width: 17px; height: 17px; }
.empty-state { display: grid; justify-items: center; text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-symbol { width: 55px; height: 55px; border-radius: 17px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-strong); margin-bottom: 13px; }
.empty-symbol svg { width: 26px; height: 26px; }
.empty-state h3 { color: var(--text); margin-bottom: 5px; }
.empty-state p { font-size: 12px; max-width: 300px; line-height: 1.5; }
.table-head { display: grid; grid-template-columns: 1.1fr repeat(4, 1fr) 76px; gap: 10px; padding: 13px 18px; color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.table-row { display: grid; grid-template-columns: 1.1fr repeat(4, 1fr) 76px; gap: 10px; align-items: center; padding: 15px 18px; border-top: 1px solid var(--line); font-size: 12px; }
.table-row:first-child { border-top: 0; }
.table-row strong { font-weight: 750; }
.table-row .row-end { justify-content: flex-end; }
.wide-card { overflow: hidden; }
.record-cards { display: grid; gap: 12px; }
.record-card { padding: 17px 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.record-card .row-sub { margin-top: 5px; }
.record-details { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.record-details .pill { background: var(--surface-3); }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(245px, .8fr); gap: 18px; }
.section-card { padding: 24px; }
.section-card + .section-card { margin-top: 18px; }
.placeholder { min-height: 500px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; }
.placeholder-copy { padding: clamp(30px,5vw,66px); align-self: center; }
.placeholder h1 { max-width: 550px; }
.placeholder .lead { margin: 17px 0 27px; color: var(--muted); line-height: 1.6; max-width: 480px; }
.feature-list { list-style: none; padding: 0; margin: 23px 0 0; display: grid; gap: 15px; }
.feature-list li { display: flex; align-items: start; gap: 11px; font-size: 13px; }
.feature-list li::before { content: '✓'; width: 19px; height: 19px; flex: 0 0 19px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 850; }
.placeholder-visual { background: radial-gradient(circle at 70% 25%, rgba(200,244,92,.35), transparent 33%), linear-gradient(150deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; padding: 40px; }
.preview-card { width: min(290px,100%); height: 330px; background: var(--surface); border: 1px solid var(--line); border-radius: 25px; box-shadow: 0 30px 70px rgba(0,0,0,.15); padding: 26px; transform: rotate(4deg); }
.preview-line { height: 10px; border-radius: 50px; background: var(--surface-3); margin: 13px 0; }
.preview-line.short { width: 45%; }.preview-line.medium { width: 72%; }
.preview-block { margin-top: 24px; height: 95px; background: linear-gradient(140deg, var(--accent), var(--surface-3)); border-radius: 16px; opacity: .7; }
.preview-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 23px; }
.preview-dot { height: 38px; width: 38px; border-radius: 50%; background: var(--accent); }
.preview-row .preview-line { flex: 1; align-self: center; margin: 0; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.input, .select, .textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--input); color: var(--text); outline: 0; font-size: 13px; }
.textarea { resize: vertical; min-height: 82px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .7; }
.form-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.settings-aside { display: grid; gap: 18px; }
.password-card .field { margin-top: 14px; }
.password-card .form-actions .button { width: 100%; }
.privacy-card { padding: 23px; }
.privacy-card .feature-art { margin-bottom: 17px; }
.privacy-card p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 11px; gap: 2px; }
.segment { background: transparent; border: 0; border-radius: 8px; padding: 8px 13px; color: var(--muted); font-size: 12px; font-weight: 700; }
.segment.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.quick-fab { position: fixed; right: 27px; bottom: 25px; height: 54px; width: 54px; border: 0; border-radius: 18px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 11px 27px rgba(0,0,0,.2); display: grid; place-items: center; z-index: 10; }
.quick-fab svg { width: 24px; height: 24px; }
.mobile-nav { display: none; }

.modal-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(3, 9, 14, .68); padding: 20px; }
.modal { width: min(650px,100%); max-height: min(92vh,920px); overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 35px 100px rgba(0,0,0,.3); padding: 24px; }
.modal.small { width: min(450px,100%); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 20px; }
.modal-head h2 { font-size: 22px; }
.modal-open { overflow: hidden; }
.quick-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.quick-option { min-height: 95px; padding: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 14px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; font-weight: 750; }
.quick-option svg { color: var(--accent-strong); width: 21px; height: 21px; }
.quick-option:disabled { opacity: .55; }
.quick-option small { color: var(--muted); font-size: 10px; font-weight: 500; }
.set-list { display: grid; gap: 10px; margin-top: 12px; }
.set-row { display: grid; grid-template-columns: minmax(150px,1.5fr) repeat(3,minmax(62px,.58fr)) 35px; gap: 8px; align-items: end; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.set-row .field label { font-size: 10px; }
.set-row .input, .set-row .select { padding: 8px; min-height: 38px; }
.set-row .icon-button { margin-bottom: 2px; }
.modal-divider { margin: 22px 0 16px; border: 0; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 26px; transform: translate(-50%,130px); min-width: 180px; max-width: min(90vw,450px); text-align: center; padding: 12px 17px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 13px; font-weight: 650; opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(28px,5vw,72px); background: #0d1420; color: #eff8ee; }
.login-visual::before { content: ''; position: absolute; width: 640px; height: 640px; border: 1px solid rgba(200,244,92,.25); border-radius: 50%; top: 4%; left: 24%; box-shadow: 0 0 0 90px rgba(200,244,92,.025), 0 0 0 200px rgba(200,244,92,.025); }
.login-visual::after { content: ''; position: absolute; width: 400px; height: 400px; right: -130px; bottom: -170px; border-radius: 50%; background: #c8f45c; filter: blur(130px); opacity: .13; }
.login-visual > * { position: relative; z-index: 1; }
.login-visual .brand { padding: 0; width: fit-content; }
.login-visual .brand-mark { background: #c8f45c; color: #14210a; }
.login-visual .brand-tagline { color: #9cafa7; }
.login-claim { max-width: 700px; }
.login-claim .eyebrow { color: #c8f45c; }
.login-claim h1 { font-size: clamp(45px,6.3vw,86px); line-height: .99; max-width: 740px; margin-bottom: 23px; }
.login-claim p:last-child { color: #a8bbb3; max-width: 420px; font-size: 15px; line-height: 1.7; }
.login-graphic { height: 140px; display: flex; align-items: center; overflow: hidden; color: #c8f45c; opacity: .9; }
.login-graphic svg { width: 100%; height: 120px; }
.login-panel { display: grid; place-items: center; padding: 35px; }
.login-box { width: min(380px,100%); }
.login-box .eyebrow { margin-bottom: 14px; }
.login-box h2 { font-size: 35px; letter-spacing: -.05em; margin-bottom: 12px; }
.login-box .page-sub { margin-bottom: 32px; }
.login-box .field { margin-bottom: 16px; }
.login-box .button { width: 100%; min-height: 48px; margin-top: 11px; }
.login-error { color: var(--danger); font-size: 12px; margin: 0 0 12px; }
.setup-hint { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }

@media (max-width: 1150px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .charts-grid, .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
  .insights-grid { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 66px; padding: 0 22px; }
  .content { padding: 25px 20px 128px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5,1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; min-height: 71px; padding: 7px 6px max(8px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .mobile-nav .nav-btn { min-height: 50px; padding: 5px 2px; border-radius: 10px; flex-direction: column; justify-content: center; gap: 4px; font-size: 10px; text-align: center; }
  .mobile-nav .nav-btn svg { flex-basis: 19px; }
  .quick-fab { right: 18px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .settings-grid, .split-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nutrition-summary { grid-template-columns: 1fr; justify-items: center; gap: 7px; padding: 20px; }
  .nutrition-summary-main { width: 100%; }
  .meal-groups { grid-template-columns: 1fr; gap: 10px; }
  .meal-group { padding: 17px; }
  .food-toolbar { align-items: stretch; }
  .food-toolbar .food-search { flex-basis: 100%; }
  .food-card { align-items: stretch; flex-direction: column; gap: 9px; }
  .food-card .row-end { justify-content: flex-start; }
  .health-filter { align-items: stretch; flex-direction: column; }
  .health-filter .field { width: 100%; }
  .health-record { padding: 17px; }
  .lab-trend-card .chart-title { flex-direction: column; align-items: stretch; }
  .lab-trend-card .field { width: 100%; }
  .attachment-row { align-items: stretch; flex-direction: column; }
  .attachment-row .row-end { justify-content: flex-start; }
  .lab-input-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .lab-input-row .field:first-child { grid-column: 1 / -1; }
  .lab-input-row .icon-button { justify-self: end; }
  .one-rm-card .chart-title { align-items: stretch; flex-direction: column; }
  .page-heading { align-items: start; margin-bottom: 22px; }
  .page-heading .button { font-size: 0; width: 42px; height: 42px; padding: 0; flex: 0 0 42px; }
  .page-heading .button svg { width: 18px; height: 18px; }
  .stats-grid { gap: 10px; margin-bottom: 11px; }
  .stat-card { min-height: 130px; padding: 16px; border-radius: 16px; }
  .stat-icon { width: 27px; height: 27px; }
  .stat-value { font-size: 26px; }
  .grid { gap: 11px; }
  .chart-card, .list-card, .section-card { padding: 19px; border-radius: 17px; }
  .chart-card { min-height: 270px; }
  .table-head { display: none; }
  .table-row { grid-template-columns: 1fr auto; gap: 8px; }
  .table-row .table-secondary { display: none; }
  .table-row .row-end { grid-column: 2; grid-row: 1; }
  .record-card { align-items: start; }
  .placeholder { grid-template-columns: 1fr; min-height: auto; }
  .placeholder-copy { padding: 32px 26px; }
  .placeholder-visual { min-height: 200px; }
  .preview-card { width: 220px; height: 220px; transform: rotate(5deg) translateY(45px); }
  .preview-block { height: 50px; }
  .modal-layer { align-items: end; padding: 0; }
  .modal, .modal.small { width: 100%; max-height: 93vh; border-radius: 22px 22px 0 0; padding: 22px 20px max(23px,env(safe-area-inset-bottom)); }
  .set-row { grid-template-columns: repeat(3,minmax(0,1fr)) 35px; }
  .set-row .field.exercise-field { grid-column: 1 / -1; }
  .set-row .field:nth-child(2) { grid-column: 1; }
  .set-row .icon-button { grid-column: 4; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 270px; padding: 25px; }
  .login-visual::before { width: 350px; height: 350px; left: 35%; }
  .login-visual .brand-tagline, .login-claim p:last-child, .login-graphic { display: none; }
  .login-claim h1 { font-size: 38px; margin: 0; }
  .login-panel { align-items: start; padding: 33px 25px; }
  .login-box h2 { font-size: 29px; }
}
@media (max-width: 420px) {
  .settings-grid .field-grid { grid-template-columns: 1fr; }
  .food-catalog .section-heading { align-items: start; }
  .food-catalog .section-heading .row-end { flex-wrap: wrap; justify-content: flex-start; }
  .lab-result-row { grid-template-columns: minmax(0,1fr) auto; }
  .lab-result-row .pill { grid-column: 2; justify-self: end; }
  .meal-item-row { grid-template-columns: minmax(0,1fr) 82px 35px; }
  .meal-item-row .input { padding-inline: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
