/* ==========================================================================
   Sanelio V9 — styles des modules métier
   Tableau de bord · Patients · Agenda · Odontogramme · Finances · Stocks ·
   Documents imprimables · Administration
   ========================================================================== */

/* Tableau de bord ---------------------------------------------------------- */
.next-up { display: flex; align-items: center; gap: 14px; margin: 0 20px 14px; padding: 12px 14px; border-radius: var(--radius); background: linear-gradient(90deg, var(--accent-soft), transparent); border: 1px solid color-mix(in srgb, var(--brand-200) 60%, var(--border)); }
.next-up .next-time { font-size: 22px; font-weight: 750; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.next-up small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.next-up .grow { flex: 1; min-width: 0; }
.day-flow { display: grid; }
.flow-row { display: grid; grid-template-columns: 58px 4px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--border); }
.flow-row:hover { background: var(--surface-2); }
.flow-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.flow-time b { display: block; font-variant-numeric: tabular-nums; font-size: 14px; }
.flow-time small { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.flow-color { width: 4px; height: 34px; border-radius: 4px; }
.flow-main { min-width: 0; }
.flow-main a { display: inline; }
.flow-main small { display: block; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-status { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.flow-status .chip svg { width: 13px; height: 13px; }
.flow-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; min-width: 132px; }
.flow-row.is-cancelled .flow-main a, .flow-row.is-cancelled .flow-time b { text-decoration: line-through; color: var(--text-3); }
.flow-row.is-done { opacity: .72; }
.alert-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; margin-left: 6px; vertical-align: 1px; }
.todo-item { color: var(--text); }
.todo-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; border: 0; }
.todo-icon svg { width: 17px; height: 17px; }
.empty-state.compact { padding: 18px 10px; }
.empty-state.compact .empty-icon { width: 38px; height: 38px; background: var(--success-bg); color: var(--success); }
.quick-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.quick-tiles a { display: grid; gap: 2px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text); background: var(--surface-2); }
.quick-tiles a:hover { border-color: var(--accent); background: var(--accent-soft); }
.quick-tiles .tile-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--accent); margin-bottom: 6px; box-shadow: var(--shadow-xs); }
.quick-tiles .tile-icon svg { width: 16px; height: 16px; }
.quick-tiles small { color: var(--text-3); font-size: 12px; }

@media (max-width: 700px) {
  .flow-row { grid-template-columns: 50px 4px minmax(0, 1fr); padding: 10px 14px; row-gap: 8px; }
  .flow-status, .flow-actions { grid-column: 3; justify-content: flex-start; min-width: 0; }
  .next-up { margin: 0 14px 12px; }
}

/* Éléments partagés ---------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 20px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.mini-stats span { display: grid; justify-items: center; padding: 10px 6px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.mini-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stats small { color: var(--text-3); font-size: 11.5px; }
.sticky-col { position: sticky; top: calc(var(--topbar-h) + 16px); }
.min0 { min-width: 0; }
.info-list.stacked > div { grid-template-columns: 1fr; gap: 2px; }
.info-list.stacked dt { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.chip-btn { height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 560; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-size: 12.5px; font-family: var(--mono); background: var(--surface-2); }
.segmented.block { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-bottom: 8px; }
.segmented.block button { justify-content: center; }
.anchor-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; }
.anchor-nav a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 560; box-shadow: var(--shadow-xs); }
.anchor-nav a:hover { color: var(--accent); border-color: var(--accent); }
.kpi .kpi-text { font-size: 18px; letter-spacing: -.01em; }
.wide-modal { width: min(820px, 100%); }
.status-select { height: 30px; min-height: 30px; padding: 0 28px 0 10px; font-size: 12.5px; font-weight: 600; border-radius: 8px; width: auto; }
.status-select.tone-success { background-color: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.status-select.tone-warning { background-color: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.status-select.tone-info { background-color: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.status-select.tone-danger { background-color: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.dropzone { position: relative; display: grid; place-items: center; min-height: 110px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.dropzone span { display: grid; justify-items: center; gap: 2px; color: var(--text-2); pointer-events: none; }
.dropzone svg { width: 24px; height: 24px; color: var(--accent); }
.dropzone small { color: var(--text-3); font-weight: 450; }
.dropzone.has-file b { color: var(--accent); }
.metric-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 8px; }
.metric-strip span { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); display: grid; }
.metric-strip small { color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.metric-strip b { font-size: 17px; font-variant-numeric: tabular-nums; }
.metric-strip.delta span.up b { color: var(--info); }
.metric-strip.delta span.down b { color: var(--warning); }

/* Dossier patient -------------------------------------------------------------- */
.patient-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 20px; padding: 22px 24px; margin-bottom: 8px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand-100) 60%, var(--surface)) 0%, var(--surface) 55%); }
.patient-id { display: flex; gap: 18px; align-items: flex-start; min-width: 0; }
.patient-id h1 { font-size: 26px; letter-spacing: -.02em; margin: 2px 0 6px; }
.patient-id .crumbs { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.patient-id .crumbs a { color: var(--text-3); }
.patient-id .crumbs .ico { width: 13px; height: 13px; }
.patient-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13.5px; }
.patient-meta a { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.patient-meta a:hover { color: var(--accent); }
.patient-meta .ico { width: 15px; height: 15px; color: var(--text-3); }
.patient-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.flag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.flag .ico { width: 14px; height: 14px; }
.flag.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.flag.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.patient-actions { display: flex; gap: 8px; align-items: flex-start; }
.patient-glance { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.patient-glance > div { display: grid; padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
.patient-glance > div:last-child { border-right: 0; }
.patient-glance small { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.patient-glance b { font-size: 15px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-glance span { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-tabs { position: sticky; top: var(--topbar-h); z-index: 6; background: var(--bg); padding-top: 6px; }
.patient-tabs .count { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-3); border-radius: 8px; padding: 1px 6px; margin-left: 4px; }
.task.is-closed .title { text-decoration: line-through; color: var(--text-3); }
.task-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; }
.task-check:hover { border-color: var(--success); }
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check .ico { width: 14px; height: 14px; }
.note-editor textarea { min-height: 150px; font-size: 14.5px; }
.note-list { display: grid; gap: 12px; }
.note-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); }
.note-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.note-meta small { display: block; color: var(--text-3); font-size: 12px; }
.note-body { white-space: normal; line-height: 1.6; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.doc-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: grid; }
.doc-thumb { position: relative; display: grid; place-items: center; height: 120px; background: var(--surface-3); overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-ext { display: grid; justify-items: center; gap: 4px; color: var(--text-3); font-weight: 700; font-size: 12px; }
.doc-ext .ico { width: 28px; height: 28px; }
.doc-cat { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(6, 38, 58, .72); color: #fff; font-size: 11px; font-weight: 600; }
.doc-info { padding: 9px 11px 11px; display: grid; min-width: 0; }
.doc-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-info small { color: var(--text-3); font-size: 11.5px; }
.doc-notes { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-menu { position: absolute; top: 6px; right: 6px; }
.doc-menu > .btn { background: rgba(255, 255, 255, .92); box-shadow: var(--shadow-sm); }
.sequence-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--border); }
.sequence-row small { display: block; color: var(--text-3); }

/* Odontogramme ------------------------------------------------------------------ */
.odonto-stats { display: flex; gap: 8px; }
.odonto-stats span { display: grid; justify-items: center; min-width: 78px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.odonto-stats b { font-size: 18px; color: var(--text); }
.odonto-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.odonto-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.odonto-legend span { display: inline-flex; align-items: center; gap: 6px; }
.odonto-legend i { width: 16px; height: 16px; border-radius: 5px; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; }
.lg-existing { background: #dbe7ee; border: 1px solid #aebfca; }
.lg-planned { border: 2px solid var(--brand-500); background: var(--brand-50); }
.lg-done { background: var(--success); color: #fff; }
.lg-missing { background: var(--surface-3); color: var(--danger); }
.dentition-control { margin-left: auto; position: relative; }
.dentition-control summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); background: var(--surface); }
.dentition-control summary::-webkit-details-marker { display: none; }
.dentition-control .ico { width: 15px; height: 15px; }
.dentition-control[open] .dentition-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(520px, 90vw); padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: grid; gap: 10px; }
.tooth-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; }
.tooth-check-grid label { display: flex; flex-direction: row; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; }
.mouth { padding: 16px 12px 8px; border-radius: var(--radius-lg); background: radial-gradient(ellipse at center, color-mix(in srgb, var(--brand-50) 80%, var(--surface)) 0%, var(--surface-2) 70%); border: 1px solid var(--border); overflow-x: auto; }
.arch { display: grid; gap: 4px; justify-items: center; }
.arch-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.tooth-row { display: flex; gap: 3px; justify-content: center; }
.tooth-row .tooth:nth-child(8) { margin-right: 14px; }
.arch .tooth-row:has(> .tooth:nth-child(10):last-child) .tooth:nth-child(8) { margin-right: 3px; }
.arch .tooth-row:has(> .tooth:nth-child(10):last-child) .tooth:nth-child(5) { margin-right: 14px; }
.occlusal-line { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--text-3); font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.occlusal-line::before, .occlusal-line::after { content: ""; flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); }
.tooth { position: relative; display: grid; justify-items: center; gap: 2px; width: 46px; padding: 4px 2px; border: 1.5px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; font: inherit; color: var(--text); transition: background .12s, border-color .12s, transform .12s; }
.tooth:hover { background: var(--surface); border-color: var(--border-strong); transform: translateY(-1px); }
.tooth.selected { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tooth-num { font-size: 11.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tooth-shape { position: relative; width: 34px; height: 46px; display: grid; place-items: center; }
.tooth-shape.flip svg { transform: rotate(180deg); }
.tooth-shape svg { width: 34px; height: 46px; fill: #ffffff; stroke: #9fb3c0; stroke-width: 1.6; transition: fill .12s, stroke .12s; }
:root[data-theme="dark"] .tooth-shape svg { fill: #dfe8ee; stroke: #6f8796; }
.tooth.has-events .tooth-shape svg { fill: #eef5f9; }
.tooth.is-planned .tooth-shape svg { stroke: var(--brand-500); stroke-width: 2.6; fill: var(--brand-50); }
.tooth.is-missing .tooth-shape svg { opacity: .22; }
.sym { position: absolute; display: block; pointer-events: none; }
.sym-crown { left: 5px; right: 5px; height: 15px; top: 3px; border-radius: 6px 6px 3px 3px; background: rgba(199, 129, 26, .55); border: 1.5px solid #a8650b; }
.tooth-shape.flip .sym-crown { top: auto; bottom: 3px; border-radius: 3px 3px 6px 6px; }
.sym-endo { width: 3px; top: 16px; bottom: 6px; left: 50%; margin-left: -1.5px; border-radius: 2px; background: #c23a32; }
.tooth-shape.flip .sym-endo { top: 6px; bottom: 16px; }
.sym-implant { width: 10px; top: 18px; bottom: 3px; left: 50%; margin-left: -5px; background: repeating-linear-gradient(0deg, #52626e 0 2px, #9aabb6 2px 4px); border-radius: 2px 2px 4px 4px; }
.tooth-shape.flip .sym-implant { top: 3px; bottom: 18px; }
.sym-resto { width: 14px; height: 10px; top: 8px; left: 50%; margin-left: -7px; border-radius: 4px; background: var(--brand-400); opacity: .85; }
.tooth-shape.flip .sym-resto { top: auto; bottom: 8px; }
.sym-missing { inset: 0; display: grid; place-items: center; color: var(--danger); font-size: 30px; font-weight: 300; font-style: normal; }
.done-mark { position: absolute; top: 2px; right: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--success); color: #fff; font-size: 10px; font-style: normal; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.mouth.treatment-mode .tooth:not(.is-planned):not(.is-done) { opacity: .35; }
.mouth.treatment-mode .sym-crown, .mouth.treatment-mode .sym-endo, .mouth.treatment-mode .sym-implant, .mouth.treatment-mode .sym-resto { opacity: .25; }
.zone-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.tooth-pill { display: inline-grid; place-items: center; min-width: 38px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-list, .plan-list { display: grid; }
.cart-item, .plan-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .grow, .plan-item .grow { min-width: 0; }
.cart-item small, .plan-item small { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-item.st-done b, .plan-item.st-cancelled b { color: var(--text-3); }
.plan-item.st-cancelled b { text-decoration: line-through; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 0; font-weight: 600; }
.cart-total b { font-size: 20px; letter-spacing: -.02em; }
.cart-card.has-items { border-color: color-mix(in srgb, var(--brand-400) 50%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.history-details summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.history-details summary::-webkit-details-marker { display: none; }
.history-details summary .eyebrow { margin: 0; }
.history-details summary .ico { margin-left: auto; transition: transform .15s; }
.history-details[open] summary .ico { transform: rotate(180deg); }
.clinical-drawer { width: min(480px, 100vw); }
.drawer-section { margin-bottom: 18px; }
.drawer-label { display: block; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.action-grid button { display: grid; text-align: left; gap: 1px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font: inherit; cursor: pointer; color: var(--text); }
.action-grid button small { color: var(--text-3); font-size: 11.5px; }
.action-grid button:hover { border-color: var(--accent); }
.action-grid button.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.surface-picker { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; justify-content: center; }
.surface-picker .sf { display: grid; place-items: center; margin: 0; }
.surface-picker .sf input { position: absolute; opacity: 0; pointer-events: none; }
.surface-picker .sf span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 750; color: var(--text-2); cursor: pointer; }
.surface-picker .sf input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.sf-v { grid-column: 2; grid-row: 1; } .sf-m { grid-column: 1; grid-row: 2; } .sf-o { grid-column: 2; grid-row: 2; } .sf-d { grid-column: 3; grid-row: 2; } .sf-l { grid-column: 2; grid-row: 3; }
.act-suggestions { display: grid; gap: 6px; margin-top: 8px; max-height: 300px; overflow-y: auto; }
.act-card { display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font: inherit; cursor: pointer; color: var(--text); }
.act-card span { display: grid; min-width: 0; }
.act-card small { color: var(--text-3); font-size: 12px; }
.act-card em { font-style: normal; font-weight: 650; white-space: nowrap; font-size: 12.5px; }
.act-card:hover { border-color: var(--accent); }
.act-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.drawer-history { display: grid; gap: 8px; }
.dh-row { display: flex; gap: 10px; }
.dh-row small { display: block; color: var(--text-3); font-size: 12px; }
.dh-row p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }
.dh-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: #aebfca; }
.dh-dot.planned { background: var(--brand-500); } .dh-dot.done { background: var(--success); }

@media (max-width: 1080px) {
  .patient-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-glance > div:nth-child(2) { border-right: 0; }
  .patient-glance > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .sticky-col { position: static; }
}
@media (max-width: 900px) {
  .patient-hero { grid-template-columns: 1fr; padding: 16px; }
  .patient-id .avatar.xl { width: 52px; height: 52px; font-size: 18px; }
  .patient-id h1 { font-size: 21px; }
  .odonto-stats { display: none; }
  .tooth { width: 38px; }
  .tooth-shape, .tooth-shape svg { width: 28px; height: 38px; }
  .dentition-control { margin-left: 0; }
}

/* Agenda --------------------------------------------------------------------- */
.agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.agenda-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.agenda-nav h1 { font-size: 21px; margin-left: 8px; }
.date-jump input { width: 40px; padding: 0 6px; color: transparent; cursor: pointer; }
.date-jump input::-webkit-datetime-edit { display: none; }
.date-jump input::-webkit-calendar-picker-indicator { margin: 0 auto; cursor: pointer; }
.agenda-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-tools select { width: auto; min-width: 180px; }
.assistant-bar { margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--brand-200) 70%, var(--border)); border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--brand-100) 60%, var(--surface)), var(--surface)); }
.assistant-bar summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.assistant-bar summary::-webkit-details-marker { display: none; }
.assistant-bar summary > .ico:first-child { color: var(--accent); }
.assistant-bar summary > .ico:last-child { margin-left: auto; transition: transform .15s; }
.assistant-bar[open] summary > .ico:last-child { transform: rotate(180deg); }
.assistant-bar .ai-form, .assistant-bar .ai-flow-result { margin: 0 14px 12px; }
.agenda-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.agenda-side { display: grid; gap: 12px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.agenda-side .card { margin: 0; padding: 16px; }
.status-summary { display: grid; gap: 6px; }
.status-summary span { display: flex; justify-content: space-between; align-items: center; }
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: clip; }
.cal-header { display: grid; grid-template-columns: 58px repeat(var(--days), minmax(150px, 1fr)); position: sticky; top: var(--topbar-h); z-index: 8; background: var(--surface); border-bottom: 1px solid var(--border); }
.cal-week .cal-header { grid-template-columns: 58px repeat(var(--days), minmax(120px, 1fr)); }
.cal-corner { border-right: 1px solid var(--border); }
.cal-colhead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-right: 1px solid var(--border); min-width: 0; color: var(--text); }
.cal-colhead:last-child { border-right: 0; }
.cal-colhead b { display: block; font-size: 14px; }
.cal-colhead small { color: var(--text-3); font-size: 12px; }
.cal-week .cal-colhead { flex-direction: column; gap: 0; align-items: center; }
.cal-week .cal-colhead b { font-size: 20px; line-height: 1.1; }
.cal-week .cal-colhead span { font-size: 11px; color: var(--text-3); min-height: 14px; }
.cal-colhead.today small, .cal-colhead.today b { color: var(--accent); }
.cal-colhead.today b { background: var(--accent); color: #fff; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; font-size: 16px; }
.doc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cal-body { position: relative; display: grid; grid-template-columns: 58px repeat(var(--days), minmax(150px, 1fr)); height: var(--h); }
.cal-week .cal-body { grid-template-columns: 58px repeat(var(--days), minmax(120px, 1fr)); }
.cal-ruler { position: relative; border-right: 1px solid var(--border); background: var(--surface-2); }
.cal-ruler span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cal-ruler span:first-child { transform: none; top: 2px !important; }
.cal-col { position: relative; border-right: 1px solid var(--border); cursor: cell;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--border) 45%, transparent) 1px, transparent 1px);
  background-size: 100% 72px, 100% 18px; }
.cal-col:last-child { border-right: 0; }
.cal-col.today { background-color: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.cal-col.drop-ready { background-color: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.cal-absence { position: absolute; left: 2px; right: 2px; z-index: 1; padding: 6px 8px; border-radius: 8px; overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--surface-3) 0 8px, color-mix(in srgb, var(--surface-3) 40%, var(--surface)) 8px 16px); border: 1px dashed var(--border-strong); color: var(--text-3); font-size: 12px; cursor: not-allowed; }
.cal-absence b { display: block; color: var(--text-2); }
.cal-event { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 0; padding: 4px 7px 4px 9px; overflow: hidden; border-radius: 8px;
  background: color-mix(in srgb, var(--ev) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ev) 35%, var(--border)); border-left: 4px solid var(--ev);
  color: var(--text); font-size: 12px; line-height: 1.3; cursor: grab; touch-action: none; box-shadow: var(--shadow-xs); transition: box-shadow .12s, transform .12s; }
.cal-event:hover { box-shadow: var(--shadow); z-index: 4; color: var(--text); }
.cal-event.dragging { opacity: .6; cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 9; }
.ev-time { display: flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--ev) 70%, var(--text)); }
.ev-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev-name:hover { text-decoration: underline; }
.ev-reason, .ev-status { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-status { font-size: 11px; color: var(--text-3); }
.ev-flag { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 9px; font-weight: 800; }
.ev-flag.danger { background: var(--danger); color: #fff; }
.ev-flag.warn { background: var(--warning-bg); color: var(--warning); }
.cal-event.compact { flex-direction: row; align-items: center; gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.cal-event.compact .ev-reason, .cal-event.compact .ev-status { display: none; }
.cal-event.short .ev-status { display: none; }
.cal-event.short { flex-direction: row; flex-wrap: wrap; align-content: flex-start; column-gap: 6px; }
.cal-event.short .ev-reason { flex-basis: 100%; }
.cal-event.st-arrived, .cal-event.st-waiting { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--info) 45%, transparent); }
.cal-event.st-in_chair { background: color-mix(in srgb, var(--ev) 26%, var(--surface)); }
.cal-event.st-done { opacity: .62; }
.cal-event.st-done .ev-status::before { content: "✓ "; color: var(--success); font-weight: 800; }
.cal-event.st-cancelled, .cal-event.st-no_show { opacity: .45; background: var(--surface-2); border-left-color: var(--text-3); z-index: 1; box-shadow: none; }
.cal-event.st-cancelled .ev-name, .cal-event.st-no_show .ev-name { text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #e5574e; z-index: 5; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5574e; }
.slot-hint { position: absolute; left: 4px; right: 4px; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px dashed var(--accent); color: var(--accent); font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 16px; pointer-events: none; z-index: 3; }
.cal-body { overflow: visible; }
@media (max-width: 1200px) { .agenda-layout { grid-template-columns: 1fr; } .agenda-side { position: static; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }
@media (max-width: 900px) {
  .cal { overflow-x: auto; }
  .cal-header, .cal-body { min-width: calc(58px + var(--days) * 140px); }
  .cal-header { position: static; }
  .agenda-nav h1 { font-size: 17px; width: 100%; margin: 6px 0 0; }
}

/* Sélecteur de patient -------------------------------------------------------- */
.patient-picker { position: relative; }
.pp-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; display: none; max-height: 320px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.pp-results.show { display: grid; }
.pp-results button { display: grid; text-align: left; gap: 1px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; }
.pp-results button small { color: var(--text-3); font-size: 12px; }
.pp-results button:hover, .pp-results button.active { background: var(--accent-soft); }
.pp-empty { padding: 12px; color: var(--text-3); font-size: 13px; }

/* ======================================================================
   Finances : éditeur, documents, signature
   ====================================================================== */
.filters-bar { flex-wrap: wrap; gap: 8px; }
.filters-bar .search-input { flex: 1 1 240px; }
.filters-bar select { width: auto; min-width: 150px; }
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 560; white-space: nowrap; }
.inline-label input { width: 150px; }
.big-number { font-size: 30px; font-weight: 720; letter-spacing: -.02em; margin: 0; font-variant-numeric: tabular-nums; }
.narrow { max-width: 560px; }
.highlight-card { border-color: var(--brand-200); background: linear-gradient(180deg, var(--brand-50), var(--surface) 70%); }
.plain-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 2px; }
.plain-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.plain-list li:last-child { border-bottom: 0; }
.share-row { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.share-row:last-of-type { margin-bottom: 10px; }
.card .progress { margin: 4px 0 6px; }
.pay-methods { grid-template-columns: repeat(5, 1fr); }
.segmented.block label { display: flex; margin: 0; cursor: pointer; }
.segmented.block label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented.block label span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 34px; padding: 4px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.segmented.block label input:checked + span { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.segmented.block label input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.money-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.money-strip > div { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 2px; }
.money-strip span { font-size: 12px; font-weight: 600; color: var(--text-3); }
.money-strip b { font-size: 19px; font-variant-numeric: tabular-nums; }
.money-strip .success b { color: var(--success); }
.money-strip .accent { background: var(--accent-soft); border-color: var(--brand-200); }
.money-strip .accent b { color: var(--accent); }
.cov-lines input.sm { width: 110px; margin-left: auto; height: 34px; }

/* Mise en page éditeur (devis, facture) */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: grid; gap: 14px; }
.editor-side.card { gap: 14px; }
.editor-main.stack, .editor-side.stack { display: grid; gap: 18px; }
.editor-actions { display: grid; gap: 8px; }

/* Éditeur de lignes d'actes */
.lines-editor { display: grid; gap: 12px; }
.le-favs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.le-favs .chip-btn { font-family: var(--mono); font-size: 12px; }
.le-wrap { overflow: visible; }
.lines-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 650; padding: 0 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.lines-table td { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--border); }
.lines-table input { height: 38px; }
.lines-table input.num, .lines-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.le-col-teeth { width: 96px; } .le-col-qty { width: 64px; } .le-col-money { width: 112px; } .le-col-del { width: 40px; }
.le-total { padding-top: 16px !important; font-weight: 650; white-space: nowrap; }
.le-act { position: relative; min-width: 240px; }
.le-act-field { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); padding-left: 6px; }
.le-act-field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.le-act-field input { border: 0; box-shadow: none !important; background: transparent; padding-left: 4px; }
.le-code { flex: none; font-family: var(--mono); font-size: 11.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.le-code:hover { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }
.le-suggest { display: none; position: absolute; z-index: 40; left: 6px; right: 6px; top: calc(100% - 2px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; padding: 4px; }
.le-suggest.show { display: block; }
.le-opt { display: grid; grid-template-columns: 86px 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.le-opt b { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.le-opt em { font-style: normal; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.le-opt.active, .le-opt:hover { background: var(--accent-soft); }
.le-empty { padding: 10px; font-size: 12.5px; color: var(--text-3); }
.le-del { padding-top: 8px !important; }
.le-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; }
.le-totals { margin: 0; display: grid; gap: 4px; min-width: 280px; }
.le-totals div { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--text-2); }
.le-totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.le-totals .grand { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 15px; color: var(--text); }
.le-totals .grand dd { font-weight: 750; font-size: 18px; }

/* Progression du devis */
.progress-steps { list-style: none; display: flex; gap: 0; margin: 0 0 18px; padding: 0; counter-reset: st; overflow-x: auto; }
.progress-steps li { flex: 1; min-width: 110px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); position: relative; padding-right: 10px; }
.progress-steps li::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }
.progress-steps li:last-child::after { display: none; }
.progress-steps li > span { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; background: var(--surface); }
.progress-steps li > span svg { width: 13px; height: 13px; }
.progress-steps li.done { color: var(--text); }
.progress-steps li.done > span { background: var(--leaf-600); border-color: var(--leaf-600); color: #fff; }
.progress-steps li.done::after { background: var(--leaf-500); }

/* Document + panneau latéral */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.doc-side { display: grid; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.doc-side .card { padding: 16px 18px; }
.doc-side .card-head { margin-bottom: 8px; }
.doc-side .card-head h2 { font-size: 15px; }

/* Feuille A4 */
.doc-sheet {
  --ink: #14232d; --ink-2: #4f5f69; --rule: #dde3e8;
  position: relative; max-width: 820px; margin: 0 auto; background: #fff; color: var(--ink);
  border-radius: 6px; box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 44px 48px; font-size: 13px; line-height: 1.5; overflow: hidden;
}
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid #0a3450; margin-bottom: 20px; }
.doc-issuer { display: grid; gap: 1px; color: var(--ink-2); font-size: 12.5px; }
.doc-issuer strong { font-size: 16px; color: #0a3450; margin-bottom: 2px; }
.doc-title { text-align: right; display: grid; gap: 1px; font-size: 12.5px; color: var(--ink-2); }
.doc-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: #10749f; }
.doc-title strong { font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.doc-parties > div { display: grid; gap: 1px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.doc-parties small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: #74858f; margin-bottom: 3px; }
.doc-parties b { color: var(--ink); font-size: 14px; }
.doc-blank { display: inline-block; min-width: 140px; border-bottom: 1px dotted #9aa7b0; height: 12px; vertical-align: baseline; }
.doc-note { font-size: 11.5px; color: var(--ink-2); margin: 12px 0; }
.doc-block { margin: 14px 0; }
.doc-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #0a3450; margin: 0 0 6px; }
.doc-block p { margin: 0 0 8px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 12.5px; }
.doc-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: #0a3450; padding: 7px 8px; font-weight: 650; }
.doc-table th:first-child { border-radius: 6px 0 0 0; } .doc-table th:last-child { border-radius: 0 6px 0 0; }
.doc-table td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.doc-table tbody tr:nth-child(even) td { background: #f7f9fb; }
.doc-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-table .w-teeth { width: 70px; } .doc-table .w-code { width: 90px; }
.doc-table .muted { color: #8a979f; }
.doc-totals { margin-left: auto; width: min(100%, 340px); display: grid; gap: 3px; }
.doc-totals > div { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.doc-totals b { color: var(--ink); font-variant-numeric: tabular-nums; }
.doc-totals .grand { padding: 8px 10px; margin: 4px 0; background: #eef6fa; border-radius: 6px; font-size: 14px; color: var(--ink); }
.doc-totals .grand b { font-size: 16px; color: #0a3450; }
.doc-totals .due b { color: #b0461f; } .doc-totals .paid b { color: #25865a; }
.doc-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.doc-signatures > div { min-height: 110px; border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; display: grid; align-content: start; gap: 4px; font-size: 12px; color: var(--ink-2); }
.doc-signatures small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #74858f; }
.doc-signatures img { max-width: 220px; max-height: 80px; }
.doc-foot { margin-top: 22px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 10.5px; color: #8a979f; text-align: center; }
.doc-watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 110px; font-weight: 800; color: rgba(194, 58, 50, .07); transform: rotate(-24deg); text-transform: uppercase; letter-spacing: .08em; }

/* Signature au cabinet (mode tablette) */
body.sign-mode .sidebar, body.sign-mode .topbar, body.sign-mode .worktabs { display: none !important; }
body.sign-mode .app { grid-template-columns: 1fr; }
.sign-layout { display: grid; gap: 20px; max-width: 860px; margin: 0 auto; }
.sign-card { display: grid; gap: 16px; padding: 24px; }
.sign-step { display: flex; align-items: center; gap: 14px; opacity: .55; }
.sign-step.current, .sign-step.done { opacity: 1; }
.sign-step h2 { font-size: 17px; margin: 0; }
.sign-num { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 750; background: var(--surface-3); color: var(--text-2); }
.sign-step.current .sign-num { background: var(--accent); color: #fff; }
.sign-step.done .sign-num { background: var(--leaf-600); color: #fff; }
.consent-text { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; line-height: 1.6; max-height: 260px; overflow: auto; }
.signature-field { display: grid; gap: 6px; }
.signature-field canvas { width: 100%; height: 190px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }
.signature-field .btn { justify-self: end; }

@media (max-width: 1180px) {
  .doc-layout, .editor-layout { grid-template-columns: 1fr; }
  .doc-side, .editor-side { position: static; }
}
@media (max-width: 760px) {
  .doc-sheet { padding: 22px 18px; font-size: 12px; }
  .doc-head, .doc-parties, .doc-signatures { grid-template-columns: 1fr; display: grid; }
  .doc-title { text-align: left; }
  .pay-methods { grid-template-columns: repeat(3, 1fr); }
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody { display: block; }
  .lines-table tr.le-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .lines-table td { border: 0; padding: 0; }
  .lines-table td.le-act { grid-column: 1 / -1; min-width: 0; }
  .lines-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
  .lines-table td.le-act::before { display: none; }
  .le-total { padding-top: 0 !important; align-self: end; }
  .le-del { grid-column: 3; justify-self: end; }
  .inline-label input { width: 130px; }
}

/* Impression : seul le document est imprimé */
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { background: #fff !important; color: #000; height: auto !important; overflow: visible !important; }
  .sidebar, .topbar, .worktabs, .page-head, .no-print, .doc-side, .progress-steps, .flash, .alert, .toast-zone, .chat-pop, #globalSearch, .modal-backdrop, .menu-toggle, .drawer { display: none !important; }
  /* Safari et Firefox n'impriment qu'une page des conteneurs « sticky », « overflow » ou en hauteur fixe : tout redevient un flux simple. */
  .app, .main, .content, .doc-main, .doc-layout, .doc-sheet, .rx-sheet, .cert-doc, .letter-sheet { display: block !important; position: static !important; overflow: visible !important; height: auto !important; min-height: 0 !important; max-height: none !important; padding: 0 !important; margin: 0 !important; width: auto !important; max-width: none !important; }
  .doc-sheet { box-shadow: none !important; border: 0 !important; border-radius: 0; font-size: 12.5px; }
  .doc-sheet + .doc-sheet { break-before: page; }
  body:not(.print-duplicate) .rx-duplicate { display: none !important; }
  .doc-head { break-inside: avoid; }
  .doc-table tr, .doc-signatures, .rx-items li, .rx-sign { break-inside: avoid; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-totals .grand, .doc-table tbody tr:nth-child(even) td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Lien patient public (devis / facture) */
body.public-doc { display: block; padding: 0; }
.public-doc-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.public-doc-bar span { display: grid; line-height: 1.3; }
.public-doc-bar small { color: var(--text-3); font-size: 12px; }
.public-doc-mark { border-radius: 8px; }
.public-doc-main { padding: 24px 16px 40px; display: grid; gap: 16px; }
body.public-doc .public-card { margin: 12vh auto 0; }
@media print { .public-doc-bar { display: none !important; } .public-doc-main { padding: 0; } }

/* Ordonnances & courriers */
.rx-lines { display: grid; gap: 10px; }
.rx-line { display: grid; grid-template-columns: 28px minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, .7fr) 36px; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.rx-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; margin-bottom: 7px; }
.rx-sheet .rx-patient { display: grid; gap: 2px; padding: 12px 14px; border-left: 3px solid #10749f; background: #f4f9fb; border-radius: 0 8px 8px 0; margin-bottom: 14px; }
.rx-sheet .rx-patient b { font-size: 15px; }
.rx-items { margin: 18px 0; padding-left: 22px; display: grid; gap: 16px; }
.rx-items li { padding-left: 6px; }
.rx-items li::marker { font-weight: 700; color: #10749f; }
.rx-items b { display: block; font-size: 14.5px; }
.rx-items span { display: block; color: var(--ink); margin-top: 2px; }
.rx-items em { display: block; font-style: normal; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.rx-sign { margin: 28px 0 0 auto; width: 240px; min-height: 90px; display: grid; align-content: start; gap: 2px; text-align: center; font-size: 12.5px; }
.rx-sign small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #74858f; font-weight: 700; }
.rx-duplicate { display: none; }
.letter-recipient { display: grid; gap: 1px; align-content: start; min-width: 220px; padding-top: 34px; font-size: 13px; }
.letter-date { text-align: right; margin: 0 0 18px; color: var(--ink-2); }
.letter-ref { margin: 0 0 18px; font-size: 13px; }
.letter-body-print { font-size: 13.5px; line-height: 1.65; white-space: normal; }
textarea.letter-body { font-family: var(--font); font-size: 14px; line-height: 1.6; }
.template-pick { margin-bottom: 18px; display: grid; gap: 12px; }
.list-item.active { background: var(--accent-soft); }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
@media (max-width: 760px) { .rx-line { grid-template-columns: 28px 1fr; } .rx-line label, .rx-line button { grid-column: 2; } }
@media print {
  body.print-duplicate .rx-duplicate { display: block; break-before: page; }
  .rx-sheet .rx-patient { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Historique simple */
ol.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); display: grid; gap: 14px; }
ol.timeline li { position: relative; display: grid; gap: 1px; font-size: 13.5px; }
ol.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
ol.timeline li:first-child::before { background: var(--accent); }

/* Tableau de suivi (prothèses) */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; display: grid; gap: 10px; min-height: 160px; }
.kanban-col > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; color: var(--text-2); }
.kanban-col > header h2 { font-size: 14px; margin: 0; flex: 1; color: var(--text); }
.kanban-col > header .count { font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; }
.kanban-card { display: grid; gap: 4px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow-xs); transition: border-color .15s, transform .15s; }
.kanban-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.kanban-card.late { border-left: 3px solid var(--danger); }
.kanban-card span { font-size: 13px; color: var(--text-2); }
.kanban-card small { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.kanban-card small .ico { width: 13px; height: 13px; }
.kanban-empty { font-size: 12.5px; color: var(--text-3); text-align: center; margin: 18px 0; }
.col-done .kanban-card { opacity: .8; }
.toolbar > select, .toolbar form select { width: auto; min-width: 190px; }

/* Protocoles */
.protocol-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.protocol-steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.protocol-steps li b { display: block; font-size: 13.5px; }
.protocol-steps li span { font-size: 12px; color: var(--text-3); }
.pstep-list { display: grid; gap: 8px; margin-top: 6px; }
.pstep { display: grid; grid-template-columns: 28px minmax(0, 2fr) 110px 70px 130px 34px; gap: 8px; align-items: center; }
.pstep .rx-num { margin: 0; }
input.mono { font-family: var(--mono); text-transform: uppercase; }
@media (max-width: 760px) { .pstep { grid-template-columns: 28px 1fr 1fr; } .pstep input:first-of-type { grid-column: 2 / -1; } }

/* Messagerie (page) */
.chat-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.chat-list { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - 140px); overflow: auto; }
.chat-thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100vh - 190px); min-height: 420px; padding: 0; }
.chat-thread .card-head { padding: 16px 18px 0; }
.chat-stream { overflow: auto; padding: 12px 18px; display: flex; flex-direction: column; gap: 8px; }
.chat-day { align-self: center; font-size: 11.5px; font-weight: 650; color: var(--text-3); background: var(--surface-2); padding: 3px 10px; border-radius: 20px; margin: 8px 0; }
.chat-msg { max-width: min(560px, 80%); align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: var(--brand-200); border-radius: 14px 14px 4px 14px; }
.chat-msg small { font-size: 11.5px; font-weight: 650; color: var(--accent); }
.chat-msg p { margin: 0; font-size: 14px; }
.chat-msg time { display: block; text-align: right; font-size: 10.5px; color: var(--text-3); }
.chat-page-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }
.chat-page-compose textarea { flex: 1; resize: none; }
.plain-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; }
.ask-answer { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); white-space: pre-line; font-size: 14px; }
.ask-answer:empty { display: none; }
@media (max-width: 900px) { .chat-page { grid-template-columns: 1fr; } .chat-list { position: static; max-height: 220px; } }
.pstep { grid-template-columns: 28px minmax(0, 1fr) 80px 140px 34px; grid-template-areas: "n t t t x" ". c d l ."; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.pstep > .rx-num { grid-area: n; } .pstep > [name="step_title[]"] { grid-area: t; } .pstep > [name="step_code[]"] { grid-area: c; }
.pstep > [name="step_duration[]"] { grid-area: d; } .pstep > select { grid-area: l; } .pstep > button { grid-area: x; }
@media (max-width: 760px) { .pstep { grid-template-columns: 28px 1fr 70px; grid-template-areas: "n t x" ". c c" ". d l"; } }

/* Compte */
.avatar.xl { width: 104px; height: 104px; font-size: 34px; border-radius: 28px; margin: 6px auto 0; }
.file-btn { cursor: pointer; justify-self: center; }
.totp-setup { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.totp-setup .qr { background: #fff; padding: 6px; border-radius: 12px; border: 1px solid var(--border); line-height: 0; }
.totp-setup .qr svg { width: 168px; height: 168px; }
.totp-key { display: block; margin-top: 4px; font-size: 14px; letter-spacing: .06em; }
.count.warn { background: var(--warning-bg); color: var(--warning); }

/* Administration */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.health { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; background: var(--surface); }
.health:hover { border-color: var(--accent); }
.health b { display: block; font-size: 13.5px; }
.health small { color: var(--text-3); font-size: 12px; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.health.warn .health-dot { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg); }
.health.err .health-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 26px 0 10px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tile { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); text-decoration: none; box-shadow: var(--shadow-xs); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile.current { border-color: var(--leaf-500); }
.tile b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.tile small { display: block; color: var(--text-3); font-size: 12.5px; }
.tile-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.exchange-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.exchange-card { display: grid; gap: 10px; align-content: start; }
.exchange-import { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exchange-import input[type=file] { flex: 1; min-width: 0; font-size: 12.5px; }
.sm-input { width: 110px; height: 32px; font-size: 12.5px; }
tr.selected td { background: var(--accent-soft); }
.mono { font-family: var(--mono); }

/* Pilotage */
.month-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 200px; padding-top: 10px; }
.mc-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; }
.mc-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.mc-bars span { width: 38%; max-width: 18px; border-radius: 5px 5px 2px 2px; min-height: 2px; }
.mc-bars .billed, .lg.billed { background: var(--brand-500); }
.mc-bars .cashed, .lg.cashed { background: var(--leaf-500); }
.mc-col small { font-size: 11px; color: var(--text-3); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.card.flush > .list > .list-item { padding-left: 18px; padding-right: 18px; }
.time-pill { flex: none; min-width: 52px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.list-item.done { opacity: .55; }
.list-item.done .title { text-decoration: line-through; }
.chat-list > .list-item { padding: 11px 16px; }
.portal { max-width: 920px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 18px; }
.portal h1 { font-size: 26px; margin: 0; }
.portal .list-item { text-decoration: none; }
.onboarding { margin-bottom: 18px; }
.onboarding-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.onboarding-step { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.onboarding-step:hover { border-color: var(--accent); }
.onboarding-step b { display: block; font-size: 13.5px; }
.onboarding-step small { color: var(--text-3); font-size: 12px; }
.onboarding-step .sign-num { width: 26px; height: 26px; font-size: 12px; border: 2px solid var(--border-strong); background: var(--surface); }
.onboarding-step.done .sign-num { background: var(--leaf-600); border-color: var(--leaf-600); color: #fff; }
.onboarding-step.done b { text-decoration: line-through; color: var(--text-3); }
@media (max-width: 760px) {
  .list-item { flex-wrap: wrap; }
  .list-item > .grow { flex: 1 1 calc(100% - 80px); }
  .list-item > .row, .list-item > form, .list-item > .badge { margin-left: auto; }
  .filters-bar select, .filters-bar .inline-label { flex: 1 1 45%; }
  .le-foot { flex-direction: column; align-items: stretch; }
  .le-totals { min-width: 0; }
}

/* ===== V9.1 — corrections d'affichage ===================================== */
.grow { flex: 1 1 0%; min-width: 0; }
.plan-item .grow { flex: 1 1 0%; min-width: 0; }
.plan-item > .tooth-pill, .plan-item > form, .plan-item > .badge { flex: none; }
.plan-item .plan-status-form select { max-width: 170px; }
.plan-item b { overflow-wrap: anywhere; }
.timeline-body { min-width: 0; }
.timeline-body .row.between { align-items: baseline; gap: 12px; flex-wrap: nowrap; }
.timeline-body .row-link { flex: 1 1 0%; min-width: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
.timeline-body .row.between > small { flex: none; }
.card, .card-head > div, .list-item, .info-list dd { min-width: 0; }
.info-list dd { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .plan-item { flex-wrap: wrap; }
  .plan-item .grow { flex-basis: calc(100% - 60px); }
  .timeline-body .row.between { flex-wrap: wrap; }
}

/* Marque : Sanelio Dentaire / Sanelio Médical */
.brand-name em { font-style: normal; font-weight: 500; color: var(--accent); margin-left: 2px; }
body.prof-medical { --accent: #0e7490; --accent-hover: #0b5f75; --accent-soft: #e0f2f5; }
[data-theme="dark"] body.prof-medical { --accent: #38bdd8; --accent-hover: #67d3e8; --accent-soft: rgba(56,189,216,.14); }
body.prof-veterinary { --accent: #2f7d4a; --accent-hover: #256a3d; --accent-soft: #e6f2ea; }
[data-theme="dark"] body.prof-veterinary { --accent: #5cc184; --accent-hover: #7fd4a0; --accent-soft: rgba(92,193,132,.14); }

/* Durée de rendez-vous en un clic */
.duration-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.duration-chips button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.duration-chips button:hover { border-color: var(--accent); color: var(--accent); }
.duration-chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.duration-end { font-size: 12.5px; color: var(--text-3); }

/* Choix du logiciel (console plateforme, installation) */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.choice-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-card.disabled { opacity: .45; cursor: not-allowed; }
.choice-card b { display: block; }
.choice-card small { display: block; color: var(--text-3); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.choice-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.choice-icon svg { width: 20px; height: 20px; }
code[data-copy] { user-select: all; font-weight: 600; }

/* Formulaires CERFA */
.radio-row { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.radio-row legend { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; width: 100%; }
.cerfa-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.cerfa-grid th, .cerfa-grid td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.cerfa-grid th:first-child { text-align: left; font-weight: 600; white-space: nowrap; }
.cerfa-grid thead th { font-weight: 500; color: var(--text-3); font-size: 12px; }
.check.inline { display: inline-flex; margin-right: 14px; }
.flag.info { background: var(--info-bg, var(--accent-soft)); color: var(--info, var(--accent)); border: 1px solid var(--info-border, transparent); }

/* Éditeur d'actes : détails prothèse et prise en charge */
.le-extra { display: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; margin-top: 6px; }
.le-extra label:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
.lines-table td.le-act { min-width: 260px; }
.le-row.show-extra .le-extra { display: grid; }
.le-extra label { font-size: 11.5px; color: var(--text-3); display: grid; gap: 2px; }
.le-extra input, .le-extra select { font-size: 13px; padding: 5px 8px; min-height: 30px; }
.le-covline { font-size: 11.5px; color: var(--text-3); margin-top: 4px; min-height: 0; }
.le-covline.warn { color: var(--warning); font-weight: 600; }
.le-del { white-space: nowrap; }
.lines-editor.no-teeth .le-col-teeth { display: none; }
.coverage-panel { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2, var(--bg)); }
.coverage-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.coverage-head small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.coverage-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.coverage-bars .cov { border-radius: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); }
.coverage-bars .cov span { display: block; font-size: 12px; color: var(--text-3); }
.coverage-bars .cov b { font-size: 18px; }
.coverage-bars .cov.amo b { color: var(--accent); }
.coverage-bars .cov.rac b { color: var(--text); }
.coverage-warnings, .coverage-notes { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; }
.coverage-warnings li { color: var(--warning); font-weight: 600; }
.coverage-notes li { color: var(--text-3); }
.coverage-warnings:empty, .coverage-notes:empty { display: none; }
@media (max-width: 720px) { .le-extra { grid-template-columns: 1fr; } .coverage-bars { grid-template-columns: 1fr; } }
.doc-subtitle { font-size: 11.5px; color: var(--text-3); margin: 0 0 10px; }
.doc-table-conv th, .doc-table-conv td { font-size: 11.5px; }
.doc-table-conv small { color: var(--text-3); }
.doc-choice p { letter-spacing: .01em; }
.end-precise { margin-top: 6px; } .end-precise summary { font-size: 12.5px; color: var(--text-3); cursor: pointer; } .end-precise label { margin-top: 6px; }
.time-pill { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; padding: 3px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.cert-title { text-align: center; font-size: 17px; margin: 28px 0 22px; } .cert-body { font-size: 13.5px; line-height: 1.7; } .segmented.wrap { flex-wrap: wrap; height: auto; }
.doc-watermark-text { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--danger); border: 1px dashed currentColor; padding: 6px 10px; border-radius: 6px; text-align: center; }
.rx-line .rx-ald { display: none; align-self: end; white-space: nowrap; margin-bottom: 8px; }
.rx-lines.with-ald .rx-line .rx-ald { display: inline-flex; }
.rx-zone { border: 1.5px solid var(--text); padding: 8px 12px; margin: 10px 0; border-radius: 4px; }
.rx-zone h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 6px; }
.doc-table-conv { table-layout: fixed; width: 100%; }
.doc-table-conv th { white-space: normal; line-height: 1.25; padding: 6px 5px; font-size: 9.5px; vertical-align: bottom; }
.doc-table-conv td { padding: 6px 5px; overflow-wrap: anywhere; }
.doc-table-conv th:nth-child(1) { width: 7%; } .doc-table-conv th:nth-child(2) { width: 10%; } .doc-table-conv th:nth-child(3) { width: 29%; }
.doc-table-conv th:nth-child(4) { width: 10%; } .doc-table-conv th:nth-child(n+5) { width: 11%; }

/* ===== Sanelio Médical ====================================================== */
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; }
.vitals-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.vitals-grid label small { font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-left: 2px; }
.vitals-grid input { font-variant-numeric: tabular-nums; }
.bmi-out { font-size: 13px; font-weight: 600; color: var(--accent); }
.dx-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.dx-list:empty { display: none; }
.dx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.dx-chip b { color: var(--accent); font-variant-numeric: tabular-nums; }
.dx-chip button { border: 0; background: transparent; color: var(--text-3); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.dx-chip button:hover { color: var(--danger); background: var(--surface); }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-tile { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-align: center; background: var(--surface); }
.action-tile:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.action-tile svg { width: 18px; height: 18px; color: var(--accent); }
.mini-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 12px 0 4px; }
.mini-title:first-of-type { margin-top: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.plain-list li { padding: 3px 0; border-bottom: 1px dashed var(--border); overflow-wrap: anywhere; }
.plain-list li:last-child { border-bottom: 0; }
.vital-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vital-chips span { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); color: var(--text-2); }
.vital-chips b { color: var(--text-3); font-weight: 600; margin-right: 2px; }
.consult-list { display: grid; }
.consult-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.consult-item:last-child { border-bottom: 0; }
.consult-date { flex: none; width: 58px; text-align: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); padding: 6px 0; height: fit-content; }
.consult-date b { display: block; font-size: 20px; line-height: 1.1; }
.consult-date span { font-size: 11px; text-transform: uppercase; }
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .lc-grid { stroke: var(--border); stroke-width: 1; }
.line-chart .lc-axis { fill: var(--text-3); font-size: 10.5px; }
.line-chart .lc-line { fill: none; stroke-width: 2; }
.line-chart .lc-s1 { stroke: var(--accent); fill: var(--accent); }
.line-chart .lc-line.lc-s1, .line-chart .lc-line.lc-s2 { fill: none; }
.line-chart .lc-s2 { stroke: #c7811a; fill: #c7811a; }
.line-chart .lc-band { fill: var(--accent-soft); opacity: .6; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.legend i.lc-s2 { background: #c7811a; margin-left: 8px; }
.form.four, .compact-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: end; }
@media (max-width: 720px) { .action-grid { grid-template-columns: repeat(2, 1fr); } }
.cart-list, .plan-list, .timeline { grid-template-columns: minmax(0, 1fr); }
.plan-item, .cart-item, .timeline-item { min-width: 0; }
.grid > *, .stack > * { min-width: 0; }
.form > * { min-width: 0; }

/* Complémentaires : panneau du devis, réseaux */
.amc-card .amc-net { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13.5px; }
.amc-card .amc-net a { margin-left: auto; }
.amc-card .amc-amounts { margin-bottom: 12px; }
.amc-card form + p { margin-top: 8px; }
.amc-card details > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.amc-card details > summary::-webkit-details-marker { display: none; }
.amc-card details.amc-pack, .amc-card details.amc-events { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.amc-card details.amc-pack summary, .amc-card details.amc-events summary { color: var(--text-2); }
.amc-card details.amc-pack summary::before, .amc-card details.amc-events summary::before { content: "▸"; font-size: 11px; }
.amc-card details[open].amc-pack summary::before, .amc-card details[open].amc-events summary::before { content: "▾"; }
.amc-card [data-copy-text] { cursor: copy; border-bottom: 1px dashed var(--border-strong); transition: background .15s; }
.amc-card [data-copy-text].copied { background: var(--accent-soft); }
.small.warn { color: #b0461f; }
.net-table input { min-width: 150px; font-size: 13px; padding: 6px 8px; }
.net-table td { vertical-align: top; }
.net-table .table-sub { white-space: normal; max-width: 260px; }
.px-3 { padding: 0 18px 10px; }
.ico.fav { color: #d99a06; fill: #d99a06; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.table-sub.warn, td.warn { color: #9a5a1f; }
.btn.plain.active .ico { fill: #d99a06; color: #d99a06; }
.pt-3 { padding-top: 14px; }
.toolbar .grow { flex: 1 1 240px; }
.ref-table td { vertical-align: top; }
/* Ordonnance : recherche médicament, liens, modèles */
.rx-line { grid-template-columns: 28px minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, .6fr) auto auto 36px; }
.rx-drug-wrap { position: relative; }
.rx-links { display: flex; gap: 6px; margin-top: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rx-links a { background: var(--surface); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border); }
.rx-suggest { top: calc(100% + 4px); }
.rx-suggest .le-opt.hl, .rx-suggest .le-opt:hover { background: var(--accent-soft); }
.rx-warn { grid-column: 2 / -1; margin: -4px 0 0; color: #9a5a1f; }
.rx-ns { white-space: nowrap; }
.rx-protocols details { border-top: 1px solid var(--border); padding: 6px 0; }
.rx-protocols details:first-of-type { border-top: 0; }
.rx-protocols summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.rx-protocols .stack-sm { display: grid; gap: 4px; padding: 6px 0 2px; }
.chip-btn.wide { width: 100%; text-align: left; justify-content: flex-start; white-space: normal; }
@media (max-width: 760px) { .rx-line { grid-template-columns: 28px 1fr; } .rx-warn { grid-column: 2; } }
.rx-allergy { grid-column: 2 / -1; margin: -4px 0 0; color: #b0261f; font-weight: 600; }
/* Ordonnance imprimée : en-tête type cabinet médical */
.rx-sheet { --ink: #111; font-size: 13px; }
.rx-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 12px; border-bottom: 1.5px solid #111; margin-bottom: 14px; }
.rx-issuer { display: grid; gap: 1px; font-size: 12.5px; color: #333; }
.rx-issuer strong { font-size: 16px; color: #111; letter-spacing: .01em; }
.rx-ids { display: grid; gap: 2px; align-content: start; text-align: right; font-size: 12px; color: #333; }
.rx-ids b { font-variant-numeric: tabular-nums; }
.rx-copy { margin-top: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: #666; }
.rx-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 4px 0 18px; }
.rx-sheet .rx-patient { border-left: 2px solid #111; background: transparent; border-radius: 0; padding: 4px 12px; margin: 0; }
.rx-date { font-size: 13px; }
.rx-indication { font-size: 12.5px; margin: 0 0 12px; }
.rx-sheet .rx-items { margin: 14px 0; padding-left: 0; list-style: none; gap: 14px; }
.rx-sheet .rx-items li { padding-left: 0; }
.rx-items b { font-size: 14px; }
.rx-items span { margin-left: 18px; }
.rx-items em { margin-left: 18px; font-size: 12.5px; color: #333; }
.rx-ns-mark { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border: 1px solid #111; padding: 0 5px; margin-left: 6px; vertical-align: 2px; }
.rx-zone { border: 1.2px solid #111; padding: 8px 12px 6px; margin: 10px 0; min-height: 80px; }
.rx-zone h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; color: #111; }
.rx-zone .rx-items { margin: 6px 0 4px; }
.rx-empty { color: #999; }
.rx-mention { font-size: 12.5px; margin: 8px 0; font-weight: 600; }
.rx-advice { font-size: 12.5px; margin: 14px 0 0; padding: 8px 10px; border-left: 2px solid #999; color: #222; }
.rx-sheet .rx-sign { margin-top: 32px; }
.rx-foot { margin-top: 30px; padding-top: 8px; border-top: 1px solid #bbb; font-size: 10.5px; color: #555; text-align: center; }
@media print { .rx-zone { break-inside: avoid; } }
.rx-kind { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }

/* Sanelio Véto */
.owner-picker { position: relative; }

/* ===== Sanelio Véto ===== */
.animal-avatar { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); font-size: 22px; line-height: 1; overflow: hidden; }
.animal-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.animal-avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
.animal-avatar.xl { width: 84px; height: 84px; border-radius: 24px; font-size: 42px; }
.animal-photo { position: relative; margin: 0; flex: none; }
.animal-photo label { position: relative; display: block; margin: 0; cursor: pointer; }
.animal-photo-edit { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); box-shadow: var(--shadow-sm); opacity: 0; transition: opacity .15s; }
.animal-photo-edit .ico { width: 14px; height: 14px; }
.animal-photo label:hover .animal-photo-edit, .animal-photo label:focus-within .animal-photo-edit { opacity: 1; }
@media (hover: none) { .animal-photo-edit { opacity: 1; } }
.animal-hero.deceased .animal-avatar { filter: grayscale(1); opacity: .75; }
.animal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.animal-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.animal-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.animal-card > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.animal-card small { color: var(--text-3); font-size: 12px; }
.animal-card.dead { opacity: .6; }
.animal-card.dead .animal-avatar { filter: grayscale(1); }
.animal-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.animal-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text); text-decoration: none; white-space: nowrap; }
.animal-chip:hover { border-color: var(--accent); color: var(--accent); }
.animal-chip.dead { color: var(--text-3); text-decoration: line-through; }
.vacc-status { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.vacc-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); border-left: 4px solid var(--success, #16a34a); font-size: 13px; }
.vacc-row span { color: var(--text-2); }
.vacc-row .due { font-weight: 600; color: var(--text); text-align: right; }
.vacc-row.soon { border-left-color: var(--warning); }
.vacc-row.soon .due { color: var(--warning); }
.vacc-row.late { border-left-color: var(--danger); background: var(--danger-bg); }
.vacc-row.late .due { color: var(--danger); }
.vacc-row.none { border-left-color: var(--border); }
@media (max-width: 640px) { .vacc-row { grid-template-columns: 1fr; gap: 2px; } .vacc-row .due { text-align: left; } }
.entry-form { border: 1px dashed var(--border); border-radius: 12px; padding: 0 12px; margin-top: 8px; }
.entry-form[open] { padding-bottom: 12px; border-style: solid; }
.entry-form > summary { cursor: pointer; list-style: none; padding: 10px 0; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.entry-form > summary::-webkit-details-marker { display: none; }
.entry-form > summary:not(.btn):not(:has(.ico))::before { content: '+'; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); font-weight: 700; }
.entry-form[open] > summary:not(.btn):not(:has(.ico))::before { content: '−'; }
.weigh-form { gap: 6px; align-items: center; }
.weigh-form input { width: 96px; min-width: 0; }
.weigh-form input[type=date] { width: 140px; }
.vital-chips span.out { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); font-weight: 600; }
.flag.neutral { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.flag.success { background: var(--success-bg, var(--accent-soft)); color: var(--success, var(--accent)); border: 1px solid var(--success-border, transparent); }
.segmented.wrap { display: flex; flex-wrap: wrap; }
.seg-radio { display: flex; margin: 0; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 32px; padding: 4px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg-radio input:checked + span { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
input.out-low, input.out-high { border-color: var(--warning); background: var(--warning-bg); }
input.out-high { border-color: var(--danger); background: var(--danger-bg); }
.field-hint.warn { color: var(--warning); font-weight: 600; }
.list-item.is-closed .title { color: var(--text-3); }
.species-emoji { font-size: 1.1em; line-height: 1; }
.care-grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.care-grid th, .care-grid td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.care-grid th:first-child, .care-grid td:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; white-space: normal; min-width: 180px; z-index: 1; }
.care-grid td.slot { min-width: 34px; }
.care-grid .slot.due { background: var(--warning-bg); }
.care-grid .slot.late { background: var(--danger-bg); }
.care-grid .slot.done { background: var(--success-bg, var(--accent-soft)); color: var(--success, var(--accent)); font-weight: 700; }
.care-grid .slot.skip { background: var(--surface-3); color: var(--text-3); }
.care-grid .now { box-shadow: inset 2px 0 0 var(--accent); }
.care-grid button.slot-btn { width: 100%; min-height: 26px; border: 0; background: transparent; cursor: pointer; border-radius: 6px; color: inherit; font: inherit; }
.care-grid button.slot-btn:hover { background: var(--accent-soft); }
.hosp-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.hosp-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; }
.hosp-card:hover { border-color: var(--accent); }
.hosp-card .hosp-top { display: flex; gap: 10px; align-items: center; }
.hosp-card .hosp-meta { font-size: 12.5px; color: var(--text-2); }
.hosp-card.critical { border-left: 4px solid var(--danger); }
.hosp-card.watch { border-left: 4px solid var(--warning); }
.hosp-card.stable { border-left: 4px solid var(--success, #16a34a); }
.lab-table td.val input { width: 90px; }
.lab-table td.flag-cell { font-weight: 700; }
.lab-table .lo { color: var(--info, var(--accent)); }
.lab-table .hi { color: var(--danger); }
.sig-pad { width: 100%; height: 170px; border: 1px dashed var(--border); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-img { max-height: 90px; max-width: 260px; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.exam-grid label { margin: 0; }
.exam-grid .exam-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.exam-grid .exam-head button { font-size: 11.5px; padding: 1px 8px; }
.med-results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.med-results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 12px; cursor: pointer; color: inherit; font: inherit; border-bottom: 1px solid var(--border); }
.med-results button:hover, .med-results button:focus { background: var(--accent-soft); outline: none; }
.med-results small { display: block; color: var(--text-3); font-size: 12px; }
.vrx-line { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface-2); }
.vrx-line .vrx-head { display: flex; gap: 8px; align-items: center; }
.vrx-line .vrx-head .rx-num { margin: 0; flex: none; }
.vrx-line .rx-warn { margin: 0; grid-column: auto; }
.med-results button.hl { background: var(--accent-soft); }
.rx-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.rx-tag { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.rx-tag.atb { background: var(--warning-bg); color: var(--warning); }
.rx-tag.aic { background: var(--danger-bg); color: var(--danger); }
.rx-tag.human { background: var(--info-bg, var(--accent-soft)); color: var(--info, var(--accent)); }
.doc-signatures > div.blank { border: 0; }
.lab-table .group-row th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding-top: 10px; }
.lab-table td.flag-cell { width: 28px; text-align: center; font-size: 15px; }
.lab-table tr.abn td:first-child { font-weight: 600; }

/* Tarifs et produits (Véto) */
.vcodes td:first-child { width: 1%; }
.vcodes td:nth-child(2) { min-width: 260px; }
.vcodes tr.group-row td { background: var(--surface-2); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding-top: 8px; padding-bottom: 8px; }
.vcodes .rx-tags { display: inline-flex; margin-left: 6px; vertical-align: middle; }
.var-chip[data-insert] { cursor: pointer; }
.var-chip[data-insert]:hover { background: var(--accent-soft); }
/* Pilotage : barres horizontales */
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 104px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 99px; background: var(--neutral-bg); overflow: hidden; }
.bar-track > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-value small { display: block; color: var(--text-3); font-size: 11.5px; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr auto; } .bar-track { grid-column: 1 / -1; order: 3; } }
