/* Caisse du cabinet — interface sobre : papier clair, encre sombre, un seul accent vert. */
:root {
    --paper: #f5f4f0;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --ink: #1b2422;
    --ink-2: #3d4947;
    --muted: #707b78;
    --line: #e4e2db;
    --line-strong: #cfccc2;
    --accent: #0f6b5c;
    --accent-ink: #0b5448;
    --accent-soft: #e9f2ef;
    --side: #14211f;
    --side-ink: #c3cdca;
    --brass: #b8975a;
    --danger: #a63d3d;
    --danger-soft: #f8ecea;
    --amber: #8a6418;
    --amber-soft: #f7f0de;
    --doc-a: #0f6b5c;
    --doc-b: #46557f;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -.01em; line-height: 1.15; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
h3 { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }

/* ---------- Boutons & champs ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong);
    background: var(--surface); font-weight: 500; white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9b6aa; }
.btn:disabled { cursor: not-allowed; }
.btn.primary, .btn.blue { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover, .btn.blue:hover { background: #000; border-color: #000; }
.btn.pay-btn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; letter-spacing: .01em; }
.btn.pay-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.pay-btn:disabled, .btn.primary:disabled { background: #d9d7cf; border-color: #d9d7cf; color: #fff; }
.btn.warn { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn.warn:hover { background: var(--ink); color: #fff; }
.btn.danger { color: var(--danger); border-color: #dcbdb9; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(27, 36, 34, .06); border-color: transparent; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn.lg { min-height: 52px; font-size: 16px; border-radius: 9px; }
.btn.block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input {
    width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--line-strong); background: var(--surface); outline: none;
    transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: #a3aaa7; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 107, 92, .14); }
.input.lg { min-height: 50px; font-size: 16px; padding-left: 44px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input:focus-visible { outline: none; }
input[type="checkbox"] { accent-color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 9px 22px; font-weight: 500; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--ink); color: #fff; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: #eeede8; color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--accent-soft); color: var(--accent-ink); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.doc-0 { --doc: var(--doc-a); }
.doc-1 { --doc: var(--doc-b); }
.doc-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.doc-chip .avatar { background: var(--doc); color: #fff; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e9e7e0; color: var(--ink-2); font-size: 11px; font-weight: 600; letter-spacing: .02em; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 4fr) 6fr; }
.login-brand { background: var(--side); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.mark { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); display: grid; place-items: center; flex: none; }
.mark svg { width: 14px; height: 14px; stroke: var(--brass); stroke-width: 2; }
.login-brand h1 { font-size: 44px; margin-top: 36px; color: #fff; }
.login-brand h1::after { content: ""; display: block; width: 48px; height: 1px; background: var(--brass); margin-top: 22px; }
.login-brand p { color: var(--side-ink); margin-top: 20px; max-width: 30ch; font-size: 15px; }
.login-brand .clock { font-size: 13px; color: var(--side-ink); letter-spacing: .04em; }
.login-main { padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 30px; max-width: 720px; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.user-tile {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); text-align: left;
    background: var(--surface); border: 1px solid var(--line); font-weight: 500;
    transition: border-color .12s, background .12s;
}
.user-tile:hover { border-color: var(--ink); }
.user-tile .avatar { width: 36px; height: 36px; font-size: 13px; }
.user-tile.doctor .avatar { background: var(--ink); color: #fff; }
.pin-card { max-width: 380px; padding: 28px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* ---------- Structure : barre latérale + page ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 26px 16px 20px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; color: #fff; font-family: var(--display); font-size: 18px; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--side-ink); font-weight: 500; text-align: left; position: relative; }
.nav button svg { opacity: .75; }
.nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav button.on { background: rgba(255, 255, 255, .09); color: #fff; }
.nav button.on::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.nav button.on svg { opacity: 1; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 0 8px; }
.side-date { font-size: 12px; letter-spacing: .03em; color: #8e9a97; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .avatar { background: rgba(255, 255, 255, .12); color: #fff; }
.side-name { color: #fff; font-weight: 500; line-height: 1.25; }
.side-role { font-size: 12px; color: #8e9a97; }
.side-logout { border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: var(--side-ink); border-radius: 7px; padding: 8px; font-size: 13px; }
.side-logout:hover { border-color: rgba(255, 255, 255, .45); color: #fff; }
.page { max-width: 1320px; width: 100%; margin: 0 auto; padding: 36px 40px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }

/* ---------- Ouverture de session ---------- */
.open-card { max-width: 680px; margin: 3vh auto 0; padding: 36px; }
.doc-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doc-option { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius); text-align: left; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; }
.doc-option:hover { border-color: var(--ink); }
.doc-option .avatar { background: #e9e7e0; color: var(--ink-2); }
.doc-option.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.doc-option.on .avatar { background: var(--doc); color: #fff; }
.doc-option .check { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.doc-option.on .check { border-color: var(--ink); background: var(--ink); }
.doc-option.on .check::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.report-box { border: 1px solid var(--line); border-left: 3px solid var(--brass); border-radius: 8px; padding: 14px 18px; background: var(--surface-2); }
.report-box h3 { color: var(--muted) !important; }
.report-box .line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.report-box .total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-weight: 600; font-size: 16px; }

/* ---------- Caisse ---------- */
.strip { display: flex; align-items: stretch; padding: 0; margin-bottom: 18px; flex-wrap: wrap; }
.strip > div { padding: 16px 22px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.strip .who { flex: 1; min-width: 280px; flex-direction: row; align-items: center; gap: 18px; justify-content: flex-start; }
.strip .kpi { border-left: 1px solid var(--line); min-width: 160px; }
.strip .kpi span { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.strip .kpi b { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.strip .kpi.main b { color: var(--accent); }
.strip .actions { border-left: 1px solid var(--line); }

.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.step { display: inline-block; font-family: var(--display); font-size: 17px; font-weight: 500; color: var(--brass); margin-right: 10px; }
.step::after { content: "."; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 15px; top: 15px; color: var(--muted); pointer-events: none; }
.results { margin-top: 8px; display: flex; flex-direction: column; }
.result { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.result:hover, .result.active { background: var(--surface-2); }
.result.active { box-shadow: inset 2px 0 0 var(--accent); }
.result .name { font-weight: 600; }
.result.new { color: var(--accent-ink); font-weight: 500; border-bottom: 0; margin-top: 4px; gap: 8px; }
.patient-picked { display: flex; align-items: center; gap: 20px; padding: 4px 0; }
.patient-picked .name { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }

.code { display: inline-block; min-width: 74px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: center; }
.code.sm { min-width: 0; padding: 0 6px; font-size: 11px; font-weight: 500; color: var(--muted); vertical-align: 1px; }
.code-big { display: flex; flex-direction: column; justify-content: center; padding-right: 20px; border-right: 1px solid var(--line); flex: none; }
.code-big span { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.code-big b { font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; color: var(--accent); }

.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.act { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px; min-height: 72px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .12s, background .12s; }
.act:hover { border-color: var(--line-strong); background: var(--surface-2); }
.act .act-img { width: 42px; height: 42px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--act); background: color-mix(in srgb, var(--act) 9%, #fff); }
.act .act-text { display: flex; flex-direction: column; min-width: 0; }
.act .label { font-weight: 600; }
.act .price { color: var(--muted); font-size: 13px; }
.act.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.act.on .act-img { background: var(--act); color: #fff; }
.act .qty { position: absolute; top: 10px; right: 10px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.act.other { --act: #5b6470; border-style: dashed; border-color: var(--line-strong); }

.ticket { position: sticky; top: 24px; }
.ticket-empty { padding: 22px 8px 10px; text-align: center; color: var(--muted); font-size: 13.5px; }
.t-line { display: grid; grid-template-columns: 1fr auto 92px 26px; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.t-line .t-label { font-weight: 500; border: 0; background: transparent; padding: 6px 0; width: 100%; min-width: 0; outline: none; border-bottom: 1px dashed transparent; }
.t-line input.t-label { border-bottom-color: var(--line-strong); }
.t-line input.t-label:focus { border-bottom-color: var(--accent); }
.t-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 9px; vertical-align: 1px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.stepper button { width: 28px; height: 32px; border: 0; background: transparent; color: var(--ink-2); font-size: 15px; }
.stepper button:hover { background: var(--surface-2); }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; }
.t-price { text-align: right; min-height: 34px; padding: 5px 9px; font-weight: 600; }
.x { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: #a3aaa7; font-size: 17px; line-height: 1; }
.x:hover { background: var(--danger-soft); color: var(--danger); }
.t-total { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 0 16px; }
.t-total span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.t-total b { font-size: 34px; font-weight: 600; letter-spacing: -.02em; }

.pay-list { display: flex; flex-direction: column; }
.pay { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pay:last-child { border-bottom: 0; }
.pay .time { width: 40px; color: var(--muted); font-size: 12.5px; flex: none; }
.pay .amount { font-weight: 600; white-space: nowrap; }
.pay.cancelled .grow, .pay.cancelled .amount { text-decoration: line-through; color: var(--muted); }

/* ---------- Tableaux ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); font-weight: 600; white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl td.right, .tbl th.right { text-align: right; }
.tbl tr.cancelled td { color: var(--muted); text-decoration: line-through; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 0; }
.tbl .input { min-height: 36px; }
.table-scroll { overflow-x: auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { padding: 18px 22px; }
.kpi-card h3::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--doc, var(--ink)); margin-right: 8px; vertical-align: 1px; }
.kpi-card b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.notice { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 8px; border: 1px solid #e3d3a6; background: var(--amber-soft); color: #5e430c; margin-bottom: 16px; }

/* ---------- Fenêtres ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 33, 31, .5); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: min(540px, 100%); background: var(--surface); border-radius: 12px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .28); }
.modal.wide { width: min(760px, 100%); }
.modal h2 { font-family: var(--display); font-size: 22px; font-weight: 500; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sum-line.big { font-size: 19px; font-weight: 600; border-bottom: 0; padding-top: 14px; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 80; padding: 12px 18px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); }
#toast.success { background: var(--accent-ink); }

.print-only { display: none; }

@media (max-width: 1180px) {
    .pos { grid-template-columns: 1fr; }
    .ticket { position: static; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
    .brand { padding: 0; font-size: 16px; }
    .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; }
    .nav button.on::before { display: none; }
    .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
    .side-date, .side-role { display: none; }
    .page { padding: 20px 16px 40px; }
    .login { grid-template-columns: 1fr; }
    .login-brand, .login-main { padding: 28px 22px; }
    .login-brand h1 { font-size: 30px; margin-top: 18px; }
    .doc-choice, .grid2 { grid-template-columns: 1fr; }
    .strip .kpi, .strip .actions { border-left: 0; border-top: 1px solid var(--line); flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
    body { background: #fff; font-size: 12px; }
    .side, .no-print, #toast, #modal-root { display: none !important; }
    .shell { display: block; }
    .page { padding: 0; max-width: none; }
    .card { border: 1px solid #bbb; break-inside: avoid; }
    .print-only { display: block; }
}

/* Formulaire patient : code et médecin */
.code-next { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface-2); flex-wrap: wrap; }
.doc-choice.compact .doc-option { padding: 10px 12px; font-weight: 500; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager:empty { display: none; }
.pager-pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pager-btn:hover { border-color: var(--line-strong); }
.pager-btn.on { background: var(--ink); color: #fff; }
.pager-gap { color: var(--muted); padding: 0 2px; }
.btn:disabled { opacity: .45; }
.tbl td.num { white-space: nowrap; }
.tbl .doc-chip { font-weight: 500; font-size: 13px; }
.tbl .doc-chip .avatar { width: 22px; height: 22px; font-size: 9.5px; }

/* ---------- Liste d'attente ---------- */
.q-title { margin: 20px 0 4px; }
.queue > .q-title:first-child { margin-top: 0; }
.q-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.q-num { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 20px; font-weight: 700; letter-spacing: -.02em; background: var(--surface-2); border: 1px solid var(--line-strong); }
.q-cabinet .q-num { background: var(--amber-soft); border-color: #e3d3a6; color: var(--amber); }
.q-termine .q-num { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 2px 0; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.q-main:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.q-main .name { font-weight: 600; font-size: 15.5px; }
.q-obs { margin-top: 3px; font-weight: 700; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.queue.full .q-obs { display: block; font-size: 15.5px; }
.queue.full .q-row { align-items: flex-start; padding: 14px 0; }
.q-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; flex: none; max-width: 60%; }
.icon-btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); border-color: #b9b6aa; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.q-closed { margin-top: 18px; }
.q-closed summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.q-done .q-num { width: 34px; height: 34px; font-size: 15px; color: var(--muted); }
.q-done .q-main { flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.q-done .q-main .name { font-size: 14.5px; font-weight: 500; }
.obs-input { font-size: 16px; font-weight: 600; line-height: 1.45; resize: vertical; }
.obs-input::placeholder { font-weight: 400; }
.modal-foot.wrap { flex-wrap: wrap; }

/* Fenêtre d'encaissement */
.modal.xl { width: min(1040px, 100%); align-self: start; margin: 3vh 0; }
.pay-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.pay-ticket { border-left: 1px solid var(--line); padding-left: 24px; }
@media (max-width: 900px) {
    .pay-grid { grid-template-columns: 1fr; }
    .pay-ticket { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
    .q-row { flex-wrap: wrap; }
    .q-actions { max-width: none; width: 100%; justify-content: flex-start; padding-left: 60px; }
}

/* ---------- Fiche imprimée remise au médecin ---------- */
#print-root { display: none; }
.fiche { max-width: 180mm; margin: 0 auto; color: #000; font-family: var(--font); font-size: 11pt; }
.fiche-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 8px; border-bottom: 2.5px solid #000; }
.fiche-cab { font-family: var(--display); font-size: 20pt; font-weight: 600; line-height: 1.1; }
.fiche-doc { font-size: 12pt; font-weight: 700; text-align: right; }
.fiche-top { display: flex; align-items: stretch; gap: 18px; margin: 14px 0 4px; }
.fiche-num { border: 3px solid #000; border-radius: 8px; padding: 8px 22px; text-align: center; flex: none; }
.fiche-num b { display: block; font-size: 46pt; font-weight: 800; line-height: 1; }
.fiche-when { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.fiche-when b { display: block; font-size: 15pt; font-weight: 700; line-height: 1.2; }
.fiche span, .fiche h4 { display: block; margin: 0; font-size: 8.5pt; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #333; }
.fiche h4 { margin: 18px 0 6px; padding-bottom: 3px; border-bottom: 1px solid #000; color: #000; }
.fiche-name { font-size: 24pt; font-weight: 800; line-height: 1.15; margin-bottom: 10px; overflow-wrap: anywhere; }
.fiche-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 22px; }
.fiche-info b { font-size: 13pt; font-weight: 700; }
.fiche-obs { min-height: 60mm; padding: 12px 14px; border: 2px solid #000; border-radius: 8px; font-size: 16pt; font-weight: 700; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
@media print {
    body.print-fiche #app { display: none !important; }
    body.print-fiche #print-root { display: block; }
}

/* ---------- Couleurs : nom du patient, date et heure, statut de la liste d'attente ---------- */
:root { --name: #1d3f72; --time: #9a4f17; --time-soft: #fbefe3; --wait: #2f5f9e; --wait-soft: #edf3fb; }
.q-attente { --st: var(--wait); --st-soft: var(--wait-soft); }
.q-cabinet { --st: #b07d12; --st-soft: var(--amber-soft); }
.q-termine { --st: var(--accent); --st-soft: var(--accent-soft); }
.q-retire { --st: var(--danger); --st-soft: var(--danger-soft); }

.q-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; color: var(--st, var(--muted)); }
.q-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st, var(--muted)); }
.q-row, .queue.full .q-row { padding: 12px 14px; margin-bottom: 8px; border: 1px solid color-mix(in srgb, var(--st) 28%, #fff); border-left: 5px solid var(--st); border-radius: 10px; background: var(--st-soft); }
.q-row .q-num, .q-cabinet .q-num, .q-termine .q-num { background: var(--st); border-color: var(--st); color: #fff; }
.q-main .name, .pay-name { color: var(--name); font-weight: 700; }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.q-time { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 5px; background: var(--time-soft); color: var(--time); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.q-row .q-time { background: #fff; }
.q-row .icon-btn, .q-row .btn:not(.primary):not(.pay-btn) { background: #fff; }
.q-row .btn.primary { background: var(--st); border-color: var(--st); }
.q-done { opacity: .9; }
.q-done .q-num { color: #fff; }
.q-done .q-main .name { font-weight: 600; }

/* Encaissements de la session : une carte par encaissement */
.pay-cards { display: flex; flex-direction: column; gap: 10px; }
.pay-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.pay-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); min-height: 40px; }
.pay-body { display: flex; align-items: center; gap: 12px; padding: 12px; }
.pay-name { font-size: 15px; }
.pay-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pay-tag { padding: 2px 8px; border-radius: 999px; background: #eeede8; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.pay-amount { flex: none; padding: 6px 12px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; }
.pay-card.cancelled { border-color: #e6cbc7; }
.pay-card.cancelled .pay-head { background: var(--danger-soft); border-color: #e6cbc7; }
.pay-card.cancelled .pay-name, .pay-card.cancelled .pay-tag { text-decoration: line-through; color: var(--muted); }
.pay-card.cancelled .pay-amount { background: #e9e7e0; color: var(--muted); text-decoration: line-through; }

/* Passages terminés : entrée, sortie, durée chez le médecin ; motif des départs */
.q-done .q-main { flex-direction: column; align-items: stretch; gap: 2px; }
.q-io { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.q-io b { color: var(--ink); }
.q-dur { padding: 1px 8px; border-radius: 5px; background: var(--st, var(--accent)); color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.q-motif { font-size: 13px; font-weight: 700; color: var(--danger); overflow-wrap: anywhere; }

/* Bouton de clôture en rouge */
.btn.red { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.red:hover { background: #8a2f2f; border-color: #8a2f2f; }

/* Rapport de session (à l'écran dans la fenêtre, et imprimé) */
.report { max-width: none; }
.report .tbl td, .report .tbl th { padding: 6px 8px; }
.report .tbl td b { font-size: inherit; }
.report .sum-line { padding: 6px 0; }
.report .sum-line span, .report .tbl span { display: inline; font-size: inherit; font-weight: inherit; letter-spacing: 0; text-transform: none; color: inherit; }
.report .sum-line.big { font-size: 15pt; border-top: 2px solid #000; margin-top: 4px; }
.report-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 28px; }
.report-sign div { border-top: 1px solid #000; padding-top: 6px; font-size: 9pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; min-height: 22mm; }
.modal .report { font-size: 13px; }
.modal .report .fiche-cab { font-size: 22px; }
.modal .report .fiche-info b { font-size: 14px; }
.modal .report .sum-line.big { font-size: 18px; }
