/* ============================================================
   Plateforme Digitalsante — Design system back-office
   ============================================================ */
:root {
    /* Charte Seven Assurances : bleu indigo #3E4095 + rouge #EE3137 */
    --bg: #f6f7fb;
    --surface: #ffffff;
    --sidebar: #23244f;
    --sidebar-hover: #2f3168;
    --sidebar-active: #ee3137;
    --sidebar-text: #a7aad0;
    --sidebar-title: #6f72a6;

    --primary: #3e4095;
    --primary-dark: #313270;
    --primary-soft: #ecedf8;

    --accent: #ee3137;
    --accent-dark: #d52026;
    --accent-soft: #fdeaeb;

    --text: #1f2440;
    --text-muted: #6b7089;
    --border: #e7e8f1;
    --border-champ: #c3c7de;
    --border-tableau: #d3d6e6;

    --success: #16a34a;
    --success-soft: #e7f6ec;
    --warning: #d97706;
    --warning-soft: #fdf3e2;
    --danger: #ee3137;
    --danger-soft: #fdeaeb;
    --neutral-soft: #eef0f6;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(16,25,53,.05);
    --shadow: 0 4px 20px rgba(16,25,53,.07);
    --shadow-lg: 0 12px 40px rgba(16,25,53,.14);
    --sidebar-w: 256px;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: block;
    padding: 18px 18px 14px;
}
.sidebar .brand .logo-chip {
    background: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    display: block;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.sidebar .brand .logo-chip img { width: 100%; height: auto; display: block; }
.sidebar .brand .tag {
    display: block;
    color: var(--sidebar-text);
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    text-align: center;
    margin-top: 9px;
    font-weight: 600;
}

.sidebar-nav { padding: 4px 12px 24px; }

.nav-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--sidebar-title);
    font-weight: 600;
    padding: 18px 12px 8px;
}

/* ---- Groupes déroulants ---- */
.nav-group { margin-top: 6px; }
.nav-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 12px 8px;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--sidebar-title);
    font-weight: 700;
    transition: color .13s;
}
.nav-group-header:hover { color: #c7cbe8; }
.nav-group-header .chev {
    width: 14px; height: 14px;
    transition: transform .2s ease;
    flex-shrink: 0;
}
.nav-group-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.nav-group.open > .nav-group-items { max-height: 600px; }
.nav-group.open > .nav-group-header .chev { transform: rotate(180deg); }

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .13s, color .13s;
}
.nav-link-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37,99,235,.4);
}
.nav-link-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }

/* ---------- Main content ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 64px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .page-title { font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
}
.user-chip .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.user-chip .name { font-weight: 600; font-size: .9rem; }
.user-chip .role { font-size: .72rem; color: var(--text-muted); }

.content { padding: 20px; flex: 1; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 14px 16px; }
/* Deux panneaux ne se touchent jamais, que la marge vienne de l'utilitaire .mb-3
   ou de cette règle : les marges verticales adjacentes fusionnent, jamais ne s'ajoutent. */
.card + .card { margin-top: 12px; }

.card-title-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px; border-bottom: 1px solid var(--border);
    font-weight: 650;
}

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center; margin-bottom: 14px;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; margin-top: 6px; font-weight: 500; }

.ic-blue   { background: var(--primary-soft); color: var(--primary); }
.ic-green  { background: #e7f6ec; color: #16a34a; }
.ic-purple { background: #f0ebfe; color: #7c3aed; }
.ic-amber  { background: #fdf3e2; color: #d97706; }
.ic-teal   { background: #e2f7f5; color: #0d9488; }
.ic-rose   { background: var(--accent-soft); color: var(--accent); }

/* ---------- Search bar ---------- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 12px; flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px; color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 8px 14px 8px 40px;
    border: 1.5px solid var(--border-champ);
    border-radius: 9px;
    background: var(--surface);
    font-size: .9rem;
    transition: border .15s, box-shadow .15s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.result-count { color: var(--text-muted); font-size: .85rem; font-weight: 500; white-space: nowrap; }

/* ============================================================
   Système de boutons unifié
   Base .btn (géométrie) + variantes de couleur + tailles
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .13s, border .13s, color .13s, box-shadow .13s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Variantes de couleur */
.btn-primary {
    background: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 6px 16px rgba(62,64,149,.30);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; box-shadow: 0 8px 22px rgba(62,64,149,.40); }

.btn-accent {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 6px 16px rgba(238,49,55,.30);
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; box-shadow: 0 8px 22px rgba(238,49,55,.40); }

.btn-ghost {
    background: var(--surface); border-color: var(--border); color: var(--text);
}
.btn-ghost:hover { background: var(--neutral-soft); color: var(--text); border-color: var(--border); }

/* Tailles */
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; border-radius: 11px; }
.btn-block { width: 100%; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 12px;
}
.page-head h2 { margin: 0; font-size: 1.15rem; font-weight: 650; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: left;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 7px 12px;
    /* Filets de tableau plus soutenus que ceux des panneaux : les lignes se comptent. */
    border-bottom: 1.5px solid var(--border-tableau);
    background: #f6f7fb;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-tableau);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tfoot td { border-top: 1.5px solid var(--border-tableau); padding: 8px 12px; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: #f8faff; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Un montant ne se coupe jamais en deux lignes : il reste d'un bloc, cale a droite. */
.data-table th.num, .data-table td.num { white-space: nowrap; }
.data-table .strong { font-weight: 600; }
/* « strong » n'existait que dans les tableaux : une valeur mise en avant ailleurs — le cumul
   d'un dossier, un montant de fiche — ne changeait pas d'épaisseur. */
.strong { font-weight: 650; }
.detail-list dd.strong { font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ---------- Badges ---------- */
.badge-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 100px;
    font-size: .74rem; font-weight: 600; line-height: 1;
}
.badge-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-muted); }

/* ---------- Definition lists (details) ---------- */
.detail-list { display: grid; grid-template-columns: 1fr; gap: 0; }
/* La valeur se lit juste apres son libelle : rejetee au bord oppose, l'oeil doit
   traverser toute la fiche pour rapprocher les deux. Les montants des tableaux,
   eux, restent alignes a droite : c'est la colonne qui se lit, pas la ligne. */
.detail-list .row-item {
    display: grid; grid-template-columns: minmax(100px, 190px) 1fr; gap: 4px 14px;
    align-items: baseline;
    padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.detail-list .row-item:last-child { border-bottom: none; }
.detail-list dt { color: var(--text-muted); font-weight: 500; }
.detail-list dd { margin: 0; font-weight: 550; text-align: left; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager a {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: grid; place-items: center;
    border: 1px solid var(--border); border-radius: 9px;
    color: var(--text); font-weight: 550; font-size: .85rem;
    transition: background .12s, border .12s;
}
.pager a:hover { background: var(--neutral-soft); }
.pager a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Login ---------- */
/* ---------- Connexion du portail prestataire ----------
   Le praticien ne doit pas croire qu'il entre chez l'assureur : la page s'ouvre en deux
   panneaux, le bandeau de la marque à gauche, la saisie à droite. Le back-office, lui,
   garde sa carte centrée sur fond sombre. */
.connexion-portail {
    min-height: 100vh;
    display: grid; grid-template-columns: minmax(320px, 4fr) minmax(360px, 3fr);
    background: var(--surface);
}
.connexion-marque {
    position: relative; overflow: hidden;
    padding: 56px 60px;
    display: flex; flex-direction: column; justify-content: center; gap: 22px;
    color: #fff;
    background: linear-gradient(150deg, #23244f 0%, #3e4095 58%, #4b4ea8 100%);
}
.connexion-marque::after {
    content: ""; position: absolute; right: -180px; bottom: -220px;
    width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(238,49,55,.55) 0%, transparent 65%);
}
.connexion-marque > * { position: relative; z-index: 1; }
.connexion-marque .logo-chip {
    background: #fff; border-radius: 14px; padding: 12px 18px;
    width: 280px; max-width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.connexion-marque .logo-chip img { width: 100%; display: block; }
.connexion-marque h1 { font-size: 2rem; line-height: 1.15; margin: 0; font-weight: 750; letter-spacing: -.02em; }
.connexion-marque p { margin: 0; color: rgba(255,255,255,.82); font-size: .95rem; max-width: 460px; }
.connexion-etapes { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 0; padding: 0; list-style: none; }
.connexion-etapes li { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: rgba(255,255,255,.92); }
.connexion-etapes .puce {
    flex: 0 0 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; font-size: .78rem;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
}
.connexion-saisie {
    display: flex; flex-direction: column; justify-content: center;
    padding: 56px 64px; gap: 4px;
}
.connexion-saisie .titre { font-size: 1.35rem; font-weight: 700; margin: 0 0 4px; }
.connexion-saisie .sous { color: var(--text-muted); font-size: .9rem; margin: 0 0 26px; }
.connexion-saisie form { max-width: 380px; width: 100%; }
.connexion-pied { margin-top: 26px; font-size: .78rem; color: var(--text-muted); max-width: 380px; }
@media (max-width: 900px) {
    .connexion-portail { grid-template-columns: 1fr; }
    .connexion-marque { padding: 32px 26px; gap: 16px; }
    .connexion-marque h1 { font-size: 1.5rem; }
    .connexion-etapes { display: none; }
    .connexion-saisie { padding: 32px 26px 48px; }
}

.login-wrap {
    min-height: 100vh;
    display: grid; place-items: center;
    background: radial-gradient(1100px 600px at 15% -10%, #3e4095 0%, transparent 55%),
                radial-gradient(900px 520px at 110% 115%, #ee3137 0%, transparent 48%),
                #1a1b3d;
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 580px;
    background: var(--surface);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 60px 64px 64px;
}
.login-card .login-logo { display: block; width: 300px; max-width: 80%; margin: 4px auto 28px; }
.login-card h1 { font-size: 1.4rem; text-align: center; margin: 0 0 32px; font-weight: 700; }
.login-card .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 26px; font-size: .9rem; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-weight: 550; font-size: .82rem; margin-bottom: 7px; }
.form-field input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: 10px; font-size: .95rem;
    transition: border .15s, box-shadow .15s;
}
.form-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.alert-error {
    background: var(--danger-soft); color: var(--danger);
    padding: 10px 14px; border-radius: 10px; font-size: .85rem; margin-bottom: 18px; font-weight: 500;
}

/* ---------- Forms (content area) ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 16px;
}
@media (min-width: 1100px) { .form-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
.field label {
    display: block; font-weight: 650; font-size: .82rem; margin-bottom: 4px; color: var(--text);
}
.field label .req { color: var(--accent); margin-left: 2px; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px 12px;
    /* Champs franchement dessinés : le filet des panneaux est trop léger pour une saisie. */
    border: 1.5px solid var(--border-champ);
    border-radius: 9px;
    background: var(--surface);
    font-size: .9rem;
    font-family: inherit;
    color: var(--text);
    transition: border .15s, box-shadow .15s;
}
/* Un champ verrouillé se voit : il porte une valeur qu'on ne discute pas. */
.field input[readonly] {
    background: var(--neutral-soft); color: var(--text-muted);
    border-style: dashed; cursor: not-allowed;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field .field-error { color: var(--accent); font-size: .78rem; margin-top: 5px; }

/* Le dépôt d'une pièce jointe se dessine comme les autres champs, le bouton de
   parcours prenant l'allure d'un bouton secondaire. */
.field input[type=file] { padding: 6px 10px; cursor: pointer; }
.field input[type=file]::file-selector-button {
    margin-right: 10px; padding: 5px 12px;
    border: 1.5px solid var(--border-champ); border-radius: 8px;
    background: var(--neutral-soft); color: var(--text);
    font-family: inherit; font-size: .85rem; font-weight: 550; cursor: pointer;
}
.field input[type=file]::file-selector-button:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Select2 aligné sur la charte ---- */
.select2-container .select2-selection--single {
    height: 38px;
    border: 1.5px solid var(--border-champ);
    border-radius: 9px;
    display: flex;
    align-items: center;
    background: var(--surface);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-left: 13px;
    color: var(--text);
    font-size: .9rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.select2-dropdown {
    border-color: var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--border-champ);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: .88rem;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.select2-container--default .select2-results__option {
    font-size: .88rem;
    padding: 8px 12px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--primary);
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--primary-soft);
    color: var(--primary);
}
.field input.input-invalid, .field select.input-invalid { border-color: var(--accent); }
.form-section-title {
    font-weight: 650; font-size: .95rem; margin: 6px 0 2px;
    grid-column: 1 / -1; color: var(--text);
}
.form-actions {
    display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}

/* ---------- Flash message ---------- */
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 550; font-size: .9rem;
}
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Detail grid ---------- */
.detail-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 22px; align-items: start; }
.detail-grid.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .detail-grid, .detail-grid.even { grid-template-columns: 1fr; } }

/* ---------- Minimal utilities ---------- */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-2 { gap: 10px; }
.ms-2 { margin-left: 10px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.mb-0 { margin-bottom: 0; }
.d-inline-block { display: inline-block; }
.text-muted { color: var(--text-muted); }
@media (min-width: 640px) { .d-sm-block { display: block !important; } }
@media (max-width: 639px) { .d-sm-block { display: none; } }
@media (max-width: 860px) { .d-md-none { display: inline-flex; } }
@media (min-width: 861px) { .d-md-none { display: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .sidebar { position: fixed; left: -100%; z-index: 100; transition: left .2s; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .content { padding: 18px; }
}

/* ---------- Choix segmenté (nature du soin) ---------- */
.choix-nature { display: flex; gap: 10px; flex-wrap: wrap; }
.choix-nature-option { position: relative; flex: 1 1 220px; margin: 0; cursor: pointer; }
.choix-nature-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.choix-nature-libelle {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px;
    border: 1.5px solid var(--border-champ);
    border-radius: 9px;
    background: var(--surface);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.choix-nature-titre { font-weight: 650; color: var(--text); font-size: .9rem; }
.choix-nature-sous { font-size: .76rem; color: var(--text-muted); }
.choix-nature-option:hover .choix-nature-libelle { border-color: var(--primary); }
.choix-nature-option input:focus-visible + .choix-nature-libelle { box-shadow: 0 0 0 3px var(--primary-soft); }
.choix-nature-option input:checked + .choix-nature-libelle {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px var(--primary);
}
.choix-nature-option input:checked + .choix-nature-libelle .choix-nature-titre { color: var(--primary-dark); }

/* ---------- Fiche patient : identité d'un côté, dossier de l'autre ---------- */
.fiche-patient { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; align-items: start; }
.fiche-patient-identite { display: flex; gap: 16px; align-items: flex-start; }
@media (max-width: 900px) { .fiche-patient { grid-template-columns: 1fr; } }

/* La consultation en deux colonnes : la fiche du patient tient la gauche et reste
   visible pendant qu'on travaille le dossier, qui occupe toute la droite. */
.consultation-layout {
    display: grid; grid-template-columns: 296px minmax(0, 1fr);
    gap: 12px; align-items: start;
}
.consultation-aside { position: sticky; top: 76px; }
.consultation-corps { min-width: 0; }
.fiche-patient-photo { display: flex; justify-content: center; margin-bottom: 12px; }
/* Les liens qui mènent aux écrans voisins : dossier, bon, proforma. */
.liens-contexte { display: flex; flex-direction: column; gap: 6px; }

/* Choix exclusif en vrais boutons radio, quand les options sont courtes et qu'un
   contrôle segmenté prendrait toute la largeur pour rien. */
.choix-radio { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; padding: 2px 0; }
.choix-radio label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 550; }
.choix-radio input[type=radio] {
    width: 16px; height: 16px; margin: 0; flex: 0 0 auto;
    accent-color: var(--primary); cursor: pointer;
}
/* Dans une colonne etroite, la valeur passe sous son libelle : cote a cote, il ne
   resterait que trois caracteres de large pour l'ecrire. */
.consultation-aside .detail-list .row-item { grid-template-columns: 1fr; gap: 1px; }
.consultation-aside .detail-list dt { font-size: .78rem; }
@media (max-width: 1100px) {
    .consultation-layout { grid-template-columns: 1fr; }
    .consultation-aside { position: static; }
}


/* ---------- Modale ---------- */
/* Une fenêtre native <dialog> : le fond de page reste lisible derrière, mais
   inerte, et la touche Échap referme sans qu'on ait à écrire de script. */
.modale {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    color: var(--text);
    padding: 0;
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow: visible;
}
.modale::backdrop { background: rgba(20, 22, 60, .45); }
.modale-tete {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    font-weight: 650; font-size: 16px;
}
.modale-corps { padding: 16px 18px; }

/* ---------- Saisie d'une correction optique ---------- */
/* L'ordonnance de lunettes se saisit œil par œil. Plutôt qu'un tableau de données détourné en
   formulaire, une carte à deux lignes : l'œil à gauche, ses quatre mesures à droite, chacune
   avec son unité posée dans le champ. */
.grille-optique {
    max-width: 760px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.grille-optique .ligne-entete,
.grille-optique .ligne-oeil {
    display: grid;
    grid-template-columns: 168px repeat(4, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 16px;
}
.grille-optique .ligne-entete {
    background: var(--neutral-soft);
    color: var(--text-muted);
    font-size: .72rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
}
.grille-optique .ligne-entete span:not(:first-child) { text-align: center; }
.grille-optique .ligne-oeil { border-top: 1px solid var(--border); }
.grille-optique .oeil { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.grille-optique .pastille {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.grille-optique .mesure { position: relative; display: block; margin: 0; }
.grille-optique .mesure input {
    width: 100%;
    padding: 9px 32px 9px 12px;
    border: 1.5px solid var(--border-champ);
    border-radius: 9px;
    background: var(--surface);
    font-family: inherit; font-size: .92rem;
    text-align: right;
    transition: border .15s, box-shadow .15s;
}
.grille-optique .mesure input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.grille-optique .mesure input::placeholder { color: var(--text-muted); opacity: .45; }
/* Les flèches du navigateur encombrent une case aussi étroite : les flèches du clavier suffisent. */
.grille-optique .mesure input::-webkit-outer-spin-button,
.grille-optique .mesure input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.grille-optique .mesure input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.grille-optique .mesure i {
    position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
    font-style: normal; font-size: .74rem; color: var(--text-muted); pointer-events: none;
}
@media (max-width: 800px) {
    .grille-optique .ligne-entete { display: none; }
    .grille-optique .ligne-oeil { grid-template-columns: 1fr 1fr; }
    .grille-optique .oeil { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ Schéma dentaire
   Le devis dentaire se lit dent par dent : la demande de prise en charge se saisit donc
   sur un odontogramme FDI, arcade par arcade, plutôt que dans une liste de numéros. */
.odontogramme {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fbfbfe, var(--surface));
    padding: 12px 14px 10px;
    margin: 0 0 14px;
    max-width: 760px;
}

.odo-entete {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.odo-titre {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
}

.odo-cote {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    width: 130px;
}

.odo-cote-fin { text-align: right; }

.odo-arcade {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 3px;
    position: relative;
    padding: 6px 0;
}

/* Le trait médian : la ligne inter-incisive, qui sépare les hémi-arcades. */
.odo-arcade::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 2px;
    bottom: 2px;
    border-left: 1px dashed var(--border-tableau);
}

.odo-haut { border-bottom: 2px solid var(--border-tableau); padding-bottom: 10px; }
.odo-bas { padding-top: 10px; }

.odo-machoire {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    padding: 0 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    z-index: 1;
}

/* Les deux intitulés encadrent le schéma : sur la ligne médiane, ils se recouvriraient. */
.odo-haut .odo-machoire { top: -9px; }
.odo-bas .odo-machoire { bottom: -9px; }

.odo-hemi {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
}

.odo-rangee {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 3px;
}

.odo-dent {
    appearance: none;
    border: 1px solid var(--border-champ);
    background: var(--surface);
    color: var(--text);
    border-radius: 7px 7px 5px 5px;
    padding: 9px 0 7px;
    font: 600 12px/1 inherit;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s, transform .12s;
}

.odo-bas .odo-dent { border-radius: 5px 5px 7px 7px; }

.odo-dent.est-lait {
    padding: 6px 0 5px;
    font-size: 11px;
    color: var(--text-muted);
    border-style: dashed;
}

.odo-dent:hover { border-color: var(--primary); background: var(--primary-soft); }

.odo-dent[aria-pressed="true"] {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Une dent qui n'est plus sur l'arcade : barrée, en retrait, mais toujours cliquable —
   c'est sur elle que se pose une prothèse ou un implant. */
.odo-dent.dent-absente {
    color: var(--text-muted);
    background: repeating-linear-gradient(135deg, transparent, transparent 4px,
                                          var(--neutral-soft) 4px, var(--neutral-soft) 8px);
    border-style: dotted;
    text-decoration: line-through;
}

/* Une dent déjà soignée : le détail des actes se lit au survol. */
.odo-dent.dent-soignee { border-color: var(--warning); }

.odo-legende {
    margin: 8px 0 0;
    font-size: 11.5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.puce {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    border: 1px solid var(--border-champ);
}

.puce-absente {
    border-style: dotted;
    background: repeating-linear-gradient(135deg, transparent, transparent 3px,
                                          var(--neutral-soft) 3px, var(--neutral-soft) 6px);
}

.puce-soignee { border-color: var(--warning); }

/* Une dent déjà portée sur la demande : on la marque pour éviter de la redemander. */
.odo-dent.a-des-actes {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--text);
    position: relative;
}

.odo-dent.a-des-actes::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--success);
}

.odo-bas .odo-dent.a-des-actes::after { bottom: auto; top: 2px; }

.odo-dent.a-des-actes[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* La denture que l'âge ne laisse pas attendre reste dessinée mais repliée : on la déplie
   d'un clic, car une dent de lait peut être retenue chez l'adulte. */
.odontogramme:not(.montre-tout) .odo-rangee-masquee { display: none; }

.odo-age {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
}

.lien-sobre {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    color: var(--primary);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.lien-sobre:hover { color: var(--primary-dark); }

/* .btn impose son display : sans cela, l'attribut hidden ne masquerait rien. */
.odo-pied [hidden] { display: none; }

.odo-pied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
}

.badge-dent {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 12px;
}

.badge-dent.lait { background: var(--neutral-soft); color: var(--text-muted); }

@media (max-width: 720px) {
    .odo-dent { padding: 7px 0 5px; font-size: 11px; }
    .odo-cote { width: 70px; font-size: 10px; }
}

/* ------------------------------------------------- Jauge des séances de rééducation
   Une rééducation se lit d'un coup d'œil : ce qui est fait, ce qui reste. */
.jauge {
    height: 7px;
    border-radius: 4px;
    background: var(--neutral-soft);
    overflow: hidden;
    margin-bottom: 4px;
}

.jauge > span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .2s;
}
