/* AnemiApp — design system (cahier des charges §12)
   Layout: mobile-first shell — sticky header, single content column, fixed 6-tab bar;
   from 960px the tab bar becomes a left sidebar and lists turn into 2–3 column grids. */
:root {
  --brick: #B5442E;          /* couleur principale */
  --brick-dark: #8F2E22;     /* rouge foncé */
  --brick-soft: #F6E7E3;
  --bg: #F7F7F7;
  --surface: #FFFFFF;
  --surface-2: #F1EFEE;
  --line: #E4E0DE;
  --ink: #171717;
  --ink-2: #707070;
  --on-brick: #FFFFFF;
  --ok: #1E7A4C;  --ok-soft: #E3F2EA;
  --warn: #9A6200; --warn-soft: #FBF0D9;
  --off: #5E5E5E; --off-soft: #ECECEC;
  --info: #2D5B8A; --info-soft: #E5EEF7;
  --danger: #B42318; --danger-soft: #FCE8E6;
  --shadow: 0 1px 2px rgba(23,23,23,.05), 0 4px 14px rgba(23,23,23,.06);
  --shadow-lg: 0 10px 40px rgba(23,23,23,.18);
  --radius: 16px; --radius-sm: 10px;
  --font-display: 'Lexend', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tab-h: 64px;
  --header-h: 72px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brick: #DD6A51; --brick-dark: #F08A73; --brick-soft: #3A221D;
    --bg: #121110; --surface: #1C1A19; --surface-2: #262322; --line: #34302E;
    --ink: #F3F0EF; --ink-2: #A9A3A0; --on-brick: #1A0E0B;
    --ok: #5CC28E; --ok-soft: #173326; --warn: #E9B04C; --warn-soft: #3A2C12;
    --off: #A0A0A0; --off-soft: #2B2B2B; --info: #8DB7E2; --info-soft: #1B2938;
    --danger: #F2827A; --danger-soft: #3A1D1B;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brick: #DD6A51; --brick-dark: #F08A73; --brick-soft: #3A221D;
  --bg: #121110; --surface: #1C1A19; --surface-2: #262322; --line: #34302E;
  --ink: #F3F0EF; --ink-2: #A9A3A0; --on-brick: #1A0E0B;
  --ok: #5CC28E; --ok-soft: #173326; --warn: #E9B04C; --warn-soft: #3A2C12;
  --off: #A0A0A0; --off-soft: #2B2B2B; --info: #8DB7E2; --info-soft: #1B2938;
  --danger: #F2827A; --danger-soft: #3A1D1B;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0; }
a { color: var(--brick); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brick) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.xsmall { font-size: .8rem; }
.eyebrow { font-family: var(--font-display); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.demo-bar { background: var(--ink); color: var(--bg); font-size: .78rem; padding: 5px 16px; display: flex; gap: 10px; align-items: center; justify-content: center; text-align: center; white-space: nowrap; }
.demo-bar button { max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 1px solid color-mix(in srgb, var(--bg) 40%, transparent); color: var(--bg); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: .78rem; }
.header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-in { height: var(--header-h); display: flex; align-items: center; gap: 8px; padding-inline: 12px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); background: none; border: 0; cursor: pointer; padding: 4px; }
.brand img.logo { width: auto; }
.brand b { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--brick); letter-spacing: -0.02em; }
.header-title { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.dot { position: absolute; top: 8px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--brick); color: var(--on-brick); font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brick-soft); color: var(--brick-dark); font-family: var(--font-display); font-weight: 600; font-size: .85rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }

.body { flex: 1; display: flex; max-width: 1180px; width: 100%; margin: 0 auto; }
.main { flex: 1; min-width: 0; padding: 16px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 20px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar-in { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); height: var(--tab-h); max-width: 640px; margin: 0 auto; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-2); cursor: pointer; font-size: .7rem; font-weight: 600; padding: 4px 2px; position: relative; min-width: 0; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab svg.i { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--brick); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brick); }
.sidebar { display: none; }

@media (min-width: 960px) {
  .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; width: 232px; flex: none; padding: 20px 12px; position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); height: calc(100vh - var(--header-h)); overflow: auto; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 0; background: none; color: var(--ink); cursor: pointer; text-align: start; font-weight: 600; font-size: .95rem; }
  .side-link:hover { background: var(--surface-2); }
  .side-link[aria-current="page"] { background: var(--brick-soft); color: var(--brick-dark); }
  .side-sep { height: 1px; background: var(--line); margin: 10px 8px; }
  .main { padding: 24px 24px 48px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flat { box-shadow: none; }
.card.tap { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; text-align: start; font: inherit; color: inherit; width: 100%; }
.card.tap:hover { box-shadow: var(--shadow-lg); }
.card.tap:active { transform: scale(.995); }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link-btn { background: none; border: 0; color: var(--brick); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: .9rem; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stack.lg { gap: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid.g4s { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid.g4s { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-weight: 700; font-size: .95rem; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--brick); color: var(--on-brick); }
.btn.primary:hover { background: var(--brick-dark); }
:root[data-theme="dark"] .btn.primary:hover { background: var(--brick-dark); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.soft { background: var(--brick-soft); color: var(--brick-dark); }
.btn.ghost { background: transparent; color: var(--brick); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-off { background: var(--off-soft); color: var(--off); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-brick { background: var(--brick-soft); color: var(--brick-dark); }
.b-danger { background: var(--danger-soft); color: var(--danger); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.blood { font-family: var(--font-display); min-width: 52px; text-align: center; }
.chip.blood[aria-pressed="true"] { background: var(--brick); border-color: var(--brick); color: var(--on-brick); }
.tag { display: inline-block; background: var(--surface-2); color: var(--ink-2); border-radius: 8px; padding: 2px 8px; font-size: .78rem; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-weight: 600; font-size: .88rem; }
.field .hint { font-size: .8rem; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brick); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brick) 20%, transparent); }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .fields.c2 { grid-template-columns: 1fr 1fr; } .fields.c3 { grid-template-columns: 1fr 1fr 1fr; } }
.search { position: relative; }
.search svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.search .input { padding-left: 44px; min-height: 50px; border-radius: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--brick); margin-top: 2px; flex: none; }

.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brick) 55%, transparent); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.status button[aria-pressed="true"][data-v="available"] { color: var(--ok); }
.seg.status button[aria-pressed="true"][data-v="low"], .seg.status button[aria-pressed="true"][data-v="appointment"] { color: var(--warn); }

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; color: inherit; width: 100%; cursor: pointer; min-width: 0; }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.li.static { cursor: default; }
.li.static:hover { background: none; }
.li .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brick-soft); color: var(--brick-dark); flex: none; }
.li .chev { color: var(--ink-2); }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); align-items: flex-start; }
.alert svg.i { margin-top: 2px; }
.alert.urgent { background: var(--danger-soft); color: var(--ink); }
.alert.urgent svg.i { color: var(--danger); }
.alert.info { background: var(--info-soft); }
.alert.info svg.i { color: var(--info); }
.alert.warn { background: var(--warn-soft); }
.alert.warn svg.i { color: var(--warn); }
.alert.neutral { background: var(--surface-2); }
.alert strong { display: block; margin-bottom: 2px; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg.i { width: 34px; height: 34px; color: var(--line); stroke-width: 1.5; }

/* Home */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .services { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.svc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: start; box-shadow: var(--shadow); color: inherit; }
.svc:hover { border-color: color-mix(in srgb, var(--brick) 40%, var(--line)); }
.svc .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brick-soft); color: var(--brick); }
.svc .ic svg.i { width: 24px; height: 24px; }
.svc b { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }

/* Blood */
.blood-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bcell { border-radius: 10px; padding: 8px 4px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: .9rem; border: 1px solid transparent; }
.bcell small { display: block; font-family: var(--font-body); font-size: .68rem; font-weight: 600; opacity: .9; }
.bcell.available { background: var(--ok-soft); color: var(--ok); }
.bcell.low { background: var(--warn-soft); color: var(--warn); }
.bcell.out { background: var(--off-soft); color: var(--off); }
.bcell.sel { border-color: currentColor; }
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-2); }
.fresh svg.i { width: 15px; height: 15px; }
.fresh.stale { color: var(--warn); }

table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: start; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* Media & detail */
.cover { aspect-ratio: 16 / 7; max-width: 100%; border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; position: relative; background: var(--brick-soft); color: var(--brick); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover svg.i { width: 48px; height: 48px; stroke-width: 1.4; }
.cover.sm { aspect-ratio: 16 / 6; }
.thumb { width: 64px; height: 64px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--brick-soft); color: var(--brick); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg.i { width: 28px; height: 28px; stroke-width: 1.6; }
.kv { display: grid; grid-template-columns: 22px 1fr; gap: 10px 10px; align-items: start; }
.kv svg.i { color: var(--ink-2); margin-top: 2px; }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
.datebox { width: 58px; flex: none; border-radius: 14px; background: var(--brick-soft); color: var(--brick-dark); text-align: center; padding: 8px 4px; font-family: var(--font-display); }
.datebox b { display: block; font-size: 1.35rem; line-height: 1.1; }
.datebox span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.prose { display: flex; flex-direction: column; gap: 12px; max-width: 68ch; }
.prose p { white-space: pre-line; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--ink-2); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: .9rem; }

/* Messages */
.msg { border-inline-start: 4px solid var(--line); }
.msg.unread { border-inline-start-color: var(--brick); }
.msg.consigne { border-inline-start-color: var(--info); }
.quote { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: .98rem; white-space: pre-line; }
.readonly-note { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--ink-2); font-size: .88rem; }

/* Forum */
.post { display: flex; gap: 12px; }
.post .bubble { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.post.mine .bubble { background: var(--brick-soft); border-color: transparent; }
.post.hidden .bubble { opacity: .6; border-style: dashed; }
.post .bubble p { overflow-wrap: anywhere; white-space: pre-line; }
.composer { position: sticky; bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: var(--shadow-lg); }
@media (min-width: 960px) { .composer { bottom: 16px; } }
.composer textarea { flex: 1; min-height: 46px; height: 46px; border: 0; resize: none; background: transparent; padding: 10px; }
.composer textarea:focus { outline: none; }

/* Stats */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: .85rem; }
.adherence { display: flex; gap: 4px; }
.adherence i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-size: .62rem; font-weight: 700; }
.adherence i.pris { background: var(--ok-soft); color: var(--ok); }
.adherence i.ignoré { background: var(--off-soft); color: var(--off); }
.adherence i.envoyé { background: var(--warn-soft); color: var(--warn); }
.adherence i.none { background: var(--surface-2); }

.timeline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; }
.timeline .st { padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.timeline .st.on { background: var(--brick); color: var(--on-brick); }
.timeline .st.done { background: var(--brick-soft); color: var(--brick-dark); }

/* Overlays */
.scrim { position: fixed; inset: 0; background: rgba(10,10,10,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 8px 18px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; animation: up .22s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 2px; }
@media (min-width: 640px) { .scrim { align-items: center; } .sheet { border-radius: 22px; padding-bottom: 20px; } }
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 80; display: flex; justify-content: center; pointer-events: none; padding-inline: 16px; }
@media (min-width: 960px) { .toast-wrap { bottom: 24px; } }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: up .2s ease; max-width: 520px; }
.splash { position: fixed; inset: 0; z-index: 100; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .35s ease; padding: 24px; text-align: center; }
.splash img { width: 108px; height: 108px; animation: pulse 1.6s ease-in-out infinite; }
.splash .word { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--brick); letter-spacing: -0.03em; }
.splash .loader { width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.splash .loader::after { content: ""; display: block; width: 40%; height: 100%; background: var(--brick); animation: load 1s ease-in-out infinite; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.auth-wrap { max-width: 460px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gbtn { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px; text-align: start; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: inherit; }
.role-pick button:hover { border-color: var(--brick); }
.role-pick b { font-size: .92rem; }
.role-pick span { font-size: .78rem; color: var(--ink-2); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice button { border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: start; color: inherit; }
.choice button[aria-pressed="true"] { border-color: var(--brick); background: var(--brick-soft); }
.choice svg.i { width: 28px; height: 28px; color: var(--brick); }
.pill-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.pill-nav button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.pill-nav button[aria-pressed="true"] { color: var(--brick); border-bottom-color: var(--brick); }
.pill-nav .count { background: var(--brick); color: var(--on-brick); border-radius: 99px; padding: 0 6px; font-size: .7rem; margin-inline-start: 4px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 0; width: 100%; }
.disclaimer { font-size: .85rem; color: var(--ink-2); background: var(--surface-2); padding: 12px 14px; border-radius: 12px; }

/* ---------- v2 : logo, langue, zones, chat, RTL ---------- */
.logo { height: 34px; width: auto; display: block; }
.logo.lg { height: 64px; }
.splash .logo { height: 96px; animation: pulse 1.6s ease-in-out infinite; }
.lang-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 10px; font-weight: 700; font-size: .78rem; cursor: pointer; flex: none; }
.lang-chip svg.i { width: 16px; height: 16px; }
.lang-chip.big { font-size: .9rem; padding: 7px 14px; }
.zone-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.zone-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; max-width: 100%; min-width: 0; }
.zone-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-btn svg.i { color: var(--brick); flex: none; }
.hero-zone { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.cty-list { max-height: 52vh; overflow: auto; }
.li.cty.sel { background: var(--brick-soft); }
.flag { font-size: 1.35rem; line-height: 1; width: 28px; text-align: center; flex: none; }
.flag.lg { font-size: 2rem; width: 40px; }
.fav-star { color: var(--line); padding: 4px; border-radius: 8px; display: grid; place-items: center; }
.fav-star.on { color: #E0A21B; }
.fav-star.on svg.i { fill: currentColor; }
.eyebrow.pad { padding: 12px 16px 6px; background: var(--surface-2); }
.lang-ic { font-family: var(--font-display); font-weight: 700; font-size: .8rem; }
.li[aria-checked="true"] { background: var(--brick-soft); }
.li[disabled] { opacity: .55; cursor: not-allowed; }
.code-box { display: flex; gap: 12px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.code { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: .06em; }
.bare { background: none; border: 0; text-align: start; cursor: pointer; color: inherit; padding: 0; font: inherit; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tap-stat { cursor: pointer; text-align: start; font: inherit; color: inherit; }
.tab-dot { position: absolute; top: 6px; inset-inline-end: 22%; background: var(--brick); color: var(--on-brick); font-style: normal; font-size: .62rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }
.side-link { position: relative; }
.side-link .tab-dot { position: static; margin-inline-start: auto; }
.chip input[type=checkbox] { accent-color: var(--brick); }
.check.chip { align-items: center; }
.pick-list { max-height: 300px; overflow: auto; }
.pick-list .li { cursor: pointer; }
.pick-list input { width: 20px; height: 20px; accent-color: var(--brick); flex: none; }
.count.ok { background: var(--ok); }

/* Chat */
.chat-head { gap: 8px; }
.chat-log { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.cmsg { display: flex; }
.cmsg.mine { justify-content: flex-end; }
.cbubble { max-width: min(80%, 560px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmsg.mine .cbubble { background: var(--brick); color: var(--on-brick); border-color: transparent; border-radius: 18px 18px 6px 18px; }
.cmsg.mine .cbubble .muted, .cmsg.mine .cbubble .xsmall.muted { color: color-mix(in srgb, var(--on-brick) 80%, transparent); }
.cbubble p { white-space: pre-line; overflow-wrap: anywhere; }
.cmeta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-size: .72rem; opacity: .8; }
.receipt svg.i { width: 15px; height: 15px; }
.receipt.read { color: #9BE3BE; }
.cmsg:not(.mine) .receipt.read { color: var(--ok); }
.att-img { display: block; margin: 2px 0 4px; }
.att-img img { display: block; max-width: min(240px, 100%); max-height: 320px; border-radius: 12px; background: var(--surface-2); object-fit: cover; }
.att { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; min-width: 0; }
.att .grow { min-width: 0; overflow-wrap: anywhere; }
.att.presc { border: 1px solid var(--info); background: var(--info-soft); }
.att.presc svg.i:first-child { color: var(--info); }
.day-sep { text-align: center; font-size: .75rem; color: var(--ink-2); margin: 8px 0; }
.day-sep span { background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.chat-compose { align-items: flex-end; }
.chat-compose textarea { flex: 1; min-height: 46px; height: 46px; border: 0; resize: none; background: transparent; padding: 10px; width: 100%; }
.chat-compose textarea:focus { outline: none; }
.chat-compose label.icon-btn { cursor: pointer; }

/* RTL */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
/* Numéros de téléphone, codes et URL restent lisibles de gauche à droite dans une page en arabe */
[dir="rtl"] a[href^="tel:"]:not(.btn), [dir="rtl"] a[href^="mailto:"]:not(.btn), [dir="rtl"] input[type="tel"], [dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] .ltr { direction: ltr; unicode-bidi: isolate; }

.search svg.i { left: auto; inset-inline-start: 14px; }
.search .input { padding-left: 14px; padding-inline-start: 44px; }
.tab[aria-current="page"]::before { left: 28%; right: 28%; }
.dot { right: auto; inset-inline-end: 8px; }
.li { text-align: start; }
.bcell.confirm { background: var(--surface); color: var(--warn); border: 1px dashed var(--warn); }
.empty .btn svg.i { width: 18px; height: 18px; color: inherit; stroke-width: 1.9; }
.empty .btn { white-space: normal; text-align: center; }

/* ---------- v3 : accueil blanc, logo plus lisible, menu « Plus » dans l'en-tête ---------- */
/* Accueil : toujours en clair, fond blanc pur ; les autres pages suivent la préférence de thème */
:root.on-home { --bg: #FFFFFF; --surface-2: #F6F4F3; }
.on-home .header { background: rgba(255,255,255,.94); }
.hero { background: radial-gradient(120% 140% at 100% 0%, var(--brick-soft) 0%, #FFFFFF 58%); border: 1px solid var(--line); border-radius: 24px; padding: 26px 20px; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; color: var(--ink); }
.hero::after { content: ""; position: absolute; right: -70px; top: -70px; width: 230px; height: 230px; border-radius: 50%; border: 30px solid color-mix(in srgb, var(--brick) 7%, transparent); pointer-events: none; }
.hero h1 { font-size: 1.6rem; color: var(--ink); }
.hero p { color: var(--brick-dark); font-weight: 600; }
.hero .search .input { border: 1px solid var(--line); background: #FFFFFF; color: var(--ink); box-shadow: 0 2px 10px rgba(23,23,23,.05); }
.hero .search svg.i { color: var(--ink-2); }
.zone-btn.light { background: #FFFFFF; border-color: var(--line); color: var(--ink); }
.zone-btn.light svg.i { color: var(--brick); }
@media (min-width: 720px) { .hero { padding: 34px 32px; } .hero h1 { font-size: 2rem; } }

/* Logo : plus grand et lisible */
.logo { height: 56px; }
.brand { padding: 2px 0; }
@media (min-width: 960px) { .logo { height: 62px; } }
.splash .logo { height: 110px; }

/* En-tête : bouton « Plus » dans le coin supérieur droit */
.menu-btn { border: 1px solid var(--line); border-radius: 50%; width: 42px; height: 42px; }
.menu-btn[aria-current="page"] { background: var(--brick-soft); color: var(--brick-dark); border-color: transparent; }
.header-in { gap: 6px; }
@media (max-width: 380px) { .logo { height: 48px; } .lang-chip span { display: none; } .login-btn { padding-inline: 10px; } }

/* Vidéos */
.vcard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.vcard > .stack { padding: 14px 16px 16px; }
.vposter { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 20% 0%, #C0392B 0%, #8E1F17 55%, #4A0F0B 100%); }
.vposter img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vplay { position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.94); color: var(--brick-dark, #8E1F17); box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: transform .15s; }
.vplay svg.i { width: 26px; height: 26px; fill: currentColor; stroke: none; margin-inline-start: 4px; }
.vposter.big .vplay { width: 76px; height: 76px; }
.vposter.big .vplay svg.i { width: 34px; height: 34px; }
.tap:hover .vplay, .vstart:hover .vplay { transform: scale(1.07); }
.vdur { position: absolute; inset-inline-end: 10px; bottom: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.vplayer { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; position: relative; }
.vplayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vplayer .vposter { height: 100%; }
.vstart { all: unset; display: block; width: 100%; height: 100%; cursor: pointer; }
.vstart:focus-visible { outline: 3px solid var(--brick); outline-offset: -3px; }
.vnote { position: absolute; inset-inline: 10px; bottom: 10px; background: rgba(0,0,0,.72); color: #fff; padding: 8px 10px; border-radius: 10px; display: flex; gap: 8px; align-items: flex-start; }
.vnote svg.i { flex: none; width: 18px; height: 18px; }
.check.consent { align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; line-height: 1.45; }
.check.consent input { margin-top: 3px; flex: none; width: 20px; height: 20px; accent-color: var(--brick); }
.seg button svg.i { width: 16px; height: 16px; vertical-align: -3px; }
.vplay.off { background: rgba(255,255,255,.18); color: #fff; box-shadow: none; transform: translateY(-28px); }
.vplay.off svg.i { fill: none; stroke: currentColor; margin: 0; }
.vfilters { display: grid; grid-template-columns: 1fr; gap: 10px; }
.vfilters .field { margin: 0; }
@media (min-width: 640px) { .vfilters { grid-template-columns: 1fr 220px; align-items: center; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.sharelink { display: flex; gap: 8px; align-items: center; }
.sharelink .input { flex: 1; min-width: 0; font-size: .85rem; }
.btn.wa { background: #1FA855; color: #fff; border-color: transparent; justify-content: center; }
.btn.wa:hover { background: #178F47; }
.btn.store { background: #111; color: #fff; border-color: #111; gap: 10px; padding-block: 8px; text-align: start; }
.btn.store span { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; }
.btn.store small { font-size: .68rem; font-weight: 500; opacity: .85; }
.installcard { border: 1px solid var(--brick-soft); background: linear-gradient(135deg, var(--brick-soft), var(--surface) 60%); }
.installcard .thumb { width: 48px; height: 48px; border-radius: 12px; background: #fff; }

/* Actualités */
.ncard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ncard > .stack { padding: 14px 16px 16px; }
.ncard.noimg { border-inline-start: 4px solid var(--brick); }
.ncard.urgent { border: 2px solid var(--danger, #C0392B); }
.ncard.urgent.noimg { border-inline-start-width: 6px; }
.ncover { position: relative; aspect-ratio: 3 / 2; background: var(--surface-2); overflow: hidden; }
.ncover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ncover .vplay.sm { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; }
.ncover .vdur svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag.tag-urgent { background: var(--danger, #C0392B); color: #fff; }
.tag.tag-urgent svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.urgent-until { color: var(--danger, #C0392B); font-weight: 600; }
.ngallery { display: flex; flex-direction: column; gap: 8px; }
.ngallery button { all: unset; cursor: zoom-in; display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.ngallery button:focus-visible { outline: 3px solid var(--brick); outline-offset: 2px; }
.nmain img { width: 100%; max-height: 70vh; object-fit: contain; display: block; background: var(--surface-2); }
.nthumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nthumbs button { border-radius: 10px; aspect-ratio: 1; }
.nthumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
figure.zoom { margin: 0; display: flex; flex-direction: column; gap: 8px; }
figure.zoom img { width: 100%; max-height: 75vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.pimgs { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .pimgs { grid-template-columns: 1fr 1fr; } }
.pimg { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pimg img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; }
.pimg .icon-btn { position: absolute; top: 14px; inset-inline-end: 14px; background: rgba(0,0,0,.6); color: #fff; }
img.mini { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Pages publiques : liens éditeur, activités passées */
.link-btn.inline { padding: 0; font: inherit; color: var(--brick); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; cursor: pointer; }
details.past summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.past summary::after { content: '▾'; color: var(--ink-2); }
details.past[open] summary::after { content: '▴'; }
details.past .list { margin-top: 10px; }
.org-cover { background: linear-gradient(135deg, var(--brick-soft), var(--surface-2)); }

/* Portée géographique des actualités */
.news-scope { padding: 12px 14px; }
.news-scope .seg { width: 100%; }
.news-scope .seg button { flex: 1; min-width: 0; }
.news-scope .tag { font-size: .78rem; }
.news-tools { align-items: center; gap: 8px; }
h2.news-sep { font-size: 1rem; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.news-scope-tag { font-size: .72rem; }
.news-scope-tag svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.nc-list { max-height: 50vh; overflow: auto; }
.nc-list .li { gap: 10px; align-items: center; }

/* Annuaires : pagination, élargissement, lignes compactes */
.pager { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.pager .btn { min-width: 220px; justify-content: center; }
.widen { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; text-align: center; }
.widen .btn .count { margin-inline-start: 4px; }
.crow { gap: 10px; align-items: center; }
.crow-main { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crow-main b { overflow-wrap: anywhere; }
.crow-main:focus-visible { outline: 2px solid var(--brick); outline-offset: 2px; border-radius: 6px; }
.nores .list { margin-top: 10px; }
.nores details { margin-top: 8px; }
details.out-list { margin-top: 18px; }
@media (max-width: 380px) { .hide-xs { display: none; } }
.crow-main { flex: 1 1 auto; min-width: 0; }
.crow-badge { margin-top: 4px; }
.crow > .btn { flex: none; }
.seg.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
.seg.two button { white-space: normal; min-width: 0; }
.seg.two button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; line-height: 1.2; }
.seg.two button svg.i { width: 16px; height: 16px; }

/* Connexion par téléphone (SMS) */
.alert.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.alert.ok svg.i { color: var(--ok); }
.abtn { background: #000; color: #fff; border-color: #000; }
.abtn:hover { background: #222; }
:root[data-theme="dark"] .abtn, :root.dark .abtn { background: #fff; color: #000; border-color: #fff; }
.phone-row { gap: 8px; }
.phone-row .tag { flex: none; min-width: 56px; justify-content: center; font-size: .95rem; padding: 10px; }
.otp-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; padding-inline-start: .5em; }
.demo-sms b { font-family: inherit; }
.auth-wrap .btn.block { white-space: normal; text-align: center; line-height: 1.25; }

/* Documents légaux */
.legal-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.prose.legal h2 { font-size: 1.05rem; margin-top: 8px; }
.prose.legal ul { padding-inline-start: 1.2em; margin: 0; display: flex; flex-direction: column; gap: 4px; }
mark.todo { background: color-mix(in srgb, var(--warn, #C98A00) 22%, transparent); color: inherit; border-radius: 4px; padding: 0 3px; }
.todo-count { color: var(--warn, #9A6A00); font-weight: 600; }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; }

/* v3.10 — qualité des traductions des fiches */
.tr-fb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; }
.tr-fb svg.i { width: 15px; height: 15px; }
.tr-pair { gap: 6px; padding: 12px 14px; }
.tr-pair p { margin: 0; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
/* v4.2 — actions discrètes : fin de suivi, menu des messages, compte en suppression */
.btn.danger-text { color: var(--danger); }
.cmeta .msg-more { background: none; border: 0; padding: 0 2px; color: inherit; opacity: .75; cursor: pointer; font: inherit; line-height: 1; }
.cmeta .msg-more:hover, .cmeta .msg-more:focus-visible { opacity: 1; }
.cbubble .msg-del { font-style: italic; opacity: .75; }
.cmeta .edited { font-style: italic; }
label.check.chip[hidden] { display: none !important; }
