/* =========================================================
   PerfectEat デザインシステム v2（2026-11 リニューアル）
   方針：白とニュートラルグレーの土台に、ブランドグリーン1色。
         色の意味を固定（P=コーラル / F=アンバー / C=ブルー / 超過=赤）。
         グラデーションと重い影はやめ、余白・文字の太さ・罫線で階層を作る。
   旧CSSのクラス名はすべて維持しています。
   ========================================================= */

/* ---------- 1. デザイントークン ---------- */
:root {
    /* ブランド */
    --teal: #0f8a7e;
    --teal-dark: #0b6b62;
    --teal-soft: #e8f5f2;
    --teal-line: #cbe7e1;

    /* 文字・面・線 */
    --ink: #17211f;
    --ink-2: #3c4845;
    --muted: #6b7774;
    --faint: #9aa5a2;
    --bg: #f5f6f4;
    --surface: #ffffff;
    --surface-2: #f8f9f8;
    --line: #e6eae8;
    --line-strong: #d6dcda;

    /* PFC（全画面で共通） */
    --c-protein: #e5604d;
    --c-fat: #e9a23b;
    --c-carbs: #3e86d6;
    --p-soft: #fdece9; --p-ink: #a83a2b;
    --f-soft: #fdf3e1; --f-ink: #8a5a0c;
    --c-soft: #e9f1fb; --c-ink: #24578f;

    /* 状態 */
    --amber: #e9a23b;
    --coral: #e5604d;
    --blue: #3e86d6;
    --danger: #d0473a;
    --danger-soft: #fdecea;
    --warn-soft: #fdf4e3;
    --warn-ink: #7d5208;

    /* 形・影・余白 */
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-1: 0 1px 2px rgba(23, 33, 31, .04), 0 1px 1px rgba(23, 33, 31, .03);
    --shadow-2: 0 6px 24px rgba(23, 33, 31, .10);
    --tap: 44px;
    --topbar-h: 56px;
    --tabbar-h: 64px;

    /* 面の追加トークン（ダークモードで切り替える） */
    --track: var(--track);
    --surface-3: var(--surface-3);
    --glass: rgba(255, 255, 255, .95);
    --on-ink: #ffffff;
    --warn-line: #f1ddb3;
    --danger-line: #f2c4be;
    --danger-ink: #8b2419;
    --scrim: var(--scrim);
}

/* ---------- 1b. ダークモード（端末の設定に合わせて自動で切り替え） ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --teal: #13a191;
        --teal-dark: #5fd3c4;
        --teal-soft: #12302c;
        --teal-line: #1e4a43;

        --ink: #e7eeec;
        --ink-2: #c3cdca;
        --muted: #98a5a1;
        --faint: #6f7c78;
        --bg: #0c1110;
        --surface: #151c1a;
        --surface-2: #1a2220;
        --line: #26302d;
        --line-strong: #35413d;

        --p-soft: #3b201c; --p-ink: #f5a598;
        --f-soft: #372b14; --f-ink: #f2c47c;
        --c-soft: #16283d; --c-ink: #9cc5f2;

        --danger: #f06d5f;
        --danger-soft: #3b1d1a;
        --warn-soft: #34290f;
        --warn-ink: #f2c47c;

        --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
        --shadow-2: 0 8px 28px rgba(0, 0, 0, .55);

        --track: #25302d;
        --surface-3: #212a28;
        --glass: rgba(21, 28, 26, .94);
        --on-ink: #0c1110;
        --warn-line: #5a4719;
        --danger-line: #6a2e28;
        --danger-ink: #f5a598;
        --scrim: rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
    img { opacity: .94; }
}

/* ---------- 2. ベース ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
a { color: var(--teal-dark); text-underline-offset: 2px; }
h1 { font-size: 1.375rem; font-weight: 800; letter-spacing: .01em; line-height: 1.35; margin: 1rem 0 .75rem; }
h2 { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; line-height: 1.4; }
h3 { font-size: .95rem; font-weight: 700; margin: .5rem 0; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.warn-text { color: var(--warn-ink); font-weight: 600; }
strong, .ring-num, .pfc-rem, .food-row-kcal, .achieve-num, .fv, .set-item-price { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
details summary { cursor: pointer; }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ---------- 3. 上部バー・レイアウト ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; justify-content: space-between; align-items: center;
    height: var(--topbar-h); padding: 0 1rem;
    background: var(--glass);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line);
}
.logo {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 800; font-size: 1.0625rem; letter-spacing: .01em;
    color: var(--ink); text-decoration: none;
}
.logo-mark {
    width: 22px; height: 22px; border-radius: 50%; display: inline-block; position: relative;
    background: conic-gradient(var(--c-protein) 0 40%, var(--c-fat) 40% 65%, var(--c-carbs) 65% 100%);
}
.logo-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.top-user {
    display: inline-flex; align-items: center; gap: .45rem;
    color: var(--muted); font-size: .8125rem; max-width: 45%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatar-circle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--teal-soft); color: var(--teal-dark);
    font-weight: 700; font-size: .8125rem;
}
.avatar-circle.lg { width: 44px; height: 44px; font-size: 1.1rem; }

.wrap {
    max-width: 640px; margin: 0 auto;
    padding: .25rem 1rem calc(var(--tabbar-h) + 2rem + env(safe-area-inset-bottom));
}

/* ---------- 4. カード ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 1rem;
    margin: .75rem 0;
    overflow-wrap: break-word;
}
.card > h2:first-child { margin-top: 0; }
.card.note { background: var(--teal-soft); border-color: var(--teal-line); box-shadow: none; }
.welcome { background: var(--surface); border-top: 4px solid var(--teal); }
.welcome h2 { font-size: 1.15rem; }

/* ---------- 5. お知らせ・アラート ---------- */
.flash {
    border-radius: var(--radius-sm); padding: .65rem .9rem; margin: .75rem 0;
    font-size: .9rem; font-weight: 500; border: 1px solid transparent;
}
.flash-ok { background: var(--teal-soft); border-color: var(--teal-line); color: var(--teal-dark); }
.flash-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.flash-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }

.alert-protein {
    background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink);
    border-radius: var(--radius); padding: .85rem 1rem; margin: .75rem 0;
    font-size: .9rem; line-height: 1.65;
}
.alert-protein a { color: inherit; font-weight: 700; }

/* ---------- 6. ボタン ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    min-height: var(--tap); padding: .5rem 1.1rem;
    border: 1px solid var(--line-strong); border-radius: 12px;
    background: var(--surface); color: var(--ink);
    font-family: inherit; font-size: .9375rem; font-weight: 700; line-height: 1.2;
    text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:hover { border-color: var(--teal); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .8125rem; border-radius: 10px; }
.btn.danger, .btn-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-line); }
.btn-danger-solid { background: var(--danger); color: #fff; border: none; }
.btn.block { display: flex; width: 100%; margin-top: .75rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: none; border: none; color: var(--faint); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- 7. フォーム ---------- */
.form label { display: block; margin: .8rem 0; font-weight: 600; font-size: .875rem; color: var(--ink-2); }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="number"], .form input[type="date"], .form input[type="search"],
.form input[type="tel"], .form input[type="url"],
.form select, .form textarea {
    display: block; width: 100%; margin-top: .35rem;
    min-height: var(--tap); padding: .6rem .75rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font-family: inherit; font-size: 1rem; font-weight: 400;
    transition: border-color .15s, box-shadow .15s;
}
.form textarea { min-height: 6rem; line-height: 1.6; }
.form input::placeholder, .form textarea::placeholder { color: var(--faint); }
.form input:hover, .form select:hover, .form textarea:hover { border-color: var(--faint); }
.form input:focus, .form select:focus, .form textarea:focus,
.inline-form input:focus, .inline-form select:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 138, 126, .15);
}
.form.compact label { margin: .45rem 0; }
.form .check { font-weight: 400; display: flex; align-items: center; gap: .5rem; }
.form .check input { width: 18px; height: 18px; accent-color: var(--teal); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2) !important; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.grid2 > *, .form label { min-width: 0; }
@media (max-width: 360px) { .grid2 { grid-template-columns: 1fr; } }

.inline-form { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; }
.inline-form input[type="date"], .inline-form select, .inline-form input.qty {
    min-height: 36px; padding: .3rem .5rem;
    border: 1px solid var(--line-strong); border-radius: 10px;
    background: var(--surface); color: var(--ink); font-size: .875rem; font-family: inherit;
}
.inline-form input.qty { width: 4.2rem; }

/* 日付入力（iOS Safariのはみ出し対策） */
.form input[type="date"], .inline-form input[type="date"] {
    -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%;
}
.form input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* セレクト */
.form select, .inline-form select {
    -webkit-appearance: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236b7774' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center; background-size: 11px 7px;
    background-color: var(--surface); padding-right: 2rem;
}
select.small-select {
    min-height: 32px; width: auto; padding: .2rem 1.6rem .2rem .55rem;
    font-size: .75rem; font-weight: 600; color: var(--ink-2);
    background-position: right .5rem center; border-radius: 8px;
}

/* ファイル選択 */
.file-pick { display: block; margin: .8rem 0; font-weight: 600; font-size: .875rem; }
.file-pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick-btn {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    margin-top: .35rem; padding: 1.1rem 1rem; min-height: 64px;
    background: var(--teal-soft); color: var(--teal-dark);
    border: 1.5px dashed var(--teal); border-radius: var(--radius);
    font-weight: 700; font-size: .9375rem; cursor: pointer;
}
.file-pick-btn::before {
    content: ""; width: 22px; height: 22px; flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l2-2.5h6L17 8h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z'/%3E%3Ccircle cx='12' cy='13.5' r='3.4'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l2-2.5h6L17 8h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z'/%3E%3Ccircle cx='12' cy='13.5' r='3.4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.file-pick-name { display: block; margin-top: .35rem; text-align: center; font-weight: 400; color: var(--muted); }
.photo-preview { margin-top: .5rem; }
.photo-preview img { max-width: 100%; max-height: 240px; border-radius: 12px; border: 1px solid var(--line); }

/* 単位つき入力 */
.field-unit { position: relative; }
.field-unit input { padding-right: 2.8rem !important; }
.field-unit .unit { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8125rem; pointer-events: none; }

/* スイッチ */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .2s; }
.switch .track::after {
    content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #fff;
    top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { left: 21px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: none; }

/* ---------- 8. タブ・チップ・セグメント ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .75rem; }
.tabs a, .tabs .tab {
    display: inline-flex; align-items: center; gap: .3rem;
    min-height: 38px; padding: .35rem .9rem;
    border-radius: 999px; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink-2);
    text-decoration: none; font-size: .875rem; font-weight: 700; white-space: nowrap;
}
.tabs a.active, .tabs .tab.active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.tabs-scroll {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-left: -1rem; margin-right: -1rem; padding: 0 1rem .25rem;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll > a, .tabs-scroll .tab { flex: none; }

.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.chip {
    display: inline-flex; align-items: center; min-height: 34px; padding: .25rem .8rem;
    border-radius: 999px; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink-2);
    font-family: inherit; font-size: .8125rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.store-scroll, .toc-chips {
    display: flex; gap: .4rem; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; scrollbar-width: none;
}
.store-scroll::-webkit-scrollbar, .toc-chips::-webkit-scrollbar { display: none; }
.store-scroll .chip { flex: none; white-space: nowrap; }
.toc-chips a {
    flex: none; white-space: nowrap; padding: .35rem .8rem; border-radius: 999px;
    background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; font-size: .8125rem; text-decoration: none;
}

/* 食事区分ピッカー（セグメント） */
.meal-picker {
    display: flex; align-items: center; gap: .5rem; margin: .5rem 0 .75rem;
}
.meal-picker-label { font-size: .8125rem; font-weight: 700; color: var(--muted); flex: none; }
.meal-picker button {
    flex: 1; min-height: 38px; padding: .3rem .4rem;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
    font-family: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
    border-radius: 10px;
}
.meal-picker button.active { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- 9. タグ・バッジ ---------- */
.tag, .tag-est, .badge-price, .badge-warn, .store-chip {
    display: inline-flex; align-items: center; vertical-align: middle;
    border-radius: 999px; padding: .05rem .5rem;
    font-size: .6875rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.tag { background: var(--teal-soft); color: var(--teal-dark); }
.tag-src { background: var(--surface-3); color: var(--muted); }
.tag-warn, .tag-est, .badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-price, .badge-warn { margin-left: .3rem; }
.badge-price { background: var(--teal-soft); color: var(--teal-dark); }
.badge-price.none { background: var(--surface-3); color: var(--muted); }
.store-chip { background: var(--teal-soft); color: var(--teal-dark); }

.pfc-chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.pfc-chip { font-size: .6875rem; font-weight: 700; padding: .05rem .45rem; border-radius: 6px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.pfc-chip.p { background: var(--p-soft); color: var(--p-ink); }
.pfc-chip.f { background: var(--f-soft); color: var(--f-ink); }
.pfc-chip.c { background: var(--c-soft); color: var(--c-ink); }

.num-badge, .dstep-num {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--teal); color: #fff; font-weight: 800; font-size: .8125rem;
}

.streak-chip {
    display: inline-flex; align-items: center; gap: .25rem;
    background: var(--warn-soft); color: var(--warn-ink);
    border-radius: 999px; padding: .2rem .7rem; margin: 0;
    font-size: .75rem; font-weight: 700; white-space: nowrap;
}

/* ---------- 10. ホーム：ヒーロー（今日の残量） ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 .25rem; }
.home-head h1 { margin: 0; }
.home-date { color: var(--muted); font-size: .875rem; font-weight: 500; margin-left: .35rem; }

.hero { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.hero.card { padding: 1.1rem 1rem 1rem; }
.ring-wrap { position: relative; width: 128px; height: 128px; flex: 0 0 auto; }
.ring { width: 128px; height: 128px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--track); stroke-width: 11; }
.ring-fg { fill: none; stroke: var(--teal); stroke-width: 11; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-warn .ring-fg { stroke: var(--amber); }
.ring-over .ring-fg { stroke: var(--coral); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label { font-size: .6875rem; color: var(--muted); font-weight: 700; letter-spacing: .02em; }
.ring-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; color: var(--ink); }
.ring-unit { font-size: .75rem; color: var(--muted); font-weight: 700; }
.hero .ring-num { font-size: 1.9rem; }
.ring-over .ring-num, .ring-num.over { color: var(--danger); }
.hero-side { flex: 1 1 150px; min-width: 0; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0 0 .5rem; }
.hero-stat { background: var(--surface-2); border-radius: 10px; padding: .45rem .6rem; }
.hero-stat span { display: block; font-size: .6875rem; color: var(--muted); font-weight: 700; }
.hero-stat strong { font-size: 1.05rem; font-weight: 800; }
.hero-stat small { font-size: .6875rem; color: var(--muted); margin-left: .1rem; }
.hero details { margin-top: .25rem; }
.hero details summary { color: var(--muted); font-size: .75rem; }
.hero .over { color: var(--danger); }

.hero-pfc { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: .25rem; }

/* PFCの行 */
.pfc-row { margin: .75rem 0; }
.pfc-row:last-child { margin-bottom: 0; }
.pfc-head { display: flex; align-items: center; gap: .5rem; }
.pfc-badge {
    color: #fff; font-weight: 800; width: 22px; height: 22px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; flex: none;
}
.pfc-label { font-weight: 700; font-size: .9rem; }
.pfc-rem { margin-left: auto; font-size: .8125rem; color: var(--muted); }
.pfc-rem strong { font-size: 1.15rem; font-weight: 800; color: var(--ink); margin-left: .15rem; }
.pfc-rem.done { color: var(--teal-dark); font-weight: 700; }
.bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin: .4rem 0 .2rem; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.pfc-sub { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* スクロール時だけ出る残量バー */
.home-remain-bar {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 35;
    display: flex; gap: 1rem; align-items: center; justify-content: center;
    padding: .45rem 1rem;
    background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    font-size: .8125rem; font-weight: 600; color: var(--muted);
    transition: opacity .2s;
}
.home-remain-bar strong { color: var(--ink); font-size: .9375rem; }
.home-remain-bar.is-hidden { opacity: 0; pointer-events: none; }

/* ホームのクイックアクション */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .75rem 0; }
.quick-actions a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
    min-height: 76px; padding: .6rem .25rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1);
    color: var(--ink); text-decoration: none; font-weight: 700; font-size: .78rem; text-align: center;
    transition: transform .08s, border-color .15s;
}
.quick-actions a:hover { border-color: var(--teal-line); }
.quick-actions a:active { transform: scale(.97); }
.quick-actions a svg {
    width: 34px; height: 34px; padding: 7px; border-radius: 10px;
    background: var(--teal-soft); color: var(--teal-dark);
}

/* ---------- 11. 食事の一覧 ---------- */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .8125rem; font-weight: 700; text-decoration: none; }

.meal-group-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
    margin: 1rem 0 .1rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line);
    font-size: .8125rem; font-weight: 800; color: var(--ink-2); letter-spacing: .04em;
}
.meal-group-head .muted { font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.meal-row {
    display: flex; align-items: center; gap: .65rem;
    padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.meal-row:last-child { border-bottom: none; }
.meal-main { flex: 1; min-width: 0; }
.meal-name { font-weight: 700; font-size: .9375rem; line-height: 1.45; }
.meal-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; font-size: .75rem; color: var(--muted); }
.meal-kcal { font-weight: 800; color: var(--ink); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.meal-method {
    flex: none; width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--muted); font-size: 1rem;
}
.meal-method svg { width: 18px; height: 18px; }
.meal-actions { display: flex; align-items: center; gap: .1rem; flex: none; }
.meal-actions form { margin: 0; }
.add-link {
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    min-height: var(--tap); margin-top: .75rem; border-radius: 12px;
    border: 1px dashed var(--line-strong); color: var(--teal-dark);
    font-weight: 700; font-size: .875rem; text-decoration: none;
}
.empty-state { text-align: center; padding: 1rem .5rem .25rem; color: var(--muted); font-size: .875rem; }

.food-card .food-name { font-weight: 700; font-size: 1rem; }
.set-list { margin: .3rem 0; padding-left: 1.2rem; }

/* 食品のコンパクト行（記録画面など） */
.food-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    column-gap: .75rem; row-gap: .4rem;
    padding: .75rem 0; border-bottom: 1px solid var(--line);
}
.food-row:last-child { border-bottom: none; }
.food-row-main { min-width: 0; grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.food-row-name { font-weight: 700; font-size: .9375rem; line-height: 1.45; margin-bottom: .25rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.food-row-main .pfc-chips { flex-wrap: wrap; }
.food-row-kcal { grid-column: 2; grid-row: 1; justify-self: end; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.food-row-kcal small { color: var(--muted); font-weight: 700; margin-left: .1rem; }
.food-row > .inline-form, .food-row > form, .food-row > .qty-ctl { grid-column: 2; grid-row: 2; justify-self: end; flex-wrap: nowrap; }
.food-row > .btn, .food-row > a.btn { grid-column: 2; grid-row: 2; justify-self: end; }

/* 表 */
.tbl, .cmp-table { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: .5rem .35rem; text-align: left; }
.tbl th, .cmp-table th { font-size: .75rem; color: var(--muted); font-weight: 700; }
.cmp-table th, .cmp-table td { padding: .4rem .35rem; border-bottom: 1px solid var(--line); text-align: right; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table tr:last-child td { border-bottom: none; }

/* 設定風リスト */
.list-row {
    display: flex; align-items: center; gap: .75rem; min-height: 52px; padding: .6rem .25rem;
    border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700;
}
.list-row:last-child { border-bottom: none; }
.list-row .chev { margin-left: auto; color: var(--faint); }

/* ---------- 12. グラフ ---------- */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; overflow-x: auto; padding-top: .5rem; }
.chart-col { flex: 1 0 22px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar { width: 70%; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 4px; }
.chart-label { font-size: .625rem; color: var(--muted); margin-top: .2rem; white-space: nowrap; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 14px; position: relative; }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-bars .cb-bar { width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background: var(--teal); min-height: 2px; }
.chart-bars .cb-bar.over { background: var(--coral); }
.chart-bars .cb-label { font-size: .6875rem; color: var(--muted); }
.chart-target { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--coral); }

.achieve { display: flex; align-items: center; gap: .5rem; }
.achieve-track { flex: 1; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.achieve-fill { height: 100%; border-radius: 99px; background: var(--teal); }
.achieve-fill.low { background: var(--amber); }
.achieve-fill.over { background: var(--coral); }
.achieve-num { font-weight: 800; white-space: nowrap; }

.stacked-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--track); margin: .4rem 0; gap: 2px; }
.stacked-bar > div { height: 100%; }
.stacked-bar .seg-b { background: var(--amber); }
.stacked-bar .seg-l { background: var(--teal); }
.stacked-bar .seg-d { background: var(--blue); }

.cal-strip { display: flex; gap: 4px; margin: .5rem 0; }
.cal-strip a {
    flex: 1; text-align: center; padding: .4rem 0; border-radius: 10px;
    text-decoration: none; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
    font-size: .75rem; font-weight: 700;
}
.cal-strip a.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cal-strip .dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--teal); margin: 2px auto 0; }
.cal-strip a.active .dot { background: var(--on-ink); }

.mini-ring { transform: rotate(-90deg); }
.mini-ring .mr-bg { stroke: var(--track); }
.mini-ring .mr-fg { stroke: var(--teal); }

/* ---------- 13. 下部タブバー・FAB・シート ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around;
    background: var(--glass);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.tabbar a {
    flex: 1; max-width: 96px; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 0 4px; color: var(--faint); text-decoration: none;
    font-size: .625rem; font-weight: 700; letter-spacing: .02em;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--teal-dark); }
.tabbar a.active::before {
    content: ""; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
    width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--teal);
}

.fab {
    position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 45;
    width: 56px; height: 56px; border-radius: 18px; border: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--teal); color: #fff; font-size: 0; cursor: pointer;
    box-shadow: 0 8px 20px rgba(11, 107, 98, .32);
    transition: transform .1s, background-color .15s;
}
.fab::before, .fab::after { content: ""; position: absolute; width: 22px; height: 2.6px; border-radius: 2px; background: currentColor; }
.fab::after { transform: rotate(90deg); }
.fab:hover { background: var(--teal-dark); }
.fab:active { transform: scale(.95); }

.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 70; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
    max-width: 560px; max-height: 88vh; overflow-y: auto; margin: 0 auto;
    background: var(--surface); border-radius: 22px 22px 0 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .16);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet-title { font-weight: 800; font-size: 1.0625rem; margin: 0 2px 12px; }
.sheet-sub { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin: 16px 2px 4px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 14px 12px; border-radius: 14px; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--ink); text-decoration: none;
}
.sheet-tile strong { font-size: .9375rem; }
.sheet-tile small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.4; margin-top: 1px; }
.sheet-tile:active { transform: scale(.98); }
.sheet-tile.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.sheet-tile.primary small { color: rgba(255, 255, 255, .85); }
.sheet-tile.primary .sheet-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.sheet-item {
    display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 2px;
    color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-size: .9375rem;
}
.sheet-item:last-of-type { border-bottom: none; }
.sheet-item small { display: block; color: var(--muted); font-size: .75rem; }
.sheet-ic {
    flex: none; width: 36px; height: 36px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--teal-soft); color: var(--teal-dark); font-size: 18px;
}
.sheet-ic svg { width: 20px; height: 20px; }
.sheet-item .chev { margin-left: auto; color: var(--faint); }
.sheet .btn { margin-top: 12px; }

/* ---------- 14. AI処理中ローダー ---------- */
.ai-loader { position: fixed; inset: 0; background: var(--glass); z-index: 999; display: none; align-items: center; justify-content: center; }
.ai-loader.show { display: flex; }
.ai-loader-box { width: min(84vw, 340px); text-align: center; }
.ai-logo-spin {
    width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; position: relative;
    background: conic-gradient(var(--c-protein) 0 40%, var(--c-fat) 40% 65%, var(--c-carbs) 65% 100%);
    animation: ai-spin 1.1s linear infinite;
}
.ai-logo-spin::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loader-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 10px; }
.ai-bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.ai-bar-fill { height: 100%; width: 0%; background: var(--teal); border-radius: 999px; transition: width .5s ease; }
.ai-bar-pct { font-size: .8125rem; color: var(--muted); margin-bottom: 12px; }
.ai-steps { list-style: none; margin: 0; padding: 0; text-align: left; font-size: .875rem; color: var(--faint); }
.ai-steps li { padding: 3px 0 3px 24px; position: relative; }
.ai-steps li::before { content: "○"; position: absolute; left: 2px; }
.ai-steps li.doing { color: var(--ink); font-weight: 700; }
.ai-steps li.doing::before { content: "◐"; color: var(--teal); }
.ai-steps li.done { color: var(--muted); }
.ai-steps li.done::before { content: "✓"; color: var(--teal); font-weight: 700; }
.ai-loader-note { font-size: .75rem; color: var(--muted); margin-top: 12px; }

/* ---------- 15. はじめての方・ガイド ---------- */
.steps { margin: .6rem 0 1rem; padding-left: 1.3em; }
.steps li { margin: .5rem 0; }
.checklist ul { list-style: none; margin: .5rem 0 .75rem; padding: 0; }
.checklist li { padding: .45rem 0 .45rem 30px; position: relative; }
.checklist li::before {
    content: ""; position: absolute; left: 2px; top: .7rem; width: 16px; height: 16px;
    border-radius: 50%; border: 2px solid var(--line-strong); box-sizing: border-box;
}
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done::before { background: var(--teal); border-color: var(--teal); }
.tips { margin: .4rem 0; padding-left: 1.2em; }
.tips li { margin: .5rem 0; line-height: 1.6; }
.bubble { display: flex; gap: .55rem; align-items: flex-start; }
.bubble .bubble-ic { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--teal-soft); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.bubble .bubble-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: .6rem .8rem; flex: 1; }

/* ---------- 16. 画面別の部品 ---------- */
/* 写真・バーコード */
#barcode-video { width: 100%; max-height: 300px; border-radius: var(--radius); background: #000; }
#barcode-reader { width: 100%; border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; }
#barcode-reader video { width: 100% !important; border-radius: var(--radius); }
.scan-frame {
    border: 2px dashed var(--teal); border-radius: var(--radius); padding: 1.6rem 1rem; text-align: center;
    color: var(--teal-dark); background: var(--teal-soft); font-weight: 700; margin-bottom: .75rem;
}

/* 買い物ドラフト */
.qty-ctl { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.qty-ctl form { margin: 0; }
.qty-ctl .btn { min-height: 36px; min-width: 36px; padding: .3rem .6rem; font-size: 1rem; }
.remain-big { font-size: 1.05rem; }
.over { color: var(--danger); font-weight: 700; }
.draft-pick { background: var(--teal-soft); border-radius: var(--radius-sm); padding: .6rem; }
.draft-steps { display: flex; flex-direction: column; gap: 10px; }
.dstep { display: flex; gap: 10px; align-items: flex-start; }
.draft-bar {
    position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 9;
    background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--line); border-radius: 999px;
    padding: .45rem 1rem; font-size: .8125rem; text-align: center;
    box-shadow: var(--shadow-2); margin: .25rem 0 .75rem;
}
.draft-bar strong { color: var(--teal-dark); font-size: 1rem; }
.draft-bar strong.over { color: var(--danger); }
.add-ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .6rem 0; }
.add-ways a {
    display: flex; align-items: center; justify-content: center; min-height: var(--tap);
    text-align: center; padding: .5rem .4rem; border-radius: 12px;
    background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; font-size: .8125rem;
    text-decoration: none; border: 1px solid var(--teal-line);
}
.live-out { font-weight: 800; color: var(--teal-dark); }

/* 固定アクションバー */
.sticky-action {
    position: sticky; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 30;
    background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
    padding: .6rem .75rem; box-shadow: var(--shadow-2); margin: .75rem 0;
}
.sticky-topbar {
    position: sticky; top: var(--topbar-h); z-index: 30; background: var(--glass);
    border-bottom: 1px solid var(--line); padding: .45rem 1rem; margin: 0 -1rem .6rem;
}

/* フレンド */
.friend-summary { font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.friend-summary strong { color: var(--ink); }
.friend-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.fstat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .6rem; text-align: center; }
.fstat .fv { font-size: 1.15rem; font-weight: 800; line-height: 1.25; color: var(--ink); }
.fstat .fl { font-size: .6875rem; color: var(--muted); margin-top: 2px; font-weight: 600; }
.fbar { height: 4px; background: var(--track); border-radius: 999px; margin: 5px 0 3px; overflow: hidden; }
.fbar i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }

/* 設定のカテゴリ（details） */
details.setting-sec { padding: 0; overflow: hidden; }
details.setting-sec > summary {
    list-style: none; cursor: pointer; min-height: 56px; padding: .9rem 1rem;
    font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: .5rem;
}
details.setting-sec > summary::-webkit-details-marker { display: none; }
details.setting-sec > summary::after {
    content: ""; margin-left: auto; width: 8px; height: 8px;
    border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
    transform: rotate(45deg); transition: transform .2s; margin-top: -4px;
}
details.setting-sec[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.setting-sec[open] > summary { border-bottom: 1px solid var(--line); }
details.setting-sec .sec-body { padding: .25rem 1rem 1rem; }
details.setting-sec .sec-body .card { box-shadow: none; }

/* 店舗・セット */
.store-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.store-grid .sg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .35rem .6rem; font-size: .8125rem; font-weight: 700; }
.store-grid .sg span { color: var(--teal-dark); }
.budget-disabled-note { color: var(--muted); font-size: .8125rem; }
.set-rows { padding-left: 0; list-style: none; }
.set-rows li { display: flex; justify-content: space-between; gap: .8rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.set-item-name { min-width: 0; }
.set-item-price { font-weight: 700; white-space: nowrap; }
.set-total { background: var(--teal-soft); border-radius: var(--radius-sm); padding: .6rem .75rem; margin: .5rem 0; display: grid; gap: .35rem; }

/* ---------- 17. 大きい画面 ---------- */
@media (min-width: 720px) {
    body { font-size: 16px; }
    .wrap { padding-top: .75rem; }
    .card { padding: 1.25rem; }
    .tabs-scroll { margin-left: 0; margin-right: 0; padding: 0 0 .25rem; }
}

/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}

/* ホームの記録行：PFCを1行に収める */
.meal-meta { gap: .3rem; }
.meal-meta .pfc-chips { flex-wrap: nowrap; gap: .2rem; }
.meal-meta .pfc-chip { padding: .02rem .35rem; }
.meal-actions select.small-select { padding-right: 1.35rem; background-position: right .4rem center; }
.meal-actions .icon-btn { width: 32px; }
@media (max-width: 374px) { .meal-meta .pfc-chips { flex-wrap: wrap; } }
.meal-meta { flex-wrap: nowrap; white-space: nowrap; }
.meal-row { gap: .55rem; }
.meal-method { width: 30px; height: 30px; }
@media (max-width: 374px) { .meal-meta { flex-wrap: wrap; } }
.meal-meta { overflow: hidden; }

/* 写真解析：記録済みの候補 */
.photo-result-head .btn { margin: .25rem .4rem 0 0; }
.food-card.is-added { background: var(--surface-2); }
.food-card.is-added .food-name { color: var(--muted); }

/* ---------- 2026-11-25 追加：ロゴ・記録の編集・その他画面 ---------- */
.logo-mark { width: 24px; height: 24px; background: none; display: inline-flex; }
.logo-mark::after { content: none; }
.pe-logo { display: inline-block; vertical-align: middle; }

/* タップで編集できる記録の行 */
a.meal-link { color: inherit; text-decoration: none; border-radius: 10px; margin: 0 -.4rem; padding-left: .4rem; padding-right: .4rem; }
a.meal-link:hover { background: var(--surface-2); }
a.meal-link:active { background: var(--teal-soft); }
.meal-row .chev, .list-row .chev { margin-left: auto; color: var(--faint); font-size: 1.25rem; line-height: 1; flex: none; }
.meal-thumb { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.history-list a.meal-row { color: inherit; text-decoration: none; }

/* 記録の編集画面 */
.entry-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: .5rem; }
.scale-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; margin: .8rem 0 .25rem; }
.scale-title { font-weight: 700; font-size: .875rem; }
.scale-box p { margin: .15rem 0 .35rem; }

/* 写真解析の結果 */
.photo-result-img { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; margin-bottom: .6rem; }

/* その他画面 */
.list-row .sheet-ic { width: 34px; height: 34px; }
.list-row > span:nth-child(2) { display: flex; flex-direction: column; }
.list-sub { color: var(--muted); font-size: .75rem; font-weight: 500; }

/* =========================================================
   v4 追加（2026-11-26）
   ========================================================= */
/* よく食べるもの（＋ボタンのシート） */
.quick-foods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: .9rem; }
.quick-foods form { margin: 0; }
.quick-food {
    width: 100%; min-height: 56px; text-align: left; padding: .55rem .7rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer;
    display: flex; flex-direction: column; gap: 2px;
}
.quick-food:active { background: var(--teal-soft); border-color: var(--teal-line); }
.qf-name { font-weight: 700; font-size: .875rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qf-meta { font-size: .75rem; color: var(--muted); }

/* 写真の候補：まとめて記録 */
.bulk-card { border-color: var(--teal-line); }
.bulk-title { font-weight: 800; }
.bulk-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.bulk-item { display: flex !important; align-items: center; gap: .6rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); font-weight: 500 !important; margin: 0 !important; }
.bulk-item:last-child { border-bottom: none; }
.bulk-item input { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.bulk-name { flex: 1; min-width: 0; }
.bulk-kcal { color: var(--muted); font-size: .8125rem; white-space: nowrap; }

/* 通知の設定 */
.notify-form { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.notify-title { font-weight: 700; }
.notify-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.notify-row .check { margin: 0; }
.notify-row input[type="time"] { width: 8.5rem; flex: none; }
.form .check, .check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--teal); }

/* ホーム：7日間の推移 */
.trend-sum { margin: 0 0 .25rem; }
.trend-plot { position: relative; height: 110px; display: flex; align-items: flex-end; gap: 6px; margin-top: 1.1rem; border-bottom: 1px solid var(--line); }
.tp-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-decoration: none; position: relative; z-index: 1; }
.tp-bar { width: 100%; max-width: 26px; background: var(--teal); border-radius: 4px 4px 0 0; }
.tp-bar.over { background: var(--coral); }
.tp-val { font-size: .6875rem; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.trend-plot .chart-target { z-index: 2; pointer-events: none; }
.trend-axis { display: flex; gap: 6px; margin-top: 6px; }
.trend-axis > span { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .6875rem; color: var(--muted); }
.trend-axis > span.is-today { color: var(--ink); font-weight: 700; }
.cb-p { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.cb-p.hit { background: var(--c-protein); border-color: var(--c-protein); }
.trend-note { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin: .4rem 0 0; }
.legend-dash { display: inline-block; width: 16px; border-top: 1.5px dashed var(--coral); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-protein); margin-left: .5rem; }

/* オフライン表示 */
.offline-banner { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--topbar-h) + 8px); z-index: 80;
    background: var(--ink); color: var(--on-ink); font-size: .8125rem; font-weight: 600; padding: .4rem .9rem; border-radius: 999px; box-shadow: var(--shadow-2); }
.offline-banner[hidden] { display: none; }
