/* Afya+ — interface mobile d'abord */
:root {
  --bg: #f3f6f5; --surface: #ffffff; --surface-2: #f7faf9; --border: #e1e8e6;
  --text: #15201d; --muted: #5f6f6a; --primary: #0b7a5c; --primary-2: #0a6a50; --primary-soft: #e3f3ee;
  --ok: #157f3b; --ok-bg: #e4f5ea; --warn: #9a6100; --warn-bg: #fdf1dc; --bad: #b42318; --bad-bg: #fde8e6;
  --info: #175cd3; --info-bg: #e5eefc; --mute-bg: #eef1f0;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --side: 248px; --top: 56px; --bottom: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --surface: #16201d; --surface-2: #1b2723; --border: #27352f;
    --text: #e7efec; --muted: #9db0a9; --primary: #2bb48a; --primary-2: #239d77; --primary-soft: #143329;
    --ok: #5fd08a; --ok-bg: #12301f; --warn: #f0b44c; --warn-bg: #33270f; --bad: #ff7b6e; --bad-bg: #3a1714;
    --info: #7aa7ff; --info-bg: #142340; --mute-bg: #222e2a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.i { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- Structure ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
  padding-top: env(safe-area-inset-top); height: calc(var(--top) + env(safe-area-inset-top));
  background: var(--primary); color: #fff; }
.topbar a, .topbar button { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; display: flex; align-items: center; gap: .5rem; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; background: #fff; object-fit: contain; }
.iconbtn { background: transparent; border: 0; padding: .5rem; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; font: inherit; }
.iconbtn:hover { background: rgba(255,255,255,.14); }
.sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; padding: env(safe-area-inset-top) 0 1rem; }
.sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
.sidebar .head { padding: 1rem; border-bottom: 1px solid var(--border); }
.sidebar .head strong { display: block; }
.nav { list-style: none; margin: 0; padding: .5rem; }
.nav li a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: var(--text); }
.nav li a:hover { background: var(--surface-2); }
.nav li a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav .sep { margin: .6rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; display: none; }
.scrim.show { display: block; }
main { padding: 1rem .75rem calc(var(--bottom) + 1.25rem + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
.bottombar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--bottom) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); }
.bottombar a, .bottombar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; color: var(--muted); background: none; border: 0; font-family: inherit; cursor: pointer; }
.bottombar a.active { color: var(--primary); font-weight: 600; }
.bottombar .pos, .bottombar a.pos.active { color: #fff; }
.bottombar .pos span.circle { background: var(--primary); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(11,122,92,.4); }

@media (min-width: 1024px) {
  .sidebar { transform: none; padding-top: 0; }
  .topbar { margin-left: var(--side); }
  .topbar .menu-btn { display: none; }
  main { margin-left: var(--side); padding: 1.5rem 2rem 2rem; }
  .bottombar { display: none; }
  .scrim { display: none !important; }
  body.wide main { max-width: none; }
}
@media (min-width: 1024px) { main { max-width: calc(1280px + var(--side)); } }

/* ---------- Composants ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 1rem 1rem 0; }
.grid { display: grid; gap: .75rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); display: block; color: var(--text); }
.kpi .label { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .35rem; }
.kpi .value { font-size: 1.3rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.ok .value { color: var(--ok); } .kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; min-height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--bad); border-color: var(--bad-bg); background: var(--bad-bg); }
.btn.ok { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.btn.block { width:100%; }
.btn.lg { min-height: 52px; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--mute-bg); color: var(--muted); }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: var(--ok); } .alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.warning { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }

/* Formulaires */
form .row { display: grid; gap: .75rem; grid-template-columns: 1fr; margin-bottom: .75rem; }
@media (min-width: 640px) { form .row.c2 { grid-template-columns: 1fr 1fr; } form .row.c3 { grid-template-columns: 1fr 1fr 1fr; } form .row.c4 { grid-template-columns: repeat(4, 1fr); } }
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
label .req { color: var(--bad); }
input, select, textarea { width: 100%; padding: .6rem .7rem; min-height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
input[type=checkbox] { width: auto; min-height: 0; }
.help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters > * { flex: 1 1 150px; }
.filters .btn { flex: 0 0 auto; }
.search { position: relative; }
.search .i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.3rem; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; background: var(--surface-2); }
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell form { display: inline; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
tr.row-bad td { background: color-mix(in srgb, var(--bad-bg) 60%, transparent); }
tr.row-warn td { background: color-mix(in srgb, var(--warn-bg) 60%, transparent); }

/* Listes mobiles (cartes) */
@media (max-width: 719px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--border); padding: .5rem .25rem; }
  table.responsive td { border: 0; padding: .2rem .75rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  table.responsive td.primary-cell { font-weight: 700; font-size: 1rem; text-align: left; }
  table.responsive td.primary-cell::before { display: none; }
  table.responsive td.actions-cell { justify-content: flex-end; padding-top: .4rem; }
  table.responsive td.actions-cell::before { display: none; }
  table.responsive tfoot { display: block; } table.responsive tfoot tr { display: flex; justify-content: space-between; }
}

/* Graphique barres */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars-x { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: .3rem; }

/* Caisse (POS) */
.pos { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .pos { grid-template-columns: 1.3fr 1fr; align-items: start; } .pos .ticket { position: sticky; top: calc(var(--top) + 1rem); } }
.results { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.results li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .5rem; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.results li:hover, .results li.kb { background: var(--primary-soft); }
.results li.out { opacity: .5; cursor: not-allowed; }
.results .name { font-weight: 600; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.cart-line .qty { display: flex; align-items: center; gap: .25rem; }
.cart-line .qty input { width: 64px; text-align: center; min-height: 36px; padding: .3rem; }
.cart-line .qty button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.totals { margin-top: .75rem; }
.totals div { display: flex; justify-content: space-between; padding: .2rem 0; }
.totals .grand { font-size: 1.35rem; font-weight: 800; color: var(--primary); border-top: 2px solid var(--border); padding-top: .5rem; margin-top: .3rem; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { margin: 0; flex: 1 1 auto; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: .55rem .6rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Divers */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 600; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1rem .25rem; }
dialog .dlg-body { padding: .5rem 1rem 1rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom) + 1rem + env(safe-area-inset-bottom)); z-index: 60;
  background: #15201d; color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 92vw; }
@media (min-width: 1024px) { .toast { bottom: 1.5rem; } }
.install-banner { display: none; align-items: center; gap: .75rem; background: var(--primary-soft); border: 1px solid var(--primary); color: var(--text); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.install-banner.show { display: flex; }
.install-banner p { margin: 0; flex: 1; font-size: .9rem; }

/* Pages invité */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: linear-gradient(160deg, var(--primary) 0 38%, var(--bg) 38%); }
.guest .box { width: min(440px, 100%); }
.guest .logo { text-align: center; color: #fff; margin-bottom: 1rem; }
.guest .logo img { width: 72px; height: 72px; border-radius: 18px; background: #fff; padding: 8px; }
.guest .logo h1 { margin: .5rem 0 0; font-size: 1.5rem; }

/* Landing */
.hero { background: var(--primary); color: #fff; padding: calc(2.5rem + env(safe-area-inset-top)) 1rem 3rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); margin: .75rem auto; max-width: 760px; }
.hero p { max-width: 640px; margin: 0 auto 1.5rem; opacity: .92; font-size: 1.05rem; }
.hero .btn { border-color: #fff; }
.hero .btn.primary { background: #fff; color: var(--primary); }
.hero .btn:not(.primary) { background: transparent; color: #fff; }
.section { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1rem; }
.section h2 { font-size: 1.4rem; text-align: center; margin-bottom: 1.5rem; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.feature .i { width: 28px; height: 28px; color: var(--primary); }
.feature h3 { margin: .5rem 0 .3rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.plan .price { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.plan ul { padding-left: 1.1rem; margin: .25rem 0 1rem; color: var(--muted); flex: 1; }
footer.site { text-align: center; color: var(--muted); padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom)); font-size: .85rem; }

/* Impression (factures, bons) */
.doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); }
.doc table th { background: #f1f1f1; color: #333; }
.doc table td, .doc table th { border-bottom: 1px solid #ddd; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: .75rem; margin-bottom: 1rem; }
.doc .doc-head img { max-height: 64px; max-width: 160px; }
.doc h2 { color: #111; }
.doc .muted { color: #555; }
.doc.ticket { max-width: 80mm; padding: .75rem; font-size: 12px; }
@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  .topbar, .sidebar, .bottombar, .no-print, .page-head .actions, .install-banner, .scrim { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .doc { border: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
}

/* v2 : sélecteur de point de vente, pastilles */
.branch-switch { width: auto; max-width: 46vw; min-height: 36px; padding: .3rem .5rem; border-radius: 9px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.14); color: #fff; font-size: .85rem; }
.branch-switch option { color: #15201d; }
.branch-chip { background: rgba(255,255,255,.18); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .hide-sm { display: none !important; } }
.bottombar .dot { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--bad); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 .35rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ''; position: absolute; left: .35rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--border); }
.timeline li::after { content: ''; position: absolute; left: .67rem; top: 1.1rem; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--primary); }
.timeline li.current::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline li.cancel::before { background: var(--bad); }
.timeline .when { font-size: .8rem; color: var(--muted); }
.pill-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pill-tabs a { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: .85rem; font-weight: 600; background: var(--surface); }
.pill-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pill-tabs a .n { opacity: .75; margin-left: .2rem; }
.amount-pos { color: var(--ok); } .amount-neg { color: var(--bad); }

/* v3 : stock chez les autres points de vente, messagerie */
#results li .elsewhere{flex-basis:100%;margin-top:.25rem;color:var(--muted)}
#results li .elsewhere a{font-weight:600}
#results li{flex-wrap:wrap}
.chat{display:flex;flex-direction:column;gap:.5rem;max-height:60vh;overflow-y:auto;padding:.75rem}
.chat .msg{max-width:80%;padding:.5rem .75rem;border-radius:12px;background:var(--surface-2);align-self:flex-start;white-space:pre-wrap;word-wrap:break-word}
.chat .msg.me{align-self:flex-end;background:var(--primary-soft)}
.chat .msg .meta{display:block;font-size:.75rem;color:var(--muted);margin-bottom:.15rem}
.peers{list-style:none;margin:0;padding:0}
.peers li a{display:flex;justify-content:space-between;align-items:center;padding:.6rem .75rem;border-bottom:1px solid var(--border);color:inherit;text-decoration:none}
.peers li a.active{background:var(--surface-2);font-weight:600}
.msg-layout{display:grid;gap:.75rem}
@media (min-width:900px){.msg-layout{grid-template-columns:280px 1fr}}
.msg-form{display:flex;gap:.5rem;padding:.75rem;border-top:1px solid var(--border);align-items:flex-end}
.msg-form textarea{flex:1;margin:0}

/* v4 : hôpital */
ul.plain{list-style:none;margin:0;padding:0}
ul.plain li{padding:.35rem 0;border-bottom:1px solid var(--border)}
form.inline{display:inline}
.bedgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:.5rem;margin-top:.75rem}
.bed{border:1px solid var(--border);border-radius:10px;padding:.55rem .6rem;display:flex;flex-direction:column;gap:.3rem;background:var(--surface)}
.bed.free{border-left:4px solid var(--ok)}.bed.occupied{border-left:4px solid var(--bad)}.bed.cleaning{border-left:4px solid var(--warn)}.bed.out_of_service{opacity:.6}
.bed select{padding:.25rem;font-size:.8rem}
.bed a{color:inherit}
.pt-head{display:flex;gap:1rem;align-items:flex-start;flex-wrap:wrap}
.pt-avatar{width:56px;height:56px;border-radius:50%;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:1.2rem;flex:none}
.pt-meta{display:flex;flex-wrap:wrap;gap:.35rem .9rem;color:var(--muted);font-size:.85rem}
.allergy{background:var(--bad-bg);color:var(--bad);border-radius:8px;padding:.35rem .6rem;font-weight:600;font-size:.85rem}
.timeline{list-style:none;margin:0;padding:0}
.timeline li{border-left:3px solid var(--border);padding:.5rem .75rem;margin-left:.4rem;position:relative}
.timeline li::before{content:"";position:absolute;left:-7px;top:.8rem;width:11px;height:11px;border-radius:50%;background:var(--primary)}
.timeline .when{font-size:.78rem;color:var(--muted)}
.vit{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:.5rem}
.vit div{background:var(--surface-2);border-radius:8px;padding:.4rem .55rem}
.vit b{display:block;font-size:1.05rem}
.vit span{font-size:.75rem;color:var(--muted)}
.flag-H,.flag-L,.flag-A{color:var(--bad);font-weight:700}
.queue-card{display:flex;justify-content:space-between;gap:.75rem;align-items:center}
.agenda{display:grid;gap:.4rem}
.slot{display:flex;gap:.6rem;align-items:center;border:1px solid var(--border);border-radius:10px;padding:.45rem .6rem;background:var(--surface)}
.slot time{font-weight:700;min-width:3.2rem}
.doc-sign{display:flex;justify-content:flex-end;margin-top:3rem}
@media print{.bed form{display:none}}
.ptcard{width:86mm;min-height:54mm;border:1px solid #333;border-radius:3mm;padding:3mm 4mm;background:#fff;color:#111;font-size:9pt;display:flex;flex-direction:column;gap:1.5mm;margin:0 auto}
.ptcard-head{display:flex;gap:2mm;align-items:center;border-bottom:1px solid #0b7a5c;padding-bottom:1.5mm;color:#0b7a5c}
.ptcard-head img{height:8mm}
.ptcard-name{font-size:12pt;font-weight:800}
.ptcard-code{font-family:monospace;font-size:14pt;letter-spacing:2px;border:1px dashed #999;padding:1mm 2mm;align-self:flex-start;margin-top:1mm}
.ptcard-foot{font-size:7pt;color:#555;margin-top:auto}
.picker{position:relative}
.picker .results{position:absolute;left:0;right:0;z-index:20;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);margin-top:.25rem}
.picker .chosen{display:flex;gap:.5rem;align-items:center;padding:.5rem .6rem;background:var(--primary-soft);border-radius:10px}
.picker .chosen.hidden{display:none}
.checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:.3rem .75rem;margin:.5rem 0}
.checks label{font-weight:400;display:flex;gap:.4rem;align-items:center;margin:0}
details>summary{list-style:none;display:inline-flex}
details>summary::-webkit-details-marker{display:none}
.rx-list li{margin-bottom:.75rem}
.hp-hero{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;padding:2.5rem 0 2rem}
.hp-hero h1{color:#fff;margin:.3rem 0}
.hp-wrap{max-width:960px;margin:0 auto;padding:0 16px}
main.hp-wrap{padding-top:1rem;padding-bottom:2rem}
.hp-logo{height:56px;border-radius:10px;background:#fff;padding:4px}
.hp-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:1rem}
.hp-actions .btn:not(.primary){background:#fff;color:var(--primary)}
.hp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:.5rem}
.hp-tile{border:1px solid var(--border);border-radius:10px;padding:.7rem;display:flex;gap:.5rem;align-items:center;background:var(--surface-2)}

/* v5 : documents médicaux imprimables */
.doc-box { border: 1px solid #bbb; border-radius: 6px; padding: .55rem .75rem; margin: .75rem 0; page-break-inside: avoid; }
.doc-box-title { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #333; margin-bottom: .35rem; }
.doc-grid { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: .2rem .75rem; margin: 0; font-size: .92rem; }
.doc-grid dt { color: #555; } .doc-grid dd { margin: 0; font-weight: 600; }
@media (max-width: 640px) { .doc-grid { grid-template-columns: max-content 1fr; } }
.doc-allergy { margin-top: .4rem; font-weight: 700; color: #b00020; }
.doc h3.doc-sec { font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid #999; padding-bottom: .15rem; margin: 1rem 0 .4rem; color: #111; }
.doc .doc-field { display: grid; grid-template-columns: 210px 1fr; gap: .5rem; padding: .18rem 0; border-bottom: 1px dotted #ccc; font-size: .92rem; }
.doc .doc-field .lbl { color: #444; } .doc .doc-field .val { font-weight: 600; white-space: pre-line; }
@media (max-width: 640px) { .doc .doc-field { grid-template-columns: 1fr; gap: 0; } }
.doc .fill { display: block; border-bottom: 1px dotted #777; min-height: 1.6rem; margin: .15rem 0; }
.doc .fill.inline { display: inline-block; min-width: 9rem; min-height: 1rem; }
.doc .box { display: inline-block; width: .85rem; height: .85rem; border: 1px solid #333; vertical-align: -2px; margin-right: .3rem; text-align: center; line-height: .8rem; font-size: .75rem; }
.doc .doc-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.doc .doc-table th, .doc .doc-table td { border: 1px solid #bbb; padding: .25rem .4rem; text-align: left; vertical-align: top; }
.doc .doc-table td.c, .doc .doc-table th.c { text-align: center; }
.doc .sig-row { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.2rem; page-break-inside: avoid; }
.doc .sig-row > div { flex: 1; text-align: center; font-size: .9rem; }
.doc .sig-row .line { border-top: 1px solid #333; margin-top: 3rem; padding-top: .25rem; }
.doc .doc-note { font-size: .8rem; color: #444; margin-top: .75rem; }
.doc .doc-sub { text-align: center; font-size: .85rem; color: #333; margin: -.5rem 0 .5rem; }
.doc .cut { border-top: 1px dashed #777; margin: 1.5rem 0 1rem; text-align: center; font-size: .75rem; color: #666; }
.doc .badge-urg { border: 2px solid #b00020; color: #b00020; padding: .05rem .4rem; font-weight: 700; border-radius: 4px; }
.print-list .print-item { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.print-list .print-item:last-child { border-bottom: 0; }
.echo-sec { margin-top: .75rem; }
.echo-sec h3 { margin: .5rem 0; }
@media print {
  @page { size: A4; margin: 12mm; }
  .doc { font-size: 11.5pt; }
  .doc .page-break { page-break-before: always; }
}
.doc .doc-field .fill.inline { display: block; min-width: 0; width: 100%; min-height: 1.1rem; }
@media print {
  .doc { font-size: 10.5pt; }
  .doc .doc-head { padding-bottom: .4rem; margin-bottom: .5rem; }
  .doc .doc-box { margin: .45rem 0; padding: .4rem .6rem; }
  .doc h3.doc-sec { margin: .55rem 0 .25rem; }
  .doc .doc-field { padding: .08rem 0; }
  .doc .sig-row { margin-top: 1.2rem; }
  .doc .sig-row .line { margin-top: 2.2rem; }
  .doc p { margin: .35rem 0; }
  .doc ul { margin: .3rem 0; }
}
/* v6 : identité Afya+ */
.guest .logo img { display: block; margin: 0 auto; background: transparent; padding: 0; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.guest .logo h1 { display: inline-block; background: rgba(11,122,92,.94); color: #fff; padding: .15rem .95rem; border-radius: 999px; }
/* Abonnés des entreprises */
tr.row-mute td { opacity: .55; }
@media (min-width: 900px) { .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c2 > .card { margin: 0; } }
.member-cards { display: flex; flex-wrap: wrap; gap: 1rem; }
.member-card { width: 85.6mm; min-height: 54mm; border: 1px solid #1d4e89; border-radius: 3mm; padding: 3mm 4mm; box-sizing: border-box; background: #fff; color: #111; font-size: 8.5pt; position: relative; page-break-inside: avoid; break-inside: avoid; }
.member-card .mc-head { display: flex; justify-content: space-between; gap: 2mm; border-bottom: 1px solid #1d4e89; padding-bottom: 1.5mm; margin-bottom: 2mm; }
.member-card .mc-head img { max-height: 9mm; }
.member-card .mc-org { font-weight: 700; font-size: 9pt; color: #1d4e89; }
.member-card .mc-name { font-size: 10.5pt; font-weight: 700; margin: .5mm 0 1mm; }
.member-card dl { padding-bottom: 4mm; }
.member-card dl { display: grid; grid-template-columns: auto 1fr; gap: .4mm 2mm; margin: 0; }
.member-card dt { color: #555; } .member-card dd { margin: 0; font-weight: 600; }
.member-card .mc-foot { position: absolute; bottom: 2mm; left: 4mm; right: 4mm; font-size: 7pt; color: #555; display: flex; justify-content: space-between; }
.member-card .mc-void { color: #b42318; font-weight: 700; }
@media print { .member-cards { gap: 6mm; } }
select.sm { width: auto; min-width: 0; padding: .25rem .5rem; font-size: .85rem; }
/* Paiement en ligne */
.pay-box { max-width: 440px; margin: 0 auto; background: var(--surface, #fff); border-radius: 16px; padding: 1.1rem 1.1rem 1.2rem; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.pay-sum { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .8rem 1rem; border: 1px solid var(--border, #dfe5e2); border-radius: 12px; background: var(--surface-2, #f4f7f6); margin-bottom: 1rem; }
.pay-sum strong { font-size: 1.35rem; white-space: nowrap; }
.pay-method { border: 1px solid var(--border, #dfe5e2); border-radius: 12px; padding: 1rem; margin-bottom: .8rem; }
.pay-method h3 { margin: 0 0 .3rem; display: flex; gap: .4rem; align-items: center; }
.mm-ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.mm-op { display: flex; flex-direction: column; align-items: center; gap: .2rem; border: 1px solid var(--border, #dfe5e2); border-radius: 10px; padding: .5rem .3rem; font-weight: 600; font-size: .8rem; text-align: center; cursor: pointer; }
.mm-op input { width: 1.1rem; height: 1.1rem; min-height: 0; padding: 0; margin: 0; accent-color: var(--primary, #0b7a5c); }
.mm-op:has(input:checked) { border-color: var(--primary, #0b7a5c); background: color-mix(in srgb, var(--primary, #0b7a5c) 10%, transparent); }
.btn.block { display: flex; width: 100%; justify-content: center; }
.pay-spin { width: 46px; height: 46px; margin: 1rem auto; border-radius: 50%; border: 4px solid var(--border, #dfe5e2); border-top-color: var(--primary, #0b7a5c); animation: payspin 1s linear infinite; }
@keyframes payspin { to { transform: rotate(360deg); } }
.pay-link { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pay-link input { flex: 1 1 220px; font-size: .85rem; }

/* Console */
.bot-preview { margin-top: .5rem; padding: .6rem .8rem; background: var(--surface-2, #f4f7f6); border-radius: 10px; font-size: .92rem; }
.bot-preview p { margin: 0 0 .35rem; }
/* Alerte de facture non réglée, visible dans chaque service */
.unpaid-alert { border: 1px solid currentColor; font-weight: 500; }
.unpaid-alert .i { vertical-align: -3px; }
/* Onglets masquables */
.tabs { position: relative; }
.tabs .tabs-cfg { margin-left: auto; flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .3rem .6rem; }
.tabs .tabs-cfg:hover { color: var(--primary); }
.tabs-menu { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .7rem .9rem; min-width: 220px; display: flex; flex-direction: column; gap: .35rem; }
.tabs-menu label { font-weight: 400; display: flex; gap: .45rem; align-items: center; cursor: pointer; }
.tabs-menu[hidden] { display: none; }
section[data-tab-panel][hidden] { display: none !important; }
/* Parcours du patient */
.journey .jbar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .3rem 0 1rem; }
.journey .jbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #2bb673); border-radius: 99px; transition: width .4s; }
.journey .jsteps { list-style: none; margin: 0; padding: 0; position: relative; }
.journey .jstep { position: relative; padding: 0 0 1rem 2.6rem; }
.journey .jstep::before { content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.journey .jstep:last-child::before { display: none; }
.journey .jstep > .jdot { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 2px solid var(--border); }
.journey .jstep > .jdot .i { width: 16px; height: 16px; }
.journey .js-done > .jdot { background: #e6f6ee; color: #0b7a5c; border-color: #0b7a5c; }
.journey .js-current > .jdot { background: #e7f1fb; color: #1d5fa8; border-color: #1d5fa8; box-shadow: 0 0 0 4px rgba(29,95,168,.12); }
.journey .js-alert > .jdot { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.journey .js-done::before { background: #0b7a5c; }
.journey .jhead { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; min-height: 32px; }
.journey .jhead strong { font-size: 1rem; }
.journey .jitems { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .35rem; }
.journey .jitems a { display: flex; gap: .6rem; justify-content: space-between; align-items: center; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; }
.journey .jitems a:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.journey .jitems small { display: block; color: var(--muted); }
.journey-mini ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.journey-mini li { display: flex; align-items: center; gap: .3rem; font-size: .8rem; padding: .2rem .5rem; border-radius: 99px; border: 1px solid var(--border); }
.journey-mini .jdot .i { width: 13px; height: 13px; }
.journey-mini li.js-done { border-color: #0b7a5c; color: #0b7a5c; } .journey-mini li.js-current { border-color: #1d5fa8; color: #1d5fa8; } .journey-mini li.js-alert { border-color: var(--bad); color: var(--bad); }
.jprog { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); }
.jprog i { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.jprog i b { display: block; height: 100%; background: var(--primary); }
/* Fenêtre de détail */
dialog.jmodal { border: 0; border-radius: 16px; padding: 0; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.25); background: var(--surface); color: var(--text); }
dialog.jmodal::backdrop { background: rgba(10,30,25,.45); }
.jmodal-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.jmodal-x { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; color: var(--text); }
.jmodal-body { padding: 1rem; overflow: auto; }
.jmodal-body h3 { margin-top: 0; } .jmodal-body table { width: 100%; }
.tabs[data-tabs] .tabs-cfg { position: sticky; right: 0; background: var(--bg, #f3f5f4); box-shadow: -8px 0 8px var(--bg, #f3f5f4); }
@media (min-width: 900px) { .tabs[data-tabs] { flex-wrap: wrap; overflow: visible; } .tabs[data-tabs] .tabs-cfg { position: static; box-shadow: none; background: transparent; } }

/* Menu de gauche personnalisable */
.sidebar .head { position: relative; padding-right: 2.6rem; }
.nav-cfg { position: absolute; top: .8rem; right: .6rem; background: none; border: 1px solid transparent; border-radius: 8px; padding: .3rem; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.nav-cfg:hover, .nav-cfg.on { color: var(--primary); background: var(--primary-soft); border-color: var(--border); }
.nav-cfg svg { width: 18px; height: 18px; }
.nav-edit { margin: .5rem .5rem 0; padding: .6rem .7rem; border-radius: 10px; background: var(--primary-soft); font-size: .82rem; }
.nav-edit p { margin: 0 0 .5rem; }
.nav-edit .actions { display: flex; gap: .4rem; justify-content: flex-end; }
.nav li.nav-off { display: none; }
.sidebar.editing .nav li.nav-off { display: block; }
.sidebar.editing .navi a { cursor: pointer; }
.sidebar.editing .navi a::after { content: ''; margin-left: auto; flex: 0 0 34px; height: 20px; border-radius: 999px; background: var(--primary) radial-gradient(circle at 24px 10px, #fff 7px, transparent 7.5px); }
.sidebar.editing .navi.nav-off a { opacity: .55; }
.sidebar.editing .navi.nav-off a::after { background: #c3ccc8 radial-gradient(circle at 10px 10px, #fff 7px, transparent 7.5px); }
.sidebar.editing .navi a .count { display: none; }
.sidebar.editing .navi[data-nav="profile"] a::after { display: none; }

/* ---------- Poste de travail du médecin (consultation) ---------- */
body.wide main { max-width: none; }
.cw-banner { position: sticky; top: calc(var(--top) + env(safe-area-inset-top)); z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id act" "vit act"; gap: .55rem 1.2rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .75rem 1rem; margin-bottom: .9rem; box-shadow: 0 4px 14px rgba(16,24,40,.06); }
.cw-id { grid-area: id; } .cw-vitals { grid-area: vit; } .cw-actions { grid-area: act; }
.cw-id { display: flex; gap: .8rem; align-items: center; min-width: 0; }
.cw-avatar { flex: 0 0 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; background: var(--info-bg); color: var(--info); }
.cw-avatar.f { background: #fbe7f1; color: #a3195b; }
.cw-name { font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.cw-meta { font-size: .85rem; color: var(--muted); margin-top: .1rem; }
.cw-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; font-weight: 600; cursor: default; font-family: inherit; }
button.chip { cursor: pointer; } button.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip .i { width: 14px; height: 14px; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.mute { color: var(--muted); font-weight: 500; }
.cw-vitals { display: flex; gap: .35rem; flex-wrap: wrap; }
.cw-vitals div { background: var(--surface-2); border-radius: 10px; padding: .25rem .55rem; text-align: center; min-width: 58px; }
.cw-vitals span { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cw-vitals b { font-size: .95rem; white-space: nowrap; }
.cw-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.cw-state { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cw-save { color: var(--muted); } .cw-save.ok { color: var(--ok); } .cw-save.bad { color: var(--bad); font-weight: 600; } .cw-save.wait, .cw-save.busy { color: var(--warn); }
.cw-btns { display: flex; gap: .4rem; align-items: center; }
.cw-more { position: relative; } .cw-more > summary { list-style: none; } .cw-more > summary::-webkit-details-marker { display: none; }
.cw-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: .35rem; min-width: 240px; }
.cw-menu a { display: flex; gap: .5rem; align-items: center; padding: .5rem .6rem; border-radius: 8px; color: var(--text); }
.cw-menu a:hover { background: var(--surface-2); }
.cw-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.cw-side { display: grid; gap: .75rem; }
.cw-card { padding: .8rem .9rem; margin: 0; }
.cw-card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .5rem; }
.cw-card .jbar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: .5rem; }
.cw-card .jbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #2bb673); }
.cw-steps { display: flex; flex-wrap: wrap; gap: .25rem; }
.cw-step { font-size: .72rem; padding: .1rem .45rem; border-radius: 6px; background: var(--mute-bg); color: var(--muted); }
.cw-step.js-done { background: var(--ok-bg); color: var(--ok); } .cw-step.js-current { background: var(--info-bg); color: var(--info); font-weight: 600; } .cw-step.js-alert { background: var(--bad-bg); color: var(--bad); }
.cw-list li { border-bottom: 1px solid var(--border); } .cw-list li:last-child { border: 0; }
.cw-list a { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .4rem 0; color: var(--text); }
.cw-list a:hover { color: var(--primary); }
.cw-list small { display: block; color: var(--muted); font-size: .75rem; }
.pre { white-space: pre-line; margin: 0; }
.tabs .tcount { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--mute-bg); color: var(--muted); font-size: .72rem; text-align: center; }
.tabs a.active .tcount { background: var(--primary-soft); color: var(--primary); }
.obs-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: center; padding: .6rem .8rem; }
.obs-tpl { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.obs-tpl select { width: auto; min-width: 200px; }
kbd { font: 600 .72rem/1 ui-monospace, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: .1rem .3rem; background: var(--surface-2); }
.soap h2 { display: flex; align-items: center; gap: .55rem; }
.soap-l { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; font-size: .9rem; }
.sysgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .5rem .9rem; }
.sysrow { border: 1px solid var(--border); border-radius: 10px; padding: .45rem .6rem; background: var(--surface-2); }
.sysrow.filled { background: var(--surface); border-color: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.syshead { display: flex; justify-content: space-between; align-items: center; }
.syshead label { margin: 0; font-size: .85rem; }
.sysrow textarea { border: 0; background: transparent; padding: .2rem 0; min-height: 1.8rem; resize: none; box-shadow: none; }
.sysrow textarea:focus { outline: none; }
.linkbtn { background: none; border: 0; color: var(--primary); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: .1rem .3rem; border-radius: 6px; }
.linkbtn:hover { background: var(--primary-soft); }
.quick { display: flex; gap: .3rem; margin-top: .3rem; }
textarea[data-grow] { resize: vertical; overflow: hidden; }
.picker .results li { display: flex; gap: .5rem; align-items: center; padding: .5rem .7rem; cursor: pointer; }
.picker .results li.on, .picker .results li:hover { background: var(--primary-soft); }
.picker .results { max-height: 320px; overflow: auto; list-style: none; padding: .25rem; }
.picker .code { font: 700 .78rem ui-monospace, monospace; background: var(--mute-bg); border-radius: 5px; padding: .05rem .35rem; min-width: 3.4rem; text-align: center; }
.obs-actions { position: sticky; bottom: calc(var(--bottom) + env(safe-area-inset-bottom) + .4rem); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; box-shadow: 0 -4px 16px rgba(0,0,0,.06); z-index: 5; }
.favs { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .55rem; }
.rx-table td { vertical-align: top; } .rx-table input, .rx-table select { min-width: 0; }
.rx-table tr.rx-allergy td { background: var(--bad-bg); }
.rx-table tr.flash td { background: var(--warn-bg); transition: background .3s; }
.rx-warn { color: var(--bad); font-weight: 700; }
.rx-done { border-bottom: 1px solid var(--border); padding: .4rem 0; } .rx-done:last-child { border: 0; }
.inline-check { font-weight: 400; display: flex; gap: .45rem; align-items: center; margin: .5rem 0; }
.allergy-ack { background: var(--bad-bg); color: var(--bad); padding: .5rem .7rem; border-radius: 10px; }
.exlist { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; margin: .5rem 0; }
.exlist label { display: flex; gap: .5rem; align-items: center; padding: .4rem .6rem; margin: 0; font-weight: 400; border-bottom: 1px solid var(--border); cursor: pointer; }
.exlist label:last-child { border: 0; }
.exlist label span:first-of-type { flex: 1; }
.exlist label.on { background: var(--primary-soft); }
.exsel { margin-bottom: .4rem; }
dialog.cw-close { width: min(520px, calc(100vw - 24px)); }
.cw-close .jmodal-body label { display: block; }
.cl-err { color: var(--bad); font-weight: 600; margin: .3rem 0 0; }
.cl-sum { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .35rem; font-size: .9rem; }
.cl-sum li { display: flex; gap: .45rem; align-items: center; }
.cl-opt { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; margin: 0 0 .7rem; }
.cl-opt legend { font-weight: 600; font-size: .85rem; padding: 0 .3rem; }
.cl-opt label { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; margin: .35rem 0; cursor: pointer; }
.cl-fu { display: flex !important; gap: .45rem; align-items: center; font-weight: 400; }
.cw-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1rem; border-top: 1px solid var(--border); }
@media (min-width: 1180px) {
  .cw-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .cw-side { position: sticky; top: calc(var(--top) + 150px); max-height: calc(100vh - var(--top) - 170px); overflow: auto; }
}
@media (max-width: 900px) {
  .cw-banner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "vit" "act"; position: static; }
  .cw-actions { align-items: stretch; } .cw-state { justify-content: flex-start; } .cw-btns { flex-wrap: wrap; }
  .kbd-hint { display: none; }
}
@media print { .cw-banner, .cw-side, .obs-tools, .obs-actions { display: none !important; } }
@media (min-width: 1024px) { .obs-actions { bottom: .6rem; } }
.rx-table th:first-child { width: 34%; } .rx-table td:first-child input { width: 100%; }
.cw-main .tabs a { padding: .6rem .75rem; }
.cw-close .jmodal-body .cl-opt label, .cw-close .jmodal-body label.cl-fu { display: flex; }
.cl-opt input, .cl-fu input { width: auto; flex: none; margin-top: .2rem; }
html:has(.cw) { scroll-padding-top: 230px; scroll-padding-bottom: 100px; }
@media (max-width: 900px) { html:has(.cw) { scroll-padding-top: 70px; } }

/* ---------- Patients non payés, caisse hôpital ---------- */
.pt-unpaid { color: var(--bad) !important; font-weight: 700; }
a.pt-unpaid:hover { text-decoration: underline; }
.unpaid-chip { white-space: nowrap; }
tr.row-unpaid td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.cashier-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; background: linear-gradient(135deg, var(--primary), #0f9a73); color: #fff; border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.cashier-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: .06em; }
.cashier-sub { font-size: .88rem; opacity: .95; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .25rem; }
.cashier-head .chip { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.cashier-head .chip.bad { background: #fde8e6; color: var(--bad); } .cashier-head .chip.warn { background: #fdf1dc; color: #9a6100; }
.cashier-head .actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.cashier-head .btn { background: #fff; color: var(--primary); border-color: #fff; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.waiting-card h2 { display: flex; align-items: center; gap: .5rem; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 rgba(180,35,24,.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(180,35,24,.5); } 70% { box-shadow: 0 0 0 10px rgba(180,35,24,0); } 100% { box-shadow: 0 0 0 0 rgba(180,35,24,0); } }
.cash-alerts { position: fixed; z-index: 90; top: calc(var(--top) + 10px); right: 12px; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 24px)); }
.cash-alert { display: flex; gap: .7rem; align-items: center; background: var(--surface); border: 2px solid var(--bad); border-radius: 12px; padding: .7rem .8rem; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: slidein .25s ease-out; transition: opacity .5s; }
.cash-alert > div { flex: 1; } .cash-alert.fade { opacity: 0; }
.cash-x { border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Ressources humaines ---------- */
.att-table input { min-width: 0; } .att-table select { min-width: 140px; }
.att-month { font-size: .78rem; }
.att-month th, .att-month td { padding: .3rem .25rem; }
.att-month .sun { background: var(--surface-2); }
.att-month .att-present { color: var(--ok); } .att-month .att-late { color: var(--warn); font-weight: 700; } .att-month .att-absent { color: var(--bad); font-weight: 700; background: var(--bad-bg); }
.att-month .att-leave, .att-month .att-sick, .att-month .att-excused, .att-month .att-mission { color: var(--info); }
.payroll-table { font-size: .88rem; } .payroll-table th { white-space: nowrap; } .payroll-table td.num { white-space: nowrap; }
.payslip table td, .payslip table th { padding: .35rem .5rem; }
.payslip tfoot td { border-top: 2px solid #111; }
@media print { .cash-alerts { display: none !important; } }
/* v11.1 : tableau de bord par service */
.dash-scope { display: flex; align-items: center; gap: .4rem; margin: -.4rem 0 1rem; }
.dash-scope .i { width: 16px; height: 16px; }
.dash-section { margin-bottom: 1.4rem; }
.dash-title { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; margin: 0 0 .6rem; padding-bottom: .35rem; border-bottom: 2px solid var(--primary); color: var(--text, inherit); }
.dash-title .i { width: 20px; height: 20px; color: var(--primary); }
.dash-section .card h3 { margin-top: 0; font-size: .98rem; }
li.row-unpaid { background: transparent; }
/* v11.3 : pharmacie publique, pharmacie interne, stocks des services */
.depot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.depot-card { margin: 0; border-top: 4px solid var(--primary); display: flex; flex-direction: column; gap: .4rem; }
.depot-card.depot-internal { border-top-color: #2563eb; }
.depot-card.depot-service { border-top-color: #9333ea; }
.depot-card h3 { margin: 0; font-size: 1.1rem; }
.depot-card h3 a { color: inherit; text-decoration: none; }
.depot-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #667085); font-weight: 600; }
.depot-figs { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .9rem; }
.depot-card .actions { margin-top: auto; flex-wrap: wrap; }
.depot-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.3rem 0 1rem; font-size: .9rem; }
.depot-switch .i { width: 16px; height: 16px; color: var(--primary); }
.depot-switch .chip { text-decoration: none; border: 1px solid var(--border, #d0d5dd); padding: .25rem .7rem; border-radius: 999px; color: inherit; background: var(--card, #fff); }
.depot-switch .chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.split-card { border-left: 4px solid var(--primary); }
.split-card .plain-list { margin: .5rem 0 1rem; padding-left: 1.2rem; }
.radio-list { display: flex; flex-direction: column; gap: .4rem; margin: .4rem 0 1rem; }
.sign-row { display: none; }
.rx-photo { max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--border, #d0d5dd); }
.consumption form .search { margin-top: .6rem; }
@media print { .sign-row { display: flex; justify-content: space-between; margin-top: 3rem; } .sign-row div { width: 40%; border-top: 1px solid #000; padding-top: .3rem; text-align: center; } }
.radio-opt { display: flex; align-items: flex-start; gap: .55rem; font-weight: 400; cursor: pointer; padding: .55rem .7rem; border: 1px solid var(--border, #d0d5dd); border-radius: 8px; }
.radio-opt input { width: auto; margin: .2rem 0 0; flex: none; }
.radio-opt:has(input:checked) { border-color: var(--primary); background: var(--surface-2, #f5f7f6); }
