/* ============================================================
   Mon suivi — proposition C (Design Claude), journal chronologique.
   Préfixe .tk- (suivi) + .tpc- (journal) + .pc- (modal photo)
   pour éviter tout conflit avec EasyAdmin et les autres pages
   custom (.sl- courses, .rp- planning, .rc- catalogue, .ri- import,
   .db- ancien dashboard).
   Variables --brand* scopées sous .tk-wrap (jamais sur :root).
   ============================================================ */

.tk-wrap {
    --brand: #6366f1;
    --brand-d: #4f46e5;
    --brand-soft: #eef0fe;
    --brand-tint: rgba(99, 102, 241, .12);
    --brand-2: #8b5cf6;

    color-scheme: light;
    position: relative;
    font-family: 'Public Sans', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: #23263a;
    font-size: 14px;
    box-sizing: border-box;
}
.tk-wrap *, .tk-wrap *::before, .tk-wrap *::after { box-sizing: border-box; }

/* ════ En-tête ════ */
.tpc-wrap { position: relative; max-width: 640px; margin: 0 auto; }
.tpc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.tpc-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.025em; }

.tpc-day-toggle {
    display: inline-flex; align-items: center; gap: 6px; margin: 5px 0 0; padding: 0; border: 0; background: transparent;
    color: #6b7080; font: inherit; font-size: 14px; cursor: pointer; border-radius: 6px;
}
.tpc-day-toggle:hover { color: var(--brand-d); }
.tpc-day-toggle svg { flex: none; }

/* ════ Historique : notice + calendrier ════ */
.tpc-history-notice {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--brand-soft); color: var(--brand-d); border: 1px solid #e2e0fb; border-radius: 13px;
    padding: 11px 16px; font-size: 13.5px; font-weight: 600; margin-bottom: 18px;
}
.tpc-history-notice span { display: inline-flex; align-items: center; gap: 8px; }
.tpc-history-notice a { color: var(--brand-d); font-weight: 800; text-decoration: underline; white-space: nowrap; }

.tk-cal-pop {
    position: absolute; top: 54px; left: 0; z-index: 30; width: 300px; max-width: calc(100vw - 48px);
    background: #fff; border: 1px solid #e6e7f1; border-radius: 16px; box-shadow: 0 16px 40px rgba(40, 40, 90, .16);
    padding: 14px;
}
.tk-cal-pop[hidden] { display: none; }

.tk-cal-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tk-cal-hd .lbl { font-size: 13.5px; font-weight: 800; color: #23263a; text-transform: capitalize; }
.tk-cal-hd .nav {
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #6b7080; text-decoration: none;
}
.tk-cal-hd .nav:hover { background: var(--brand-soft); color: var(--brand-d); }
.tk-cal-hd .nav.disabled { color: #d7d9ea; pointer-events: none; }

.tk-cal-dow, .tk-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.tk-cal-dow span { text-align: center; font-size: 10.5px; font-weight: 700; color: #9aa0b4; padding-bottom: 4px; }

.tk-cal-cell {
    display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; font-size: 12.5px; font-weight: 700;
    text-decoration: none; color: #41465c; background: #f5f5fa;
}
.tk-cal-cell.blank { background: transparent; }
.tk-cal-cell.future { background: transparent; color: #cbd5e1; font-weight: 600; }
.tk-cal-cell.empty { background: #e9eaf1; color: #8a8fa3; }
.tk-cal-cell.under { background: #dcfce7; color: #16803c; }
.tk-cal-cell.over { background: #fde0e0; color: #b91c1c; }
.tk-cal-cell.logged { background: #dbeafe; color: #1d4ed8; }
.tk-cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.tk-cal-cell.viewed { box-shadow: inset 0 0 0 2px var(--brand-d); font-weight: 800; }
a.tk-cal-cell:hover { filter: brightness(0.94); }

.tk-cal-legend { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef0f4; }
.tk-cal-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: #9aa0b4; }
.tk-cal-legend i { width: 9px; height: 9px; border-radius: 3px; }
.tk-cal-legend i.under { background: #22c55e; }
.tk-cal-legend i.over { background: #ef4444; }
.tk-cal-legend i.logged { background: #3b82f6; }
.tk-cal-legend i.empty { background: #b8bccb; }

.tk-ring { position: relative; flex: none; }
.tk-ring svg { display: block; width: 100%; height: 100%; }
.tk-ring .ctr { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 12px; }
.tk-ring .ctr b { font-weight: 800; letter-spacing: -.03em; line-height: 1; font-size: 17px; }
.tk-ring .ctr small { font-size: 9px; font-weight: 700; color: #9aa0b4; text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; }
.tk-ring .ctr .over { color: #dc2626; }

/* ════ Série de jours suivis + liens vers les autres suivis (poids, jeûne) ════ */
.tpc-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.tpc-tool-link {
    display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 99px;
    background: var(--brand-soft); color: var(--brand-d); font-size: 13px; font-weight: 800;
    border: 1px solid #e2e0fb; text-decoration: none;
}
.tpc-tool-link:hover { background: #e4e6fd; }

.tpc-streak {
    display: inline-flex; align-items: center; flex-shrink: 0; gap: 5px; padding: 7px 12px; border-radius: 99px;
    background: #fff4e5; color: #d97706; font-size: 13px; font-weight: 800; border: 1px solid #fde4c4;
}

/* ════ Héros (anneau + KPIs + conseil du jour) ════ */
.tpc-hero {
    position: relative; background: linear-gradient(150deg, #4f46e5, #7c3aed 88%); border-radius: 24px;
    padding: 24px 26px; color: #fff; overflow: hidden; box-shadow: 0 16px 34px rgba(79, 70, 229, .28);
    margin-bottom: 18px;
}
.tpc-hero-glow { position: absolute; top: -60px; right: -40px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); }
.tpc-hero-row { display: flex; align-items: center; gap: 26px; position: relative; flex-wrap: wrap; }
.tpc-hero .tk-ring .ctr b { font-size: 34px; color: #fff; }
.tpc-hero .tk-ring .ctr small { font-size: 11px; color: rgba(255, 255, 255, .85); max-width: 90px; }
.tpc-hero .tk-ring .ctr .over { color: #fecaca; }
.tpc-hero-right { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.tpc-hero-side { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 20px; }
.tpc-hero-kpi { display: flex; flex-direction: column; }
.tpc-hero-kpi span { font-size: 11.5px; font-weight: 700; opacity: .8; text-transform: uppercase; letter-spacing: .04em; }
.tpc-hero-kpi b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.tpc-hero-pct { font-size: 12.5px; font-weight: 700; opacity: .9; background: rgba(255, 255, 255, .16); padding: 5px 10px; border-radius: 99px; }

.tpc-advice { margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .18); position: relative; }
.tpc-hero-right > .tpc-advice:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.tpc-advice-hd { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; opacity: .9; margin-bottom: 12px; }
.tpc-advice-count { margin-left: auto; font-size: 11px; font-weight: 800; background: rgba(255, 255, 255, .18); padding: 2px 9px; border-radius: 99px; letter-spacing: 0; text-transform: none; }

.tpc-crit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpc-crit-it {
    min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 12px 4px 10px; border: 1.5px solid rgba(255, 255, 255, .16); border-radius: 15px;
    background: rgba(255, 255, 255, .08); cursor: default; position: relative; font: inherit; color: inherit;
    transition: background .15s, border-color .15s;
}
.tpc-crit-badge {
    width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .75); border: 1.5px dashed rgba(255, 255, 255, .4);
    transition: all .15s;
}
.tpc-crit-it.ok { background: rgba(34, 197, 94, .2); border-color: rgba(74, 222, 128, .55); }
.tpc-crit-it.ok .tpc-crit-badge { background: #22c55e; color: #fff; border: 1.5px solid #22c55e; box-shadow: 0 3px 10px rgba(16, 120, 50, .45); }
.tpc-crit-lbl { font-size: 11px; font-weight: 800; color: #fff; text-align: center; line-height: 1.15; }
.tpc-crit-state { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: rgba(255, 255, 255, .7); }
.tpc-crit-it.ok .tpc-crit-state { color: #bbf7d0; }
.tpc-crit-tip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px); width: 150px;
    background: #1a1c2e; color: #fff; font-size: 11.5px; font-weight: 600; line-height: 1.35; padding: 9px 11px;
    border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none;
    transition: opacity .14s, transform .14s; z-index: 10;
}
.tpc-crit-tip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1a1c2e; }
.tpc-crit-it:hover .tpc-crit-tip, .tpc-crit-it:active .tpc-crit-tip, .tpc-crit-it:focus-visible .tpc-crit-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ════ Suggestions familiales (juste au-dessus du journal) ════ */
.tpc-fam-sugg {
    position: relative; display: flex; flex-direction: column; gap: 10px; overflow: hidden;
    background: linear-gradient(150deg, #f59e0b, #ec4899 88%);
    border-radius: 22px; padding: 18px 20px; margin-bottom: 18px;
    box-shadow: 0 16px 34px rgba(236, 72, 153, .28);
}
.tpc-fam-sugg-glow { position: absolute; top: -50px; right: -30px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 70%); }
.tpc-fam-sugg-hd { position: relative; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: rgba(255, 255, 255, .9); }
.tpc-fam-sugg-item { position: relative; display: flex; align-items: stretch; gap: 2px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); border-radius: 15px; overflow: hidden; }
.tpc-fam-sugg-bd { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; min-width: 0; color: #fff; }
.tpc-fam-sugg-bd:hover { background: rgba(255, 255, 255, .14); }
.tpc-fam-sugg-bd .tpc-fg { background: #fff; }
.tpc-fam-sugg-bd .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tpc-fam-sugg-bd .tx b { font-weight: 800; }
.tpc-fam-sugg-bd .tx small { color: rgba(255, 255, 255, .85); font-weight: 700; }
.tpc-fam-sugg-bd .cta {
    display: flex; align-items: center; gap: 4px; flex: none; font-size: 12.5px; font-weight: 800;
    color: #ec4899; background: #fff; padding: 7px 12px; border-radius: 99px; white-space: nowrap;
}
.tpc-fam-sugg-x { border: 0; background: transparent; color: rgba(255, 255, 255, .75); cursor: pointer; width: 40px; flex: none; display: grid; place-items: center; }
.tpc-fam-sugg-x:hover { background: rgba(255, 255, 255, .2); color: #fff; }

@media (max-width: 480px) {
    .tpc-fam-sugg-bd .cta span { display: none; }
    .tpc-fam-sugg-bd .cta { padding: 8px; }
}

/* ════ Bloc hydratation (sous le héros calories) ════ */
.tpc-hydro-hero {
    position: relative; display: block; background: linear-gradient(150deg, #0ea5e9, #0284c7 88%);
    border-radius: 24px; padding: 20px 24px; color: #fff; overflow: hidden;
    box-shadow: 0 16px 34px rgba(14, 165, 233, .28); margin-bottom: 18px; transition: background .3s ease;
}
.tpc-hydro-hero.is-reached { background: linear-gradient(150deg, #0d9488, #059669 88%); box-shadow: 0 16px 34px rgba(5, 150, 105, .28); }
.tpc-hydro-hero-glow { position: absolute; top: -50px; right: -30px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); }
.tpc-hydro-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tpc-hydro-label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.tpc-hydro-pct { font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .18); padding: 3px 10px; border-radius: 99px; }
.tpc-hydro-value { position: relative; display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.tpc-hydro-value small { font-size: 15px; font-weight: 700; opacity: .8; margin-left: 4px; }
.tpc-hydro-progress { position: relative; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; margin-top: 12px; }
.tpc-hydro-fill { height: 100%; width: 0; border-radius: 99px; background: #fff; transition: width .4s ease; }
.tpc-hydro-goal { position: relative; display: block; margin-top: 8px; font-size: 12.5px; font-weight: 600; opacity: .9; }
.tpc-hydro-goal a { color: #fff; font-weight: 800; text-decoration: underline; }
.tpc-hydro-actions { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tpc-hydro-add {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .3); border-radius: 99px; background: rgba(255, 255, 255, .14);
    color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .12s;
}
.tpc-hydro-add:hover { background: rgba(255, 255, 255, .26); }
.tpc-hydro-add:disabled { opacity: .5; cursor: not-allowed; }

/* ════ Bloc jeûne (sous le héros calories) — 3 états selon l'heure (cf. tkFastPhase
   dans tracking.js) : en cours (violet, défaut), conclusion réussie (vert)/loupée
   (ambre, même teinte que l'ancien .is-warning), attente du prochain jeûne (ardoise). ════ */
.tpc-fast-hero {
    position: relative; display: block; background: linear-gradient(150deg, #4f46e5, #8b5cf6 88%);
    border-radius: 24px; padding: 20px 24px; color: #fff; overflow: hidden; text-decoration: none;
    box-shadow: 0 16px 34px rgba(79, 70, 229, .28); margin-bottom: 18px; transition: background .3s ease;
}
.tpc-fast-hero:hover { filter: brightness(1.04); }
.tpc-fast-hero.is-concluded-success { background: linear-gradient(150deg, #15803d, #22c55e 88%); box-shadow: 0 16px 34px rgba(21, 128, 61, .28); }
.tpc-fast-hero.is-concluded-missed { background: linear-gradient(150deg, #b45309, #d97706 88%); box-shadow: 0 16px 34px rgba(180, 83, 9, .28); }
.tpc-fast-hero.is-waiting { background: linear-gradient(150deg, #475569, #64748b 88%); box-shadow: 0 16px 34px rgba(71, 85, 105, .28); }
.tpc-fast-hero-glow { position: absolute; top: -50px; right: -30px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); }
.tpc-fast-hero-label { position: relative; display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.tpc-fast-hero-timer { position: relative; display: block; font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tpc-fast-hero-progress { position: relative; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; margin-top: 14px; }
.tpc-fast-hero-progress[hidden] { display: none; }
.tpc-fast-hero-fill { height: 100%; width: 0; border-radius: 99px; background: #fff; transition: width .4s ease; }
.tpc-fast-hero-goal { position: relative; display: block; margin-top: 8px; font-size: 12.5px; font-weight: 700; opacity: .9; }

@media (max-width: 480px) {
    .tpc-hero { padding: 20px 18px; }
    .tpc-hero-row { gap: 18px; }
    .tpc-hero .tk-ring { width: 128px !important; height: 128px !important; }
    .tpc-hero .tk-ring .ctr b { font-size: 26px; }
    .tpc-hero .tk-ring .ctr small { font-size: 10px; max-width: 76px; }
    .tpc-hero-right { min-width: 130px; }
    .tpc-hero-kpi b { font-size: 19px; }
}

/* ════ Scanner photo (CTA pleine largeur) ════ */
.tpc-scan {
    display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; margin: 0 0 18px;
    padding: 18px 22px; border: 1px solid #e2e0fb; border-radius: 20px; cursor: pointer;
    background: linear-gradient(135deg, #eef0fe, #f4edff); font: inherit; transition: transform .1s;
}
.tpc-scan:active { transform: scale(.99); }
.tpc-scan-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tpc-scan-txt b { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; color: var(--brand-d); }
.tpc-scan-txt span { font-size: 12.5px; color: #6b7080; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.tpc-scan-cam { width: 52px; height: 52px; flex: none; border-radius: 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px var(--brand-tint); }

.tpc-describe {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-align: center; margin: -10px 0 18px;
    padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700;
    color: #6b7080;
}
.tpc-describe:hover { color: var(--brand-d); }

/* ════ Ajout rapide ════ */
.tpc-quickcard { background: #fff; border: 1px solid #e6e7f1; border-radius: 16px; padding: 14px 18px; margin-bottom: 22px; box-shadow: 0 1px 2px rgba(40, 40, 90, .03); }

.tk-quick-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border: 0; background: none; padding: 2px 0; font: inherit; cursor: pointer; color: inherit; text-align: left;
}
.tk-quick-toggle .lbl { font-size: 13.5px; font-weight: 700; color: #23263a; }
.tk-quick-toggle-ic {
    width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand-d);
    display: grid; place-items: center; transition: transform .15s ease;
}
.tk-quick-toggle[aria-expanded="true"] .tk-quick-toggle-ic { transform: rotate(45deg); }

.tk-quick { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; margin-top: 10px; border-top: 1px solid #eef0f4; }
.tk-quick[hidden] { display: none; }

.tk-cat-row { display: flex; align-items: center; gap: 8px; }
.tk-cat-row label { font-size: 12px; font-weight: 700; color: #9aa0b4; text-transform: uppercase; letter-spacing: .03em; }
.tk-cat-select {
    height: 34px; border: 1px solid #d7d9ea; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 700;
    color: #41465c; background: #fff; padding: 0 10px; outline: none; cursor: pointer;
}
.tk-cat-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.tk-quick-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px; }
.tk-qchip {
    display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 6px 0 12px; border: 1px solid #e6e7f1;
    background: #fff; border-radius: 99px; font: inherit; font-size: 12.5px; font-weight: 600; color: #41465c;
    cursor: pointer; transition: all .12s;
}
.tk-qchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: lowercase; }
.tk-qchip:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-d); }
.tk-qchip .k { flex: none; color: #9aa0b4; font-weight: 700; font-size: 11.5px; }
.tk-qchip:hover .k { color: var(--brand-d); }
.tk-qchip:disabled { opacity: .5; cursor: not-allowed; }

.tk-qfree { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tk-qfree input { height: 42px; border: 1px solid #d7d9ea; border-radius: 10px; font: inherit; font-size: 14px; padding: 0 13px; outline: none; color: #23263a; width: 100%; }
.tk-qfree input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.tk-qfree-submit {
    width: 42px; height: 42px; flex: none; padding: 0; border: 0; border-radius: 10px;
    background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.tk-qfree-submit:disabled { opacity: .4; cursor: not-allowed; }

.tk-food-field { position: relative; flex: 1; min-width: 220px; }

.tk-unit-field { position: relative; flex: none; width: 130px; }
.tk-unit-field input { padding-right: 42px; }
.tk-unit-field .unit { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: #9aa0b4; pointer-events: none; }
.tk-unit-field[hidden] { display: none; }

@media (max-width: 560px) {
    /* La recherche libre passe en colonne : le champ texte prend sa propre ligne pleine
       largeur (flex-basis 100% le force à passer à la ligne plutôt que de se faire
       écraser par ses voisins de largeur fixe dans la même rangée flex-wrap) — sinon
       le champ, et donc la liste de suggestions calée sur sa largeur (`.tk-food-ac`,
       position:absolute relative à `.tk-food-field`), se retrouvaient tous les deux
       ratatinés et inutilisables sur mobile. */
    .tk-food-field { flex: 1 1 100%; min-width: 0; }
    .tk-unit-field { flex: 1 1 100px; width: auto; }
    .tk-qfree-submit { flex: 0 0 44px; width: 44px; height: 44px; }
    /* 16px minimum : sous ce seuil, iOS Safari zoome automatiquement la page au focus. */
    .tk-qfree input { font-size: 16px; }
    .tk-quick-chips { grid-template-columns: 1fr; }
}
.tk-food-ac {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
    background: #fff; border: 1px solid #e6e7f1; border-radius: 12px; box-shadow: 0 16px 40px rgba(40, 40, 90, .16);
    padding: 6px; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto;
}
.tk-food-ac[hidden] { display: none; }
.tk-food-ac-group + .tk-food-ac-group { border-top: 1px solid #e6e7f1; padding-top: 6px; margin-top: 4px; }
.tk-food-ac-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #9aa0b4; padding: 4px 11px; }
.tk-food-ac-it {
    display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px;
    border: 0; background: transparent; border-radius: 10px; font: inherit; cursor: pointer; text-align: left;
    transition: background-color .12s;
}
.tk-food-ac-it .ic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.tk-food-ac-it[data-kind="recipe"] .ic { background: var(--brand-soft); color: var(--brand-d); }
.tk-food-ac-it[data-kind="food"] .ic { background: #dcfce7; color: #16a34a; }
.tk-food-ac-it .nm {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13.5px; font-weight: 600; color: #23263a;
}
.tk-food-ac-it .sub {
    font-size: 11px; font-weight: 700; color: #6b7080; background: #f3f3fa; padding: 3px 9px; border-radius: 99px;
    flex: none; white-space: nowrap;
}
.tk-food-ac-it.on, .tk-food-ac-it:hover { background: var(--brand-soft); }
.tk-food-ac-it.on .nm, .tk-food-ac-it:hover .nm { color: var(--brand-d); }
.tk-food-ac-it.on .sub, .tk-food-ac-it:hover .sub { background: #fff; color: var(--brand-d); }
.tk-food-ac-empty { padding: 10px 11px; font-size: 13px; color: #9aa0b4; }

/* ════ Bouton photo générique ════ */
.tk-photobtn {
    display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 20px; border: 0; border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font: inherit; font-weight: 800;
    font-size: 14.5px; cursor: pointer; box-shadow: 0 4px 14px var(--brand-tint); transition: filter .12s, transform .1s;
}
.tk-photobtn:hover { filter: brightness(1.06); }
.tk-photobtn:active { transform: translateY(1px); }

/* ════ Journal chronologique ════ */
.tpc-tl-hd { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 16px; font-weight: 800; letter-spacing: -.01em; color: var(--brand-d); }
.tk-empty { color: #9aa0b4; font-size: 14px; padding-bottom: 12px; }
.tpc-tl-group { margin-bottom: 24px; }
.tpc-tl-group-hd {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px;
    border-radius: 11px; color: #fff; font-size: 13px; font-weight: 800; margin: 0 0 14px;
}
.tpc-tl-group-hd .nm { text-transform: uppercase; letter-spacing: .03em; }
.tpc-tl-group-hd .kc { font-variant-numeric: tabular-nums; opacity: .92; }

.tpc-tl { position: relative; padding-left: 38px; }
.tpc-tl::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 26px; width: 2px; background: #e6e7f1; }
.tpc-ev { position: relative; margin-bottom: 14px; }
.tpc-dot { position: absolute; left: -30px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid #e6e7f1; display: grid; place-items: center; color: var(--brand-d); }
.tpc-ev.eaten .tpc-dot { background: #16a34a; border-color: #16a34a; color: #fff; }
.tpc-ev-card { display: flex; align-items: center; gap: 13px; background: #fff; border: 1px solid #e6e7f1; border-radius: 13px; padding: 12px 15px; }
.tpc-ev .hh { position: absolute; left: -84px; top: 16px; width: 44px; text-align: right; font-size: 12px; font-weight: 700; color: #9aa0b4; }
.tpc-ev .th { width: 40px; height: 40px; border-radius: 11px; overflow: hidden; flex: none; }
.tk-th-fallback { display: flex; align-items: center; justify-content: center; color: #fff; }
.tpc-fg { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tpc-fg-photo { padding: 0; border: 0; overflow: hidden; cursor: pointer; background: #e6e7f1; }
.tpc-fg-btn { padding: 0; border: 0; cursor: pointer; font: inherit; }
.tpc-fg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpc-ev .bd { flex: 1; min-width: 0; }
.tpc-ev .tag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-d); }
.tpc-ev .nm { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.tpc-ev .qty { font-size: 12.5px; font-weight: 700; color: var(--brand-d); margin-top: 1px; }
.tpc-ev .kc { font-size: 11px; font-weight: 600; color: #9aa0b4; font-variant-numeric: tabular-nums; margin-top: 1px; }
.tpc-ev-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.tpc-ev .rm, .tpc-ev .requick { border: 0; background: transparent; color: #c3c7d4; cursor: pointer; width: 26px; height: 26px; border-radius: 6px; flex: none; }
.tpc-ev .rm:hover { background: #fdecea; color: #dc2626; }
.tpc-ev .requick:hover { background: var(--brand-soft); color: var(--brand-d); }

@media (max-width: 620px) {
    .tpc-tl { padding-left: 0; }
    .tpc-tl::before { display: none; }
    .tpc-ev .hh { position: static; width: auto; text-align: left; display: block; margin-bottom: 4px; }
    .tpc-dot { display: none; }
}

/* ════ À venir (cartes plates) ════ */
.tpc-sec-t { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #9aa0b4; margin: 22px 2px 13px; }
.tpc-sec-t svg { color: #9aa0b4; }
.tpc-up { display: flex; flex-direction: column; gap: 10px; }
.tpc-upcard { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e6e7f1; border-radius: 16px; padding: 12px 15px; box-shadow: 0 1px 2px rgba(40, 40, 90, .03); }
.tpc-upcard .th { width: 42px; height: 42px; border-radius: 12px; overflow: hidden; flex: none; }
.tpc-upcard .bd { flex: 1; min-width: 0; }
.tpc-upcard .top { display: flex; align-items: center; gap: 8px; }
.tpc-upcard .tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #9aa0b4; }
.tpc-upcard .hh { font-size: 11px; font-weight: 700; color: #9aa0b4; }
.tpc-upcard .nm { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin-top: 2px; }
.tpc-upcard .kc { font-size: 12px; font-weight: 700; color: #9aa0b4; margin-top: 2px; }
.tpc-upcard .eatbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 11px; background: var(--brand-soft); color: var(--brand-d); font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tpc-upcard .eatbtn:hover { background: var(--brand); color: #fff; }

/* ════ Modale de capture photo ════ */
.pc-scrim {
    position: fixed; inset: 0; z-index: 1000; background: rgba(20, 22, 45, .5); backdrop-filter: blur(3px);
    display: grid; place-items: start center; padding: 70px 24px 24px; animation: pcf .15s ease;
}
.pc-scrim[hidden] { display: none; }
@keyframes pcf { from { opacity: 0; } to { opacity: 1; } }
.pc-modal { width: 100%; max-width: 480px; max-height: calc(100vh - 94px); background: #fff; border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 70px rgba(30, 25, 80, .32); animation: pcp .2s cubic-bezier(.3, .7, .4, 1); }
@keyframes pcp { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.pc-hd { display: flex; align-items: center; gap: 11px; padding: 18px 20px; border-bottom: 1px solid #eef0f4; flex: none; }
.pc-hd .ic { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; flex: none; }
.pc-hd h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.pc-hd .x { margin-left: auto; width: 32px; height: 32px; border: 1px solid #e6e7f1; background: #fff; border-radius: 8px; color: #6b7080; cursor: pointer; display: grid; place-items: center; }
.pc-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.pc-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    text-align: center; height: 210px; border: 2px dashed #d7d9ea; border-radius: 16px; cursor: pointer; color: #6b7080;
    overflow: hidden; transition: all .12s;
}
.pc-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.pc-drop .cam { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-d); display: grid; place-items: center; }
.pc-drop b { font-size: 15px; color: #23263a; }
.pc-drop span { font-size: 12.5px; }
.pc-gallery-link {
    display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px;
    text-align: center; font-size: 13px; font-weight: 700; color: var(--brand-d); cursor: pointer;
}
.pc-gallery-link:hover { text-decoration: underline; }
.pc-preview { position: relative; height: 210px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #818cf8, #7c3aed); }
.pc-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-preview .scan { position: absolute; inset: 0; background: linear-gradient(transparent, rgba(99, 102, 241, .28)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.pc-scanline { position: absolute; left: 0; right: 0; height: 3px; background: #fff; box-shadow: 0 0 14px 3px rgba(255, 255, 255, .7); animation: scan 1.4s ease-in-out infinite; }
@keyframes scan { 0% { top: 6%; } 50% { top: 92%; } 100% { top: 6%; } }
.pc-spin { width: 30px; height: 30px; border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: pcspin .7s linear infinite; z-index: 2; }
@keyframes pcspin { to { transform: rotate(360deg); } }
.pc-scan-txt { font-size: 13.5px; font-weight: 700; z-index: 2; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.pc-error { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: #fdecea; color: #b91c1c; font-size: 13px; font-weight: 600; }

.pc-describe { display: flex; flex-direction: column; gap: 8px; }
.pc-describe label { font-size: 12.5px; font-weight: 700; color: #6b7080; text-transform: uppercase; letter-spacing: .03em; }
.pc-describe textarea {
    resize: vertical; min-height: 96px; border: 1px solid #d7d9ea; border-radius: 13px; font: inherit; font-size: 14px;
    padding: 12px 14px; outline: none; color: #23263a;
}
.pc-describe textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.pc-describe .hint { font-size: 12px; color: #9aa0b4; font-weight: 600; line-height: 1.4; }

.pc-describe-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    height: 160px; color: #6b7080; font-size: 13.5px; font-weight: 700;
}
.pc-spin-dark { width: 30px; height: 30px; border: 3px solid #e6e7f1; border-top-color: var(--brand); border-radius: 50%; animation: pcspin .7s linear infinite; }

.pc-correct-link {
    align-self: flex-end; display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 0; border: 0;
    background: transparent; color: var(--brand-d); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.pc-correct-link:hover { text-decoration: underline; }
.pc-res { display: flex; flex-direction: column; gap: 16px; }
.pc-res-top { display: flex; align-items: center; gap: 14px; }
.pc-res-th { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; flex: none; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; align-items: center; justify-content: center; color: #fff; }
.pc-res-th img { width: 100%; height: 100%; object-fit: cover; }
.pc-res-top h4 { margin: 0 0 5px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.pc-conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #16a34a; background: #dcfce7; padding: 3px 9px; border-radius: 99px; }
.pc-water-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 700; color: #0284c7; background: #e0f2fe; padding: 3px 9px; border-radius: 99px; }
.pc-ing { border: 1px solid #eef0f4; border-radius: 13px; padding: 12px 14px; background: #fafaff; }
.pc-ing-hd { margin: 0 0 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #9aa0b4; }
.pc-ing-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.pc-ing-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; color: #23263a; }
.pc-ing-list li .pc-ing-name { display: flex; flex-direction: column; gap: 2px; }
.pc-ing-list li .pc-ing-ciqual { font-weight: 600; font-size: 11px; color: #9aa0b4; }
.pc-ing-list li .qty { color: #6b7080; font-weight: 700; font-size: 12.5px; white-space: nowrap; margin-left: auto; }
.pc-ing-list li .rm { border: 0; background: transparent; color: #c3c7d4; cursor: pointer; width: 22px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center; }
.pc-ing-list li .rm:hover { background: #fdecea; color: #dc2626; }
.pc-ing-empty { color: #9aa0b4; font-weight: 600; font-size: 13px; list-style: none; }

.pc-portion-options { display: flex; gap: 8px; }
.pc-portion-chip {
    flex: 1; height: 40px; padding: 0 10px; border: 1px solid #e6e7f1; background: #fff; border-radius: 12px;
    font: inherit; font-size: 13px; font-weight: 700; color: #41465c; cursor: pointer; transition: all .12s;
}
.pc-portion-chip:hover { border-color: #0ea5e9; background: #e0f2fe; }
.pc-portion-chip.active { border-color: #0284c7; background: #0ea5e9; color: #fff; }

.pc-kcal-edit { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; border: 1px solid #eef0f4; border-radius: 13px; background: #fafaff; }
.pc-kcal-edit .lbl { font-size: 12.5px; font-weight: 700; color: #6b7080; text-transform: uppercase; letter-spacing: .03em; }
.pc-kcal-edit input { margin-left: auto; width: 110px; height: 42px; border: 1px solid #d7d9ea; border-radius: 10px; font: inherit; font-size: 18px; font-weight: 800; text-align: center; color: var(--brand-d); outline: none; }
.pc-kcal-edit input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.pc-kcal-edit .u { font-size: 13px; font-weight: 700; color: #9aa0b4; }

.pc-cat-edit { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid #eef0f4; border-radius: 13px; background: #fafaff; }
.pc-cat-edit .lbl { font-size: 12.5px; font-weight: 700; color: #6b7080; text-transform: uppercase; letter-spacing: .03em; }
.pc-cat-edit .tk-cat-select { margin-left: auto; width: 200px; height: 38px; }
.pc-portion-toggle { flex-basis: 100%; text-align: right; border: 0; background: transparent; color: var(--brand-d); font: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; white-space: nowrap; }
.pc-portion-adjust { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border: 1px dashed #d7d9ea; border-radius: 13px; background: #fff; }
.pc-portion-adjust label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #6b7080; }
.pc-portion-adjust input[type="text"] { width: 100px; }
.pc-portion-adjust input[type="number"] { width: 64px; }
.pc-portion-adjust input[type="text"], .pc-portion-adjust input[type="number"] { height: 32px; border: 1px solid #d7d9ea; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 700; text-align: center; color: #23263a; outline: none; }
.pc-portion-adjust input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.pc-portion-adjust .pc-remember { font-size: 12.5px; }
.pc-portion-adjust .pc-remember input[type="checkbox"] { width: 15px; height: 15px; }
.pc-macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.pc-macros--4 { grid-template-columns: repeat(4, 1fr); }
.pc-macro { border: 1px solid #eef0f4; border-radius: 11px; padding: 11px; text-align: center; }
.pc-macro b { display: block; font-size: 16px; font-weight: 800; }
.pc-macro small { font-size: 11px; color: #9aa0b4; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pc-ft { display: flex; gap: 10px; padding: 0 20px 20px; flex: none; }
.pc-ft button { flex: 1; height: 48px; border-radius: 12px; font: inherit; font-weight: 800; font-size: 14.5px; cursor: pointer; border: 0; }
.pc-ft .retry { flex: none; width: 48px; background: #f3f3fa; color: #6b7080; }
.pc-ft .add { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 14px var(--brand-tint); }
.pc-ft .add:disabled { opacity: .5; cursor: not-allowed; }
