:root {
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --primary-dark: #3730a3;
    --secondary: #64748b;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary-light: #312e81;
    --primary: #818cf8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header { padding: 30px 24px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 28px; background: var(--primary-light); width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.logo-text { font-size: 1.4rem; font-weight: 700; color: var(--primary); letter-spacing: -0.02em; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after { content: ""; position: absolute; width: 16px; height: 16px; top: 50%; left: 50%; margin: -8px 0 0 -8px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-nav { flex: 1; padding: 0 16px; overflow-y: auto; }
.nav-group { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin: 24px 0 8px 12px; letter-spacing: 0.05em; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--secondary); border-radius: var(--radius); transition: all 0.2s; font-weight: 500; margin-bottom: 4px; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3); }
.nav-item.hidden { display: none; }
.badge-nav { background: var(--danger); color: white; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 50px; margin-left: auto; border: 2px solid var(--card-bg); box-shadow: var(--shadow-sm); }
.nav-item.active .badge-nav { border-color: var(--primary); }
 .badge-nav.hidden { display: none; }

.sidebar-footer { padding: 24px; border-top: 1px solid var(--border); }
.user-block { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.user-avatar { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-meta { display: flex; flex-direction: column; }
.user-name { font-size: 0.9rem; font-weight: 600; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-header { height: 80px; background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 0 40px; display: flex; align-items: center; justify-content: space-between; }
#current-view-title { font-size: 1.6rem; font-weight: 700; }
.view-container { padding: 30px 40px; overflow-y: auto; flex: 1; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--card-bg); width: 95%; max-width: 650px; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1); max-height: 95vh; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.modal.modal-lg { max-width: 1100px; }
.hidden { display: none !important; }

/* Dashboard Cards */
.card { background: var(--card-bg); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { padding: 20px; background: var(--card-bg); border-radius: 16px; border: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-value { font-size: 1.5rem; font-weight: 700; }

/* Forms & Buttons */
.btn { padding: 10px 20px; border-radius: 10px; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); font-size: 0.95rem; }
.form-control:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-light); }

/* --- Onglets Dossier Patient --- */
.tabs-container { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.tab-item { padding: 12px 20px; cursor: pointer; border-radius: 10px 10px 0 0; color: var(--text-muted); font-weight: 600; transition: all 0.2s; position: relative; border-bottom: 2px solid transparent; }
.tab-item:hover { background: var(--primary-light); color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Dossier Hero Section */
.patient-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: 20px; padding: 30px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; position: relative; overflow: hidden; }
.patient-hero::after { content: '🏥'; position: absolute; right: -20px; bottom: -20px; font-size: 15rem; opacity: 0.1; pointer-events: none; }
.patient-info-main h1 { font-size: 2.2rem; margin: 0; }
.patient-badges { display: flex; gap: 10px; margin-top: 10px; }
.badge-light { background: rgba(255,255,255,0.2); backdrop-filter: blur(5px); padding: 5px 12px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; }

.badge { padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 0.7rem; text-transform: uppercase; }
.p-green { background: #d1fae5; color: #10b981; }
.p-red { background: #fee2e2; color: #ef4444; }
.p-orange { background: #ffedd5; color: #f97316; }

/* --- CARNET DE SANTÉ & IMPRESSION --- */
@media print {
    body { overflow: visible !important; height: auto !important; width: 100% !important; background: white !important; }
    .sidebar, .top-header, .no-print, .btn, #dark-mode-toggle, .modal-header, .close-modal { display: none !important; }
    .main-content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
    .view-container { padding: 0 !important; overflow: visible !important; }
    .modal-overlay { position: static !important; background: none !important; backdrop-filter: none !important; display: block !important; padding: 0 !important; }
    .modal { 
        position: static !important; 
        width: 100% !important; 
        max-width: none !important; 
        box-shadow: none !important; 
        border: none !important; 
        padding: 0 !important; 
        margin: 0 !important; 
        max-height: none !important; 
        display: block !important;
    }
    .modal-body { padding: 0 !important; overflow: visible !important; }
    
    #carnet-sante-view { width: 100% !important; }
    .card { border: 1px solid #eee !important; box-shadow: none !important; break-inside: avoid; }
    table { break-inside: auto; }
    tr { break-inside: avoid; break-after: auto; }
}

#carnet-sante-view tr:nth-child(even) { background-color: #f8fafc; }
#carnet-sante-view table th { border-bottom: 2px solid var(--primary); }

/* --- MODE SUPERVISEUR (READ-ONLY) --- */
.is-superviseur .btn-primary,
.is-superviseur .btn-success,
.is-superviseur .btn-add-act-folder,
.is-superviseur button[type="submit"],
.is-superviseur .btn-editer-facture,
.is-superviseur .btn-take-vitals,
.is-superviseur .btn-view-folder + button,
.is-superviseur .logout-btn + div,
.is-superviseur #form-admin-settings button,
.is-superviseur #form-admin-design button,
.is-superviseur .btn-primary:not(.btn-view-folder):not(.btn-carnet):not(.btn-view-fiche),
.is-superviseur [onclick*="supprimer"],
.is-superviseur [onclick*="editer"],
.is-superviseur [onclick*="modifier"] {
    display: none !important;
}

.is-superviseur select, 
.is-superviseur input:not([type="checkbox"]):not([type="radio"]):not([type="search"]),
.is-superviseur textarea {
    pointer-events: none;
    background-color: #f1f5f9 !important;
    opacity: 0.7;
}

.is-superviseur .sidebar-footer::before {
    content: "👁️ MODE SUPERVISION";
    display: block;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

/* --- ADMIN CUSTOM TOGGLE --- */
.custom-toggle {
    display: inline-block;
    position: relative;
    width: 44px;
    height: 22px;
}

.custom-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-toggle label {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.custom-toggle label:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.custom-toggle input:checked + label {
    background-color: var(--success);
}

.custom-toggle input:checked + label:before {
    transform: translateX(22px);
}

/* --- BADGES & TAGS --- */
.badge-light {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
/* Login Screen */
#login-root {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    background: #f8fafc;
    display: flex;
    align-items: center; justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s;
}

#login-root.hidden {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    z-index: -1000 !important;
}

.login-wrapper {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute; width: 100%; height: 100%;
    overflow: hidden; z-index: 0;
}

.shape {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.4;
    animation: pulse 10s infinite alternate;
}

.shape-1 { width: 500px; height: 500px; background: #818cf8; top: -100px; left: -100px; }
.shape-2 { width: 600px; height: 600px; background: #c084fc; bottom: -150px; right: -150px; animation-delay: -2s; }

.login-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%; max-width: 440px;
    padding: 50px;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    text-align: center;
}

.login-header h1 { font-size: 2.2rem; font-weight: 800; color: #1e1b4b; margin: 15px 0 5px; letter-spacing: -0.02em; }
.login-logo { font-size: 3.5rem; }

.login-form { margin-top: 35px; text-align: left; }
.input-with-icon { position: relative; }
.input-icon { position: absolute; left: 16px; top: 18px; font-size: 1.1rem; }
.login-form .form-control { padding-left: 50px; height: 56px; border-radius: 16px; background: white; border: 1.5px solid #e2e8f0; font-size: 1rem; }
.login-form .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }

.login-btn {
    width: 100%; height: 56px; margin-top: 25px;
    border-radius: 16px; font-weight: 700; font-size: 1.05rem;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4); }
.btn-arrow { transition: transform 0.2s; }
.login-btn:hover .btn-arrow { transform: translateX(4px); }

.login-error {
    margin-top: 20px; padding: 12px;
    background: #fef2f2; color: #b91c1c;
    border-radius: 12px; font-size: 0.9rem; font-weight: 500;
    border-left: 4px solid #ef4444;
}

.login-error.hidden { display: none !important; }

.login-footer { margin-top: 40px; font-size: 0.8rem; color: #94a3b8; }

[data-theme="dark"] .login-card { background: rgba(15, 23, 42, 0.8); border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .login-header h1 { color: white; }
[data-theme="dark"] .login-form .form-control { background: #0f172a; border-color: #334155; color: white; }
[data-theme="dark"] #login-root { background: #020617; }

@keyframes modalPop { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.animate-up { animation: modalPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Logout Button */
.logout-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #fef2f2;
    color: #e11d48;
    border: 1.5px solid #fecaca;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logout-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #be123c;
    box-shadow: 0 4px 6px -1px rgba(225, 29, 72, 0.1);
}

.logout-btn::before {
    content: "🚪";
    font-size: 1.1rem;
}
/* --- DENTAL MODULE & ODONTOGRAM --- */
.odontogram-wrapper {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tooth {
    transition: all 0.2s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.05));
    transform-origin: center;
    cursor: pointer;
    pointer-events: all;
}

.tooth:hover {
    filter: brightness(0.9) drop-shadow(0 4px 8px rgba(79, 70, 229, 0.15));
}

.tooth text {
    user-select: none;
    pointer-events: none;
}

.tooth-status-Sain { fill: #ffffff; stroke: #cbd5e1; }
.tooth-status-Carie { fill: #fee2e2; stroke: #ef4444; }
.tooth-status-Obturé { fill: #dbeafe; stroke: #3b82f6; }
.tooth-status-Absent { fill: #f1f5f9; stroke: #64748b; }
.tooth-status-Couronne { fill: #fef9c3; stroke: #eab308; }
.tooth-status-Extraction { fill: #ffedd5; stroke: #f97316; }

.dental-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
    background: var(--bg-main);
    padding: 20px;
    border-radius: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.dental-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Pulse animation for active selection */
@keyframes pulse-tooth {
    0% { filter: drop-shadow(0 0 0px var(--primary)); }
    100% { filter: drop-shadow(0 0 10px var(--primary)); }
}

.tooth-active {
    animation: pulse-tooth 1s infinite alternate;
}

/* --- HAMBURGER MENU & SIDEBAR OVERLAY --- */
.menu-toggle {
    display: none;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 15px;
}
.menu-toggle:hover { background: var(--primary); color: white; }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 90;
}
.sidebar-overlay.active { display: block; }


/* =============================================
   RESPONSIVE LAYER — HIS CARE
   Targets inline styles from templates.js
   without modifying any JS code.
   ============================================= */

/* ---- Tablet & below (≤1024px) ---- */
@media (max-width: 1024px) {

    /* Sidebar slide-in */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0; bottom: 0;
        width: 270px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        box-shadow: 20px 0 50px rgba(0,0,0,0.15);
    }
    .sidebar.active { left: 0; }
    .main-content { width: 100%; }
    .top-header { padding: 0 20px; }
    .view-container { padding: 20px; }
    .menu-toggle { display: flex; }
    #current-view-title { font-size: 1.3rem; }

    /* Any 2-col / 3-col inline grid → 1 col */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns: 3fr 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard 4-column stat grids → 2 col */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ---- Phone & below (≤768px) ---- */
@media (max-width: 768px) {

    body { overflow: auto; }

    /* Stats → single column */
    .stats-grid { grid-template-columns: 1fr !important; }

    /* Patient hero banner */
    .patient-hero {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px;
        padding: 20px !important;
    }
    .patient-hero::after { font-size: 7rem; }
    .patient-info-main h1 { font-size: 1.6rem !important; }
    .patient-badges { flex-wrap: wrap; }

    /* Dental grid */
    .dental-grid { grid-template-columns: 1fr !important; }

    /* Login card */
    .login-card { padding: 30px 20px; margin: 15px; max-width: 100%; }

    /* Tabs — horizontal scroll */
    .tabs-container {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        flex-wrap: nowrap !important;
    }
    .tab-item { padding: 10px 14px; font-size: 0.85rem; flex-shrink: 0; }

    /* ALL inline flex rows → column */
    [style*="display:flex"][style*="gap"],
    [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }

    /* ALL inline grids → single column */
    [style*="display:grid"],
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Tables: horizontal scroll wrapper */
    .card, .view-container { overflow-x: auto; }
    table { min-width: 560px; }

    /* Table cells — tighter padding */
    td, th { padding: 10px 8px !important; font-size: 0.82rem !important; }

    /* Forms */
    .form-control {
        height: 48px;
        font-size: 1rem !important;
    }

    /* Buttons: full-width except header actions */
    .btn {
        padding: 12px 18px !important;
        font-size: 0.95rem !important;
    }
    .header-actions .btn,
    .header-actions button { width: auto !important; margin-bottom: 0 !important; }

    /* Caisse billing panel inline styles */
    #caisse-patient-billing [style*="display:grid"],
    #caisse-patient-billing [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Modal full-height on phone */
    .modal { width: 98% !important; border-radius: 16px; }

    /* Headings inside cards */
    .card h2 { font-size: 1.2rem !important; }
    .card h3 { font-size: 1rem !important; }

    /* Inline column layouts used in caisse/billing */
    [style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Inline padding overrides for dense cards */
    [style*="padding:30px"] { padding: 16px !important; }
    [style*="padding:24px"] { padding: 14px !important; }
}

/* ---- Small phone (≤480px) ---- */
@media (max-width: 480px) {

    .top-header { height: 64px; }
    .header-actions { gap: 8px !important; }
    .date-display { display: none; }

    /* Full-screen modal */
    .modal {
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    /* Sidebar user meta — hide on very small */
    .user-block .user-meta { display: none; }

    /* Typography scale */
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.2rem !important; }
    h3 { font-size: 1rem !important; }

    /* Compact view container */
    .view-container { padding: 12px !important; }
    .card { padding: 12px !important; border-radius: 12px !important; }

    /* Logo text: hide on tiny screens */
    .logo-text { font-size: 1.1rem; }

    /* Stat cards: compact */
    .stat-card { padding: 14px !important; gap: 12px; }
    .stat-value { font-size: 1.3rem !important; }
    .stat-icon { width: 40px !important; height: 40px !important; font-size: 16px !important; }

    /* Buttons truly full-width */
    .btn { width: 100% !important; justify-content: center; margin-bottom: 8px; }
    .header-actions .btn,
    .header-actions button { width: auto !important; margin-bottom: 0 !important; }

    /* Reduce table font further */
    td, th { padding: 8px 6px !important; font-size: 0.78rem !important; }

    /* Stack inline badge rows */
    [style*="display:flex"] { flex-wrap: wrap !important; }

    /* Caisse tab nav: icon-only feel */
    #caisse-tabs-nav .tab-item { font-size: 0.78rem; padding: 8px 10px; }

    .patient-hero { padding: 14px !important; }
    .patient-info-main h1 { font-size: 1.3rem !important; }
}

/* ---- Print: keep intact ---- */
@media print {
    body { overflow: visible !important; height: auto !important; width: 100% !important; background: white !important; }
    .sidebar, .top-header, .no-print, .btn, #dark-mode-toggle,
    .modal-header, .close-modal { display: none !important; }
    .main-content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
    .view-container { padding: 0 !important; overflow: visible !important; }
    .modal-overlay { position: static !important; background: none !important; backdrop-filter: none !important; display: block !important; padding: 0 !important; }
    .modal {
        position: static !important; width: 100% !important; max-width: none !important;
        box-shadow: none !important; border: none !important; padding: 0 !important;
        margin: 0 !important; max-height: none !important; display: block !important;
        border-radius: 0 !important;
    }
    .modal-body { padding: 0 !important; overflow: visible !important; }
    #carnet-sante-view { width: 100% !important; }
    .card { border: 1px solid #eee !important; box-shadow: none !important; break-inside: avoid; }
    table { break-inside: auto; min-width: 0 !important; }
    tr { break-inside: avoid; break-after: auto; }
    [style*="display:grid"] { grid-template-columns: 1fr 1fr !important; }
}

/* --- TABS BOUTONS --- */
.btn-tab {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

