:root{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#203530;background:#f5f6f1;--green:#194e49;--line:#d6e2da;--muted:#526b63}*{box-sizing:border-box}body{margin:0;min-width:280px}a{color:var(--green)}button,input,select,textarea{font:inherit}button,.quick{cursor:pointer}button,a,input,select,textarea,summary{outline-offset:3px}:focus-visible{outline:3px solid #d8792b}.skip{position:absolute;left:-9999px}.skip:focus{left:1rem;top:1rem;background:white;padding:.7rem;z-index:10}.top{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:12px max(18px,calc((100vw - 980px)/2));background:#fff;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:.6rem;text-decoration:none;font-weight:750;letter-spacing:-.02em;font-size:1.1rem}.brand img{object-fit:contain}main{max-width:980px;margin:auto;padding:26px 18px 100px;min-height:65vh}.page-heading{margin:10px 0 24px}.page-heading h1{font-size:clamp(2rem,6vw,3.3rem);line-height:1.05;letter-spacing:-.04em;margin:.3rem 0}.page-heading p{color:var(--muted);margin:.4rem 0}.eyebrow{text-transform:uppercase;letter-spacing:.14em;font-size:.72rem;font-weight:750;color:#9a6837!important}.card,.entry-card{background:#fff;border:1px solid var(--line);border-radius:20px;padding:22px;box-shadow:0 7px 30px #1238200b;margin-bottom:18px}.narrow{max-width:500px;margin:30px auto}.card h2,.timeline h2{font-size:1.25rem;margin:0 0 18px}form{display:grid;gap:16px}label{display:grid;gap:7px;font-weight:650}input:not([type=checkbox]):not([type=radio]):not([type=hidden]),textarea,select{width:100%;min-height:48px;border:1px solid #adc2b8;border-radius:12px;background:#fff;padding:10px 12px;color:inherit}textarea{min-height:100px;resize:vertical}input[type=file]{padding:10px!important}button,.primary{min-height:48px;padding:10px 18px;border:1px solid #afc7bc;border-radius:12px;background:#fff;color:var(--green);font-weight:700}.primary{background:var(--green);color:#fff;border-color:var(--green)}.link{border:0;background:none;padding:0;min-height:36px}.danger{color:#a1272c}.quick-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.quick{display:flex;align-items:center;gap:14px;min-height:110px;padding:22px;border-radius:19px;text-decoration:none;font-size:1.1rem;font-weight:750}.quick span{font-size:1.7rem}.quick.meal{background:#e6f4e9;color:#215e44}.quick.pain{background:#fff0e8;color:#8d4530}.quick.note{background:#e8edf9;color:#354d7c}.timeline{margin-top:32px}.entry-card{padding:18px}.entry-head{display:flex;justify-content:space-between;align-items:center;gap:10px;color:var(--muted);font-size:.9rem}.badge{display:inline-flex;padding:5px 10px;border-radius:99px;font-weight:750;color:#215e44;background:#e6f4e9}.badge.pain{color:#8d4530;background:#fff0e8}.badge.note{color:#354d7c;background:#e8edf9}.entry-desc{font-size:1.04rem;font-weight:650;white-space:pre-wrap;overflow-wrap:anywhere}.entry-card p{margin:10px 0}.entry-photo{max-width:100%;max-height:220px;border-radius:12px;object-fit:contain}.row-actions{display:flex;gap:22px;align-items:center;margin-top:16px}.row-actions a{font-weight:700}.row-actions form{display:block}.filters,.report-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:end}.filters button,.report-form button{width:100%}.check{display:flex;align-items:center;gap:10px;font-weight:500;min-height:40px}.check input{width:20px;height:20px;flex:none}.intensity{display:grid;grid-template-columns:repeat(11,1fr);gap:6px}.intensity label{display:block}.intensity input{position:absolute;opacity:0}.intensity span{display:grid;place-items:center;min-height:48px;border:1px solid var(--line);border-radius:10px}.intensity input:checked+span{background:var(--green);color:#fff}.intensity input:focus-visible+span{outline:3px solid #d8792b}fieldset{border:0;padding:0;margin:0}legend{font-weight:700;margin-bottom:10px}details{padding:14px 0;border-top:1px solid var(--line)}details>*:not(summary){margin-top:15px}summary{font-weight:700;cursor:pointer;min-height:44px;padding:10px 0}.sub-links{display:flex;gap:20px;margin-top:20px}.flash{border-radius:12px;padding:12px 16px;background:#e5f3ea;color:#174936}.flash.error{background:#fff0e8;color:#8d2f28}.flashes{max-width:980px;margin:15px auto 0;padding:0 18px}.empty{background:#fff;padding:20px;border-radius:14px;color:var(--muted)}.admin-user{display:grid;gap:5px;border-top:1px solid var(--line);padding:16px 0}.admin-user span{color:var(--muted);overflow-wrap:anywhere}.admin-user form{display:block}footer{max-width:980px;margin:0 auto;padding:20px 18px 110px;color:var(--muted);font-size:.88rem}.bottom{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:center;gap:4px;padding:7px max(10px,calc((100vw - 980px)/2)) calc(7px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);z-index:5}.bottom a{display:grid;place-items:center;flex:1;max-width:180px;min-height:52px;text-align:center;text-decoration:none;color:var(--muted);font-size:1.2rem;border-radius:11px}.bottom a span{font-size:.78rem}.bottom a[aria-current=page]{background:#e3f1e9;color:var(--green);font-weight:750}@media(max-width:650px){main{padding:18px 14px 95px}.quick-actions{grid-template-columns:1fr;gap:10px}.quick{min-height:66px;padding:14px 20px}.filters,.report-form{grid-template-columns:1fr 1fr}.filters label:nth-child(3){grid-column:1/3}.filters button,.report-form button{grid-column:1/3}.report-form .check{grid-column:1/3}.intensity{grid-template-columns:repeat(6,1fr)}.card{padding:18px}.bottom a{font-size:1rem}.bottom a span{font-size:.68rem}.entry-head{align-items:flex-start;flex-direction:column}}
:root{--footer-height:calc(42px + env(safe-area-inset-bottom))}
body{min-height:100dvh}
main{padding-bottom:calc(100px + var(--footer-height))}
.site-footer{position:fixed;left:0;right:0;bottom:0;z-index:20;display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap;gap:10px;width:100%;max-width:none;height:var(--footer-height);margin:0;padding:0 18px env(safe-area-inset-bottom);background:#102f2b;border-top:1px solid #ffffff24;color:#e7f0eb;font-size:.76rem;white-space:nowrap}
.site-footer a{color:inherit;text-decoration:none}
.site-footer a:hover,.site-footer a:focus-visible{text-decoration:underline}
.footer-links{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}
.footer-short{display:none}
.has-nav .bottom{bottom:var(--footer-height);padding-bottom:7px}
@media(max-width:650px){
  .site-footer{gap:5px;padding-inline:8px;font-size:.64rem}
  .footer-links{gap:4px}
  .footer-long{display:none}
  .footer-short{display:inline}
  .has-nav main{padding-bottom:calc(100px + var(--footer-height))}
}
@media(max-width:350px){.footer-year{display:none}.site-footer{font-size:.61rem}}

/* Accueil et saisie du journal */
.theme-meal { --tap-ink: #21563f; --tap-fill: #e6f4e9; }
.theme-pain { --tap-ink: #853d30; --tap-fill: #fff0e8; }
.theme-note { --tap-ink: #374b81; --tap-fill: #e8edf9; }

.today-screen main, .entry-screen main { max-width: 650px; }
.today-title { margin: 3px 0 17px; font-size: clamp(1.8rem, 6vw, 2.45rem); }

.log-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.log-action {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  min-height: 84px;
  border: 1px solid color-mix(in srgb, var(--tap-ink) 21%, transparent);
  border-radius: 17px;
  background: var(--tap-fill);
  color: var(--tap-ink);
  font-size: clamp(.95rem, 4vw, 1.12rem);
  font-weight: 750;
  text-decoration: none;
  touch-action: manipulation;
}

.log-action span { font-size: 1.4rem; line-height: 1; }
.log-action:active { background: var(--tap-ink); color: white; }
.today-screen .timeline { margin-top: 25px; }

.entry-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 8px;
  padding: env(safe-area-inset-top) max(14px, calc((100% - 622px) / 2)) 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.entry-bar h1 { margin: 0; font-size: 1.06rem; }
.entry-back {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 53px;
  font-weight: 700;
  text-decoration: none;
}

.entry-screen main { padding-bottom: calc(96px + var(--footer-height)); }
.entry-screen .entry-form { gap: 22px; }
.tap-group legend { margin-bottom: 9px; font-size: 1.05rem; }
.tap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.tap-grid.tap-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tap-grid.tap-scale { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tap-choice { position: relative; display: block; min-width: 0; cursor: pointer; }
.tap-group { position: relative; }
.tap-group legend { padding-right: 78px; }
.choice-edit { position: absolute; top: -37px; right: 0; z-index: 3; min-height: 38px; padding: 4px 8px; border: 0; background: transparent; font-size: .85rem; }
.tap-item { position: relative; display: block; min-width: 0; }
.tap-item .tap-choice { height: 100%; }
.choice-remove { display: none; position: absolute; top: -8px; left: -7px; z-index: 2; width: 27px; height: 27px; min-height: 27px; padding: 0; border: 2px solid white; border-radius: 50%; background: #c63c43; color: white; font-size: 1.15rem; line-height: 1; box-shadow: 0 2px 7px #0003; }
.editing-choices .choice-remove { display: grid; place-items: center; }
.editing-choices .tap-item:not(.other-item) .tap-choice { animation: choice-wiggle .22s ease-in-out infinite alternate; transform-origin: 50% 75%; }
@keyframes choice-wiggle { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
@media (prefers-reduced-motion: reduce) { .editing-choices .tap-item { animation: none !important; } }
.choice-new { margin-top: 10px; }
.choice-new[hidden] { display: none; }

.tap-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tap-choice span {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 50px;
  padding: 6px 4px;
  border: 1px solid #bacbc3;
  border-radius: 12px;
  background: #fff;
  color: var(--tap-ink);
  font-size: clamp(.82rem, 3.55vw, 1rem);
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.tap-choice input:checked + span { border-color: var(--tap-ink); background: var(--tap-ink); color: white; }
.tap-choice input:focus-visible + span { outline: 3px solid #d8792b; outline-offset: 2px; }
.tap-scale span { font-size: 1rem; }
.entry-details { padding: 0; }
.entry-details[open] { padding-bottom: 8px; }
.entry-details summary { color: var(--green); }

.entry-save {
  position: fixed;
  right: 0;
  bottom: var(--footer-height);
  left: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.entry-save button {
  width: min(100%, 614px);
  min-height: 53px;
  border-color: var(--tap-ink);
  background: var(--tap-ink);
}

.entry-save button:disabled { opacity: .7; cursor: wait; }
.entry-keywords { display: flex; flex-wrap: wrap; gap: 5px; padding: 0; list-style: none; }
.entry-keywords li { padding: 4px 9px; border-radius: 12px; background: #edf3ee; font-size: .88rem; }
.report-stats { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-bottom: 20px; }
.report-stats div { display: grid; gap: 5px; padding: 14px 8px; border-radius: 12px; background: #edf4ee; text-align: center; }
.report-stats strong { color: var(--green); font-size: 1.55rem; }
.report-stats span { color: var(--muted); font-size: .78rem; }
.report-actions p { margin: 0; }
.pattern-filter { display: flex; align-items: end; }
.pattern-filter label { flex: 1; }
.pattern-card h3 { margin: 0 0 9px; color: var(--green); }
.pattern-card p { margin: 5px 0; }
.pattern-difference { color: var(--green); font-weight: 700; }
.notice { padding: 14px; border-left: 4px solid #b77740; border-radius: 8px; background: #fff5e9; }
.muted { color: var(--muted); }
.legal { max-width: 760px; margin-inline: auto; line-height: 1.65; }
.legal h2 { margin: 25px 0 8px; color: var(--green); font-size: 1.18rem; }
.legal p { margin: 9px 0; }
.legal-meta { color: var(--muted); font-size: .9rem; }
@media(max-width:650px) { .report-stats { grid-template-columns: repeat(3,minmax(0,1fr)); } .pattern-filter { display: grid; } }

@media (max-width: 355px) {
  .tap-grid, .tap-grid.tap-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tap-grid.tap-scale { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
