/* ==========================================================================
   Global.css - EOS Gestion DPS
   Complete professional responsive redesign
   ========================================================================== */

:root {
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --primary-dark: #152a45;
    --accent: #3182ce;
    --accent-light: #ebf4ff;
    --surface: rgba(255, 255, 255, 0.97);
    --surface-alt: rgba(245, 248, 252, 0.97);
    --surface-dark: rgba(20, 40, 68, 0.96);
    --text: #1a202c;
    --text-light: #4a5568;
    --text-muted: #718096;
    --border: #cbd5e0;
    --border-light: #e2e8f0;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #dd6b20;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes scrollText {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-image: url('images/fond.jpg');
    background-size: cover;
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    z-index: 1;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-light);
}

center {
    display: block;
    text-align: center;
}

/* ==========================================================================
   Toast Notifications (replaces alert())
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
    max-width: 450px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}

.toast:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-1px);
}

.toast.toast-exit {
    animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast-icon {
    background: rgba(56, 161, 105, 0.12);
    color: var(--success);
}

.toast-error .toast-icon {
    background: rgba(229, 62, 62, 0.12);
    color: var(--danger);
}

.toast-warning .toast-icon {
    background: rgba(221, 107, 32, 0.12);
    color: var(--warning);
}

.toast-info .toast-icon {
    background: rgba(49, 130, 206, 0.12);
    color: var(--accent);
}

.toast-body {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 16px;
    border: none;
    background: none;
    padding: 0;
}

.toast-close:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius) var(--radius);
    transition: width linear;
}

.toast-success .toast-progress { background: var(--success); }
.toast-error .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info .toast-progress { background: var(--accent); }

/* ==========================================================================
   Confirm Dialog (replaces confirm())
   ========================================================================== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.confirm-dialog {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 28px;
    max-width: 420px;
    width: 90%;
    animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-cancel {
    padding: 9px 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.confirm-cancel:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
}

.confirm-ok {
    padding: 9px 20px;
    border-radius: 6px;
    border: none;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.confirm-ok:hover {
    background: #c53030;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

#BarLogIn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-dark);
    backdrop-filter: blur(16px);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 0 28px;
    height: 48px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

#BarLogIn a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all var(--transition);
    font-size: 13px;
    font-weight: 500;
}

#BarLogIn a:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.bar-left, .bar-center, .bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bar-left { flex: 1; }
.bar-center { flex: 0 0 auto; }
.bar-right { flex: 1; justify-content: flex-end; }

.bar-user {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    font-weight: 400;
}

.bar-separator {
    width: 1px;
    height: 16px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
}

.bar-icon {
    display: flex;
    align-items: center;
    padding: 6px 8px !important;
}

.bar-icon img {
    opacity: 0.7;
    transition: opacity var(--transition);
}

.bar-icon:hover img { opacity: 1; }

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

#SideBar {
    text-align: center;
    display: inline-flex;
    align-items: stretch;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    animation: slideDown 0.4s ease;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 96%;
}

#TitreSideBar {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 0 22px;
    text-decoration: none;
    margin: 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

#bordG {
    background: var(--primary-dark);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    color: transparent;
    font-size: 0;
    width: 10px;
    display: inline-block;
    margin: 0;
}

#bordD {
    background: var(--primary-dark);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: transparent;
    font-size: 0;
    width: 10px;
    display: inline-block;
    margin: 0;
    padding: 0 !important;
}

#liens {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: wrap;
}

#liens a {
    text-decoration: none;
    display: inline-flex;
}

.btn {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    padding: 14px 20px;
    text-decoration: none;
    margin: 0;
    border: none;
    border-right: 1px solid var(--border-light);
    white-space: nowrap;
    position: relative;
    transition: all var(--transition);
}

.btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all var(--transition);
    transform: translateX(-50%);
}

.btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
}

.btn:hover::after {
    width: 80%;
}

#liens a:last-of-type .btn {
    border-right: none;
}

/* ==========================================================================
   Labels
   ========================================================================== */

.labels {
    color: var(--danger);
    background-color: #fff;
    font-family: var(--font);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    width: 60px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    white-space: nowrap;
    padding: 2px 4px;
}

/* ==========================================================================
   Content Sections (#content) - used in search panels and forms
   ========================================================================== */

#content, #content1, #content2, #content3 {
    width: 95%;
    height: auto;
    min-height: 140px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin: 10px auto;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    transition: box-shadow var(--transition);
}

#content:hover, #content1:hover, #content2:hover, #content3:hover {
    box-shadow: var(--shadow);
}

/* ==========================================================================
   Search Panel (#recherche)
   ========================================================================== */

#recherche {
    animation: slideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 12px 0;
    border: 1px solid var(--border-light);
}

#recherche > center > table,
#recherche > form > center > table,
#recherche > center > form > table,
#recherche > form > table {
    border-collapse: separate;
    border-spacing: 12px 0;
}

#recherche table > tbody > tr > th,
#recherche > center > table > tbody > tr > th,
#recherche > form > center > table > tbody > tr > th,
#recherche > center > form > table > tbody > tr > th {
    background: transparent !important;
    color: var(--text) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: normal !important;
    padding: 0 !important;
    vertical-align: top;
}

#recherche #content {
    width: 100% !important;
    height: auto !important;
    min-height: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: #fff;
    padding: 16px 20px;
    margin: 0;
    box-shadow: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

#recherche #content:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.06);
}

#recherche .titre {
    display: inline-block;
    position: static;
    float: none;
    margin: 0 0 10px 0;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-light);
    padding: 3px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#recherche table table {
    border-spacing: 0;
}

#recherche table table td {
    padding: 4px 8px 4px 0;
    font-size: 13px;
    color: var(--text-light);
    border: none !important;
    background: transparent !important;
}

#recherche input[type="text"] {
    width: 100% !important;
}

#recherche input[type="submit"],
#recherche input[type="button"] {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

#recherche input[type="submit"]:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

#recherche input[type="button"] {
    background: var(--surface);
    color: var(--text-light);
    border: 1px solid var(--border);
}

#recherche input[type="button"]:hover {
    background: var(--border-light);
}

/* ==========================================================================
   Chat Components
   ========================================================================== */

#wrapper, #loginform {
    margin: 0 auto;
    padding-bottom: 25px;
    background: var(--surface);
    width: 504px;
    max-width: 95%;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#loginform { padding-top: 18px; }
#loginform p { margin: 5px; }

#chatbox {
    text-align: left;
    margin: 0 auto 25px;
    padding: 12px;
    background: #fff;
    height: 270px;
    width: 430px;
    max-width: 95%;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: auto;
}

#usermsg {
    width: 395px;
    max-width: 80%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 13px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

#usermsg:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

#submit { width: 60px; }

.error { color: var(--danger); font-weight: 500; }

#menu {
    padding: 12px 25px;
    border-bottom: 1px solid var(--border-light);
}

.welcome { float: left; font-weight: 500; }
.logout { float: right; }

.msgln {
    margin: 0 0 4px 0;
    padding: 4px 8px;
    border-radius: 4px;
}

.msgln:hover { background: var(--surface-alt); }

/* ==========================================================================
   Section Titles
   ========================================================================== */

.titre {
    display: block;
    position: relative;
    margin: -12px 0 0 20px;
    float: left;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    background: var(--surface);
    padding: 2px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.titreimg {
    display: block;
    position: relative;
    margin: -2% 0 0 98.5%;
    float: left;
    color: var(--text);
    font-size: 18px;
    background-image: url('images/but1.png');
    cursor: pointer;
    transition: opacity var(--transition);
}

.titreimg:hover { opacity: 0.7; }

/* ==========================================================================
   Logo Area & Page Headings (titre.php)
   ========================================================================== */

/* Legacy support */
#imgFFSS img {
    width: 190px;
    position: absolute;
    margin: 15px 0 0 15px;
}

/* Modern responsive titre header */
.titre-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    gap: 16px;
    animation: fadeIn 0.4s ease;
    flex-wrap: wrap;
}

.titre-logo img {
    width: 160px;
    height: auto;
    flex-shrink: 0;
}

.titre-mission {
    flex: 1;
    text-align: center;
    font-family: var(--font);
    color: var(--primary);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.3px;
    min-width: 200px;
}

.titre-clock {
    flex-shrink: 0;
    text-align: center;
}

.titre-clock-display {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 8px 18px;
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    font-size: 22px;
    font-family: var(--font);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.titre-clock-link {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.titre-clock-link:hover {
    text-decoration: underline;
}

h2 {
    font-family: var(--font);
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.3px;
    animation: fadeIn 0.5s ease;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

#accueil {
    width: min(96%, 1600px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: var(--text);
    padding: clamp(16px, 2.5vw, 32px) clamp(16px, 3vw, 40px);
    border: 1px solid var(--border-light);
    text-decoration: none;
    text-align: left;
    margin: 0 auto 20px;
    position: relative;
    animation: slideUp 0.4s ease;
}

#TitreAccueil {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

#TxtAccueil {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.7;
}

#TxtAccueil a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

#TxtAccueil a:hover {
    color: var(--primary);
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-page {
    background-image: url('images/fond.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.4), rgba(21, 42, 69, 0.7));
    z-index: 1;
}

.login-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    padding: 48px 40px;
    animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo img {
    width: 100px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
    animation: fadeIn 0.8s ease 0.2s both;
}

.login-heading {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeIn 0.8s ease 0.3s both;
}

.login-title {
    font-family: var(--font);
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.login-subtitle {
    font-family: var(--font);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(229, 62, 62, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 62, 62, 0.4);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 24px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-error svg {
    flex-shrink: 0;
    color: #fc8181;
}

.login-form {
    animation: fadeIn 0.8s ease 0.4s both;
}

.login-field {
    margin-bottom: 24px;
}

.login-label {
    display: block;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 16px;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 2;
}

.login-input-wrap input[type="text"],
.login-input-wrap input[type="password"] {
    width: 100%;
    padding: 14px 44px 14px 48px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-family: var(--font);
    font-size: 15px;
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.login-input-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-input-wrap input[type="text"]:focus,
.login-input-wrap input[type="password"]:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1), inset 0 2px 4px rgba(0,0,0,0.1);
}

.login-input-wrap input:focus ~ .login-input-icon,
.login-input-wrap:focus-within .login-input-icon {
    color: #ffffff;
}

.login-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.login-toggle-pwd:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.login-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 32px;
    box-shadow: 0 8px 16px rgba(43, 108, 176, 0.4);
    position: relative;
    overflow: hidden;
}

.login-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.2), rgba(255,255,255,0));
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(43, 108, 176, 0.5);
    background: linear-gradient(135deg, #4299e1, #2b6cb0);
}

.login-btn:hover::after {
    transform: translateX(100%);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(43, 108, 176, 0.4);
}

.login-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.login-btn-arrow {
    transition: transform 0.3s ease;
}

.login-btn:hover .login-btn-arrow {
    transform: translateX(4px);
}

.login-btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-footer {
    margin-top: 32px;
    font-family: var(--font);
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    text-align: center;
    letter-spacing: 0.5px;
    animation: fadeIn 0.8s ease 0.5s both;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Legacy #LogIn support (used on other pages if needed) */
#LogIn {
    width: 420px;
    max-width: 92%;
    height: auto;
    min-height: 200px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    color: var(--text);
    padding: 36px;
    border: 1px solid var(--border-light);
    text-decoration: none;
    text-align: left;
    animation: scaleIn 0.35s ease;
}

#LogIn input[type="text"],
#LogIn input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 14px;
    box-sizing: border-box;
    transition: all var(--transition);
    margin-top: 4px;
    margin-bottom: 4px;
}

#LogIn input[type="text"]:focus,
#LogIn input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

#LogIn input[type="submit"] {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    margin-top: 8px;
}

#LogIn input[type="submit"]:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

#bouton {
    background: var(--surface);
    border-radius: 6px;
    font-family: var(--font);
    color: var(--primary);
    font-size: 13px;
    width: 150px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    text-decoration: none;
    text-align: left;
    font-weight: 600;
    transition: all var(--transition);
}

#boutonN {
    background: var(--surface);
    border-radius: 6px;
    font-family: var(--font);
    color: var(--primary);
    font-size: 13px;
    width: 205px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    text-decoration: none;
    text-align: left;
    font-weight: 600;
    transition: all var(--transition);
}

#bouton:hover, #boutonN:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

#boutonAjout { margin-left: 75%; margin-top: -3%; }
#boutonAjoutN { margin-left: 70%; margin-top: -3%; }

/* ==========================================================================
   Tables
   ========================================================================== */

table {
    text-align: center;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

table tr th {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--primary) !important;
    padding: 12px 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr th:first-child { border-radius: var(--radius) 0 0 0; }
table tr th:last-child { border-radius: 0 var(--radius) 0 0; }

table tr td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    transition: all var(--transition);
}

table tr:nth-child(even) td {
    background: var(--surface-alt);
}

table tr:hover td {
    background: var(--accent-light);
}

table tr td img { vertical-align: middle; }
table tr td a { text-decoration: none; }

/* Table responsive wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

/* ==========================================================================
   Save / Cancel Buttons
   ========================================================================== */

.btnEnreg {
    background: var(--success);
    border-radius: 6px;
    font-family: var(--font);
    color: #fff;
    width: auto;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    padding: 10px 24px;
    border: none;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

#boutons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 24px 0 8px;
    flex-wrap: wrap;
}

.btnEnreg:hover {
    background: #2f855a;
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btnAnnul {
    background: var(--surface);
    border-radius: 6px;
    font-family: var(--font);
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 120px;
    font-size: 14px;
    padding: 10px 24px;
    border: 1px solid var(--border);
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btnAnnul:hover {
    background: var(--surface-alt);
    color: var(--text);
    border-color: var(--text-muted);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* ==========================================================================
   Time Display
   ========================================================================== */

#heure {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    box-shadow: var(--shadow-sm);
    position: absolute;
    right: 3%;
    top: 80px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 1px;
    font-size: 22px;
    text-align: center;
    font-family: var(--font);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

#heureG {
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 24px;
    width: 90%;
    max-width: 900px;
    margin: 2% auto 0;
    box-shadow: var(--shadow);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 4px;
    font-size: clamp(60px, 18vw, 220px);
    font-family: var(--font);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

#lihorloge {
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
}

#lihorloge a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

#lihorloge a:hover { text-decoration: underline; }

/* ==========================================================================
   jQuery UI Override
   ========================================================================== */

.ui-widget-content {
    padding: 0.5em;
    margin: 10px 10px 10px 0;
}

/* ==========================================================================
   Droppable / Interactive
   ========================================================================== */

#droppable {
    width: 800px;
    max-width: 95%;
    height: 565px;
    padding: 0.5em;
    margin: 10px;
    background-color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

#imgsortie, #sortie { cursor: pointer; }

/* ==========================================================================
   Form Inputs
   ========================================================================== */

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    font-family: var(--font);
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    transition: all var(--transition);
    background: #fff;
    color: var(--text);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

input[type="submit"],
input[type="button"] {
    font-family: var(--font);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    transition: all var(--transition);
    padding: 8px 20px;
    font-size: 13px;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ==========================================================================
   Modern Form Components (AjoutPersonne, etc.)
   ========================================================================== */

.form-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    padding: clamp(18px, 2.5vw, 32px) clamp(18px, 3vw, 40px);
    margin: 0 auto 20px;
    width: min(96%, 1600px);
    text-align: left;
    animation: slideUp 0.4s ease;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.form-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.form-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface);
}

.form-actions a:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.form-actions a img {
    width: 20px;
    height: 20px;
}

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

.form-section {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 20px 24px;
    border: 1px solid var(--border-light);
}

.form-section-gap {
    margin-bottom: 16px;
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: all var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* Form group flex sizing utilities */
.fg-sexe { flex: 0 0 40%; }
.fg-age { flex: 0 0 25%; }
.fg-ref { flex: 0 0 35%; }
.fg-cp { flex: 0 0 30%; }
.fg-code { flex: 0 0 45%; }
.fg-grow { flex: 1 1 0%; }
.fg-doublon { display: flex; align-items: center; padding-bottom: 6px; }

/* Radio / checkbox inline group */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 38px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

/* Gender toggle buttons */
.gender-toggle {
    display: flex;
    gap: 8px;
}

.gender-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gender-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.gender-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
}

.gender-btn input[type="radio"] {
    display: none;
}

/* Item color buttons */
.item-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.item-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.item-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.item-btn.active {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.item-btn input[type="radio"] {
    display: none;
}

.item-btn .item-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.item-btn.item-vert { border-color: #38a169; }
.item-btn.item-vert.active { background: #f0fff4; border-color: #38a169; color: #22543d; }
.item-btn.item-vert .item-dot { background: #38a169; }

.item-btn.item-orange { border-color: #dd6b20; }
.item-btn.item-orange.active { background: #fffaf0; border-color: #dd6b20; color: #7b341e; }
.item-btn.item-orange .item-dot { background: #dd6b20; }

.item-btn.item-rouge { border-color: #e53e3e; }
.item-btn.item-rouge.active { background: #fff5f5; border-color: #e53e3e; color: #742a2a; }
.item-btn.item-rouge .item-dot { background: #e53e3e; }

.item-btn.item-rougec { border-color: #c53030; }
.item-btn.item-rougec.active { background: #fff5f5; border-color: #c53030; color: #742a2a; }
.item-btn.item-rougec .item-dot { background: #c53030; animation: pulse 1s infinite; }

.item-btn.item-noir { border-color: #1a202c; }
.item-btn.item-noir.active { background: #f7fafc; border-color: #1a202c; color: #1a202c; }
.item-btn.item-noir .item-dot { background: #1a202c; }

/* Moyen selection cards */
.moyen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.moyen-card {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.moyen-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.moyen-card.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
}

.moyen-card input[type="radio"] {
    display: none;
}

.moyen-type-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}

.moyen-type-title:first-child {
    margin-top: 0;
}

/* Form footer buttons */
.form-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: 6px;
    border: none;
    background: var(--success);
    color: #fff;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    min-width: 140px;
}

.btn-primary:hover {
    background: #2f855a;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-light);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    min-width: 140px;
}

.btn-secondary:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

/* Timeline (for person edit) */
.timeline-bar {
    display: flex;
    align-items: stretch;
    background: var(--surface-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    overflow-x: auto;
    margin: 16px 0;
    padding: 0;
}

.timeline-step {
    flex: 1;
    min-width: 100px;
    padding: 12px 16px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    border-right: 1px solid var(--border-light);
    position: relative;
}

.timeline-step:last-child { border-right: none; }

.timeline-step::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--surface-alt);
    border-top: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    transform: translateY(-50%) rotate(45deg);
    z-index: 1;
}

.timeline-step:last-child::after { display: none; }

.timeline-step .step-label {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.timeline-step .step-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.timeline-step .step-icon {
    margin-bottom: 4px;
}

/* ==========================================================================
   Marquee Replacement (CSS animation)
   ========================================================================== */

marquee {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    background: rgba(229, 62, 62, 0.08);
    border: 1px solid rgba(229, 62, 62, 0.2);
    border-radius: 6px;
    padding: 8px 0;
    color: var(--danger);
    font-weight: 600;
    font-size: 14px;
}

/* ==========================================================================
   Horloge Page
   ========================================================================== */

.horloge-stats {
    font-size: clamp(16px, 2.5vw, 30px);
    font-weight: 400;
    margin-top: 2%;
    padding: 0 5%;
    line-height: 1.8;
    color: var(--text);
}

.horloge-stats strong {
    font-weight: 700;
    color: var(--primary);
}

.horloge-table {
    width: 90%;
    max-width: 1200px;
    margin: 2% auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: clamp(12px, 1.5vw, 20px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.horloge-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
}

.horloge-table tr:first-child td {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: clamp(14px, 1.8vw, 25px);
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

::selection {
    background: rgba(49, 130, 206, 0.15);
    color: var(--text);
}

/* ==========================================================================
   Page-specific action images
   ========================================================================== */

#TxtAccueil img {
    transition: all var(--transition);
    border-radius: 4px;
}

#TxtAccueil img:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Admin Forms - Responsive Layout System
   ========================================================================== */

.admin-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.admin-form-full {
    grid-column: 1 / -1;
}

.admin-field {
    margin-bottom: 16px;
}

.admin-field label,
.admin-field .field-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text);
}

.admin-field .field-label.required {
    color: var(--danger);
}

.admin-field input[type="text"],
.admin-field input[type="password"],
.admin-field input[type="number"],
.admin-field input[type="date"],
.admin-field input[type="time"],
.admin-field select,
.admin-field textarea {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.admin-field textarea {
    max-width: 100%;
    min-height: 80px;
    resize: vertical;
}

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-checkbox input[type="checkbox"] {
    position: static;
    margin: 0;
}

/* Timeline responsive */
.timeline-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

.timeline-responsive img.fleche-img {
    width: 100%;
    min-width: 600px;
    height: auto;
}

.timeline-responsive table {
    position: relative;
    font-size: 13px;
    line-height: 1.4;
    margin-top: -70px;
    color: var(--text);
}

/* Chart containers responsive */
.chart-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.chart-box {
    flex: 1;
    min-width: 280px;
    max-width: 500px;
    height: 300px;
}

/* Force inline-styled inputs to be responsive */
#content input[type="text"],
#content input[type="password"],
#content input[type="number"],
#content select {
    max-width: 100%;
    box-sizing: border-box;
}

#content textarea {
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .admin-form {
        grid-template-columns: 1fr;
    }

    .admin-field input[type="text"],
    .admin-field input[type="password"],
    .admin-field input[type="number"],
    .admin-field input[type="date"],
    .admin-field select {
        max-width: 100%;
    }
}

/* ==========================================================================
   Responsive: Tablet (< 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    #accueil {
        width: 95%;
        padding: 20px 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-card {
        width: 95%;
        padding: 24px 20px;
    }

    .form-section {
        padding: 18px 20px;
    }

    .form-row {
        gap: 12px;
    }

    /* Relax flex sizing for tablet */
    .fg-sexe { flex: 0 0 36%; }
    .fg-age { flex: 0 0 22%; }
    .fg-ref { flex: 0 0 32%; }
    .fg-cp { flex: 0 0 28%; }
    .fg-code { flex: 0 0 40%; }

    .form-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .form-actions a {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Touch-friendly inputs */
    .form-input,
    .form-input select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .gender-btn {
        padding: 10px 14px;
    }

    .item-btn {
        padding: 8px 14px;
    }

    #boutonAjout, #boutonAjoutN {
        margin-left: auto;
        margin-top: 8px;
        display: block;
    }

    #heure {
        position: relative;
        right: auto;
        top: auto;
        display: inline-block;
        margin: 8px auto;
    }

    .titre-header {
        padding: 10px 16px;
        gap: 12px;
    }

    .titre-logo img {
        width: 120px;
    }

    .titre-mission {
        font-size: 15px;
        min-width: 160px;
    }

    .titre-clock-display {
        font-size: 18px;
        padding: 6px 14px;
    }
}

/* ==========================================================================
   Responsive: Mobile (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
    #BarLogIn {
        padding: 0 12px;
        height: 44px;
        font-size: 12px;
    }

    #BarLogIn a {
        padding: 4px 8px;
        font-size: 12px;
    }

    .bar-user { display: none; }
    .bar-separator { display: none; }
    .bar-center { display: none; }

    #SideBar {
        border-radius: var(--radius);
        max-width: 100%;
    }

    #bordG, #bordD { display: none; }

    #TitreSideBar {
        padding: 0 12px;
        font-size: 10px;
    }

    .btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    #accueil {
        width: 98%;
        padding: 16px 14px;
        border-radius: var(--radius);
    }

    #TitreAccueil {
        font-size: 17px;
    }

    .form-card {
        width: 98%;
        padding: 16px 14px;
    }

    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .form-title {
        font-size: 18px;
    }

    .form-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .form-actions a {
        justify-content: center;
        text-align: center;
    }

    .form-section {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Override all fg-* flex sizing to stack vertically */
    .form-row .fg-sexe,
    .form-row .fg-age,
    .form-row .fg-ref,
    .form-row .fg-cp,
    .form-row .fg-code,
    .form-row .fg-grow {
        flex: 1 1 100%;
        width: 100%;
    }

    .fg-doublon {
        padding-bottom: 0;
        padding-top: 4px;
    }

    .fg-famille {
        margin-top: -8px;
    }

    .fg-famille .form-label {
        display: none;
    }

    .radio-group {
        gap: 12px;
    }

    .gender-toggle {
        gap: 8px;
    }

    .gender-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .item-toggle {
        gap: 6px;
    }

    .item-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 auto;
        justify-content: center;
    }

    .moyen-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }

    .moyen-card {
        padding: 12px 10px;
        font-size: 12px;
    }

    #recherche {
        padding: 12px;
    }

    #recherche > center > table,
    #recherche > form > center > table,
    #recherche > center > form > table,
    #recherche > form > table {
        display: block;
    }

    #recherche > center > table > tbody,
    #recherche > form > center > table > tbody,
    #recherche > center > form > table > tbody,
    #recherche > form > table > tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #recherche > center > table > tbody > tr,
    #recherche > form > center > table > tbody > tr,
    #recherche > center > form > table > tbody > tr,
    #recherche > form > table > tbody > tr {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #recherche > center > table > tbody > tr > th,
    #recherche > form > center > table > tbody > tr > th,
    #recherche > center > form > table > tbody > tr > th,
    #recherche > form > table > tbody > tr > th {
        width: 100% !important;
    }

    #recherche #content {
        padding: 12px 14px;
    }

    .form-footer,
    #boutons {
        flex-direction: column;
        gap: 8px;
    }

    .btn-primary, .btn-secondary, .btnEnreg, .btnAnnul {
        width: 100%;
    }

    #LogIn {
        width: 95%;
        padding: 24px;
    }

    .login-card {
        padding: 28px 24px 24px;
        border-radius: 12px;
    }

    .login-logo img {
        width: 72px;
    }

    .login-title {
        font-size: 20px;
    }

    #wrapper, #loginform {
        width: 95%;
    }

    .confirm-dialog {
        width: 95%;
        padding: 20px;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
    }

    .toast-container {
        right: 10px;
        left: 10px;
    }

    .titre-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px 12px;
        gap: 8px;
    }

    .titre-logo img {
        width: 100px;
    }

    .titre-mission {
        font-size: 14px;
        min-width: 0;
        width: 100%;
    }

    .titre-clock {
        width: 100%;
    }

    .titre-clock-display {
        font-size: 16px;
        padding: 6px 12px;
    }
}

/* ==========================================================================
   Responsive: Small Mobile (< 480px)
   ========================================================================== */

@media (max-width: 480px) {
    #BarLogIn {
        padding: 0 8px;
    }

    .bar-left a:not(:first-child) { display: none; }

    .btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    #TitreSideBar {
        padding: 0 8px;
        font-size: 9px;
    }

    .form-card {
        width: 100%;
        padding: 12px 10px;
        border-radius: var(--radius);
    }

    .form-section {
        padding: 14px 12px;
    }

    .form-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .form-actions {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .form-actions a {
        padding: 8px 8px;
        font-size: 11px;
    }

    .form-actions a img {
        width: 16px;
        height: 16px;
    }

    .gender-toggle {
        gap: 6px;
    }

    .gender-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .item-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .item-btn {
        padding: 10px 8px;
        font-size: 12px;
        justify-content: center;
    }

    .moyen-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-footer {
        gap: 6px;
    }

    .btn-primary, .btn-secondary {
        padding: 12px 20px;
        font-size: 14px;
    }

    #heureG {
        padding: 16px;
        width: 95%;
    }

    .titre-logo img {
        width: 80px;
    }

    .titre-mission {
        font-size: 13px;
    }

    .titre-clock-display {
        font-size: 14px;
        padding: 5px 10px;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    #BarLogIn, #SideBar, #bordG, #bordD, #TitreSideBar,
    #boutons, .form-footer, .form-actions, .toast-container,
    .titre-clock-link { display: none; }

    body {
        background: #fff;
        color: #000;
    }

    #accueil, .form-card {
        box-shadow: none;
        border: 1px solid #ccc;
        width: 100%;
    }
}

/* ==========================================================================
   v2.1 - Modern additions: hamburger, drawer, stats, error pages, scroll-top
   ========================================================================== */

/* ---------- Etat actif dans la navigation ---------- */
#SideBar a.is-active .btn,
#SideBar .btn.is-active {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: inset 0 -3px 0 var(--accent);
}

#BarLogIn a.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.menu-drawer a.is-active {
    background: var(--accent-light);
    color: var(--primary);
    font-weight: 700;
    border-left: 3px solid var(--accent);
}

/* ---------- Hamburger button (cache desktop, visible mobile) ---------- */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    flex-direction: column;
    justify-content: space-around;
    align-items: stretch;
    transition: background var(--transition);
    margin-right: 4px;
}
.menu-toggle:hover { background: rgba(255,255,255,0.12); }
.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: rgba(255,255,255,0.85);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    transform-origin: center;
}
.menu-toggle.is-active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.is-active span:nth-child(2) { opacity: 0; }
.menu-toggle.is-active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Drawer mobile ---------- */
.menu-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    z-index: 10010;
    display: flex;
    flex-direction: column;
    transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
}
.menu-drawer.is-open { left: 0; }

.menu-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}
.menu-drawer-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.menu-drawer-close:hover { background: rgba(255,255,255,0.15); }

.menu-drawer-nav {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1;
}
.menu-drawer-nav a {
    display: block;
    padding: 13px 20px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    border-left: 3px solid transparent;
    transition: all var(--transition);
}
.menu-drawer-nav a:hover {
    background: var(--accent-light);
    color: var(--primary);
    border-left-color: var(--accent);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    z-index: 10005;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.menu-overlay.is-visible { opacity: 1; pointer-events: all; }

/* ---------- Stats cards (dashboard) ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 0 0 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition);
    animation: slideUp 0.4s ease backwards;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

.stat-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-card.is-success .stat-icon { background: rgba(56,161,105,0.12); color: var(--success); }
.stat-card.is-warning .stat-icon { background: rgba(221,107,32,0.12); color: var(--warning); }
.stat-card.is-danger .stat-icon { background: rgba(229,62,62,0.12); color: var(--danger); }

.stat-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* ---------- Bouton "retour en haut" ---------- */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 999;
}
.back-to-top.is-visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.back-to-top:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* ---------- Pages d'erreur (403, 404, 500) ---------- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.error-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.4s cubic-bezier(0.4,0,0.2,1);
}
.error-code {
    font-size: 88px;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -2px;
}
.error-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.error-message {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0 0 28px;
}
.error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.error-actions a {
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.error-btn-primary {
    background: var(--primary);
    color: #fff !important;
}
.error-btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.error-btn-secondary {
    background: var(--surface-alt);
    color: var(--text) !important;
    border: 1px solid var(--border);
}
.error-btn-secondary:hover { background: #fff; }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-muted);
}
.empty-state-title {
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 6px;
}
.empty-state-text { font-size: 14px; line-height: 1.5; }

/* ---------- Mobile : afficher hamburger ---------- */
@media (max-width: 900px) {
    .menu-toggle { display: flex; }
    /* On masque la sidebar horizontale sur mobile (le drawer prend le relais) */
    #SideBar { display: none !important; }
    /* Sur tablette/mobile, on cache aussi les liens dans BarLogIn (drawer suffit) */
    .bar-left a, .bar-center a {
        display: none;
    }
    .bar-right .bar-user { display: none; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card { padding: 12px 14px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; }
    .stat-icon svg { width: 18px; height: 18px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 10px; }

    .error-card { padding: 32px 24px; }
    .error-code { font-size: 72px; }

    .back-to-top {
        width: 40px;
        height: 40px;
        right: 12px;
        bottom: 12px;
    }
}

/* ==========================================================================
   v2.2 - Largeurs etendues + Tchat moderne + Animations
   ========================================================================== */

/* ---------- Containers fluides plus larges ---------- */
.titre-header { width: min(96%, 1600px); margin-left: auto; margin-right: auto; }
.stats-grid { width: min(96%, 1600px) !important; max-width: none !important; }
#SideBar { max-width: min(96%, 1600px) !important; }

/* ---------- Tchat moderne ---------- */
.tchat-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 990;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tchat-toggle:hover { background: var(--primary-light); transform: translateY(-2px) scale(1.05); }
.tchat-toggle.is-active { background: var(--accent); transform: rotate(360deg); }
.tchat-toggle.has-unread::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
    animation: pulse 1.6s ease infinite;
}
.tchat-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--danger);
    color: #fff;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    font-variant-numeric: tabular-nums;
}

/* Repositionner back-to-top pour ne pas chevaucher le tchat */
.back-to-top { right: 88px; }
@media (max-width: 600px) { .back-to-top { right: 70px; bottom: 14px; } }

.tchat-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    z-index: 991;
    border: 1px solid var(--border-light);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tchat-panel.is-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.tchat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    flex-shrink: 0;
}
.tchat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.tchat-header-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tchat-header-title { font-weight: 700; font-size: 15px; }
.tchat-header-sub { font-size: 11px; opacity: 0.85; margin-top: 2px; }
.tchat-header-sub strong { font-weight: 600; }
.tchat-close {
    background: transparent;
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.tchat-close:hover { background: rgba(255,255,255,0.18); }

.tchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface-alt);
    scrollbar-width: thin;
}
.tchat-messages::-webkit-scrollbar { width: 5px; }
.tchat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.tchat-empty {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
}
.tchat-empty p { font-weight: 600; margin: 12px 0 4px; color: var(--text-light); }
.tchat-empty small { font-size: 12px; }

.tchat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: tchatSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tchat-msg.is-self { flex-direction: row-reverse; }
.tchat-msg.is-new .tchat-bubble { animation: tchatBubblePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

.tchat-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.tchat-bubble {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.tchat-msg.is-self .tchat-bubble {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    border-bottom-right-radius: 4px;
}
.tchat-msg:not(.is-self) .tchat-bubble {
    border-bottom-left-radius: 4px;
}

.tchat-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    font-size: 11px;
    margin-bottom: 3px;
}
.tchat-author { font-weight: 700; color: var(--primary); }
.tchat-msg.is-self .tchat-author { color: rgba(255,255,255,0.95); }
.tchat-time { color: var(--text-muted); font-weight: 500; font-size: 10px; }
.tchat-msg.is-self .tchat-time { color: rgba(255,255,255,0.75); }

.tchat-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.tchat-msg.is-self .tchat-text { color: #fff; }

.tchat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.tchat-form textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 14px;
    background: var(--surface-alt);
    color: var(--text);
    resize: none;
    line-height: 1.4;
    min-height: 38px;
    max-height: 120px;
    transition: all var(--transition);
    outline: none;
}
.tchat-form textarea:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.1);
}
.tchat-send {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.tchat-send:hover { background: var(--primary); transform: scale(1.05); }
.tchat-send:active { transform: scale(0.95); }

@keyframes tchatSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes tchatBubblePop {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .tchat-toggle { right: 14px; bottom: 14px; width: 50px; height: 50px; }
    .tchat-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 80vh;
        border-radius: 16px 16px 0 0;
    }
}

/* ---------- Animations universelles : hover sur boutons et liens ---------- */
.btn, .btnEnreg, .btnAnnul, .btn-primary, .btn-secondary,
input[type="submit"], input[type="button"], button:not(.tchat-close):not(.tchat-send):not(.menu-toggle):not(.menu-drawer-close):not(.back-to-top):not(.login-toggle-pwd) {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover lift subtil sur boutons primaires */
.btn-primary:hover, .btnEnreg:hover {
    transform: translateY(-1px);
}

/* Hover sur cards */
#content, #content1, #content2, #content3, .form-section, .moyen-card, .stat-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Stagger animation sur listes dans #accueil ---------- */
#accueil tr {
    animation: rowFadeIn 0.4s ease backwards;
}
#accueil tr:nth-child(1) { animation-delay: 0.02s; }
#accueil tr:nth-child(2) { animation-delay: 0.04s; }
#accueil tr:nth-child(3) { animation-delay: 0.06s; }
#accueil tr:nth-child(4) { animation-delay: 0.08s; }
#accueil tr:nth-child(5) { animation-delay: 0.10s; }
#accueil tr:nth-child(6) { animation-delay: 0.12s; }
#accueil tr:nth-child(7) { animation-delay: 0.14s; }
#accueil tr:nth-child(8) { animation-delay: 0.16s; }
#accueil tr:nth-child(9) { animation-delay: 0.18s; }
#accueil tr:nth-child(10) { animation-delay: 0.20s; }

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

/* ---------- Smooth focus ring globaux ---------- */
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
input:focus, textarea:focus, select:focus { outline: none; }

/* ---------- Tableaux responsive : scroll horizontal mobile ---------- */
@media (max-width: 768px) {
    #accueil > table,
    #accueil > div > table,
    .form-card > table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Print : desactiver bg image ---------- */
@media print {
    .tchat-toggle, .tchat-panel, .back-to-top, .menu-toggle, .menu-overlay { display: none !important; }
}

/* ==========================================================================
   v2.3 - Command Palette, Dark Mode, Tabs modernes
   ========================================================================== */

/* ---------- Command Palette ---------- */
.cp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 11000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.cp-overlay.is-open { opacity: 1; pointer-events: all; }

.cp-modal {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
    width: 100%;
    max-width: 580px;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cp-overlay.is-open .cp-modal { transform: translateY(0) scale(1); }

.cp-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
}
.cp-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
}
.cp-search input::placeholder { color: var(--text-muted); }
.cp-kbd, .cp-footer kbd {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 600;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    color: var(--text-light);
    font-family: var(--font);
}

.cp-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 50vh;
    overflow-y: auto;
}
.cp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
}
.cp-item.is-active { background: var(--accent-light); }
.cp-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cp-item.is-active .cp-icon { background: var(--accent); color: #fff; }
.cp-icon svg { width: 16px; height: 16px; }
.cp-label { flex: 1; font-weight: 500; color: var(--text); font-size: 14px; }
.cp-hint { font-size: 12px; color: var(--text-muted); }
.cp-empty { padding: 30px 20px; text-align: center; color: var(--text-muted); font-size: 14px; list-style: none; }

.cp-footer {
    display: flex;
    gap: 18px;
    padding: 10px 18px;
    border-top: 1px solid var(--border-light);
    background: var(--surface-alt);
    font-size: 11px;
    color: var(--text-muted);
}
.cp-footer span { display: flex; align-items: center; gap: 6px; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-right: 8px;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); color: #fff; }
.theme-toggle .theme-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-moon { display: inline-block; }

/* ---------- Tabs modernes ---------- */
.tabs-modern {
    display: inline-flex;
    background: var(--surface-alt);
    padding: 4px;
    border-radius: 10px;
    gap: 2px;
    border: 1px solid var(--border-light);
    margin: 12px auto 20px;
}
.tabs-modern button {
    appearance: none;
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tabs-modern button:hover { color: var(--text); }
.tabs-modern button.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.tabs-modern button svg { width: 14px; height: 14px; }

/* ---------- Toolbar pour pages (export / actions) ---------- */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.page-toolbar .toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    font-family: var(--font);
}
.page-toolbar .toolbar-btn:hover {
    background: var(--surface-alt);
    border-color: var(--accent);
    color: var(--primary);
    transform: translateY(-1px);
}
.page-toolbar .toolbar-btn.is-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.page-toolbar .toolbar-btn.is-primary:hover {
    background: var(--primary-light);
    color: #fff;
}
.page-toolbar .toolbar-btn svg { width: 14px; height: 14px; }

/* ---------- Profile page ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .profile-grid { grid-template-columns: 1fr; }
}
.profile-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    text-align: center;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow);
}
.profile-name { font-size: 18px; font-weight: 700; color: var(--text); }
.profile-role {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 12px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* ==========================================================================
   Dark Mode (toggle via [data-theme="dark"])
   ========================================================================== */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;
    --accent: #38bdf8;
    --accent-light: rgba(56, 189, 248, 0.15);
    --surface: rgba(30, 41, 59, 0.96);
    --surface-alt: rgba(15, 23, 42, 0.96);
    --surface-dark: rgba(2, 6, 23, 0.96);
    --text: #e2e8f0;
    --text-light: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.5);
}
[data-theme="dark"] body {
    background-image: none;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
    color: var(--text);
}
[data-theme="dark"] body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('images/fond.jpg') center/cover no-repeat;
    opacity: 0.04;
    pointer-events: none;
    z-index: -1;
}
[data-theme="dark"] #BarLogIn { background: rgba(2, 6, 23, 0.96); border-bottom-color: rgba(255,255,255,0.05); }
[data-theme="dark"] #SideBar { background: var(--surface); }
[data-theme="dark"] .login-card,
[data-theme="dark"] #accueil,
[data-theme="dark"] .form-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .tchat-panel,
[data-theme="dark"] .menu-drawer,
[data-theme="dark"] .cp-modal,
[data-theme="dark"] .confirm-dialog,
[data-theme="dark"] .toast,
[data-theme="dark"] .moyen-pill,
[data-theme="dark"] .h-stat,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .error-card { background: var(--surface); border-color: var(--border-light); color: var(--text); }
[data-theme="dark"] .form-input, [data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"], [data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="email"],
[data-theme="dark"] textarea, [data-theme="dark"] select {
    background: var(--surface-alt);
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .tchat-bubble { background: var(--surface-alt); border-color: var(--border); }
[data-theme="dark"] .tchat-msg.is-self .tchat-bubble { background: var(--accent); color: #0f172a; }
[data-theme="dark"] .tchat-form textarea { background: var(--surface-alt); }
[data-theme="dark"] .tchat-messages { background: rgba(15, 23, 42, 0.6); }
[data-theme="dark"] kbd { background: #1e293b; color: var(--text-light); border-color: var(--border); }
[data-theme="dark"] .titre-clock-display, [data-theme="dark"] #date_heure { color: var(--accent); }
[data-theme="dark"] #TitreSideBar { background: var(--primary-dark); }
[data-theme="dark"] .btn { background: var(--surface-alt); color: var(--text-light); }
[data-theme="dark"] .btn:hover { background: var(--primary-dark); color: #fff; }
[data-theme="dark"] #SideBar a.is-active .btn { background: var(--accent) !important; color: #fff !important; }

/* ==========================================================================
   v2.4 - Refonte Sidebar/TopBar/Synthese - lisibilite et modernite
   ========================================================================== */

/* ---------- Sidebar horizontale modernisee ---------- */
#SideBar {
    display: inline-flex !important;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 6px;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    overflow: visible;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}
#TitreSideBar {
    display: none !important; /* on retire l'ancien titre vertical */
}
#bordG, #bordD { display: none !important; }

#SideBar #liens {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: stretch;
}
#SideBar a {
    display: flex;
    text-decoration: none;
    flex: 0 0 auto;
}
#SideBar .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    height: auto;
    line-height: 1;
    box-shadow: none !important;
    margin: 0;
}
#SideBar .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.2s;
}
#SideBar .btn:hover {
    background: var(--surface-alt);
    color: var(--primary);
    transform: none;
}
#SideBar .btn:hover svg { opacity: 1; }

#SideBar a.is-active .btn,
#SideBar .btn.is-active {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25) !important;
    border-color: var(--primary) !important;
}
#SideBar a.is-active .btn svg,
#SideBar .btn.is-active svg { opacity: 1; }

[data-theme="dark"] #SideBar {
    background: var(--surface);
    border-color: var(--border-light);
}
[data-theme="dark"] #SideBar .btn {
    color: var(--text-light);
}
[data-theme="dark"] #SideBar .btn:hover {
    background: var(--surface-alt);
    color: var(--accent);
}
[data-theme="dark"] #SideBar a.is-active .btn { background: var(--accent) !important; color: #0f172a !important; }

/* ---------- TopBar : ajouter un logo a gauche ---------- */
#BarLogIn::before {
    content: "EOS";
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    font-size: 14px;
    margin-right: 8px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-light) 100%);
    border-radius: 6px;
    flex-shrink: 0;
}

/* ---------- Section Synthese moderne (Statistique) ---------- */
.synth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 20px 0;
}
.synth-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.4s ease backwards;
}
.synth-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.synth-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--primary);
}
.synth-card-header svg { width: 18px; height: 18px; }
.synth-card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.synth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 1px dashed var(--border-light);
}
.synth-row:last-child { border-bottom: none; }
.synth-row .label { flex: 1; }
.synth-row .value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--surface-alt);
    padding: 3px 10px;
    border-radius: 6px;
    min-width: 32px;
    text-align: center;
}
.synth-row.highlight .value { background: var(--accent-light); color: var(--accent); }
.synth-row.warning .value { background: rgba(221, 107, 32, 0.12); color: var(--warning); }
.synth-row.danger .value { background: rgba(229, 62, 62, 0.12); color: var(--danger); }

/* ---------- Heatmap heures (Statistique) ---------- */
.heat-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    margin: 16px 0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.heat-table th {
    padding: 6px 4px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    border-radius: 4px;
    text-align: center;
}
.heat-table td {
    padding: 8px 4px;
    text-align: center;
    border-radius: 4px;
    background: var(--surface-alt);
    color: var(--text-light);
    transition: transform 0.15s ease;
    font-weight: 600;
}
.heat-table td:hover { transform: scale(1.1); }
.heat-table td.h-0 { background: var(--surface-alt); color: var(--text-muted); }
.heat-table td.h-1 { background: rgba(49, 130, 206, 0.15); color: var(--accent); }
.heat-table td.h-2 { background: rgba(49, 130, 206, 0.30); color: var(--primary); }
.heat-table td.h-3 { background: rgba(49, 130, 206, 0.55); color: #fff; }
.heat-table td.h-4 { background: rgba(49, 130, 206, 0.85); color: #fff; }
.heat-table td.h-total { background: var(--primary); color: #fff; font-weight: 700; }
.heat-table tr.label-row td:first-child {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    text-align: right;
    padding-right: 10px;
}
.heat-table .day-label {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    text-align: left;
}

/* ---------- Texte plus lisible : taille plus grande dans #accueil ---------- */
#TxtAccueil {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-light);
}
#TxtAccueil strong { color: var(--text); }
#TitreAccueil {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

/* Mobile : la sidebar prend toute la largeur des liens */
@media (max-width: 900px) {
    #BarLogIn::before { display: none; }
}
@media (max-width: 600px) {
    #SideBar .btn { padding: 8px 12px; font-size: 12px; }
    #SideBar .btn span { display: inline; }
    #SideBar .btn svg { width: 14px; height: 14px; }
    .synth-grid { grid-template-columns: 1fr; }
    .synth-card { padding: 16px; }
    .heat-table { font-size: 10px; }
    .heat-table td, .heat-table th { padding: 4px 2px; }
}

/* ==========================================================================
   v3.0 - Design system boutons unifie + Topbar logo + Cartographie
   ========================================================================== */

/* ---------- ui-btn : design system bouton complet ---------- */
.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}
.ui-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ui-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ui-btn:active { transform: translateY(0); }
.ui-btn:disabled, .ui-btn.is-disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Variantes */
.ui-btn--primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.ui-btn--primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; box-shadow: 0 4px 12px rgba(30,58,95,0.25); }

.ui-btn--accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.ui-btn--accent:hover { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(49,130,206,0.25); }

.ui-btn--secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.ui-btn--secondary:hover { background: var(--surface-alt); border-color: var(--accent); color: var(--primary); }

.ui-btn--ghost {
    background: transparent;
    color: var(--text-light);
    border-color: transparent;
}
.ui-btn--ghost:hover { background: var(--surface-alt); color: var(--text); }

.ui-btn--danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.ui-btn--danger:hover { background: #c53030; border-color: #c53030; color: #fff; box-shadow: 0 4px 12px rgba(229,62,62,0.25); }

.ui-btn--success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.ui-btn--success:hover { background: #2f855a; border-color: #2f855a; color: #fff; }

.ui-btn--warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}

/* Tailles */
.ui-btn--sm { padding: 6px 10px; font-size: 12px; gap: 6px; }
.ui-btn--sm svg { width: 14px; height: 14px; }
.ui-btn--lg { padding: 14px 24px; font-size: 15px; gap: 10px; }
.ui-btn--lg svg { width: 18px; height: 18px; }

/* Icon-only */
.ui-btn--icon {
    width: 36px;
    padding: 0;
    aspect-ratio: 1;
}
.ui-btn--icon.ui-btn--sm { width: 30px; }
.ui-btn--icon.ui-btn--lg { width: 44px; }

/* Group */
.ui-btn-group {
    display: inline-flex;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.ui-btn-group .ui-btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    box-shadow: none;
}
.ui-btn-group .ui-btn:last-child { border-right: none; }
.ui-btn-group .ui-btn.is-active { background: var(--primary); color: #fff; }

/* Loading */
.ui-btn.is-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}
.ui-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    color: var(--text);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Topbar : logo image + amelioration spacing ---------- */
#BarLogIn {
    padding: 0 20px;
    height: 52px;
    gap: 12px;
}
#BarLogIn::before {
    content: "EOS";
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #fff;
    font-size: 13px;
    padding: 5px 11px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-light) 100%);
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 2px 8px rgba(49,130,206,0.3);
}

#BarLogIn a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    transition: all 0.2s;
}
#BarLogIn a svg { width: 15px; height: 15px; opacity: 0.8; flex-shrink: 0; }
#BarLogIn a:hover { background: rgba(255,255,255,0.1); color: #fff; }
#BarLogIn a:hover svg { opacity: 1; }
#BarLogIn .bar-icon { padding: 7px; }
#BarLogIn .bar-icon svg { width: 16px; height: 16px; opacity: 0.8; }
#BarLogIn .bar-logout { color: rgba(255,255,255,0.6); }
#BarLogIn .bar-logout:hover { background: rgba(229,62,62,0.2); color: #fff; }
#BarLogIn .bar-logout svg { opacity: 0.85; }
#BarLogIn .bar-user span { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 600px) {
    #BarLogIn .bar-user span,
    #BarLogIn .bar-left a span,
    #BarLogIn .bar-center a span { display: none; }
    #BarLogIn::before { padding: 4px 8px; font-size: 11px; }
}

/* ---------- Mission header (titre.php) ---------- */
.titre-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    border: 1px solid var(--border-light);
    margin: 12px auto;
    width: min(96%, 1600px);
    gap: 16px;
    animation: slideDown 0.4s ease;
}
.titre-logo { flex-shrink: 0; display: inline-flex; }
.titre-logo img { height: 56px; width: auto; max-width: 180px; }
.titre-mission {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}
.titre-mission-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.titre-mission-name {
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 700;
    color: var(--primary);
    margin-top: 2px;
}
.titre-clock { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.titre-clock-display {
    background: var(--primary);
    color: #fff;
    font-family: 'JetBrains Mono', 'Inter', monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 20px;
    padding: 6px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    letter-spacing: 1px;
}
.titre-clock-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}
.titre-clock-link svg { width: 12px; height: 12px; }
.titre-clock-link:hover { color: var(--accent); }

@media (max-width: 700px) {
    .titre-header { flex-direction: column; padding: 12px; gap: 10px; }
    .titre-clock { align-items: center; }
}

/* ---------- Carte v3 Leaflet ---------- */
.map3-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    width: 100%;
}
.map3-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.map3-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 8px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: 9px;
}
.map3-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.map3-search input {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 14px;
    width: 100%;
    color: var(--text);
}
.map3-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-light);
}
.map3-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.map3-legend-dot { width: 10px; height: 10px; border-radius: 50%; }

#map3 {
    flex: 1;
    width: 100%;
    background: #e8eef6;
}
[data-theme="dark"] #map3 { background: #0f172a; }

.map3-popup-title { font-size: 14px; font-weight: 700; color: var(--primary); margin: 0 0 6px; }
.map3-popup-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.map3-popup-actions { display: flex; gap: 6px; margin-top: 8px; }

.map3-marker {
    width: 32px;
    height: 42px;
    cursor: pointer;
    transform: translate(-50%, -100%);
}

/* ---------- Widgets dashboard v3 ---------- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    width: min(96%, 1600px);
    margin: 0 auto 24px;
}
.widget {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    animation: slideUp 0.4s ease backwards;
}
.widget:hover { box-shadow: var(--shadow); }
.widget--col-3 { grid-column: span 3; }
.widget--col-4 { grid-column: span 4; }
.widget--col-6 { grid-column: span 6; }
.widget--col-8 { grid-column: span 8; }
.widget--col-12 { grid-column: span 12; }

.widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.widget-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.widget-title svg { width: 16px; height: 16px; color: var(--primary); }

@media (max-width: 1024px) {
    .widget--col-3, .widget--col-4 { grid-column: span 6; }
    .widget--col-6, .widget--col-8 { grid-column: span 12; }
}
@media (max-width: 600px) {
    .widget--col-3, .widget--col-4, .widget--col-6 { grid-column: span 12; }
    .widget { padding: 14px; }
}

/* v3.1 - Fix centrage sidebar */
nav#SideBar {
    display: flex !important;
    margin: 0 auto;
    width: fit-content;
    max-width: min(96%, 1600px);
}
#BarLogIn .bar-left a + a { margin-left: 4px; }
.theme-toggle { margin-right: 4px; }
@media (max-width: 700px) {
    nav#SideBar { width: 100%; max-width: 100%; flex-wrap: wrap; }
    nav#SideBar #liens { width: 100%; justify-content: center; }
}

/* ==========================================================================
   v3.2 - Onboarding + Voice + Notifications push
   ========================================================================== */

/* Onboarding overlay */
.onboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
}
.onboard-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    pointer-events: all;
}
.onboard-spotlight {
    position: absolute;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6), 0 0 0 4px rgba(56, 189, 248, 0.6), 0 0 30px rgba(56, 189, 248, 0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 1;
}
.onboard-tip {
    position: absolute;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 18px 22px;
    max-width: 320px;
    z-index: 2;
    pointer-events: all;
    animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.onboard-tip-step {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.onboard-tip-title {
    margin: 4px 0 8px;
    font-size: 16px;
    color: var(--text);
}
.onboard-tip-text {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}
.onboard-tip-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

/* Voice command button */
.voice-btn {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 4px;
}
.voice-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.voice-btn.is-listening {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229,62,62, 0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(229,62,62, 0); }
}

/* Templates tchat */
.tchat-templates {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px 12px 0;
    border-top: 1px solid var(--border-light);
}
.tchat-template-btn {
    appearance: none;
    border: 1px solid var(--border-light);
    background: var(--surface-alt);
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.tchat-template-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--primary);
}

/* Live mode operationnel */
.live-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #2c5282 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}
.live-grid {
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    grid-template-rows: auto 1fr;
    gap: 14px;
    padding: 14px;
    height: 100vh;
    box-sizing: border-box;
}
.live-grid > .live-header { grid-column: 1 / -1; }
@media (max-width: 1100px) {
    .live-grid { grid-template-columns: 1fr 1fr; }
    .live-feed { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .live-grid { grid-template-columns: 1fr; height: auto; }
}
.live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.1);
}
.live-header h1 { margin: 0; font-size: 18px; font-weight: 700; }
.live-header .live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(74,222,128,0.2);
    color: #4ade80;
    border: 1px solid rgba(74,222,128,0.3);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.live-header .live-pill::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 1.4s ease-in-out infinite;
}
.live-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}
.live-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.live-card-head {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.live-feed {
    overflow-y: auto;
    padding: 10px 14px;
}
.live-event {
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    animation: liveSlide 0.3s ease;
}
.live-event.is-urgent {
    border-left-color: #f87171;
    background: rgba(248,113,113,0.12);
}
.live-event.is-medical {
    border-left-color: #facc15;
    background: rgba(250,204,21,0.1);
}
.live-event.is-info {
    border-left-color: #60a5fa;
}
.live-event-time {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-variant-numeric: tabular-nums;
    margin-bottom: 3px;
}
.live-event-text { color: #fff; line-height: 1.4; }
@keyframes liveSlide {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.live-kpi {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 14px;
}
.live-kpi-cell {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.live-kpi-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff 0%, #cfd8e6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.live-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.6);
    margin-top: 6px;
}
.live-mini-map {
    flex: 1;
    min-height: 300px;
    background: #0f172a;
}

/* ==========================================================================
   v3.3 - Sidebar verticale optionnelle (mode "rail")
   Active via <body class="layout-rail">
   ========================================================================== */
body.layout-rail {
    --rail-width: 220px;
    --rail-collapsed: 64px;
}
body.layout-rail nav#SideBar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: var(--rail-width);
    max-width: var(--rail-width) !important;
    flex-direction: column;
    align-items: stretch;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-light);
    background: var(--surface);
    margin: 0 !important;
    padding: 16px 8px;
    overflow-y: auto;
    z-index: 100;
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
}
body.layout-rail nav#SideBar #liens {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
}
body.layout-rail nav#SideBar a { width: 100%; }
body.layout-rail nav#SideBar .btn {
    width: 100%;
    justify-content: flex-start;
    padding: 11px 14px;
}
body.layout-rail.is-collapsed nav#SideBar {
    width: var(--rail-collapsed);
}
body.layout-rail.is-collapsed nav#SideBar .btn { justify-content: center; padding: 11px; }
body.layout-rail.is-collapsed nav#SideBar .btn span { display: none; }

body.layout-rail #accueil,
body.layout-rail .form-card,
body.layout-rail .titre-header,
body.layout-rail .stats-grid,
body.layout-rail .map3-page {
    margin-left: calc(var(--rail-width) + 16px) !important;
    margin-right: 16px !important;
    width: auto !important;
    max-width: calc(100% - var(--rail-width) - 32px) !important;
}
body.layout-rail.is-collapsed #accueil,
body.layout-rail.is-collapsed .form-card,
body.layout-rail.is-collapsed .titre-header,
body.layout-rail.is-collapsed .stats-grid,
body.layout-rail.is-collapsed .map3-page {
    margin-left: calc(var(--rail-collapsed) + 16px) !important;
    max-width: calc(100% - var(--rail-collapsed) - 32px) !important;
}

@media (max-width: 900px) {
    body.layout-rail nav#SideBar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    body.layout-rail.rail-open nav#SideBar { transform: translateX(0); }
    body.layout-rail #accueil, body.layout-rail .form-card,
    body.layout-rail .titre-header, body.layout-rail .stats-grid {
        margin-left: 16px !important;
        max-width: calc(100% - 32px) !important;
    }
}

.rail-toggle {
    position: fixed;
    bottom: 88px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
body.layout-rail .rail-toggle { display: flex; }
.rail-toggle:hover { background: var(--primary-light); }

/* ==========================================================================
   v3.4 - Mode haute lisibilite + Banniere alertes metier
   ========================================================================== */

[data-theme="hicontrast"] {
    --primary: #000;
    --primary-light: #1a1a1a;
    --accent: #0050a0;
    --accent-light: #cce0ff;
    --surface: #ffffff;
    --surface-alt: #f5f5f5;
    --text: #000000;
    --text-light: #1a1a1a;
    --text-muted: #444444;
    --border: #000000;
    --border-light: #888888;
    --shadow: 0 4px 0 #000;
    --shadow-sm: 0 2px 0 #000;
    --shadow-lg: 0 6px 0 #000;
}
[data-theme="hicontrast"] body { background: #fff !important; background-image: none !important; }
[data-theme="hicontrast"] body::before { display: none !important; }
[data-theme="hicontrast"] * { font-weight: 600 !important; }
[data-theme="hicontrast"] .ui-btn { border: 2px solid #000; font-size: 16px; padding: 12px 18px; }
[data-theme="hicontrast"] input, [data-theme="hicontrast"] select, [data-theme="hicontrast"] textarea {
    border: 2px solid #000; font-size: 16px; padding: 10px 12px;
}
[data-theme="hicontrast"] .stat-value, [data-theme="hicontrast"] .synth-row .value, [data-theme="hicontrast"] .h-stat-value {
    font-size: 36px !important; color: #000 !important;
}
[data-theme="hicontrast"] #BarLogIn { background: #000 !important; border-bottom: 3px solid #fff; }
[data-theme="hicontrast"] #BarLogIn a { color: #fff; font-size: 14px; }
[data-theme="hicontrast"] .menu-toggle span { background: #fff !important; height: 3px; }

/* Banniere alertes metier */
.alert-banner {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 950;
    background: var(--warning);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideDown 0.3s ease;
}
.alert-banner.is-danger { background: var(--danger); }
.alert-banner.is-info { background: var(--accent); }
.alert-banner-icon { width: 28px; height: 28px; background: rgba(255,255,255,0.25); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-banner-text { flex: 1; font-size: 14px; font-weight: 600; }
.alert-banner-close { background: rgba(255,255,255,0.2); border: none; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.alert-banner-close:hover { background: rgba(255,255,255,0.35); }

/* Widget meteo */
.weather-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.weather-temp { font-size: 28px; font-weight: 700; line-height: 1; color: var(--primary); }
.weather-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.weather-icon { font-size: 32px; }

/* ==========================================================================
   v3.5 - Bilan.php / Transfert.php - lisibilite renforcee
   ========================================================================== */

/* Bilan : containers internes */
#simplifie, #medical, #detaille {
    margin-top: 14px !important;
    animation: fadeIn 0.3s ease;
}
#simplifie #content, #medical #content,
#detaille #content, #detaille #content1, #detaille #content2, #detaille #content3 {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    background: var(--surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 12px !important;
    padding: 22px 26px !important;
    margin: 12px 0 !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
    font-size: 14px;
    line-height: 1.6;
    overflow: visible;
}
#simplifie #content:hover, #medical #content:hover,
#detaille #content:hover, #detaille #content1:hover,
#detaille #content2:hover, #detaille #content3:hover {
    border-color: var(--accent) !important;
    box-shadow: var(--shadow) !important;
}

/* Titres sections */
#simplifie .titre, #medical .titre, #detaille .titre {
    display: block;
    font-size: 14px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary) !important;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
}
#simplifie .titreimg, #medical .titreimg, #detaille .titreimg {
    float: right;
    margin-top: -4px;
}

/* Inputs et selects dans Bilan */
#simplifie input[type="text"], #simplifie input[type="number"], #simplifie input[type="time"], #simplifie input[type="date"], #simplifie select, #simplifie textarea,
#medical input[type="text"], #medical input[type="number"], #medical input[type="time"], #medical input[type="date"], #medical select, #medical textarea,
#detaille input[type="text"], #detaille input[type="number"], #detaille input[type="time"], #detaille input[type="date"], #detaille select, #detaille textarea {
    border: 1px solid var(--border) !important;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: var(--font);
    font-size: 13px;
    background: var(--surface-alt);
    transition: all 0.2s;
}
#simplifie input:focus, #medical input:focus, #detaille input:focus,
#simplifie select:focus, #medical select:focus, #detaille select:focus,
#simplifie textarea:focus, #medical textarea:focus, #detaille textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.1);
    background: #fff;
    outline: none;
}

/* Tableaux dans Bilan */
#simplifie table, #medical table, #detaille table {
    border-collapse: separate;
    border-spacing: 0;
}
#simplifie table td, #medical table td, #detaille table td {
    padding: 6px 10px;
    vertical-align: middle;
}

/* Switch radio Bilan medical / simplifie / detaille */
#simplifie input[name="typeB"], #medical input[name="typeB"], #detaille input[name="typeB"],
input#Medic, input#Simp, input#Det {
    appearance: auto;
    margin-right: 4px;
}

/* Boutons Enregistrer / Annuler */
.btnEnreg, .btnAnnul {
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.btnEnreg { background: var(--primary); color: #fff; border-color: var(--primary); }
.btnEnreg:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btnAnnul { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.btnAnnul:hover { background: var(--surface); border-color: var(--text-muted); }

/* Boutons icones Bilan en haut */
#TitreAccueil + span img,
.bilan-actions img {
    width: 64px !important;
    height: 64px;
    border-radius: 12px;
    background: var(--surface);
    padding: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    object-fit: contain;
}
#TitreAccueil + span img:hover,
.bilan-actions img:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

/* Timeline (fleche entree/sortie sur Bilan + Transfert) */
.timeline-responsive {
    position: relative;
    margin: 20px 0;
    padding: 14px 0;
}
.fleche-img {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: block;
}
.timeline-responsive table {
    width: 100% !important;
    margin: 0 !important;
}

/* Transfert.php : redesign */
#accueil .timeline-responsive + br + table,
.transfert-form {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 18px 22px;
    margin-top: 18px;
    box-shadow: var(--shadow-sm);
}

/* Force fluidite des #content avec width:850px */
[style*="width:850px"], [style*="width: 850px"] {
    width: 100% !important;
    max-width: 100% !important;
}
[style*="width:75%"], [style*="width: 75%"] {
    width: 100% !important;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

/* Cacher la fleche image qui se superpose mal sur le Bilan */
@media (max-width: 768px) {
    .fleche-img { display: none; }
    .timeline-responsive table { margin-top: 0 !important; }
}

/* Boutons radio compactes pour switch Bilan medical/simplifie/detaille */
.bilan-tabs-compat {
    text-align: center;
    margin: 14px 0 18px;
}
.bilan-tabs-compat label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin: 0 3px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}
.bilan-tabs-compat label:hover { border-color: var(--accent); }
.bilan-tabs-compat input[type="radio"]:checked + span,
.bilan-tabs-compat label:has(input:checked) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
/* Legacy fix appended to Global.css */
#accueil [style*="width:850px"],
#accueil [style*="width: 850px"],
#accueil [style*="width:800px"],
#accueil [style*="width: 800px"],
#accueil [style*="width:700px"],
#accueil [style*="width: 700px"],
#accueil [style*="width:75%"],
#accueil [style*="width: 75%"],
#accueil [style*="width:80%"],
#accueil [style*="width: 80%"] {
    width: 100% !important;
    max-width: min(96%, 1100px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

#accueil > table:not([class]),
#accueil .table-responsive table:not([class]) {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 13px;
}
#accueil > table:not([class]) > tbody > tr:first-child,
#accueil .table-responsive table:not([class]) > tbody > tr:first-child,
#accueil > table:not([class]) > tr:first-child,
#accueil .table-responsive table:not([class]) > tr:first-child {
    background: var(--primary) !important;
}
#accueil > table:not([class]) > tbody > tr:first-child > th,
#accueil > table:not([class]) > tbody > tr:first-child > td,
#accueil > table:not([class]) > tr:first-child > th,
#accueil > table:not([class]) > tr:first-child > td,
#accueil .table-responsive table:not([class]) > tr:first-child th {
    color: #fff !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px !important;
    padding: 10px 12px !important;
    border: none !important;
    text-align: left;
    background: var(--primary) !important;
}
#accueil > table:not([class]) td,
#accueil .table-responsive table:not([class]) td {
    padding: 8px 12px !important;
    border-bottom: 1px solid var(--border-light) !important;
    background: transparent !important;
    color: var(--text);
}
#accueil > table:not([class]) tr:nth-child(even):not(:first-child) td,
#accueil .table-responsive table:not([class]) tr:nth-child(even):not(:first-child) td {
    background: var(--surface-alt) !important;
}
#accueil > table:not([class]) tr:hover td,
#accueil .table-responsive table:not([class]) tr:hover td {
    background: var(--accent-light) !important;
}

#accueil tr[style*="background:#616161"] th,
#accueil tr[style*="background:#616161"] td,
#accueil tr[style*="background: #616161"] th,
#accueil tr[style*="background: #616161"] td {
    background: var(--primary) !important;
    color: #fff !important;
}
#accueil td[style*="background:#a3a3a3"],
#accueil td[style*="background: #a3a3a3"],
#accueil td[style*="background:#949494"],
#accueil td[style*="background: #949494"] {
    background: transparent !important;
}

#accueil input[type="text"]:not(.form-input):not(.ui-btn),
#accueil input[type="number"]:not(.form-input):not(.ui-btn),
#accueil input[type="date"]:not(.form-input):not(.ui-btn),
#accueil input[type="time"]:not(.form-input):not(.ui-btn),
#accueil input[type="email"]:not(.form-input):not(.ui-btn),
#accueil input[type="tel"]:not(.form-input):not(.ui-btn),
#accueil select:not(.form-input):not(.ui-btn),
#accueil textarea:not(.form-input) {
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-family: var(--font);
    font-size: 13px !important;
    background: var(--surface-alt);
    color: var(--text);
    transition: all 0.2s;
}
#accueil input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.form-input):focus,
#accueil select:not(.form-input):focus,
#accueil textarea:not(.form-input):focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.12) !important;
    background: #fff !important;
    outline: none !important;
}

#accueil input[type="submit"]:not(.btnEnreg):not(.btnAnnul):not(.ui-btn),
#accueil input[type="button"]:not(.btnEnreg):not(.btnAnnul):not(.ui-btn) {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
#accueil input[type="submit"]:not(.btnAnnul):not(.ui-btn):hover,
#accueil input[type="button"]:not(.btnAnnul):not(.ui-btn):hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

#accueil a img[src*="btn"], #accueil a img[src*="ajout"], #accueil a img[src*="edit"],
#accueil a img[src*="croix"], #accueil a img[src*="play"], #accueil a img[src*="archive"],
#accueil a img[src*="dupli"], #accueil a img[src*="forms-icon"] {
    width: 22px !important;
    height: 22px;
    object-fit: contain;
    padding: 4px;
    border-radius: 6px;
    background: var(--surface-alt);
    transition: all 0.15s;
    vertical-align: middle;
}
#accueil a img[src*="btn"]:hover, #accueil a img[src*="ajout"]:hover, #accueil a img[src*="edit"]:hover,
#accueil a img[src*="croix"]:hover, #accueil a img[src*="play"]:hover, #accueil a img[src*="archive"]:hover {
    background: var(--accent-light);
    transform: scale(1.1);
}

#accueil [style*="margin-top:-"],
#accueil [style*="margin-top: -"] {
    margin-top: 0 !important;
}

#accueil > div > div[id^="content"]:not(.live-card) {
    background: var(--surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 12px !important;
    padding: 18px 22px !important;
    box-shadow: var(--shadow-sm) !important;
    margin: 12px 0 !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

#accueil .titre {
    display: block;
    font-size: 13px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary) !important;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

#accueil #bouton, #accueil #boutons {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
#accueil #boutonAjout {
    margin: 12px 0;
    text-align: right;
}
#accueil #boutonAjout a, #accueil #boutonAjout > div {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}
#accueil #boutonAjout a:hover, #accueil #boutonAjout > div:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

#accueil center { display: block; text-align: center; }
#accueil center > br + table, #accueil center > table { margin: 12px auto; }
