/* SmartClinic Plus — Custom overrides */

/* Footer du sidebar : indicateur réseau + icône customizer, fixé en bas */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: inherit;
    z-index: 2;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar-footer-customizer {
    display: flex;
    align-items: center;
    color: rgba(200, 200, 200, 0.5);
    cursor: pointer;
    transition: color 0.15s;
}
.sidebar-footer-customizer:hover { color: var(--bs-primary); }

/* Indicateur réseau */
.sc-net-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(200, 200, 200, 0.8);
    background: rgba(255, 255, 255, 0.05);
    line-height: 1;
}
.sc-net-indicator.net-good { color: #10B981; background: rgba(16, 185, 129, 0.1); }
.sc-net-indicator.net-medium { color: #F59E0B; background: rgba(245, 158, 11, 0.1); }
.sc-net-indicator.net-bad { color: #EF4444; background: rgba(239, 68, 68, 0.12); }
.sc-net-indicator.net-offline {
    color: #fff;
    background: #DC2626;
    animation: sc-net-blink 1.6s infinite;
}
@keyframes sc-net-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.sc-net-icon { flex-shrink: 0; }
.sc-net-label { font-variant-numeric: tabular-nums; }

/* HTMX progress bar — barre fine au top, animée pendant chaque requête */
#htmx-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, #3a57e8 20%, #3a57e8 80%, transparent);
    background-size: 200% 100%;
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.2s ease-out, opacity 0.2s;
    z-index: 9999; pointer-events: none; opacity: 0;
}
#htmx-progress.active {
    opacity: 1;
    animation: htmx-progress-anim 1.5s ease-in-out infinite;
}
@keyframes htmx-progress-anim {
    0%   { transform: scaleX(0);   background-position: 0%   0; }
    50%  { transform: scaleX(0.7); background-position: 100% 0; }
    100% { transform: scaleX(1);   background-position: 200% 0; }
}
/* Désactive uniquement les boutons en cours de requête (évite double-click) */
button.htmx-request, a.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}


/* Réserver la place en bas du sidebar pour ne pas cacher les derniers items
   (user block ~52px + footer customizer ~40px = ~92px) */
.sidebar .data-scrollbar { max-height: calc(100vh - 152px) !important; }

/* Sidebar user block — avatar + nom + bouton logout, juste au-dessus du footer customizer */
.sidebar-user-block {
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: inherit;
    z-index: 2;
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.sidebar-user-info { font-size: 0.78rem; }
.sidebar-user-name {
    font-weight: 600;
    color: rgba(200, 200, 200, 0.95);
    line-height: 1.2;
}
.sidebar-user-email {
    color: rgba(200, 200, 200, 0.55);
    font-size: 0.7rem;
    line-height: 1.2;
}
.sidebar-user-logout {
    color: rgba(200, 200, 200, 0.55);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: inline-flex;
}
.sidebar-user-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* En mode sidebar mini (collapsed icons), masquer le texte user mais garder avatar + logout */
.sidebar.sidebar-mini .sidebar-user-info { display: none; }
.sidebar.sidebar-mini .sidebar-user-block .d-flex { justify-content: center; }

/* ══════════════════════════════════════════════════════════════
 * App-shell layout (opt-in, desktop only)
 *
 * Les frameworks CSS (Hope-UI, Bootstrap) sont faits pour le pattern
 * "page-scroll" par défaut : contenu défile globalement. SmartClinic
 * veut le pattern "app-shell" en desktop (chaque panneau scroll interne,
 * pas de scroll global) — standard pour interfaces denses (Figma, Linear).
 *
 * Règle : opt-in via .sc-page ET seulement à ≥992px (lg). En dessous,
 * on laisse le comportement natif Hope-UI (page-scroll empilé).
 *
 * Classes utilitaires :
 *   .sc-page        — racine page app-shell
 *   .sc-fill        — enfant qui prend l'espace restant
 *   .sc-scroll-y    — scroll vertical interne
 *   .sc-card-fill   — card dont le card-body scrolle interne
 * ══════════════════════════════════════════════════════════════ */
@media (min-width: 992px) {
    body:has(.sc-page) main.main-content {
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    body:has(.sc-page) main.main-content > .iq-banner {
        flex: 0 0 auto;
    }
    /* Hope-UI force min-height via !important. On garde son margin-top:-3rem
       (effet float visuel au-dessus du gradient) qui fonctionne avec flex. */
    body:has(.sc-page) main.main-content > .iq-banner + .content-inner {
        flex: 1 1 0;
        min-height: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .sc-page {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .sc-fill { flex: 1 1 0; min-height: 0; }
    .sc-scroll-y { overflow-y: auto; min-height: 0; }
    .sc-card-fill {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    .sc-card-fill > .card-body { flex: 1 1 0; min-height: 0; overflow-y: auto; }
}
/* <992px : comportement natif Hope-UI (page-scroll), classes sc-* = no-op */

/* Empty state — zone vide stylisée (remplace "Aucun X" gris nu) */
.sc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--bs-secondary-color);
    text-align: center;
    min-height: 140px;
}
.sc-empty .sc-empty-icon {
    opacity: 0.3;
    width: 32px;
    height: 32px;
}
.sc-empty .sc-empty-text { font-size: 0.85rem; margin: 0; }
.sc-empty .sc-empty-cta { margin-top: 0.25rem; }

/* Sidebar: compact width */
body {
    --sidebar-width: 11rem;
}

/* Hide navbar on desktop si pas de tabs ET pas d'actions (breadcrumb seul ne suffit pas) */
@media (min-width: 1200px) {
    .iq-navbar:not(:has(#page-nav-tabs > li)):not(:has(#page-nav-actions > li)) {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════
 * Imaging — masonry gallery (Pinterest-style)
 *
 * CSS Grid avec aspect-ratio par image — chaque card span le bon nombre
 * de rows pour préserver le ratio sans crop ni stretch.
 * Lecture left-to-right, top-to-bottom (chronologique).
 * ══════════════════════════════════════════════════════════════ */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    grid-auto-rows: 8px;
    gap: 8px;
    align-items: start;
    /* Safety: contient les enfants, prévient l'explosion en taille naturelle */
    width: 100%;
    max-width: 100%;
}
.masonry-item {
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0,0,0,0.04);
    position: relative;
    grid-row-end: span var(--row-span, 25);
    /* Safety: empêche l'item de dépasser la largeur de sa cellule grid */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    /* HARD CAP — peu importe row-span, jamais d'item plus haut que 400px */
    max-height: 400px;
    /* aspect-ratio fallback (sera override par inline style) */
    aspect-ratio: var(--ratio, 1);
}
/* Le link DEFINI la hauteur via aspect-ratio — image jamais déformée même
   avant que JS recalcule le row-span exact (anti-flash de layout cassé). */
.masonry-thumb-link, .masonry-pending {
    display: block;
    width: 100%;
    max-width: 100%;
    /* aspect-ratio appliquée inline via style="aspect-ratio: W/H" sur le parent .masonry-item;
       fallback ici si pas défini */
    aspect-ratio: var(--ratio, 1);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.masonry-thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}
.masonry-thumb-link:hover .masonry-thumb {
    transform: scale(1.03);
}
.masonry-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.masonry-thumb-link:hover .masonry-overlay,
.masonry-item:focus-within .masonry-overlay { opacity: 1; }

.masonry-pending {
    background: rgba(58, 87, 232, 0.05);
    border: 2px dashed rgba(58, 87, 232, 0.2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
}

/* Drop zone hover state pendant drag-and-drop */
#imaging-dropzone.dz-hover,
#doc-dropzone.dz-hover {
    background: rgba(58, 87, 232, 0.05);
    outline: 3px dashed var(--bs-primary);
    outline-offset: -8px;
    border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════════
 * Documents grid (cards classiques, pas masonry — formats homogènes)
 * ══════════════════════════════════════════════════════════════ */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.doc-card {
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    overflow: hidden;
    background: white;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}
.doc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.doc-card-thumb-wrap {
    position: relative;
    aspect-ratio: 0.77;  /* ratio A4 portrait approx */
    background: #f5f5f5;
    overflow: hidden;
}
.doc-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.doc-card-thumb-fallback {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--bs-secondary-color);
    font-weight: 600;
}
.doc-card-format-badge {
    position: absolute;
    top: 6px; right: 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.doc-card-body {
    padding: 8px 10px;
    background: white;
}
.doc-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.doc-card-meta {
    font-size: 0.7rem;
}
.doc-card-pending {
    opacity: 0.85;
    pointer-events: none;
}
.doc-card-pending .doc-card-thumb-wrap {
    background: rgba(58, 87, 232, 0.05);
}
#imaging-dropzone.dz-hover::before {
    content: 'Lâcher pour uploader';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bs-primary);
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Upload progress (bottom right toast-like) */
#imaging-upload-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    z-index: 1100;
    display: none;
}
#imaging-upload-progress.active { display: block; }
.imaging-upload-item {
    background: white;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-left: 3px solid var(--bs-primary);
    font-size: 0.85rem;
}
.imaging-upload-item.error { border-left-color: var(--bs-danger); }
.imaging-upload-item.done { border-left-color: var(--bs-success); }
.imaging-upload-item .progress { height: 4px; margin-top: 4px; }
.sidebar .sidebar-header .logo-title {
    font-size: 0.95rem;
}

/* Theme-2: gris plus foncé */
[data-bs-theme-color="color-2"] {
    --bs-primary: #5a5f68;
    --bs-primary-rgb: 90, 95, 104;
    --bs-primary-bg-subtle: #dfe0e2;
    --bs-primary-border-subtle: #b8bbbf;
    --bs-primary-hover-bg: #484c53;
    --bs-primary-hover-border: #3d4047;
    --bs-primary-active-bg: #484c53;
    --bs-primary-active-border: #3d4047;
}

/* ══════════════════════════════════════════════════════════════
 * Primary tint palette
 *
 * Background "light" qui suit la couleur primaire du customizer.
 * --bs-primary-rgb est mis à jour au runtime par setting.js → ces
 * variables se recalculent automatiquement quand l'utilisateur change
 * la couleur dans la fenêtre Personnalisation.
 *
 * Usage : background-color: var(--sc-primary-bg-50);
 * ══════════════════════════════════════════════════════════════ */
:root {
    --sc-primary-bg-50:  rgba(var(--bs-primary-rgb), 0.03);
    --sc-primary-bg-100: rgba(var(--bs-primary-rgb), 0.06);
    --sc-primary-bg-200: rgba(var(--bs-primary-rgb), 0.10);
    --sc-primary-bg-300: rgba(var(--bs-primary-rgb), 0.16);
}
[data-bs-theme="dark"] {
    --sc-primary-bg-50:  rgba(var(--bs-primary-rgb), 0.06);
    --sc-primary-bg-100: rgba(var(--bs-primary-rgb), 0.10);
    --sc-primary-bg-200: rgba(var(--bs-primary-rgb), 0.16);
    --sc-primary-bg-300: rgba(var(--bs-primary-rgb), 0.22);
}

/* Body bg light primary — cards restent blanches (contraste) */
body {
    background-color: var(--sc-primary-bg-200);
}

/* Cards : tint primary léger, bord subtil, radius prononcé, shadow douce */
.card {
    background-color: color-mix(in srgb, #fff 96%, var(--bs-primary) 4%);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.08);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(var(--bs-primary-rgb), 0.05);
    overflow: hidden; /* coupe les enfants au radius (header, body, etc.) */
}
.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.06);
}
.card-body,
.card-footer {
    background-color: transparent;
}
[data-bs-theme="dark"] .card {
    background-color: color-mix(in srgb, var(--bs-body-bg) 92%, var(--bs-primary) 8%);
    border-color: rgba(var(--bs-primary-rgb), 0.18);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(var(--bs-primary-rgb), 0.08);
}


/* ══════════════════════════════════════════════════════════════
 * Card Paiements — Tab Soins
 * Récap financier + sections (Encaissements / Tiers / Bulletins)
 * ══════════════════════════════════════════════════════════════ */
.sc-pay-actions {
    display: inline-flex;
    gap: 0.25rem;
}
.sc-pay-actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* Récap solde — clean, tabular nums, hiérarchie typographique */
.sc-pay-summary {
    padding: 0.75rem 0.85rem;
    background: rgba(var(--bs-primary-rgb), 0.03);
    border-radius: 6px;
    margin-bottom: 0.75rem;
}
.sc-pay-summary .sc-pay-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.15rem 0;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}
.sc-pay-summary .sc-pay-row .label small {
    font-size: 0.68rem;
    color: var(--bs-secondary-color);
    opacity: 0.75;
    margin-left: 3px;
}
.sc-pay-summary .sc-pay-row .amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--bs-body-color);
}
.sc-pay-summary .sc-pay-row.is-deduction .amount { color: var(--bs-info); }
.sc-pay-summary .sc-pay-row.is-credit    .amount { color: #059669; }
.sc-pay-summary .sc-pay-divider {
    height: 1px;
    background: rgba(var(--bs-primary-rgb), 0.12);
    margin: 0.4rem 0;
}
.sc-pay-summary .sc-pay-row-total {
    padding: 0.25rem 0 0.1rem;
    font-size: 0.82rem;
    align-items: baseline;
}
.sc-pay-summary .sc-pay-row-total .label {
    font-weight: 600;
    color: var(--bs-body-color);
}
.sc-pay-summary .sc-pay-row-total .amount {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.sc-pay-summary .sc-pay-row-total.is-due       .amount { color: #dc2626; }
.sc-pay-summary .sc-pay-row-total.is-zero      .amount { color: #059669; }
.sc-pay-summary .sc-pay-row-total.is-overpaid  .amount { color: var(--bs-info); }

/* Section header — Encaissements / Tiers / Bulletins */
.sc-pay-section {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
}
.sc-pay-section + .sc-pay-section {
    border-top: 1px solid rgba(var(--bs-primary-rgb), 0.08);
}
.sc-pay-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    font-size: 0.64rem;
    letter-spacing: 0.07em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}
.sc-pay-section-header .sc-pay-section-total {
    font-variant-numeric: tabular-nums;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    color: var(--bs-body-color);
}

/* Container scrollable des items — vertical only, jamais horizontal */
.sc-pay-list {
    max-height: 18vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Item de liste paiement / tiers / bulletin — single line, clic = edit modal */
.sc-pay-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    margin: 0 -0.5rem;
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.12s ease;
    overflow: hidden;          /* coupe les enfants qui débordent */
}
.sc-pay-item:last-child { border-bottom: none; }
.sc-pay-item:hover { background-color: rgba(var(--bs-primary-rgb), 0.06); }

.sc-pay-item-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.3;
    flex-shrink: 0;            /* le montant ne se compresse pas */
    white-space: nowrap;
}
.sc-pay-item-amount.is-credit  { color: #059669; }   /* paiement reçu */
.sc-pay-item-amount.is-pending { color: var(--bs-info); }  /* tiers en attente */
.sc-pay-item-amount.is-info    { color: var(--bs-body-color); }  /* bulletin */

.sc-pay-item-meta {
    flex: 1 1 auto;
    min-width: 0;              /* permet le shrink + ellipsis */
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    line-height: 1.3;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sc-pay-item-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.sc-pay-item-tag.tag-expected   { background: rgba(8, 177, 186, 0.15);  color: #047481; }
.sc-pay-item-tag.tag-invoiced   { background: rgba(245, 158, 11, 0.15); color: #92400e; }
.sc-pay-item-tag.tag-paid       { background: rgba(16, 185, 129, 0.15); color: #065f46; }
.sc-pay-item-tag.tag-cancelled  { background: rgba(148, 163, 184, 0.15); color: #475569; }


/* ══════════════════════════════════════════════════════════════
 * Page sub-navigation — barre de tabs au-dessus du contenu
 * Pattern : titre + tabs locales + actions, en remplacement
 * de la "card-glass banner" navy précédente.
 * ══════════════════════════════════════════════════════════════ */
.sc-page-subnav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg,
        var(--bs-primary) 0%,
        color-mix(in srgb, var(--bs-primary) 80%, #4338ca) 100%);
    color: #fff;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.18);
}
.sc-page-subnav-title-wrap h5 {
    color: #fff;
}

/* Tabs dans la subnav — pills légers sur fond translucide */
.sc-page-subnav-tabs { padding: 0; margin: 0; list-style: none; }
.sc-page-subnav-tab {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    background: transparent;
    border: none;
}
.sc-page-subnav-tab:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.1);
}
.sc-page-subnav-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    font-weight: 600;
}

/* Boutons d'action dans la subnav — fond clair (contraste avec navy) */
.sc-page-subnav .btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--bs-primary);
    border: none;
}
.sc-page-subnav .btn:hover {
    background: #fff;
    color: var(--bs-primary);
}
.sc-page-subnav .btn.btn-success {
    background: #10b981;
    color: #fff;
}
.sc-page-subnav .btn.btn-success:hover {
    background: #059669;
}


/* ══════════════════════════════════════════════════════════════
 * Voice Notes — Tab Soins, carte Notes vocales
 * Bouton mic + liste audio + transcription
 * ══════════════════════════════════════════════════════════════ */
.sc-vn-mic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    background: #fff;
    color: var(--bs-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.sc-vn-mic:hover {
    background: rgba(var(--bs-primary-rgb), 0.08);
    border-color: var(--bs-primary);
}
.sc-vn-mic.is-recording {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
    animation: sc-vn-recording-pulse 1.5s ease-in-out infinite;
}
.sc-vn-mic.is-uploading {
    opacity: 0.6;
    pointer-events: none;
}
@keyframes sc-vn-recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* État pendant l'enregistrement — affiche timer + pulse */
.sc-vn-state {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.78rem;
}
.sc-vn-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc2626;
    animation: sc-vn-recording-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
.sc-vn-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #dc2626;
}

/* Liste des notes */
.sc-vn-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.sc-vn-item {
    background: rgba(var(--bs-primary-rgb), 0.04);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.08);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
}
.sc-vn-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.sc-vn-item-time {
    font-weight: 600;
    color: var(--bs-body-color);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
.sc-vn-item-duration {
    color: var(--bs-secondary-color);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}
.sc-vn-item-visit {
    background: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}
.sc-vn-item-status {
    margin-left: auto;
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.sc-vn-item-status.status-pending,
.sc-vn-item-status.status-processing {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
}
.sc-vn-item-status.status-failed {
    background: rgba(220, 38, 38, 0.15);
    color: #991b1b;
}
.sc-vn-item-status.status-done { display: none; }
.sc-vn-item-delete {
    background: none;
    border: none;
    padding: 2px 4px;
    color: var(--bs-secondary-color);
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s ease;
}
.sc-vn-item:hover .sc-vn-item-delete { opacity: 1; }
.sc-vn-item-delete:hover { color: #dc2626; background: rgba(220, 38, 38, 0.08); }

.sc-vn-audio {
    width: 100%;
    height: 28px;
    margin-bottom: 0.4rem;
}

.sc-vn-item-text {
    color: var(--bs-body-color);
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}


/* ══════════════════════════════════════════════════════════════
 * Visite item — Tab Soins, carte Visites
 * Layout multi-lignes condensées avec border-left status.
 * Affiche TOUS les champs de la visite mais seulement si remplis.
 * ══════════════════════════════════════════════════════════════ */
.sc-visit-item {
    padding: 0.5rem 0.65rem 0.5rem 0.6rem;
    border-left: 3px solid var(--bs-gray-400);
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.06);
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 0.78rem;
    line-height: 1.35;
}
.sc-visit-item:hover { background-color: rgba(var(--bs-primary-rgb), 0.05); }
.sc-visit-item:last-child { border-bottom: none; }
.sc-visit-item.status-scheduled { border-left-color: #3b82f6; }
.sc-visit-item.status-arrived   { border-left-color: #a855f7; }
.sc-visit-item.status-open      { border-left-color: #f59e0b; }
.sc-visit-item.status-closed    { border-left-color: #10b981; }
.sc-visit-item.status-cancelled { border-left-color: #dc2626; opacity: 0.55; text-decoration: line-through; }
.sc-visit-item.status-no_show   { border-left-color: #6b7280; opacity: 0.6; }

/* Header — V<n> + date + status + actions */
.sc-visit-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
    overflow: hidden;
}
.sc-visit-num {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--bs-body-color);
    flex-shrink: 0;
}
.sc-visit-date {
    color: var(--bs-secondary-color);
    font-size: 0.74rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.sc-visit-date small { font-size: 0.68rem; opacity: 0.75; }
.sc-visit-status {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 3px;
    text-transform: uppercase;
}
.sc-visit-status.status-scheduled { background: rgba(59, 130, 246, 0.15);  color: #1e40af; }
.sc-visit-status.status-arrived   { background: rgba(168, 85, 247, 0.15);  color: #6b21a8; }
.sc-visit-status.status-open      { background: rgba(245, 158, 11, 0.18);  color: #92400e; }
.sc-visit-status.status-closed    { background: rgba(16, 185, 129, 0.18);  color: #065f46; }
.sc-visit-status.status-cancelled { background: rgba(220, 38, 38, 0.15);   color: #991b1b; }
.sc-visit-status.status-no_show   { background: rgba(107, 114, 128, 0.15); color: #374151; }

/* Actions header */
.sc-visit-actions {
    display: inline-flex;
    gap: 2px;
    flex-shrink: 0;
}
.sc-visit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    text-decoration: none;
    padding: 0;
}
.sc-visit-btn:hover {
    background: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
}

/* Meta praticien — Box · Dr · Type */
.sc-visit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.15rem;
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
}
.sc-visit-meta span { display: inline; }
.sc-visit-meta span + span::before { content: '·'; margin-right: 0.4rem; opacity: 0.5; }

/* Field Motif/Diag/Notes/Actes/Docs : label compact + value tronquée */
.sc-visit-field {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    overflow: hidden;
}
.sc-visit-field .label {
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-weight: 600;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-top: 1px;
    min-width: 32px;
}
.sc-visit-field .value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-body-color);
}

/* Footer — total prix + prochain RDV */
.sc-visit-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
    padding-top: 0.25rem;
    border-top: 1px dashed rgba(var(--bs-primary-rgb), 0.08);
    font-size: 0.7rem;
}
.sc-visit-total {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--bs-primary);
    flex-shrink: 0;
}
.sc-visit-next {
    color: var(--bs-secondary-color);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}


/* ══════════════════════════════════════════════════════════════
 * Acte item — Tab Soins, carte Actes
 * Layout 3 lignes : titre+status / dents+prix / progression
 * Border-left coloré selon status (planned/in_progress/completed)
 * ══════════════════════════════════════════════════════════════ */
.acte-item {
    padding: 0.5rem 0.75rem 0.5rem 0.65rem;
    border-left: 3px solid var(--bs-gray-400);
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.06);
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.acte-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}
.acte-item:last-child { border-bottom: none; }
.acte-item.status-planned     { border-left-color: #94a3b8; }
.acte-item.status-in_progress { border-left-color: #f59e0b; }
.acte-item.status-completed   { border-left-color: #10b981; }

.acte-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--bs-body-color);
    line-height: 1.2;
    min-width: 0;
}
.acte-teeth {
    display: inline-block;
    font-family: var(--bs-font-monospace, ui-monospace, monospace);
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(var(--bs-primary-rgb), 0.08);
    color: var(--bs-secondary-color);
    padding: 1px 7px;
    border-radius: 4px;
    line-height: 1.4;
}
.acte-price {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--bs-primary);
    white-space: nowrap;
}

/* Status badge — pastille couleur cohérente avec border-left */
.acte-status-badge {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    text-transform: uppercase;
}
.acte-status-badge.status-planned     { background: rgba(148, 163, 184, 0.18); color: #475569; }
.acte-status-badge.status-in_progress { background: rgba(245, 158, 11, 0.18);  color: #92400e; }
.acte-status-badge.status-completed   { background: rgba(16, 185, 129, 0.18);  color: #065f46; }

/* Progression dots — clic toggle status (cycle planned→in_progress→done) */
.acte-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.acte-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: none;
    background: var(--bs-gray-300);
    padding: 0;
    transition: transform 0.1s ease, background-color 0.15s ease;
    cursor: pointer;
}
.acte-dot:hover {
    transform: scale(1.3);
}
.acte-dot.status-done        { background: #10b981; }
.acte-dot.status-in_progress { background: #f59e0b; }
.acte-dot.status-skipped     { background: #94a3b8; opacity: 0.4; }
.acte-progress-text {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* Lab badge — étape en attente labo */
.acte-lab-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    background: rgba(8, 177, 186, 0.15);
    color: #047481;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.acte-lab-badge:hover {
    background: rgba(8, 177, 186, 0.25);
}


/* ── Compact layout: reduce spacing everywhere ── */


/* Tighter content padding */
.content-inner {
    padding-top: 1rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* Reduce container-fluid padding */
.container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* Compact cards */
.card {
    margin-bottom: 0.75rem !important;
}
.card-body {
    padding: 0.75rem !important;
}

/* Tighter grid gaps */
.row {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
}

/* Compact sidebar */
.sidebar-body .nav-link {
    padding: 0.4rem 1rem !important;
}

/* Content starts at same position regardless of banner */
.iq-banner:not(.hide) + .content-inner {
    margin-top: 0 !important;
}

/* Smaller page title */
.iq-navbar-header h1 {
    font-size: 1.5rem;
}

/* ── Tabulator custom theme ── */
.tabulator {
    border: none !important;
    background: transparent !important;
    font-size: inherit;
}
.tabulator .tabulator-header {
    background: var(--bs-light) !important;
    border-bottom: 2px solid var(--bs-border-color) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary);
}
.tabulator .tabulator-header .tabulator-col {
    background: transparent !important;
    border-right: none !important;
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    border-bottom: 1px solid var(--bs-border-color);
    cursor: pointer;
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.04) !important;
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-right: none !important;
    padding: 0.6rem 0.75rem;
}
.tabulator .tabulator-footer {
    background: var(--bs-light) !important;
    border-top: 1px solid var(--bs-border-color) !important;
}
.tabulator .tabulator-footer .tabulator-page {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    margin: 0 2px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}
.tabulator .tabulator-footer .tabulator-page.active {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

/* DataTables search input — normal size */
.dataTables_filter input.form-control-sm {
    font-size: 1rem !important;
    padding: 0.375rem 0.75rem !important;
    min-height: calc(1.5em + 0.75rem + 2px) !important;
    border-radius: 0.375rem !important;
}

/* Tom Select: hide dropdown arrow in sidebar */
#sidebar-medical .ts-control {
    padding: 0.25rem 0.5rem !important;
}
#sidebar-medical .ts-wrapper .ts-dropdown-toggle {
    display: none;
}

/* ── FullCalendar status colors ── */
.fc-status-cancelled { opacity: 0.4; text-decoration: line-through; }
.fc-status-no_show { opacity: 0.4; background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(0,0,0,0.1) 3px, rgba(0,0,0,0.1) 6px) !important; }
.fc-status-closed { opacity: 0.6; }
.fc-confirmed { border-left: 3px solid #219653 !important; }

/* ── FullCalendar ── */
.fc { font-size: 0.85rem; }
.fc .fc-toolbar-title { font-size: 1.1rem; }
.fc .fc-button { font-size: 0.8rem; padding: 0.25rem 0.5rem; }
.fc .fc-event { cursor: pointer; border-radius: 4px; }
.fc .fc-timegrid-slot { height: 2rem; }
#agenda-container { display: flex; height: calc(100vh - 120px); }
#calendar-wrapper { flex: 1; overflow: hidden; }
#waiting-room { width: 250px; border-left: 1px solid var(--bs-border-color); overflow-y: auto; transition: width 0.3s; }
#waiting-room.collapsed { width: 0; overflow: hidden; }
#waiting-room .wr-header { padding: 0.5rem; background: var(--bs-light); border-bottom: 1px solid var(--bs-border-color); }
#waiting-room .wr-item { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--bs-border-color); font-size: 0.85rem; cursor: pointer; }
#waiting-room .wr-item:hover { background: rgba(var(--bs-primary-rgb), 0.04); }

/* All modals scrollable */
.modal-dialog-scrollable .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Pro table hover */
.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.04) !important;
}

/* Soft button variant */
.btn-soft-primary {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    border: none;
}
.btn-soft-primary:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.2);
    color: var(--bs-primary);
}


@media (max-width: 991px) {
    .content-inner {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Body text: noir au lieu du gris Hope UI */
:root,
[data-bs-theme="light"] {
    --bs-body-color: #232328;
    --bs-body-color-rgb: 35, 35, 40;
}

/* ────────────────────────────────────────────────────────────
   Odontogramme — anatomique (Odontogram) + compact (sélecteur)
   Portage depuis Endo.tn/frontend — CSS adapté Bootstrap/Plus
──────────────────────────────────────────────────────────── */
.sc-odonto { --sc-tooth-gold: #9a7230; --sc-tooth-green: #1a5c35; --sc-tooth-accent: #c4974a; --sc-tooth-primary: #0d6efd; }
.sc-odonto svg { max-width: 100%; width: auto; height: auto; max-height: 100%; display: block; margin: 0 auto; user-select: none; touch-action: manipulation; color: #6c757d; }
.sc-odonto { display: flex; align-items: center; justify-content: center; }
.sc-odonto .tooth { cursor: pointer; transition: color 120ms; pointer-events: bounding-box; }
.sc-odonto .tooth path:not(.tooth-fill) { fill: transparent; pointer-events: all; }
.sc-odonto .tooth .tooth-fill { pointer-events: all; opacity: 0.08; transition: opacity 120ms, fill 120ms; }
.sc-odonto .tooth:hover .tooth-fill { opacity: 0.25; }
.sc-odonto .tooth:hover { color: var(--sc-tooth-accent); }

/* Consultation réalisée — gold */
.sc-odonto .tooth.has-cslt { color: var(--sc-tooth-accent); }
.sc-odonto .tooth.has-cslt .tooth-fill { fill: var(--sc-tooth-accent); opacity: .22; }

/* Traitement générique — vert */
.sc-odonto .tooth.has-trt { color: var(--sc-tooth-green); }
.sc-odonto .tooth.has-trt .tooth-fill { fill: var(--sc-tooth-green); opacity: .25; }

/* Sous-types traitement */
.sc-odonto .tooth.has-trt-endo { color: #1a5c55; }
.sc-odonto .tooth.has-trt-endo .tooth-fill { fill: #1a5c55; opacity: .28; }
.sc-odonto .tooth.has-trt-cons { color: #4a7f45; }
.sc-odonto .tooth.has-trt-cons .tooth-fill { fill: #4a7f45; opacity: .28; }
.sc-odonto .tooth.has-trt-chir { color: #7a1f1f; }
.sc-odonto .tooth.has-trt-chir .tooth-fill { fill: #7a1f1f; opacity: .28; }

/* Consult + Traitement */
.sc-odonto .tooth.has-both { color: var(--sc-tooth-accent); }
.sc-odonto .tooth.has-both .tooth-fill { fill: var(--sc-tooth-green); opacity: .45; }

/* Dent active (focus courant) — bleu */
.sc-odonto .tooth.active { color: var(--sc-tooth-primary); }
.sc-odonto .tooth.active .tooth-fill { fill: var(--sc-tooth-primary); opacity: .22; }

/* Sélection multi (filtre / picker formulaire) — gold bord épais + fill visible */
.sc-odonto .tooth.tooth-sel { color: var(--sc-tooth-gold); }
.sc-odonto .tooth.tooth-sel path[stroke] { stroke-width: 3; stroke: var(--sc-tooth-gold); }
.sc-odonto .tooth.tooth-sel .tooth-fill { fill: var(--sc-tooth-gold); opacity: .55; }

/* Lecture seule */
.sc-odonto.readonly .tooth { cursor: default; }
.sc-odonto.readonly .tooth:hover { color: currentColor; }

/* ─── Dentition lactéale (boutons simples) ─── */
.sc-decid { display: flex; flex-direction: column; gap: 4px; padding: 6px 4px; }
.sc-decid-row { display: flex; justify-content: center; gap: 3px; flex-wrap: nowrap; }
.sc-decid-tooth {
    min-width: 28px; height: 30px; padding: 2px 4px;
    border: 1.5px solid #dee2e6; background: #fff; color: #495057;
    border-radius: 6px; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; transition: all 120ms;
    display: inline-flex; align-items: center; justify-content: center;
}
.sc-decid-tooth:hover { border-color: #c4974a; color: #9a7230; background: rgba(196,151,74,0.08); }
.sc-decid-tooth.tooth-sel {
    border-color: #9a7230; background: #9a7230; color: #fff; border-width: 2px;
}
.sc-decid-sep { width: 10px; border-left: 1px dashed #adb5bd; margin: 0 3px; }
.sc-decid.readonly .sc-decid-tooth { cursor: default; }
.sc-decid.readonly .sc-decid-tooth:hover { border-color: #dee2e6; color: #495057; background: #fff; }

/* Toggle container — déplié/replié */
.sc-decid-toggle { margin-top: 6px; }
.sc-decid-wrap { overflow: hidden; transition: max-height 200ms ease; }
.sc-decid-wrap.collapsed { max-height: 0; }
.sc-decid-wrap.expanded { max-height: 120px; }


/* ══════════════════════════════════════════════════════════════
 * Odontogram — display states (status + findings)
 * ══════════════════════════════════════════════════════════════ */
/* Status (physique) */
.sc-odonto .tooth.st-absent .tooth-fill { fill: #adb5bd; opacity: 0.5; }
.sc-odonto .tooth.st-absent { color: #adb5bd; opacity: 0.6; }
.sc-odonto .tooth.st-absent path:not(.tooth-fill) { stroke-dasharray: 3,2; }
.sc-odonto .tooth.st-implant .tooth-fill { fill: #6c757d; opacity: 0.35; }
.sc-odonto .tooth.st-implant { color: #495057; }
.sc-odonto .tooth.st-pontic .tooth-fill { fill: #8B5CF6; opacity: 0.3; }
.sc-odonto .tooth.st-pontic { color: #6D28D9; }
.sc-odonto .tooth.st-unerupted { opacity: 0.35; }
.sc-odonto .tooth.st-agenesis { opacity: 0.25; }

/* Findings — pathologies (rouges/oranges) */
.sc-odonto .tooth.has-caries .tooth-fill { fill: #EF4444; opacity: 0.35; }
.sc-odonto .tooth.has-caries { color: #B91C1C; }
.sc-odonto .tooth.has-apical { color: #DC2626; }
.sc-odonto .tooth.has-apical .tooth-fill { fill: #DC2626; opacity: 0.3; }
.sc-odonto .tooth.has-fracture .tooth-fill { fill: #F59E0B; opacity: 0.35; }
.sc-odonto .tooth.has-fracture { color: #D97706; }
.sc-odonto .tooth.has-mobility { color: #F59E0B; }

/* Findings — traitements existants (bleus/verts/violets) */
.sc-odonto .tooth.has-restore .tooth-fill { fill: #3B82F6; opacity: 0.35; }
.sc-odonto .tooth.has-restore { color: #1D4ED8; }
.sc-odonto .tooth.has-crown .tooth-fill { fill: #8B5CF6; opacity: 0.4; }
.sc-odonto .tooth.has-crown { color: #6D28D9; }
.sc-odonto .tooth.has-endo .tooth-fill { fill: #DC2626; opacity: 0.3; }
.sc-odonto .tooth.has-endo { color: #B91C1C; }

/* Combo carie + restauration = tinted */
.sc-odonto .tooth.has-caries.has-restore .tooth-fill { fill: url(#caries-restore-gradient); opacity: 0.5; }

/* Décision (contour coloré) */
.sc-odonto .tooth.dec-treat path:not(.tooth-fill) { stroke: #3B82F6; stroke-width: 2.5; }
.sc-odonto .tooth.dec-extract path:not(.tooth-fill) { stroke: #DC2626; stroke-width: 2.5; stroke-dasharray: 4,2; }
.sc-odonto .tooth.dec-watch path:not(.tooth-fill) { stroke: #F59E0B; stroke-width: 2.5; }

/* Click hint en mode display */
.sc-odonto[data-mode="display"] .tooth { cursor: pointer; }
.sc-odonto[data-mode="display"] .tooth:hover .tooth-fill { opacity: 0.55; }

/* ══════════════════════════════════════════════════════════════
 * Odontogram chart (Premium-style) — PNG base + SVG overlay
 * ══════════════════════════════════════════════════════════════ */
.od-arch-wrap {
    display: grid;
    grid-template-columns: repeat(16, auto);
    gap: 0;
    position: relative;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    --od-h-buccal: 120px;
}
.od-arch-wrap .od-midline {
    grid-template-columns: subgrid;
}
/* Mode compact (dans la carte du tab soins) */
.od-schema-compact .od-arch-wrap { --od-h-buccal: 70px; }
.od-schema-compact .od-midline { padding: 2px 0; font-size: 0.6rem; }
/* Hub v2 — card odontogramme : hauteur intermédiaire (lisible mais compact) */
#card-odontogramme .od-arch-wrap { --od-h-buccal: 90px; }
/* Séparation occlusale : invisible — la vraie gencive est rendue par PanoramicOverlay SVG */
#card-odontogramme .od-occlusal-sep {
    height: 4px;
    background: transparent;
    margin: 0;
}
#card-odontogramme .od-row { line-height: 0; }
/* Offcanvas constats : identique au customizer mais sans padding haut */
#odonto-findings-offcanvas .offcanvas-header { padding-top: 0; padding-bottom: 0.5rem; }
#odonto-findings-offcanvas .offcanvas-body { padding-top: 0.5rem; }
#odonto-findings-offcanvas .odp-selected-header { margin-top: 0; }
#card-odontogramme #odonto-chart-wrap { padding: 0 !important; }
.od-row { display: contents; }
.od-row-buccal-up > .od-cell { align-items: flex-end; }
.od-row-buccal-lo > .od-cell { align-items: flex-start; }
/* Visibilité des rangées selon le mode de dentition (display:contents → none) */
.od-schema[data-dentition-mode="primary"] .od-row-buccal-up,
.od-schema[data-dentition-mode="primary"] .od-row-buccal-lo,
.od-schema[data-dentition-mode="permanent"] .od-row-decid-up,
.od-schema[data-dentition-mode="permanent"] .od-row-decid-lo {
    display: none !important;
}
.od-schema[data-dentition-mode="primary"] .od-row-buccal-up > .od-cell,
.od-schema[data-dentition-mode="primary"] .od-row-buccal-lo > .od-cell,
.od-schema[data-dentition-mode="permanent"] .od-row-decid-up > .od-cell,
.od-schema[data-dentition-mode="permanent"] .od-row-decid-lo > .od-cell {
    display: none !important;
}
.od-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    height: var(--od-h-buccal);
    overflow: hidden;
}
.od-cell:hover { background: rgba(var(--bs-primary-rgb), 0.08); }
.od-cell-active { background: rgba(var(--bs-primary-rgb), 0.14); box-shadow: inset 0 -2px 0 var(--bs-primary); }
.od-cell-empty { cursor: default; opacity: 0.15; pointer-events: none; }
.od-buccal-img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.od-svg-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.od-svg-overlay svg {
    width: 100%;
    height: 100%;
    display: block;
}
/* Midline : rangée des numéros entre les 2 arcades */
.od-midline {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    padding: 6px 0;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-light);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bs-secondary);
}
.od-midline-num {
    text-align: center;
    border-right: 1px solid var(--bs-border-color-subtle);
}
.od-midline-num:last-child { border-right: none; }
/* Décision — outline dashed coloré + tint léger (style cohérent avec sélection) */
.od-cell[class*="dec-"] { border-radius: 2px; }
.od-cell.dec-treat   { outline: 2px dashed #3B82F6; outline-offset: -1px; background: rgba(59,130,246,0.10); }
.od-cell.dec-extract { outline: 2px dashed #DC2626; outline-offset: -1px; background: rgba(220,38,38,0.10); }
.od-cell.dec-watch   { outline: 2px dashed #F59E0B; outline-offset: -1px; background: rgba(245,158,11,0.10); }
.od-cell.dec-refer   { outline: 2px dashed #8B5CF6; outline-offset: -1px; background: rgba(139,92,246,0.10); }
.od-cell.dec-review  { outline: 2px dashed #6B7280; outline-offset: -1px; background: rgba(107,114,128,0.10); }

/* ══════════════════════════════════════════════════════════════
 * Overlays : panoramic (bridges/mobility/splints) + drawing (% coords)
 * ══════════════════════════════════════════════════════════════ */
.od-arch-wrap { position: relative; }
.od-panoramic-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}
.od-drawing-overlay {
    position: absolute;
    /* left/top/width/height posés dynamiquement en JS pour coller à chaque rangée */
    pointer-events: none;  /* désactivé par défaut */
    z-index: 5;
    touch-action: none;
    overflow: hidden;  /* strokes clippés aux bounds de l'overlay */
}
.od-drawing-overlay.active {
    pointer-events: auto;  /* activé en mode drawing */
    cursor: crosshair;
    background: rgba(59,130,246,0.03);  /* légère teinte pour montrer la zone active */
    outline: 1px dashed rgba(59,130,246,0.3);
}

/* Toolbar drawing — flottante en bas du chart */
.od-drawing-toolbar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-size: 0.75rem;
    backdrop-filter: blur(6px);
}
.od-drawing-toolbar .od-tool-panel {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}
.od-drawing-toolbar.active .od-tool-panel { display: flex; }
.od-drawing-toolbar [data-tool-toggle] { padding: 4px 8px; }
.od-drawing-toolbar.active [data-tool-toggle] {
    background: var(--bs-primary);
    color: #fff;
    border-radius: 4px;
}
.od-tool-btn {
    background: transparent;
    border: none;
    padding: 4px 6px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--bs-body-color);
    border-radius: 4px;
}
.od-tool-btn:hover { background: rgba(0,0,0,0.05); }
.od-tool-btn.active { background: var(--bs-primary); color: #fff; }
.od-tool-sep { width: 1px; height: 16px; background: var(--bs-border-color); margin: 0 2px; }
.od-color {
    width: 18px; height: 18px;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
}
.od-color.active { border-color: var(--bs-primary); transform: scale(1.15); }
.od-width {
    width: 22px; height: 22px;
    background: transparent;
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.od-width.active { border-color: var(--bs-primary); background: rgba(13,110,253,0.1); }

/* Panoramic overlay text (mobility) */
.od-panoramic-overlay text { user-select: none; }

/* ══════════════════════════════════════════════════════════════
 * Mode fullscreen drawing — chart en plein écran avec backdrop
 * ══════════════════════════════════════════════════════════════ */
.od-schema.od-drawing-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, 0.85);
    padding: 40px 20px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.od-schema.od-drawing-fullscreen .od-arch-wrap {
    width: auto;
    max-width: 98vw;
    max-height: 92vh;
    margin: 0 auto;
    /* !important pour battre la spécificité de #card-odontogramme .od-arch-wrap */
    --od-h-buccal: 45vh !important;  /* 2 rangées : 90vh total */
}
/* Mixte : 4 rangées visibles → 22vh × 4 = 88vh */
.od-schema.od-drawing-fullscreen[data-dentition-mode="mixed"] .od-arch-wrap {
    --od-h-buccal: 22vh !important;
}
/* Réduit le padding outer en fullscreen pour libérer plus d'espace vertical */
.od-schema.od-drawing-fullscreen {
    padding: 10px 10px 70px;
}
.od-schema.od-drawing-fullscreen .od-drawing-toolbar {
    position: fixed;
    bottom: 20px;
    z-index: 1061;
    background: rgba(255,255,255,1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
/* Bouton "Fermer fullscreen" en haut à droite */
.od-fullscreen-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1062;
    background: rgba(255,255,255,0.95);
    color: #000;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    justify-content: center;
}
.od-schema.od-drawing-fullscreen ~ .od-fullscreen-close,
.od-schema.od-drawing-fullscreen .od-fullscreen-close { display: inline-flex; }
.od-schema.od-drawing-fullscreen .od-fullscreen-close {
    position: fixed; top: 16px; right: 16px;
}

/* Cellule sélectionnée — check vert au centre de la dent (n'interfère pas avec décision) */
.od-cell.od-cell-selected {
    position: relative;
}
.od-cell.od-cell-selected::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 18px; height: 18px;
    background: var(--bs-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.20);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 7'/></svg>");
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* ─── Pédiatrie : modes de dentition ─────────────────────────────────── */

/* Rangées lait : 10 dents (5 par hémi-arcade) positionnées dans le grid 16-cols
   du parent .od-arch-wrap. Les codes lait correspondent aux positions perm 1-5
   donc on les place sur les colonnes grid 4 à 13. */
.od-row-decid-up,
.od-row-decid-lo {
    display: contents;
}
.od-row-decid-up > .od-cell:nth-child(1),
.od-row-decid-lo > .od-cell:nth-child(1) {
    grid-column-start: 4;
}

/* Force chaque rangée perm à commencer à la colonne 1 → garantit qu'elle
   occupe sa propre ligne du grid, même si la rangée lait précédente laisse
   des colonnes 14-16 vides (sinon le grid auto-flow remplirait ces trous). */
.od-row-buccal-up > .od-cell:nth-child(1),
.od-row-buccal-lo > .od-cell:nth-child(1) {
    grid-column-start: 1;
}

/* Séparation occlusale : ligne mince entre les 2 arcades, sans numéros */
.od-occlusal-sep {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--bs-border-color);
    margin: 6px 0;
}

/* Hint retard d'éruption — petit ! orange en coin */
.od-cell.od-cell-eruption-delayed::before {
    content: "!";
    position: absolute;
    top: 2px; left: 2px;
    background: #f97316;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    width: 12px; height: 12px;
    text-align: center;
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}

/* ══════════════════════════════════════════════════════════════
 * Odontogram — UI chips (Premium-inspired)
 * ══════════════════════════════════════════════════════════════ */
.odp-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bs-border-color-subtle);
}
.odp-section:last-child { border-bottom: none; margin-bottom: 0; }
.odp-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.odp-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.odp-chip {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid var(--bs-border-color);
    border-radius: 4px;
    background: #fff;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
    line-height: 1.2;
}
.odp-chip:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.06);
}
.odp-chip.active {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}
/* Décision : bordure + texte colorés au repos, fond plein quand active */
.odp-chip--danger { border-color: #EF4444; color: #EF4444; }
.odp-chip--danger:hover { border-color: #EF4444; color: #EF4444; background: rgba(239,68,68,0.06); }
.odp-chip--danger.active { background: #EF4444; border-color: #EF4444; color: #fff; }
.odp-chip--warning { border-color: #F59E0B; color: #B45309; }
.odp-chip--warning:hover { border-color: #F59E0B; color: #B45309; background: rgba(245,158,11,0.08); }
.odp-chip--warning.active { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.odp-chip--success { border-color: #10B981; color: #065F46; }
.odp-chip--success:hover { border-color: #10B981; color: #065F46; background: rgba(16,185,129,0.08); }
.odp-chip--success.active { background: #10B981; border-color: #10B981; color: #fff; }
.odp-chip--purple { border-color: #8B5CF6; color: #6D28D9; }
.odp-chip--purple:hover { border-color: #8B5CF6; color: #6D28D9; background: rgba(139,92,246,0.08); }
.odp-chip--purple.active { background: #8B5CF6; border-color: #8B5CF6; color: #fff; }
.odp-chip--info { border-color: #3B82F6; color: #1D4ED8; }
.odp-chip--info:hover { border-color: #3B82F6; color: #1D4ED8; background: rgba(59,130,246,0.08); }
.odp-chip--info.active { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.odp-chip--neutral { border-color: #6B7280; color: #4B5563; }
.odp-chip--neutral:hover { border-color: #6B7280; color: #4B5563; background: rgba(107,114,128,0.08); }
.odp-chip--neutral.active { background: #6B7280; border-color: #6B7280; color: #fff; }

/* Hiérarchie principale : gros boutons État / Pathologie / Traitement / Tests */
.odp-main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}
.odp-main-grid.odp-main-grid-4 { grid-template-columns: repeat(4, 1fr); }
/* Bouton Tests désactivé quand >1 dent */
.odp-main-btn:disabled,
.odp-main-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: auto;
}
/* Liste constats existants : 1 row par dent, findings inline, design sobre */
.odp-existing-tooth-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.78rem;
    color: #1F2937;
}
.odp-existing-tooth-row:last-child { border-bottom: none; }
.odp-existing-tooth-num {
    flex: 0 0 auto; font-weight: 700;
    background: #F3F4F6; color: #1F2937;
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.72rem; line-height: 1.4;
    min-width: 30px; text-align: center;
}
.odp-existing-tooth-items {
    flex: 1; min-width: 0;
    display: flex; flex-wrap: wrap; align-items: center;
    column-gap: 14px; row-gap: 4px;
    line-height: 1.5;
}
.odp-finding-item {
    display: inline-flex; align-items: center; gap: 4px;
    color: #1F2937;  /* override class inheritance */
}
.odp-finding-item.is-pending .odp-finding-label { font-style: italic; color: #b45309; }
.odp-finding-item .odp-finding-label { color: #1F2937; }
.odp-finding-item.is-pending .odp-finding-label { color: #b45309; }
.odp-pending-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: #F59E0B;
}

/* Liste constats existants : row compact (single-line, ~22px) */
.odp-existing-row {
    display: flex; align-items: center; gap: 5px;
    padding: 2px 4px; font-size: 0.72rem;
    line-height: 1.3;
    transition: background 0.12s;
}
.odp-existing-row:hover { background: #f9fafb; }
.odp-existing-row.is-pending { background: #fffbeb; }
.odp-existing-row.is-pending .odp-existing-label { font-style: italic; color: #b45309; }
.odp-existing-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #d1d5db; flex-shrink: 0;
}
.odp-existing-row.odp-cat-chip--caries .odp-existing-dot { background: #EF4444; }
.odp-existing-row.odp-cat-chip--endo .odp-existing-dot { background: #DC2626; }
.odp-existing-row.odp-cat-chip--fracture .odp-existing-dot { background: #F97316; }
.odp-existing-row.odp-cat-chip--restore .odp-existing-dot { background: #3B82F6; }
.odp-existing-row.odp-cat-chip--prosthetic .odp-existing-dot { background: #8B5CF6; }
.odp-existing-row.odp-cat-chip--perio .odp-existing-dot { background: #10B981; }
.odp-existing-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.odp-faces-pill {
    display: inline-block; padding: 0 4px; margin-left: 3px;
    background: #e5e7eb; color: #374151; border-radius: 3px;
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em;
}
.odp-sev-pill {
    display: inline-block; padding: 0 4px; margin-left: 2px;
    background: #fee2e2; color: #b91c1c; border-radius: 3px;
    font-size: 0.6rem; font-weight: 600;
}

/* Sticky save bar : footer de l'offcanvas constats */
.odp-save-bar {
    position: sticky; bottom: 0;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
    z-index: 10;
}
.odp-save-bar.saving #odp-save-btn {
    opacity: 0.6;
    pointer-events: none;
}
.odp-save-pulse {
    width: 8px; height: 8px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.8);
    animation: odp-pulse 1.5s infinite;
}
@keyframes odp-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.8); }
    70% { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.odp-save-count-pill {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Hint quand Tests désactivé (multi-dents) */
.odp-tests-hint {
    padding: 8px 12px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.72rem;
    border-radius: 4px;
    margin-bottom: 8px;
    border-left: 3px solid #f59e0b;
}

/* Tests cliniques : ligne label + chips alignés */
.odp-test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.odp-test-label {
    flex: 0 0 60px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.odp-test-chip {
    min-width: 32px;
    text-align: center;
}
.odp-main-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 0.4rem;
    border: 2px solid var(--main-c, #6B7280);
    border-radius: 8px;
    background: #fff;
    color: var(--main-c, #374151);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s;
}
.odp-main-btn:hover { filter: brightness(0.96); }
.odp-main-btn.active { background: var(--main-c, #374151); color: #fff; }
.odp-main-sublist { margin-top: 4px; }

/* Catégories hiérarchiques : 3 gros boutons par section, sublist révélée au click */
.odp-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.odp-cat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.4rem;
    border: 2px solid var(--cat-c, #6B7280);
    border-radius: 6px;
    background: #fff;
    color: var(--cat-c, #374151);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s;
}
.odp-cat-btn:hover { filter: brightness(0.96); }
.odp-cat-btn.active { background: var(--cat-c, #374151); color: #fff; }
.odp-cat-count { font-weight: 700; opacity: 0.85; }
.odp-cat-sublist { margin-top: 4px; padding-top: 4px; }

/* Chip category buttons (Pathologies/Traitements) — plus costauds */
.odp-cat-chip {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.12s;
    position: relative;
}
.odp-cat-chip:hover { filter: brightness(0.97); }
.odp-cat-chip.active {
    color: #fff;
}
.odp-cat-chip--caries { border-color: #EF4444; color: #EF4444; }
.odp-cat-chip--caries.active { background: #EF4444; }
.odp-cat-chip--endo { border-color: #DC2626; color: #DC2626; }
.odp-cat-chip--endo.active { background: #DC2626; }
.odp-cat-chip--fracture { border-color: #F97316; color: #F97316; }
.odp-cat-chip--fracture.active { background: #F97316; }
.odp-cat-chip--restore { border-color: #3B82F6; color: #3B82F6; }
.odp-cat-chip--restore.active { background: #3B82F6; }
.odp-cat-chip--prosthetic { border-color: #8B5CF6; color: #8B5CF6; }
.odp-cat-chip--prosthetic.active { background: #8B5CF6; }
.odp-cat-chip--perio { border-color: #F59E0B; color: #F59E0B; }
.odp-cat-chip--perio.active { background: #F59E0B; }

/* Form expansé sous le chip category */
.odp-finding-form {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.02);
    border-left: 3px solid var(--chip-color, var(--bs-primary));
}
.odp-finding-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.odp-finding-form-row:last-child { margin-bottom: 0; }
.odp-finding-form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bs-secondary);
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.odp-save-btn {
    margin-top: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: var(--chip-color, var(--bs-primary));
    color: #fff;
    cursor: pointer;
    width: 100%;
}
.odp-save-btn:hover { filter: brightness(1.08); }

/* Selected teeth header */
.odp-selected-header {
    padding: 8px 10px;
    background: rgba(var(--bs-primary-rgb), 0.08);
    border-radius: 4px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.odp-selected-count { font-size: 0.85rem; font-weight: 700; color: var(--bs-primary); }
.odp-selected-teeth { font-size: 0.75rem; color: var(--bs-secondary); }


/* Post-it list */
.sc-odonto-postits { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0; }
.sc-postit {
    display: inline-flex; flex-direction: column; gap: 2px;
    padding: 4px 8px; border-radius: 4px; font-size: 0.75rem;
    border-left: 3px solid; max-width: 200px;
}
.sc-postit-teeth { font-weight: 600; font-size: 0.7rem; }
.sc-postit-content { color: #495057; }
.sc-postit.c-yellow { background: rgba(245,158,11,.12); border-color: #f59e0b; }
.sc-postit.c-yellow .sc-postit-teeth { color: #f59e0b; }
.sc-postit.c-blue { background: rgba(59,130,246,.12); border-color: #3b82f6; }
.sc-postit.c-blue .sc-postit-teeth { color: #3b82f6; }
.sc-postit.c-green { background: rgba(16,185,129,.12); border-color: #10b981; }
.sc-postit.c-green .sc-postit-teeth { color: #10b981; }
.sc-postit.c-pink { background: rgba(236,72,153,.12); border-color: #ec4899; }
.sc-postit.c-pink .sc-postit-teeth { color: #ec4899; }
.sc-postit.c-orange { background: rgba(249,115,22,.12); border-color: #f97316; }
.sc-postit.c-orange .sc-postit-teeth { color: #f97316; }


/* ══════════════════════════════════════════════════════════════
 * Patient Sidebar Card — composition propre
 * ══════════════════════════════════════════════════════════════ */
.patient-sidebar-card .card-body { font-size: 0.78rem; }

.ps-edit-btn {
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 8px;
}

/* Section group (Dossier / Coordonnées / Identité / Administratif) */
.ps-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--bs-border-color-subtle);
}
.ps-section:last-child { border-bottom: none; }

.ps-section-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-primary);
    margin-bottom: 6px;
}
.ps-section-header svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Sous-sections (Allergies, Médicaments, Pathologies, Habitudes) */
.ps-subsection {
    margin-bottom: 6px;
}
.ps-subsection:last-child { margin-bottom: 0; }
.ps-subsection-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary);
    margin-bottom: 2px;
    opacity: 0.75;
}

/* Items — par défaut neutres */
.ps-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--bs-body-color);
    margin-bottom: 2px;
}
.ps-item-empty {
    font-size: 0.72rem;
    color: var(--bs-secondary);
    opacity: 0.6;
    font-style: italic;
    padding: 2px 6px;
}

/* Item à risque — hachure rouge diagonale */
.ps-item-risky {
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0,
        transparent 4px,
        rgba(220, 53, 69, 0.16) 4px,
        rgba(220, 53, 69, 0.16) 8px
    );
    background-color: rgba(220, 53, 69, 0.04);
    border-left: 3px solid #dc3545;
    color: #842029;
    font-weight: 500;
    padding-left: 6px;
}

/* Petit dot rouge pour signaler le risque */
.ps-risk-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
    flex-shrink: 0;
}

/* Coordonnées : icon + texte aligné */
.ps-coord {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 0.78rem;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.ps-coord-icon {
    flex-shrink: 0;
    color: var(--bs-secondary);
    opacity: 0.6;
}
.ps-coord > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Habitudes : badges compacts */
.ps-habit-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    font-weight: 500;
}

/* Notes section */
.ps-section-notes .ps-notes-text {
    font-size: 0.75rem;
    margin: 0;
    color: var(--bs-body-color);
    background: var(--bs-light);
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 2px solid var(--bs-border-color);
}

/* ════════════════════════════════════════════════════════════════
   Cards Patient (layout v2)
   On utilise Bootstrap au max. Ici uniquement ce qui n'existe pas
   nativement : l'avatar circulaire dimensionné.
   ════════════════════════════════════════════════════════════════ */

.sc-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1;
}

/* Visit modal — section labels (uppercase, small, muted) */
.sc-vm-section-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.64rem;
    letter-spacing: 0.07em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}
.sc-vm-section-label svg { flex-shrink: 0; }

/* Card Devis — badges status compacts */
#card-devis .devis-status,
.devis-status-draft, .devis-status-proposed, .devis-status-accepted,
.devis-status-declined, .devis-status-expired {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 8px; border-radius: 10px;
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    flex-shrink: 0;
}
.devis-status-draft     { background: #F3F4F6; color: #4B5563; }
.devis-status-proposed  { background: #DBEAFE; color: #1E40AF; }
.devis-status-accepted  { background: #D1FAE5; color: #065F46; }
.devis-status-declined  { background: #FEE2E2; color: #991B1B; }
.devis-status-expired   { background: #FEF3C7; color: #92400E; }
#card-devis .devis-row:hover { background: #f9fafb; }

/* Devis modal — option columns + alt lines */
.quote-line-alt { background: #FFFBEB; border-left: 3px solid #F59E0B; padding-left: 4px !important; }
.quote-option-col .card { background: #fff; }

