:root {
  color-scheme: light;
  --bg:#f5f7f3; --surface:#fff; --surface-soft:#f7f9f6; --text:#192c24; --muted:#58675e;
  --line:#e2e8e0; --line-strong:#cad6cb; --primary:#24563f; --primary-hover:#1b4834;
  --primary-soft:#e8f1e8; --accent:#43835d; --warning:#9f342f; --shadow:0 2px 3px #263d2610;
  --green-bg:#e8f2e9; --green-ink:#2c6c48; --orange-bg:#fff0e3; --orange-ink:#ac5421;
  --blue-bg:#eaf1fd; --blue-ink:#305ea4; --purple-bg:#f0ebfb; --purple-ink:#7051a2;
  --teal-bg:#e3f3ef; --teal-ink:#266e63; --neutral-bg:#edf1eb; --neutral-ink:#496052;
  --sidebar:224px; --side-gap:40px; --radius:19px;
  font-family: -apple-system,BlinkMacSystemFont,"Hiragino Sans","Yu Gothic UI","Noto Sans CJK JP",Meiryo,sans-serif;
}
@media (prefers-color-scheme:dark) {
  :root:not([data-theme=light]) {
    color-scheme:dark;
    --bg:#141b18; --surface:#1b2520; --surface-soft:#202c25; --text:#ebf4ee; --muted:#aebcb3;
    --line:#324239; --line-strong:#52685a; --primary:#96d4ab; --primary-hover:#b6e6c5;
    --primary-soft:#2b4234; --accent:#80c399; --warning:#ff9f91; --shadow:0 2px 4px #0003;
    --green-bg:#2d4334; --green-ink:#a2d9b2; --orange-bg:#4e3327; --orange-ink:#ffc196;
    --blue-bg:#283751; --blue-ink:#a9c9ff; --purple-bg:#3d3154; --purple-ink:#d7bbff;
    --teal-bg:#29433c; --teal-ink:#9edcd1; --neutral-bg:#2c3830; --neutral-ink:#bbd0c1;
  }
}
:root[data-theme=dark] {
  color-scheme:dark;
  --bg:#141b18; --surface:#1b2520; --surface-soft:#202c25; --text:#ebf4ee; --muted:#aebcb3;
  --line:#324239; --line-strong:#52685a; --primary:#96d4ab; --primary-hover:#b6e6c5;
  --primary-soft:#2b4234; --accent:#80c399; --warning:#ff9f91; --shadow:0 2px 4px #0003;
  --green-bg:#2d4334; --green-ink:#a2d9b2; --orange-bg:#4e3327; --orange-ink:#ffc196;
  --blue-bg:#283751; --blue-ink:#a9c9ff; --purple-bg:#3d3154; --purple-ink:#d7bbff;
  --teal-bg:#29433c; --teal-ink:#9edcd1; --neutral-bg:#2c3830; --neutral-ink:#bbd0c1;
}
* { box-sizing:border-box; }
[hidden],.hidden { display:none !important; }
html { min-width:280px; background:var(--bg); }
body { margin:0; min-height:100vh; color:var(--text); font-size:1rem; line-height:1.55; }
button,input,select,textarea { font:inherit; color:inherit; }
input[type=checkbox],input[type=radio] { accent-color:var(--primary); }
input,textarea,select { max-width:100%; min-width:0; }
button,summary,select,a { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.44; }
a { color:var(--primary); }
h1,h2,h3,p,figure { margin:0; }
h1,h2,h3,strong { overflow-wrap:anywhere; }
svg { display:block; flex:none; }
:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.skip { position:fixed; left:10px; top:10px; padding:12px; background:var(--surface); z-index:12; transform:translateY(-150%); }
.skip:focus { transform:none; }
.loading,.fatal { margin:50px auto; max-width:600px; padding:24px; }
.sidebar { position:fixed; inset:0 auto 0 0; width:var(--sidebar); border-right:1px solid var(--line); display:flex; flex-direction:column; background:var(--surface); padding:30px 17px 20px; z-index:3; }
.brand { display:flex; align-items:center; gap:12px; color:var(--text); text-decoration:none; font-size:1.08rem; font-weight:800; letter-spacing:.10em; line-height:1.28; min-height:44px; }
.sidebar .brand { margin:0 0 42px 8px; }
.brand small { display:block; color:var(--muted); font-weight:500; font-size:.67rem; margin-top:4px; letter-spacing:.08em; }
.brand-mark { display:grid; flex:none; place-items:center; width:40px; height:40px; background:#224f3b; color:#e5f6e9; border-radius:13px; }
.side-nav { display:grid; gap:7px; }
.side-nav a { display:flex; align-items:center; gap:13px; padding:0 13px; min-height:49px; border-radius:11px; color:var(--muted); font-size:.9rem; font-weight:630; text-decoration:none; }
.side-nav a:hover { background:var(--surface-soft); color:var(--text); }
.side-nav a[aria-current] { background:var(--primary-soft); color:var(--primary); font-weight:800; }
.side-nav b { margin-left:auto; width:6px; height:6px; flex:none; border-radius:100%; background:var(--accent); }
.sidebar-foot { margin-top:auto; }
.privacy-link { display:flex; gap:9px; align-items:center; padding:12px 10px; min-height:58px; border-radius:11px; background:var(--surface-soft); text-decoration:none; color:var(--primary); }
.privacy-link strong,.privacy-link small { display:block; }
.privacy-link strong { font-size:.74rem; }
.privacy-link small { color:var(--muted); font-size:.67rem; margin-top:2px; }
.shell { margin-left:var(--sidebar); }
.topbar { border-bottom:1px solid var(--line); background:var(--surface); padding:0 var(--side-gap); }
.topbar-inner { min-height:64px; margin:auto; max-width:1260px; display:flex; justify-content:space-between; align-items:center; gap:8px; }
.workspace-name,.connection { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:.79rem; font-weight:650; }
.workspace-name svg { color:var(--green-ink); }
.connection { border:1px solid var(--line); padding:5px 11px; border-radius:30px; background:var(--surface-soft); white-space:nowrap; font-size:.73rem; }
.status-dot { width:7px; height:7px; border-radius:50%; background:var(--accent); flex:none; }
.mobile-brand,.bottom-nav { display:none; }
.content { padding:25px var(--side-gap) 48px; margin:0 auto; max-width:calc(1260px + var(--side-gap)*2); min-width:0; }
.content:focus { outline:none; }
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:20px; }
.kicker { color:var(--green-ink); font-size:.83rem; font-weight:750; margin-bottom:4px; letter-spacing:.035em; }
h1 { font-size:clamp(1.65rem,3.05vw,2.34rem); font-weight:780; letter-spacing:.014em; line-height:1.33; }
.heading-sub { color:var(--muted); margin-top:6px; font-size:.86rem; }
.date-nav { display:flex; align-items:center; padding:1px 2px; border:1px solid var(--line); border-radius:12px; background:var(--surface); flex:none; }
.icon-button { display:inline-grid; place-items:center; min-width:44px; min-height:44px; border:0; border-radius:9px; color:var(--muted); background:transparent; padding:0; }
.icon-button:hover:not(:disabled) { background:var(--surface-soft); color:var(--text); }
.calendar-control { position:relative; display:flex; align-items:center; justify-content:center; gap:6px; min-width:61px; min-height:44px; font-size:.78rem; font-weight:700; cursor:pointer; }
.calendar-control:focus-within,.file-button:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
.calendar-control input,.file-button input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.calendar-control input::-webkit-calendar-picker-indicator { position:absolute; inset:0; width:100%; height:100%; padding:0; cursor:pointer; }
.hero { min-height:225px; border-radius:22px; display:flex; align-items:center; overflow:hidden; color:#f6fcf8;
  background-color:#153c2e;
  background-image:linear-gradient(90deg,#143b2d 1%,#153c2e 30%,#163b2df0 46%,#163b2d35 75%,#163b2d26 100%),url('../assets/morning-run.webp');
  background-size:cover,70% auto; background-repeat:no-repeat; background-position:center, right 41%;
  padding:25px 32px;
}
.hero-copy { position:relative; max-width:100%; }
.hero-tag { display:inline-flex; align-items:center; gap:7px; color:#e1f2e5; font-weight:700; font-size:.69rem; letter-spacing:.075em; border:1px solid #ffffff38; background:#ffffff14; padding:4px 9px; border-radius:20px; margin-bottom:10px; }
.hero-tag span { width:6px; height:6px; border-radius:50%; background:#a8d6a8; }
.hero h2 { font-size:clamp(1.52rem,3.3vw,2.14rem); line-height:1.35; letter-spacing:.022em; font-weight:760; }
.hero p { color:#e1eee6; margin:8px 0 17px; font-size:.86rem; max-width:44ch; }
.button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; border:1px solid var(--line-strong); border-radius:10px; padding:8px 14px; background:var(--surface); color:var(--text); text-decoration:none; font-weight:720; font-size:.82rem; text-align:center; overflow-wrap:anywhere; }
.button.primary { border-color:var(--primary); background:var(--primary); color:var(--bg); }
.button.primary:hover { background:var(--primary-hover); }
.button.secondary:hover,.button.danger:hover,.text-button:hover { background:var(--surface-soft); }
.button.hero-button { background:#e9f3e6; color:#1c4230; border-color:transparent; }
.button.hero-button:hover { background:#fff; }
.button.danger { color:var(--warning); }
.overview { margin-top:22px; }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:11px; }
.section-heading h2,.panel h2 { font-size:1.02rem; line-height:1.35; }
.section-heading p,.panel-heading p { color:var(--muted); font-size:.76rem; margin-top:3px; }
.text-button,.subtle-link { display:inline-flex; gap:6px; align-items:center; text-decoration:none; min-height:44px; min-width:44px; padding:5px 8px; border:0; border-radius:8px; background:transparent; color:var(--primary); font-size:.77rem; font-weight:720; }
.summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(140px,100%),1fr)); gap:12px; }
.summary-card { min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:16px; text-align:left; padding:13px 14px 12px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:5px; transition:background .15s,border-color .15s; }
.summary-card:hover,.quick-item:hover,.record:hover { border-color:var(--line-strong); background:var(--surface-soft); }
.summary-head { display:flex; justify-content:space-between; align-items:center; color:var(--muted); margin-bottom:2px; }
.badge { display:inline-grid; flex:none; width:39px; height:39px; place-items:center; border-radius:12px; background:var(--neutral-bg); color:var(--neutral-ink); }
.badge.green { background:var(--green-bg); color:var(--green-ink); }
.badge.orange { background:var(--orange-bg); color:var(--orange-ink); }
.badge.blue { background:var(--blue-bg); color:var(--blue-ink); }
.badge.purple { background:var(--purple-bg); color:var(--purple-ink); }
.badge.teal { background:var(--teal-bg); color:var(--teal-ink); }
.summary-label { color:var(--muted); font-size:.81rem; font-weight:720; }
.summary-value { font-size:1.38rem; line-height:1.25; font-variant-numeric:tabular-nums; }
.summary-value.missing { font-size:1.20rem; letter-spacing:.02em; }
.summary-value small { font-size:.71rem; color:var(--muted); }
.summary-sub { color:var(--muted); font-size:.72rem; overflow-wrap:anywhere; }
.macro-strip { display:flex; flex-wrap:wrap; gap:6px 18px; color:var(--muted); font-size:.78rem; padding:9px 3px 0; }
.macro-strip b { color:var(--text); }
.dashboard-grid { display:grid; grid-template-columns:minmax(0,1.51fr) minmax(0,1fr); gap:15px; margin:18px 0; }
.panel { min-width:0; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); background:var(--surface); padding:17px 18px; }
.panel-heading,.panel-title { display:flex; align-items:center; gap:10px; min-width:0; }
.panel-heading { justify-content:space-between; margin-bottom:13px; }
.panel-heading .badge { width:37px; height:37px; }
.panel-heading .badge svg { height:19px; width:19px; }
.chart { min-width:0; }
.chart-plot { position:relative; }
.chart-plot>svg { width:100%; height:clamp(145px,14vw,195px); overflow:visible; }
.chart-plot text { fill:var(--muted); font-family:inherit; font-size:12px; }
.chart-grid { stroke:var(--line); stroke-dasharray:4 4; }
.chart-line,.chart-average,.chart-goal { fill:none; stroke-width:2; vector-effect:non-scaling-stroke; stroke:var(--accent); }
.chart-average,.chart-goal { stroke:var(--primary); stroke-dasharray:4 5; opacity:.78; }
.chart-goal { stroke:var(--teal-ink); stroke-dasharray:2 5; }
.chart-dot { fill:var(--accent); stroke:var(--surface); stroke-width:1.2; }
.chart-labels { margin:0 1.5% 0 8%; display:flex; justify-content:space-between; gap:4px; color:var(--muted); font-size:.71rem; font-variant-numeric:tabular-nums; }
.chart-empty { position:absolute; inset:0 0 0 8%; display:grid; place-items:center; pointer-events:none; }
.chart-empty span { background:var(--surface); border:1px solid var(--line); border-radius:30px; padding:5px 10px; color:var(--muted); font-size:.75rem; }
.chart-legend { display:flex; flex-wrap:wrap; gap:9px 16px; align-items:center; margin:12px 0 0; color:var(--muted); font-size:.72rem; }
.chart-legend span { display:inline-flex; align-items:center; gap:6px; }
.chart-legend i { width:17px; border-top:2px solid var(--accent); }
.chart-legend .dashed { border-style:dashed; border-color:var(--primary); }
.chart-legend .goal-line { border-style:dotted; border-color:var(--teal-ink); }
.chart-data { color:var(--muted); font-size:.77rem; }
.chart-data ul { max-height:135px; overflow:auto; }
.empty { display:grid; gap:7px; justify-items:center; align-content:center; text-align:center; min-height:166px; padding:16px 7px; }
.empty .badge { height:42px; width:42px; margin-bottom:2px; }
.empty strong { font-size:.85rem; }
.empty p { color:var(--muted); font-size:.75rem; }
.quick-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(140px,100%),1fr)); gap:9px; }
.quick-item { display:grid; grid-template-columns:auto 1fr auto; grid-template-rows:auto auto; align-items:center; text-align:left; min-height:60px; padding:8px; gap:0 8px; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.quick-item .badge { grid-row:1/3; width:30px; height:30px; border-radius:9px; }
.quick-item .badge svg { height:17px; width:17px; }
.quick-item strong { grid-column:2; align-self:end; font-size:.75rem; }
.quick-item small { grid-column:2; font-size:.67rem; color:var(--muted); align-self:start; }
.quick-item>svg { grid-column:3; grid-row:1/3; color:var(--muted); }
.modal-quick { grid-template-columns:repeat(2,minmax(0,1fr)); }
.modal-quick .quick-item { min-height:64px; }
.modal-quick .quick-item strong { grid-row:1/3; align-self:center; font-size:.85rem; }
.record-list { display:grid; gap:6px; }
.record { width:100%; display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center; min-height:58px; gap:9px; text-align:left; padding:7px 8px; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:10px; }
.record-main { display:grid; gap:1px; }
.record strong { font-size:.83rem; }
.record small,.record-detail { color:var(--muted); font-size:.72rem; overflow-wrap:anywhere; }
.record .badge { width:31px; height:31px; border-radius:8px; }
.record .badge svg { height:17px; width:17px; }
.record>svg { color:var(--muted); }
.log-panel>.button,.history-panel>.button { margin-top:12px; }
.history-actions { margin-bottom:14px; }
.group-date { color:var(--muted); font-size:.8rem; margin:15px 0 7px; }
.content>.panel+.panel,.draft-panel+.panel { margin-top:15px; }
.segmented { display:flex; flex-wrap:wrap; align-items:center; gap:5px; margin:10px 0 14px; }
.segmented button { min-width:44px; min-height:44px; padding:5px 12px; border:1px solid var(--line); border-radius:8px; color:var(--muted); background:var(--surface); font-weight:680; font-size:.79rem; }
.segmented button[aria-pressed=true] { color:var(--primary); background:var(--primary-soft); border-color:var(--line-strong); }
.settings-grid { display:grid; gap:14px; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.settings-list { display:flex; flex-wrap:wrap; gap:8px; margin:11px 0; }
.table-scroll { max-width:100%; overflow:auto; }
table { border-collapse:collapse; width:100%; font-size:.82rem; }
th, td { padding:9px 7px; border-bottom:1px solid var(--line); text-align:left; }
thead th { color:var(--muted); }
td small { display:block; color:var(--muted); font-size:.68rem; }
.panel h3 { margin-top:15px; font-size:.9rem; }
.nutrition-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(110px,100%),1fr)); gap:8px; margin-top:8px; }
.nutrition-grid>div { border:1px solid var(--line); border-radius:10px; padding:9px; display:grid; }
.nutrition-grid span,.nutrition-grid small { font-size:.72rem; color:var(--muted); }
.observations { margin:7px 0 0; padding-left:1.4rem; font-size:.83rem; }
.storage { display:grid; gap:5px; margin:8px 0 12px; font-size:.82rem; }
.storage>div { display:flex; justify-content:space-between; gap:8px; border-bottom:1px solid var(--line); padding:5px 0; }
.storage dt { color:var(--muted); }
.storage dd { margin:0; text-align:right; font-weight:680; }
.field-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 12px; }
.field { display:grid; align-content:start; gap:5px; font-size:.84rem; font-weight:650; min-width:0; margin:0 0 8px; }
.field.full { grid-column:1/-1; }
.field>.unit,.unit { color:var(--muted); font-size:.73rem; font-weight:550; }
.field :is(input:not([type=radio]),select,textarea) { width:100%; min-height:44px; border:1px solid var(--line-strong); border-radius:9px; padding:8px 10px; color:var(--text); background:var(--surface-soft); font-size:1rem; font-weight:450; }
.field input[type=file] { padding:8px; }
textarea { resize:vertical; }
.checkline { display:flex; align-items:center; gap:9px; min-height:44px; font-size:.82rem; cursor:pointer; }
.checkline input { width:19px; height:19px; flex:none; margin:0; }
.help { font-size:.79rem; color:var(--muted); margin:7px 0; overflow-wrap:anywhere; }
.info { padding:9px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); color:var(--muted); font-size:.82rem; margin:9px 0; }
.onboarding { margin-top:16px; }
details { margin-top:9px; }
summary { cursor:pointer; font-size:.82rem; font-weight:700; min-height:44px; padding:10px 0; color:var(--primary); }
dialog { width:min(620px,calc(100% - 26px)); max-height:calc(100% - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); color:var(--text); background:var(--surface); border:1px solid var(--line-strong); border-radius:20px; box-shadow:0 30px 95px #091a1250; padding:0; overflow:auto; overscroll-behavior:contain; }
dialog::backdrop { background:#101f19a0; }
.dialog-head { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:9px; border-bottom:1px solid var(--line); background:var(--surface); padding:9px 15px 9px 19px; }
.dialog-head h2 { font-size:1.16rem; }
.dialog-body { padding:14px 19px 19px; }
.dialog-body>p { font-size:.85rem; }
.dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; padding-top:12px; margin-top:8px; border-top:1px solid var(--line); }
.dialog-error { border-radius:8px; padding:9px 10px; border:1px solid var(--line); color:var(--warning); font-size:.83rem; margin-bottom:10px; }
.dialog-body form .info:first-of-type { margin-top:0; }
.photo-fields,.rating { border:0; padding:0; min-width:0; }
.photo-fields { margin:0 0 13px; }
.photo-fields legend,.rating legend { font-size:.84rem; font-weight:700; margin-bottom:5px; padding:0; }
.photo-buttons,.set-actions { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.file-button { position:relative; display:inline-flex; align-items:center; gap:7px; padding:8px 11px; background:var(--surface-soft); border:1px dashed var(--line-strong); color:var(--primary); min-height:48px; border-radius:9px; font-size:.82rem; font-weight:690; cursor:pointer; }
.photos { display:grid; grid-template-columns:repeat(auto-fit,minmax(74px,88px)); gap:7px; }
.photo { position:relative; }
.photo-view { border:0; padding:0; border-radius:8px; background:transparent; cursor:zoom-in; }
.photo img { display:block; width:100%; aspect-ratio:1; object-fit:cover; border-radius:8px; }
.photos:not(:empty) { margin-bottom:8px; }
.photo-remove { position:absolute; inset:0 0 auto auto; z-index:1; display:grid; place-items:center; width:44px; height:44px; color:#fff; background:#14241ee0; border:0; border-radius:8px; }
.photo-dialog { width:max-content; max-width:calc(100% - 26px); padding:10px; text-align:center; }
.photo-dialog img { display:block; max-width:100%; max-height:70dvh; object-fit:contain; margin-bottom:8px; border-radius:10px; }
.rating { grid-column:1/-1; }
.rating-options { display:flex; gap:5px; flex-wrap:wrap; }
.rating-options label { position:relative; min-width:44px; min-height:44px; }
.rating-options input { position:absolute; opacity:0; margin:0; width:100%; height:100%; cursor:pointer; }
.rating-options span { display:grid; place-items:center; min-width:44px; min-height:44px; border:1px solid var(--line); border-radius:8px; }
.rating-options input:checked+span { background:var(--primary-soft); border-color:var(--accent); color:var(--primary); }
.rating-options input:focus-visible+span { outline:2px solid var(--accent); outline-offset:1px; }
.set-card { border:1px solid var(--line); border-radius:12px; padding:9px 10px; margin:8px 0; }
.set-head { display:flex; align-items:center; justify-content:space-between; color:var(--text); }
.set-done { display:flex; align-items:center; gap:8px; color:var(--primary); background:var(--primary-soft); border-radius:8px; padding:0 8px; min-height:44px; font-weight:650; cursor:pointer; }
.set-done input { width:19px; height:19px; }
.reorder-line { display:grid; grid-template-columns:1fr auto auto; align-items:center; border-bottom:1px solid var(--line); gap:2px; padding:4px 0; }
#toast { position:fixed; z-index:20; left:50%; bottom:20px; transform:translateX(-50%); max-width:calc(100vw - 24px); border-radius:12px; background:#193c2d; color:#fff; padding:8px 13px; opacity:0; pointer-events:none; transition:opacity .15s; font-size:.85rem; }
#toast.visible { opacity:1; }
@media (max-width:1150px) { :root { --sidebar:190px; --side-gap:24px; } }
@media (max-width:830px) {
  :root { --side-gap:17px; }
  .sidebar,.workspace-name { display:none; }
  .shell { margin-left:0; }
  .topbar { padding-top:env(safe-area-inset-top); }
  .topbar-inner { min-height:56px; }
  .mobile-brand { display:flex; font-size:.93rem; gap:9px; }
  .mobile-brand .brand-mark { width:31px; height:31px; border-radius:9px; }
  .content { padding-top:17px; padding-bottom:calc(83px + env(safe-area-inset-bottom)); }
  .bottom-nav { position:fixed; z-index:5; inset:auto 0 0; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); border-top:1px solid var(--line); background:var(--surface); padding:4px max(8px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .bottom-nav a { min-height:49px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; text-decoration:none; color:var(--muted); font-size:.70rem; font-weight:620; border-radius:10px; }
  .bottom-nav a[aria-current] { color:var(--primary); background:var(--primary-soft); font-weight:800; }
  #toast { bottom:calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width:600px) {
  .page-heading { align-items:flex-start; flex-wrap:wrap; margin-bottom:14px; gap:7px; }
  .page-heading .date-nav { align-self:flex-end; }
  .page-heading h1 { font-size:1.60rem; }
  .date-nav .icon-button { min-width:44px; }
  .hero { border-radius:17px; min-height:197px; padding:17px; background-size:cover,auto 100%; background-position:center,right center;
    background-image:linear-gradient(90deg,#143b2d 0%,#143b2df0 28%,#153c2eac 67%,#153c2e65 100%),url('../assets/morning-run.webp'); }
  .hero p { max-width:32ch; margin-bottom:12px; font-size:.8rem; }
  .hero h2 { font-size:1.40rem; }
  .summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .summary-card { padding:10px 11px; }
  .dashboard-grid,.settings-grid { grid-template-columns:minmax(0,1fr); gap:12px; }
  .panel { padding:14px; }
  .dialog-head { padding-left:14px; }
  .dialog-body { padding:12px 14px 15px; }
}
@media (max-width:360px) {
  :root { --side-gap:12px; }
  .heading-sub { max-width:32ch; }
  .field-grid { grid-template-columns:1fr; gap:2px; }
  .dialog-actions { justify-content:stretch; }
  .dialog-actions>* { flex:1; }
}
@media (max-width:310px) {
  .quick-grid,.modal-quick { grid-template-columns:1fr; }
  .summary-grid { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; transition-duration:0s!important; }
}
.history-actions { display:flex; gap:8px; flex-wrap:wrap; }
.template-list .reorder-line { grid-template-columns:minmax(0,1fr) auto; }
.ai-details .field { margin-top:9px; }
.ai-details #prompt-preview { width:100%; margin-top:8px; }
.habits-panel { margin-top:17px; }
.habits-panel .quick-item { min-width:0; }
.metric-picker { max-width:290px; margin-top:10px; }
@media (max-width:360px) {
  .chart-labels span:nth-child(even):not(:last-child) { display:none; }
}

.photo-view-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:7px; }

/* Audit adjustments for the controls used during daily recording. */
:root { --control-line:#7c9084; }
:root[data-theme=dark] { --control-line:#849b8c; }
@media (prefers-color-scheme:dark) { :root:not([data-theme=light]) { --control-line:#849b8c; } }
.field :is(input:not([type=radio]),select,textarea), .file-button, .rating-options span {
  border-color:var(--control-line);
}
.hero { min-height:175px; }
.hero h2 { margin-bottom:12px; }
.actions-panel>.button { margin-bottom:10px; }
.analysis-tools { margin-bottom:12px; }
.last-workout { margin:0 0 8px; }
.set-card .workout-fields>.field:first-child { grid-column:1/-1; }
.field-stepper { display:grid; grid-template-columns:auto minmax(3.4rem,1fr) auto; align-items:center; gap:2px; }
.field-stepper .icon-button { border:1px solid var(--control-line); color:var(--primary); font-size:1.2rem; }
.field-stepper input { text-align:center; padding-inline:4px !important; appearance:textfield; }
.field-stepper input::-webkit-inner-spin-button { appearance:none; }
[data-form=record] .dialog-actions {
  position:sticky; bottom:0; z-index:1; background:var(--surface); padding-bottom:7px;
}
[data-form=record] .dialog-actions .primary { flex:1; min-width:min(9rem,100%); }
.meal-ai-next { flex:1; }
.share-options { padding:6px 10px; border:1px solid var(--line); border-radius:9px; margin:8px 0; }
.share-options legend { font-size:.85rem; font-weight:700; }
.import-preview { padding-left:1.3rem; font-size:.86rem; }
.ai-details { scroll-margin-top:64px; }
.dialog-error, .close-warning, .inline-confirm, .copy-warning { scroll-margin-top:65px; scroll-margin-bottom:78px; }
@media (max-width:600px) {
  .hero { min-height:137px; }
  .hero .button { min-height:46px; }
  .hero h2 { margin-bottom:9px; }
  .summary-sub { font-size:.76rem; }
  .workout-fields { grid-template-columns:minmax(0,1fr); }
  .field-stepper { grid-template-columns:48px minmax(0,1fr) 48px; }
  .field-stepper .icon-button { width:48px; }
  #modal:has([data-form=record]) {
    margin:auto auto 0; width:100%; max-width:none;
    max-height:calc(92dvh - env(safe-area-inset-top));
    border-radius:22px 22px 0 0;
    scroll-padding-block:66px 76px;
  }
  #modal:has([data-form=record]) .dialog-body { padding-bottom:max(12px,env(safe-area-inset-bottom)); }
  [data-form=record] .dialog-actions { bottom:0; }
}
@media (max-height:420px) {
  [data-form=record] .dialog-actions { position:static; }
}
.settings-grid .field-grid {
  grid-template-columns:repeat(auto-fit,minmax(min(100%,9.6rem),1fr));
}
