:root {
  --bg: #FBF8F3;
  --card: #FFFFFF;
  --ink: #1F1B16;
  --muted: #7A7268;
  --line: #E8E1D6;
  --accent: #B5523B;
  --paris: #D6E4FB;   --paris-ink: #1E4BA8;
  --kids: #FFD2AE;    --kids-ink: #B4530F;  --kids-band: #F08A3C;
  --bedoule: #CDEFD7; --bedoule-ink: #1D7A43;
  --ailleurs: #E6D9F7;--ailleurs-ink: #6B3FC4;
  --vac: #F2C230;
  --ferie: #C62828;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--ferie); min-height: 1.4em; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.logo { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 20px; background: var(--accent); color: #fff; font: 600 30px/72px Georgia, serif; letter-spacing: -1px; }
.login h1 { margin: 4px 0; font: 600 32px Georgia, serif; }
.login .field { text-align: left; margin: 18px 0; }

/* ---------- structure */
#app { padding-top: var(--safe-t); padding-bottom: calc(76px + var(--safe-b)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-t)) 8px 8px; margin-top: calc(-1 * var(--safe-t)); background: var(--bg); }
.top .title { flex: 1; font: 600 22px Georgia, serif; text-transform: capitalize; padding: 6px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; font-size: 30px; line-height: 1; color: var(--accent); }
.icon-btn:active { background: var(--line); }
main { padding: 0 12px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabs button { flex: 1; padding: 8px 0 6px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; }
.tabs .ti { font-size: 21px; line-height: 1.1; }
.tabs button.on { color: var(--accent); font-weight: 600; }
.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 6; width: 58px; height: 58px; border-radius: 29px; background: var(--accent); color: #fff; font-size: 30px; box-shadow: 0 6px 18px rgba(120,50,30,.35); }
.banner { margin: 0 12px 8px; padding: 10px 14px; border-radius: 12px; background: #FFF3CD; font-size: 15px; }

/* ---------- calendrier */
.dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 13px; color: var(--muted); padding: 2px 0 4px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.day { position: relative; aspect-ratio: 1 / 1.18; border-radius: 10px; padding: 4px 4px 3px; text-align: left; display: flex; flex-direction: column; overflow: hidden; background: var(--paris); }
.day.out { opacity: .35; }
.day.paris { background: var(--paris); }
.day.paris.kids { background: var(--kids); }
.day.bedoule { background: var(--bedoule); }
.day.ailleurs { background: var(--ailleurs); }
.day.kids::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--kids-band); }
.day.paris.kids::after { display: none; }
.day.vac { box-shadow: inset 0 3px 0 var(--vac); }
.day .n { font-weight: 600; font-size: 16px; line-height: 1.1; }
.day.we .n { color: var(--muted); }
.day.ferie .n { color: var(--ferie); }
.day.today { outline: 2.5px solid var(--ink); outline-offset: -2.5px; }
.day.sel { outline: 3px solid var(--accent); outline-offset: -3px; }
.day .fl { font-size: 9.5px; line-height: 1.05; color: var(--ferie); font-weight: 600; margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.day .bottom { margin-top: auto; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-height: 14px; padding-bottom: 3px; }
.badge { font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 5px; line-height: 15px; background: var(--ink); color: #fff; }
.badge.tt { background: #fff; color: var(--ink); border: 1px solid var(--ink); line-height: 13px; }
.badge.tte { background: #fff; color: #7A3E00; border: 1px dashed #7A3E00; line-height: 13px; }
.dot { width: 7px; height: 7px; border-radius: 4px; background: var(--accent); }
.dot.resa { background: #333; border-radius: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 2px 4px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 18px; border-radius: 5px; display: inline-block; position: relative; overflow: hidden; }
.sw.kidsband::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--kids-band); }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.summary div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.summary b { display: block; font-size: 24px; font-family: Georgia, serif; }
.summary small { color: var(--muted); font-size: 13px; }
.selbar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: 12px; font-size: 15px; }
.selbar button { margin-left: auto; color: #fff; text-decoration: underline; }

/* ---------- listes */
.section-title { font: 600 19px Georgia, serif; margin: 22px 2px 8px; }
.month-sep { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 2px 6px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; width: 100%; }
.item .when { min-width: 52px; text-align: center; }
.item .when b { display: block; font: 600 22px/1 Georgia, serif; }
.item .when small { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.item .what { flex: 1; min-width: 0; }
.item .what .t { font-weight: 600; }
.item .what .s { font-size: 14px; color: var(--muted); }
.item .ico { font-size: 22px; }
.item.garde { border-left: 5px solid var(--kids-band); }
.item.lieu-bedoule { border-left: 5px solid var(--bedoule-ink); }
.item.ferie { border-left: 5px solid var(--ferie); }
.item.abs { border-left: 5px solid var(--ink); }
.item.vac { border-left: 5px solid var(--vac); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.linkbtn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #F3EEE6; text-decoration: none; color: var(--ink); font-weight: 600; margin: 6px 0; word-break: break-word; }
.linkbtn::after { content: "↗"; margin-left: auto; color: var(--accent); }

/* ---------- cartes / formulaires */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 10px 0; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-height: 48px; }
.field textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 12px; background: #F0EAE0; font-weight: 600; min-height: 48px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: #FBE4E1; color: var(--ferie); }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 15px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btns .btn { flex: 1; }
.seg { display: flex; background: #EFE8DD; border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 10px; font-size: 15px; min-height: 42px; }
.seg button.on { background: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.big button { padding: 12px; font-size: 17px; }
.seg.lieux button.on[data-v="paris"] { background: var(--paris); color: var(--paris-ink); }
.seg.lieux button.on[data-v="bedoule"] { background: var(--bedoule); color: var(--bedoule-ink); }
.seg.lieux button.on[data-v="ailleurs"] { background: var(--ailleurs); color: var(--ailleurs-ink); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; min-height: 48px; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: #DDD5C9; position: relative; transition: .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked { background: var(--kids-band); }
.switch input:checked::after { left: 23px; }
.counter { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px 12px; align-items: center; }
.counter .h { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.counter input { width: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.counter .rest { font: 600 20px Georgia, serif; text-align: right; min-width: 44px; }
.counter .rest.neg { color: var(--ferie); }
.opt { border-radius: 14px; padding: 12px; background: var(--card); border: 1px solid var(--line); }
.opt .big { font: 600 20px Georgia, serif; }
.opt .ratio { display: inline-block; padding: 2px 8px; border-radius: 8px; background: var(--bedoule); color: var(--bedoule-ink); font-weight: 700; font-size: 14px; }
.opt .ratio.mid { background: #FFF0C2; color: #7A5A00; }
.opt .ratio.low { background: #EFE8DD; color: var(--muted); }
.strip { display: flex; gap: 2px; margin: 8px 0; }
.strip i { flex: 1; height: 26px; border-radius: 4px; font-style: normal; font-size: 10px; display: grid; place-items: center; color: var(--muted); background: #EFE8DD; }
.strip i.off { background: var(--bedoule); color: var(--bedoule-ink); }
.strip i.fer { background: #FAD4D0; color: var(--ferie); font-weight: 700; }
.strip i.pose { background: var(--accent); color: #fff; font-weight: 700; }
.strip i.cp { background: var(--ink); color: #fff; }
.total { padding: 14px; border-radius: 14px; background: var(--ink); color: #fff; margin: 10px 0; }
.total b { font: 600 26px Georgia, serif; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; background: #F7F3EC; }

/* ---------- feuille du bas */
.sheet-bg { position: fixed; inset: 0; background: rgba(30,20,10,.35); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); border-radius: 20px 20px 0 0; padding: 8px 16px calc(24px + var(--safe-b)); box-shadow: 0 -8px 30px rgba(0,0,0,.18); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #D5CCBF; margin: 2px auto 8px; }
.sheet h2 { font: 600 24px Georgia, serif; margin: 4px 0 2px; }
.sheet h2::first-letter { text-transform: uppercase; }
.sheet .close { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 20px; background: #EFE8DD; font-size: 20px; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; font-weight: 600; margin: 6px 0; }
.tagline { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tag { font-size: 13px; padding: 3px 9px; border-radius: 8px; background: #EFE8DD; }
.tag.fer { background: #FAD4D0; color: var(--ferie); }
.tag.vac { background: #FCEBB0; color: #6E5200; }
.link-row { display: flex; gap: 6px; margin: 6px 0; }
.link-row input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.link-row input.lbl { flex: 0 0 34%; }
.link-row button { width: 40px; border-radius: 10px; background: #EFE8DD; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #F3EEE6; border-radius: 10px; margin: 6px 0; font-size: 15px; }
.file-row a { flex: 1; color: var(--ink); word-break: break-all; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); z-index: 30; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 15px; max-width: 90vw; text-align: center; }
@media (min-width: 700px) { main { max-width: 680px; margin: 0 auto; } .sheet { max-width: 620px; margin: 0 auto; } }

/* Hervé */
.hb { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px; font: 700 11px/17px -apple-system, sans-serif; text-align: center; color: #fff; background: #1E3A8A; font-style: normal; display: inline-block; }
.hb.ailleurs { background: #6B3FC4; }
.hb.bedoule { background: var(--bedoule-ink); }
.item.herve { border-left: 5px solid #1E3A8A; }
.summary div:last-child:nth-child(odd) { grid-column: span 2; }
.btn:disabled { opacity: .45; cursor: default; }
