/* DA « Calendrier » — blanc, Manrope, accent rouge, couleur par livret */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&display=swap');

:root {
  --bg: #FFFFFF;
  --surface: #F7F7F6;
  --line: #EBEBEA;
  --text: #131313;
  --muted: #8A8A86;
  --accent: #E5484D;
  --accent-soft: #FDECEC;
  --ok: #30A46C;
  --warn: #B4610E;
  --warn-soft: #FFF4E5;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111; --surface: #1A1A1A; --line: #2A2A2A; --text: #EDEDED; --muted: #8C8C88;
    --accent-soft: #3A1E1F; --warn-soft: #33260F; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 'Manrope', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 16px 40px; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 32px 0 10px; }
.sub { color: var(--muted); margin: 0 0 24px; }
a { color: inherit; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; font-size: 13px; color: var(--muted); }
.topbar a { text-decoration: none; }
.topbar a:hover { color: var(--text); }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--text); outline-offset: -1px; }
input[type=file] { font: inherit; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); font: 600 14px 'Manrope', sans-serif;
  padding: 11px 18px; border-radius: 999px; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .4; cursor: default; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; font-weight: 600; }
.stat small { color: var(--muted); font-size: 12px; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; align-items: baseline; padding: 10px 0 10px 12px; border-left: 3px solid var(--c, var(--accent)); margin-bottom: 6px; }
.row .num { color: var(--muted); font-size: 12px; width: 22px; flex-shrink: 0; }
.row .t { flex: 1; font-weight: 500; }
.row .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.row.archived { opacity: .45; text-decoration: line-through; }

.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.tag.new { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 13px; margin: 12px 0; }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.rename { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rename input { width: 18px; height: 18px; accent-color: var(--text); }
.actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row { flex-wrap: wrap; }
  .row .meta { width: 100%; padding-left: 34px; }
}

/* ───────────── Jour 2 : app ───────────── */
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.wrap { max-width: 560px; padding-top: max(20px, env(safe-area-inset-top)); }
button { font: inherit; color: inherit; }

.toast { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  animation: toast 3.2s ease forwards; box-shadow: 0 6px 24px rgba(0,0,0,.12); max-width: calc(100% - 32px); }
@keyframes toast { 0%{opacity:0;transform:translate(-50%,-8px)} 8%,85%{opacity:1;transform:translate(-50%,0)} 100%{opacity:0;visibility:hidden} }

/* Barre d'onglets */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 10px 8px calc(12px + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.tabbar svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--text); }
.tabbar a.on svg { stroke-width: 2.1; }

/* En-tête du jour */
.head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.head h1 { font-size: 28px; }
.countdown { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.countdown b { color: var(--accent); font-weight: 600; }

/* Bande semaine */
.week { display: grid; grid-template-columns: 22px repeat(7, 1fr) 22px; align-items: start; gap: 2px; margin: 0 -6px 20px; }
.week .nav { display: flex; align-items: center; justify-content: center; height: 46px; color: var(--muted); text-decoration: none; font-size: 18px; }
.week .day { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text); padding: 6px 0 4px; border-radius: 12px; }
.week .day small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.week .day b { font-size: 16px; font-weight: 500; margin-top: 1px; font-variant-numeric: tabular-nums; }
.week .day.today b { color: var(--accent); font-weight: 600; }
.week .day.sel { background: var(--text); }
.week .day.sel small, .week .day.sel b { color: var(--bg); }
.week .day.off b { color: var(--muted); }
.dots { display: flex; gap: 2px; height: 6px; margin-top: 5px; justify-content: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c, var(--accent)); }
.dots i.d { opacity: .3; }

.dayline { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 12px; }
.dayline h2 { margin: 0; font-size: 15px; }
.dayline span { font-size: 12px; color: var(--muted); }

/* Tâches */
.slot { display: grid; grid-template-columns: 50px 1fr; gap: 0 10px; margin-bottom: 10px; }
.slot > .lbl { font-size: 12px; color: var(--muted); padding-top: 12px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item { position: relative; display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--c, var(--accent));
  padding: 8px 4px 8px 12px; transition: opacity .25s; }
.item .txt { flex: 1; min-width: 0; }
.item .t { font-weight: 500; line-height: 1.3; }
.item .m { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item.done { opacity: .5; }
.item.done .t { text-decoration: line-through; }
.item.done { border-left-color: var(--line); }
.late { color: var(--accent); font-weight: 600; }

.check { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: 1.6px solid var(--line); background: transparent; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, border-color .15s, transform .1s; padding: 0; }
.check svg { width: 15px; height: 15px; stroke: var(--bg); stroke-width: 2.6; fill: none; opacity: 0; transition: opacity .15s; }
.check:active { transform: scale(.9); }
.item.done .check { background: var(--text); border-color: var(--text); }
.item.done .check svg { opacity: 1; }
.more { flex-shrink: 0; width: 28px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; letter-spacing: 1px; padding: 0; }
.menu { position: absolute; right: 36px; top: 100%; z-index: 20; margin-top: -4px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1); padding: 4px; min-width: 190px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; cursor: pointer; text-decoration: none; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--surface); }

.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.empty b { display: block; color: var(--text); font-size: 16px; font-weight: 500; margin-bottom: 4px; }

.duo-mini { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 12px; font-size: 13px; color: var(--muted); }
.duo-mini, .duo-mini a { text-decoration: none; }
.pip { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }

/* Semaine */
.wday { padding: 14px 0; border-bottom: 1px solid var(--line); }
.wday-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.wday-h b { font-weight: 600; text-transform: capitalize; }
.wday-h b.is-today { color: var(--accent); }
.wday-h span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.bar i { display: block; height: 100%; background: var(--text); border-radius: 2px; }
.bar.over i { background: var(--accent); }
.mini { display: flex; gap: 8px; align-items: baseline; border-left: 3px solid var(--c); padding: 3px 0 3px 10px; font-size: 14px; margin-bottom: 4px; }
.mini .t { flex: 1; }
.mini small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.mini.done { opacity: .45; text-decoration: line-through; border-left-color: var(--line); }
.weeknav { display: flex; gap: 8px; }
.weeknav a { text-decoration: none; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; }

/* Duo */
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.person { border-radius: 16px; padding: 14px; background: var(--surface); }
.person.me { background: var(--text); color: var(--bg); }
.person .big { font-size: 34px; font-weight: 600; line-height: 1; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.person small { display: block; font-size: 12px; opacity: .7; line-height: 1.6; }
.lv { margin-bottom: 14px; }
.lv-h { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.lv-h span { color: var(--muted); font-size: 12px; }
.lv .bar { margin-bottom: 4px; height: 6px; }
.lv .bar i { background: var(--c); }

/* Cours */
.crow { border-left: 3px solid var(--c); padding: 0 0 0 12px; margin-bottom: 6px; }
.crow > summary { list-style: none; display: flex; gap: 10px; align-items: baseline; padding: 8px 0; cursor: pointer; }
.crow > summary::-webkit-details-marker { display: none; }
.crow .t { flex: 1; font-weight: 500; }
.st { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.st.vu { background: var(--text); color: var(--bg); }
.st.late { background: var(--accent-soft); color: var(--accent); }
.cpanel { padding: 4px 0 14px; display: grid; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.inline input[type=date], .inline input[type=number], .inline input[type=text] { width: auto; flex: 1; min-width: 120px; padding: 8px 10px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--accent); border: 1px solid var(--accent-soft); }
.timeline { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.timeline .ok { color: var(--text); }

/* Réglages */
.section { margin-bottom: 30px; }
.section h2 { margin-top: 0; }
.days { display: grid; gap: 6px; }
.days label { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); text-transform: capitalize; }
.days select { width: 110px; padding: 7px 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label { text-align: center; padding: 9px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.seg-help { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; }
.chip button { border: 0; background: var(--line); border-radius: 50%; width: 20px; height: 20px; cursor: pointer; line-height: 1; padding: 0; color: var(--muted); }
input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.callout { border-radius: 16px; padding: 18px; background: var(--surface); margin: 8px 0 20px; }
.callout b { display: block; font-size: 16px; margin-bottom: 4px; }
.callout p { margin: 0 0 14px; color: var(--muted); }

/* ───────────── Jour 3 : cas cliniques ───────────── */
.enonce { background: var(--surface); border-radius: 16px; padding: 16px 18px; line-height: 1.6; margin-bottom: 22px; }
.q { margin-bottom: 18px; }
.q-h { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.q-n { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.q-h b { font-weight: 600; line-height: 1.4; }
textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; min-height: 80px; }
textarea:focus { outline: 2px solid var(--text); outline-offset: -1px; }
.q-rep { padding: 10px 12px; border-left: 3px solid var(--line); color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.q-corr { border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.5; background: var(--surface); }
.q-ok .q-corr { background: color-mix(in srgb, var(--ok) 11%, transparent); }
.q-part .q-corr { background: var(--warn-soft); }
.q-ko .q-corr { background: var(--accent-soft); }
.verdict { font-weight: 700; margin-right: 4px; }
.q-ok .verdict { color: var(--ok); } .q-part .verdict { color: var(--warn); } .q-ko .verdict { color: var(--accent); }
.q-ok .q-n { background: var(--ok); } .q-part .q-n { background: var(--warn); } .q-ko .q-n { background: var(--accent); }
.pageref { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.attendu { font-size: 13px; color: var(--muted); margin-top: 6px; }
.attendu summary { cursor: pointer; font-weight: 500; padding: 4px 0; }
.score { display: flex; gap: 16px; align-items: center; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 6px; }
.score b { font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.score b small { font-size: 16px; color: var(--muted); font-weight: 500; }
.score p { margin: 0; font-size: 14px; color: var(--muted); }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 24px; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.hist { display: flex; gap: 10px; align-items: center; border-left: 3px solid var(--c); padding: 8px 0 8px 12px; margin-bottom: 6px; text-decoration: none; }
.hist .t { flex: 1; font-weight: 500; }
.hist small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gear { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.gear { text-decoration: none; color: var(--text); }
.gear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gauge { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.gauge i { display: block; height: 100%; background: var(--text); }

/* Choix de couleur en pastilles */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--s);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--s); }
.swatch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 4px; }
.lv-edit { padding: 12px 0 14px; border-bottom: 1px solid var(--line); }
.lv-edit:first-of-type { padding-top: 0; }
