:root {
  --bg: #f4f2eb;
  --surface: #ffffff;
  --surface-2: #f9f8f3;
  --ink: #17211b;
  --muted: #687069;
  --line: #dfe2dc;
  --line-strong: #c9cec7;
  --brand: #19623f;
  --brand-dark: #0f472d;
  --brand-soft: #dff1e6;
  --accent: #d8ff6f;
  --accent-ink: #283814;
  --warning: #a75d00;
  --warning-soft: #fff1d8;
  --danger: #a63737;
  --danger-soft: #fde7e7;
  --blue: #255f9d;
  --blue-soft: #e6f1ff;
  --purple: #6b4da3;
  --purple-soft: #f0eafd;
  --shadow: 0 16px 45px rgba(32, 45, 37, 0.08);
  --shadow-sm: 0 6px 22px rgba(32, 45, 37, 0.07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar: 252px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* Authentication */
.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
  background: var(--bg);
}
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 6vw, 78px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(216, 255, 111, 0.28), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(85, 174, 121, 0.25), transparent 34%),
    linear-gradient(145deg, #0f472d 0%, #173c2a 54%, #14231b 100%);
}
.auth-visual::after {
  content: "";
  position: absolute;
  width: 440px;
  height: 440px;
  right: -160px;
  bottom: -130px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255,255,255,.035), 0 0 0 120px rgba(255,255,255,.025);
}
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; font-weight: 800; letter-spacing: -.03em; font-size: 22px; }
.logo-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: var(--brand-dark);
  background: var(--accent);
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
.auth-copy { position: relative; z-index: 1; max-width: 600px; }
.auth-kicker { margin: 0 0 14px; color: var(--accent); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.auth-copy h1 { margin: 0 0 18px; max-width: 600px; font-size: clamp(42px, 6vw, 76px); line-height: .97; letter-spacing: -.06em; }
.auth-copy p { max-width: 560px; margin: 0; color: rgba(255,255,255,.76); font-size: 18px; }
.auth-feature-row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.auth-feature { padding: 9px 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(255,255,255,.84); background: rgba(255,255,255,.06); backdrop-filter: blur(10px); }
.auth-panel { display: grid; place-items: center; padding: 30px; }
.auth-card { width: min(480px, 100%); padding: clamp(28px, 5vw, 50px); border: 1px solid rgba(23,33,27,.08); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 8px; font-size: 31px; letter-spacing: -.045em; }
.auth-card > p { margin: 0 0 28px; color: var(--muted); }
.auth-footer { margin-top: 24px; color: var(--muted); font-size: 13px; text-align: center; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #fff;
  background: linear-gradient(180deg, #173d2b 0%, #102a1e 100%);
  box-shadow: 10px 0 35px rgba(10, 35, 23, .08);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.sidebar-brand strong { display: block; font-size: 19px; letter-spacing: -.035em; }
.sidebar-brand small { display: block; margin-top: 2px; color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.nav-label { margin: 12px 10px 7px; color: rgba(255,255,255,.38); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.nav-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  color: rgba(255,255,255,.72);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-btn.active { color: var(--accent-ink); background: var(--accent); font-weight: 800; box-shadow: inset 0 -2px 0 rgba(0,0,0,.08); }
.nav-icon { display: grid; width: 24px; height: 24px; place-items: center; font-size: 16px; }
.sidebar-spacer { flex: 1; }
.sidebar-goal { padding: 16px; border: 1px solid rgba(255,255,255,.10); border-radius: 17px; background: rgba(255,255,255,.055); }
.sidebar-goal-top { display: flex; justify-content: space-between; color: rgba(255,255,255,.68); font-size: 12px; }
.sidebar-goal strong { color: #fff; }
.sidebar-progress { height: 7px; margin: 10px 0 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.12); }
.sidebar-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.sidebar-goal small { color: rgba(255,255,255,.45); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.09); }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--brand-dark); background: var(--accent); font-weight: 900; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { color: rgba(255,255,255,.45); }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.sidebar .icon-button { width: 34px; height: 34px; color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.10); background: rgba(255,255,255,.06); }

.main-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 4vw, 50px);
  border-bottom: 1px solid rgba(23,33,27,.08);
  background: rgba(244,242,235,.88);
  backdrop-filter: blur(18px);
}
.topbar-title h1 { margin: 0; font-size: 25px; line-height: 1.1; letter-spacing: -.045em; }
.topbar-title p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.mobile-brand { display: none; align-items: center; gap: 10px; font-weight: 900; }
.content { width: min(1550px, 100%); margin: 0 auto; padding: 30px clamp(20px, 4vw, 50px) 80px; }
.view-enter { animation: viewIn .24s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Type and layout */
.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: 11px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1.05; letter-spacing: -.055em; }
.page-heading p { max-width: 720px; margin: 8px 0 0; color: var(--muted); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 26px 0 13px; }
.section-title h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }
.inline { display: flex; align-items: center; gap: 9px; }
.inline-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; }

/* Cards */
.card { border: 1px solid rgba(23,33,27,.075); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-header h3, .card-header h4 { margin: 0; letter-spacing: -.025em; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.hero-card {
  position: relative;
  min-height: 286px;
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
  color: #fff;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 88% 10%, rgba(216,255,111,.25), transparent 31%),
    linear-gradient(135deg, #15472f 0%, #173d2b 55%, #11261b 100%);
  box-shadow: var(--shadow);
}
.hero-card::after { content: ""; position: absolute; width: 320px; height: 320px; right: -110px; bottom: -180px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.018); }
.hero-card > * { position: relative; z-index: 1; }
.hero-top { display: flex; justify-content: space-between; gap: 20px; }
.hero-copy h2 { margin: 0; max-width: 700px; font-size: clamp(30px, 5vw, 52px); line-height: 1.02; letter-spacing: -.06em; }
.hero-copy p { max-width: 650px; margin: 14px 0 0; color: rgba(255,255,255,.67); }
.hero-number { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.hero-metric { padding: 13px 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.055); }
.hero-metric small { display: block; color: rgba(255,255,255,.5); }
.hero-metric strong { display: block; margin-top: 4px; font-size: 18px; }
.metric-card { padding: 18px; }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric-value { margin: 10px 0 6px; font-size: 30px; font-weight: 850; letter-spacing: -.05em; }
.metric-sub { color: var(--muted); font-size: 12px; }
.metric-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 900; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stat-strip-item { padding: 17px 18px; border-right: 1px solid var(--line); }
.stat-strip-item:last-child { border-right: 0; }
.stat-strip-item small { display: block; color: var(--muted); }
.stat-strip-item strong { display: block; margin-top: 4px; font-size: 20px; letter-spacing: -.035em; }
.empty-state { padding: 38px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); text-align: center; background: var(--surface-2); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 17px; }

/* Buttons and tags */
.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: #aeb5ae; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .52; cursor: not-allowed; transform: none; }
.btn-primary { color: #fff; border-color: var(--brand); background: var(--brand); }
.btn-primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-accent { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.btn-dark { color: #fff; border-color: var(--ink); background: var(--ink); }
.btn-soft { color: var(--brand-dark); border-color: transparent; background: var(--brand-soft); }
.btn-danger { color: var(--danger); border-color: #efc6c6; background: var(--danger-soft); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 6px 10px; border-radius: 10px; font-size: 12px; }
.btn-lg { min-height: 50px; padding: 12px 20px; border-radius: 14px; }
.hero-card .btn-ghost { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.06); }
.hero-card .btn-ghost:hover { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.1); }
.pill, .tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; white-space: nowrap; }
.pill { padding: 6px 10px; color: var(--muted); background: var(--surface-2); font-size: 12px; font-weight: 700; }
.tag { padding: 4px 8px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.tag.warning { color: var(--warning); background: var(--warning-soft); }
.tag.danger { color: var(--danger); background: var(--danger-soft); }
.tag.blue { color: var(--blue); background: var(--blue-soft); }
.tag.purple { color: var(--purple); background: var(--purple-soft); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status-dot.ok { background: #23a15c; box-shadow: 0 0 0 4px rgba(35,161,92,.12); }

/* Forms */
.field { display: grid; gap: 7px; }
.field label { color: #384239; font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea, .input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  outline: none;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(25,98,63,.11); }
.field-hint { color: var(--muted); font-size: 11px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.check-card { position: relative; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-card span { display: flex; min-height: 48px; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: .15s ease; }
.check-card input:checked + span { color: var(--brand-dark); border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); font-weight: 800; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: #e8e9e4; }
.segmented button { min-height: 34px; padding: 5px 11px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 700; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.range-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.range-row input[type="range"] { width: 100%; accent-color: var(--brand); }

/* Progress and charts */
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e7e9e4; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #5eaa75); }
.progress-track.accent span { background: var(--accent); }
.ring { --value: 0; --ring-color: var(--brand); display: grid; width: 112px; height: 112px; place-items: center; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), #e9ebe6 0); }
.ring::before { content: ""; grid-area: 1/1; width: 82px; height: 82px; border-radius: 50%; background: var(--surface); }
.ring-content { position: relative; z-index: 1; grid-area: 1/1; text-align: center; }
.ring-content strong { display: block; font-size: 22px; letter-spacing: -.04em; }
.ring-content small { display: block; color: var(--muted); font-size: 10px; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.macro { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.macro-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.macro strong { display: block; margin-top: 5px; font-size: 17px; }
.mini-track { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #e3e6e0; }
.mini-track span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.chart-wrap { position: relative; min-height: 260px; }
.chart-svg { width: 100%; height: auto; min-height: 240px; overflow: visible; }
.chart-grid-line { stroke: #e3e6e0; stroke-width: 1; }
.chart-axis-label { fill: #8a918b; font-size: 10px; font-family: var(--font); }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGradient); opacity: .35; }
.chart-dot { fill: #fff; stroke: var(--brand); stroke-width: 3; }
.chart-target { fill: none; stroke: #a8afaa; stroke-width: 2; stroke-dasharray: 6 6; }
.chart-tooltip { position: absolute; z-index: 3; padding: 7px 9px; border-radius: 9px; color: #fff; background: var(--ink); font-size: 11px; pointer-events: none; transform: translate(-50%, -115%); }
.bar-chart { display: flex; min-height: 190px; align-items: flex-end; gap: 10px; padding: 10px 4px 28px; }
.bar-column { position: relative; display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.bar { width: min(34px, 80%); min-height: 4px; border-radius: 8px 8px 3px 3px; background: var(--brand); }
.bar-column small { position: absolute; top: calc(100% + 8px); color: var(--muted); font-size: 10px; }

/* Lists and meals */
.list { display: grid; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.list-row-main { min-width: 0; flex: 1; }
.list-row-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-main small { display: block; margin-top: 2px; color: var(--muted); }
.list-row-value { flex: 0 0 auto; font-weight: 850; font-variant-numeric: tabular-nums; }
.meal-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.meal-group-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.meal-group-header h4 { margin: 0; }
.meal-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 15px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.meal-item:last-child { border-bottom: 0; }
.meal-item-name strong { display: block; }
.meal-item-name small { color: var(--muted); }
.nutrition-summary { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 22px; }

/* Training */
.plan-week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 9px; overflow-x: auto; padding-bottom: 5px; }
.day-card { min-height: 185px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.day-card.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.day-card.rest { color: var(--muted); background: var(--surface-2); }
.day-name { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.day-card h4 { margin: 0 0 5px; font-size: 15px; }
.day-card p { margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.exercise-list-compact { display: grid; gap: 6px; }
.exercise-list-compact span { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.exercise-list-compact span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.exercise-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.exercise-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.exercise-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.exercise-card-art { padding: 10px; background: #f6f7f2; }
.exercise-card-body { display: flex; flex: 1; flex-direction: column; padding: 16px; }
.exercise-card h3 { margin: 8px 0 6px; font-size: 18px; letter-spacing: -.035em; }
.exercise-card p { margin: 0; color: var(--muted); font-size: 13px; }
.exercise-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.exercise-card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; }
.exercise-illustration { display: block; width: 100%; height: auto; }
.art-bg { fill: #f7f8f4; }
.art-divider { stroke: #dde1da; stroke-width: 1; stroke-dasharray: 4 5; }
.body-line { fill: none; stroke: #34413a; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.body-line.accent { stroke: var(--brand); }
.joint { fill: var(--brand); }
.ground { stroke: #bfc6bf; stroke-width: 3; stroke-linecap: round; }
.weight { fill: #34413a; }
.accent-fill { fill: var(--brand); }
.box { fill: #e0e4dd; stroke: #aeb6ae; stroke-width: 2; }
.accent-stroke { fill: none; stroke: var(--brand); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.band { fill: none; stroke: #8c5cae; stroke-width: 4; stroke-linecap: round; }
.wheel { fill: none; stroke: #34413a; stroke-width: 3; }
.bike { fill: none; stroke: #34413a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.motion-arrow { fill: none; stroke: #de8b34; stroke-width: 3; stroke-dasharray: 5 4; stroke-linecap: round; }
.arrow-head { fill: #de8b34; }
.art-label { fill: #89918b; font-size: 9px; font-weight: 900; letter-spacing: .1em; font-family: var(--font); }
.exercise-detail-layout { display: grid; grid-template-columns: minmax(300px, .95fr) minmax(0, 1.05fr); gap: 24px; }
.step-list { display: grid; gap: 10px; counter-reset: steps; margin: 0; padding: 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 30px 1fr; align-items: start; gap: 10px; }
.step-list li::before { counter-increment: steps; content: counter(steps); display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); font-size: 12px; font-weight: 900; }
.cue-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.cue-list li { position: relative; padding-left: 20px; }
.cue-list li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 900; }
.workout-exercise { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.workout-exercise.complete { border-color: #9bd5af; background: #f3fbf6; }
.workout-log-grid { display: grid; grid-template-columns: 80px 110px 100px 1fr auto; align-items: end; gap: 9px; margin-top: 12px; }
.timer-panel { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 15px; color: #fff; background: var(--ink); }
.timer-time { min-width: 80px; color: var(--accent); font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }

/* Menus and Keller */
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.menu-card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.menu-card h3 { margin: 8px 0 7px; font-size: 21px; letter-spacing: -.04em; }
.menu-card > p { margin: 0; color: var(--muted); }
.menu-nutrition { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 16px 0; }
.menu-nutrition div { padding: 9px; border-radius: 11px; background: var(--surface-2); text-align: center; }
.menu-nutrition strong { display: block; }
.menu-nutrition small { color: var(--muted); font-size: 10px; }
.ingredients { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 17px; }
.inventory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.inventory-item { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.inventory-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inventory-item small { color: var(--muted); }
.shopping-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.shopping-row:last-child { border-bottom: 0; }
.shopping-row.checked .shopping-name { color: var(--muted); text-decoration: line-through; }
.shopping-check { width: 20px; height: 20px; accent-color: var(--brand); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.photo-card { position: relative; overflow: hidden; aspect-ratio: 4/5; border-radius: 16px; background: #dfe3dd; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; }
.photo-card-overlay { position: absolute; inset: auto 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 30px 11px 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.photo-card-overlay strong { display: block; font-size: 12px; }
.photo-card-overlay small { color: rgba(255,255,255,.75); }
.photo-delete { width: 30px; height: 30px; border: 0; border-radius: 9px; color: #fff; background: rgba(0,0,0,.35); cursor: pointer; }
.compare-stage { position: relative; overflow: hidden; width: 100%; aspect-ratio: 4/3; border-radius: var(--radius-lg); background: #dfe3dd; }
.compare-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #111; }
.compare-stage .after { clip-path: inset(0 50% 0 0); }
.compare-divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.compare-divider::after { content: "↔"; position: absolute; top: 50%; left: 50%; display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--ink); background: #fff; transform: translate(-50%, -50%); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.privacy-note { display: flex; gap: 11px; padding: 14px; border: 1px solid #cddcef; border-radius: 14px; color: #244968; background: #edf5ff; font-size: 12px; }

/* Chat */
.chat-shell { display: grid; min-height: 620px; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ai-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: var(--brand-dark); background: var(--accent); font-weight: 900; }
.chat-messages { display: flex; flex-direction: column; gap: 13px; overflow-y: auto; padding: 20px; background: linear-gradient(180deg, #fbfcf9, #f6f6f1); }
.chat-message { display: flex; max-width: min(760px, 88%); gap: 9px; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; background: #fff; white-space: pre-wrap; }
.chat-message.user .chat-bubble { color: #fff; border-color: var(--brand); border-radius: 16px 16px 5px 16px; background: var(--brand); }
.chat-message small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.chat-message.user small { color: rgba(255,255,255,.65); }
.chat-compose { padding: 14px; border-top: 1px solid var(--line); background: #fff; }
.chat-input-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.chat-input-row textarea { min-height: 50px; max-height: 160px; resize: vertical; }
.prompt-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 10px; }
.prompt-chip { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-2); cursor: pointer; font-size: 11px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Alerts */
.notice { display: flex; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); }
.notice.warning { color: #6d460f; border-color: #efd2a4; background: var(--warning-soft); }
.notice.success { color: var(--brand-dark); border-color: #b6dfc3; background: #edf9f1; }
.notice.danger { color: #792828; border-color: #efbebe; background: var(--danger-soft); }
.notice-icon { display: grid; width: 30px; height: 30px; place-items: center; flex: 0 0 auto; border-radius: 10px; background: rgba(255,255,255,.6); font-weight: 900; }
.notice strong { display: block; margin-bottom: 2px; }
.notice p { margin: 0; font-size: 12px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(11,20,14,.64); backdrop-filter: blur(7px); opacity: 0; visibility: hidden; transition: .18s ease; }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 24px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.3); transform: translateY(10px) scale(.98); transition: .2s ease; }
.modal-backdrop.open .modal { transform: none; }
.modal-lg { width: min(1060px, 100%); }
.modal-xl { width: min(1260px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.modal-head h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.modal-body { padding: 22px; }
.modal-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 14px 22px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }

/* Scanner */
.scanner-frame { position: relative; overflow: hidden; min-height: 340px; border-radius: 18px; background: #101712; }
#scannerReader { width: 100%; min-height: 340px; }
.scanner-frame::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: min(75%, 360px); height: 130px; border: 3px solid var(--accent); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.scanner-status { margin: 12px 0 0; color: var(--muted); text-align: center; }

/* Toast and loader */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; width: min(380px, calc(100vw - 36px)); gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; color: #fff; background: #1e2a22; box-shadow: var(--shadow); animation: toastIn .2s ease; }
.toast.error { background: #762e2e; }
.toast.success { background: #155636; }
.toast button { margin-left: auto; border: 0; color: inherit; background: transparent; cursor: pointer; opacity: .7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.loading-screen { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; color: #fff; background: #123322; }
.loading-mark { display: grid; gap: 14px; justify-items: center; }
.spinner { width: 38px; height: 38px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { overflow: hidden; min-height: 18px; border-radius: 8px; background: linear-gradient(90deg, #eceeea 25%, #f7f8f5 50%, #eceeea 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Mobile bottom nav */
.mobile-nav { display: none; }

@media (max-width: 1250px) {
  .exercise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1040px) {
  :root { --sidebar: 220px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: 1fr; }
  .exercise-detail-layout { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { min-height: 44vh; padding: 35px; }
  .auth-feature-row { display: none; }
  .auth-panel { padding: 24px 20px 45px; }
}

@media (max-width: 820px) {
  body { padding-bottom: 72px; }
  .sidebar { display: none; }
  .main-shell { margin-left: 0; }
  .topbar { min-height: 68px; padding: 11px 16px; }
  .topbar-title { display: none; }
  .mobile-brand { display: flex; }
  .content { padding: 22px 14px 40px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 6px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
  .mobile-nav button { display: grid; justify-items: center; gap: 2px; padding: 5px 2px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
  .mobile-nav button span { font-size: 17px; }
  .mobile-nav button.active { color: var(--brand); background: var(--brand-soft); font-weight: 800; }
  .hero-card { min-height: auto; }
  .hero-top { display: block; }
  .hero-metrics { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip-item:nth-child(2) { border-right: 0; }
  .stat-strip-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .exercise-grid { grid-template-columns: 1fr; }
  .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .macro-grid { grid-template-columns: repeat(2, 1fr); }
  .nutrition-summary { grid-template-columns: 1fr; }
  .ring { margin: 0 auto; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .workout-log-grid { grid-template-columns: repeat(2, 1fr); }
  .workout-log-grid .field:last-of-type { grid-column: 1 / -1; }
  .chat-shell { min-height: calc(100vh - 150px); }
}

@media (max-width: 560px) {
  .topbar-actions .btn span.label { display: none; }
  .page-heading { display: block; }
  .page-heading .btn { margin-top: 14px; }
  .hero-copy h2 { font-size: 35px; }
  .grid-4 { grid-template-columns: 1fr; }
  .metric-card { padding: 15px; }
  .menu-nutrition { grid-template-columns: repeat(2, 1fr); }
  .inventory-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .check-grid { grid-template-columns: 1fr; }
  .meal-item { grid-template-columns: 1fr auto; }
  .meal-item > :nth-child(2) { display: none; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .modal-body { padding: 17px; }
  .auth-visual { min-height: 38vh; }
  .auth-copy h1 { font-size: 40px; }
  .auth-copy p { font-size: 15px; }
  .auth-card { padding: 25px 20px; border-radius: 24px; }
}

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