/* ============================================================
   Dossier Médical & Chirurgical — design (réf. : sidebar claire,
   bandeaux navy, sous-titres filet doré, tableaux à en-tête sombre)
   ============================================================ */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #16263a;
  --ink-2: #33475f;
  --muted: #6b7d92;
  --line: #e4e9f0;
  --line-2: #d2dbe6;

  --navy: #173a5e;
  --navy-2: #1f4d7a;
  --navy-bar: linear-gradient(180deg, #1f4a76 0%, #173a5e 100%);
  --tbl-head: #16263a;
  --indigo: #4f46e5;
  --indigo-d: #4338ca;
  --teal: #0ea5a5;
  --gold: #d9a441;
  --violet: #6d5ef0;

  --ok: #1f9d57;  --ok-soft: #e4f6ec;
  --warn: #c67d12; --warn-soft: #fcf2dd;
  --crit: #d23b32; --crit-soft: #fce8e6;
  --info: #2563c9; --info-soft: #e7f0fc;
  --blue-soft: #e7f0fc;

  --shadow-sm: 0 1px 2px rgba(20,40,60,.05), 0 1px 3px rgba(20,40,60,.04);
  --shadow: 0 6px 22px rgba(20,40,60,.10);
  --shadow-lg: 0 20px 50px rgba(15,40,70,.20);
  --r: 11px; --r-sm: 8px; --r-xs: 6px;
  --sb-w: 250px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
a { color: var(--indigo); text-decoration: none; cursor: pointer; }
button { font-family: inherit; }
::selection { background: #cfe0f5; }

.app { display: grid; grid-template-columns: var(--sb-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar (claire) ---------- */
.sidebar { background: #fbfcfe; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto; background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; display: grid; place-items: center; font-size: 19px; font-weight: 700; box-shadow: 0 4px 12px rgba(23,58,94,.3); }
.brand-name { font-size: 15px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.sb-search { padding: 12px 14px 4px; }
.sb-search input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); border-radius: 8px; padding: 8px 11px; font-size: 13px; outline: none; }
.sb-search input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.nav { padding: 8px 10px; overflow-y: auto; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink-2); cursor: pointer; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 500; margin: 1px 0; position: relative; }
.nav-item .ic { font-size: 15px; width: 20px; text-align: center; filter: grayscale(.3); }
.nav-item:hover { background: #eef2f7; color: var(--ink); }
.nav-item.active { background: #e8eff8; color: var(--navy); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: var(--navy-2); }
.nav-item .badge-n { margin-left: auto; background: var(--line); color: var(--ink-2); font-size: 11px; padding: 1px 7px; border-radius: 20px; font-weight: 700; }
.sb-actions { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.sb-actions-row { display: flex; gap: 6px; }
.sb-actions-row .btn { flex: 1; justify-content: center; }
.sb-status { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 9px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--warn); box-shadow: 0 0 0 3px rgba(198,125,18,.18); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,87,.2); }
.sb-status a { font-size: 11.5px; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.9); backdrop-filter: saturate(150%) blur(8px); border-bottom: 1px solid var(--line); padding: 11px 24px; display: flex; align-items: center; gap: 16px; }
.topbar h1 { font-size: 16px; }
.topbar .crumb { font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.save-state { font-size: 12px; color: var(--warn); font-weight: 600; }
.save-state.saved { color: var(--ok); }
.patient-chip { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 5px; }
.patient-chip .pc-name { font-weight: 700; font-size: 13px; }
.patient-chip .pc-meta { font-size: 11px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; background: linear-gradient(135deg, var(--navy-2), var(--navy)); }
.avatar.f { background: linear-gradient(135deg, #d2699c, #a83a73); }

.content { padding: 22px 24px 60px; max-width: 1200px; width: 100%; margin: 0 auto; }
.section { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sec-head h2 { font-size: 19px; }
.sec-head .sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }

/* ---------- Panel (carte à bandeau navy) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); margin-bottom: 18px; overflow: hidden; }
.panel-bar { background: var(--navy-bar); color: #fff; padding: 12px 18px; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; }
.panel-bar .ic { font-size: 16px; }
.panel-bar .spacer { flex: 1; }
.panel-bar .btn { padding: 5px 10px; font-size: 12px; }
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }

/* sous-titre filet doré */
.sublabel { text-transform: uppercase; font-size: 11px; letter-spacing: .05em; color: var(--navy); font-weight: 800; padding-bottom: 6px; border-bottom: 2px solid var(--gold); margin: 18px 0 13px; }
.sublabel:first-child { margin-top: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 11px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .02em; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: 8px 10px; font-size: 13.5px; color: var(--ink); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
input::placeholder, textarea::placeholder { color: #9aabbe; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 18px; }
.form-grid.wide { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid { display: grid; gap: 18px; }
.grid.g2 { grid-template-columns: 1fr 1fr; }
.grid.g3 { grid-template-columns: repeat(3,1fr); }
@media (max-width: 980px){ .grid.g2,.grid.g3 { grid-template-columns: 1fr; } }

/* checkbox grids (antécédents) */
.ckgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 18px; }
@media (max-width: 760px){ .ckgrid { grid-template-columns: 1fr 1fr; } }
.ckopt { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.ckopt input { width: auto; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: 8px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; white-space: nowrap; }
.btn:hover { border-color: var(--indigo); color: var(--indigo); background: #f1f1fe; }
.btn.primary { background: var(--indigo); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.25); }
.btn.primary:hover { background: var(--indigo-d); color: #fff; }
.btn.navy { background: var(--navy); border-color: transparent; color: #fff; }
.btn.navy:hover { background: var(--navy-2); color: #fff; }
.btn.teal { background: var(--teal); border-color: transparent; color: #fff; }
.btn.teal:hover { filter: brightness(1.06); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #f1f1fe; }
.btn.danger:hover { border-color: var(--crit); color: var(--crit); background: var(--crit-soft); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.block { justify-content: center; width: 100%; }
.btn.icon { padding: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.blue { background: var(--blue-soft); color: var(--info); }
.badge.teal { background: #e0f7f6; color: #0b7d7d; }
.badge.violet { background: #ecebfe; color: #5546d8; }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.grey { background: #eef2f7; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px 4px 12px; font-size: 12.5px; font-weight: 500; }
.chip .x { cursor: pointer; color: var(--muted); font-weight: 700; }
.chip .x:hover { color: var(--crit); }

/* ---------- Tables ---------- */
table.tbl, table.dtl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: var(--surface-2); }
/* tableau de bilan à en-tête sombre */
table.dtl thead th { background: var(--tbl-head); color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; padding: 8px 12px; text-align: left; }
table.dtl tbody td { padding: 7px 12px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
table.dtl tbody tr:hover td { background: var(--surface-2); }
.dtl input { padding: 5px 8px; }
.cell-ref { color: var(--muted); font-size: 12px; }
.st-ok { color: var(--ok); font-weight: 700; } .st-high { color: var(--crit); font-weight: 700; } .st-low { color: var(--info); font-weight: 700; }

/* ---------- Vitals ---------- */
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }
.vital { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; background: var(--surface); }
.vital .vl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.vital .vv { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.vital .vu { font-size: 11px; color: var(--muted); font-weight: 600; }
.vital.is-high { border-color: var(--crit); background: var(--crit-soft); } .vital.is-high .vv { color: var(--crit); }
.vital.is-low { border-color: var(--info); background: var(--info-soft); } .vital.is-low .vv { color: var(--info); }
.vital.is-ok { border-color: var(--ok); }

/* ---------- Search dropdown ---------- */
.search-wrap { position: relative; }
.results { position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; display: none; }
.results.open { display: block; }
.res-item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.res-item:hover, .res-item.hl { background: var(--blue-soft); }
.res-item .r-dci { font-weight: 700; font-size: 13.5px; }
.res-item .r-meta { font-size: 11.5px; color: var(--muted); }
.res-item .r-cat { margin-left: auto; }

/* ---------- Tabs / filters ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); background: var(--surface); }
.filter:hover { border-color: var(--indigo); color: var(--indigo); }
.filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Patient list ---------- */
.plist { display: grid; gap: 9px; }
.pcard { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.pcard:hover { border-color: var(--indigo); box-shadow: var(--shadow); }
.pcard.current { border-color: var(--teal); box-shadow: 0 0 0 2px #e0f7f6; }
.pcard .pc-main { flex: 1; min-width: 0; }
.pcard .pc-n { font-weight: 700; font-size: 14px; }
.pcard .pc-d { font-size: 12px; color: var(--muted); }
.pcard .pc-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .12s; }
.pcard:hover .pc-actions { opacity: 1; }

/* protocol card */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.protocol { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 13px; background: var(--surface); }
.protocol:hover { border-color: var(--indigo); box-shadow: var(--shadow-sm); }
.protocol .pt { font-weight: 700; font-size: 13.5px; margin: 5px 0 4px; }
.protocol .pl { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* ---------- Score gauge ---------- */
.score-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge { --p: 0; --c: var(--ok); width: 124px; height: 124px; border-radius: 50%; flex: 0 0 auto; background: conic-gradient(var(--c) calc(var(--p)*1%), #e6ecf3 0); display: grid; place-items: center; position: relative; }
.gauge::before { content: ""; position: absolute; inset: 11px; background: var(--surface); border-radius: 50%; box-shadow: inset 0 1px 4px rgba(20,40,60,.08); }
.gauge .gv { position: relative; font-size: 32px; font-weight: 800; line-height: 1; }
.gauge .gl { position: relative; font-size: 11px; color: var(--muted); font-weight: 600; }

/* reco / alerts */
.reco { display: flex; gap: 10px; padding: 10px 13px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 8px; }
.reco .rico { font-size: 15px; flex: 0 0 auto; }
.reco.crit { background: var(--crit-soft); border-color: #f3c6c3; }
.reco.warn { background: var(--warn-soft); border-color: #f0dcb4; }
.reco.ok { background: var(--ok-soft); border-color: #c2e9cf; }
.alert { display: flex; gap: 11px; padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; align-items: flex-start; }
.alert.crit { background: var(--crit-soft); color: #8c211b; border: 1px solid #f1c4c1; }
.alert.warn { background: var(--warn-soft); color: #855104; border: 1px solid #efd9ad; }
.alert.info { background: var(--blue-soft); color: #18467f; border: 1px solid #c3dcf6; }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .ei { font-size: 38px; opacity: .5; margin-bottom: 8px; }
.empty h3 { color: var(--ink-2); margin-bottom: 4px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.disclaimer { font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line-2); padding-top: 10px; margin-top: 8px; }

/* toast / modal */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg); animation: tin .25s ease; max-width: 340px; }
.toast.ok { background: #14713b; } .toast.err { background: #a52a23; }
@keyframes tin { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.modal-bg { position: fixed; inset: 0; background: rgba(8,24,42,.5); backdrop-filter: blur(2px); z-index: 150; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-lg); max-width: 600px; width: 100%; max-height: 86vh; overflow-y: auto; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 15px; } .modal-b { padding: 18px 20px; } .modal-f { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

/* checklist (examens à demander) */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 5px; }
.ckitem { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-xs); cursor: pointer; font-size: 13px; background: var(--surface); }
.ckitem:hover { border-color: var(--indigo); background: #f1f1fe; }
.ckitem.on { border-color: var(--teal); background: #e0f7f6; }
.ckitem input { width: auto; }

/* PRINT */
.print-only { display: none; }
/* Styles de bloc d'ordonnance — définis HORS @media print pour pouvoir mesurer la hauteur du contenu
   (pagination manuelle). Invisibles à l'écran : seuls la zone d'impression et le div de mesure les utilisent. */
.ord-blk .p-name { display: block; font-size: 15pt; font-weight: 700; color: #111; }
.ord-blk .p-sub { font-size: 11pt; color: #444; }
.ord-blk .m-rx { font-weight: 700; color: #111; font-size: 12pt; margin-top: 4px; }
.ord-blk .m-po { font-size: 10.5pt; color: #555; margin: 0 0 2px; }
.ord-blk .ord-sec { font-weight: 700; font-size: 12pt; margin: 10px 0 4px; }
.ord-blk .ord-exams { font-size: 12.5pt; line-height: 1.7; }
.ord-blk .ord-fine { font-size: 8.5pt; color: #777; margin-top: 3px; }
.ord-blk .ord-reco { font-size: 11pt; margin-top: 12px; }
.ord-blk .ord-sign { text-align: right; font-size: 11pt; color: #555; margin-top: 20px; }
.ord-measure { font-family: "Helvetica Neue", Arial, sans-serif; color: #15233f; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; font-size: 12pt; }
  #appRoot, .login-overlay, .toasts, .no-print, .modal-bg { display: none !important; }
  .print-only { display: block !important; }
  /* Synthèse / consentement : document texte simple */
  .rx-doc { color: #111; font-family: "Georgia", "Times New Roman", serif; padding: 14mm 16mm; }
  .rx-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--navy); padding-bottom: 10px; }
  .rx-doc h1, .rx-doc h2, .rx-doc h3 { color: var(--navy); }
  .rx-foot { margin-top: 40px; border-top: 1px solid #999; padding-top: 8px; font-size: 10pt; display: flex; justify-content: space-between; }
  /* Ordonnance & demandes d'examens : pagination manuelle — CHAQUE page a son propre en-tête + pied
     (garanti sur tout navigateur). Le pied est collé en bas (flex), le corps a une marge haute confortable. */
  .ord-page { width: 210mm; height: 297mm; box-sizing: border-box; display: flex; flex-direction: column;
              overflow: hidden; page-break-after: always; color: #15233f; font-family: "Helvetica Neue", Arial, sans-serif; }
  .ord-page:last-child { page-break-after: auto; }
  .ord-header { position: relative; flex: 0 0 auto; }
  .ord-footer { flex: 0 0 auto; }
  .ord-hd, .ord-ft { display: block; width: 210mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ord-date { position: absolute; top: 85%; left: 64%; font-size: 12pt; }
  .ord-body { flex: 1 1 auto; overflow: hidden; padding: 9mm 16mm 4mm; }
}

/* ---------- Login ---------- */
.login-overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #0c3f78 0%, #0a2b54 60%, #06203f 100%); }
.login-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 28px 26px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.login-title { font-size: 16px; font-weight: 800; color: var(--navy); line-height: 1.15; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-error { color: var(--crit); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; font-weight: 600; }
.login-hint { font-size: 11px; color: var(--muted); text-align: center; margin: 14px 0 0; }

/* ===================== AGENDA + FACTURATION (Phase 1) ===================== */
.ag-nav{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.ag-pracsel{ padding:5px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.ag-label{ font-weight:700; color:var(--navy,#1e293b); margin:6px 2px 10px; }
.ag-wrap{ border:1px solid var(--line); border-radius:12px; overflow:hidden; background:var(--surface,#fff); }
.ag-heads{ display:grid; grid-template-columns:48px repeat(7,1fr); border-bottom:1px solid var(--line); background:#f8fafc; }
.ag-corner{ }
.ag-head{ padding:7px 4px; text-align:center; font-size:12px; border-left:1px solid var(--line); }
.ag-head.today{ background:#eef5ff; }
.ag-dow{ color:#64748b; } .ag-dn{ font-weight:700; }
.ag-cal{ display:grid; grid-template-columns:48px repeat(7,1fr); position:relative; }
.ag-gutter{ position:relative; }
.ag-hr{ position:absolute; right:5px; transform:translateY(-7px); font-size:11px; color:#94a3b8; }
.ag-col{ position:relative; border-left:1px solid var(--line); cursor:pointer; }
.ag-col.today{ background:#fafcff; } .ag-col.closed{ background:repeating-linear-gradient(45deg,#f8fafc,#f8fafc 6px,#f1f5f9 6px,#f1f5f9 12px); }
.ag-line{ position:absolute; left:0; right:0; border-top:1px solid #eef2f7; }
.ag-now{ position:absolute; left:0; right:0; border-top:2px solid #e11d48; z-index:4; }
.ag-now::before{ content:''; position:absolute; left:0; top:-4px; width:6px; height:6px; border-radius:50%; background:#e11d48; }
.ag-appt{ position:absolute; touch-action:none; border-radius:6px; background:#eef2ff; border-left:3px solid #64748b; padding:2px 5px; font-size:11px; overflow:hidden; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.08); z-index:2; }
.ag-appt:hover{ filter:brightness(.97); z-index:5; box-shadow:0 2px 6px rgba(0,0,0,.16); }
.ag-appt .ag-t{ font-weight:700; color:#475569; } .ag-appt .ag-n{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .ag-appt .ag-m{ color:#64748b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-appt.s-confirme{ background:#e0ecff; } .ag-appt.s-arrive{ background:#cffafe; } .ag-appt.s-honore{ background:#dcfce7; } .ag-appt.s-absent{ background:#fee2e2; }
.ag-appt.s-annule{ background:#f1f5f9; opacity:.6; } .ag-appt.s-annule .ag-n{ text-decoration:line-through; }
.pres{ position:relative; }
.pres-item{ padding:6px 9px; cursor:pointer; border-bottom:1px solid var(--line); }
.pres-item:hover{ background:#eef5ff; }
#agPatRes, #invPatRes{ max-height:180px; overflow:auto; border:1px solid var(--line); border-radius:8px; margin-top:4px; }
#agPatRes:empty, #invPatRes:empty{ border:0; }
.ag-total{ font-size:14px; padding-top:6px; }
.dtl td.num, .dtl th.num{ text-align:right; white-space:nowrap; }
.dtl td.num.due, .ag-total b.due{ color:#b91c1c; font-weight:700; }
.etat-foot td{ font-weight:700; border-top:2px solid var(--line); background:#f8fafc; }
@media (max-width:760px){ .ag-appt{ font-size:10px; } .ag-hr{ font-size:10px; } }

/* Phase 3 — multi-provider legend + dots */
.ag-legend{ display:inline-flex; gap:6px; flex-wrap:wrap; align-items:center; }
.ag-lchip{ display:inline-flex; align-items:center; gap:5px; padding:2px 9px; border:1px solid var(--line); border-radius:999px; cursor:pointer; font-size:12px; user-select:none; }
.ag-lchip.off{ opacity:.45; text-decoration:line-through; }
.ag-pdot{ display:inline-block; width:8px; height:8px; border-radius:50%; flex:0 0 auto; }
.ag-appt .ag-pdot{ position:absolute; top:3px; right:3px; }
