/* WaistLog – feuille de style (mobile-first, responsive + adaptative, mode sombre automatique) */
:root {
  --bg: #f4f7f5; --surface: #fff; --surface2: #eef3f0; --text: #1c2a24; --muted: #62736b; --line: #dbe4df;
  --brand: #2f855a; --brand-d: #276749; --brand-l: #e3f3ea; --accent: #dd6b20;
  --good: #2f855a; --warn: #b7791f; --bad: #c53030; --info: #2b6cb0;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 14px rgba(20, 40, 30, .05);
  --nav-h: 62px; --top-h: 56px; --side-w: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a16; --surface: #1a2420; --surface2: #222f29; --text: #e7efe9; --muted: #98a9a0; --line: #2e3c35;
    --brand: #48bb78; --brand-d: #38a169; --brand-l: #1f3a2b; --good: #48bb78; --warn: #ecc94b; --bad: #fc8181; --info: #63b3ed;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
  .avatar-opt img, .avatar-chip img { background: #fff; }
  .chart svg text { fill: #98a9a0; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; }
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: .3em 0 .5em; line-height: 1.2; } h2 { font-size: 1.15rem; margin: 0 0 .6em; } h3 { font-size: 1.02rem; margin: 0 0 .4em; }
p { margin: .4em 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; } .good { color: var(--good); } .bad { color: var(--bad); }
.only-mobile { display: initial; } .spacer { flex: 1; }
code { background: var(--surface2); padding: .1em .35em; border-radius: 6px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* ---------- Barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.1rem; } .brand:hover { text-decoration: none; }
.iconbtn { background: none; border: 0; min-width: 40px; min-height: 40px; border-radius: 10px; cursor: pointer; font-size: 1.15rem; color: var(--text); display: inline-grid; place-items: center; padding: 0 6px; }
.iconbtn:hover { background: var(--surface2); } .iconbtn.danger { color: var(--bad); }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: .8rem; font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface2); font-size: .75rem; font-weight: 600; }
.badge.premium { background: #fdf0c8; color: #8a5a00; } .badge.sale { background: #fde2e2; color: #b42318; } .badge.bad { background: #fde2e2; color: #b42318; }
.avatar-chip img { border-radius: 50%; display: block; border: 2px solid var(--brand-l); }

/* ---------- Structure application ---------- */
.shell { display: block; }
.main { padding: 14px 14px calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; min-width: 0; }
.sidenav { position: fixed; z-index: 40; top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: 0; left: 0; width: min(78vw, 280px); background: var(--surface); border-right: 1px solid var(--line);
  padding: 10px; overflow-y: auto; transform: translateX(-102%); transition: transform .2s ease; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.sidenav.open { transform: none; }
.sidenav a, .linkbtn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; background: none; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: left; min-height: 44px; }
.sidenav a:hover, .linkbtn:hover { background: var(--surface2); text-decoration: none; }
.sidenav a.active { background: var(--brand-l); color: var(--brand-d); font-weight: 700; }
.sidenav .ico { width: 1.4em; text-align: center; } .admin-link { color: var(--accent) !important; }
.bottomnav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }
.bottomnav a:hover { text-decoration: none; } .bottomnav .ico { font-size: 1.25rem; line-height: 1.2; } .bottomnav small { font-size: .68rem; }
.bottomnav .active { color: var(--brand); font-weight: 700; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 22px 8px; }

@media (min-width: 900px) {
  .only-mobile { display: none !important; }
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .sidenav { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); width: auto; transform: none; box-shadow: none; }
  .main { padding: 22px 28px 60px; width: 100%; }
  h1 { font-size: 1.8rem; }
}
@media (max-width: 420px) { .hide-xs { display: none !important; } }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 0 0 14px; min-width: 0; }
.card.narrow { max-width: 440px; margin: 28px auto; } .card.callout { border-left: 5px solid var(--accent); }
.card.prose { max-width: 780px; margin-left: auto; margin-right: auto; } .prose h3 { margin-top: 1.2em; } .prose ul { padding-left: 1.2em; } .prose li { margin: .25em 0; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; } .pagehead h1, .pagehead h2 { margin: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 14px; } .grid > .card { margin: 0; }
@media (min-width: 640px) { .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cols-journal { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; } }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; } .stack > .card { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-d); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--brand); } .btn-ghost:hover { background: var(--brand-l); color: var(--brand-d); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; } .btn-danger:hover { background: #9b2424; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; } .btn-lg { padding: 14px 24px; font-size: 1.05rem; } .btn-block { width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details > summary { cursor: pointer; } summary.danger { color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; border: 1px solid; font-size: .95rem; }
.flash-ok { background: #e6f6ec; border-color: #9fd6b3; color: #1d5a37; } .flash-warn { background: #fff6dd; border-color: #ecd58a; color: #7a5a00; }
.flash-err { background: #fde8e8; border-color: #f0a8a8; color: #8f1d1d; }
@media (prefers-color-scheme: dark) { .flash-ok { background: #17321f; color: #a5e0b9; border-color: #2d6a43; } .flash-warn { background: #3a3114; color: #f0d98a; border-color: #6d5a1c; } .flash-err { background: #3c1b1b; color: #f4b0b0; border-color: #7a2d2d; } .badge.premium { background: #4a3b10; color: #f3d98a; } .badge.sale, .badge.bad { background: #4a1e1e; color: #f4b0b0; } }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 12px; } .form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
textarea { resize: vertical; min-height: 70px; } input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.row2, .row3, .row4 { display: grid; gap: 10px; grid-template-columns: 1fr; } @media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: repeat(3, 1fr); } .row4 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 559px) { .row3.keep, .row4.keep { grid-template-columns: 1fr 1fr; } }
.check { flex-direction: row !important; align-items: flex-start; gap: 8px !important; font-weight: 400 !important; } .check input { width: 20px; min-height: 20px; margin-top: 3px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; } legend { font-weight: 700; padding: 0 6px; font-size: .92rem; }
.inline { display: inline; } .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .inline-form input[type=text], .inline-form input[type=date], .inline-form select { flex: 1 1 160px; width: auto; }
.mini { width: 90px !important; flex: 0 0 90px !important; text-align: right; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; } .filters input[type=search] { flex: 1 1 180px; width: auto; } .filters select { width: auto; flex: 0 1 auto; }
label.inline { display: inline-flex; align-items: center; gap: 6px; } label.inline input { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; } .chip { padding: 5px 12px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: .85rem; border: 1px solid var(--line); cursor: pointer; font: inherit; font-size: .85rem; }
.chip.sel, .chip:hover { background: var(--brand-l); border-color: var(--brand); color: var(--brand-d); text-decoration: none; }

/* Tableaux : cartes empilées sur mobile */
.table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; } td.act { text-align: right; white-space: nowrap; width: 1%; } tfoot th, tfoot td { border-bottom: 0; }
@media (max-width: 639px) {
  .rtable thead { display: none; } .rtable, .rtable tbody, .rtable tr, .rtable td, .rtable tfoot { display: block; width: 100%; }
  .rtable tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; margin: 0 0 10px; background: var(--surface); }
  .rtable td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right !important; width: 100% !important; }
  .rtable td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .8rem; text-align: left; flex: 0 0 38%; }
  .rtable td.act { justify-content: flex-end; }
  .rtable tfoot tr { background: var(--surface2); } .rtable tfoot th { display: inline-block; width: auto; }
}
.list { list-style: none; padding: 0; margin: 0; } .list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); } .list li:last-child { border: 0; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 12px; margin: 0 0 10px; } .kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.tabsbar { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 10px; margin: 0 0 8px; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.tabsbar a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: .9rem; } .tabsbar a.sel { background: var(--brand); color: #fff; } .tabsbar a:hover { text-decoration: none; background: var(--brand-l); } .tabsbar a.sel:hover { background: var(--brand); }

/* ---------- Tableau de bord / indicateurs ---------- */
.hello { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; } .hello h1 { margin: 0; font-size: 1.35rem; } .hello p { margin: 0; } .hello > div { flex: 1 1 200px; } .hello img, .companion-cta img { border-radius: 50%; background: var(--brand-l); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; } .stat-l { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } .stat-v { font-size: 1.7rem; font-weight: 800; line-height: 1.15; } .stat-v small { font-size: .9rem; font-weight: 600; color: var(--muted); } .stat-s { font-size: .82rem; color: var(--muted); }
.stat-s.good, .stat-v.good { color: var(--good); } .stat-s.bad, .stat-v.bad { color: var(--bad); }
.companion-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; } .companion-cta > div { flex: 1 1 200px; } .companion-cta p { margin: 0; }
.meter { height: 16px; border-radius: 999px; background: var(--surface2); overflow: hidden; border: 1px solid var(--line); } .meter-bar { height: 100%; background: linear-gradient(90deg, #68c48b, var(--brand)); border-radius: 999px; transition: width .4s ease; }
.meter.over .meter-bar { background: linear-gradient(90deg, #f6ad55, var(--bad)); } .meter-legend { margin: 6px 0 4px; font-size: .95rem; }
.score { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; } .score-num { font-size: 2.2rem; font-weight: 800; line-height: 1; } .score-num small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.score-good .score-num { color: var(--good); } .score-mid .score-num { color: var(--warn); } .score-low .score-num { color: var(--bad); } .score-txt { font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; } .chk { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; } .chk .dot { flex: 0 0 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--muted); }
.chk-ok .dot { background: var(--good); } .chk-warn .dot { background: #e6a817; } .chk-bad .dot { background: var(--bad); } .chk-info .dot { background: var(--info); }
.macrobar, .catbar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 8px 0; font-size: .75rem; color: #fff; font-weight: 700; } .macrobar span { display: grid; place-items: center; white-space: nowrap; padding: 0 4px; overflow: hidden; }
.m-p { background: #e57373; } .m-c { background: #c9a227; } .m-f { background: #5c8fd6; } .catbar { height: 12px; } .catbar span { display: block; }
.legend { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; } .catdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: baseline; }
.chart { width: 100%; min-height: 180px; } .chart svg { width: 100%; height: auto; display: block; } .chart .nodata { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- Journal ---------- */
.datebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; } .datebar form { margin: 0; } .datebar input[type=date] { width: auto; } .datelabel { font-weight: 700; margin-left: 4px; }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; } .weekstrip a { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); line-height: 1.2; }
.weekstrip a:hover { text-decoration: none; background: var(--brand-l); } .weekstrip a.sel { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); } .weekstrip small { color: var(--muted); font-size: .7rem; } .weekstrip b { font-size: 1rem; } .weekstrip em { font-style: normal; font-size: .7rem; color: var(--muted); } .weekstrip a.ok em { color: var(--good); font-weight: 700; } .weekstrip a.over em { color: var(--bad); font-weight: 700; }
.meal-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; } .meal-h h2 { margin: 0; flex: 1; }
.entries { list-style: none; margin: 0; padding: 0; } .entries li { border-top: 1px solid var(--line); } .entry > summary { display: flex; gap: 10px; align-items: center; padding: 9px 2px; list-style: none; } .entry > summary::-webkit-details-marker { display: none; }
.e-label { flex: 1; min-width: 0; overflow-wrap: anywhere; } .e-g { color: var(--muted); font-size: .85rem; white-space: nowrap; } .e-k { font-weight: 700; white-space: nowrap; min-width: 70px; text-align: right; }
.row-form { padding: 6px 0 12px; display: grid; gap: 10px; grid-template-columns: 1fr 1fr; } .row-form label:first-child, .row-form .btnrow, .row-form p { grid-column: 1 / -1; }
.meal-tools { margin-top: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; } .tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; font: inherit; font-weight: 600; color: var(--text); min-height: 40px; } .tab.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.live-kcal { align-self: end; padding: 10px 0; font-weight: 700; color: var(--brand-d); }
.ai-result { margin-top: 10px; padding: 12px; background: var(--brand-l); border-radius: 12px; font-size: .95rem; white-space: pre-wrap; } .ai-lookup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; } .avatar-opt { background: var(--surface2); border: 2px solid transparent; border-radius: 14px; padding: 4px; cursor: pointer; display: grid; place-items: center; } .avatar-opt.sel { border-color: var(--brand); background: var(--brand-l); } .avatar-opt img { border-radius: 50%; width: 100%; height: auto; max-width: 64px; }

/* ---------- Companeo (chat) ---------- */
.companion-fab { position: fixed; z-index: 34; right: 14px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--brand); background: var(--surface); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); cursor: pointer; padding: 0; display: grid; place-items: center; }
.companion-fab img { border-radius: 50%; } @media (min-width: 900px) { .companion-fab { bottom: 24px; right: 24px; } }
.chat-panel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-panel.floating { position: fixed; z-index: 50; right: 10px; left: 10px; bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom)); top: 70px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
@media (min-width: 900px) { .chat-panel.floating { left: auto; width: 400px; top: auto; height: 560px; bottom: 92px; right: 24px; } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--brand-l); } .chat-head img { border-radius: 50%; background: #fff; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 220px; max-height: 60vh; } .chat-panel.floating .chat-log { max-height: none; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; } .msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; } .msg.bot { align-self: flex-start; background: var(--surface2); border-bottom-left-radius: 4px; } .msg.err { background: #fde8e8; color: #8f1d1d; } .msg.wait { opacity: .7; font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); } .chat-form input { flex: 1; } .chat-foot { margin: 0; padding: 0 12px 8px; }
.companion-page .chat-log { max-height: 55vh; min-height: 320px; }

/* ---------- Publicité ---------- */
.ad { margin: 0 0 14px; text-align: center; overflow: hidden; } .ad-placeholder { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; color: var(--muted); font-size: .85rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); }
.ad-placeholder span { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }

/* ---------- Pages publiques ---------- */
.public-main { max-width: 1040px; margin: 0 auto; padding: 18px 14px 20px; } .hero { text-align: center; padding: 34px 6px 26px; } .hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); margin-bottom: .3em; } .lead { font-size: 1.1rem; color: var(--muted); max-width: 680px; margin: 0 auto 1.2em; }
.features h3 { color: var(--brand-d); } .plan { text-align: left; } .plan.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); } .price { font-size: 1.7rem; font-weight: 800; margin: .1em 0; } .plan ul { padding-left: 1.1em; margin: .6em 0 1em; } .plan li { margin: .25em 0; }
.cat-h { margin: 22px 0 8px; } .article-card { color: var(--text); display: block; } .article-card:hover { text-decoration: none; border-color: var(--brand); }
.public .topbar { position: static; }
.profile-grid > section.stack, .profile-grid > section.card { min-width: 0; }
@media print { .topbar, .sidenav, .bottomnav, .companion-fab, .ad, .chat-panel { display: none !important; } .shell { display: block; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* L'attribut hidden doit toujours masquer (sinon .form { display:flex } affiche les 4 onglets du journal en même temps) */
[hidden] { display: none !important; }
/* Journal : déplacer tout un repas / une ligne vers un autre repas */
.move-all, .move-meal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Poids : liste des mesures avec barre de défilement + filtre de dates (liste et graphiques) */
.scroll-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.scroll-list table { margin: 0; }
.scroll-list thead th { position: sticky; top: 0; z-index: 1; background: var(--surface2); }
.weight-filter .filters { margin-bottom: 4px; }
.weight-filter .filters label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; }
.weight-filter .filters input[type=date] { width: auto; }
@media (max-width: 639px) { .scroll-list { max-height: 420px; border: 0; } }

/* Provenance des aliments (journal, repas types, rapports) : recette | aliment utilisateur | aliment catalogue | aliment libre */
.origin { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  --oc: #999; color: var(--oc); background: color-mix(in srgb, var(--oc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--oc) 45%, transparent); }
.origin-recipe { --oc: #8e6bbf; } .origin-user { --oc: #3182ce; } .origin-catalog { --oc: #2f855a; } .origin-free { --oc: #dd6b20; }
@media (prefers-color-scheme: dark) { .origin-recipe { --oc: #b79be0; } .origin-user { --oc: #63b3ed; } .origin-catalog { --oc: #68d391; } .origin-free { --oc: #f6ad55; } }
.e-origin { flex: 0 0 9.8rem; min-width: 0; }
@media (max-width: 559px) { .e-origin { flex: 0 0 100%; } .entry > summary, .rg-head, .entries li.line { flex-wrap: wrap; } .e-label { flex: 1 1 8rem; } }

/* Recette repliable : en-tête (nom, quantité, kcal) + lignes des ingrédients */
.recipe-group { border-top: 1px solid var(--line); }
.recipe-group > .rg-head { display: flex; gap: 10px; align-items: center; padding: 9px 2px; font-weight: 700; cursor: pointer; background: color-mix(in srgb, #8e6bbf 7%, transparent); border-radius: 8px; }
.recipe-group > .rg-head .e-label { font-weight: 700; }
.rg-toggle { flex: 0 0 auto; width: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; cursor: pointer; }
.rg-toggle:hover { background: var(--surface2); }
.rg-body { padding: 0 0 6px 18px; border-left: 3px solid color-mix(in srgb, #8e6bbf 40%, transparent); margin-left: 12px; }
.rg-items { margin: 0; } .rg-items > li:first-child { border-top: 0; }
.rg-tools { padding: 4px 0 6px; }
.entries li.line { display: flex; gap: 10px; align-items: center; padding: 9px 2px; }
.qty-form { display: inline-flex; gap: 6px; } .qty-form .mini { min-height: 34px; padding: 4px 8px; }
.meal-lines .e-g { white-space: nowrap; }

/* ---------- Contenu riche des articles (rendu public + zone de l'éditeur) ---------- */
.prose h2 { margin: 1.4em 0 .4em; font-size: 1.35rem; } .prose h4 { margin: 1em 0 .3em; font-size: 1rem; }
.prose ol { padding-left: 1.4em; }
.prose blockquote { margin: 1em 0; padding: .6em 1em; border-left: 4px solid var(--brand); background: var(--brand-l); border-radius: 0 10px 10px 0; }
.prose blockquote p { margin: .3em 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 1em auto; }
.prose img.img-left { float: left; max-width: 45%; margin: .3em 1em .6em 0; } .prose img.img-right { float: right; max-width: 45%; margin: .3em 0 .6em 1em; }
.prose img.img-center { margin: 1em auto; max-width: 70%; } .prose img.img-full { width: 100%; max-width: 100%; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; } .prose .tbl { overflow-x: auto; margin: 1em 0; } .prose .tbl table { margin: 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45em .65em; text-align: left; vertical-align: top; } .prose th { background: var(--surface2); font-weight: 700; }
.prose .ta-left { text-align: left; } .prose .ta-center { text-align: center; } .prose .ta-right { text-align: right; } .prose .ta-justify { text-align: justify; }
.rt-body { display: flow-root; }
@media (max-width: 560px) { .prose img.img-left, .prose img.img-right { float: none; max-width: 100%; margin: 1em auto; } }

/* ---------- Éditeur visuel (superadmin) ---------- */
.rt { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: .3rem 0 .6rem; overflow: hidden; }
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface2); }
.rt-sub { background: var(--brand-l); } .rt-sub[hidden] { display: none; }
.rt-btn { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .95rem; cursor: pointer; line-height: 1; }
.rt-btn:hover { background: var(--surface); border-color: var(--line); } .rt-btn.on { background: var(--brand); color: #fff; }
.rt-txt { font-size: .82rem; height: 30px; } .rt-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.rt-select { height: 34px; min-height: 0; width: auto; padding: 0 8px; border-radius: 8px; font-size: .9rem; }
.rt-bar.rt-src .rt-btn:not([data-rt="source"]) { opacity: .4; pointer-events: none; }
.rt-area { min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 14px 16px; outline: none; background: var(--surface); }
.rt-area.card, .rt-area.prose { max-width: none; }
.rt-area img.rt-sel { outline: 3px solid var(--brand); outline-offset: 2px; cursor: pointer; }
.rt-area > div { margin: 0 0 1em; } .rt-area li > div, .rt-area td > div, .rt-area th > div { margin: 0; }
.rt-area table td, .rt-area table th { min-width: 40px; }
.rt-status { padding: 4px 12px; min-height: 1.4em; } .rt-status:empty { padding: 0; min-height: 0; }
textarea.rt-source { display: block; width: 100%; min-height: 320px; max-height: 70vh; border: 0; border-radius: 0; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
textarea.rt-source[hidden] { display: none; }
.rt-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); color: var(--text); width: min(92vw, 420px); }
.rt-dialog::backdrop { background: rgba(0, 0, 0, .45); } .rt-dialog h3 { margin: 0 0 8px; } .rt-dialog label { display: block; margin: 8px 0; }

/* ---------- Pages d'information (À propos, FAQ, Conditions, Confidentialité, Contact) ---------- */
.prose .lead { font-size: 1.1rem; color: var(--muted); }
.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin: 8px 0; background: var(--surface); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; } .faq details[open] summary { color: var(--brand-d); } .faq details p { margin: 0 0 12px; }
.contact .form { max-width: 560px; } .contact textarea { min-height: 160px; resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.foot a { color: var(--muted); } .foot a:hover { color: var(--brand); }

/* Sélecteur de langue (liste déroulante avec drapeaux) */
.langsel { position: relative; }
.langsel summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: .8rem; font-weight: 600; user-select: none; }
.langsel summary::-webkit-details-marker { display: none; }
.langsel summary:hover, .langsel[open] summary { background: var(--brand-l); }
.langsel .caret { font-size: .7rem; color: var(--muted); }
.langsel .flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); flex: none; }
.langsel-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; margin: 0; padding: 4px; list-style: none; min-width: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.langsel-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: .85rem; font-weight: 600; }
.langsel-menu a:hover { background: var(--surface2); text-decoration: none; }
.langsel-menu a.sel { background: var(--brand-l); color: var(--brand-d); }

/* Bandeau de consentement aux cookies */
.cookiebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.cookiebar[hidden] { display: none; }
.cookiebar-in { max-width: 860px; margin: 0 auto; background: var(--surface, #fff); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.cookiebar-txt { flex: 1 1 340px; font-size: .9rem; } .cookiebar-txt p { margin: 4px 0 0; color: var(--muted); }
.cookiebar-btns { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }
@media (max-width: 560px) { .cookiebar-btns { width: 100%; } .cookiebar-btns .btn { flex: 1; } }
@media (max-width: 760px) { body.app .cookiebar { bottom: 62px; } }
