/* ============================================================
   カロリー帳 — モダン・リニューアル
   Warm "paper + terracotta" system. Light / Dark via [data-mode].
   ============================================================ */

:root {
  /* accent (coral / terracotta — tweakable hue) */
  --acc-h: 28;
  --acc: oklch(0.66 0.13 var(--acc-h));
  --acc-strong: oklch(0.58 0.14 var(--acc-h));
  --acc-quiet: oklch(0.72 0.09 var(--acc-h));
  --on-acc: #fffaf6;

  --pos: oklch(0.64 0.13 28);   /* over budget — warm */
  --neg: oklch(0.58 0.09 165);  /* under budget — calm green */
  --wt-line: oklch(0.5 0.13 255); /* 累積体重の折れ線（青系） */
  /* いつ別 積み上げの色（朝・昼・夕・間食・なし） */
  --meal-breakfast: oklch(0.82 0.12 80);
  --meal-lunch: oklch(0.73 0.13 150);
  --meal-dinner: oklch(0.60 0.12 255);
  --meal-snack: oklch(0.70 0.15 350);
  --meal-none: oklch(0.74 0.02 80);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --ff: "Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  --ff-head: "Zen Kaku Gothic New", var(--ff);
  --ff-serif: "Newsreader", Georgia, serif;
  --ff-num: "Newsreader", Georgia, serif;
  --ff-data: "Noto Sans JP", system-ui, sans-serif;

  --nav-h: 64px;
}

/* ---------- Light (default) ---------- */
:root,
[data-mode="light"] {
  --bg: #F4F2EC;
  --bg-grad: radial-gradient(120% 80% at 88% -10%, #efe7dd 0%, transparent 52%),
             radial-gradient(90% 70% at 0% 0%, #f1ede2 0%, transparent 45%);
  --surface: #FCFBF7;
  --surface-2: #F1EEE5;
  --surface-3: #EBE7DB;
  --ink: #20201D;
  --ink-2: #57544C;
  --ink-3: #8C887C;
  --line: #E4E0D4;
  --line-strong: #D6D1C2;
  --shadow-sm: 0 1px 2px rgba(40,33,22,.04), 0 2px 8px -4px rgba(40,33,22,.08);
  --shadow: 0 2px 6px -2px rgba(40,33,22,.07), 0 14px 34px -16px rgba(40,33,22,.18);
  --shadow-lg: 0 18px 50px -18px rgba(40,33,22,.28);
  --ring-track: #E7E2D5;
}

/* ---------- Dark (warm charcoal) ---------- */
[data-mode="dark"] {
  --bg: #1B1A18;
  --bg-grad: radial-gradient(120% 80% at 88% -10%, #29251f 0%, transparent 55%),
             radial-gradient(90% 70% at 0% 0%, #232220 0%, transparent 45%);
  --surface: #262522;
  --surface-2: #2F2D29;
  --surface-3: #383631;
  --ink: #F2EFE6;
  --ink-2: #BBB6A8;
  --ink-3: #8A857728;
  --ink-3: #87826F;
  --line: #383631;
  --line-strong: #494640;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 2px 8px -2px rgba(0,0,0,.35), 0 16px 40px -18px rgba(0,0,0,.6);
  --shadow-lg: 0 22px 60px -20px rgba(0,0,0,.7);
  --ring-track: #38362F;
  --wt-line: oklch(0.72 0.13 255);
  --acc: oklch(0.7 0.13 var(--acc-h));
  --acc-strong: oklch(0.74 0.13 var(--acc-h));
  --neg: oklch(0.7 0.11 165);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 横方向のはみ出しでモバイルのレイアウトビューポートが広がり、position:fixed の
     オーバーレイ/モーダルが画面外へずれる（SPで確認）のを防ぐ。clip は sticky を壊さない。 */
  overflow-x: clip;
}
body {
  min-height: 100vh;
  background-image: var(--bg-grad);
  background-attachment: fixed;
  transition: background-color .35s ease, color .35s ease;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }

.num { font-family: var(--ff-data); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.serif { font-family: var(--ff-serif); }

/* ===================== Top nav (fixed) ===================== */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 14px;
  /* バーは全幅のまま、内容は本体(.page: max-width 1180px・中央寄せ・左右 padding clamp(16px,4vw,40px))
     と左右を揃える。広い画面では (画面幅-1180)/2 + 同じ padding を左右に確保し、本体の内容左右端に一致させる。
     1180/2 = 590px。狭い画面では clamp 値にフォールバック。 */
  padding: 0 max(clamp(16px, 4vw, 40px), calc(50% - 590px + clamp(16px, 4vw, 40px)));
  background: color-mix(in oklch, var(--bg) 78%, transparent);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid color-mix(in oklch, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; background: none; border: none; padding: 0; cursor: pointer; color: inherit; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(155deg, var(--acc) 0%, var(--acc-strong) 100%);
  color: var(--on-acc); display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px var(--acc);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-family: var(--ff-serif); font-size: 21px; font-weight: 600; letter-spacing: .005em; }
.brand-name .jp { font-family: var(--ff-head); font-size: 17px; font-weight: 700; }

.nav-tabs { display: flex; align-items: center; gap: 3px; margin-left: 8px; }
.nav-tabs-end { margin-left: 0; flex: none; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--radius-pill);
  border: none; background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 600; transition: .16s;
}
.nav-tab svg { width: 18px; height: 18px; }
.nav-tab:hover { background: var(--surface-2); color: var(--ink); }
.nav-tab.active { background: var(--surface); color: var(--acc-strong); box-shadow: var(--shadow-sm); }

.nav-spacer { flex: 1; }
.nav-right { display: flex; align-items: center; gap: 8px; flex: none; }

.mode-toggle {
  position: relative;
  width: 60px; height: 32px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  display: flex; align-items: center; padding: 0 5px; transition: .2s;
}
.mode-toggle .knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; color: var(--acc-strong);
  transition: transform .26s cubic-bezier(.5,1.6,.4,1);
}
[data-mode="dark"] .mode-toggle .knob { transform: translateX(28px); }
.mode-toggle .knob svg { width: 14px; height: 14px; }
.mode-toggle .t-ic { flex: 1; display: grid; place-items: center; color: var(--ink-3); }
.mode-toggle .t-ic svg { width: 13px; height: 13px; }

.icon-pill {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2);
  display: grid; place-items: center; transition: .15s;
}
.icon-pill:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-pill svg { width: 18px; height: 18px; }

/* nav labels collapse on small screens */
@media (max-width: 720px) {
  .nav-tab span { display: none; }
  .nav-tab { padding: 10px; }
  .brand-name { display: none; }
  .nav-tabs { margin-left: 2px; }
}

/* ===================== Page / content ===================== */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 30px) clamp(16px, 4vw, 40px) 120px;
}

.page-head { margin-bottom: 22px; }
.eyebrow {
  font-family: var(--ff-serif); font-style: italic; font-size: 15px;
  color: var(--acc-strong); margin-bottom: 4px;
}
.page-h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; font-family: var(--ff-head); letter-spacing: .01em; line-height: 1.1; }
.page-desc { font-size: 14px; color: var(--ink-3); margin-top: 7px; }

.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  color: var(--ink-3); text-transform: uppercase; margin: 0 0 12px 2px;
}
/* データ欄のサブ見出し（食事の記録 / 体重） */
.settings-subtle { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 8px 2px; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-lg { border-radius: var(--radius-lg); }

/* ===================== Dashboard ===================== */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* hero */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center;
  padding: 26px 28px;
}
.ring-wrap { position: relative; width: 168px; height: 168px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.ring-center .rc-pct { font-family: var(--ff-serif); font-size: 40px; font-weight: 600; line-height: 1; }
.ring-center .rc-pct .u { font-size: 17px; }
.ring-center .rc-lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }

.hero-body { min-width: 0; }
.hero-bal-lbl { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.hero-bal {
  font-family: var(--ff-serif); font-size: clamp(38px, 6vw, 56px); font-weight: 600;
  line-height: 1; margin: 4px 0 2px; letter-spacing: -.01em;
}
.hero-bal .u { font-family: var(--ff-head); font-size: 18px; font-weight: 700; margin-left: 6px; }
.hero-bal.pos { color: var(--pos); }
.hero-bal.neg { color: var(--neg); }
.hero-cap { font-size: 13px; color: var(--ink-2); }
.hero-cap b { font-weight: 700; }
/* ① 今日の目安カロリー（目標ペース） */
.hero-goalpace { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; margin-top: 12px; padding: 9px 13px; background: var(--acc-soft); border: 1px solid color-mix(in oklch, var(--acc) 22%, transparent); border-radius: 11px; font-size: 12.5px; }
.hgp-lbl { font-weight: 800; color: var(--acc-strong); }
.hgp-val { color: var(--ink); }
.hgp-val .num { font-size: 15px; font-weight: 800; }
.hgp-rest { margin-left: auto; font-weight: 800; }
.hgp-rest.ok { color: var(--neg); }
.hgp-rest.over { color: var(--pos); }
.hero-split { display: flex; gap: 28px; margin-top: 18px; flex-wrap: wrap; }
.hsplit { }
.hsplit .l { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-bottom: 3px; }
.hsplit .v { font-size: 21px; font-weight: 800; font-family: var(--ff-data); }
.hsplit .v .u { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-left: 2px; }

/* stat cards row */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.scard { padding: 18px 20px; }
.scard .s-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.scard .s-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); color: var(--acc-strong); display: grid; place-items: center; }
.scard .s-ic svg { width: 16px; height: 16px; }
.scard .s-lbl { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.scard .s-val { font-family: var(--ff-serif); font-size: 30px; font-weight: 600; line-height: 1; }
.scard .s-val.pos { color: var(--pos); }
.scard .s-val.neg { color: var(--neg); }
.scard .s-val.none { font-family: var(--ff-head); font-size: 17px; font-weight: 700; color: var(--ink-3); }
.scard .s-val .u { font-family: var(--ff-head); font-size: 13px; font-weight: 700; margin-left: 3px; }
.scard .s-sub { font-size: 12px; color: var(--ink-3); margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.scard .s-sub svg { width: 13px; height: 13px; }

/* dashboard lower split */
.dash-split { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* 7-day chart */
.spark { display: flex; align-items: flex-end; gap: 8px; height: 168px; padding: 8px 2px 0; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.spark-diff { font-size: 10.5px; font-weight: 800; font-family: var(--ff-data); letter-spacing: -.02em; white-space: nowrap; line-height: 1; }
.spark-diff.over { color: var(--acc-strong); }
.spark-diff.under { color: var(--neg); }
.spark-diff.none { color: var(--ink-3); font-weight: 600; }
.spark-bar-wrap { width: 100%; flex: 1; display: flex; align-items: flex-end; position: relative; }
.spark-burn { position: absolute; left: 0; right: 0; height: 2px; background: var(--ink-3); opacity: .45; border-radius: 2px; }
.spark-bar { width: 100%; max-width: 26px; margin: 0 auto; border-radius: 7px 7px 3px 3px; transition: height .5s cubic-bezier(.2,.8,.2,1); min-height: 3px; }
.spark-bar.under { background: linear-gradient(180deg, var(--neg), color-mix(in oklch, var(--neg) 70%, transparent)); }
.spark-bar.over { background: linear-gradient(180deg, var(--acc), var(--acc-strong)); }
.spark-bar.empty { background: var(--surface-3); }
.spark-lbl { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.spark-lbl.today { color: var(--acc-strong); font-weight: 800; }
.chart-legend { display: flex; gap: 16px; justify-content: center; margin-top: 14px; font-size: 11.5px; color: var(--ink-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.spark-note { text-align: center; font-size: 11px; color: var(--ink-3); margin-top: 8px; }

/* ===================== Diverging bar chart (中央0) ===================== */
.dv-wrap { padding-top: 6px; }
.dv-chart { position: relative; display: flex; align-items: stretch; gap: 8px; }
.dv-chart.dv-dense { gap: 2px; }
.dv-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.dv-half { height: 92px; width: 100%; display: flex; flex-direction: column; align-items: center; }
.dv-half.top { justify-content: flex-end; }
.dv-half.bottom { justify-content: flex-start; }
.dv-zero { position: absolute; left: 0; right: 0; top: 92px; height: 2px; background: var(--ink-3); opacity: .5; border-radius: 2px; z-index: 1; }
.dv-chart.dv-hasy { padding-left: 40px; }
.dv-yaxis { position: absolute; left: 0; top: 0; width: 36px; height: 184px; pointer-events: none; z-index: 2; }
.dv-ytick { position: absolute; right: 4px; transform: translateY(-50%); font-size: 9px; font-weight: 700; font-family: var(--ff-data); color: var(--ink-3); white-space: nowrap; line-height: 1; }
.dv-ytick.zero { color: var(--ink-2); }
.dv-bar { width: 100%; max-width: 30px; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.dv-dense .dv-bar { max-width: 14px; }
.dv-bar.under { background: linear-gradient(0deg, var(--neg), color-mix(in oklch, var(--neg) 72%, transparent)); border-radius: 6px 6px 2px 2px; }
.dv-bar.over { background: linear-gradient(180deg, var(--acc), var(--acc-strong)); border-radius: 2px 2px 6px 6px; }
/* 未記録日（摂取0として不足計上）は淡色で区別 */
.dv-bar.est, .dvr-bar.est { opacity: .4; }
.dv-val { font-size: 10.5px; font-weight: 800; font-family: var(--ff-data); letter-spacing: -.02em; white-space: nowrap; line-height: 1; margin: 0 0 3px; }
.dv-val.under { color: var(--neg); }
.dv-val.over { color: var(--acc-strong); margin: 3px 0 0; }
.dv-none { color: var(--ink-3); opacity: .5; font-weight: 700; line-height: 1; padding-top: 2px; }
.dv-axis { margin-top: 8px; font-size: 11px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.dv-dense .dv-axis { font-size: 9px; }
.dv-axis.today { color: var(--acc-strong); font-weight: 800; }
.dv-col.today .dv-bar.under { box-shadow: 0 0 0 2px color-mix(in oklch, var(--neg) 40%, transparent); }
.dv-col.today .dv-bar.over { box-shadow: 0 0 0 2px color-mix(in oklch, var(--acc) 40%, transparent); }
.dv-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 16px; font-size: 11.5px; color: var(--ink-3); }
.dv-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dv-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dv-legend i.up { background: var(--neg); }
.dv-legend i.down { background: var(--acc); }
.dv-legend i.wt { background: var(--wt-line); border-radius: 2px; height: 3px; width: 16px; }
.dv-legend i.goal { background: var(--acc-strong); border-radius: 2px; height: 0; width: 16px; border-top: 2px dashed var(--acc-strong); }
/* ③ 目標ペース線（横破線） */
.dv-goalline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--acc-strong); opacity: .7; z-index: 2; pointer-events: none; }
.dv-zerolbl { font-weight: 600; }

/* weight line overlay */
.dv-chart.dv-haswt { padding-top: 6px; }
.dv-line { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 184px; pointer-events: none; z-index: 4; overflow: visible; }
.dv-dots { position: absolute; left: 0; right: 0; top: 0; height: 184px; pointer-events: none; z-index: 5; }
.dv-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--wt-line); transform: translate(-50%, -50%); }

/* ===================== Weight line chart (折れ線のみ・中央0) ===================== */
/* ダッシュボードの累積体重チャート枠。データ有無で高さが変わると下のカレンダーが
   ずれるため、常にチャート相当の高さを確保し中身を縦中央に置く。 */
.wl-slot { min-height: 283px; display: flex; flex-direction: column; justify-content: center; }
.wl-wrap { padding-top: 2px; }
.wl-axislabels { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; padding-left: 52px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.wl-ax.gain { color: var(--pos); }
.wl-ax.zero { color: var(--ink-2); }
.wl-ax.loss { color: var(--neg); }
.wl-plot { position: relative; margin-left: 52px; }
.wl-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); transform: translateY(-0.5px); }
.wl-grid.zero { background: var(--ink-3); opacity: .55; height: 2px; }
.wl-tick { position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--ink-3); font-family: var(--ff-data); white-space: nowrap; }
.wl-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 2; }
.wl-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.wl-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--wt-line); transform: translate(-50%, -50%); }
.wl-dot.gain { border-color: var(--pos); }
.wl-dot.loss { border-color: var(--neg); }
.wl-val { position: absolute; transform: translate(-50%, -150%); font-size: 10px; font-weight: 800; font-family: var(--ff-data); color: var(--ink-2); white-space: nowrap; }
.wl-xaxis { display: flex; margin-left: 52px; margin-top: 9px; }
.wl-xlabel { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; overflow: hidden; }
.wl-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-top: 14px; padding-left: 52px; }
.wl-end { font-size: 13px; font-weight: 800; font-family: var(--ff-data); }
.wl-end.gain { color: var(--pos); }
.wl-end.loss { color: var(--neg); }
.wl-note { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.wl-goal-key { display: inline-block; width: 16px; height: 0; border-top: 2px dashed var(--acc-strong); opacity: .8; }
@media (max-width: 600px) {
  .wl-axislabels, .wl-plot, .wl-xaxis, .wl-foot { margin-left: 0; padding-left: 0; }
  .wl-tick { display: none; }
}

/* ---------- 実測体重（今日の体重入力 / レポートの体重セクション） ---------- */
/* 目標カード末尾の「今日の体重」インライン入力 */
.today-weight { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.today-weight .tw-lbl { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.today-weight .tw-lbl svg { width: 16px; height: 16px; color: var(--ink-3); }
.tw-field, .wr-field { position: relative; display: inline-flex; align-items: center; }
.tw-field input.num, .wr-field input.num { width: 92px; text-align: right; padding-right: 30px; }
.tw-unit { position: absolute; right: 10px; font-size: 11px; color: var(--ink-3); pointer-events: none; }
/* 目標カードの「現在体重（実測 M/D）」の補足 */
.goal-stat .gl-sub { font-weight: 600; color: var(--ink-3); font-size: 10.5px; margin-left: 3px; }
/* レポートの体重 追加フォーム */
.weight-add { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.weight-add input[type="date"].input { width: auto; flex: 1 1 150px; min-width: 130px; }
.weight-add .btn { flex: none; }
/* 履歴リスト */
.weight-list { margin-top: 12px; display: flex; flex-direction: column; }
.weight-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.weight-row:first-child { border-top: none; }
.weight-row .wr-date { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.weight-row .wr-field input.num { width: 86px; }

/* ===================== Diverging rows (横・サマリー用) ===================== */
.dvr-wrap { padding-top: 4px; }
.dvr-axislabels { display: flex; align-items: center; margin: 0 0 12px; padding-left: 66px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.dvr-ax.over { flex: 1; text-align: right; padding-right: 8px; color: var(--acc-strong); }
.dvr-ax.zero { width: 22px; text-align: center; }
.dvr-ax.under { flex: 1; text-align: left; padding-left: 8px; color: var(--neg); }
.dvr-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.dvr-label { width: 58px; flex: none; text-align: right; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.dvr-track { flex: 1; position: relative; height: 22px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.dvr-center { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; transform: translateX(-1px); background: var(--ink-3); opacity: .55; z-index: 1; }
.dvr-bar { position: absolute; top: 3px; bottom: 3px; max-width: 50%; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.dvr-bar.under { left: 50%; background: linear-gradient(90deg, color-mix(in oklch, var(--neg) 72%, transparent), var(--neg)); border-radius: 0 6px 6px 0; }
.dvr-bar.over { right: 50%; background: linear-gradient(270deg, color-mix(in oklch, var(--acc) 72%, transparent), var(--acc-strong)); border-radius: 6px 0 0 6px; }
.dvr-val { width: 148px; flex: none; font-size: 12px; font-weight: 800; font-family: var(--ff-data); text-align: right; }
.dvr-val.under { color: var(--neg); }
.dvr-val.over { color: var(--acc-strong); }
.dvr-val.none { color: var(--ink-3); font-weight: 600; }
.dvr-kg { font-size: 11px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.dvr-note { margin-top: 12px; text-align: center; font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 600px) {
  .dvr-axislabels { padding-left: 50px; }
  .dvr-label { width: 44px; }
  .dvr-val { width: 118px; }
  .dvr-kg { display: block; margin-left: 0; }
}

/* ===================== いつ別 積み上げ（StackedBars） ===================== */
.stk-wrap { padding-top: 6px; }
.stk-chart { position: relative; padding-left: 44px; }
.stk-yaxis { position: absolute; left: 0; top: 0; width: 40px; height: 184px; pointer-events: none; }
.stk-ytick { position: absolute; right: 4px; transform: translateY(-50%); font-size: 9px; font-weight: 700; font-family: var(--ff-data); color: var(--ink-3); white-space: nowrap; line-height: 1; }
.stk-ytick.zero { color: var(--ink-2); }
.stk-cols { display: flex; align-items: flex-start; gap: 8px; }
.stk-cols.stk-dense { gap: 2px; }
.stk-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.stk-stack { position: relative; width: 100%; max-width: 30px; height: 184px; display: flex; flex-direction: column-reverse; justify-content: flex-start; }
.stk-dense .stk-stack { max-width: 14px; }
.stk-seg { width: 100%; transition: height .4s cubic-bezier(.2,.8,.2,1); }
.stk-seg:first-child { border-radius: 0 0 3px 3px; }
.stk-seg:last-child { border-radius: 3px 3px 0 0; }
.stk-seg.breakfast { background: var(--meal-breakfast); }
.stk-seg.lunch { background: var(--meal-lunch); }
.stk-seg.dinner { background: var(--meal-dinner); }
.stk-seg.snack { background: var(--meal-snack); }
.stk-seg.none { background: var(--meal-none); }
.stk-burn { position: absolute; left: -3px; right: -3px; height: 0; border-top: 2px dashed var(--ink-2); z-index: 3; pointer-events: none; }
.stk-axis { margin-top: 8px; font-size: 11px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.stk-dense .stk-axis { font-size: 9px; }
.stk-axis.today { color: var(--acc-strong); font-weight: 800; }
.stk-legend { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 16px; font-size: 11.5px; color: var(--ink-3); }
.stk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.stk-sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.stk-sw.breakfast { background: var(--meal-breakfast); }
.stk-sw.lunch { background: var(--meal-lunch); }
.stk-sw.dinner { background: var(--meal-dinner); }
.stk-sw.snack { background: var(--meal-snack); }
.stk-sw.none { background: var(--meal-none); }
.stk-burnsw { width: 16px; height: 0; border-top: 2px dashed var(--ink-2); display: inline-block; }

/* ===================== サマリー: 内訳 / ランキング / 前期間比較 ===================== */
/* 内訳（食事別・カテゴリ別）とランキングの共通リスト。割合バー＋kcal＋構成比。 */
.bd-list { display: flex; flex-direction: column; gap: 13px; margin-top: 6px; }
/* 行はクリックで ON/OFF（what-if）。ボタン化のリセット＋OFFの灰色化。 */
.bd-row { display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left; background: none; border: none; padding: 6px 8px; margin: -6px -8px; border-radius: 10px; cursor: pointer; font: inherit; color: inherit; transition: background .15s, opacity .15s; }
.bd-row:hover { background: var(--surface-2); }
.bd-row.off { opacity: .42; }
.bd-row.off .bd-name { text-decoration: line-through; }
.bd-row.off .bd-fill { filter: grayscale(1); background: var(--ink-3); }
.bd-head { display: flex; align-items: baseline; gap: 8px; }
.bd-name { font-size: 13.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 7px; min-width: 0; }
.bd-name > :not(.rk-no):not(.rk-cat) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-val { margin-left: auto; flex: none; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.bd-val .num { font-size: 14px; font-weight: 800; color: var(--ink); }
.bd-pct { display: inline-block; margin-left: 8px; min-width: 34px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.bd-track { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bd-fill { height: 100%; border-radius: 5px; background: var(--acc); transition: width .5s cubic-bezier(.2,.8,.2,1); min-width: 2px; }
.bd-fill.breakfast { background: var(--meal-breakfast); }
.bd-fill.lunch { background: var(--meal-lunch); }
.bd-fill.dinner { background: var(--meal-dinner); }
.bd-fill.snack { background: var(--meal-snack); }
.bd-fill.none { background: var(--meal-none); }
/* ランキングの順位バッジ・カテゴリ補足 */
.rk-no { flex: none; width: 20px; height: 20px; border-radius: 7px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 800; font-family: var(--ff-data); display: inline-grid; place-items: center; }
.rk-cat { flex: none; font-size: 11px; font-weight: 600; color: var(--ink-3); }
/* 前期間比較（サマリーのヒーロー内） */
/* 摂取が増えた(▲)=超過寄り=--pos(warm) / 減った(▼)=--neg(green)。アプリ全体の収支配色に合わせる。 */
.cmp-line { margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.cmp-line.up { color: var(--pos); }
.cmp-line.down { color: var(--neg); }

/* レポートの what-if ガイダンス＋before:after */
.report-hint { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; padding: 11px 14px; background: color-mix(in oklch, var(--acc) 9%, var(--surface)); border: 1px solid color-mix(in oklch, var(--acc) 22%, var(--line)); border-radius: 12px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.report-hint-ic { flex: none; color: var(--acc-strong); display: inline-grid; place-items: center; margin-top: 1px; }
.report-hint-ic svg { width: 16px; height: 16px; }
.whatif-ba { display: flex; align-items: stretch; gap: 10px; margin-top: 4px; }
.whatif-col { flex: 1; min-width: 0; text-align: center; padding: 10px 8px; border-radius: 14px; background: var(--surface-2); }
.whatif-col.on { background: color-mix(in oklch, var(--acc) 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--acc) 30%, transparent); }
.whatif-cap { font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.whatif-col.on .whatif-cap { color: var(--acc-strong); }
.whatif-num { font-family: var(--ff-serif); font-size: clamp(26px, 6vw, 34px); font-weight: 600; line-height: 1; }
.whatif-num .u { font-family: var(--ff-head); font-size: 14px; font-weight: 700; margin-left: 4px; }
.whatif-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; font-family: var(--ff-data); }
.whatif-arrow { flex: none; display: grid; place-items: center; color: var(--ink-3); }
.whatif-arrow svg { width: 22px; height: 22px; }
.whatif-delta { margin-top: 12px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.whatif-delta b { font-family: var(--ff-data); font-weight: 800; color: var(--ink); }
.whatif-reset { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 5px 14px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.whatif-reset:hover { background: var(--surface); color: var(--ink); }

/* ===================== Entries list (shared) ===================== */
.card-head { display: flex; align-items: center; margin-bottom: 14px; }
.card-head .ch-total { margin-left: auto; font-size: 14px; font-weight: 800; font-family: var(--ff-data); }

/* record card date navigation */
.rec-head { margin-bottom: 14px; }
.rec-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rec-history-btn { margin-left: auto; border: none; background: none; color: var(--acc-strong); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; padding: 4px 2px; }
.rec-history-btn svg { width: 15px; height: 15px; }
.rec-history-btn:hover { text-decoration: underline; }
.rec-datenav { display: flex; align-items: center; gap: 7px; }
.rec-nav-btn { width: 32px; height: 32px; flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 9px; display: grid; place-items: center; }
.rec-nav-btn:hover:not(:disabled) { border-color: var(--acc); color: var(--acc-strong); }
.rec-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.rec-nav-btn svg { width: 16px; height: 16px; }
/* 「この日に記録する」＋ボタン（アクセント塗りで追加アクションを明示） */
.rec-add { border-color: var(--acc); background: var(--acc); color: #fff; }
.rec-add:hover:not(:disabled) { background: var(--acc-strong); border-color: var(--acc-strong); color: #fff; }
.rec-today-btn { padding: 0 14px; height: 32px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 700; border-radius: 9px; }
.rec-today-btn:hover:not(:disabled) { border-color: var(--acc); color: var(--acc-strong); }
.rec-today-btn.on, .rec-today-btn:disabled { opacity: .5; cursor: default; }
.rec-cal { width: 36px; height: 32px; flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 9px; display: grid; place-items: center; position: relative; cursor: pointer; }
.rec-cal:hover { border-color: var(--acc); color: var(--acc-strong); }
.rec-cal svg { width: 16px; height: 16px; pointer-events: none; }
.rec-cal input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rec-total { margin-left: auto; font-size: 13px; font-weight: 800; font-family: var(--ff-data); color: var(--ink); white-space: nowrap; }
.rec-range { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-3); white-space: nowrap; font-family: var(--ff-data); }

.meal-block { margin-bottom: 6px; }
.meal-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  padding: 10px 4px 7px;
}
.meal-head .meal-emoji { font-size: 15px; }
.meal-label { display: inline-flex; align-items: center; gap: 7px; }
.meal-label .meal-ic { display: grid; place-items: center; color: var(--acc-strong); }
.meal-label .meal-ic svg { width: 16px; height: 16px; }
.meal-head .meal-sum { margin-left: auto; color: var(--ink-3); font-weight: 700; font-family: var(--ff-data); white-space: nowrap; }

.entry {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid transparent; margin-bottom: 8px;
  transition: .14s;
}
.entry:hover { border-color: var(--line-strong); }
.entry-main { min-width: 0; flex: 1; }
.entry-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.entry-tags { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.entry-tag { display: inline-flex; align-items: center; }
.entry-tag + .entry-tag::before { content: "›"; margin-right: 6px; color: var(--line-strong); }

/* 大分類 → 中分類 の階層表示（登録時と同じ構造） */
.cat-group { margin: 4px 0 10px; }
.cat-group:last-child { margin-bottom: 0; }
.cat-major {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 10px; margin-bottom: 6px;
  background: var(--surface-3); border-radius: var(--radius-sm);
}
.cat-major-name { font-size: 13px; font-weight: 800; color: var(--ink); }
.cat-major-sum { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.cat-major .cat-edit { margin-left: 6px; width: 30px; height: 30px; }
.cat-major .cat-edit:hover { background: color-mix(in oklch, var(--acc) 14%, transparent); color: var(--acc-strong); }
.cat-major-bare { background: transparent; padding: 2px 2px 4px; }
.cat-major-bare .cat-major-name { color: var(--ink-3); font-weight: 700; font-size: 12px; }
.entry-static { padding-right: 14px; }
.cat-mid { padding-left: 12px; border-left: 2px solid var(--line); margin: 0 0 8px 6px; }
.cat-mid:last-child { margin-bottom: 0; }
.cat-mid-flush { padding-left: 0; border-left: none; margin-left: 0; }
.cat-middle { font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 4px 2px 6px; }
.cat-items { display: flex; flex-direction: column; }
.entry-cal { font-size: 15px; font-weight: 800; white-space: nowrap; font-family: var(--ff-data); }
.entry-cal .u { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-left: 2px; }
.entry-actions { display: flex; gap: 2px; }
.icon-btn { border: none; background: none; color: var(--ink-3); width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; transition: .14s; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: color-mix(in oklch, var(--pos) 16%, transparent); color: var(--pos); }
.icon-btn svg { width: 16px; height: 16px; }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; opacity: .4; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.empty-sub { font-size: 13px; margin-top: 5px; line-height: 1.6; }

/* ===================== History ===================== */
.day-group { margin-bottom: 22px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; padding: 0 2px; }
.day-date { font-size: 17px; font-weight: 800; font-family: var(--ff-head); white-space: nowrap; }
.day-dow { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.day-total { margin-left: auto; font-size: 14px; font-weight: 700; font-family: var(--ff-data); white-space: nowrap; }
.day-balance { font-size: 12px; font-weight: 700; margin-left: 8px; }
.bal-pos { color: var(--pos); }
.bal-neg { color: var(--neg); }
.history-day-card { padding: 16px 18px; margin-bottom: 16px; }

/* pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 20px; padding-top: 6px; }
.pager-info { font-size: 13px; color: var(--ink-3); }
.pager-info b { color: var(--ink-2); font-weight: 700; }
.pager-ctrls { display: flex; align-items: center; gap: 6px; }
.pager-btn, .pager-num {
  min-width: 38px; height: 38px; padding: 0 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: 14px; font-weight: 700; font-family: var(--ff-data);
  display: grid; place-items: center; transition: .14s;
}
.pager-btn:hover:not(:disabled), .pager-num:hover { border-color: var(--acc); color: var(--acc-strong); }
.pager-btn:disabled { opacity: .35; cursor: not-allowed; }
.pager-btn svg { width: 17px; height: 17px; }
.pager-num.on { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.pager-num.on:hover { color: var(--on-acc); }
.pager-gap { min-width: 22px; text-align: center; color: var(--ink-3); font-weight: 700; }
@media (max-width: 560px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } }

/* ===================== Summary ===================== */
.period-seg { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-pill); border: 1px solid var(--line); }
.period-seg button { border: none; background: none; padding: 9px 22px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 700; color: var(--ink-2); transition: .15s; }
.period-seg button.on { background: var(--surface); color: var(--acc-strong); box-shadow: var(--shadow-sm); }

.period-nav { display: flex; align-items: center; gap: 14px; margin: 18px 2px; }
.pn-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; transition: .15s; }
.pn-btn:hover:not(:disabled) { border-color: var(--acc); color: var(--acc-strong); }
.pn-btn:disabled { opacity: .35; cursor: not-allowed; }
.pn-btn svg { width: 18px; height: 18px; }
.pn-label { font-size: 19px; font-weight: 800; font-family: var(--ff-head); white-space: nowrap; }
.pn-spacer { flex: 1; }

/* レポートの一番上のBOX（体重換算）はスクロール時にヘッダー直下へ固定（sticky）。
   背景＝surface（下のカードが透けない）、z-index は固定ヘッダー(50)より下・本文より上。 */
.hero-sentinel { height: 0; margin: 0; padding: 0; }
.hero-card { padding: 26px; text-align: center; position: sticky; top: var(--nav-h); z-index: 20; background: var(--surface); box-shadow: var(--shadow); transition: border-radius .12s; }
/* ヘッダーに貼り付いている間だけ上部の角を四角くしてぴったり密着させる */
.hero-card.stuck { border-top-left-radius: 0; border-top-right-radius: 0; }
.hero-balance { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.hero-num { font-family: var(--ff-serif); font-size: 52px; font-weight: 600; line-height: 1; }
.hero-num .u { font-family: var(--ff-head); font-size: 18px; font-weight: 700; margin-left: 5px; }
.hero-sub { font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.weight-pill { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; padding: 10px 18px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 700; }
.weight-pill svg { width: 16px; height: 16px; }
.weight-loss { background: color-mix(in oklch, var(--neg) 15%, transparent); color: var(--neg); }
.weight-gain { background: color-mix(in oklch, var(--pos) 15%, transparent); color: var(--pos); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.stat-lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-val { font-family: var(--ff-serif); font-size: 26px; font-weight: 600; margin-top: 7px; }
.stat-val .u { font-family: var(--ff-head); font-size: 12px; font-weight: 700; color: var(--ink-3); margin-left: 3px; }

.chart { margin-top: 18px; }
.chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.chart-label { width: 58px; font-size: 12px; color: var(--ink-3); font-weight: 600; text-align: right; flex: none; }
.chart-track { flex: 1; height: 22px; background: var(--surface-2); border-radius: 7px; overflow: hidden; position: relative; }
.chart-fill { height: 100%; border-radius: 7px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.chart-fill.under { background: var(--neg); }
.chart-fill.over { background: var(--acc); }
.chart-burnline { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); opacity: .5; }
.chart-val { width: 58px; font-size: 12px; font-weight: 700; flex: none; font-family: var(--ff-data); }

/* ===================== Form controls ===================== */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.field-label .hint { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.req, .opt { display: inline-block; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 6px; border-radius: 5px; vertical-align: 1px; letter-spacing: .02em; }
.req { background: var(--acc); color: #fff; }
.opt { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.li-head .req { padding: 2px 5px; }

.input, .select {
  width: 100%; padding: 12px 13px; font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in oklch, var(--acc) 20%, transparent); }
.input.num { font-family: var(--ff-data); }
/* iOS Safari の input[type=date] はネイティブ装飾で intrinsic な最小幅を持ち、
   コンテナ幅を無視してはみ出す。装飾を外すと width:100%/min-width:0 が効く（タップ時の
   日付ピッカーは従来どおり機能する）。 */
.input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; }
.input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.field { min-width: 0; }
/* iOS Safari は入力欄の font-size が 16px 未満だとフォーカス時に自動ズームし、ズーム後の幅
   が viewport を超えて横スクロール（画面幅オーバー）が起きる。タッチ端末／狭幅では全フォーム
   入力を 16px にして自動ズーム自体を防ぐ（今日の体重・各日付/数値入力・検索・共有URL欄など共通）。 */
@media (max-width: 560px), (pointer: coarse) {
  .input, .select { font-size: 16px; }
  .share-url-box .input { font-size: 16px; }
}
.select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23998' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* 項目数に依らず1行に等幅配置（4→5項目になっても折り返さない） */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.seg button { border: none; background: transparent; padding: 10px 4px; border-radius: calc(var(--radius-sm) - 3px); font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 3px; transition: .15s; }
.seg button .seg-emoji { font-size: 17px; line-height: 1; }
.seg button.on { background: var(--surface); color: var(--acc-strong); box-shadow: var(--shadow-sm); }
.seg-sm button { padding: 8px 3px; font-size: 11.5px; gap: 2px; }
.seg-sm button .seg-emoji { font-size: 14px; }
/* line variant — muted stroke icon + label */
.seg .seg-ic { color: var(--ink-3); display: grid; place-items: center; transition: color .15s; }
.seg .seg-ic svg { width: 19px; height: 19px; }
.seg-sm .seg-ic svg { width: 16px; height: 16px; }
.seg button.on .seg-ic { color: var(--acc-strong); }
/* text variant — single line, centered */
.seg-text button { flex-direction: row; padding: 11px 4px; }
.seg-text.seg-sm button { padding: 9px 4px; }

/* combobox */
.combo { position: relative; }
.combo-wrap { position: relative; }
.combo .input { padding-right: 38px; }
.combo-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: none; background: none; display: grid; place-items: center; color: var(--ink-3); border-radius: 8px; }
.combo-toggle:hover { background: var(--surface-2); color: var(--ink-2); }
.combo-toggle svg { width: 16px; height: 16px; transition: transform .18s; }
.combo.open .combo-toggle svg { transform: rotate(180deg); }
.combo-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; padding: 5px; }
.combo-opt { padding: 10px 11px; border-radius: 8px; font-size: 14px; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.combo-opt:hover, .combo-opt.cursor { background: var(--surface-2); }
.combo-opt .opt-cal { margin-left: auto; font-size: 12px; color: var(--ink-3); font-family: var(--ff-data); }
.combo-empty { padding: 11px; font-size: 13px; color: var(--ink-3); }

/* データ操作の種類セレクト（ポップオーバー：食事の記録 / 体重） */
.settings-data-hint { font-size: 12.5px; color: var(--ink-3); margin: -2px 2px 10px; line-height: 1.6; }
.kind-menu { position: relative; flex-shrink: 0; }
.kind-menu-btn > svg:last-child { width: 15px; height: 15px; margin-left: -1px; opacity: .65; transition: transform .15s; }
.kind-menu.open .kind-menu-btn > svg:last-child { transform: rotate(180deg); }
.kind-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 186px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 5px; }
.kind-pop-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.kind-pop-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 11px; border: 0; background: transparent; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.kind-pop-item:hover { background: var(--surface-2); }
.kind-pop-item svg { width: 17px; height: 17px; opacity: .8; flex-shrink: 0; }

/* line items in record form */
.li-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.li-head { display: flex; gap: 8px; padding: 0 2px 7px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.li-head .h-item { flex: 1; }
.li-head .h-cal { width: 110px; flex: none; }
.li-head .h-sp { width: 32px; flex: none; }
/* edit modal row: 中分類 + 項目 + カロリー + 削除 */
.li-head .h-mid { width: 132px; flex: none; }
.li-row-edit .li-mid { width: 132px; flex: none; min-width: 0; }
@media (max-width: 540px) {
  .li-head .h-mid { display: none; }
  .li-head .h-item { display: none; }
  .li-head .h-cal { display: none; }
  .li-row-edit { flex-wrap: wrap; }
  .li-row-edit .li-mid { width: 100%; }
  .li-row-edit .li-item { flex: 1 1 auto; }
}
.li-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.li-row .li-item { flex: 1; min-width: 0; }
.li-row .li-cal { width: 110px; flex: none; position: relative; }
.li-row .li-cal .input { padding-right: 44px; }
.li-row .li-cal.auto .input { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 9%, var(--surface)); }
.cal-input-wrap { position: relative; }
.cal-input-wrap .unit { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--ink-3); pointer-events: none; }
.li-remove { width: 32px; height: 46px; flex: none; border: none; background: none; color: var(--ink-3); border-radius: 9px; display: grid; place-items: center; }
.li-remove svg { width: 16px; height: 16px; }
.li-remove:hover:not(:disabled) { background: color-mix(in oklch, var(--pos) 16%, transparent); color: var(--pos); }
.li-remove:disabled { opacity: 0; pointer-events: none; }
.li-hint { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }
.li-hint svg { width: 13px; height: 13px; color: var(--acc-strong); flex: none; }

.date-row-inner { display: flex; gap: 8px; }
.date-row-inner .input { flex: 1; min-width: 0; }
.btn-today { flex: none; padding: 0 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: 13px; }
.btn-today:hover:not(:disabled) { border-color: var(--acc); color: var(--acc-strong); }
.btn-today:disabled { opacity: .4; cursor: not-allowed; }

/* ===================== Buttons ===================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: var(--radius-sm); border: none; font-size: 15px; font-weight: 700; transition: .15s; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--acc); color: var(--on-acc); box-shadow: 0 8px 20px -8px var(--acc); }
.btn-primary:hover { background: var(--acc-strong); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary.is-disabled { opacity: .5; box-shadow: none; }
.btn-primary.is-disabled:hover { background: var(--acc); }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-block { width: 100%; }
.btn-add { width: 100%; background: transparent; color: var(--acc-strong); border: 1.5px dashed var(--line-strong); padding: 12px; border-radius: var(--radius-sm); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.btn-add svg { width: 17px; height: 17px; flex: none; }
.btn-add:hover { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 8%, transparent); }

.preset-row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.preset { padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); font-size: 12px; font-weight: 700; color: var(--ink-2); font-family: var(--ff-data); }
.preset:hover { border-color: var(--acc); color: var(--acc-strong); }
.preset.on { background: color-mix(in oklch, var(--acc) 14%, transparent); border-color: var(--acc); color: var(--acc-strong); }

/* ===================== FAB ===================== */
.fab {
  position: fixed; z-index: 45;
  /* 本体(.page: max-width 1180px・中央寄せ)の右端に合わせる。広い画面では (画面幅-1180)/2＋余白を
     右に確保し、本体右端へ寄せる（ビューポート右端の余白にぽつんと離れないように）。1180/2=590px。 */
  right: max(clamp(18px, 4vw, 40px), calc(50% - 590px + clamp(18px, 4vw, 40px))); bottom: clamp(20px, 4vw, 36px);
  height: 58px; padding: 0 24px 0 20px; border-radius: var(--radius-pill);
  border: none; background: linear-gradient(150deg, var(--acc) 0%, var(--acc-strong) 100%);
  color: var(--on-acc); font-size: 16px; font-weight: 800; font-family: var(--ff-head);
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 14px 34px -10px var(--acc), 0 4px 12px -4px rgba(0,0,0,.2);
  transition: transform .18s cubic-bezier(.4,1.4,.5,1), box-shadow .2s;
}
.fab svg { width: 22px; height: 22px; }
.fab:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 20px 44px -10px var(--acc), 0 6px 16px -4px rgba(0,0,0,.24); }
.fab:active { transform: translateY(0) scale(.99); }

/* ===================== Modal ===================== */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: color-mix(in oklch, var(--ink) 42%, transparent);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: grid; place-items: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.98); transition: transform .25s cubic-bezier(.3,1.1,.4,1); padding: 24px;
}
.scrim.show .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-title { font-size: 21px; font-weight: 800; font-family: var(--ff-head); }
.modal-sub { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.modal-close { margin-left: auto; flex: none; }
.modal-foot { display: flex; gap: 10px; margin-top: 18px; position: sticky; bottom: -24px; padding: 14px 0 0; background: linear-gradient(180deg, transparent, var(--surface) 30%); }
.save-total { font-size: 13px; color: var(--ink-2); align-self: center; white-space: nowrap; }
.save-total b { font-size: 19px; font-weight: 800; color: var(--ink); font-family: var(--ff-data); }
.btn-save { flex: 1; white-space: nowrap; }

/* ---- SNS共有（ホーム上部ボタン・モーダル・設定の一覧） ---- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.share-open-btn { flex: none; align-self: center; }
.share-open-btn svg { width: 16px; height: 16px; }
.share-lead { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin: 0 0 14px; }
.share-opts { display: flex; flex-direction: column; gap: 8px; }
.share-opt { display: flex; align-items: flex-start; gap: 11px; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .12s, background .12s; }
.share-opt:hover { border-color: var(--line-strong); }
.share-opt.on { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 7%, transparent); }
.share-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.share-opt-box { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-strong); display: grid; place-items: center; margin-top: 1px; color: #fff; }
.share-opt.on .share-opt-box { background: var(--acc); border-color: var(--acc); }
.share-opt-box svg { width: 14px; height: 14px; }
.share-opt:not(.on) .share-opt-box svg { display: none; }
.share-opt-tx { display: flex; flex-direction: column; gap: 2px; }
.share-opt-t { font-size: 14.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.share-opt-tag { font-size: 10.5px; font-weight: 700; color: var(--neg); border: 1px solid color-mix(in oklch, var(--neg) 40%, transparent); border-radius: 5px; padding: 1px 5px; }
.share-opt-d { font-size: 12.5px; color: var(--ink-3); }
.share-warn { margin-top: 12px; font-size: 12.5px; color: var(--neg); background: color-mix(in oklch, var(--neg) 8%, transparent); border-radius: 8px; padding: 9px 11px; line-height: 1.6; }
.share-url-box { display: flex; gap: 8px; margin-bottom: 14px; }
.share-url-box .input { flex: 1; font-size: 13px; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.share-actions .btn { flex: 1; min-width: 96px; justify-content: center; }
.share-x { background: #000; color: #fff; border: 1px solid #000; }
.share-x:hover { background: #1a1a1a; }
.share-line { background: #06C755; color: #fff; border: 1px solid #06C755; }
.share-line:hover { background: #05b54d; }
.share-list { display: flex; flex-direction: column; }
.share-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.share-item:first-child { border-top: 0; }
.share-item-main { flex: 1; min-width: 0; }
.share-item-labels { font-size: 14px; font-weight: 700; color: var(--ink); }
.share-item-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.share-item-actions { display: flex; gap: 6px; flex: none; }
.share-item-actions .icon-pill svg { width: 16px; height: 16px; }
.share-del:hover { color: var(--neg); border-color: var(--neg); }
.share-more { margin-top: 12px; }
/* 「続けて登録する」を含む二次ボタンの無効表示（btn-primary 同等の減光） */
.btn-ghost.is-disabled { opacity: .5; }
.btn-ghost.is-disabled:hover { border-color: var(--line); color: var(--ink-2); }
/* 狭幅では合計を1行上に逃がし、ボタン2つを横並びで確保 */
@media (max-width: 560px) {
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .save-total { width: 100%; order: -1; margin-bottom: 2px; }
  .modal-foot .btn-save { padding-left: 12px; padding-right: 12px; font-size: 14px; }
  /* 設定行の控え（日付入力・表示スタイルのセグメント）は狭幅で溢れるため、
     ラベルの下に回り込ませて全幅にする。 */
  .settings-row:has(.settings-input),
  .settings-row:has(.mealstyle-seg) { flex-wrap: wrap; }
  .settings-row .settings-input { width: 100%; }
  .settings-row .mealstyle-seg { width: 100%; }
  .mealstyle-seg button { flex: 1; padding: 9px 6px; min-width: 0; }
}

/* form top grid in modal */
.form-top { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-top .field { margin-bottom: 0; }

/* ===================== Toast ===================== */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 22px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .25s; z-index: 100; display: flex; align-items: center; gap: 8px; }
.toast svg { width: 17px; height: 17px; color: var(--acc); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== Settings ===================== */
.settings-row { display: flex; align-items: flex-start; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: none; }
.settings-info { flex: 1; }
.settings-name { font-size: 15px; font-weight: 700; }
.settings-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }
.settings-input { width: 132px; flex: none; }
.settings-input input[type="date"] { width: 100%; }

/* 目標セクションの算出サマリー（進捗バー＋指標） */
.goal-summary { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.goal-summary.bare { margin-top: 0; padding-top: 0; border-top: none; }
/* ④ 残り日数＋達成評価 */
.goal-verdict { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; background: var(--surface-2); }
.goal-verdict .gv-days { font-weight: 700; color: var(--ink-2); flex: none; }
.goal-verdict .gv-days .num { font-size: 15px; font-weight: 800; color: var(--ink); }
.goal-verdict .gv-days .gv-dl { font-weight: 600; color: var(--ink-3); font-size: 11.5px; margin-left: 1px; }
.goal-verdict .gv-judge { margin-left: auto; font-weight: 800; }
.goal-verdict.ok { background: color-mix(in oklch, var(--neg) 12%, var(--surface)); }
.goal-verdict.ok .gv-judge { color: var(--neg); }
.goal-verdict.warn { background: color-mix(in oklch, var(--pos) 12%, var(--surface)); }
.goal-verdict.warn .gv-judge { color: var(--pos); }
.goal-verdict.muted .gv-judge { color: var(--ink-3); }
.goal-empty { margin-top: 14px; font-size: 13px; color: var(--ink-3); line-height: 1.7; }
.goal-prog-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.goal-prog-head .num { font-size: 17px; font-weight: 800; color: var(--acc-strong); }
.goal-prog-track { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.goal-prog-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--acc) 0%, var(--acc-strong) 100%); transition: width .5s cubic-bezier(.2,.8,.2,1); min-width: 2px; }
.goal-prog-ends { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.goal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 16px; }
.goal-stat { display: flex; flex-direction: column; gap: 2px; }
.goal-stat .gl { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.goal-stat .gv { font-size: 18px; font-weight: 800; color: var(--ink); }
.goal-stat .gv i { font-size: 12px; font-weight: 700; color: var(--ink-3); font-style: normal; margin-left: 2px; }
.goal-note { margin-top: 14px; font-size: 11.5px; line-height: 1.7; color: var(--ink-3); }
@media (max-width: 440px) { .goal-stats { grid-template-columns: 1fr; } }

.swatch-row { display: flex; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; transition: .15s; position: relative; }
.swatch.on { border-color: var(--ink); transform: scale(1.08); }
.swatch.on::after { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 12px; border-radius: 50%; background: #fff; mix-blend-mode: difference; }

.mealstyle-seg { flex: none; }
.mealstyle-preview { margin-top: 12px; max-width: 360px; }

/* 設定のサブグループ（例: 「いつ」の設定）。サブ見出し＋字下げで入れ子を表現。 */
.settings-subhead { font-size: 13px; font-weight: 700; color: var(--ink-2); padding-top: 4px; }
.settings-sub { margin: 8px 0 0 14px; padding-left: 14px; border-left: 2px solid var(--line); }
.settings-sub .settings-row:first-child { padding-top: 6px; }
/* 非活性の設定行（依存元 OFF）。薄字＋操作不可で「効かない」ことを示す。 */
.settings-row.is-disabled { opacity: .45; }
.settings-row.is-disabled .period-seg button,
.settings-row.is-disabled .mealstyle-preview { pointer-events: none; }
.settings-disabled-note { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-top: 6px; }

/* ON/OFF トグルスイッチ（設定用） */
.switch { flex: none; width: 46px; height: 28px; border-radius: 999px; border: none; background: var(--line-strong); position: relative; cursor: pointer; transition: background .18s; padding: 0; }
.switch.on { background: var(--acc); }
.switch.is-disabled { cursor: not-allowed; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .18s; }
.switch.on .switch-knob { left: 21px; }

/* ===================== Import (RevoGrid) ===================== */
.import-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.import-bar-sp { flex: 1; }
.import-hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; margin-bottom: 14px; }
/* 取込種別セグメント（記録 / 体重） */
.import-kind { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.import-kind-label { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-right: 4px; }
.import-kind-tab { padding: 7px 18px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.import-kind-tab:hover:not(:disabled) { border-color: var(--acc); color: var(--acc-strong); }
.import-kind-tab.on { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.import-kind-tab:disabled { opacity: .6; cursor: default; }
.import-confirm-actions { display: flex; gap: 10px; }
.import-grid-wrap { height: 62vh; min-height: 360px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.import-grid { display: block; width: 100%; height: 100%; }
/* 削除確認（AuthConfirm）を全画面オーバーレイで表示。元の画面/モーダルは裏で保持される。
   z-index は modal の scrim(80) より上。 */
.confirm-overlay { position: fixed; inset: 0; z-index: 90; }
.confirm-overlay .auth-wrap { min-height: 100vh; min-height: 100dvh; }
.import-msg { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; font-size: 13px; }
.import-msg-title { font-weight: 700; margin-bottom: 8px; }
.import-msg ul { margin: 0; padding-left: 18px; line-height: 1.7; }
.import-msg.err { background: color-mix(in oklch, var(--neg) 12%, transparent); border: 1px solid color-mix(in oklch, var(--neg) 40%, transparent); color: var(--ink); }
.import-msg.conflict { background: color-mix(in oklch, var(--pos) 12%, transparent); border: 1px solid color-mix(in oklch, var(--pos) 40%, transparent); color: var(--ink); }
.conflict-days { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.conflict-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 4px 6px 4px 12px; font-family: var(--ff-data); font-size: 12.5px; }
.conflict-del { border: none; background: none; color: var(--ink-3); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; }
.conflict-del:hover { background: color-mix(in oklch, var(--pos) 16%, transparent); color: var(--pos); }
.conflict-del svg { width: 14px; height: 14px; }

/* ===================== History filter ===================== */
.filter-card { margin-bottom: 22px; }
.history-layout { display: block; }
.history-results { min-width: 0; }

/* 表示切替（一覧/グリッド）トグル＋グリッド表 */
.hist-toolbar { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 14px; }
.view-seg { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: var(--radius-pill); border: 1px solid var(--line); }
.view-seg button { border: none; background: none; padding: 7px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; color: var(--ink-2); transition: .15s; }
.view-seg button.on { background: var(--surface); color: var(--acc-strong); box-shadow: var(--shadow-sm); }
.hist-grid-card { padding: 6px; overflow: hidden; }
.hist-grid-scroll { overflow-x: auto; }
.hist-grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.hist-grid th, .hist-grid td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.hist-grid thead th { font-size: 11.5px; font-weight: 700; color: var(--ink-3); border-bottom: 1.5px solid var(--line-strong); }
.hist-grid tbody tr:last-child td { border-bottom: none; }
.hist-grid tbody tr:hover { background: var(--surface-2); }
.hist-grid .g-date { color: var(--ink-2); }
.hist-grid .g-dow { color: var(--ink-3); font-size: 12px; }
.hist-grid .g-item { white-space: normal; min-width: 150px; color: var(--ink); font-weight: 600; }
.hist-grid .g-dash { color: var(--ink-3); }
.hist-grid .g-num { text-align: right; font-family: var(--ff-data); font-weight: 700; }
.hist-grid .g-act, .hist-grid .g-act-h { width: 1%; text-align: right; padding-left: 4px; }
@media (min-width: 980px) {
  .history-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .history-filter-col {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--nav-h) - 40px);
    overflow-y: auto;
  }
  .history-filter-col .filter-card { margin-bottom: 0; }
  /* 左サイドでは各行を1カラムに */
  .history-filter-col .filter-row,
  .history-filter-col .filter-row-date,
  .history-filter-col .filter-row-3,
  .history-filter-col .filter-row-kw { grid-template-columns: 1fr; }
}
.filter-head { display: flex; align-items: center; margin-bottom: 14px; }
.filter-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.filter-title svg { width: 16px; height: 16px; color: var(--acc-strong); }
.filter-clear { margin-left: auto; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 700; padding: 6px 13px; border-radius: var(--radius-pill); }
.filter-clear:hover { border-color: var(--acc); color: var(--acc-strong); }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.filter-grid .field { margin-bottom: 0; }
.filter-row { display: grid; gap: 12px; margin-bottom: 12px; }
.filter-row .field { margin-bottom: 0; }
.filter-row-date { grid-template-columns: 1fr 1fr 1.3fr; }
.filter-row-3 { grid-template-columns: repeat(3, 1fr); }
.filter-row-kw { grid-template-columns: 2fr 1fr; margin-bottom: 0; }
.filter-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.filter-result b { color: var(--ink); }
@media (max-width: 680px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-row-date { grid-template-columns: 1fr 1fr; }
  .filter-row-date .f-cal { grid-column: 1 / -1; }
  .filter-row-3 { grid-template-columns: 1fr; }
  .filter-row-kw { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .filter-grid { grid-template-columns: 1fr; }
  .filter-row-date { grid-template-columns: 1fr; }
}

/* ===================== Desktop dashboard layout ===================== */
@media (min-width: 860px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-split { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
}
@media (max-width: 600px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 18px; justify-items: center; }
  .hero-split { justify-content: center; }
  .stat-row { grid-template-columns: 1fr; }
  .form-top { grid-template-columns: 1fr; }
  .modal { padding: 20px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: end; max-height: 92vh; }
  .scrim { padding: 0; place-items: end center; }
}

/* ===================== Focus rings ===================== */
*:focus { outline: none; }
*:focus-visible { outline: 2.5px solid var(--acc-strong); outline-offset: 2px; border-radius: 6px; }
.input:focus-visible, .select:focus-visible { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in oklch, var(--acc) 22%, transparent); }
.seg button:focus-visible { outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===================== Footer ===================== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px clamp(16px, 4vw, 40px) 40px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.footer-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.footer-brand .brand-mark svg { width: 24px; height: 24px; }
.footer-name { font-family: var(--ff-serif); font-size: 22px; font-weight: 600; line-height: 1.1; }
.footer-name .jp { font-family: var(--ff-head); font-size: 18px; font-weight: 700; }
.footer-tag { font-size: 13px; color: var(--ink-3); margin-top: 3px; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 14px 34px; margin-bottom: 26px; }
.footer-link { font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; transition: color .14s; }
.footer-link:hover { color: var(--acc-strong); }

.footer-guides { display: flex; flex-wrap: wrap; gap: 12px 34px; }
.footer-guide { font-size: 14px; color: var(--ink-3); text-decoration: none; transition: color .14s; }
.footer-guide:hover { color: var(--ink-2); }

.footer-rule { height: 1px; background: var(--line); margin: 34px 0 24px; }

.footer-disc { font-size: 13px; line-height: 1.8; color: var(--ink-3); margin: 0 0 16px; max-width: 980px; }
.footer-disc-name { color: var(--ink-2); font-weight: 700; }
.footer-copy { font-size: 12.5px; color: var(--ink-3); margin: 0; }

@media (max-width: 600px) {
  .footer-inner { padding: 36px 18px 32px; }
  .footer-nav { gap: 12px 24px; }
  .footer-guides { flex-direction: column; gap: 10px; }
}

/* entrance — transform only (never holds content invisible) */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { transform: translateY(12px); } to { transform: none; } }
  .dash-grid > * { animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
  .dash-grid > *:nth-child(2) { animation-delay: .05s; }
  .dash-grid > *:nth-child(3) { animation-delay: .1s; }
}

/* ===================== Dashboard add-ons ===================== */
/* right column stacks the 7-day chart + compact calendar */
.dash-right { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-right > .card { margin: 0; }

/* insight strip: streak + month projection */
.insight-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .insight-strip { grid-template-columns: 1fr; } }
.insight-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow); }
.insight-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.insight-ic svg { width: 23px; height: 23px; }
.insight-ic.streak { background: color-mix(in oklch, var(--acc) 16%, transparent); color: var(--acc-strong); }
.insight-ic.proj.gain { background: color-mix(in oklch, var(--pos) 15%, transparent); color: var(--pos); }
.insight-ic.proj.loss { background: color-mix(in oklch, var(--neg) 16%, transparent); color: var(--neg); }
.insight-body { min-width: 0; }
.insight-lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.insight-val { font-size: 26px; font-weight: 800; line-height: 1.15; font-family: var(--ff-data); }
.insight-val .u { font-size: 13px; font-weight: 700; margin-left: 3px; color: var(--ink-3); }
.insight-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* quick-add chips */
.quick-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.quick-sub { font-size: 11.5px; color: var(--ink-3); }
.quick-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.qchip { display: inline-flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 7px 7px 14px; cursor: pointer; transition: .15s; }
.qchip:hover { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 8%, var(--surface-2)); }
.qchip-name { font-size: 13.5px; font-weight: 600; color: var(--ink); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qchip-cal { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.qchip-cal .u { font-size: 10px; margin-left: 1px; font-weight: 600; }
.qchip-add { width: 24px; height: 24px; border-radius: 50%; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; flex: none; }
.qchip-add svg { width: 15px; height: 15px; }

/* calendar heatmap */
.heat-counts { margin-left: auto; display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.heat-counts .hc { display: inline-flex; align-items: center; gap: 5px; }
.heat-counts .hc i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.heat-counts .hc.under i { background: var(--neg); }
.heat-counts .hc.over i { background: var(--pos); }
.heat-counts .hc.none i { background: var(--surface-3); }
.heat-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 16px 0 7px; }
.heat-dow span { text-align: center; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-cell { height: clamp(42px, 7vw, 64px); border: none; border-radius: 9px; font-size: 12px; font-weight: 600; font-family: var(--ff-data); display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); cursor: pointer; transition: transform .12s, box-shadow .12s; padding: 0; }
.heat-cell.empty { background: transparent; pointer-events: none; }
.heat-cell.none { background: var(--surface-2); color: var(--ink-3); }
.heat-cell.future { background: transparent; color: var(--line-strong); cursor: default; }
.heat-cell.under { background: color-mix(in oklch, var(--neg) 34%, var(--surface)); color: var(--ink); }
.heat-cell.over { background: color-mix(in oklch, var(--pos) 34%, var(--surface)); color: var(--ink); }
.heat-cell:not(.future):not(.empty):hover { transform: translateY(-1px); box-shadow: var(--shadow); }
/* 「今日」は控えめにドットで示す（選択と紛らわしい強い枠線はやめる）。 */
.heat-cell.today { position: relative; }
.heat-cell.today::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--acc);
}
/* 「選択中の日」はアクセント塗りで明確に区別（状態色より優先するため後置）。 */
.heat-cell.sel { background: var(--acc); color: var(--on-acc); box-shadow: 0 6px 16px -6px var(--acc); }
.heat-cell.sel.today::after { background: var(--on-acc); }
.heat-legend { display: flex; gap: 16px; justify-content: center; margin-top: 14px; font-size: 11.5px; color: var(--ink-3); }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.heat-legend .under { background: color-mix(in oklch, var(--neg) 34%, var(--surface)); }
.heat-legend .over { background: color-mix(in oklch, var(--pos) 34%, var(--surface)); }
.heat-legend .none { background: var(--surface-2); }

/* compact calendar (fits the dashboard right column) */
.heat-compact .heat-dow { gap: 4px; margin: 12px 0 5px; }
.heat-compact .heat-dow span { font-size: 10px; }
.heat-compact .heat-grid { gap: 4px; }
.heat-compact .heat-cell { height: clamp(30px, 4.4vw, 40px); font-size: 11px; border-radius: 7px; }
.heat-compact .heat-counts { gap: 9px; font-size: 10.5px; }
.heat-compact .heat-legend { gap: 12px; margin-top: 11px; font-size: 10.5px; }

/* ===================== Quick-add expand / collapse ===================== */
.quick-chips.collapsed { max-height: var(--two-rows, 92px); overflow: hidden; }
.quick-toggle {
  margin: 12px auto 0; display: flex; align-items: center; gap: 5px;
  background: none; border: none; color: var(--acc-strong);
  font-size: 13px; font-weight: 700; padding: 4px 8px; border-radius: 8px;
}
.quick-toggle:hover { background: var(--surface-2); }
.quick-toggle .qt-ic { display: inline-grid; place-items: center; transition: transform .2s; }
.quick-toggle .qt-ic svg { width: 16px; height: 16px; }
.quick-toggle .qt-ic.up { transform: rotate(180deg); }

/* pinned chip + star affordances */
.qchip.pinned { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 9%, var(--surface-2)); }
.qchip-pin { display: inline-grid; place-items: center; color: var(--acc-strong); flex: none; }
.qchip-pin svg { width: 14px; height: 14px; fill: var(--acc-strong); stroke: var(--acc-strong); }
.qchip-pinnable .qchip-add { background: transparent; color: var(--acc-strong); }
.qchip-pinnable .qchip-add svg { width: 16px; height: 16px; fill: none; }
.qchip-pinnable:hover .qchip-add svg { fill: var(--acc-soft); }

.li-pin, .entry-pin {
  border: none; background: none; color: var(--ink-3); border-radius: 8px;
  display: grid; place-items: center; flex: none; cursor: pointer; transition: .12s;
}
.li-pin { width: 30px; height: 46px; }
.li-pin svg, .entry-pin svg { width: 17px; height: 17px; fill: none; }
.li-pin:hover:not(:disabled), .entry-pin:hover { color: var(--acc-strong); }
.li-pin.on, .entry-pin.on { color: var(--acc-strong); }
.li-pin.on svg, .entry-pin.on svg { fill: var(--acc-strong); stroke: var(--acc-strong); }
.li-pin:disabled { opacity: .35; cursor: default; }
.entry-pin { width: 30px; height: 30px; margin-left: 2px; }

/* quick-add manager (settings) */
.qm-list { display: flex; flex-direction: column; gap: 8px; }
.qm-row { display: flex; align-items: center; gap: 11px; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm, 12px); }
.qm-pin { display: grid; place-items: center; color: var(--acc-strong); flex: none; }
.qm-pin svg { width: 16px; height: 16px; fill: var(--acc-strong); stroke: var(--acc-strong); }
.qm-main { flex: 1; min-width: 0; }
.qm-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.qm-tags { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.qm-cal { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; flex: none; }
.qm-cal .u { font-size: 10px; color: var(--ink-3); margin-left: 1px; font-weight: 600; }
.qm-actions { display: flex; gap: 2px; flex: none; }
.qm-actions .icon-btn:disabled { opacity: .3; cursor: default; }
.qm-suggest { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.qm-suggest-lbl { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 11px; }

/* ===================== Edit modal — 中分類ブロック ===================== */
.edit-block { margin-top: 14px; }
.edit-block.is-multi { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; background: var(--surface-2); }
.edit-mid-field { margin-bottom: 0; }
.edit-mid-row { display: flex; gap: 8px; align-items: flex-start; }
.edit-mid-row .combo { flex: 1; min-width: 0; }
.btn-add-block { margin-top: 14px; border-style: solid; }
.edit-foot { display: flex; align-items: center; gap: 12px; }
.edit-foot .save-total { margin-left: auto; }
.btn-delete {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line-strong); color: var(--pos);
  font-size: 14px; font-weight: 700; padding: 11px 15px; border-radius: var(--radius-sm, 12px);
  transition: .15s;
}
.btn-delete:hover { background: color-mix(in oklch, var(--pos) 10%, transparent); border-color: var(--pos); }
.btn-delete svg { width: 17px; height: 17px; }
@media (max-width: 560px) {
  .edit-foot { flex-wrap: wrap; }
  .edit-foot .save-total { width: 100%; order: -1; margin: 0 0 4px; }
}

/* ===================== Auth screens (login / confirm / done) ===================== */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 28px 18px; background: var(--app-bg, var(--bg)); }
.auth-card { width: 100%; max-width: 408px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 22px); box-shadow: var(--shadow-lg); padding: 32px 30px; }
.auth-center { text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 38px; height: 38px; }
.auth-brand-name { font-weight: 800; font-size: 20px; font-family: var(--ff-head, inherit); letter-spacing: .01em; }
.auth-brand-name .jp { color: var(--acc-strong); }
.auth-title { font-size: 23px; font-weight: 800; margin: 0 0 6px; letter-spacing: .01em; }
.auth-center .auth-title { margin-top: 4px; }
.auth-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 22px; line-height: 1.6; }
.auth-msg { margin-bottom: 18px; }
.auth-lbl { display: block; }
.auth-card .input { width: 100%; }
.auth-pw { position: relative; }
.auth-pw .input { padding-right: 64px; }
.auth-pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--ink-3); font-size: 12.5px; font-weight: 700; padding: 6px 8px; border-radius: 8px; }
.auth-pw-toggle:hover { background: var(--surface-2); color: var(--ink-2); }
.auth-submit { margin-top: 20px; }
.auth-field { margin-bottom: 14px; }
.auth-field:last-of-type { margin-bottom: 0; }
.auth-err { font-size: 12px; color: var(--pos); font-weight: 600; margin-top: 6px; }
.auth-forgot { text-align: center; margin-top: 16px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 18px; }
.auth-link { border: none; background: none; color: var(--acc-strong); font-weight: 700; font-size: 13px; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.auth-link:hover { background: var(--surface-2); text-decoration: underline; }

/* social signup buttons */
.social-group { display: flex; flex-direction: column; gap: 11px; margin-top: 4px; }
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm, 12px);
  font-size: 15px; font-weight: 700; cursor: pointer; border: 1.5px solid transparent;
  white-space: nowrap; line-height: 1.2;
  transition: filter .15s, background .15s, border-color .15s;
}
.social-btn .social-ic { display: inline-grid; place-items: center; width: 20px; height: 20px; }
.social-btn.google { background: #fff; color: #3c4043; border-color: var(--line-strong); }
.social-btn.google:hover { background: #f7f7f5; border-color: var(--ink-3); }
.social-btn.apple { background: #000; color: #fff; }
.social-btn.apple:hover { filter: brightness(1.25); }
.social-btn.line { background: #06C755; color: #fff; }
.social-btn.line:hover { filter: brightness(.94); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-3); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-note { margin-top: 18px; font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.6; }

.auth-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 18px; }
.auth-ic svg { width: 30px; height: 30px; }
.auth-ic.ok { background: color-mix(in oklch, var(--neg) 16%, transparent); color: var(--neg); }
.auth-ic.danger { background: color-mix(in oklch, var(--pos) 14%, transparent); color: var(--pos); }
.auth-ic:not(.ok):not(.danger) { background: var(--surface-2); color: var(--ink-2); }
.auth-points { text-align: left; list-style: none; padding: 14px 16px; margin: 0 0 20px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; color: var(--ink-2); }
.auth-points.danger { background: color-mix(in oklch, var(--pos) 7%, var(--surface-2)); }
.auth-points li { position: relative; padding-left: 18px; line-height: 1.5; }
.auth-points li + li { margin-top: 8px; }
.auth-points li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--pos); }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===================== Auto-calc (settings) ===================== */
.autocalc-cta {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--acc-soft); border: 1px solid color-mix(in oklch, var(--acc) 30%, transparent);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; cursor: pointer; transition: .15s;
}
.autocalc-cta:hover { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 12%, var(--surface)); }
.autocalc-cta-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--acc); color: #fff; display: grid; place-items: center; }
.autocalc-cta-ic svg { width: 21px; height: 21px; }
.autocalc-cta-tx { flex: 1; min-width: 0; }
.autocalc-cta-t { display: block; font-size: 14.5px; font-weight: 800; color: var(--ink); }
.autocalc-cta-s { display: block; font-size: 12px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.autocalc-cta-go { color: var(--acc-strong); flex: none; }
.autocalc-cta-go svg { width: 20px; height: 20px; }

/* ホームの初回セットアップ促しカード（オンボーディング未完了の間だけ表示） */
.setup-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--acc-soft); border: 1px solid color-mix(in oklch, var(--acc) 30%, transparent);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 18px; cursor: pointer; transition: .15s;
}
.setup-card:hover { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 12%, var(--surface)); }
.setup-card-ic { width: 42px; height: 42px; flex: none; border-radius: 13px; background: var(--acc); color: #fff; display: grid; place-items: center; }
.setup-card-ic svg { width: 22px; height: 22px; }
.setup-card-tx { flex: 1; min-width: 0; }
.setup-card-t { display: block; font-size: 15px; font-weight: 800; color: var(--ink); }
.setup-card-s { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.setup-card-go { color: var(--acc-strong); flex: none; }
.setup-card-go svg { width: 20px; height: 20px; }

/* オンボーディング・ウィザード */
.onb-steps { display: flex; gap: 7px; justify-content: center; margin: -4px 0 18px; }
.onb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong, var(--line)); transition: .15s; }
.onb-dot.done { background: color-mix(in oklch, var(--acc) 55%, var(--surface-2)); }
.onb-dot.on { background: var(--acc); width: 22px; border-radius: 999px; }
.onb-goal-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.onb-toggle-btn { padding: 11px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 700; cursor: pointer; transition: .12s; }
.onb-toggle-btn:hover { border-color: var(--acc); }
.onb-toggle-btn.on { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-strong); }
.onb-hint, .onb-skip-note { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 4px; }
.onb-skip-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 13px 14px; }
.onb-confirm { display: flex; flex-direction: column; gap: 12px; }
.onb-sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); }
.onb-sum-l { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.onb-sum-v { font-size: 22px; font-weight: 800; color: var(--acc-strong); }
.onb-sum-v .u { font-size: 11px; color: var(--ink-3); font-weight: 700; margin-left: 2px; }

.calc-modal .field { margin-bottom: 16px; }
.calc-sex button { flex: 1; }
.calc-slider .field-label { display: flex; align-items: baseline; gap: 4px; }
.calc-slider .calc-val { margin-left: auto; font-size: 18px; font-weight: 800; color: var(--acc-strong); }
.calc-slider .calc-u { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.calc-modal input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-2); outline: none; margin-top: 4px; }
.calc-modal input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--acc); border: 3px solid var(--surface); box-shadow: 0 2px 8px -2px rgba(0,0,0,.3); cursor: pointer; }
.calc-modal input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--acc); border: 3px solid var(--surface); cursor: pointer; }
.calc-act { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* 5段階（ハリス・ベネディクト）は縦並びのリスト型にして説明文を読みやすく */
.calc-act-5 { grid-template-columns: 1fr; }
.calc-act-5 .calc-act-btn { flex-direction: row; align-items: center; gap: 10px; padding: 10px 13px; }
.calc-act-5 .calc-act-top { order: 2; flex: none; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 88px; }
.calc-act-5 .calc-act-d { order: 1; flex: 1; font-size: 11.5px; }
.calc-act-5 .calc-act-x { font-size: 12px; }
.calc-act-btn { display: flex; flex-direction: column; gap: 5px; padding: 11px 10px; border-radius: var(--radius-sm, 12px); border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; text-align: left; transition: .12s; }
.calc-act-btn:hover { border-color: var(--acc); }
.calc-act-btn.on { border-color: var(--acc); background: var(--acc-soft); }
.calc-act-top { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.calc-act-l { font-size: 14px; font-weight: 800; color: var(--ink); }
.calc-act-x { font-size: 11px; font-weight: 700; color: var(--acc-strong); font-family: var(--ff-data, inherit); }
.calc-act-d { font-size: 10.5px; color: var(--ink-3); line-height: 1.4; }
.calc-result { background: var(--surface-2); border-radius: var(--radius); padding: 16px; margin: 4px 0 8px; }
.calc-result-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.calc-result-row + .calc-result-row { margin-top: 10px; }
.calc-result-l { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.calc-result-v { font-size: 22px; font-weight: 800; color: var(--acc-strong); }
.calc-result-v .u { font-size: 11px; color: var(--ink-3); font-weight: 700; margin-left: 2px; }
.calc-result-note { font-size: 11px; color: var(--ink-3); margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
/* 計算式・出典の明示ボックス */
.calc-formula { border: 1px solid var(--line); border-radius: var(--radius-sm, 12px); padding: 13px 14px; margin: 4px 0 10px; background: var(--surface); }
.calc-formula-h { font-size: 11px; font-weight: 800; color: var(--ink-2); letter-spacing: .04em; margin-bottom: 9px; }
.calc-formula-row { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.calc-formula-row + .calc-formula-row { margin-top: 4px; }
.calc-formula-step { flex: none; font-weight: 800; color: var(--acc-strong); font-size: 11px; min-width: 76px; }
.calc-formula-eq b { font-weight: 800; color: var(--ink); }
.calc-formula-note { font-size: 10.5px; color: var(--ink-3); line-height: 1.6; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.calc-cite { font-size: 10.5px; color: var(--ink-3); line-height: 1.6; margin-top: 7px; }
.calc-cite a { color: var(--acc-strong); font-weight: 700; text-decoration: underline; }
@media (max-width: 420px) {
  .calc-act { grid-template-columns: 1fr; }
  .calc-act-btn { flex-direction: row; align-items: center; justify-content: space-between; }
  .calc-act-top { flex-direction: row-reverse; gap: 8px; }
}
.btn-danger-solid { background: var(--pos); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.95); }
.btn-danger-solid.is-disabled { opacity: .5; filter: none; cursor: not-allowed; }
.btn-danger-solid.is-disabled:hover { filter: none; }

/* 危険操作の確認モーダル（全データ削除）＋ 退会確認の入力ゲート/バックアップ導線 */
.modal.modal-sm { max-width: 460px; }
.danger-msg { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin: 0 0 16px; }
.danger-export { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.danger-export-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 0 0 10px; }
.danger-field { margin-bottom: 4px; }
.danger-field-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; }
.danger-field-label b { color: var(--pos); font-weight: 800; }
.danger-foot { justify-content: flex-end; }
/* auth（退会など）側でも同じバックアップ導線/入力ゲートを使う（左寄せ） */
.auth-center .danger-export { text-align: left; }
.auth-center .danger-field { text-align: left; margin-bottom: 16px; }

.auth-back { position: absolute; top: 16px; left: 16px; border: none; background: none; color: var(--ink-3); font-size: 12.5px; font-weight: 700; padding: 6px 9px; border-radius: 8px; cursor: pointer; }
.auth-back:hover { background: var(--surface-2); color: var(--ink-2); }
.auth-card { position: relative; }

/* ===================== Landing page (logged-out top) ===================== */
.lp { min-height: 100vh; background: var(--app-bg, var(--bg)); color: var(--ink); }
/* バーは全幅、内容はヒーロー(max-width 1100px・中央寄せ)の左右端に整列（間延び解消）。1100/2=550px。 */
.lp-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px max(24px, calc(50% - 550px)); background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.lp-brand { display: flex; align-items: center; gap: 10px; }
.lp-brand .brand-mark { width: 32px; height: 32px; }
.lp-brand-name { font-weight: 800; font-size: 18px; font-family: var(--ff-head, inherit); }
.lp-brand-name .jp { color: var(--acc-strong); }
.lp-nav-menu { display: flex; align-items: center; gap: 22px; }
.lp-nav-menu a { color: var(--ink-2); font-weight: 700; font-size: 14px; text-decoration: none; padding: 6px 2px; border-radius: 6px; transition: color .15s; }
.lp-nav-menu a:hover { color: var(--acc-strong); }
/* アンカー遷移時にスティッキーヘッダー分のオフセットを確保 */
.lp [id] { scroll-margin-top: 76px; }
.lp-nav-actions { display: flex; align-items: center; gap: 14px; }
.lp-login-link { border: none; background: none; color: var(--ink-2); font-weight: 700; font-size: 14px; cursor: pointer; padding: 8px; border-radius: 8px; }
.lp-login-link:hover { color: var(--acc-strong); }
.lp-cta-sm { padding: 9px 16px; font-size: 14px; }

/* 画面下部に常駐するフロート CTA（アプリの「記録する」FABと同趣旨）。ヒーローを過ぎたら表示。 */
.lp-fab {
  position: fixed; z-index: 45;
  right: max(clamp(16px, 4vw, 36px), calc(50% - 550px)); bottom: clamp(18px, 4vw, 32px);
  height: 56px; padding: 0 24px; border-radius: var(--radius-pill);
  border: none; background: linear-gradient(150deg, var(--acc) 0%, var(--acc-strong) 100%);
  color: var(--on-acc); font-size: 15.5px; font-weight: 800; font-family: var(--ff-head, inherit);
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  box-shadow: 0 14px 34px -10px var(--acc), 0 4px 12px -4px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .25s, transform .25s cubic-bezier(.4,1.4,.5,1), box-shadow .2s;
}
.lp-fab.show { opacity: 1; transform: none; pointer-events: auto; }
.lp-fab svg { width: 20px; height: 20px; }
.lp-fab:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 20px 44px -10px var(--acc), 0 6px 16px -4px rgba(0,0,0,.24); }
.lp-fab:active { transform: translateY(0) scale(.99); }

.lp-hero { max-width: 1100px; margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.lp-eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: .12em; color: var(--acc-strong); text-transform: uppercase; margin-bottom: 14px; }
.lp-eyebrow.center { text-align: center; }
.lp-h1 { font-family: var(--ff-head, inherit); font-size: clamp(34px, 5vw, 54px); font-weight: 900; line-height: 1.14; letter-spacing: .01em; margin: 0 0 18px; }
.lp-h1 .hl { color: var(--acc-strong); position: relative; }
.lp-h1 .hl::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: .08em; height: .28em; background: var(--acc-soft); z-index: -1; border-radius: 4px; }
.lp-lead { font-size: 16.5px; line-height: 1.85; color: var(--ink-2); margin: 0 0 26px; max-width: 30em; }
.lp-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-hero-cta.center { justify-content: center; }
.lp-mini { margin-top: 16px; font-size: 12.5px; color: var(--ink-3); }

/* hero phone mockup */
.lp-hero-visual { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lp-hero-note { margin: 18px auto 0; max-width: 290px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow); text-align: left; }
.lp-hero-note b { color: var(--acc-strong); font-weight: 800; }

/* device frame + screen mock */
.ph { background: #0e0d0b; border-radius: 38px; padding: 9px; box-shadow: 0 0 0 2px var(--line-strong), 0 30px 60px -22px rgba(40,30,20,.5); position: relative; }
.ph::before { content: ""; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 78px; height: 18px; background: #0e0d0b; border-radius: 0 0 12px 12px; z-index: 3; }
.ph-lg { width: 290px; }
.ph-sm { width: 230px; margin: 0 auto 18px; }
.ph-sm .ph-screen { height: 340px; }
.ph-screen { background: var(--surface); border-radius: 30px; overflow: hidden; padding: 26px 16px 16px; }
.ph-note { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--acc); color: #fff; font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 999px; z-index: 4; white-space: nowrap; }
.ph-tabbar { display: flex; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 30px 30px; padding: 9px 6px 12px; margin: 0 -16px -16px; }
.ph-tabbar span { flex: 1; text-align: center; font-size: 9.5px; font-weight: 700; color: var(--ink-3); }
.ph-tabbar span.on { color: var(--acc-strong); }

/* 実スクショをベゼル内に表示（ノッチ非表示・スクショを画面いっぱいにクロップ） */
.ph:has(.ph-shot)::before { display: none; }
.ph-screen.ph-shot { padding: 0; }
.ph-lg .ph-screen.ph-shot { height: 560px; }
.ph-sm .ph-screen.ph-shot { height: 340px; }
.ph-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.ph-shot.pos-bottom img { object-position: bottom center; }

.phs-bar { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.phs-bat { width: 18px; height: 9px; border: 1.5px solid var(--ink-3); border-radius: 2px; position: relative; }
.phs-bat::after { content: ""; position: absolute; inset: 1.5px; background: var(--ink-3); border-radius: 1px; }
.phs-h { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.phs-h b { color: var(--ink); }
.phs-ring { position: relative; width: 128px; height: 128px; margin: 8px auto 2px; }
.phs-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.phs-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.phs-ring-fg { fill: none; stroke: var(--acc); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 314; stroke-dashoffset: 26; }
.phs-ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.phs-ring-c b { font-size: 26px; font-weight: 800; font-family: var(--ff-data, inherit); }
.phs-ring-c span { font-size: 10px; color: var(--ink-3); font-weight: 600; }
.phs-bal { text-align: center; font-size: 12px; font-weight: 700; margin-bottom: 12px; }
.phs-bal.under { color: var(--neg); }
.phs-bal b { font-weight: 800; }
.phs-quick { background: var(--surface-2); border-radius: 14px; padding: 11px; margin-bottom: 12px; }
.phs-quick-h { font-size: 10px; font-weight: 800; color: var(--ink-3); letter-spacing: .04em; margin-bottom: 8px; }
.phs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.phs-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 5px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.phs-chip i { color: var(--acc-strong); font-style: normal; }
.phs-chip em { font-style: normal; color: var(--ink-3); font-family: var(--ff-data, inherit); }
.phs-chip.on { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 9%, var(--surface)); color: var(--acc-strong); }
.phs-chip.on em { color: var(--acc-strong); }
.phs-fab { text-align: center; background: var(--acc); color: #fff; border-radius: 12px; padding: 11px; font-size: 13px; font-weight: 800; box-shadow: 0 8px 18px -8px var(--acc); }

/* small step screens */
.phm { font-size: 11px; }
.phm-h { font-size: 14px; font-weight: 800; font-family: var(--ff-head, inherit); margin-bottom: 10px; }
.phm-h-sub { font-size: 10px; font-weight: 700; color: var(--acc-strong); background: var(--acc-soft); padding: 2px 8px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.phm-seg { display: flex; gap: 3px; background: var(--surface-2); padding: 3px; border-radius: 9px; margin-bottom: 11px; }
.phm-seg span { flex: 1; text-align: center; font-size: 10px; font-weight: 700; color: var(--ink-3); padding: 6px 2px; border-radius: 6px; }
.phm-seg span.on { background: var(--surface); color: var(--acc-strong); box-shadow: var(--shadow); }
.phm-field { margin-bottom: 9px; }
.phm-field label { display: block; font-size: 10px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.phm-input { display: flex; justify-content: space-between; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; font-size: 12px; font-weight: 600; color: var(--ink); }
.phm-input.sel { border-color: var(--acc); background: color-mix(in oklch, var(--acc) 7%, var(--surface)); }
.phm-input i { color: var(--ink-3); font-style: normal; }
.phm-pop { margin-top: 6px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; box-shadow: var(--shadow); }
.phm-pop span { display: block; padding: 8px 11px; font-size: 11.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.phm-pop span:last-child { border-bottom: none; }
.phm-pop span.on { background: var(--acc-soft); color: var(--acc-strong); font-weight: 700; }
.phm-calbox { display: flex; align-items: baseline; justify-content: center; gap: 5px; border: 1.5px solid var(--acc); background: color-mix(in oklch, var(--acc) 7%, var(--surface)); border-radius: 12px; padding: 14px; margin-bottom: 8px; }
.phm-calbox b { font-size: 30px; font-weight: 800; font-family: var(--ff-data, inherit); color: var(--ink); }
.phm-calbox span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.phm-auto { font-size: 10.5px; font-weight: 700; color: var(--acc-strong); text-align: center; margin-bottom: 12px; }
.phm-line { display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); border-radius: 9px; padding: 9px 11px; margin-bottom: 6px; }
.phm-line-name { font-size: 11.5px; font-weight: 600; }
.phm-line-cal { font-size: 12px; font-weight: 800; font-family: var(--ff-data, inherit); }
.phm-line-cal em { font-style: normal; font-size: 9px; color: var(--ink-3); font-weight: 600; margin-left: 1px; }
.phm-add { text-align: center; border: 1.5px dashed var(--line-strong); border-radius: 9px; padding: 9px; font-size: 11px; font-weight: 700; color: var(--acc-strong); margin: 8px 0; }
.phm-save { text-align: center; background: var(--acc); color: #fff; border-radius: 10px; padding: 10px; font-size: 12px; font-weight: 800; }
.phm-hero { display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.phm-hero-l { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.phm-hero-v { font-size: 22px; font-weight: 800; font-family: var(--ff-data, inherit); }
.phm-hero-v.under { color: var(--neg); }
.phm-hero-v em { font-style: normal; font-size: 12px; margin-left: 1px; }
.phm-bars { display: flex; flex-direction: column; gap: 7px; }
.phm-brow { display: flex; align-items: center; gap: 7px; }
.phm-brow span { width: 26px; font-size: 9.5px; color: var(--ink-3); font-weight: 600; text-align: right; }
.phm-track { flex: 1; height: 13px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.phm-track i { display: block; height: 100%; border-radius: 5px; }
.phm-track i.under { background: var(--neg); }
.phm-track i.over { background: var(--acc); }

/* band */
.lp-band { max-width: 880px; margin: 8px auto 0; padding: 22px 24px; display: flex; align-items: center; justify-content: center; gap: 26px; flex-wrap: wrap; }
.lp-band-item { text-align: center; }
.lp-band-item b { display: block; font-size: 26px; font-weight: 900; font-family: var(--ff-head, inherit); color: var(--acc-strong); }
.lp-band-item span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.lp-band-sep { width: 1px; height: 38px; background: var(--line-strong); }

/* sections */
.lp-section { max-width: 1040px; margin: 0 auto; padding: 56px 24px; }
.lp-sec-head { text-align: center; margin-bottom: 36px; }
.lp-h2 { font-family: var(--ff-head, inherit); font-size: clamp(24px, 3.4vw, 34px); font-weight: 900; line-height: 1.3; margin: 0; }
.lp-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.lp-feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow); }
.lp-feat-ic { width: 46px; height: 46px; border-radius: 13px; background: var(--acc-soft); color: var(--acc-strong); display: grid; place-items: center; margin-bottom: 14px; }
.lp-feat-ic svg { width: 23px; height: 23px; }
.lp-feat-title { font-size: 16px; font-weight: 800; margin-bottom: 7px; }
.lp-feat-body { font-size: 13px; color: var(--ink-2); line-height: 1.7; }

.lp-steps-sec { background: var(--surface-2); max-width: none; }
.lp-steps { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-step { text-align: center; padding: 0 12px; }
.lp-step-n { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; font-size: 20px; font-weight: 900; font-family: var(--ff-data, inherit); }
.lp-step-title { font-size: 17px; font-weight: 800; margin-bottom: 7px; }
.lp-step-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }

/* 痩せる物語（目標→記録→体重の1本のストーリー） */
.lp-story-sec { max-width: none; background: color-mix(in oklch, var(--acc) 6%, var(--bg)); }
.lp-story { max-width: 920px; margin: 0 auto; display: flex; align-items: stretch; justify-content: center; gap: 6px; }
.lp-story-step { flex: 1 1 0; min-width: 0; text-align: center; padding: 0 10px; }
.lp-story-arrow { flex: 0 0 auto; align-self: center; font-size: 24px; font-weight: 800; color: var(--acc-strong); padding-bottom: 22px; }

/* あえてやらない（PFC割り切りを強みとして提示） */
.lp-why { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-why-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 22px; }
.lp-why-h { font-size: 17px; font-weight: 800; margin-bottom: 10px; color: var(--acc-strong); }
.lp-why-card p { font-size: 13.5px; line-height: 1.8; color: var(--ink-2); margin: 0; }

/* feature showcase（実スクリーンショット付きの章） */
.lp-show-sec { max-width: none; }
.lp-show-sec.alt { background: var(--surface-2); }
.lp-migrate-sec { background: color-mix(in oklch, var(--acc) 6%, var(--bg)); }
.lp-sec-lead { max-width: 38em; margin: 14px auto 0; font-size: 15.5px; line-height: 1.85; color: var(--ink-2); }
.lp-shows { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }
.lp-show { display: grid; grid-template-columns: 1.04fr .96fr; gap: 44px; align-items: center; }
.lp-show.flip .lp-show-media { order: 2; }
.lp-show-media { display: flex; justify-content: center; min-width: 0; }
/* スマホ画面（縦長）を端末風カードで表示。短い画像は全体、長い画像は上端を表示。 */
.lp-shot { width: 290px; max-width: 100%; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 26px 54px -24px rgba(40, 30, 20, .42), 0 4px 12px -4px rgba(40, 30, 20, .12); overflow: hidden; }
.lp-shot img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: cover; object-position: top center; }
.lp-show-text { min-width: 0; }
.lp-show-h { font-family: var(--ff-head, inherit); font-size: clamp(19px, 2.2vw, 23px); font-weight: 800; line-height: 1.42; margin: 0 0 12px; }
.lp-show-p { font-size: 14.5px; line-height: 1.85; color: var(--ink-2); margin: 0 0 16px; }
.lp-show-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lp-show-list li { position: relative; padding-left: 27px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.lp-show-list li::before { content: ""; position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border-radius: 50%; background: var(--acc-soft); }
.lp-show-list li::after { content: ""; position: absolute; left: 5px; top: 5px; width: 6px; height: 3px; border-left: 2px solid var(--acc-strong); border-bottom: 2px solid var(--acc-strong); transform: rotate(-45deg); }
@media (max-width: 860px) {
  .lp-shows { gap: 44px; }
  .lp-show { grid-template-columns: 1fr; gap: 20px; }
  .lp-show.flip .lp-show-media { order: 0; }
  .lp-shot img { max-height: 72vh; }
}

.lp-final { text-align: center; padding: 64px 24px; }
.lp-final-h { font-family: var(--ff-head, inherit); font-size: clamp(24px, 3.6vw, 36px); font-weight: 900; margin: 0 0 12px; }

/* FAQ accordion */
.lp-faq-sec { max-width: 760px; }
.lp-faq { display: flex; flex-direction: column; gap: 10px; }
.lp-faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lp-faq-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 18px 20px; font-size: 15.5px; font-weight: 700; color: var(--ink); }
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-q { flex: 1; }
.lp-faq-q::before { content: "Q"; color: var(--acc-strong); font-weight: 900; margin-right: 10px; font-family: var(--ff-data, inherit); }
.lp-faq-mark { position: relative; width: 16px; height: 16px; flex: none; }
.lp-faq-mark::before, .lp-faq-mark::after { content: ""; position: absolute; background: var(--acc-strong); border-radius: 2px; transition: transform .2s; }
.lp-faq-mark::before { top: 7px; left: 0; width: 16px; height: 2px; }
.lp-faq-mark::after { left: 7px; top: 0; width: 2px; height: 16px; }
.lp-faq-item[open] .lp-faq-mark::after { transform: scaleY(0); }
.lp-faq-a { padding: 0 20px 18px 50px; font-size: 14px; color: var(--ink-2); line-height: 1.8; }
@media (max-width: 520px) {
  .lp-faq-item summary { font-size: 14px; padding: 15px 16px; }
  .lp-faq-a { padding: 0 16px 15px 38px; font-size: 13px; }
}
.lp-final-sub { font-size: 15px; color: var(--ink-2); line-height: 1.8; margin: 0 0 26px; }

.lp-foot { border-top: 1px solid var(--line); padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lp-foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-family: var(--ff-head, inherit); }
.lp-foot-brand .brand-mark.sm { width: 26px; height: 26px; }
.lp-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }
.lp-foot-links a { font-size: 13px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.lp-foot-links a:hover { color: var(--acc-strong); }
.lp-foot-copy { font-size: 11.5px; color: var(--ink-3); }

@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; padding-top: 36px; text-align: center; }
  .lp-lead { margin-left: auto; margin-right: auto; }
  .lp-hero-cta { justify-content: center; }
  /* SP では説明文（テキスト）を先に見せ、スクリーンショットはその下に置く */
  .lp-hero-text { order: 0; }
  .lp-hero-visual { order: 1; margin-top: 8px; }
  .lp-hero-note { text-align: center; }
  .lp-features { grid-template-columns: 1fr 1fr; }
  .lp-steps { grid-template-columns: 1fr; gap: 28px; max-width: 320px; }
  .lp-story { flex-direction: column; align-items: center; gap: 0; }
  .lp-story-step { max-width: 300px; padding: 4px 12px; }
  .lp-story-arrow { padding: 8px 0; transform: rotate(90deg); }
  .lp-why { grid-template-columns: 1fr; max-width: 420px; }
}
@media (max-width: 880px) {
  /* 幅が足りない端末では目次ナビを隠す（ログイン/登録ボタンを優先） */
  .lp-nav-menu { display: none; }
}
@media (max-width: 520px) {
  .lp-features { grid-template-columns: 1fr; }
  .lp-nav { padding: 12px 16px; }
  .lp-cta-sm { padding: 8px 13px; }
}
