/* 오늘의 수지 (energy-balance) — 시각 단일 진실원천: projects/energy-balance/DESIGN.md
   양 팔레트(Light/Dark) — frontmatter themes.light/dark · chart-tokens · exercise-categories 1:1 미러.
   시그니처 = 딥 파인 그린(솔잎/클로로필 = 자연의 에너지 통화).
   neutrals = warm hue (50–75°). pure-gray/보라/blue-purple ❌. 라즈베리는 차트·배지만. */

/* ===== no-JS 폴백 (light 기본 팔레트) ===== */
:root {
  --bg: oklch(0.985 0.006 75);
  --surface: oklch(0.997 0.004 75);
  --surface-2: oklch(0.965 0.008 75);
  --ink: oklch(0.23 0.020 60);
  --muted: oklch(0.50 0.015 60);
  --faint: oklch(0.62 0.012 65);
  --line: rgba(60, 50, 30, .10);
  --accent: oklch(0.52 0.110 155);
  --accent-deep: oklch(0.42 0.110 155);
  --accent-ink: oklch(0.99 0.005 75);
  --danger: oklch(0.58 0.165 354);

  --chart-1: oklch(0.52 0.110 155);
  --chart-2: oklch(0.72 0.135 75);
  --chart-3: oklch(0.55 0.090 200);
  --chart-4: oklch(0.58 0.165 354);
  --chart-5: oklch(0.62 0.130 165);

  --ex-cardio: oklch(0.58 0.130 180);
  --ex-strength: oklch(0.55 0.140 30);
  --ex-flexibility: oklch(0.62 0.110 145);
  --ex-daily: oklch(0.70 0.090 85);
  --ex-hiit: oklch(0.56 0.160 25);

  --grad-accent: linear-gradient(150deg, var(--accent), var(--accent-deep));
  --shadow-sm: 0 1px 2px rgba(60,50,30,.06);
  --shadow-md: 0 10px 26px -14px rgba(60,50,30,.20);
  --shadow-focus: 0 0 0 3px rgba(34,120,80,.22);

  --font-display: "Cabinet Grotesk", "Pretendard Variable", sans-serif;
  --font-body: "Geist", "Pretendard Variable", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;

  --fs-display: 44px; --lh-display: 1.05; --fw-display: 700;
  --fs-h1: 24px;      --lh-h1: 1.20;      --fw-h1: 700;
  --fs-h2: 17px;      --lh-h2: 1.35;      --fw-h2: 600;
  --fs-body: 15.5px;  --lh-body: 1.60;
  --fs-small: 13px;   --lh-small: 1.45;
  --fs-metric: 36px;  --lh-metric: 1.0;

  --sp-xs: 6px; --sp-sm: 10px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 36px;
  --r-sm: 10px; --r-base: 14px; --r-lg: 20px; --r-pill: 999px;

  --t-base: 240ms; --t-fast: 140ms; --t-slow: 400ms;
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* ===== Light palette (명시) ===== */
:root[data-theme="light"] {
  --bg: oklch(0.985 0.006 75);
  --surface: oklch(0.997 0.004 75);
  --surface-2: oklch(0.965 0.008 75);
  --ink: oklch(0.23 0.020 60);
  --muted: oklch(0.50 0.015 60);
  --faint: oklch(0.62 0.012 65);
  --line: rgba(60, 50, 30, .10);
  --accent: oklch(0.52 0.110 155);
  --accent-deep: oklch(0.42 0.110 155);
  --accent-ink: oklch(0.99 0.005 75);
  --danger: oklch(0.58 0.165 354);

  --chart-1: oklch(0.52 0.110 155);
  --chart-2: oklch(0.72 0.135 75);
  --chart-3: oklch(0.55 0.090 200);
  --chart-4: oklch(0.58 0.165 354);
  --chart-5: oklch(0.62 0.130 165);

  --ex-cardio: oklch(0.58 0.130 180);
  --ex-strength: oklch(0.55 0.140 30);
  --ex-flexibility: oklch(0.62 0.110 145);
  --ex-daily: oklch(0.70 0.090 85);
  --ex-hiit: oklch(0.56 0.160 25);

  --grad-accent: linear-gradient(150deg, var(--accent), var(--accent-deep));
  --shadow-sm: 0 1px 2px rgba(60,50,30,.06);
  --shadow-md: 0 10px 26px -14px rgba(60,50,30,.20);
  --shadow-focus: 0 0 0 3px rgba(34,120,80,.22);
}

/* ===== Dark palette (warm deep charcoal, pure-gray ❌) ===== */
:root[data-theme="dark"] {
  --bg: oklch(0.19 0.008 65);
  --surface: oklch(0.23 0.010 65);
  --surface-2: oklch(0.27 0.012 65);
  --ink: oklch(0.95 0.008 75);
  --muted: oklch(0.70 0.012 65);
  --faint: oklch(0.55 0.010 60);
  --line: rgba(255, 235, 205, .12);
  --accent: oklch(0.62 0.090 155);
  --accent-deep: oklch(0.52 0.100 155);
  --accent-ink: oklch(0.16 0.020 155);
  --danger: oklch(0.64 0.150 354);

  --chart-1: oklch(0.62 0.090 155);
  --chart-2: oklch(0.78 0.115 75);
  --chart-3: oklch(0.66 0.075 200);
  --chart-4: oklch(0.64 0.150 354);
  --chart-5: oklch(0.70 0.115 165);

  --ex-cardio: oklch(0.68 0.105 180);
  --ex-strength: oklch(0.66 0.120 30);
  --ex-flexibility: oklch(0.71 0.090 145);
  --ex-daily: oklch(0.78 0.075 85);
  --ex-hiit: oklch(0.64 0.145 25);

  --grad-accent: linear-gradient(150deg, var(--accent), var(--accent-deep));
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
  --shadow-md: 0 14px 32px -16px rgba(0,0,0,.55);
  --shadow-focus: 0 0 0 3px rgba(120,200,160,.22);
}

/* ===== i18n / theme switch 브릿지 (양 [data-theme]에서 가독) ===== */
:root[data-theme="light"] .i18n-switch {
  --i18n-switch-bg: var(--surface-2);
  --i18n-switch-border: var(--line);
  --i18n-switch-fg: var(--ink);
  --i18n-switch-active-bg: color-mix(in oklch, var(--accent) 18%, transparent);
  --i18n-switch-active-fg: var(--accent);
  --i18n-switch-menu-bg: var(--surface);
  --i18n-switch-menu-border: var(--line);
  --i18n-switch-shadow: 0 8px 24px rgba(0,0,0,.18);
}
:root[data-theme="dark"] .i18n-switch {
  --i18n-switch-bg: var(--surface-2);
  --i18n-switch-border: var(--line);
  --i18n-switch-fg: var(--ink);
  --i18n-switch-active-bg: color-mix(in oklch, var(--accent) 22%, transparent);
  --i18n-switch-active-fg: var(--accent);
  --i18n-switch-menu-bg: var(--surface);
  --i18n-switch-menu-border: var(--line);
  --i18n-switch-shadow: 0 8px 24px rgba(0,0,0,.45);
}
:root[data-theme="light"] .theme-switch {
  --theme-switch-bg: var(--surface);
  --theme-switch-border: var(--line);
  --theme-switch-fg: var(--muted);
  --theme-switch-active-bg: var(--accent);
  --theme-switch-active-fg: var(--accent-ink);
  --theme-switch-radius: 10px;
}
:root[data-theme="dark"] .theme-switch {
  --theme-switch-bg: var(--surface);
  --theme-switch-border: var(--line);
  --theme-switch-fg: var(--muted);
  --theme-switch-active-bg: var(--accent);
  --theme-switch-active-fg: var(--accent-ink);
  --theme-switch-radius: 10px;
}

/* ===== reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.num, data, .tabular, .chart-label, .metric-big .v, .donut-center text, .bar-7day text {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r-sm); }
svg { display: block; }

/* ===== layout ===== */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 28px) 100px; }
.topbar {
  max-width: 760px; margin: 0 auto;
  padding: 22px clamp(16px, 5vw, 28px) 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--grad-accent); color: var(--accent-ink);
  border-radius: 12px; box-shadow: var(--shadow-md);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: var(--fw-h1); letter-spacing: -.01em;
  line-height: 1.15;
}
.brand-text p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: var(--r-pill);
}
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-sm); font-size: 16px; transition: all var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }

/* ===== hero ===== */
.hero { padding: 6px 0 4px; }
.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-h1); font-weight: var(--fw-h1);
  letter-spacing: -.015em; line-height: 1.1;
  color: var(--ink);
}
.hero-tag { font-size: var(--fs-body); color: var(--muted); margin-top: 8px; max-width: 60ch; }
.hero-tag .accent { color: var(--accent); font-weight: 600; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ===== buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: var(--fs-small); font-weight: 600;
  padding: 10px 18px; min-height: 40px; border-radius: var(--r-sm);
  border: 1px solid transparent; transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: 12px; }
.btn.primary {
  background: var(--grad-accent); color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in oklch, var(--danger) 30%, transparent); }
.btn.danger:hover { background: color-mix(in oklch, var(--danger) 10%, transparent); }

/* ===== step indicator ===== */
.step-indicator {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin: 16px 0;
}
.step-cell {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 6px; text-align: center;
  font-size: 11px; color: var(--muted); font-weight: 600;
  transition: all var(--t-base) var(--ease);
  position: relative;
}
.step-cell .step-num {
  display: block; font-family: var(--font-display);
  font-size: 14px; font-weight: var(--fw-h2); color: var(--faint);
  line-height: 1; margin-bottom: 4px;
}
.step-cell.is-past { background: color-mix(in oklch, var(--accent) 14%, transparent); color: var(--accent); }
.step-cell.is-past .step-num { color: var(--accent); }
.step-cell.is-current {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.step-cell.is-current .step-num { color: var(--accent-ink); }
.step-cell button { all: unset; cursor: pointer; display: block; width: 100%; }

/* ===== step card ===== */
.step-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: var(--sp-lg);
  margin-top: 14px;
  animation: cardIn var(--t-base) var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.step-card h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h1); font-weight: var(--fw-h1); letter-spacing: -.01em;
  line-height: 1.2; color: var(--ink);
}
.step-card .sub { color: var(--muted); font-size: var(--fs-small); margin-top: 6px; max-width: 60ch; }
.step-card .step-actions {
  display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; align-items: center;
}
.step-card .step-actions .spacer { flex: 1; }
.ledger-strip {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding: 10px 14px; margin-top: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12px; color: var(--muted);
}
.ledger-strip strong { color: var(--accent); font-weight: 600; }

/* ===== inputs (sliders, chips, radios) ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field > .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-top: 0; }
input[type="number"], input[type="text"], select {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 12px; border-radius: var(--r-sm); width: 100%;
  font-variant-numeric: tabular-nums; transition: border-color var(--t-fast) var(--ease);
}
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent); outline: none;
}

.sex-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.sex-radio label, .place-radio label, .shape-radio label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all var(--t-fast) var(--ease); text-align: center;
}
.sex-radio input, .place-radio input, .shape-radio input { display: none; }
.sex-radio label:hover, .place-radio label:hover, .shape-radio label:hover { border-color: var(--accent); }
.sex-radio label.on, .place-radio label.on, .shape-radio label.on {
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  border-color: var(--accent); color: var(--accent); font-weight: 600;
}

.act-list, .place-radio { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; min-height: 34px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); color: var(--ink); font-size: 12px; font-weight: 500;
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.on {
  background: color-mix(in oklch, var(--accent) 16%, transparent);
  border-color: var(--accent); color: var(--accent);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* sliders */
.slider-row { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.slider-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.slider-label .v { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
  margin-top: -10px; cursor: grab;
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); cursor: grab;
}

/* ===== metric-big ===== */
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 620px) { .metric-grid { grid-template-columns: repeat(4, 1fr); } }
.metric-big {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: var(--sp-md);
}
.metric-big .k { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.metric-big .v {
  display: block; margin-top: 4px;
  font-family: var(--font-display); font-size: var(--fs-metric);
  font-weight: var(--fw-display); line-height: 1; color: var(--accent);
  letter-spacing: -.02em;
}
.metric-big .u { font-size: 14px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.metric-big .tip { display: block; margin-top: 8px; font-size: 11px; color: var(--faint); }

/* ===== preset cards (Step 1) ===== */
.preset-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-top: 6px; scroll-snap-type: x mandatory; }
.preset-card {
  flex: 0 0 130px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: 12px; cursor: pointer; scroll-snap-align: start;
  transition: all var(--t-fast) var(--ease); text-align: left;
}
.preset-card:hover { border-color: var(--accent); }
.preset-card.on {
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  border-color: var(--accent); border-width: 2px; padding: 11px;
}
.preset-card .pn { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.preset-card .pd { font-size: 11px; color: var(--muted); min-height: 28px; line-height: 1.35; }
.preset-card .pp { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; }
.preset-card .mini-donut { margin-top: 8px; }

/* donut + macro grams */
.donut-wrap { display: flex; gap: 18px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.donut-chart { width: 180px; height: 180px; }
.donut-center text { font-family: var(--font-display); font-weight: 700; fill: var(--ink); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.donut-legend .leg { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-legend .leg .sw { width: 12px; height: 12px; border-radius: 3px; }
.donut-legend .leg .ll { flex: 1; color: var(--ink); }
.donut-legend .leg .lv { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ===== meal card (Step 2) ===== */
.meal-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.meal-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px;
  animation: cardIn var(--t-base) var(--ease) both;
}
.meal-card .slot { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.meal-card .rname { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.meal-card .nutr { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.meal-card .nutr .p { color: var(--chart-1); font-weight: 600; }
.meal-card .nutr .c { color: var(--chart-2); font-weight: 600; }
.meal-card .nutr .f { color: var(--chart-3); font-weight: 600; }
.meal-card .ings { font-size: 11px; color: var(--faint); margin-top: 4px; grid-column: 1 / -1; }
.meal-card .swap { align-self: start; }

/* stack bar */
.stack-bar-wrap { margin-top: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.stack-bar { height: 14px; background: var(--bg); border-radius: var(--r-pill); position: relative; overflow: hidden; }
.stack-seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; transition: all var(--t-base) var(--ease); }
.stack-target-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); opacity: .6; }
.stack-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

.deviation-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; margin-top: 12px;
}
.deviation-badge.hit { background: color-mix(in oklch, var(--chart-5) 18%, transparent); color: var(--chart-5); }
.deviation-badge.near { background: color-mix(in oklch, var(--chart-2) 18%, transparent); color: var(--chart-2); }
.deviation-badge.over, .deviation-badge.under { background: color-mix(in oklch, var(--chart-4) 14%, transparent); color: var(--chart-4); }
.deviation-badge.under { background: color-mix(in oklch, var(--chart-3) 14%, transparent); color: var(--chart-3); }

/* ===== exercise (Step 3) ===== */
.diff-header {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: 14px 16px; margin-top: 12px;
  display: flex; align-items: center; gap: 16px;
}
.diff-header.surplus .v { color: var(--chart-4); }
.diff-header.deficit .v { color: var(--chart-5); }
.diff-header.balanced .v { color: var(--chart-5); }
.diff-header .lbl { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.diff-header .v { font-family: var(--font-display); font-size: var(--fs-display); font-weight: var(--fw-display); line-height: 1; font-variant-numeric: tabular-nums; }
.diff-header .u { font-size: 14px; color: var(--muted); margin-left: 4px; }

.section-block { margin-top: 18px; }
.section-block > h3 { font-size: var(--fs-h2); font-weight: var(--fw-h2); color: var(--ink); }
.section-block > .tip { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ex-row {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.ex-row:last-child { border-bottom: 0; }
.ex-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.ex-row .nm { color: var(--ink); font-weight: 500; }
.ex-row .meta { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.ex-row .meta strong { color: var(--accent); font-weight: 600; }
.ex-list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-base); margin-top: 8px; overflow: hidden; }

.routine-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
@media (max-width: 540px) { .routine-grid { grid-template-columns: 1fr; } }
.routine-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-base); padding: 12px; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.routine-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.routine-card .rn { font-size: 13px; font-weight: 700; color: var(--ink); }
.routine-card .rp { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.routine-card .rd { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* gauge semi */
.gauge-wrap { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-base); padding: 16px; margin-top: 12px; text-align: center; }
.gauge-semi { width: 100%; max-width: 360px; margin: 0 auto; }
.gauge-semi .gauge-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.gauge-semi .center-num { font-family: var(--font-display); font-weight: 700; font-size: 22px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.gauge-semi.is-hit .arc { stroke: var(--chart-5); }
.gauge-semi.is-hit { animation: hitPulse 400ms var(--ease); }
@keyframes hitPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@keyframes hitPulse2 {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ===== 7-day bar (Step 4) ===== */
.bar-7day-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-base); padding: 16px; margin-top: 12px; }
.bar-7day { width: 100%; height: 200px; }
.bar-7day .bar-label { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.bar-7day .zero-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--muted); justify-content: center; flex-wrap: wrap; }
.legend .ll { display: inline-flex; align-items: center; gap: 5px; }
.legend .ll .sw { width: 10px; height: 10px; border-radius: 2px; }

.log-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.log-table th, .log-table td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.log-table th { font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.log-table th:first-child, .log-table td:first-child { text-align: left; }
.log-table td.net.hit { color: var(--chart-5); font-weight: 600; }
.log-table td.net.over { color: var(--chart-4); font-weight: 600; }
.log-table td.net.under { color: var(--chart-3); font-weight: 600; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.summary-cell { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-base); padding: 12px; text-align: center; }
.summary-cell .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.summary-cell .v { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent); margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1; }

/* badge hit */
.badge-hit {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700;
  background: color-mix(in oklch, var(--chart-5) 18%, transparent); color: var(--chart-5);
  animation: badgeIn var(--t-slow) var(--ease) both;
}
@keyframes badgeIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ===== empty ===== */
.empty { text-align: center; padding: 28px 16px; }
.empty .emoji { font-size: 32px; opacity: .6; }
.empty .title { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.empty .sub { margin-top: 4px; font-size: 12px; color: var(--muted); max-width: 40ch; margin-left: auto; margin-right: auto; }

/* ===== disclaimer ===== */
.disclaimer {
  font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 12px; margin-top: 12px;
  line-height: 1.5;
}

/* ===== modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  max-width: 480px; width: 100%; max-height: 86vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; font-weight: var(--fw-h2); }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.help-list { padding-left: 18px; }
.help-list li { margin: 8px 0; font-size: 13px; line-height: 1.55; color: var(--ink); }
.help-foot { margin-top: 14px; font-size: 12px; color: var(--muted); font-style: italic; }

/* ===== toast ===== */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: var(--r-pill); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md); opacity: 0;
  transition: all var(--t-base) var(--ease); z-index: 200;
  max-width: 90vw; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== footer ===== */
.foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 11px; color: var(--faint); }
.foot a { color: var(--muted); }

/* ===== RTL ===== */
[dir="rtl"] .topbar { direction: rtl; }
[dir="rtl"] .meal-card { direction: rtl; }

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
