:root {
  --bg: #0e1012; --card: #181b1f; --line: #262a30; --text: #eef0f2; --muted: #8b939c;
  --accent: #c6f04d; --accent-ink: #141a00; --warn: #ffb454;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
button, summary, .tap { -webkit-user-select: none; user-select: none; transition: transform .08s, background-color .15s, opacity .15s; }
button:active, .tap:active { transform: scale(.96); opacity: .75; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 0;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
h1 { font-size: 26px; margin: 4px 0 2px; letter-spacing: -0.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 0 8px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }
.btn { background: var(--line); border-radius: 12px; padding: 12px 16px; min-height: 44px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; border: 1px solid var(--line); }
.btn.danger { color: #ff7b72; }

/* Navigation des jours */
.daynav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.daynav button { width: 52px; height: 52px; font-size: 24px !important; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 18px; }
.daynav .title { text-align: center; }
.daynav .title b { display: block; font-size: 20px; }
.daynav .title b::first-letter { text-transform: uppercase; }

/* Compteurs */
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gauge .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gauge .num span { font-size: 14px; font-weight: 500; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }

/* Repas */
.meal.done { border-color: #46551a; }
.meal .slot { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meal .name { font-weight: 650; font-size: 17px; margin: 2px 0 2px; }
.meal .macro { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meal ul { list-style: none; padding: 0; margin: 10px 0; }
.meal li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 15px; }
.meal li span:last-child { color: var(--accent); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meal .head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: -14px; padding: 14px; width: calc(100% + 28px); border-radius: 16px; }
.check { width: 48px; height: 48px; border-radius: 50%; border: 2px solid #3a4048; flex: none; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: transparent; }
.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.meal.done .name { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); border: 1px solid #46551a; border-radius: 999px; padding: 1px 8px; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.meal .actions { display: flex; gap: 8px; align-items: center; }
details { flex: 1; }
details summary { color: var(--text); font-size: 15px; cursor: pointer; padding: 12px 14px; min-height: 44px; background: var(--line); border-radius: 12px; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 4px; }
details ol { margin: 6px 0 0; padding-left: 20px; font-size: 15px; }
details li { display: list-item; border: 0; padding: 3px 0; }
details li::marker { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 11px 14px; font-size: 15px; background: var(--bg); }
.list-line { display: flex; align-items: center; gap: 12px; padding: 13px 0; min-height: 52px; border-top: 1px solid var(--line); }
.list-line:first-child { border-top: 0; }
.list-line .grow { flex: 1; min-width: 0; }
.list-line .qty { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-line.off .grow { text-decoration: line-through; color: var(--muted); }
.list-line .brand { display: block; font-size: 13px; color: var(--muted); text-decoration: none; }
.box { width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: transparent; font-size: 14px; }
.off .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.x { color: var(--muted); font-size: 22px; width: 44px; height: 44px; margin: -10px -10px -10px 0; }

.notice { border-left: 3px solid var(--accent); }
.notice.warn { border-left-color: var(--warn); }
.big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
svg.chart { width: 100%; height: auto; display: block; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Onglets */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: #121417; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
#tabs { padding-left: 8px; padding-right: 8px; gap: 6px; padding-top: 8px; }
#tabs button { flex: 1; max-width: 140px; padding: 12px 0; margin-bottom: 8px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--muted); }
#tabs button.on { color: var(--accent-ink); background: var(--accent); }

/* Feuille de choix */
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
#sheet[hidden] { display: none; }
#sheet .panel {
  background: var(--card); width: 100%; max-width: 560px; max-height: 80vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
#sheet .optrow { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
#sheet .opt { display: block; flex: 1; text-align: left; padding: 14px 0; min-height: 56px; }
#sheet .pin { font-size: 13px; padding: 8px 10px; min-height: 40px; }
#sheet .pin.on { background: var(--accent); color: var(--accent-ink); }
#sheet .opt b { display: block; font-weight: 600; }
#sheet .opt.cur b { color: var(--accent); }
