/* HomeTable design tokens — from design-system/hometable/MASTER.md (UI UX Pro Max), adjusted for contrast.
   Every text/background pair below is measured by tools/contrast.py (all ≥ 4.5:1; UI borders ≥ 3:1).
   #059669 (white text 3.77:1) is NOT used behind text; solid buttons use #047857 (5.48:1). */
:root {
  --c-bg: #F6FAF7;
  --c-surface: #FFFFFF;
  --c-text: #14211B;
  --c-muted: #4A5A52;
  --c-border: #DCE9E1;          /* decorative dividers only */
  --c-input-border: #6B7C73;    /* 4.42:1 on white (UI component ≥ 3:1) */
  --c-primary: #047857;
  --c-primary-hover: #065F46;
  --c-on-primary: #FFFFFF;
  --c-primary-soft: #D1FAE5;
  --c-on-primary-soft: #065F46;
  --c-warm-soft: #FFEDD5;
  --c-on-warm-soft: #7C2D12;
  --c-warn-soft: #FEF3C7;
  --c-on-warn-soft: #92400E;
  --c-danger: #B91C1C;
  --c-danger-soft: #FEE2E2;
  --c-on-danger-soft: #991B1B;
  --c-info-soft: #DBEAFE;
  --c-on-info-soft: #1E3A8A;
  --c-amber: #D97706;           /* decorative accents only (never text) */
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  --t-fast: 150ms; --t-med: 260ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--c-text); background: var(--c-bg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-3); }
h1 { font-size: 1.45rem; letter-spacing: .01em; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--space-3); }
a { color: var(--c-primary); text-underline-offset: 3px; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--c-surface); padding: var(--space-2) var(--space-3); border-radius: var(--radius-s); z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--c-muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-3); }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 var(--space-4);
  border-radius: 999px; border: 1.5px solid var(--c-primary); background: var(--c-surface); color: var(--c-primary);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); }
.btn:hover { background: var(--c-primary-soft); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn.primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn.danger { border-color: var(--c-danger); color: var(--c-danger); }
.btn.danger.solid { background: var(--c-danger); color: #fff; }
.btn.ghost { border-color: transparent; }
.btn.small { min-height: 36px; padding: 0 var(--space-3); font-size: .9rem; }
.btn.icon { width: 44px; padding: 0; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4);
  background: var(--c-bg); border-bottom: 1px solid var(--c-border); min-height: 56px; }   /* solid: blur is costly on phone WebViews */
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: 1.1rem; color: var(--c-text); text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.topbar .btn, .brand { white-space: nowrap; }
.top-link svg { width: 22px; height: 22px; }
@media (max-width: 520px) { .top-link .tl-text { display: none; } .top-link { width: 44px; padding: 0; } .topbar { gap: var(--space-1); } }
.beta { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
main { max-width: 980px; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(var(--nav-h) + var(--space-6)); }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(7, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--c-surface); border-top: 1px solid var(--c-border); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--c-muted);
  text-decoration: none; font-size: .78rem; font-weight: 600; min-height: 44px; }
.nav a svg { width: 40px; height: 28px; padding: 3px 9px; border-radius: 999px; transition: background var(--t-fast) var(--ease); }
.nav a[aria-current="page"] { color: var(--c-on-primary-soft); font-weight: 700; }
.nav a[aria-current="page"] svg { background: var(--c-primary-soft); }
@media (min-width: 860px) {
  .nav { position: sticky; top: 56px; bottom: auto; height: 52px; max-width: 980px; margin: 0 auto; border: 0; background: transparent;
    grid-template-columns: repeat(7, max-content); gap: 2px; padding: 0 var(--space-4); }
  .nav a { flex-direction: row; font-size: .92rem; padding: 0 var(--space-3); border-radius: 999px; }
  .nav a[aria-current="page"] { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
  main { padding-bottom: var(--space-7); }
}

/* ---------- cards & chips ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--space-4); }
.card + .card { margin-top: var(--space-3); }
.grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.menu-card { text-decoration: none; display: flex; gap: var(--space-3); padding: var(--space-3); align-items: flex-start; text-align: left; width: 100%; cursor: pointer; font: inherit; color: inherit;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast); }
.menu-card:hover { border-color: var(--c-primary); transform: translateY(-2px); }
.menu-card .art { width: 52px; height: 52px; flex: none; border-radius: var(--radius); background: var(--c-warm-soft); padding: 6px; }
.menu-card h3 { margin: 0 0 4px; }
.menu-card.unfit { opacity: .78; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.chip.warm { background: var(--c-warm-soft); color: var(--c-on-warm-soft); }
.chip.warn { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.chip.bad { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.chip.info { background: var(--c-info-soft); color: var(--c-on-info-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.filter-chips button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--c-input-border); background: var(--c-surface);
  font: inherit; font-size: .9rem; color: var(--c-text); cursor: pointer; }
.filter-chips button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }

.notice { border-radius: var(--radius); padding: var(--space-3) var(--space-4); display: flex; gap: var(--space-3); align-items: flex-start; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice.info { background: var(--c-info-soft); color: var(--c-on-info-soft); }
.notice.warn { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.notice.bad { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.notice.ok { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.notice p:last-child { margin: 0; }

/* ---------- forms ---------- */
label, .label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { font-size: .85rem; color: var(--c-muted); margin-top: 2px; }
input[type=text], input[type=number], input[type=date], input[type=search], input[type=email], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--c-input-border); border-radius: var(--radius-s);
  font: inherit; color: var(--c-text); background: var(--c-surface); }
textarea { min-height: 96px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--c-danger); border-width: 2px; }
.field { margin-bottom: var(--space-4); }
.field-error { color: var(--c-danger); font-size: .875rem; font-weight: 600; margin-top: 4px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: 0 0 var(--space-4); }
.checks legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.checks label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1.5px solid var(--c-input-border);
  border-radius: 999px; font-weight: 500; cursor: pointer; margin: 0; }
.checks input { width: 18px; height: 18px; accent-color: var(--c-primary); }
.checks label:has(input:checked) { background: var(--c-primary-soft); border-color: var(--c-primary); }
.error-summary { border: 2px solid var(--c-danger); background: var(--c-danger-soft); color: var(--c-on-danger-soft); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.error-summary h3 { margin-bottom: 6px; }
.error-summary a { color: var(--c-on-danger-soft); }

/* ---------- week plan ---------- */
.day { margin-bottom: var(--space-4); }
.day-head { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-2); }
.slot { display: grid; grid-template-columns: 56px 1fr; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius); background: var(--c-surface);
  border: 1px solid var(--c-border); margin-bottom: var(--space-2); }
#view.enter { animation: fade 160ms ease-out; }   /* one fade per page, not one animation per card */
@keyframes fade { from { opacity: .35; } }
.slot.flash { animation: flash .9s var(--ease); }
@keyframes flash { from { background: var(--c-primary-soft); } }
.slot .slot-name { font-size: .8rem; font-weight: 700; color: var(--c-muted); padding-top: 3px; }
.slot.locked { border-color: var(--c-primary); box-shadow: inset 4px 0 0 var(--c-primary); }
.slot.invalid { border-color: var(--c-danger); background: #FFF7F7; }
.slot.skip, .slot.leftover { background: #FBFDFC; }
.slot .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
.slot .title { font-weight: 700; }
.reasons { margin: 4px 0 0; padding-left: 18px; font-size: .85rem; color: var(--c-muted); }
.proposals { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.proposal h3 { display: flex; align-items: center; gap: 8px; }
.mini-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: .85rem; margin: var(--space-2) 0; }
.skip-grid { display: grid; grid-template-columns: 64px repeat(3, 1fr); gap: 6px; font-size: .85rem; }
.skip-grid button { min-height: 40px; border-radius: var(--radius-s); border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; cursor: pointer; }
.skip-grid button[aria-pressed="true"] { background: var(--c-warn-soft); color: var(--c-on-warn-soft); border-color: var(--c-on-warn-soft); font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.bar { height: 8px; border-radius: 4px; background: var(--c-border); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c-primary); }

/* ---------- shopping ---------- */
ul.plain { list-style: none; margin: 0; padding: 0; }
.shop-item { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--space-2); align-items: start; padding: var(--space-3) 0; border-bottom: 1px solid var(--c-border); }
.shop-item input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--c-primary); }
.shop-item.done .name { text-decoration: line-through; color: var(--c-muted); }
.qty { font-weight: 800; white-space: nowrap; }

/* ---------- dialog / toast ---------- */
dialog { border: 0; border-radius: var(--radius-l); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); color: var(--c-text); }
dialog::backdrop { background: rgba(20, 33, 27, .45); }
dialog .dlg-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; background: var(--c-surface); z-index: 1; }
dialog .dlg-head h2 { margin: 0; flex: 1; }
dialog .dlg-body { padding: var(--space-4); }
dialog[open] { animation: pop var(--t-med) var(--ease); }
@media (max-width: 600px) { dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--radius-l) var(--radius-l) 0 0; } }
.toasts { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); transform: translateX(-50%); z-index: 60; display: flex; justify-content: center;
  width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 4px; max-width: 100%; background: var(--c-text); color: #fff; padding: 6px 6px 6px 16px; min-height: 44px;
  font-size: .9rem; border-radius: 999px; box-shadow: 0 6px 20px rgba(20, 33, 27, .22); animation: rise 200ms var(--ease); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 160ms, transform 160ms; }
.toast-msg { padding-right: 10px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast-act { flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: #2A3B33; color: #A7F3D0; font: inherit; font-weight: 700; cursor: pointer; }
.loading { padding: var(--space-6) 0; text-align: center; color: var(--c-muted); }
.skeleton { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, #EAF2ED, #F6FAF7, #EAF2ED); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.empty-art { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-5) var(--space-3); }
.empty-art img { width: 96px; height: 96px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
:root[lang="en"] .tt-name { word-break: normal; overflow-wrap: break-word; hyphens: auto; }
.keybox { font-family: ui-monospace, Menlo, monospace; word-break: break-all; background: var(--c-warn-soft); color: var(--c-on-warn-soft); padding: var(--space-3); border-radius: var(--radius-s); }

/* ---------- intro page comic ---------- */
.hero { display: grid; gap: var(--space-5); align-items: center; padding: var(--space-5) 0; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.hero .lead { font-size: 1.1rem; color: var(--c-muted); }
.comic { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.panel { position: relative; background: var(--c-surface); border: 3px solid var(--c-text); border-radius: var(--radius); padding: 28px var(--space-3) var(--space-3); min-height: 210px;
  display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; animation: panel-in .5s var(--ease) both; }
.panel:nth-child(2) { animation-delay: .25s; } .panel:nth-child(3) { animation-delay: .5s; } .panel:nth-child(4) { animation-delay: .75s; }
.panel .no { position: absolute; top: 8px; left: 10px; font-weight: 900; font-size: .8rem; color: var(--c-muted); }
.panel .cast { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.panel .cast img { width: 56px; height: 56px; min-width: 0; }
.panel .cast img.big { width: 72px; height: 72px; }
@media (max-width: 420px) { .panel .cast img { width: 44px; height: 44px; } .panel .cast img.big { width: 60px; height: 60px; } .bubble { font-size: .85rem; } }
.panel .cast img.float { animation: bob 2.6s ease-in-out infinite; }
.bubble { position: relative; background: #FFFDF5; border: 2px solid var(--c-text); border-radius: 16px; padding: 8px 10px; font-size: .9rem; font-weight: 600; margin-bottom: var(--space-2); }
.bubble::after { content: ""; position: absolute; bottom: -10px; left: 28px; border: 8px solid transparent; border-top-color: var(--c-text); border-bottom: 0; }
.panel.p1 { background: #FFF7ED; } .panel.p2 { background: #FEFCE8; } .panel.p3 { background: #ECFDF5; } .panel.p4 { background: #F0F9FF; }
@keyframes panel-in { from { opacity: 0; transform: translateY(14px) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
.features { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature img { width: 44px; height: 44px; }
footer.site { max-width: 980px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); font-size: .85rem; color: var(--c-muted); }
@media (min-width: 860px) { .hero { grid-template-columns: 1fr 1.1fr; } }

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

/* ---------- 2026-11-07 usage-log fixes (docs/USAGE_LOG.md) ---------- */
#view > .notice, #view > .grid + .notice { margin-bottom: var(--space-4); }
.check-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; cursor: pointer; }
.check-row input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--c-primary); }
.filter-row { display: grid; grid-template-columns: 4.5em 1fr; align-items: center; gap: var(--space-2); }
.filter-label { font-size: .8rem; font-weight: 700; color: var(--c-muted); }
.ing-table td:nth-child(2), .ing-table td:nth-child(3), .ing-table th { white-space: nowrap; }
.skip-grid > span { align-self: center; }
.slot details.more { display: contents; }
.slot details.more > summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; }
.slot details.more > summary::-webkit-details-marker { display: none; }
.slot details.more > summary::after { content: "▾"; margin-left: 4px; }
.slot details.more[open] > summary::after { content: "▴"; }
.slot details.more > .actions { flex-basis: 100%; margin-top: 0; }
.notice .btn { margin-top: var(--space-2); }
.sug-table td:first-child { width: 36px; } .sug-table input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--c-primary); }

/* stock category tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; border-bottom: 1px solid var(--c-border); }
.tabs [role=tab] { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; font-size: .9rem; color: var(--c-text); cursor: pointer; }
.tabs [role=tab][aria-selected="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); font-weight: 700; }
.tab-count { min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center;
  background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.tabs [aria-selected="true"] .tab-count { background: var(--c-surface); color: var(--c-primary); }
.stock-row input[type=number] { width: 7em; flex: none; }
#inv-panel ul { list-style: none; padding: 0; margin: 0; }
.stock-row { flex-wrap: nowrap; gap: 6px; }
.stock-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-row input[type=number] { width: 5.5em; min-height: 40px; }
.map-list { list-style: none; padding: 0; margin: 0; }
.map-row { display: flex; gap: var(--space-3); align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--c-border); }
.map-row .grow { min-width: 0; }
.map-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
details.card > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; min-height: 44px; }

/* ---------- week timetable (課表) + bottom sheet ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: var(--space-2) 0 var(--space-3); }
.quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; padding: 6px 4px;
  border-radius: var(--radius); border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-size: .8rem;
  font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.quick-btn svg { width: 22px; height: 22px; color: var(--c-primary); }
.quick-btn:disabled { opacity: .5; cursor: not-allowed; }
.quick-btn:active:not(:disabled) { transform: scale(.97); }
.tt { display: grid; gap: 6px; }
.tt-row { display: grid; grid-template-columns: 42px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.tt-row > span { display: block; min-width: 0; }
.tt-head > span { font-size: .8rem; font-weight: 700; color: var(--c-muted); text-align: center; }
.tt-day { display: flex !important; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius-s); line-height: 1.15; }
.tt-day b { font-size: .85rem; } .tt-day small { font-size: .75rem; color: var(--c-muted); }
.tt-row.today .tt-day { background: var(--c-primary); color: var(--c-on-primary); }
.tt-row.today .tt-day small { color: var(--c-on-primary); }
.tt-cell { position: relative; width: 100%; height: 100%; min-height: 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  padding: 8px; border-radius: var(--radius-s); border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
  font: inherit; text-align: left; cursor: pointer; transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.tt-cell:active { transform: scale(.98); }
.tt-cell:hover { border-color: var(--c-primary); }
.tt-name { font-size: .85rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.tt-badges { display: flex; gap: 4px; align-items: center; min-height: 16px; }
.tt-badges svg { width: 14px; height: 14px; color: var(--c-primary); }
.tt-tag { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px; font-size: .7rem; font-weight: 700;
  background: var(--c-warm-soft); color: var(--c-on-warm-soft); }
.tt-tag.out { background: var(--c-border); color: var(--c-text); }
.tt-cell.leftover { background: var(--c-warm-soft); border-style: dashed; }
.tt-cell.skip { background: transparent; color: var(--c-muted); border-style: dashed; }
.tt-cell.empty { background: transparent; color: var(--c-muted); border-style: dashed; }
.tt-cell.locked { border: 2px solid var(--c-primary); }
.tt-cell.invalid { border: 2px solid var(--c-danger); background: var(--c-danger-soft); }
.tt-warn { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--c-danger); color: #fff; font-size: .7rem; font-weight: 800; }
.tt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: var(--space-2); }
.tt-legend svg { width: 14px; height: 14px; color: var(--c-primary); }
.sheet-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 2px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet-act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px;
  border-radius: var(--radius); border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-size: .85rem;
  font-weight: 600; text-decoration: none; cursor: pointer; }
.sheet-act svg { width: 22px; height: 22px; color: var(--c-primary); }
.sheet-act[aria-pressed="true"] { background: var(--c-primary-soft); border-color: var(--c-primary); }
@media (max-width: 600px) { dialog { padding-bottom: env(safe-area-inset-bottom); } dialog .dlg-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--c-border); } }
@media (min-width: 900px) { .tt-row { grid-template-columns: 64px repeat(3, minmax(0, 1fr)); } .tt-cell { min-height: 76px; } }

/* ---------- compact shopping checklist ---------- */
.shop-top { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-2) 0; }
.shop-progress { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
.shop-progress .bar { display: block; height: 6px; border-radius: 3px; background: var(--c-border); overflow: hidden; }
.shop-progress .bar > span { display: block; height: 100%; background: var(--c-primary); transition: width var(--t-med) var(--ease); }
.shop-add { display: flex; gap: 8px; margin-bottom: var(--space-3); }
.shop-add input { flex: 1; }
.shop-group { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: var(--space-3); overflow: hidden; }
.shop-group h2 { font-size: .85rem; margin: 0; padding: 8px 12px; background: var(--c-bg, #F5FAF7); border-bottom: 1px solid var(--c-border); color: var(--c-muted); }
.shop-group ul { list-style: none; margin: 0; padding: 0; }
.shop-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 44px; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; min-height: 52px; border-bottom: 1px solid var(--c-border); }
.shop-row:last-child { border-bottom: 0; }
.shop-row input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--c-primary); }
.shop-main { display: flex; flex-direction: column; min-width: 0; margin: 0; font-weight: 500; cursor: pointer; padding: 6px 0; }
.shop-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-sub { font-size: .75rem; color: var(--c-muted); font-weight: 500; }
.shop-note { font-size: .8rem; color: var(--c-on-warm-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-qty { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.2; }
.shop-qty strong { font-size: .95rem; }
.shop-row.done .shop-name, .shop-row.done .shop-qty strong { text-decoration: line-through; color: var(--c-muted); }
.icon-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--c-primary); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--c-primary-soft); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-warn, #B45309); }

/* ---------- stock: photos + location ---------- */
.inv-add .btn input[type=file] { display: none; }
.cam-preview img, .stock-thumb { width: 44px; height: 44px; border-radius: var(--radius-s); object-fit: cover; flex: none; }
.stock-item { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 4px; min-height: 56px;
  border: 0; border-bottom: 1px solid var(--c-border); background: transparent; font: inherit; color: var(--c-text); text-align: left; cursor: pointer; }
.stock-item:hover { background: var(--c-primary-soft); }
.stock-main { display: flex; flex-direction: column; min-width: 0; }
.stock-main .shop-sub { display: inline-flex; align-items: center; gap: 2px; }
.stock-main .shop-sub svg { width: 12px; height: 12px; }
.ph-missing { display: grid; place-items: center; gap: 4px; background: var(--c-border); color: var(--c-muted); }
.ph-missing svg { width: 18px; height: 18px; }
.stock-photo { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--c-border); display: grid; place-items: center; }
.stock-photo img { width: 100%; height: 100%; object-fit: cover; }
.stock-photo .ph-missing { width: 100%; height: 100%; font-size: .9rem; }
label.btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
label.btn input[type=file] { display: none; }

/* ---------- 2026-11-07 round 3: smoother, cleaner (see docs/USAGE_LOG.md 第三輪) ---------- */
/* page loading: the old page stays; a thin bar shows work in progress */
body.busy::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 40%; z-index: 90; background: var(--c-primary);
  animation: busybar 900ms var(--ease) infinite; }
@keyframes busybar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.page-head h1 { margin: 0; }
.grid { gap: 10px; }
.card + .card { margin-top: 10px; }
.btn:active, .tt-cell:active, .member-card:active, .stock-item:active, .next-meal:active, .quick-btn:active { transform: scale(.98); }
.fields-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.fields-3 label { font-size: .85rem; }

/* family */
.member-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: 10px; }
.member-card { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) 20px; gap: var(--space-3); align-items: center; padding: var(--space-3);
  border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast); }
.member-card:hover { border-color: var(--c-primary); }
.member-card > svg, .link-card > svg:last-child, .next-meal > svg { width: 20px; height: 20px; color: var(--c-muted); }
.member-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.member-name { font-weight: 700; font-size: 1.05rem; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }
.tone-a { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.tone-b { background: var(--c-warm-soft); color: var(--c-on-warm-soft); }
.tone-c { background: var(--c-info-soft); color: var(--c-on-info-soft); }
.tone-d { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
details.fine-print > summary { align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; color: var(--c-muted); }
details.fine-print > summary svg { width: 18px; height: 18px; }
details.fine-print[open] > summary { margin-bottom: var(--space-2); }
.link-card { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 52px;
  border-radius: var(--radius); background: var(--c-surface); border: 1px dashed var(--c-input-border); color: var(--c-text); text-decoration: none; font-weight: 600; }
.link-card > svg:first-child { width: 22px; height: 22px; color: var(--c-primary); }

/* stock */
.stock-tools { position: sticky; top: 56px; z-index: 5; background: var(--c-bg); padding: 4px 0 2px; margin-bottom: var(--space-2); display: grid; gap: 8px; }
.stock-tools .tabs { border-bottom: 0; }
.stock-list { list-style: none; margin: 0; padding: 0 var(--space-3); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.stock-list li:last-child .stock-item { border-bottom: 0; }
.stock-g { font-variant-numeric: tabular-nums; }
.picker { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: 216px; overflow-y: auto; margin-top: 8px; padding: 2px;
  overscroll-behavior: contain; }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-height: 48px; padding: 6px 10px; border-radius: var(--radius-s);
  border: 1.5px solid var(--c-border); background: var(--c-surface); color: var(--c-text); font: inherit; text-align: left; cursor: pointer; line-height: 1.3; }
.pick > span:first-child { font-weight: 600; }
.pick[aria-selected="true"] { border-color: var(--c-primary); background: var(--c-primary-soft); }
.picker > p { grid-column: 1 / -1; margin: 6px 2px; }
#pk-chosen { margin: 6px 0 0; }
.loc-chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 2px; scrollbar-width: none; }
.mini-chip { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--c-input-border); background: var(--c-surface);
  color: var(--c-text); font: inherit; font-size: .85rem; cursor: pointer; }
.mini-chip:active { background: var(--c-primary-soft); }

/* week: next meal */
.next-meal { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) 20px; gap: var(--space-3); align-items: center; padding: var(--space-3);
  margin-bottom: var(--space-2); border-radius: var(--radius); border: 1px solid var(--c-primary); background: var(--c-primary-soft); color: var(--c-text);
  font: inherit; text-align: left; cursor: pointer; }
.next-meal img { width: 48px; height: 48px; border-radius: var(--radius-s); background: var(--c-surface); padding: 4px; }
.next-meal.invalid { border-color: var(--c-danger); background: var(--c-danger-soft); }
.nm-main { display: flex; flex-direction: column; min-width: 0; }
.nm-when { font-size: .8rem; font-weight: 700; color: var(--c-on-primary-soft); }
.nm-name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-meal.invalid .nm-when { color: var(--c-on-danger-soft); }
.quick { margin-top: 0; }

@media (prefers-reduced-motion: reduce) { body.busy::before { animation: none; width: 100%; opacity: .5; } }

/* ---------- accounts: sign-in, families, sharing ---------- */
.login { max-width: 440px; margin: 0 auto; }
.login-hero { text-align: center; padding: var(--space-4) 0 var(--space-3); }
.login-hero img { width: 72px; height: 72px; }
.login-hero h1 { margin: var(--space-2) 0 6px; }
.login-alt { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: var(--space-4); }
.login-legal { text-align: center; margin-top: var(--space-4); }
.btn.sso { width: 100%; min-height: 48px; gap: 10px; font-weight: 600; }
.btn.sso svg { width: 20px; height: 20px; }
.sso-apple { background: #000; border-color: #000; color: #fff; }
.sso-apple:hover { background: #1F1F1F; }
.sso-google { background: #fff; border-color: #747775; color: #1F1F1F; }
.sso-google:hover { background: #F2F2F2; }
.or { display: flex; align-items: center; gap: var(--space-3); color: var(--c-muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--c-border); }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; }
.dev-code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .15em; }
.invite-code { font-family: ui-monospace, Menlo, monospace; font-size: 1.7rem; font-weight: 800; letter-spacing: .12em; text-align: center; padding: var(--space-4);
  border-radius: var(--radius); background: var(--c-primary-soft); color: var(--c-on-primary-soft); user-select: all; }
.trial-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; padding: 8px var(--space-4); font-size: .85rem;
  background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.trial-bar a { color: var(--c-on-warn-soft); font-weight: 700; }
.trial-card { border-color: var(--c-on-warn-soft); background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: 6px 0; border-bottom: 1px solid var(--c-border); flex-wrap: nowrap; }
.people li:last-child { border-bottom: 0; }
.avatar.small { width: 36px; height: 36px; font-size: 1rem; flex: none; }

/* ---------- explore: 菜單庫 | 社群分享 ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: var(--space-3); border-radius: 999px; background: var(--c-surface); border: 1px solid var(--c-border); }
.lang-switch { max-width: 260px; margin: var(--space-3) auto 0; }
button.seg-tab { border: 0; background: none; font: inherit; cursor: pointer; }
.seg-tab { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 999px; font-weight: 600; color: var(--c-muted); text-decoration: none; }
.seg-tab[aria-selected="true"], .seg-tab[aria-pressed="true"] { background: var(--c-primary); color: var(--c-on-primary); font-weight: 700; }
@media (max-width: 400px) { .nav a { font-size: .72rem; } .nav a svg { width: 36px; padding: 3px 7px; } }

/* ---------- 健身紀錄 ---------- */
.fit-bar { display: flex; align-items: center; gap: var(--space-2); justify-content: space-between; }
.fit-date { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; flex: 1; }
.who { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.who button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; font-weight: 600; color: var(--c-text); cursor: pointer; }
.who button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.energy { display: grid; grid-template-columns: 112px 1fr; gap: var(--space-4); align-items: center; }
.ring { width: 112px; height: 112px; }
.ring .track { stroke: var(--c-border); }
.ring .val { stroke: var(--c-primary); transition: stroke-dasharray var(--t-med) var(--ease); }
.ring .val.over { stroke: var(--c-danger); }
.ring text { fill: var(--c-text); font-weight: 800; font-family: var(--font); }
.ring .sub { fill: var(--c-muted); font-weight: 600; }
.big-num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); font-size: .9rem; }
.kv dt { color: var(--c-muted); } .kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.macro { padding: var(--space-2) var(--space-3); border-radius: var(--radius-s); background: var(--c-bg); }
.macro b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.macro .meter { display: block; width: 100%; height: 6px; margin-top: 4px; }
.meter .m-track { fill: var(--c-border); } .meter .m-val { fill: var(--c-primary); } .meter .m-val.over { fill: var(--c-amber); }
.meal { padding: 0; overflow: hidden; }
.meal-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--c-border); }
.meal-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.meal-head .meal-kcal { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c-muted); }
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 52px; padding: var(--space-2) var(--space-4); border: 0; border-bottom: 1px solid var(--c-border);
  background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.entries li:last-child .entry { border-bottom: 0; }
.entry:hover { background: var(--c-bg); }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-kcal { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meal-empty { padding: var(--space-3) var(--space-4); margin: 0; }
.planned { display: flex; flex-direction: column; gap: 6px; }
.planned .row { flex-wrap: nowrap; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--c-border); stroke-width: 1; }
.chart .axis { fill: var(--c-muted); font-size: 11px; font-family: var(--font); }
.chart .w-dot { fill: var(--c-surface); stroke: var(--c-muted); stroke-width: 1.5; }
.chart .w-avg { fill: none; stroke: var(--c-primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .w-target { stroke: var(--c-amber); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .kbar { fill: var(--c-primary); } .chart .kbar.over { fill: var(--c-amber); } .chart .kbar.partial { fill: var(--c-primary-soft); stroke: var(--c-primary); stroke-width: 1; }
.chart .t-line { stroke: var(--c-text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--c-muted); }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; background: var(--c-primary); }
.legend i.dash { background: none; border-top: 2px dashed var(--c-amber); height: 0; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--c-muted); background: var(--c-surface); }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; border: 1px solid var(--c-border); border-radius: var(--radius-s); }
.pick-list button { display: flex; width: 100%; align-items: center; gap: var(--space-3); min-height: 52px; padding: 6px var(--space-3); border: 0; border-bottom: 1px solid var(--c-border);
  background: var(--c-surface); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pick-list li:last-child button { border-bottom: 0; }
.pick-list button[aria-pressed="true"] { background: var(--c-primary-soft); }
.amount-row { display: flex; gap: var(--space-2); align-items: flex-end; flex-wrap: wrap; padding: var(--space-3); border-radius: var(--radius-s); background: var(--c-bg); }
.amount-row .field { margin: 0; flex: 1 1 120px; }
.steps-pill { display: flex; gap: 6px; flex-wrap: wrap; }
.steps-pill button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; cursor: pointer; }

/* ---------- 社群分享 ---------- */
.post-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.post-card h3 { margin: 0; }
.post-stats { display: flex; gap: var(--space-3); font-size: .85rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.post-stats span { display: inline-flex; align-items: center; gap: 4px; }
.post-stats svg { width: 16px; height: 16px; }
.nut-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.nut-strip div { padding: 6px 2px; border-radius: var(--radius-s); background: var(--c-bg); font-size: .78rem; color: var(--c-muted); }
.nut-strip b { display: block; font-size: 1rem; color: var(--c-text); font-variant-numeric: tabular-nums; }
.btn[aria-pressed="true"] { background: var(--c-primary-soft); }
.btn[aria-pressed="true"] svg { fill: currentColor; }
.author-note { white-space: pre-wrap; }
.steps-pill button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); font-weight: 700; }
.entry > svg { width: 18px; height: 18px; flex: none; color: var(--c-muted); }
.chart .kbar.partial { fill: #6EE7B7; stroke: var(--c-primary); stroke-width: 1.5; }   /* lower bound: lighter but clearly visible */
.chips + .author-note { margin-top: var(--space-3); }

/* ---------- 個人版 / 家庭版 ---------- */
.mode-pick { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.mode-pick legend { font-weight: 700; margin-bottom: var(--space-2); }
.mode-card { display: grid; grid-template-columns: auto 48px 1fr; gap: var(--space-3); align-items: center; padding: var(--space-3); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); background: var(--c-surface); cursor: pointer; }
.mode-card img { width: 48px; height: 48px; }
.mode-card > span { display: flex; flex-direction: column; gap: 2px; }
.mode-card input { width: 20px; height: 20px; accent-color: var(--c-primary); margin: 0; }
.mode-card:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); }
.seg.three { grid-template-columns: repeat(3, 1fr); }

/* ---------- 外食 & 固定菜單 ---------- */
.level { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.level.l2 { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.level.l1 { background: var(--c-info-soft); color: var(--c-on-info-soft); }
.level.l0 { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.checks-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.checks-list li { display: flex; gap: 6px; align-items: flex-start; }
.checks-list svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.checks-list .ok svg { color: var(--c-primary); } .checks-list .no svg { color: var(--c-amber); } .checks-list .meh svg { color: var(--c-muted); }
.tips { margin: 0; padding-left: 1.2em; } .tips li + li { margin-top: 4px; }
.venue-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.venue-chips button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 999px;
  border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; font-weight: 600; cursor: pointer; }
.venue-chips button img { width: 28px; height: 28px; }
.venue-chips button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.comp-row { display: grid; grid-template-columns: 1fr 90px 44px; gap: 6px; align-items: start; padding: var(--space-2); border: 1px solid var(--c-border); border-radius: var(--radius-s); }
.comp-row .custom { grid-column: 1 / -1; }
.comp-row input, .comp-row select { min-width: 0; width: 100%; }
.day-block + .day-block { margin-top: var(--space-3); }
.day-block h3 { display: flex; justify-content: space-between; gap: var(--space-2); margin-bottom: 6px; }
.day-block h3 small { font-weight: 600; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.ritem { display: flex; align-items: center; gap: var(--space-2); padding: 6px 0; border-top: 1px solid var(--c-border); }
.ritem .grow { min-width: 0; }
.ritem .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 600; }
.ritem button svg { width: 18px; height: 18px; }
.wd-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-pick button { min-width: 44px; min-height: 40px; border-radius: 999px; border: 1.5px solid var(--c-input-border); background: var(--c-surface); font: inherit; font-weight: 600; cursor: pointer; }
.wd-pick button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.sched { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sched th, .sched td { border-top: 1px solid var(--c-border); padding: 6px 4px; text-align: left; vertical-align: top; }
.plain { border: 0; padding: 0; margin: 0; } .plain legend { font-weight: 700; margin-bottom: var(--space-2); }
.who-box { border-color: var(--c-primary); }
.hm-row { flex-wrap: nowrap; } .hm-row input[type=number] { width: 5.5em; min-height: 40px; flex: none; }

/* ---------- public legal pages ---------- */
body.legal main { max-width: 760px; padding-bottom: var(--space-7); }
body.legal li + li { margin-top: 6px; }
.next-steps ol { margin: 0; padding-left: 1.3em; } .next-steps li + li { margin-top: 6px; }
.next-steps li.done { color: var(--c-muted); text-decoration: line-through; }

/* nav labels: short on phones (7 tabs), full on wide screens; the accessible name is always the full one */
.nav .nl-full { display: none; }
@media (min-width: 860px) { .nav .nl-full { display: inline; } .nav .nl-short { display: none; } }
@media (max-width: 400px) { .nav a svg { width: 34px; padding: 3px 6px; } }

/* ---------- 2026-11-09 UI review (docs/USAGE_LOG.md「2026-11-09 UI 操作審視」) ---------- */
/* touch targets: everything you tap is at least 44 × 44 px */
.btn.small { min-height: 44px; }
.top-link { min-height: 44px; }
@media (max-width: 520px) { .top-link { height: 44px; } }
.filter-chips button, .seg-tab, .tabs [role=tab], .checks label, .skip-grid button, .who button, .steps-pill button, .wd-pick button, .mini-chip { min-height: 44px; }
.toast-act { min-height: 44px; }
.trial-bar a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
details > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--c-muted); flex: none; }
details[open] > summary::before { content: "▾"; }
details.card > summary::before, details.fine-print > summary::before { content: none; }
.btn.block { width: 100%; }
.mini-chip[aria-pressed="true"] { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-on-primary-soft); font-weight: 700; }
.skip-box > summary { justify-content: space-between; }
.skip-box > summary .label { margin: 0; }

/* the app's own confirm (askDialog): centred card on top of the sheet, never the browser's confirm() */
dialog.ask { width: min(400px, calc(100vw - 32px)); padding: var(--space-5) var(--space-4) var(--space-4); border-radius: var(--radius-l); margin: auto; }
dialog.ask h2 { font-size: 1.15rem; margin-bottom: var(--space-2); }
dialog.ask p { color: var(--c-text); }
.ask-actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--space-4); }
.ask-actions .btn { flex: 1 1 120px; }
@media (max-width: 600px) { dialog.ask { margin: auto; width: calc(100vw - 32px); max-width: 400px; border-radius: var(--radius-l); padding-bottom: var(--space-4); } }

/* iOS safe areas (viewport-fit=cover): notch / status bar on top, rounded corners and landscape sides */
.topbar { padding-top: max(var(--space-2), env(safe-area-inset-top)); padding-left: max(var(--space-4), env(safe-area-inset-left)); padding-right: max(var(--space-4), env(safe-area-inset-right));
  min-height: calc(56px + env(safe-area-inset-top)); }
main { padding-left: max(var(--space-4), env(safe-area-inset-left)); padding-right: max(var(--space-4), env(safe-area-inset-right)); }
.nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.stock-tools { top: calc(56px + env(safe-area-inset-top)); }
dialog { max-height: calc(100vh - 48px - env(safe-area-inset-top)); max-height: calc(100dvh - 24px - env(safe-area-inset-top)); }
@media (min-width: 860px) { .nav { top: calc(56px + env(safe-area-inset-top)); } }

/* ---- 冰箱過期提醒、每餐偏好 (2026-11-09) ---- */
.nav a { position: relative; }
.nav-dot { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--c-warn-soft); color: var(--c-on-warn-soft); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.nav-dot.bad { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.expiry-alert { border-left: 4px solid var(--c-on-warn-soft); }
.expiry-alert.bad { border-left-color: var(--c-on-danger-soft); }
.expiry-alert h2 { font-size: 1.05rem; margin: 0; }
.stock-item.is-expired .shop-name { text-decoration: line-through; text-decoration-thickness: 1px; }
.stock-item .shop-sub .chip { margin-left: 4px; }
.pref-slot { border: 1px solid var(--c-input-border); border-radius: 12px; padding: var(--space-3); margin: 0; }
.pref-slot legend { padding: 0 6px; }
.pref-slot .small.muted { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.pref-slot { min-width: 0; }
.pref-slot .filter-chips { flex-wrap: wrap; overflow: visible; }
.stock-tools > .btn.small { justify-self: start; align-self: flex-start; width: auto; }
.pref-slot summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pref-slot[open] summary { margin-bottom: var(--space-2); }
