:root {
  --ink: #17241e;
  --muted: #68766e;
  --line: #dce5de;
  --paper: #f5f8f5;
  --card: #ffffff;
  --green: #246347;
  --green-dark: #194b35;
  --mint: #dff1e5;
  --mint-soft: #eef8f1;
  --gold: #dfa94d;
  --danger: #a14040;
  --shadow: 0 14px 35px rgba(31, 58, 42, 0.065);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(36, 99, 71, .28);
  outline-offset: 3px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(36px, 4vw, 48px); line-height: 0.98; letter-spacing: -0.055em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.025em; }
h3 { margin: 0; font-size: 14px; }

.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; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }

.topbar { height: 72px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1448px, 100%); height: 100%; margin: 0 auto; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 780; letter-spacing: -0.04em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: #fff; font-size: 18px; }
.topbar-user { display: flex; align-items: center; gap: 20px; color: var(--muted); font-size: 13px; }
.theme-toggle-form { margin: 0; display: flex; }
.theme-toggle-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--green); cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.theme-toggle-button:hover { border-color: var(--green); background: var(--mint); transform: translateY(-1px); }
.theme-toggle-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logout-form { display: inline; }
.logout-form button { padding: 0; border: 0; background: none; color: var(--green); font: inherit; font-weight: 650; cursor: pointer; }

.app-shell { width: min(1448px, 100%); min-height: calc(100vh - 72px); margin: 0 auto; display: flex; }
.sidebar { width: 228px; flex: 0 0 228px; padding: 28px 18px; display: flex; flex-direction: column; gap: 5px; border-right: 1px solid var(--line); }
.nav-item { padding: 12px 15px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 650; }
.nav-item.active, .nav-item:hover { background: var(--mint); color: var(--green); }
.sidebar-bottom { margin-top: auto; }
.main-content { width: min(1220px, calc(100% - 228px)); padding: 42px 48px 70px; }

.messages { margin-bottom: 18px; }
.message { padding: 12px 15px; border: 1px solid #bfdbc8; border-radius: 10px; background: var(--mint-soft); color: var(--green-dark); font-size: 13px; }
.message--error { border-color: #e0bcbc; background: #fff2f2; color: #7f3434; }
.message--warning { border-color: #e7d3a7; background: #fff8e8; color: #77571d; }
.undo-banner { margin-bottom: 12px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #bfd9c6; border-radius: 11px; background: var(--mint-soft); color: var(--green-dark); font-size: 12px; }
.undo-banner form { margin: 0; }
.undo-banner button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 8px; background: var(--green); color: #fff; cursor: pointer; font-weight: 800; }

.page-heading { margin-bottom: 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading .muted { margin-bottom: 0; }
.dashboard-hero { margin-bottom: 18px; display: grid; grid-template-columns: minmax(270px, .86fr) minmax(390px, 1.3fr) minmax(285px, .9fr); gap: 14px; align-items: stretch; }
.dashboard-hero > * { min-width: 0; }
.dashboard-hero > .dashboard-weight-card, .dashboard-hero > .dashboard-activity-card { padding: 18px; }
.dashboard-hero > .dashboard-weight-card { display: flex; flex-direction: column; }
.dashboard-hero > .dashboard-weight-card > :last-child { margin-top: auto; }
.mobile-date-picker, .dashboard-date-context { display: none; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.form-heading { align-items: flex-start; }
.narrow-page { width: min(760px, 100%); margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 28px; color: var(--green); font-size: 13px; font-weight: 700; }

.button { min-height: 42px; padding: 11px 17px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 760; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--mint); color: var(--green); }
.button.quiet { background: transparent; color: var(--muted); }
.text-link { color: var(--green); font-size: 12px; font-weight: 750; }

.metric-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel, .food-table { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.metric-card { padding: 20px; border-top: 3px solid var(--green); }
.metric-label { display: flex; justify-content: space-between; gap: 10px; }
.metric-label p, .metric-label span { margin: 0 0 18px; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; font-size: 24px; letter-spacing: -0.04em; }
.metric-card small { color: var(--muted); font-size: 12px; font-weight: 550; letter-spacing: 0; }
.metric-card small.metric-target-adjusted { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 750; }
.metric-activity-indicator { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); vertical-align: middle; }
.metric-activity-indicator svg { width: 11px; height: 11px; fill: currentColor; }
.metric-card > span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.progress-track { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: #ebf0ec; }
.progress-track span { height: 100%; display: block; border-radius: inherit; background: var(--green); }
.accent .progress-track span { background: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { padding: 24px; }
.panel-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.status-pill, .count-label { padding: 6px 10px; border-radius: 99px; background: #fff3d9; color: #8a6528; font-size: 10px; font-weight: 750; white-space: nowrap; }
.side-stack { display: grid; gap: 18px; }

.dashboard-weight-card { border-top: 3px solid var(--green); }
.dashboard-calendar { border-top: 3px solid var(--green); }
.dashboard-hero .panel-heading, .dashboard-hero .calendar-heading { min-height: 28px; align-items: center; }
.dashboard-hero .panel-heading h2, .dashboard-hero .calendar-heading h2 { margin: 0; font-size: 18px; line-height: 1.2; }
.dashboard-weight-stats { margin: 12px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-weight-stats > div { min-width: 0; padding: 0 10px; border-left: 1px solid var(--line); }
.dashboard-weight-stats > div:first-child { padding-left: 0; border-left: 0; }
.dashboard-weight-stats > div:last-child { padding-right: 0; }
.dashboard-weight-stats span, .dashboard-weight-stats strong { display: block; }
.dashboard-weight-stats span { margin-bottom: 6px; color: var(--muted); font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-weight-stats strong { font-size: 16px; white-space: nowrap; }
.dashboard-weight-stats small { color: var(--muted); font-size: 9px; }
.dashboard-weight-chart { height: 66px; margin: -6px 0 2px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: linear-gradient(180deg, rgba(238, 248, 241, .72), rgba(255, 255, 255, 0)); }
.dashboard-weight-chart svg { width: 100%; height: 64px; display: block; overflow: visible; }
.dashboard-weight-chart-axis { fill: none; stroke: #bfcfc3; stroke-width: 1; }
.dashboard-weight-chart-guide { fill: none; stroke: #e1e9e3; stroke-width: 1; }
.dashboard-weight-chart-line { fill: none; stroke: var(--green); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-weight-chart-point { fill: #fff; stroke: var(--green); stroke-width: 2; }
.dashboard-weight-chart-bound, .dashboard-weight-chart-day { fill: var(--muted); font-family: inherit; font-size: 6.5px; font-weight: 650; }
.dashboard-weight-chart-bound { text-anchor: end; dominant-baseline: middle; }
.dashboard-weight-chart-day { text-anchor: middle; }
.dashboard-weight-chart p { margin: 0; color: var(--muted); font-size: 8px; }
.dashboard-weight-form { padding-top: 15px; border-top: 1px solid var(--line); }
.dashboard-weight-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 750; }
.dashboard-weight-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.dashboard-weight-form input { min-width: 0; width: 100%; padding: 10px 11px; border: 1px solid #bfcfc3; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.dashboard-weight-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.weight-logged-state { padding: 12px; display: flex; align-items: center; gap: 10px; border-radius: 10px; background: var(--mint-soft); color: var(--green-dark); }
.weight-logged-state > span { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; border-radius: 50%; background: var(--green); color: #fff; font-size: 12px; }
.weight-logged-state p, .weight-logged-state strong, .weight-logged-state small { margin: 0; display: block; }
.weight-logged-state strong { font-size: 10px; }
.weight-logged-state small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.dashboard-weight-away { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

.dashboard-activity-card { display: flex; flex-direction: column; border-top: 3px solid var(--green); }
.dashboard-training-shortcuts { padding-top: 10px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.dashboard-training-shortcuts > span { margin-right: auto; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-training-shortcuts a { padding: 6px 8px; border-radius: 7px; background: var(--mint); color: var(--green); font-size: 9px; font-weight: 750; }
.dashboard-training-shortcuts small { color: var(--muted); font-size: 8px; }
.activity-today-summary { margin: 13px 0 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.activity-today-summary > span { min-width: 0; padding: 0 9px; border-left: 1px solid var(--line); }
.activity-today-summary > span:first-child { padding-left: 0; border-left: 0; }
.activity-today-summary > span:last-child { padding-right: 0; }
.activity-today-summary strong, .activity-today-summary small { display: block; }
.activity-today-summary strong { font-size: 15px; white-space: nowrap; }
.activity-today-summary small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.3; }
.dashboard-activity-forms { min-height: 0; padding-top: 10px; display: flex; flex: 1; flex-direction: column; gap: 9px; border-top: 1px solid var(--line); }
.dashboard-activity-forms form > p { margin: 0 0 5px; color: var(--muted); font-size: 9px; font-weight: 750; }
.activity-quick-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 42px; gap: 5px; align-items: end; }
.activity-quick-fields label span { margin-bottom: 4px; display: block; color: var(--muted); font-size: 8px; }
.activity-quick-fields input, .activity-quick-fields select, .dashboard-steps-form input { min-width: 0; width: 100%; height: 34px; padding: 7px; border: 1px solid #bfcfc3; border-radius: 8px; background: #fff; color: var(--ink); outline: none; font-size: 10px; }
.activity-quick-fields input:focus, .activity-quick-fields select:focus, .dashboard-steps-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.activity-quick-fields .button, .dashboard-steps-form .button { min-height: 34px; height: 34px; padding: 7px 9px; }
.activity-quick-fields .button { width: 100%; grid-column: auto; }
.dashboard-steps-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.activity-step-logged { margin-top: auto; }

.weight-stat-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.weight-stat-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.weight-stat-card.accent { border-top: 3px solid var(--green); }
.weight-stat-card > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.weight-stat-card strong { margin-top: 15px; display: block; font-size: 27px; letter-spacing: -0.04em; }
.weight-stat-card strong small { color: var(--muted); font-size: 12px; letter-spacing: 0; }
.weight-stat-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.weight-up { color: #8d4949; }
.weight-down { color: #4d527f; }
.weight-page-grid { display: grid; grid-template-columns: minmax(250px, 0.62fr) minmax(0, 1.38fr); gap: 18px; align-items: start; }
.weight-actions-stack { display: grid; gap: 18px; }
.weight-chart-panel { margin-bottom: 18px; overflow: hidden; }
.weight-chart-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 9px; font-weight: 700; }
.weight-chart-legend span { display: flex; align-items: center; gap: 5px; }
.weight-chart-legend i { width: 15px; height: 4px; display: inline-block; border-radius: 99px; }
.weight-chart-legend .calorie-key { background: var(--gold); opacity: .62; }
.weight-chart-legend .raw-weight-key { width: 8px; height: 8px; border: 2px solid var(--green); background: #fff; }
.weight-chart-legend .trend-key { height: 0; border-top: 2px solid #6f9b82; border-radius: 0; background: transparent; }
.weight-chart-legend .projection-key { height: 0; border-top: 2px dashed #3f6f58; border-radius: 0; background: transparent; }
.weight-chart-legend .medication-key { background: #7b4fa3; }
.weight-chart-toolbar { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.weight-chart-reset { min-width: 74px; height: 34px; padding: 0 11px; border: 1px solid #bfd0c3; border-radius: 8px; background: #fff; color: var(--green); font: inherit; font-size: 9px; font-weight: 800; cursor: pointer; }
.weight-chart-reset:hover:not(:disabled), .weight-chart-reset:focus-visible { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(36, 99, 71, .1); }
.weight-chart-reset:disabled { opacity: .42; cursor: default; }
.weight-chart-toolbar output { color: var(--ink); font-size: 10px; font-weight: 750; }
.weight-chart-toolbar p { margin: 0 0 0 auto; color: var(--muted); font-size: 9px; }
.weight-chart-scroll { margin-top: 18px; overflow-x: auto; }
.weight-chart-stage { position: relative; min-width: 620px; }
.weight-chart { width: 100%; height: auto; display: block; overflow: visible; cursor: crosshair; touch-action: pan-y; user-select: none; }
.weight-chart:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.weight-chart.is-panning { cursor: grabbing; }
.chart-interaction-surface { fill: transparent; pointer-events: all; }
.chart-zoom-selection { fill: rgba(36, 99, 71, .14); stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 5 3; pointer-events: none; }
.chart-grid-line { stroke: #e5ebe6; stroke-width: 1; }
.chart-axis-label, .chart-date-label, .chart-axis-title { fill: var(--muted); font-family: inherit; font-size: 9px; }
.chart-axis-label { dominant-baseline: middle; }
.chart-axis-label-left { text-anchor: end; }
.chart-axis-label-right { text-anchor: start; }
.chart-axis-title { font-size: 8px; font-weight: 800; text-transform: uppercase; }
.chart-axis-title-right { text-anchor: end; }
.chart-date-label { text-anchor: middle; }
.calorie-bar { fill: var(--gold); opacity: .58; cursor: inherit; outline: none; }
.calorie-trend-line { fill: none; stroke: #9c6a1c; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.weight-chart-legend .calorie-trend-key { height: 0; border-top: 2px solid #9c6a1c; border-radius: 0; background: transparent; }
.medication-icon { fill: none; stroke: #7b4fa3; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.medication-hit-target { fill: var(--card); stroke: var(--line); cursor: pointer; }
.medication-annotation:hover .medication-hit-target, .medication-annotation:focus .medication-hit-target { stroke: var(--green); }
.theme-dark .calorie-trend-line { stroke: #e1bd80; }
.theme-dark .weight-chart-legend .calorie-trend-key { border-top-color: #e1bd80; }
.theme-dark .medication-icon { stroke: #bd91e2; }
.calorie-bar:hover, .calorie-bar:focus { opacity: .9; stroke: #b88425; stroke-width: 1.5; }
.chart-tooltip { position: absolute; z-index: 5; width: max-content; max-width: 230px; padding: 9px 11px; border: 1px solid #cbd7ce; border-radius: 8px; background: rgba(255, 255, 255, .98); color: var(--ink); box-shadow: 0 8px 22px rgba(31, 58, 42, .18); pointer-events: none; }
.chart-tooltip strong, .chart-tooltip span, .chart-tooltip small { display: block; }
.chart-tooltip strong { margin-bottom: 4px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.chart-tooltip span { font-size: 12px; font-weight: 800; }
.chart-tooltip small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.chart-tooltip-row { margin-top: 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.chart-tooltip-row span { color: var(--muted); font-size: 8px; font-weight: 700; }
.chart-tooltip-row b { font-size: 10px; white-space: nowrap; }
.chart-crosshair { stroke: #789586; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.weight-point { fill: #fff; stroke: var(--green); stroke-width: 2.5; }
.weight-point:focus, .projection-point:focus, .medication-annotation:focus { outline: none; filter: drop-shadow(0 0 3px rgba(36, 99, 71, .55)); }
.weight-point-outlier { stroke: #a56a46; stroke-dasharray: 2 1; }
.weight-trend-line { fill: none; stroke: #6f9b82; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.weight-projection-line { fill: none; stroke: #3f6f58; stroke-width: 2.5; stroke-dasharray: 4 5; }
.projection-point { fill: #fff; stroke: #3f6f58; stroke-width: 2; }
.projection-boundary { stroke: #aac0b1; stroke-width: 1; stroke-dasharray: 2 5; }
.projection-label { fill: #769181; font-family: inherit; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.medication-label { fill: #6d4898; font-family: inherit; font-size: 9px; font-weight: 800; }
.medication-arrow-line { stroke: #8e66b2; stroke-width: 1.5; stroke-dasharray: 3 3; }
.medication-arrow-head { fill: none; stroke: #8e66b2; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-note { margin: 8px 0 0; color: var(--muted); font-size: 9px; }
.chart-projection-note { padding-top: 8px; border-top: 1px solid var(--line); line-height: 1.55; }
.weight-log-panel h2, .medication-log-panel h2 { font-size: 18px; }
.weight-log-panel .muted, .medication-log-panel .muted { margin: 8px 0 0; font-size: 11px; }
.weight-log-form { margin-top: 20px; display: grid; gap: 8px; }
.weight-log-form label { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 750; }
.weight-log-form label small { font-weight: 500; }
.weight-log-form input { width: 100%; padding: 11px 12px; border: 1px solid #c5d2c8; border-radius: 8px; color: var(--ink); outline: none; }
.weight-log-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.weight-log-form .button { margin-top: 8px; }
.medication-log-form { margin-top: 20px; display: grid; gap: 8px; }
.medication-log-form > label, .medication-dose-fields label { color: var(--muted); font-size: 10px; font-weight: 750; }
.medication-log-form label small { font-weight: 500; }
.medication-log-form input, .medication-log-form select { width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid #c5d2c8; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.medication-log-form input:focus, .medication-log-form select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.medication-dose-fields { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; }
.medication-log-form .button { margin-top: 8px; }
.medication-history { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.medication-history h3 { margin-bottom: 8px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.medication-history-row { padding: 8px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.medication-history-row:first-of-type { border-top: 0; }
.medication-history strong, .medication-history small { display: block; }
.medication-history strong { font-size: 10px; }
.medication-history small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.medication-history time { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.medication-delete { margin-right: 0; }
.weight-history-list { margin-top: 17px; }
.weight-history-row { padding: 12px 2px; display: grid; grid-template-columns: minmax(0, 1fr) 95px 75px; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.weight-history-row:first-child { border-top: 0; }
.weight-history-row > div strong, .weight-history-row > div small { display: block; }
.weight-history-row > div strong { font-size: 12px; }
.weight-history-row > div span { margin-left: 6px; padding: 2px 5px; border-radius: 99px; background: var(--mint); color: var(--green); font-size: 8px; font-weight: 800; }
.weight-history-row > div small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.weight-history-row > strong { text-align: right; font-size: 12px; }
.weight-history-row > span { color: var(--muted); font-size: 10px; text-align: right; }

.activity-page-grid, .activity-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.activity-history-grid { margin-top: 18px; }
.activity-log-panel h2 { font-size: 18px; }
.activity-log-panel > .muted { margin: 8px 0 0; font-size: 11px; }
.activity-log-form { margin-top: 20px; }
.activity-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.activity-form-grid label { color: var(--muted); font-size: 10px; font-weight: 750; }
.activity-form-grid label > span { margin-bottom: 6px; display: block; }
.activity-form-grid label small { font-weight: 500; }
.activity-form-grid input, .activity-form-grid select { width: 100%; padding: 11px 12px; border: 1px solid #c5d2c8; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.activity-form-grid input:focus, .activity-form-grid select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.activity-wide-field { grid-column: 1 / -1; }
.activity-log-form > .button { margin-top: 14px; }
.activity-history-list { margin-top: 14px; }
.activity-history-row { padding: 5px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; border-top: 1px solid var(--line); }
.activity-history-row:first-child { border-top: 0; }
.activity-history-row strong, .activity-history-row small { display: block; }
.activity-history-row strong { font-size: 11px; }
.activity-history-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.activity-history-row .activity-pace { color: var(--green); font-weight: 750; }
.activity-history-row .activity-calories { color: #a4681e; font-weight: 750; }
.activity-history-row time { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.activity-history-entry { min-width: 0; width: 100%; padding: 8px 7px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.activity-history-entry:hover, .activity-history-entry:focus-visible { background: var(--mint-soft); outline: none; }
.activity-history-entry time { padding-top: 1px; }
.activity-delete { align-self: center; }
.activity-inline-edit { grid-column: 1 / -1; padding: 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; border: 1px solid #bcd4c3; border-radius: 9px; background: var(--mint-soft); }
.activity-inline-fields { display: grid; gap: 8px; align-items: end; }
.activity-inline-cardio-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.activity-inline-step-fields { grid-template-columns: .8fr 1fr; }
.activity-inline-note { grid-column: 1 / -1; }
.activity-inline-fields label { color: var(--muted); font-size: 9px; font-weight: 750; }
.activity-inline-fields input, .activity-inline-fields select { width: 100%; margin-top: 5px; padding: 8px 9px; border: 1px solid #bfcfc3; border-radius: 7px; background: #fff; color: var(--ink); outline: none; font-size: 10px; }
.activity-inline-fields input:focus, .activity-inline-fields select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.activity-inline-actions { display: flex; gap: 5px; }
.activity-inline-actions button { width: 37px; height: 37px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; cursor: pointer; font-size: 18px; }
.activity-inline-edit .confirm-action { background: var(--green); color: #fff; }
.activity-inline-edit .confirm-action:hover { background: var(--green-dark); }
.activity-inline-edit .cancel-action { background: #f9eaea; color: var(--danger); }
.activity-inline-edit .cancel-action:hover { background: #f2dada; }

.calendar-panel { padding: 20px; }
.dashboard-calendar { min-width: 0; padding: 18px 20px; }
.dashboard-calendar .diary-calendar { margin-top: 10px; }
.dashboard-calendar .calendar-day > a, .dashboard-calendar .calendar-day > span { min-height: 27px; aspect-ratio: auto; }
.dashboard-calendar .calendar-legend { margin-top: 9px; }
.calendar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-month-nav { display: flex; align-items: center; gap: 4px; }
.calendar-month-nav a, .calendar-month-nav > span { min-width: 30px; height: 30px; padding: 0 7px; display: grid; place-items: center; border-radius: 8px; background: var(--paper); color: var(--green); font-size: 12px; font-weight: 800; }
.calendar-month-nav a:hover { background: var(--mint); }
.calendar-month-nav > span { color: #bdc6c0; }
.calendar-month-nav .calendar-today { width: auto; padding: 0 9px; font-size: 10px; }
.diary-calendar { width: 100%; margin-top: 14px; table-layout: fixed; border-spacing: 4px; }
.diary-calendar th { padding-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 750; text-align: center; }
.calendar-day { padding: 0; text-align: center; }
.calendar-day > a, .calendar-day > span { position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; color: var(--ink); font-size: 10px; font-weight: 750; }
.calendar-day > a:hover { transform: translateY(-1px); box-shadow: 0 3px 9px rgba(31, 58, 42, 0.13); }
.calendar-day--no-data > a, .calendar-day--no-data > span { background: #edf0ee; color: #7d8981; }
.calendar-day--under-target > a, .calendar-day--under-target > span { background: #eee6f8; color: #6d4898; }
.calendar-day--on-target > a, .calendar-day--on-target > span { background: #dcefe2; color: var(--green-dark); }
.calendar-day--over-target > a, .calendar-day--over-target > span { background: #f5dddd; color: #933b3b; }
.calendar-day--logged > a, .calendar-day--logged > span { background: #fff0cf; color: #896324; }
.calendar-day--planned > a, .calendar-day--planned > span { background: #e5edf7; color: #426282; }
.calendar-day--future > a, .calendar-day--future > span { background: #f7f8f7; color: #aeb9b1; }
.calendar-day.is-outside { opacity: 0.34; }
.calendar-day.is-selected > a, .calendar-day.is-selected > span { box-shadow: inset 0 0 0 2px var(--ink); }
.calendar-day.is-today > a::after, .calendar-day.is-today > span::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.calendar-alcohol-icon { position: absolute; bottom: 2px; left: 3px; width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.calendar-legend { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px 11px; color: var(--muted); font-size: 8px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 4px; }
.calendar-legend i { width: 8px; height: 8px; display: inline-block; border-radius: 3px; }
.mobile-date-picker { align-items: center; gap: 8px; }
.mobile-date-picker > a { width: 44px; height: 44px; display: grid; flex: 0 0 44px; place-items: center; border-radius: 10px; background: var(--paper); color: var(--green); font-weight: 800; }
.mobile-date-picker form { min-width: 0; flex: 1; }
.mobile-date-picker input { width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid #c7d4ca; border-radius: 10px; background: #fff; color: var(--ink); }
.dashboard-date-context { padding: 10px 12px; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.dashboard-date-context div { min-width: 0; }
.dashboard-date-context strong, .dashboard-date-context span { display: block; }
.dashboard-date-context strong { font-size: 13px; }
.dashboard-date-context span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.dashboard-date-context a { flex: 0 0 auto; color: var(--green); font-size: 11px; font-weight: 750; }
.legend-no-data { background: #dfe4e0; }
.legend-under { background: #cbb7e4; }
.legend-target { background: #9ecfac; }
.legend-over { background: #dfa5a5; }
.legend-logged { background: #edca7e; }
.legend-planned { background: #aac1dd; }

.meal-list { margin-top: 22px; }
.diary-panel { border-top: 3px solid var(--green); }
.diary-panel > .meal-list { margin-top: 0; }
.meal-section { padding: 20px 0; border-top: 1px solid var(--line); }
.meal-section:first-child { border-top: 0; padding-top: 2px; }
.meal-heading { margin-bottom: 8px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-left: 4px solid var(--green); border-radius: 8px; background: #f1f6f2; }
.meal-heading h3 { font-size: 15px; font-weight: 800; }
.meal-heading-nutrients { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.meal-heading-nutrients > strong { color: var(--green-dark); font-size: 11px; font-weight: 750; white-space: nowrap; }
.meal-heading .meal-macro-list { gap: 4px; }
.meal-heading .meal-macro-list > span { padding: 2px 5px; }
.meal-empty { margin: 10px 0 0; color: #9aa59e; font-size: 12px; }
.diary-row { margin: 8px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; align-items: center; overflow: hidden; border: 1px solid #e0e8e2; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(28, 57, 42, .035); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.diary-row:hover { border-color: #c7dacd; box-shadow: 0 5px 15px rgba(28, 57, 42, .075); transform: translateY(-1px); }
.diary-entry-link { padding: 13px 8px 13px 14px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(180px, .8fr); gap: 16px; align-items: center; }
.diary-entry-summary { min-width: 0; }
.diary-food-name { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 800; line-height: 1.35; text-overflow: ellipsis; }
.diary-portion { width: fit-content; margin-top: 7px; padding: 3px 7px; display: inline-flex; border-radius: 6px; background: #f1f4f2; color: #6d7a72; font-size: 9px; font-weight: 700; line-height: 1.2; }
.diary-nutrients { display: flex; align-items: flex-end; flex-direction: column; gap: 7px; text-align: right; }
.diary-calories { padding: 4px 8px; display: inline-flex; border-radius: 7px; background: var(--mint); color: var(--green-dark); font-size: 12px; font-weight: 850; line-height: 1.2; }
.diary-macro-list { display: flex; justify-content: flex-end; gap: 5px; color: var(--muted); font-size: 9px; }
.diary-macro-list > span { padding: 3px 6px; display: inline-flex; align-items: center; gap: 3px; border: 1px solid #e4eae6; border-radius: 6px; background: #fafcfb; white-space: nowrap; }
.diary-macro-list b { color: var(--green); font-size: 8px; font-weight: 850; }
.diary-delete { margin-right: 6px; display: flex; align-items: center; justify-content: flex-end; }
.diary-delete button { width: 34px; height: 34px; padding: 8px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #9baaa1; cursor: pointer; }
.diary-delete button:hover { background: #f9eaea; color: var(--danger); }
.diary-delete svg { width: 16px; height: 16px; fill: currentColor; }
.diary-delete-actions { display: flex; gap: 4px; }
.diary-delete .confirm-action, .diary-inline-edit .confirm-action { background: var(--green); color: #fff; }
.diary-delete .confirm-action:hover, .diary-inline-edit .confirm-action:hover { background: var(--green-dark); color: #fff; }
.diary-delete .cancel-action, .diary-inline-edit .cancel-action { background: #f9eaea; color: var(--danger); }
.diary-delete .cancel-action:hover, .diary-inline-edit .cancel-action:hover { background: #f2dada; color: var(--danger); }
.diary-inline-edit { grid-column: 1 / -1; margin: 5px; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 12px; align-items: end; border: 1px solid #bcd4c3; border-radius: 9px; background: var(--mint-soft); }
.diary-inline-edit-name small, .diary-inline-edit-name strong, .diary-inline-edit-name span { display: block; }
.diary-inline-edit-name small { margin-bottom: 3px; color: var(--green); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.diary-inline-edit-name strong { font-size: 13px; }
.diary-inline-edit-name span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.diary-inline-edit label { color: var(--muted); font-size: 10px; font-weight: 750; }
.diary-inline-edit input { width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #bfcfc3; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.diary-inline-edit input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.diary-inline-edit-actions { display: flex; gap: 5px; }
.diary-inline-edit-actions button { width: 39px; height: 39px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; cursor: pointer; font-size: 18px; }
.meal-actions { margin-top: 8px; display: flex; align-items: center; gap: 7px; }
.meal-action-icon { width: 33px; height: 33px; padding: 0; display: inline-grid; flex: 0 0 33px; place-items: center; border: 1px solid #d8e5dc; border-radius: 8px; background: #f7faf8; color: var(--green); cursor: pointer; line-height: 1; }
.meal-action-icon:hover { border-color: #bcd2c3; background: var(--mint); color: var(--green-dark); }
.meal-action-icon:focus-visible { outline: 3px solid rgba(36, 99, 71, .15); outline-offset: 2px; }
.meal-action-icon.is-open { border-color: #d0d8d2; background: #e7ebe8; color: #5c6961; }
.meal-control-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.meal-control-icon--close { display: none; }
.meal-add-link.is-open .meal-control-icon--add { display: none; }
.meal-add-link.is-open .meal-control-icon--close { display: block; }
.meal-inline-search { max-width: 560px; margin: 5px 0 8px; padding: 10px; border: 1px solid #c8dbce; border-radius: 11px; background: var(--mint-soft); }
.meal-search-bar { display: flex; align-items: center; gap: 7px; }
.meal-search-input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid #bfcfc3; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.meal-search-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.meal-create-food { flex: 0 0 auto; white-space: nowrap; }
.meal-search-hint { margin: 7px 2px 0; color: var(--muted); font-size: 10px; }
.quick-macro-toggle { margin-top: 7px; padding: 3px 2px; border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: 10px; font-weight: 750; }
.meal-search-results { margin-top: 7px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.meal-search-results a { padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.meal-search-results a:first-child { border-top: 0; }
.meal-search-results a:hover, .meal-search-results a.active { background: var(--mint); }
.meal-search-results strong, .meal-search-results small { display: block; }
.meal-search-results strong { font-size: 12px; }
.meal-search-results small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.meal-search-results b { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); }
.meal-search-empty { display: block; padding: 11px; color: var(--muted); font-size: 11px; }
.meal-quick-add-form { margin-top: 8px; padding: 12px; border: 1px solid #bcd4c3; border-radius: 9px; background: #fff; }
.quick-add-heading { margin-bottom: 11px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quick-add-heading small, .quick-add-heading strong { display: block; }
.quick-add-heading small { margin-bottom: 3px; color: var(--muted); font-size: 9px; }
.quick-add-heading strong { font-size: 13px; }
.quick-add-heading button { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: var(--paper); color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.quick-add-heading button:hover { background: #f9eaea; color: var(--danger); }
.quick-add-fields { display: grid; grid-template-columns: minmax(160px, 1fr) 110px auto; gap: 10px; align-items: end; }
.meal-quick-add-form.is-direct-amount .quick-add-fields { grid-template-columns: minmax(130px, 180px) auto; justify-content: start; }
.quick-add-fields label { color: var(--muted); font-size: 10px; font-weight: 750; }
.quick-add-fields select, .quick-add-fields input { width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #cbd7ce; border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
.quick-amount-control { position: relative; display: block; }
.meal-quick-add-form.is-direct-amount .quick-amount-control input { padding-right: 38px; }
.quick-amount-control b { position: absolute; right: 11px; bottom: 11px; color: var(--green); font-size: 10px; pointer-events: none; }
.quick-add-fields select:focus, .quick-add-fields input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.quick-add-fields .button { min-height: 39px; padding: 9px 13px; }
.quick-macro-form { margin-top: 8px; padding: 12px; border: 1px solid #bcd4c3; border-radius: 9px; background: #fff; }
.quick-macro-fields { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(72px, .75fr)) auto; gap: 8px; align-items: end; }
.quick-macro-fields label { color: var(--muted); font-size: 9px; font-weight: 750; }
.quick-macro-fields input { width: 100%; margin-top: 5px; padding: 9px; border: 1px solid #cbd7ce; border-radius: 8px; color: var(--ink); outline: none; }
.quick-macro-fields input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, .1); }
.quick-macro-fields .button { min-height: 38px; padding: 8px 12px; }
.meal-copy-panel { max-width: 700px; margin: 5px 0 8px; padding: 14px; border: 1px solid #c8dbce; border-radius: 11px; background: var(--mint-soft); }
.copy-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.copy-panel-heading small, .copy-panel-heading strong { display: block; }
.copy-panel-heading small { margin-bottom: 3px; color: var(--green); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.copy-panel-heading strong { font-size: 13px; }
.copy-panel-heading button { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.copy-panel-heading button:hover { background: #f9eaea; color: var(--danger); }
.copy-date-row { margin-top: 13px; display: grid; grid-template-columns: 1fr auto 1fr 1fr; gap: 9px; align-items: end; }
.copy-date-row > span { padding-bottom: 11px; color: var(--muted); }
.copy-date-row label { color: var(--muted); font-size: 9px; font-weight: 750; }
.copy-date-row input, .copy-date-row select { width: 100%; margin-top: 5px; padding: 9px; border: 1px solid #c4d2c7; border-radius: 8px; background: #fff; color: var(--ink); font-size: 10px; outline: none; }
.copy-date-row input:focus, .copy-date-row select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, .1); }
.copy-source-entries { max-height: 300px; margin-top: 13px; overflow-y: auto; border-top: 1px solid #d3dfd6; border-bottom: 1px solid #d3dfd6; }
.copy-source-entries > p { padding: 18px 4px; color: var(--muted); font-size: 10px; text-align: center; }
.copy-meal-group { padding: 10px 0; border-top: 1px solid #d3dfd6; }
.copy-meal-group:first-child { border-top: 0; }
.copy-meal-group h4 { margin: 0 4px 6px; color: var(--green-dark); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.copy-entry-option { padding: 8px; display: flex; align-items: center; gap: 9px; border-radius: 8px; cursor: pointer; }
.copy-entry-option:hover { background: #fff; }
.copy-entry-option input { accent-color: var(--green); }
.copy-entry-option strong, .copy-entry-option small { display: block; }
.copy-entry-option strong { font-size: 11px; }
.copy-entry-option small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.copy-panel-footer { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copy-panel-footer > span { color: var(--muted); font-size: 9px; }
.copy-panel-buttons { display: flex; gap: 7px; }
.copy-panel-footer .button:disabled { opacity: .45; cursor: not-allowed; }

.quick-list { margin-top: 18px; }
.quick-list > a { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.quick-list > a:first-child { border-top: 0; }
.quick-list strong, .quick-list small { display: block; }
.quick-list strong { font-size: 13px; }
.quick-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-list b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); }
.compact-empty { padding: 25px 0 5px; text-align: center; color: var(--muted); font-size: 12px; }

.search-bar { margin-bottom: 32px; padding: 7px; display: flex; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.search-bar input { min-width: 0; flex: 1; padding: 10px 12px; border: 0; outline: 0; color: var(--ink); }
.section-block { margin-top: 30px; }
.section-heading { margin-bottom: 15px; align-items: flex-end; }
.food-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.food-card { min-height: 145px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.food-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.food-card h3 { font-size: 15px; }
.food-card p { margin: 5px 0; color: var(--muted); font-size: 11px; }
.food-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.food-card-foot span { color: var(--muted); font-size: 10px; }
.food-card-foot .button { min-height: 34px; padding: 8px 12px; }
.food-table { overflow: hidden; }
.food-row { padding: 16px 18px; display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(250px, 1fr) auto; gap: 18px; align-items: center; border-top: 1px solid var(--line); }
.food-row:first-child { border-top: 0; }
.food-row strong, .food-row > div > span { display: block; }
.food-row strong { font-size: 13px; }
.food-row > div > span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.macro-line { display: flex; justify-content: flex-end; gap: 13px; }
.macro-line span { margin: 0 !important; white-space: nowrap; }
.food-row .button { min-height: 34px; padding: 8px 13px; }
.food-actions { display: flex; align-items: center; gap: 12px; }
.food-actions form, .food-card-heading form { margin: 0; }
.favourite-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 1px solid #d7e2da; border-radius: 9px; background: #f8faf8; color: #aab4ad; cursor: pointer; font-size: 18px; }
.favourite-button:hover, .favourite-button.is-favourite { border-color: #a9cab4; background: var(--mint); color: var(--green); }
.edit-link { color: var(--muted); font-size: 11px; font-weight: 700; }
.empty-state { padding: 42px 20px; text-align: center; }
.empty-icon { width: 40px; height: 40px; margin: 0 auto 13px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 23px; }
.empty-state p { color: var(--muted); font-size: 13px; }

.recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.recipe-card { padding: 22px; display: grid; gap: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.recipe-card-heading, .recipe-card-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.recipe-card-actions { display: flex; align-items: center; gap: 10px; }
.recipe-card-actions form { margin: 0; }
.recipe-card-actions button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.recipe-card-heading h2 { font-size: 18px; }
.recipe-card-heading p, .recipe-card-foot > span { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.recipe-card-foot { align-items: center; }

.saved-meal-layout, .cleanup-layout { display: grid; grid-template-columns: minmax(260px, .65fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
.saved-meal-create h2, .cleanup-form-panel h2 { margin-bottom: 8px; }
.compact-form { margin-top: 18px; }
.compact-form input, .compact-form select { width: 100%; padding: 11px 12px; border: 1px solid #cbd7ce; border-radius: 9px; background: #fff; color: var(--ink); }
.compact-form .errorlist { margin: 3px 0 0; padding: 0; list-style: none; color: var(--danger); font-size: 10px; }
.saved-meal-list { display: grid; gap: 12px; }
.saved-meal-list > .section-heading { margin-bottom: 2px; }
.saved-meal-card { padding: 18px; }
.saved-meal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.saved-meal-heading h3 { font-size: 16px; }
.saved-meal-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.saved-meal-heading form { margin: 0; }
.icon-danger { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 9px; background: #fff2f2; color: var(--danger); cursor: pointer; font-size: 20px; }
.saved-meal-items { margin: 13px 0; padding: 10px 0; display: grid; gap: 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); list-style: none; }
.saved-meal-items li { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.saved-meal-items small { color: var(--muted); white-space: nowrap; }
.saved-meal-log-form { display: grid; grid-template-columns: minmax(135px, 1fr) minmax(130px, 1fr) auto; gap: 9px; align-items: end; }
.saved-meal-log-form label { color: var(--muted); font-size: 9px; font-weight: 750; }
.saved-meal-log-form input, .saved-meal-log-form select { width: 100%; margin-top: 5px; padding: 10px; border: 1px solid #cbd7ce; border-radius: 8px; background: #fff; }
.duplicate-panel { display: grid; gap: 10px; }
.duplicate-group { padding: 12px; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.duplicate-group > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.duplicate-group strong, .duplicate-group small { font-size: 10px; }
.duplicate-group small { color: var(--muted); }
.destructive-note { padding: 11px; display: grid; gap: 3px; border: 1px solid #ead2d2; border-radius: 9px; background: #fff6f6; }
.destructive-note strong { color: #7f3434; font-size: 10px; }
.destructive-note span { color: var(--muted); font-size: 9px; line-height: 1.45; }

.period-switcher { padding: 4px; display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.period-switcher button { min-height: 36px; padding: 7px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 750; }
.period-switcher button.active { background: var(--mint); color: var(--green); }
.trend-stat-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.trend-stat { padding: 17px; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 13px; background: var(--card); box-shadow: var(--shadow); }
.trend-stat > span { color: var(--muted); font-size: 9px; font-weight: 750; }
.trend-stat > strong { margin-top: 12px; display: block; font-size: 23px; }
.trend-stat > strong small { color: var(--muted); font-size: 10px; }
.trend-stat p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.trend-chart-panel { margin-bottom: 18px; }
.trend-chart-legend { display: flex; gap: 13px; color: var(--muted); font-size: 9px; }
.trend-chart-legend span { display: flex; align-items: center; gap: 5px; }
.trend-chart-legend i { width: 13px; height: 5px; display: inline-block; border-radius: 3px; background: var(--green); }
.trend-chart-legend span:last-child i { height: 2px; background: #8ca397; }
.trend-chart-scroll { margin-top: 18px; overflow-x: auto; }
.trend-bars { min-width: max(100%, calc(var(--trend-columns) * 18px)); height: 220px; padding: 12px 4px 20px; display: grid; grid-template-columns: repeat(var(--trend-columns), minmax(10px, 1fr)); gap: 3px; align-items: end; border-bottom: 1px solid #cfdbd2; background: repeating-linear-gradient(to top, transparent 0, transparent 43px, #eef2ef 44px); }
.trend-bar-day { position: relative; height: 100%; display: flex; align-items: center; justify-content: flex-end; flex-direction: column; }
.trend-intake-bar { width: min(12px, 72%); min-height: 1px; border-radius: 4px 4px 1px 1px; background: #89b79a; transition: background .15s ease; }
.trend-bar-day:hover .trend-intake-bar, .trend-bar-day.is-on-target .trend-intake-bar { background: var(--green); }
.trend-target-marker { position: absolute; right: 4%; left: 4%; height: 2px; border-radius: 99px; background: #80958a; }
.trend-bar-day small { position: absolute; bottom: -17px; color: var(--muted); font-size: 7px; }
.energy-balance-panel { margin-bottom: 18px; overflow: hidden; }
.energy-balance-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 14px; color: var(--muted); font-size: 9px; font-weight: 700; }
.energy-balance-legend span { display: flex; align-items: center; gap: 5px; }
.energy-balance-legend i { width: 15px; height: 4px; display: inline-block; border-radius: 99px; }
.energy-balance-legend .adjusted-tdee-key { background: var(--green); }
.energy-balance-legend .intake-key { background: var(--gold); }
.energy-balance-legend .balance-key { background: #655b91; }
.energy-balance-scroll { margin-top: 18px; overflow-x: auto; }
.energy-balance-stage { min-width: 620px; }
.energy-balance-chart { width: 100%; height: auto; display: block; overflow: visible; }
.energy-zero-line { stroke: #aebdb2; stroke-width: 1.5; }
.energy-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.adjusted-tdee-line { stroke: var(--green); }
.intake-line { stroke: var(--gold); }
.balance-line { stroke: #655b91; }
.energy-point { fill: #fff; stroke-width: 2; }
.adjusted-tdee-point { stroke: var(--green); }
.intake-point { stroke: var(--gold); }
.balance-point { stroke: #655b91; }
.trend-detail-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.confidence-pill { padding: 6px 9px; border-radius: 99px; background: #edf0ee; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.confidence-high { background: var(--mint); color: var(--green); }
.confidence-medium { background: #fff2d8; color: #805e24; }
.confidence-low { background: #fbe9e8; color: #8b3f38; }
.tdee-number { margin-top: 20px; display: block; font-size: 31px; }
.tdee-number small { color: var(--muted); font-size: 11px; }
.tdee-explainer > p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.tdee-confidence-note { margin-top: 14px; padding: 12px 14px; border: 1px solid #ead4b4; border-radius: 10px; background: #fff8eb; color: #6f542a; font-size: 10px; line-height: 1.5; }
.tdee-confidence-note strong { display: block; margin-bottom: 5px; font-size: 10px; }
.tdee-confidence-note ul { margin: 0; padding-left: 17px; }
.tdee-confidence-note li + li { margin-top: 4px; }
.model-details { margin: 16px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.model-details > div { padding: 10px; background: #fff; }
.model-details dt { color: var(--muted); font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.model-details dd { margin: 4px 0 0; font-size: 11px; font-weight: 800; }
.nutrient-average-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nutrient-average-grid > div { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.nutrient-average-grid span, .nutrient-average-grid strong { display: block; }
.nutrient-average-grid span { color: var(--muted); font-size: 9px; }
.nutrient-average-grid strong { margin-top: 5px; font-size: 13px; }
.ranked-list, .meal-distribution { margin-top: 15px; }
.ranked-list > div { padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.ranked-list > div:first-child { border-top: 0; }
.ranked-list strong, .ranked-list small { display: block; }
.ranked-list strong { font-size: 11px; }
.ranked-list small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.ranked-list b { color: var(--green); font-size: 10px; }
.meal-distribution > div { padding: 8px 0; display: grid; grid-template-columns: minmax(90px, .8fr) minmax(100px, 1.2fr) 38px; gap: 10px; align-items: center; }
.meal-distribution strong, .meal-distribution small { display: block; font-size: 10px; }
.meal-distribution small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.meal-distribution i { height: 6px; overflow: hidden; border-radius: 99px; background: #edf1ee; }
.meal-distribution i b { height: 100%; display: block; border-radius: inherit; background: var(--green); }
.meal-distribution em { color: var(--muted); font-size: 9px; font-style: normal; text-align: right; }

.active-goal-card { margin-bottom: 18px; border-top: 3px solid var(--green); }
.active-goal-card form { margin: 0; }
.active-goal-stats { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.active-goal-stats > div { padding: 13px; background: #fff; }
.active-goal-stats span, .active-goal-stats strong { display: block; }
.active-goal-stats span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.active-goal-stats strong { margin-top: 5px; font-size: 13px; }
.goal-progress-copy { margin: 12px 0 0; color: var(--muted); font-size: 10px; }
.goal-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 18px; align-items: start; }
.goal-form-panel > h2 { margin-bottom: 7px; }
.goal-form { margin-top: 18px; }
.goal-history article { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); }
.goal-history article:first-of-type { margin-top: 13px; }
.goal-history strong, .goal-history span, .goal-history b, .goal-history small { display: block; }
.goal-history strong { font-size: 11px; }
.goal-history span, .goal-history small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.goal-history b { font-size: 11px; text-align: right; }
.goal-history small { text-align: right; }

.measurement-panel { margin-top: 18px; }
.measurement-layout { margin-top: 18px; display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 22px; }
.measurement-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.measurement-form .field-wide { grid-column: 1 / -1; }
.measurement-form label { color: var(--muted); font-size: 9px; font-weight: 750; }
.measurement-form input { width: 100%; margin-top: 5px; padding: 10px; border: 1px solid #cbd7ce; border-radius: 8px; }
.measurement-history { max-height: 390px; overflow-y: auto; }
.measurement-history article { padding: 9px 0; display: grid; grid-template-columns: 75px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.measurement-history article:first-child { border-top: 0; }
.measurement-history time { color: var(--muted); font-size: 9px; }
.measurement-history article > span { display: flex; flex-wrap: wrap; gap: 5px; }
.measurement-history b { padding: 4px 6px; border-radius: 6px; background: var(--paper); font-size: 8px; }
.measurement-history form { margin: 0; }
.recipe-macros { padding: 12px 0; justify-content: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.recipe-macros span { color: var(--muted); font-size: 10px; }
.recipe-form-page { width: min(860px, 100%); }
.recipe-ingredient-formset, .batch-ingredient-list { display: grid; gap: 10px; }
.recipe-ingredient-row { padding: 14px; display: grid; grid-template-columns: minmax(240px, 1fr) 160px auto; gap: 14px; align-items: end; border: 1px solid var(--line); border-radius: 10px; }
.food-combobox { position: relative; }
.food-combobox select[hidden] { display: none; }
.food-search-results { position: absolute; z-index: 30; top: calc(100% + 5px); right: 0; left: 0; max-height: 260px; padding: 5px; overflow-y: auto; border: 1px solid #cbd7ce; border-radius: 10px; background: #fff; box-shadow: 0 14px 35px rgba(31, 58, 42, 0.16); }
.food-search-results button { width: 100%; padding: 10px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; font-size: 12px; }
.food-search-results button:hover, .food-search-results button.active { background: var(--mint); color: var(--green-dark); }
.food-search-empty { display: block; padding: 10px 11px; color: var(--muted); font-size: 11px; }
.remove-draft-row { min-height: 43px; padding: 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 11px; font-weight: 700; }
.form-hint { margin: 12px 0 0; color: var(--muted); font-size: 10px; }
.batch-ingredient-list { margin-top: 16px; }
.batch-ingredient-row { padding: 13px 0; display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; align-items: center; border-top: 1px solid var(--line); }
.batch-ingredient-row:first-child { border-top: 0; }
.batch-ingredient-row strong, .batch-ingredient-row span { display: block; }
.batch-ingredient-row strong { font-size: 13px; }
.batch-ingredient-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.save-defaults-check { margin-top: 20px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 9px; border-radius: 10px; background: var(--mint-soft); color: var(--muted); cursor: pointer; font-size: 11px; line-height: 1.45; }
.save-defaults-check input { margin-top: 2px; accent-color: var(--green); }
.entry-edit-notice { margin-top: 20px; padding: 13px 15px; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; border-radius: 10px; background: #fff7e5; color: #76551c; font-size: 10px; }
.entry-edit-notice strong, .entry-edit-notice span { display: block; }
.recipe-calculation { margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid #bed9c6; border-radius: 12px; background: var(--mint-soft); }
.recipe-calculation > div { padding: 18px; border-left: 1px solid #bed9c6; }
.recipe-calculation > div:first-child { border-left: 0; }
.recipe-calculation strong, .recipe-calculation span { display: block; }
.recipe-calculation strong { font-size: 17px; letter-spacing: -0.025em; }
.recipe-calculation span { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.recipe-calculation .selected-portion { background: var(--green); color: #fff; }
.recipe-calculation .selected-portion .eyebrow { color: #bde6c9; }
.recipe-calculation .selected-portion span { color: #d9eadf; }

.nutrition-strip { margin-bottom: 16px; padding: 15px 18px; display: flex; flex-wrap: wrap; gap: 18px; border-radius: 12px; background: var(--mint-soft); color: var(--muted); font-size: 11px; }
.nutrition-strip b { color: var(--ink); }
.nutrition-strip small { margin-left: auto; }
.product-form { padding: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid #cbd7ce; border-radius: 9px; background: #fff; color: var(--ink); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 99, 71, 0.1); }
.field small { color: var(--muted); font-size: 10px; }
.field-error, .form-error { color: var(--danger); font-size: 11px; }
.form-actions { margin-top: 28px; display: flex; justify-content: flex-end; gap: 10px; }
.form-divider { height: 1px; margin: 30px 0; background: var(--line); }
.settings-section { display: grid; gap: 18px; }
.settings-section-heading h2 { margin-top: 4px; font-size: 20px; }
.settings-section-heading .muted { margin-top: 6px; }
.settings-toggle { padding: 16px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--mint-soft); cursor: pointer; }
.settings-toggle input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--green); }
.settings-toggle span { display: grid; gap: 4px; }
.settings-toggle strong { color: var(--ink); font-size: 12px; }
.settings-toggle small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.settings-body-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.automatic-target-status { padding: 13px 15px; display: grid; gap: 4px; border: 1px solid #c9ddcf; border-radius: 10px; background: #f5faf6; }
.automatic-target-status strong { color: var(--green-dark); font-size: 11px; }
.automatic-target-status span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.serving-formset { margin-top: 15px; display: grid; gap: 10px; }
.serving-row { padding: 14px; display: grid; grid-template-columns: 1fr 120px 100px auto auto; gap: 14px; align-items: end; border: 1px solid var(--line); border-radius: 10px; }
.check-field { min-height: 43px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.check-field input { accent-color: var(--green); }
.delete-check { color: var(--danger); }

.auth-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: linear-gradient(135deg, #edf7ef, #f8fbf8); }
.auth-card { width: min(420px, 100%); padding: 42px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 50px; }
.auth-card h1 { font-size: 36px; }
.auth-card .muted { margin-bottom: 0; }
.form-stack { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.form-stack label { margin-top: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-stack input { padding: 12px; border: 1px solid #ccd8cf; border-radius: 8px; }
.form-stack .button { margin-top: 13px; }

.button.compact { min-height: 34px; padding: 8px 11px; font-size: 10px; }
.activity-subnav { margin: -12px 0 22px; padding: 4px; display: flex; gap: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--card); scrollbar-width: thin; }
.activity-subnav a { min-height: 38px; padding: 9px 13px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.activity-subnav a:hover, .activity-subnav a.active { background: var(--mint); color: var(--green); }
.activity-stat-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.activity-stat-grid article { min-width: 0; padding: 15px; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.activity-stat-grid span, .activity-stat-grid strong, .activity-stat-grid > article > small { display: block; }
.activity-stat-grid span { min-height: 26px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.activity-stat-grid strong { margin: 8px 0 5px; overflow: hidden; font-size: 21px; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.activity-stat-grid strong small { color: var(--muted); font-size: 9px; font-weight: 650; }
.activity-stat-grid > article > small { min-height: 26px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.activity-analytics-grid { margin-bottom: 18px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; }
.weekly-activity-chart { margin-top: 20px; display: grid; gap: 11px; }
.weekly-activity-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(0, .75fr); gap: 12px; align-items: center; }
.weekly-activity-row time { color: var(--muted); font-size: 9px; font-weight: 700; }
.weekly-activity-row > div { min-width: 0; }
.weekly-activity-row span { height: 7px; display: block; overflow: hidden; border-radius: 99px; background: #edf2ee; }
.weekly-activity-row span i { height: 100%; display: block; border-radius: inherit; background: var(--green); }
.weekly-activity-row span.steps i { background: #87b99d; }
.weekly-activity-row small { margin-top: 4px; display: block; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.activity-breakdown { margin-top: 15px; display: grid; }
.activity-breakdown > div:not(.compact-empty) { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.activity-breakdown > div:first-child { border-top: 0; }
.activity-breakdown span, .activity-breakdown strong, .activity-breakdown small { display: block; }
.activity-breakdown strong { font-size: 12px; }
.activity-breakdown small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.activity-breakdown b { color: var(--green-dark); font-size: 11px; white-space: nowrap; }
.training-recent-panel { margin-bottom: 18px; }
.training-recent-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.training-recent-grid article { padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; }
.training-recent-grid h3 { margin-top: 3px; font-size: 14px; }
.training-recent-grid p { margin: 5px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.training-recent-grid time { color: var(--muted); font-size: 9px; }
.training-kind { color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.training-row-actions, .routine-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.training-row-actions form, .routine-actions form { margin: 0; }
.icon-delete { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--danger); cursor: pointer; font-size: 16px; }
[data-training-delete] [data-delete-actions], [data-confirm-delete] [data-delete-actions] { display: inline-flex; gap: 4px; }
[data-confirm-delete] .confirm-action, [data-confirm-delete] .cancel-action { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; cursor: pointer; font-size: 15px; }
[data-confirm-delete] .confirm-action { background: var(--green); color: #fff; }
[data-confirm-delete] .cancel-action { background: #f9eaea; color: var(--danger); }
.strength-session-form, .workout-template-form { width: 100%; }
.strength-session-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.strength-session-details label, .routine-details label, .strength-set-row label, .routine-exercise-row label, .exercise-create-form label, .bouldering-form label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
.strength-session-details input, .strength-session-details select, .routine-details input, .routine-details textarea, .strength-set-row input, .strength-set-row select, .routine-exercise-row input, .routine-exercise-row select, .exercise-create-form input, .exercise-create-form select, .bouldering-form input, .bouldering-form select { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid #cbd7ce; border-radius: 9px; background: #fff; color: var(--ink); }
.set-table-heading { margin: 26px 0 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.strength-set-list, .routine-exercise-list { display: grid; gap: 8px; }
.strength-set-row { padding: 11px; display: grid; grid-template-columns: minmax(170px, 1.5fr) 105px 75px 70px minmax(120px, 1fr) 36px; gap: 9px; align-items: end; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; }
.strength-set-row .set-delete-field, .routine-exercise-row .set-delete-field { display: none; }
.remove-set { width: 36px; height: 42px; border: 0; border-radius: 8px; background: #fff1f1; color: var(--danger); cursor: pointer; font-size: 18px; }
.setup-callout { text-align: center; }
.setup-callout p { margin: 10px 0 18px; color: var(--muted); font-size: 12px; }
.training-library-grid, .bouldering-layout { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.exercise-create-form, .bouldering-form { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.exercise-create-form label:first-child, .exercise-create-form label:last-of-type, .bouldering-form label:last-of-type { grid-column: 1 / -1; }
.exercise-create-form .button, .bouldering-form .button, .bouldering-form .form-actions { grid-column: 1 / -1; }
.exercise-list, .routine-list, .bouldering-history { margin-top: 20px; display: grid; }
.exercise-list > div:not(.compact-empty), .routine-list article, .bouldering-history article { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); }
.exercise-list strong, .exercise-list small { display: block; }
.exercise-list strong { font-size: 12px; }
.exercise-list small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.routine-list h3 { font-size: 14px; }
.routine-list p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.routine-list small { color: var(--muted); font-size: 9px; }
.routine-details { max-width: 620px; display: grid; gap: 14px; }
.routine-exercise-row { padding: 11px; display: grid; grid-template-columns: minmax(180px, 1.5fr) 80px 80px 110px 36px; gap: 9px; align-items: end; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; }
.bouldering-history article > a { min-width: 0; display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 12px; }
.bouldering-history strong, .bouldering-history small { display: block; }
.bouldering-history strong { font-size: 12px; }
.bouldering-history small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.bouldering-history time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.standalone-form { width: min(760px, 100%); }

.settings-account-panel { margin-top: 18px; }
.security-setting-list { margin-top: 18px; display: grid; }
.security-setting-list > div { min-height: 62px; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); }
.security-setting-list > div:first-child { border-top: 0; }
.security-setting-list span, .security-setting-list strong, .security-setting-list small { display: block; }
.security-setting-list strong { font-size: 13px; }
.security-setting-list small { max-width: 500px; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.integration-status { min-width: 48px; padding: 6px 9px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 99px; background: #edf1ee; color: var(--muted); font-size: 9px; font-weight: 800; white-space: nowrap; }
.integration-status.enabled { background: var(--mint); color: var(--green); }
.sharing-form { margin-top: 18px; padding: 15px; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.45fr) auto; gap: 14px; align-items: end; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfb; }
.sharing-form > label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
.sharing-form input[type="text"] { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #cbd7ce; border-radius: 8px; background: #fff; color: var(--ink); }
.sharing-checks { display: grid; gap: 6px; }
.sharing-checks label { min-height: 24px; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 10px; }
.sharing-checks input { width: 17px; height: 17px; accent-color: var(--green); }
.sharing-list { margin-top: 20px; }
.sharing-list h3 { margin-bottom: 6px; color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.sharing-list article { min-height: 58px; padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.sharing-list article > div { display: flex; align-items: center; gap: 6px; }
.sharing-list article form { margin: 0; }
.sharing-list strong, .sharing-list small { display: block; }
.sharing-list strong { font-size: 12px; }
.sharing-list small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.install-panel { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.install-panel .muted { max-width: 560px; margin-bottom: 0; }

.barcode-lookup-panel { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.barcode-lookup-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 9px; align-items: end; }
.barcode-lookup-form label { grid-column: 1 / -1; color: var(--muted); font-size: 10px; font-weight: 750; }
.barcode-lookup-form input { min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid #cbd7ce; border-radius: 9px; background: #fff; color: var(--ink); }
.barcode-lookup-panel > .muted { margin: 10px 0 0; font-size: 10px; }
.barcode-camera { margin-top: 12px; padding: 12px; border-radius: 11px; background: #102119; color: #fff; text-align: center; }
.barcode-camera video { width: min(100%, 560px); max-height: 320px; display: block; margin: 0 auto; border-radius: 8px; }
.barcode-camera p { margin: 9px 0; font-size: 11px; }
.source-notice { margin-bottom: 15px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #bed9c6; border-radius: 10px; background: var(--mint-soft); color: var(--green-dark); font-size: 11px; }
.source-notice a { color: var(--green); font-weight: 750; }

.integration-layout { display: grid; grid-template-columns: minmax(320px, 1.1fr) minmax(280px, .9fr); gap: 18px; align-items: start; }
.apple-import-form { margin-top: 18px; display: grid; gap: 13px; }
.apple-import-form > label:not(.apple-import-check) { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
.apple-import-form input[type="file"], .apple-import-form input[type="text"] { width: 100%; min-height: 42px; padding: 10px; border: 1px solid #cbd7ce; border-radius: 9px; background: #fff; color: var(--ink); }
.apple-import-form label > small { color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.4; }
.apple-import-check { min-height: 30px; display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 700; }
.apple-import-check input { width: 18px; height: 18px; accent-color: var(--green); }
.privacy-note { margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; line-height: 1.5; }
.import-history { margin-top: 15px; display: grid; }
.import-history article { padding: 12px 0; display: grid; gap: 4px; border-top: 1px solid var(--line); }
.import-history article:first-child { border-top: 0; }
.import-history strong { font-size: 11px; overflow-wrap: anywhere; }
.import-history span, .import-history small { color: var(--muted); font-size: 9px; }
.integration-disabled { max-width: 620px; }
.integration-disabled h2 { margin: 14px 0 8px; }
.integration-disabled p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.integration-disabled code { padding: 2px 5px; border-radius: 5px; background: #edf1ee; color: var(--ink); }

.shared-report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.shared-report-grid > .panel:last-child:nth-child(odd) { grid-column: 1 / -1; }
.shared-stat { margin: 18px 0; padding: 15px; border-radius: 10px; background: var(--mint-soft); }
.shared-stat strong, .shared-stat span { display: block; }
.shared-stat strong { color: var(--green-dark); font-size: 24px; letter-spacing: -.04em; }
.shared-stat span { margin-top: 5px; color: var(--muted); font-size: 9px; }
.shared-daily-list { display: grid; }
.shared-daily-list > div { padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.shared-daily-list time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.shared-daily-list span { text-align: right; font-size: 9px; }
.shared-measurements { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.shared-measurements h3 { margin-bottom: 3px; }
.shared-measurements time { color: var(--muted); font-size: 8px; }
.shared-measurements p { margin: 9px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.shared-measurements p span { padding: 5px 7px; border-radius: 7px; background: var(--mint-soft); color: var(--green-dark); font-size: 8px; font-weight: 700; }
.shared-activity-stats { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.shared-activity-stats > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; }
.shared-activity-stats strong, .shared-activity-stats span { display: block; }
.shared-activity-stats strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.shared-activity-stats span { margin-top: 5px; color: var(--muted); font-size: 9px; }

.auth-help-link { margin-top: 12px; display: inline-flex; color: var(--green); font-size: 11px; font-weight: 750; }
.form-stack p { margin: 0; display: grid; gap: 6px; }
.form-stack p label { color: var(--muted); font-size: 11px; font-weight: 700; }
.form-stack p input { width: 100%; }
.form-stack .helptext { color: var(--muted); font-size: 9px; line-height: 1.45; }
.form-stack .errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 10px; }

@media (max-width: 980px) {
  .main-content { padding: 34px 28px 70px; }
  .dashboard-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-calendar { grid-column: 1 / -1; }
  .activity-quick-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-quick-fields .button { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { display: contents; }
  .weight-page-grid { grid-template-columns: 1fr; }
  .activity-page-grid, .activity-history-grid { grid-template-columns: 1fr; }
  .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-grid { grid-template-columns: 1fr; }
  .saved-meal-layout, .cleanup-layout { grid-template-columns: 1fr; }
  .trend-detail-grid, .goal-layout, .measurement-layout { grid-template-columns: 1fr; }
  .activity-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .activity-analytics-grid, .training-library-grid, .bouldering-layout { grid-template-columns: 1fr; }
  .integration-layout { grid-template-columns: 1fr; }
  .sharing-form { grid-template-columns: 1fr 1fr; }
  .sharing-form .button { grid-column: 1 / -1; }
  .strength-set-row { grid-template-columns: minmax(160px, 1.5fr) 100px 75px 70px 36px; }
  .strength-set-row .set-note { grid-column: 1 / -2; }
}

@media (max-width: 760px) {
  body { padding-bottom: 64px; }
  .button, .button.compact { min-height: 44px; }
  .topbar { height: 62px; }
  .topbar-inner { padding: 0 18px; }
  .brand { font-size: 21px; }
  .brand-mark { width: 29px; height: 29px; }
  .topbar-user { font-size: 0; }
  .logout-form button { min-width: 44px; min-height: 44px; font-size: 12px; }
  .app-shell { display: block; min-height: calc(100vh - 62px); }
  .sidebar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; width: 100%; height: 64px; padding: 7px 8px; display: flex; flex-direction: row; justify-content: space-around; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); border-right: 0; backdrop-filter: blur(12px); }
  .sidebar-bottom { margin: 0; display: contents; }
  .nav-item { min-width: 44px; min-height: 48px; padding: 9px 4px; display: grid; place-items: center; border-radius: 8px; font-size: 10px; }
  .main-content { width: 100%; padding: 28px 16px 34px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .dashboard-page { display: flex; flex-direction: column; }
  .dashboard-page > .undo-banner { order: 0; }
  .dashboard-page > .metric-grid { order: 1; }
  .dashboard-hero { display: contents; }
  .dashboard-calendar { order: 2; margin-bottom: 10px; }
  .dashboard-date-context { order: 3; margin-bottom: 10px; display: flex; }
  .dashboard-grid { order: 5; }
  .dashboard-weight-card { order: 6; margin-top: 12px; }
  .dashboard-activity-card { order: 7; margin-top: 12px; }
  .dashboard-hero > .dashboard-weight-card, .dashboard-hero > .dashboard-activity-card { padding: 18px; }
  .page-heading .button { width: 100%; }
  .trends-heading .period-switcher { width: 100%; }
  .period-switcher button { min-height: 44px; flex: 1; }
  .heading-actions { width: 100%; }
  .heading-actions { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-width: 0; padding: 13px; }
  .metric-label p, .metric-label span { margin-bottom: 11px; font-size: 10px; }
  .metric-card strong { font-size: 18px; white-space: nowrap; }
  .metric-card small { display: block; margin-top: 3px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
  .metric-card > span { font-size: 10px; }
  .progress-track { margin-top: 10px; }
  .panel { padding: 18px; }
  .calendar-panel { padding: 14px; }
  .dashboard-calendar .calendar-heading { margin-bottom: 10px; }
  .dashboard-calendar .calendar-heading h2 { font-size: 16px; }
  .dashboard-calendar .calendar-month-nav { display: none; }
  .dashboard-calendar .diary-calendar, .dashboard-calendar .calendar-legend { display: none; }
  .mobile-date-picker { display: flex; }
  .weight-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .trend-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .trend-stat { padding: 13px; }
  .trend-stat > strong { font-size: 20px; }
  .weight-stat-card { min-width: 0; padding: 13px 10px; }
  .weight-stat-card > span { min-height: 28px; display: block; font-size: 9px; line-height: 1.35; }
  .weight-stat-card strong { margin-top: 8px; font-size: 19px; white-space: nowrap; }
  .weight-stat-card p { min-height: 26px; font-size: 9px; line-height: 1.4; }
  .weight-chart-scroll { overflow-x: visible; }
  .weight-chart-stage { min-width: 0; }
  .weight-chart-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .weight-chart-reset { min-width: 88px; height: 44px; }
  .weight-chart-toolbar output { min-height: 44px; display: flex; align-items: center; }
  .weight-chart-toolbar p { width: 100%; margin-left: 0; line-height: 1.45; }
  .chart-axis-label { font-size: 22px; }
  .chart-date-label { font-size: 19px; }
  .chart-axis-title, .projection-label { font-size: 19px; }
  .medication-label { font-size: 20px; }
  .weight-chart-panel .panel-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .weight-chart-legend { flex-wrap: wrap; gap: 7px 11px; font-size: 10px; }
  .activity-quick-fields { grid-template-columns: 1fr 1fr 1fr; }
  .activity-inline-cardio-fields { grid-template-columns: 1fr 1fr; }
  .activity-inline-step-fields { grid-template-columns: 1fr 1fr; }
  .activity-inline-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .diary-entry-link { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .diary-nutrients { text-align: right; }
  .diary-inline-edit { grid-template-columns: minmax(0, 1fr) 95px; }
  .diary-inline-edit-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .meal-inline-search { max-width: none; }
  .meal-copy-panel { max-width: none; }
  .copy-date-row { grid-template-columns: 1fr 1fr; }
  .copy-date-row > span { display: none; }
  .copy-date-row label:last-child { grid-column: 1 / -1; }
  .quick-add-fields { grid-template-columns: minmax(0, 1fr) 92px; }
  .quick-add-fields .button { grid-column: 1 / -1; width: 100%; }
  .quick-macro-toggle { min-height: 44px; text-align: left; }
  .quick-macro-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-macro-fields label:first-child { grid-column: 1 / -1; }
  .quick-macro-fields .button { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .copy-panel-footer { align-items: stretch; flex-direction: column; }
  .copy-panel-buttons { width: 100%; }
  .copy-panel-buttons { flex-wrap: wrap; }
  .copy-panel-buttons .button { flex: 1; }
  .meal-action-icon { width: 44px; height: 44px; flex-basis: 44px; }
  .diary-delete button, .diary-inline-edit-actions button, .activity-inline-actions button { width: 44px; height: 44px; }
  .quick-add-heading button, .copy-panel-heading button { width: 44px; height: 44px; }
  .calendar-month-nav a, .calendar-month-nav > span { min-width: 44px; height: 44px; }
  .activity-quick-fields input, .activity-quick-fields select, .dashboard-steps-form input { min-height: 44px; height: 44px; font-size: 12px; }
  .activity-quick-fields .button, .dashboard-steps-form .button { min-height: 44px; height: 44px; }
  .activity-quick-fields label span, .dashboard-activity-forms form > p { font-size: 11px; }
  .dashboard-weight-stats span, .activity-today-summary small { font-size: 10px; }
  .weight-logged-state strong { font-size: 12px; }
  .weight-logged-state small, .dashboard-weight-away { font-size: 10px; line-height: 1.45; }
  .food-grid { grid-template-columns: 1fr; }
  .food-row { grid-template-columns: 1fr auto; gap: 12px; }
  .macro-line { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; flex-wrap: wrap; }
  .food-row .button { grid-column: 2; grid-row: 1; }
  .favourite-button, .icon-danger { width: 44px; height: 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .serving-row { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: auto; }
  .product-form { padding: 20px; }
  .nutrition-strip small { width: 100%; margin-left: 0; }
  .recipe-ingredient-row, .batch-ingredient-row { grid-template-columns: 1fr; }
  .recipe-calculation { grid-template-columns: 1fr; }
  .recipe-calculation > div { border-top: 1px solid #bed9c6; border-left: 0; }
  .recipe-calculation > div:first-child { border-top: 0; }
  .recipe-card-foot { align-items: stretch; flex-direction: column; }
  .recipe-card-foot .button { width: 100%; }
  .recipe-card-heading { align-items: stretch; flex-direction: column; }
  .recipe-card-actions { justify-content: flex-start; }
  .saved-meal-log-form { grid-template-columns: 1fr 1fr; }
  .saved-meal-log-form .button { grid-column: 1 / -1; width: 100%; }
  .active-goal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .measurement-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .measurement-history article { grid-template-columns: 70px minmax(0, 1fr) 44px; }
  .model-details { grid-template-columns: 1fr; }
  .activity-heading .period-switcher { width: 100%; }
  .activity-subnav { margin-top: -14px; }
  .activity-subnav a { min-height: 44px; }
  .activity-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-stat-grid article { padding: 13px; }
  .activity-analytics-grid { grid-template-columns: 1fr; }
  .weekly-activity-row { grid-template-columns: 48px minmax(0, 1fr); }
  .weekly-activity-row > div:last-child { grid-column: 2; }
  .training-recent-grid { grid-template-columns: 1fr; }
  .training-recent-grid article { align-items: flex-start; flex-direction: column; }
  .training-row-actions { width: 100%; justify-content: flex-start; }
  .training-row-actions .button { width: auto; }
  .strength-session-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strength-session-details .field-wide { grid-column: 1 / -1; }
  .strength-set-row { grid-template-columns: repeat(2, minmax(0, 1fr)) 44px; }
  .strength-set-row .set-exercise { grid-column: 1 / -1; }
  .strength-set-row .set-note { grid-column: 1 / 3; }
  .strength-set-row .remove-set { grid-column: 3; grid-row: 2; width: 44px; height: 44px; }
  .routine-exercise-row { grid-template-columns: repeat(3, minmax(0, 1fr)) 44px; }
  .routine-exercise-row .routine-exercise { grid-column: 1 / -1; }
  .routine-exercise-row .remove-set { width: 44px; height: 44px; }
  .exercise-create-form, .bouldering-form { grid-template-columns: 1fr; }
  .exercise-create-form label:first-child, .exercise-create-form label:last-of-type, .bouldering-form label:last-of-type { grid-column: auto; }
  .exercise-create-form .button, .bouldering-form .button, .bouldering-form .form-actions { grid-column: auto; }
  .routine-list article, .bouldering-history article { align-items: flex-start; flex-direction: column; }
  .routine-actions { width: 100%; justify-content: flex-start; }
  .bouldering-history article > a { width: 100%; }
  .icon-delete { width: 44px; height: 44px; }
  [data-confirm-delete] .confirm-action, [data-confirm-delete] .cancel-action { width: 44px; height: 44px; }
  .strength-session-details input, .strength-session-details select, .strength-set-row input, .strength-set-row select, .routine-details input, .routine-exercise-row input, .routine-exercise-row select, .exercise-create-form input, .exercise-create-form select, .bouldering-form input, .bouldering-form select { min-height: 44px; }
  .security-setting-list > div, .install-panel { align-items: flex-start; flex-direction: column; }
  .security-setting-list .button, .install-panel .button { width: 100%; min-height: 44px; }
  .sharing-form { grid-template-columns: 1fr; }
  .sharing-form input[type="text"] { min-height: 44px; }
  .sharing-checks label, .apple-import-check { min-height: 44px; }
  .sharing-form .button { grid-column: auto; width: 100%; min-height: 44px; }
  .sharing-list article { align-items: flex-start; }
  .barcode-lookup-form { grid-template-columns: 1fr 1fr; }
  .barcode-lookup-form input { grid-column: 1 / -1; min-height: 44px; }
  .barcode-lookup-form .button { min-height: 44px; }
  .source-notice { align-items: flex-start; flex-direction: column; }
  .shared-report-grid { grid-template-columns: 1fr; }
  .shared-report-grid > .panel:last-child:nth-child(odd) { grid-column: auto; }
  .shared-activity-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apple-import-form input[type="file"], .apple-import-form input[type="text"], .apple-import-form .button { min-height: 44px; }
  .auth-card { padding: 30px; }
  input, select, textarea { font-size: 16px !important; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diary-entry-link { grid-template-columns: 1fr; }
  .diary-nutrients { align-items: flex-start; text-align: left; }
  .diary-macro-list { justify-content: flex-start; flex-wrap: wrap; }
}

/* The saved theme class is rendered on <html> so dark colours apply before first paint. */
html.theme-dark {
  color-scheme: dark;
  --ink: #eeeeee;
  --muted: #ababab;
  --line: #343434;
  --paper: #151515;
  --card: #1f1f1f;
  --green: #92b5d1;
  --green-dark: #b0cadf;
  --mint: #303030;
  --mint-soft: #262626;
  --gold: #c4ad87;
  --danger: #e99b9b;
  --night-accent-fill: #92b5d1;
  --night-accent-hover: #b0cadf;
  --night-accent-ink: #172431;
  --night-control-line: #737373;
  --night-success: #add5ba;
  --shadow: 0 14px 35px rgba(0, 0, 0, .24);
}

.theme-dark :where(a, button, input, select, textarea, [tabindex]):focus-visible { outline-color: #92b5d1; }
.theme-dark .button.primary,
.theme-dark .undo-banner button,
.theme-dark .diary-delete .confirm-action,
.theme-dark .diary-inline-edit .confirm-action,
.theme-dark .activity-inline-edit .confirm-action,
.theme-dark [data-confirm-delete] .confirm-action { background: var(--night-accent-fill); color: var(--night-accent-ink); }
.theme-dark .button.primary:hover,
.theme-dark .undo-banner button:hover,
.theme-dark .diary-delete .confirm-action:hover,
.theme-dark .diary-inline-edit .confirm-action:hover,
.theme-dark .activity-inline-edit .confirm-action:hover,
.theme-dark [data-confirm-delete] .confirm-action:hover { background: var(--night-accent-hover); color: var(--night-accent-ink); }
.theme-dark .brand-mark { background: #e6e6e6; color: #202020; }
.theme-dark .weight-logged-state > span { background: #293c32; color: var(--night-success); }
.theme-dark .theme-toggle-button { background: #262626; }
.theme-dark .theme-toggle-button:hover { background: var(--mint); }
.theme-dark :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: var(--night-control-line) !important;
  background: #191919 !important;
  color: var(--ink) !important;
}
.theme-dark :where(input, textarea)::placeholder { color: #a1a1a1; opacity: 1; }
.theme-dark input[type="checkbox"], .theme-dark input[type="radio"] { accent-color: #92b5d1; }
.theme-dark .progress-track,
.theme-dark .meal-distribution i,
.theme-dark .weekly-activity-row span { background: #343434; }
.theme-dark .dashboard-weight-chart { background: linear-gradient(180deg, rgba(146, 181, 209, .04), transparent); }
.theme-dark .dashboard-weight-chart-axis { stroke: #676767; }
.theme-dark .dashboard-weight-chart-guide,
.theme-dark .chart-grid-line { stroke: #343434; }
.theme-dark .dashboard-weight-chart-point,
.theme-dark .weight-point,
.theme-dark .projection-point,
.theme-dark .energy-point,
.theme-dark .weight-chart-legend .raw-weight-key { fill: var(--card); background: var(--card); }
.theme-dark .weight-chart-reset,
.theme-dark .diary-row,
.theme-dark .meal-search-results,
.theme-dark .meal-quick-add-form,
.theme-dark .quick-macro-form,
.theme-dark .model-details > div,
.theme-dark .active-goal-stats > div,
.theme-dark .training-recent-grid article,
.theme-dark .strength-set-row,
.theme-dark .routine-exercise-row,
.theme-dark .sharing-form,
.theme-dark .shared-activity-stats > div { background: #292929; }
.theme-dark .chart-tooltip,
.theme-dark .food-search-results { border-color: #737373; background: rgba(41, 41, 41, .98); box-shadow: 0 12px 30px rgba(0, 0, 0, .38); }
.theme-dark .weight-chart-reset { border-color: #737373; }
.theme-dark .chart-zoom-selection { fill: rgba(146, 181, 209, .18); stroke: #92b5d1; }
.theme-dark .meal-heading { background: #292929; }
.theme-dark .meal-action-icon,
.theme-dark .favourite-button { border-color: #656565; background: #292929; }
.theme-dark .meal-action-icon.is-open { border-color: #656565; background: #343434; color: var(--muted); }
.theme-dark .diary-portion,
.theme-dark .confidence-pill,
.theme-dark .integration-status,
.theme-dark .integration-disabled code { background: #303030; color: var(--muted); }
.theme-dark .diary-macro-list > span { border-color: #404040; background: #292929; }
.theme-dark .diary-delete button { color: #aaaaaa; }
.theme-dark .diary-delete button:hover,
.theme-dark .quick-add-heading button:hover,
.theme-dark .copy-panel-heading button:hover { background: #422628; color: var(--danger); }
.theme-dark .diary-delete .cancel-action,
.theme-dark .diary-inline-edit .cancel-action,
.theme-dark .activity-inline-edit .cancel-action,
.theme-dark [data-confirm-delete] .cancel-action { background: #422628; color: var(--danger); }
.theme-dark .diary-delete .cancel-action:hover,
.theme-dark .diary-inline-edit .cancel-action:hover,
.theme-dark .activity-inline-edit .cancel-action:hover { background: #543033; }
.theme-dark .icon-danger,
.theme-dark .remove-set { background: #3b2325; }
.theme-dark .destructive-note { border-color: #61383b; background: #322022; }
.theme-dark .destructive-note strong { color: #f3a2a2; }
.theme-dark .confidence-medium { background: #44381f; color: #f0ce86; }
.theme-dark .message--error,
.theme-dark .confidence-low { border-color: #654044; background: #392426; color: #f2aaaa; }
.theme-dark .message--warning,
.theme-dark .tdee-confidence-note,
.theme-dark .entry-edit-notice { border-color: #675332; background: #382f1f; color: #e9cc8d; }
.theme-dark .automatic-target-status { border-color: #444444; background: #262626; color: var(--green-dark); }
.theme-dark .calendar-day--no-data > a, .theme-dark .calendar-day--no-data > span { background: #303030; color: #b6b6b6; }
.theme-dark .calendar-day--under-target > a, .theme-dark .calendar-day--under-target > span { background: #382d47; color: #d1b4ed; }
.theme-dark .calendar-day--on-target > a, .theme-dark .calendar-day--on-target > span { background: #293c32; color: #add5ba; }
.theme-dark .calendar-day--over-target > a, .theme-dark .calendar-day--over-target > span { background: #492b2d; color: #f1a9a9; }
.theme-dark .calendar-day--logged > a, .theme-dark .calendar-day--logged > span { background: #483a20; color: #edd08f; }
.theme-dark .calendar-day--planned > a, .theme-dark .calendar-day--planned > span { background: #283b4b; color: #accbea; }
.theme-dark .calendar-day--future > a, .theme-dark .calendar-day--future > span { background: #1f1f1f; color: #929292; }
.theme-dark .legend-no-data { background: #727272; }
.theme-dark .legend-over { background: #b96767; }
.theme-dark .legend-logged { background: #b98e3f; }
.theme-dark .trend-bars { border-color: #565656; background: repeating-linear-gradient(to top, transparent 0, transparent 43px, #343434 44px); }
.theme-dark .weight-up { color: #efa2a2; }
.theme-dark .weight-down { color: #b0cadf; }
.theme-dark .medication-label { fill: #c9a5e9; }
.theme-dark .medication-arrow-line,
.theme-dark .medication-arrow-head { stroke: #bd91e2; }
.theme-dark .projection-boundary { stroke: #676767; }
.theme-dark .projection-label { fill: #ababab; }
.theme-dark .source-notice { border-color: #444444; }
.theme-dark .auth-card { background: var(--card); }

/* Neutral surfaces carry the layout; colour is reserved for actions and data. */
.theme-dark .topbar { background: #191919; }
.theme-dark .nav-item.active, .theme-dark .nav-item:hover { color: var(--ink); }
.theme-dark .nav-item.active { box-shadow: inset 2px 0 0 var(--green); }
.theme-dark .metric-card,
.theme-dark .dashboard-weight-card,
.theme-dark .dashboard-activity-card,
.theme-dark .dashboard-calendar,
.theme-dark .diary-panel,
.theme-dark .activity-stat-grid article,
.theme-dark .trend-stat,
.theme-dark .barcode-lookup-panel { border-top-color: #414141; }
.theme-dark .meal-heading { border-left-color: #626262; }
.theme-dark .meal-heading-nutrients > strong,
.theme-dark .diary-calories,
.theme-dark .diary-macro-list b,
.theme-dark .weight-logged-state { color: var(--ink); }
.theme-dark .progress-track span,
.theme-dark .weekly-activity-row span i { background: #92b5d1; }
.theme-dark .weekly-activity-row span.steps i { background: #a0a0a0; }
.theme-dark .status-pill, .theme-dark .count-label { background: #303030; color: #c6c6c6; }
.theme-dark .metric-card small.metric-target-adjusted,
.theme-dark .metric-activity-indicator { color: var(--night-success); }
.theme-dark .metric-activity-indicator { background: #293c32; }
.theme-dark .message:not(.message--error):not(.message--warning),
.theme-dark .undo-banner, .theme-dark .meal-copy-panel,
.theme-dark .diary-row, .theme-dark .meal-inline-search,
.theme-dark .meal-quick-add-form, .theme-dark .quick-macro-form,
.theme-dark .diary-inline-edit, .theme-dark .activity-inline-edit,
.theme-dark .copy-source-entries, .theme-dark .copy-meal-group,
.theme-dark .recipe-calculation, .theme-dark .recipe-calculation > div { border-color: var(--line); }
.theme-dark .diary-row:hover { border-color: #656565; background: #303030; }
.theme-dark .meal-action-icon:hover,
.theme-dark .favourite-button:hover,
.theme-dark .favourite-button.is-favourite,
.theme-dark .copy-entry-option:hover { background: #343434; border-color: #858585; color: var(--ink); }
.theme-dark .recipe-calculation .selected-portion { background: #303030; color: var(--ink); }
.theme-dark .recipe-calculation .selected-portion .eyebrow,
.theme-dark .recipe-calculation .selected-portion span { color: #cecece; }
.theme-dark :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(146, 181, 209, .16);
}
.theme-dark .weight-chart-reset:hover:not(:disabled), .theme-dark .weight-chart-reset:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(146, 181, 209, .16);
}
.theme-dark .weight-trend-line { stroke: #92b5d1; }
.theme-dark .weight-projection-line, .theme-dark .projection-point { stroke: #a7bac9; }
.theme-dark .weight-chart-legend .trend-key { border-top-color: #92b5d1; }
.theme-dark .weight-chart-legend .projection-key { border-top-color: #a7bac9; }
.theme-dark .weight-chart-legend .medication-key { background: #bd91e2; }
.theme-dark .trend-intake-bar { background: #92b5d1; }
.theme-dark .trend-target-marker, .theme-dark .trend-chart-legend span:last-child i { background: #c0c0c0; }
.theme-dark .balance-line, .theme-dark .balance-point { stroke: #91bbc8; }
.theme-dark .energy-balance-legend .balance-key { background: #91bbc8; }
.theme-dark .energy-zero-line { stroke: #858585; }
.theme-dark .chart-crosshair { stroke: #a4a4a4; }
.theme-dark .weight-point:focus, .theme-dark .projection-point:focus, .theme-dark .medication-annotation:focus {
  filter: drop-shadow(0 0 3px rgba(146, 181, 209, .55));
}
.theme-dark .legend-target { background: #83b396; }
.theme-dark .auth-page, .theme-dark .barcode-camera { background: var(--paper); }

@media (max-width: 760px) {
  .theme-dark .sidebar { background: rgba(25, 25, 25, .97); }
}
