/* =========================================================
   SIGS - Systeme Integre de Gestion des Stocks
   Design System v3.0 - Modern, Clean & Professional
   ========================================================= */

/* --- Google Fonts --- */
/* Polices systeme : rendu natif sur chaque plateforme, zero octet a telecharger */

/* --- Variables globales --- */
:root {
    /* Typographie : pile systeme, identique au rendu natif iOS / Android */
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', 'Noto Sans', Arial, sans-serif;
    --font-num: ui-monospace, 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', monospace;

    /* Palette principale */
    --primary: #1e3a5f;
    --primary-light: #2a5298;
    --primary-dark: #0f1f33;
    --accent: #4361ee;
    --accent-hover: #3a56d4;
    --accent-light: #eef2ff;
    --accent-rgb: 67,97,238;

    /* Couleurs fonctionnelles */
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #06b6d4;
    --info-light: #ecfeff;

    /* Couleurs neutres */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255,255,255,0.06);
    --bg-sidebar-active: rgba(67,97,238,0.2);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-muted: #cbd5e1;
    --border-color: #e2e8f0;
    --bg-subtle: #f8fafc;

    /* Dimensions */
    --sidebar-width: 264px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Ombres */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Page Loader --- */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0c1222 0%, #1a2540 50%, #0f172a 100%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-spinner {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner-ring:nth-child(1) {
    width: 90px;
    height: 90px;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    animation: spinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(2) {
    width: 70px;
    height: 70px;
    border-bottom-color: var(--success);
    border-left-color: var(--success);
    animation: spinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
    animation-delay: -0.3s;
}

.spinner-ring:nth-child(3) {
    width: 50px;
    height: 50px;
    border-top-color: var(--warning);
    border-right-color: var(--warning);
    animation: spinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    animation-delay: -0.6s;
}

.loader-icon {
    font-size: 1.5rem;
    color: #ffffff;
    animation: loaderPulse 1.5s ease-in-out infinite;
}

@keyframes spinnerRotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loaderPulse {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50%      { opacity: 1; transform: scale(1.1); }
}

.loader-text {
    font-family: var(--font-ui);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.loader-bar-fill {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success), var(--accent));
    background-size: 200% 100%;
    border-radius: 4px;
    animation: loaderProgress 1.5s ease-in-out infinite;
}

@keyframes loaderProgress {
    0%   { width: 0%; transform: translateX(0); }
    50%  { width: 70%; }
    100% { width: 100%; transform: translateX(0); }
}

/* AJAX Loader (barre superieure) */
.ajax-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99998;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ajax-loader.active {
    opacity: 1;
}

.ajax-loader-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 0 2px 2px 0;
    animation: ajaxSlide 1.2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5);
}

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

/* --- Overlay Loader --- */
.overlay-loader { position:fixed; inset:0; background:rgba(255,255,255,0.82); z-index:9999; display:flex; flex-direction:column; align-items:center; justify-content:center; backdrop-filter:blur(3px); opacity:0; visibility:hidden; transition:opacity 0.3s ease, visibility 0.3s ease; }
.overlay-loader.active { opacity:1; visibility:visible; }
.overlay-loader .overlay-spinner { width:48px; height:48px; border:3px solid #e2e8f0; border-top-color:var(--accent); border-radius:50%; animation:spinnerRotate 0.8s linear infinite; }
.overlay-loader-text { margin-top:16px; font-size:0.95rem; font-weight:600; color:var(--text-primary); }
.overlay-loader-sub { margin-top:4px; font-size:0.8rem; color:var(--text-secondary); animation:loaderPulse 1.5s ease-in-out infinite; }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-ui);
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
    font-size: 0.875rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; }

/* =========================================================
   SIDEBAR - Professional v3.0
   ========================================================= */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1040;
    background: #0c1222;
    background-image: linear-gradient(180deg, #0c1222 0%, #141d30 50%, #1a2540 100%);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }

/* Sidebar Brand */
.sidebar-brand {
    padding: 18px 20px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.sidebar-brand .brand-logo {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 6px;
    box-shadow: 0 4px 14px rgba(67,97,238,0.35);
}

.sidebar-brand h5 {
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 1px;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.3);
    font-size: 0.6rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 8px 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav .nav-section {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(255,255,255,0.2);
    padding: 14px 14px 5px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-nav .nav-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.06);
}

/* First section no top margin */
.sidebar-nav .nav > .nav-section:first-child,
.sidebar-nav .nav > li:first-child + .nav-section {
    margin-top: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.18s ease;
    position: relative;
    letter-spacing: 0.01em;
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    margin-right: 10px;
    opacity: 0.5;
    transition: all 0.18s ease;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.92);
    transform: translateX(2px);
}
.sidebar-nav .nav-link:hover i {
    opacity: 0.9;
    color: rgba(147,180,253,0.7);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(67,97,238,0.2), rgba(124,58,237,0.12));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(67,97,238,0.1);
}
.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: #93b4fd;
}
.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: linear-gradient(180deg, var(--accent), #7c3aed);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(67,97,238,0.4);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 8px 10px 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    background: rgba(0,0,0,0.12);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s ease;
}
.sidebar-user-row:hover {
    background: rgba(255,255,255,0.06);
}

.sidebar-user-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}
a.sidebar-user-left:hover {
    color: inherit;
    text-decoration: none;
}
a.sidebar-user-left:hover .sidebar-user-name {
    color: rgba(255,255,255,1);
}

.sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(67,97,238,0.25);
}

.sidebar-user-avatar-img {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.12);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-user-info { overflow: hidden; }

.sidebar-user-name {
    color: rgba(255,255,255,0.88);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    color: rgba(255,255,255,0.3);
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.3;
    font-weight: 500;
}

.sidebar-logout-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(239,68,68,0.12);
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.95rem;
    border: 1px solid rgba(239,68,68,0.1);
}
.sidebar-logout-icon:hover {
    background: rgba(239,68,68,0.25);
    color: #fca5a5;
    transform: scale(1.08);
    border-color: rgba(239,68,68,0.2);
}

/* Sidebar Scrollbar */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Gradient fade hint at bottom of nav when scrollable */
.sidebar-nav {
    mask-image: linear-gradient(to bottom, black calc(100% - 8px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 8px), transparent 100%);
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}
.main-content.expanded { margin-left: 0; width: 100%; }

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0; z-index: 1030;
    box-shadow: var(--shadow-xs);
}

.topbar .btn-sidebar-toggle {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center; justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    transition: var(--transition-fast);
}
.topbar .btn-sidebar-toggle:hover {
    background: var(--bg-body); color: var(--text-primary);
}

.topbar .commerce-badge {
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.topbar .user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}
.topbar .user-dropdown:hover { background: var(--bg-body); }

.topbar .user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.topbar .user-avatar-img,
.user-avatar-img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(67,97,238,0.2);
}

.topbar .user-info { line-height: 1.3; }
.topbar .user-name { font-weight: 600; font-size: 0.82rem; color: var(--text-primary); }
.topbar .user-role { font-size: 0.7rem; color: var(--text-secondary); }

/* =========================================================
   PAGE CONTENT
   ========================================================= */
.page-content {
    padding: 24px 28px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.35rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h2 i { color: var(--accent); font-size: 1.2rem; }

.page-header .breadcrumb-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-header .btn {
    box-shadow: var(--shadow-sm);
}

/* =========================================================
   CARDS - Enhanced v3.0
   ========================================================= */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    transition: box-shadow 0.25s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}
.card-header h6 {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h6 i {
    font-size: 1rem;
}
.card-header.d-flex { gap: 10px; }

.card-body { padding: 22px; }

/* --- Colored card headers --- */
.card-header.bg-gradient-primary  { background: linear-gradient(135deg, #1e3a5f, #2a5298) !important; border-bottom: none; }
.card-header.bg-gradient-success  { background: linear-gradient(135deg, #059669, #10b981) !important; border-bottom: none; }
.card-header.bg-gradient-info     { background: linear-gradient(135deg, #0891b2, #06b6d4) !important; border-bottom: none; }
.card-header.bg-gradient-warning  { background: linear-gradient(135deg, #d97706, #f59e0b) !important; border-bottom: none; }
.card-header.bg-gradient-danger   { background: linear-gradient(135deg, #dc2626, #ef4444) !important; border-bottom: none; }

.card-header.bg-gradient-primary,
.card-header.bg-gradient-success,
.card-header.bg-gradient-info,
.card-header.bg-gradient-danger {
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-header.bg-gradient-primary h6,
.card-header.bg-gradient-success h6,
.card-header.bg-gradient-info h6,
.card-header.bg-gradient-warning h6,
.card-header.bg-gradient-danger h6,
.card-header.bg-gradient-primary .text-white,
.card-header.text-white h6 {
    color: #fff !important;
}

/* Backward compat: old bg-success etc. */
.card-header.bg-success { background: linear-gradient(135deg, #059669, #10b981) !important; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header.bg-primary { background: linear-gradient(135deg, #1e3a5f, #2a5298) !important; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header.bg-info    { background: linear-gradient(135deg, #0891b2, #06b6d4) !important; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header.bg-warning { background: linear-gradient(135deg, #d97706, #f59e0b) !important; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header.bg-danger  { background: linear-gradient(135deg, #dc2626, #ef4444) !important; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header.bg-success h6,
.card-header.bg-primary h6,
.card-header.bg-info h6,
.card-header.bg-danger h6 { color: #fff !important; }
.card-header.bg-success h6 i,
.card-header.bg-primary h6 i,
.card-header.bg-info h6 i,
.card-header.bg-danger h6 i { color: rgba(255,255,255,0.85) !important; }
.card-header.bg-warning h6 { color: #1e293b !important; }
.card-header.bg-warning h6 i { color: rgba(30,41,59,0.7) !important; }

/* =========================================================
   KPI CARDS - Unified structure
   ========================================================= */
.kpi-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    height: 100%;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.kpi-card .card-body {
    padding: 22px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* When text-center is used (simple KPI) */
.kpi-card .card-body.text-center {
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.kpi-card .kpi-icon-bg {
    position: absolute;
    right: -8px; bottom: -8px;
    font-size: 4.5rem;
    opacity: 0.05;
    z-index: 0;
    line-height: 1;
}

.kpi-card .kpi-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.kpi-card .kpi-icon.bg-primary-light { background: var(--accent-light); color: var(--accent); }
.kpi-card .kpi-icon.bg-success-light { background: var(--success-light); color: var(--success); }
.kpi-card .kpi-icon.bg-danger-light  { background: var(--danger-light); color: var(--danger); }
.kpi-card .kpi-icon.bg-warning-light { background: var(--warning-light); color: var(--warning); }
.kpi-card .kpi-icon.bg-info-light    { background: var(--info-light); color: var(--info); }
.kpi-card .kpi-icon.bg-secondary-light { background: #f1f5f9; color: #475569; }

.kpi-card .kpi-content {
    min-width: 0;
    flex: 1;
}

.kpi-card .kpi-value {
    font-size: clamp(0.95rem, 1.8vw, 1.35rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 1px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.kpi-card .kpi-value-success { color: var(--success) !important; }
.kpi-card .kpi-value-danger  { color: var(--danger) !important; }

.kpi-card .kpi-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Money columns in tables - right-aligned */
.table td.td-money,
.table th.th-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.table td.td-money {
    font-weight: 700;
}

/* =========================================================
   EQUAL HEIGHT ROWS
   ========================================================= */
.row.g-3 > [class*="col"],
.row.g-2 > [class*="col"] {
    display: flex;
    flex-direction: column;
}
.row.g-3 > [class*="col"] > .card,
.row.g-3 > [class*="col"] > .kpi-card,
.row.g-2 > [class*="col"] > .card,
.row.g-2 > [class*="col"] > .kpi-card {
    flex: 1;
}

/* =========================================================
   TABLES
   ========================================================= */
.table { margin-bottom: 0; }

.table thead th {
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 11px 14px;
    white-space: nowrap;
    background: var(--bg-subtle);
}

.table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    font-size: 0.83rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr { transition: background 0.12s; }
.table-hover tbody tr:hover { background-color: var(--bg-subtle); }

/* =========================================================
   BUTTONS - Enhanced v3.0
   ========================================================= */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 9px 20px;
    font-size: 0.83rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(var(--accent-rgb),0.25);
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #2f46c0);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb),0.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: var(--success);
    box-shadow: 0 2px 4px rgba(16,185,129,0.25);
}
.btn-success:hover {
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: var(--danger);
    box-shadow: 0 2px 4px rgba(239,68,68,0.25);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: var(--warning);
    box-shadow: 0 2px 4px rgba(245,158,11,0.25);
}

.btn-outline-primary { border-color: var(--accent); color: var(--accent); border-width: 1.5px; }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 12px rgba(var(--accent-rgb),0.25); }
.btn-outline-danger  { border-width: 1.5px; }
.btn-outline-danger:hover { box-shadow: 0 4px 12px rgba(239,68,68,0.2); }
.btn-outline-success { border-width: 1.5px; }
.btn-outline-success:hover { box-shadow: 0 4px 12px rgba(16,185,129,0.2); }

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
    border-width: 1.5px;
}
.btn-outline-secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-light);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-light {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: var(--text-secondary);
}
.btn-light:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

.btn-sm { padding: 6px 14px; font-size: 0.78rem; }
.btn-lg {
    padding: 12px 30px;
    font-size: 0.95rem;
    border-radius: var(--radius);
    font-weight: 700;
}

/* =========================================================
   BADGES - Enhanced v3.0
   ========================================================= */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge.bg-success { background: var(--success-light) !important; color: #065f46 !important; }
.badge.bg-danger  { background: var(--danger-light) !important; color: #991b1b !important; }
.badge.bg-warning { background: var(--warning-light) !important; color: #92400e !important; }
.badge.bg-info    { background: var(--info-light) !important; color: #155e75 !important; }
.badge.bg-primary { background: var(--accent-light) !important; color: #3730a3 !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #475569 !important; }

/* Badge with dot indicator */
.badge i { font-size: 0.6rem; }

/* =========================================================
   MODALS - Enhanced v3.0
   ========================================================= */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal-backdrop.show { opacity: 0.35; }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.modal-header .modal-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header .modal-title i {
    font-size: 1.1rem;
}
.modal-header .btn-close {
    opacity: 0.5;
    transition: opacity 0.15s;
}
.modal-header .btn-close:hover { opacity: 0.85; }

.modal-body { padding: 24px 28px; }

.modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Standardize modal footer button sizes */
.modal-footer .btn {
    min-width: 140px;
    padding: 10px 24px;
    font-size: 0.85rem;
    border-radius: var(--radius);
}
.modal-footer .btn-light {
    background: #fff;
    border: 1.5px solid #cbd5e1;
    color: #475569;
}
.modal-footer .btn-light:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}
.modal-footer .btn-primary:hover,
.modal-footer .btn-success:hover {
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.25);
}

/* Colored modal headers */
.modal-header.bg-success,
.modal-header.bg-primary {
    border-bottom: none;
}
.modal-header.bg-success { background: linear-gradient(135deg, #059669, #10b981) !important; }

/* =========================================================
   FORMS - Enhanced v3.0
   ========================================================= */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.85rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
    color: var(--text-primary);
    background: var(--bg-card);
}
.form-control:hover, .form-select:hover {
    border-color: #cbd5e1;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb),0.1), 0 1px 2px rgba(0,0,0,0.04);
    background: #fff;
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.form-label i { color: var(--text-light); font-size: 0.85rem; }

/* Required field indicator */
.form-label .text-danger { font-size: 0.9rem; line-height: 1; }

/* Form groups spacing in modals */
.modal-body .mb-3 { margin-bottom: 18px !important; }

.form-control-sm, .form-select-sm { padding: 7px 12px; font-size: 0.8rem; }

.input-group-text {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: var(--bg-subtle);
    font-size: 0.83rem;
    color: var(--text-secondary);
}

/* Form text helper */
.form-text {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Disabled state */
.form-control:disabled, .form-control[readonly] {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    cursor: not-allowed;
}
.form-select:disabled, .form-select[readonly] {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* =========================================================
   FORM DESIGN SYSTEM - Required, Sections, Validation
   ========================================================= */

/* --- Required field indicator (CSS pseudo-element) --- */
.form-label.required::after {
    content: '*';
    color: #ef4444;
    font-size: 0.95rem;
    font-weight: 700;
    margin-left: 3px;
    line-height: 1;
}

/* --- Form sections (visual grouping) --- */
.form-section {
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.form-section:last-of-type {
    margin-bottom: 0;
}
.form-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-title i {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.1);
    font-size: 0.75rem;
    color: var(--accent);
}

/* --- Inline validation --- */
.form-control.is-invalid, .form-select.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15), 0 1px 2px rgba(0,0,0,0.04);
}
.form-control.is-valid, .form-select.is-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.form-control.is-valid:focus, .form-select.is-valid:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15), 0 1px 2px rgba(0,0,0,0.04);
}
.invalid-feedback {
    display: none;
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 4px;
    align-items: center;
    gap: 4px;
}
.invalid-feedback::before {
    content: '\F33A';
    font-family: 'bootstrap-icons';
    font-size: 0.8rem;
}
.is-invalid ~ .invalid-feedback {
    display: flex;
}

/* --- Unified search input-group --- */
.search-input-group {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input-group .input-group-text {
    background: transparent;
    border: none;
    padding-right: 0;
    color: var(--text-light);
}
.search-input-group .form-control {
    border: none;
    box-shadow: none;
    background: transparent;
}
.search-input-group .form-control:focus {
    box-shadow: none;
    transform: none;
}
.search-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
}

/* --- Form text with icon --- */
.form-text i {
    font-size: 0.7rem;
    margin-right: 2px;
}

/* --- Responsive form adjustments --- */
@media (max-width: 576px) {
    .modal-body {
        padding: 16px 14px;
    }
    .form-section {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    .form-section-title {
        font-size: 0.7rem;
    }
}

/* =========================================================
   FILTER BARS - Enhanced v3.0
   ========================================================= */
.card.mb-3 > .card-body > .row.g-2 {
    align-items: flex-end;
}

.card.mb-3 > .card-body {
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.card.mb-3 > .card-body .form-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 700;
}

/* Make filter bar buttons match input height */
.card.mb-3 .row.g-2 .btn-sm {
    height: calc(1.6em + 14px + 3px);
    font-size: 0.8rem;
}

/* Filter bar select/input consistency */
.card.mb-3 .form-control-sm,
.card.mb-3 .form-select-sm {
    height: calc(1.6em + 14px + 3px);
}

/* =========================================================
   POS (Point de Vente) - Professional POS Layout
   ========================================================= */
.pos-page.page-content {
    padding: 0 !important;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}
.pos-page .page-header { display: none; }
.pos-page > * { animation: none !important; }

.pos-layout {
    height: calc(100vh - var(--topbar-height));
    margin: 0 !important;
    display: flex;
    flex-wrap: wrap;
}

/* === Left side: Products === */
.pos-left {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    border-right: 1px solid var(--border-color);
    padding: 0 !important;
}

.pos-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.pos-toolbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pos-toolbar-item .form-select { min-width: 140px; }
.pos-toolbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    flex-shrink: 0;
}

.pos-products-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f1f5f9;
}

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 10px;
    align-content: start;
}

.pos-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}
.pos-empty-state i { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.3; }
.pos-empty-state p { margin: 0; font-size: 0.9rem; }

.pos-product-card {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    background: var(--bg-card);
    padding: 14px 10px 10px;
    text-align: center;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.pos-product-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(67,97,238,0.18);
    transform: translateY(-2px);
}
.pos-product-card:active {
    transform: scale(0.97);
    box-shadow: 0 1px 4px rgba(67,97,238,0.15);
}
.pos-product-card.out-of-stock { opacity: 0.35; pointer-events: none; }

.pos-product-card .product-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    margin-bottom: 8px;
    min-height: 2.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pos-product-card .product-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 6px;
}
.pos-product-card .product-stock {
    font-size: 0.68rem;
    font-weight: 600;
}

/* === Right side: Cart === */
.pos-right {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    padding: 0 !important;
}

.pos-cart {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    overflow: hidden;
}

.pos-cart-header {
    background: linear-gradient(135deg, var(--primary), #3730a3);
    color: white;
    padding: 14px 18px;
    flex-shrink: 0;
}
.pos-cart-header h5 { font-weight: 700; font-size: 0.95rem; }
.pos-cart-badge {
    background: rgba(255,255,255,0.25);
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 20px;
    padding: 2px 10px;
    min-width: 28px;
    text-align: center;
}

/* Cart items - scrollable middle */
.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 6px 14px;
    min-height: 80px;
}

.pos-cart-empty {
    text-align: center;
    padding: 40px 12px;
    color: var(--text-secondary);
}
.pos-cart-empty i { font-size: 2.2rem; display: block; margin-bottom: 8px; opacity: 0.2; }
.pos-cart-empty p { margin: 0; font-size: 0.85rem; }

/* Cart footer - fixed at bottom */
.pos-cart-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
}

.pos-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: linear-gradient(135deg, #f0f4ff, #ede9fe);
}
.pos-cart-total span:first-child {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.pos-cart-total span:last-child {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent);
}

.pos-cart-payment {
    padding: 10px 14px;
    background: var(--bg-subtle);
}

.pos-monnaie {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
}
.pos-monnaie span:first-child { font-size: 0.78rem; color: var(--text-secondary); }
.pos-monnaie span:last-child { font-weight: 700; color: #10b981; font-size: 0.9rem; }

.pos-cart-actions {
    padding: 10px 14px 14px;
    background: var(--bg-subtle);
}

.pos-btn-validate {
    font-weight: 700;
    font-size: 0.95rem;
    padding: 11px;
    letter-spacing: 0.02em;
    border-radius: var(--radius) !important;
    transition: all 0.2s ease;
}
.pos-btn-validate:not(:disabled) {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.pos-btn-validate:not(:disabled):hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* Cart item rows */
.pos-cart-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 6px;
}
.pos-cart-item:last-child { border-bottom: none; }

.pos-cart-item-info {
    flex: 1;
    min-width: 0;
}
.pos-cart-item-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-cart-item-price {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.pos-cart-item-qty {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.pos-cart-item-qty .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 50%;
    line-height: 1;
}
.pos-cart-item-qty span {
    font-weight: 700;
    font-size: 0.82rem;
    min-width: 18px;
    text-align: center;
}

.pos-cart-item-total {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--accent);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

.pos-cart-item-remove {
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.82rem;
    transition: color 0.15s;
    flex-shrink: 0;
}
.pos-cart-item-remove:hover { color: #ef4444; }

/* =========================================================
   BILLETAGE - Professional Redesign
   ========================================================= */
.cloture-page .page-header h2 { margin-bottom: 0; }

.cloture-auto-info {
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid #c7d2fe;
}
.cloture-auto-info i { font-size: 1.6rem; color: var(--accent); }
.cloture-auto-info .info-text { flex: 1; }
.cloture-auto-info .info-text strong { display: block; font-size: 0.95rem; color: var(--text-primary); }
.cloture-auto-info .info-text small { color: var(--text-secondary); }

/* Resume caisse card */
.resume-caisse-card { border: none; }
.resume-caisse-card .card-header {
    background: linear-gradient(135deg, var(--accent), #7c3aed) !important;
    color: white !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.resume-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.resume-stat-row:last-child { border-bottom: none; }
.resume-stat-row .stat-label { color: var(--text-secondary); font-size: 0.88rem; }
.resume-stat-row .stat-value { font-weight: 700; font-size: 0.95rem; }
.resume-stat-row.highlight {
    background: #f0f4ff;
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
}
.resume-stat-row.highlight .stat-label { color: var(--accent); font-weight: 600; }
.resume-stat-row.highlight .stat-value { color: var(--accent); font-size: 1.1rem; }

/* Billetage table */
.billetage-card { border: none; }
.billetage-card .card-header {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.billetage-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 8px 0 4px;
    margin-top: 8px;
}
.billetage-section-title:first-child { margin-top: 0; }

.billetage-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.billetage-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}
.billetage-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.billetage-table tr:hover td { background: var(--bg-subtle); }
.billetage-table .denom-value {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.billetage-table .denom-input {
    width: 70px;
    text-align: center;
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.billetage-table .denom-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(67,97,238,0.15);
}
.billetage-table .denom-total {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
    text-align: right;
}
.billetage-table .denom-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.billetage-table .denom-icon.billet { background: linear-gradient(135deg, #10b981, #059669); }
.billetage-table .denom-icon.piece { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* Totals section in billetage */
.billetage-totals {
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
    border: 1px solid var(--border-color);
}
.billetage-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
.billetage-total-row:not(:last-child) { border-bottom: 1px solid #e2e8f0; }
.billetage-total-row .total-label { font-weight: 600; color: var(--text-secondary); }
.billetage-total-row .total-value { font-weight: 800; font-size: 1.15rem; }
.billetage-total-row.main-total { padding: 12px 0; }
.billetage-total-row.main-total .total-label { color: var(--text-primary); font-size: 1rem; }
.billetage-total-row.main-total .total-value { font-size: 1.3rem; color: var(--accent); }

.billetage-total-row .ecart-positif { color: #10b981; font-weight: 800; }
.billetage-total-row .ecart-negatif { color: #ef4444; font-weight: 800; }
.billetage-total-row .ecart-zero { color: #10b981; font-weight: 800; }

/* Ecart styling used globally */
.ecart-positif { color: #10b981 !important; }
.ecart-negatif { color: #ef4444 !important; }
.ecart-zero { color: #10b981 !important; }

/* Mode paiement badges in resume */
.mode-paiement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.mode-paiement-item:last-child { margin-bottom: 0; }
.mode-paiement-item .mode-name { font-size: 0.85rem; color: var(--text-secondary); }
.mode-paiement-item .mode-name .badge { font-size: 0.7rem; margin-left: 4px; }
.mode-paiement-item .mode-amount { font-weight: 700; font-size: 0.9rem; }

/* Legacy billetage-row (kept for compatibility) */
.billetage-row {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
    gap: 12px;
}
.billetage-row:hover { background-color: var(--bg-subtle); }

.denomination-label {
    font-weight: 700;
    min-width: 100px;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.billetage-montant { color: var(--accent); font-size: 0.83rem; }

/* =========================================================
   PROFIL PAGE
   ========================================================= */

/* Hero Banner */
.profil-hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.profil-hero-bg {
    height: 120px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, var(--accent) 100%);
}

.profil-hero-content {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding: 0 28px 20px;
    margin-top: -50px;
    position: relative;
    z-index: 1;
    background: white;
    padding-top: 0;
}

.profil-photo-wrapper {
    position: relative;
    display: inline-block;
    margin-top: -40px;
    flex-shrink: 0;
}

.profil-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(67,97,238,0.25);
    border: 4px solid white;
}
.profil-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profil-photo-initials {
    color: white;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.profil-photo-edit {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.82rem;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}
.profil-photo-edit:hover {
    background: #3730a3;
    transform: scale(1.08);
}

.profil-hero-info {
    padding-bottom: 4px;
}
.profil-hero-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profil-remove-photo-btn {
    font-size: 0.72rem;
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.25);
    background: rgba(239,68,68,0.05);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}
.profil-remove-photo-btn:hover {
    background: rgba(239,68,68,0.12);
    color: var(--danger);
}

/* Stats Bar */
.profil-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.profil-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.profil-stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--accent);
    flex-shrink: 0;
}

.profil-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.profil-stat-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Section Cards */
.profil-section-card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.profil-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.profil-section-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .profil-stats { grid-template-columns: repeat(2, 1fr); }
    .profil-hero-content { padding: 0 20px 16px; }
}
@media (max-width: 575.98px) {
    .profil-stats { grid-template-columns: 1fr; }
    .profil-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profil-hero-name { font-size: 1.15rem; }
}

/* =========================================================
   LOGIN PAGE - Professional v3.0 (Split Layout)
   ========================================================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #2a5298 100%);
    position: relative;
    overflow: hidden;
}
/* Animated floating orbs */
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(67,97,238,0.18), transparent 70%);
    top: -200px; right: -120px;
    animation: loginOrb1 12s ease-in-out infinite alternate;
}
.login-wrapper::after {
    content: '';
    position: absolute;
    width: 450px; height: 450px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124,58,237,0.12), transparent 70%);
    bottom: -120px; left: -120px;
    animation: loginOrb2 10s ease-in-out infinite alternate;
}
@keyframes loginOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-40px, 30px) scale(1.08); }
}
@keyframes loginOrb2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -25px) scale(1.05); }
}

/* Decorative grid pattern */
.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.03) 1px, transparent 0);
    background-size: 40px 40px;
    z-index: 0;
}

/* ---- Left Panel (Branding) ---- */
.login-panel-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 60px 48px;
}
.login-panel-left-content {
    max-width: 380px;
    animation: loginPanelIn 0.8s ease-out;
}
@keyframes loginPanelIn {
    0% { opacity: 0; transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(0); }
}
.login-panel-icon {
    width: 80px; height: 80px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 28px;
    box-shadow: 0 12px 36px rgba(67,97,238,0.4);
    position: relative;
}
.login-panel-icon::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 26px;
    border: 2px solid rgba(255,255,255,0.15);
}
.login-panel-left h1 {
    font-weight: 900;
    font-size: 2.4rem;
    color: #fff;
    letter-spacing: 5px;
    margin-bottom: 8px;
}
.login-panel-subtitle {
    color: rgba(255,255,255,0.55);
    font-size: 0.9rem;
    margin: 0 0 44px;
    letter-spacing: 0.3px;
}
.login-panel-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: rgba(255,255,255,0.75);
}
.login-feature-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    flex-shrink: 0;
}
.login-feature-item strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}
.login-feature-item span {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}
.login-panel-left-footer {
    position: absolute;
    bottom: 24px;
    color: rgba(255,255,255,0.2);
    font-size: 0.72rem;
}

/* ---- Right Panel (Form) ---- */
.login-panel-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 40px 24px;
}
.login-card-v2 {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
    padding: 44px 40px;
    animation: loginCardIn 0.6s ease-out 0.2s both;
}
@keyframes loginCardIn {
    0% { opacity: 0; transform: translateY(24px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mobile brand (hidden on desktop) */
.login-brand-mobile { display: none; text-align: center; margin-bottom: 28px; }
.login-brand-mobile .brand-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(67,97,238,0.35);
}
.login-brand-mobile h3 {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: 3px;
    margin-bottom: 4px;
}
.login-brand-mobile p {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin: 0;
}

/* Welcome v2 */
.login-welcome-v2 {
    margin-bottom: 28px;
}
.login-welcome-v2 h4 {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.login-welcome-v2 p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    margin: 0;
    line-height: 1.5;
}

/* Alert v2 */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    animation: loginShake 0.4s ease;
}
.login-alert-danger {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.15);
    border-left: 3px solid #ef4444;
}
.login-alert-warning {
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.15);
    border-left: 3px solid #f59e0b;
}
.login-alert-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.login-alert-danger .login-alert-icon {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}
.login-alert-warning .login-alert-icon {
    background: rgba(245,158,11,0.1);
    color: #f59e0b;
}
.login-alert-content strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.login-alert-danger .login-alert-content strong { color: #dc2626; }
.login-alert-warning .login-alert-content strong { color: #d97706; }
.login-alert-content span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
@keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Form fields v2 */
.login-form-v2 { display: flex; flex-direction: column; gap: 20px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.login-field-label i { font-size: 0.85rem; color: var(--text-light); }
.login-field-input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-color);
    background: var(--bg-body);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
}
.login-field-input::placeholder { color: var(--text-light); font-size: 0.84rem; }
.login-field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(67,97,238,0.1);
    background: var(--bg-card);
}
.login-password-wrapper {
    position: relative;
}
.login-password-wrapper .login-field-input { padding-right: 48px; }
.login-toggle-pw {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}
.login-toggle-pw:hover {
    color: var(--accent);
    background: rgba(67,97,238,0.06);
}

/* Submit button v2 */
.login-btn-submit {
    width: 100%;
    height: 52px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #5a4ce6);
    border: none;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(67,97,238,0.35);
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}
.login-btn-submit::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s ease;
}
.login-btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 28px rgba(67,97,238,0.5);
    transform: translateY(-2px);
}
.login-btn-submit:hover:not(:disabled)::before { left: 100%; }
.login-btn-submit:active:not(:disabled) { transform: translateY(0); box-shadow: 0 4px 12px rgba(67,97,238,0.3); }
.login-btn-submit:disabled {
    opacity: 0.8;
    cursor: wait;
}
.login-btn-loading {
    background: linear-gradient(135deg, #5a6fd6, #4f46c8);
}

/* Bottom section */
.login-bottom {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.login-secured {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--success);
    font-weight: 600;
    margin-bottom: 8px;
}
.login-secured i { font-size: 0.8rem; }
.login-footer-v2 {
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 0.3px;
}

/* Responsive login */
@media (max-width: 992px) {
    .login-panel-left { display: none; }
    .login-wrapper { align-items: center; justify-content: center; padding: 20px; }
    .login-panel-right { padding: 20px; }
    .login-brand-mobile { display: block; }
}
@media (max-width: 480px) {
    .login-card-v2 { padding: 32px 24px; }
    .login-welcome-v2 h4 { font-size: 1.2rem; }
    .login-brand-mobile .brand-icon { width: 56px; height: 56px; font-size: 1.5rem; }
    .login-brand-mobile h3 { font-size: 1.3rem; }
}

/* =========================================================
   ERROR 404 PAGE - Professional v2.0
   ========================================================= */
.error-page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #2a5298 100%);
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
}
.error-page-wrapper::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(67,97,238,0.15), transparent 70%);
    top: -150px; left: -100px;
    animation: loginOrb2 10s ease-in-out infinite alternate;
}
.error-page-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239,68,68,0.06), transparent 70%);
    bottom: -100px; right: -80px;
    animation: loginOrb1 12s ease-in-out infinite alternate;
}

.error-page-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
    padding: 52px 44px;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: loginCardIn 0.6s ease-out;
}

/* Animated compass ring */
.error-icon-ring {
    position: relative;
    width: 120px; height: 120px;
    margin: 0 auto 24px;
}
.error-icon-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 2.4rem;
    color: var(--accent);
}
.error-ring-svg {
    width: 100%; height: 100%;
}
.error-ring-animated {
    animation: errorRingSpin 4s linear infinite;
    transform-origin: 60px 60px;
}
@keyframes errorRingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error code */
.error-code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 16px;
}
.error-code-digit {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.error-code-dot {
    font-size: 0.5rem;
    color: var(--accent);
    opacity: 0.4;
    margin: 0 2px;
    align-self: center;
}

.error-title {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.error-description {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 16px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.error-url-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(67,97,238,0.06);
    border: 1px solid rgba(67,97,238,0.12);
    border-radius: 20px;
    padding: 6px 16px;
    margin-bottom: 32px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.error-url-badge i { color: var(--accent); font-size: 0.9rem; }
.error-url-badge code {
    background: none;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
}

/* Action buttons */
.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}
.error-btn-primary {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 24px;
    background: linear-gradient(135deg, var(--accent), #5a4ce6);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: var(--radius);
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(67,97,238,0.35);
    transition: all 0.25s ease;
}
.error-btn-primary:hover {
    color: #fff;
    box-shadow: 0 8px 24px rgba(67,97,238,0.5);
    transform: translateY(-2px);
}
.error-btn-secondary {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 24px;
    background: var(--bg-body);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.88rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-color);
    text-decoration: none;
    transition: all 0.25s ease;
}
.error-btn-secondary:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(67,97,238,0.04);
    transform: translateY(-2px);
}

/* Help section */
.error-help-section {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}
.error-help-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.error-help-links {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.error-help-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.error-help-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(67,97,238,0.04);
}
.error-help-links a i { font-size: 0.85rem; }

/* Footer */
.error-page-footer {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
}

/* Responsive 404 */
@media (max-width: 576px) {
    .error-page-card { padding: 36px 24px; }
    .error-code-digit { font-size: 3rem; }
    .error-icon-ring { width: 90px; height: 90px; }
    .error-icon-inner { font-size: 1.8rem; }
    .error-actions { flex-direction: column; }
    .error-btn-primary, .error-btn-secondary { width: 100%; justify-content: center; }
}

/* =========================================================
   CLOTURE CAISSE - Success Confirmation Animation
   ========================================================= */

/* --- Popup shell --- */
.cloture-success-popup {
    border-radius: 18px !important;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.18) !important;
}
.cloture-success-popup .swal2-icon,
.cloture-success-popup .swal2-title {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
}
.cloture-success-popup .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
}
.cloture-success-popup .swal2-actions {
    padding: 0 28px 24px !important;
    margin-top: 0 !important;
}
.cloture-confirm-btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 10px 32px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}
.cloture-confirm-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(16,185,129,0.4) !important;
}

/* --- Entrance / exit --- */
.cloture-swal-enter {
    animation: cloturePopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.cloture-swal-leave {
    animation: cloturePopOut 0.25s ease-in both;
}
@keyframes cloturePopIn {
    0% { opacity: 0; transform: scale(0.7) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes cloturePopOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.9) translateY(-10px); }
}

/* --- Wrapper --- */
.cloture-success-wrap {
    text-align: center;
}

/* --- Header block (green gradient top) --- */
.cloture-header {
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    padding: 28px 24px 22px;
    position: relative;
    overflow: hidden;
}
.cloture-header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.cloture-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

/* Animated SVG check */
.cloture-check-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    margin-bottom: 12px;
    animation: clotureRingPop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.15s both;
}
@keyframes clotureRingPop {
    0% { opacity: 0; transform: scale(0.3); }
    100% { opacity: 1; transform: scale(1); }
}
.cloture-check-svg {
    width: 42px;
    height: 42px;
}
.cloture-check-circle {
    stroke: #fff;
    stroke-width: 2;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    animation: clotureStrokeDraw 0.6s ease 0.4s forwards;
}
.cloture-check-path {
    stroke: #fff;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: clotureStrokeDraw 0.4s ease 0.9s forwards;
}
@keyframes clotureStrokeDraw {
    to { stroke-dashoffset: 0; }
}

.cloture-title {
    color: #fff;
    font-family: var(--font-ui);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px;
    animation: clotureFadeUp 0.4s ease 0.5s both;
}
.cloture-subtitle {
    color: rgba(255,255,255,0.88);
    font-size: 0.88rem;
    font-weight: 500;
    margin: 0;
    animation: clotureFadeUp 0.4s ease 0.65s both;
}
.cloture-subtitle i {
    margin-right: 4px;
    font-size: 0.8rem;
}

/* --- Divider --- */
.cloture-divider {
    height: 3px;
    background: linear-gradient(90deg, var(--success), #34d399, var(--success));
    background-size: 200% 100%;
    animation: clotureDividerShimmer 2s ease infinite;
}
@keyframes clotureDividerShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Sales highlight card --- */
.cloture-ventes-box {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    margin: 20px 24px 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    animation: clotureFadeUp 0.5s ease 0.8s both;
    position: relative;
    overflow: hidden;
}
.cloture-ventes-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #059669, #10b981);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.cloture-ventes-content {
    flex: 1;
    min-width: 0;
}
.cloture-ventes-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #065f46;
    margin-bottom: 2px;
}
.cloture-ventes-montant {
    font-size: 1.65rem;
    font-weight: 800;
    color: #047857;
    line-height: 1.15;
    animation: clotureCountPulse 0.6s ease 1.3s both;
}
.cloture-ventes-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 10px;
    background: rgba(5,150,105,0.12);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #065f46;
}
@keyframes clotureCountPulse {
    0%  { transform: scale(1); }
    40% { transform: scale(1.06); }
    100%{ transform: scale(1); }
}

/* --- Recap section --- */
.cloture-recap {
    margin: 0 24px 20px;
    animation: clotureFadeUp 0.5s ease 1s both;
}
.cloture-recap-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: left;
}
.cloture-recap-title i {
    margin-right: 5px;
}
.cloture-recap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.cloture-recap-item {
    background: var(--bg-subtle);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
}
.cloture-recap-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    margin-bottom: 4px;
}
.cloture-recap-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Ecart bar */
.cloture-ecart-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #065f46;
}
.cloture-ecart-bar i {
    margin-right: 5px;
}
.cloture-ecart-value {
    font-weight: 800;
    font-size: 0.95rem;
    color: #059669;
}

/* --- Shared fade-up keyframe --- */
@keyframes clotureFadeUp {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .cloture-header { padding: 22px 16px 18px; }
    .cloture-ventes-box { margin: 16px 16px 12px; padding: 14px; }
    .cloture-ventes-montant { font-size: 1.35rem; }
    .cloture-recap { margin: 0 16px 16px; }
    .cloture-recap-grid { grid-template-columns: 1fr; }
    .cloture-success-popup { width: 95vw !important; }
    .cloture-success-popup .swal2-actions { padding: 0 16px 18px !important; }
}

/* =========================================================
   DEVELOPER SIGNATURE
   ========================================================= */
.dev-signature {
    text-align: center;
    padding: 14px 20px;
    animation: devSigFadeIn 1s ease 0.8s both;
}
@keyframes devSigFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
.dev-signature-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    margin-bottom: 6px;
}
.dev-signature-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}
.dev-signature-name .dev-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    animation: devDotPulse 2s ease-in-out infinite;
}
@keyframes devDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}
.dev-signature-contact {
    margin-top: 4px;
}
.dev-signature-contact a {
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(67, 97, 238, 0.2);
    background: rgba(67, 97, 238, 0.04);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.dev-signature-contact a:hover {
    background: rgba(67, 97, 238, 0.1);
    border-color: rgba(67, 97, 238, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.15);
}
.dev-signature-contact a i {
    font-size: 0.7rem;
}

/* Signature variant for dark backgrounds (login wrapper bottom) */
.dev-signature-dark {
    position: relative;
    z-index: 1;
    padding: 16px 20px;
    text-align: center;
    animation: devSigFadeIn 1s ease 1.2s both;
}
.dev-signature-dark .dev-signature-label {
    color: rgba(255,255,255,0.35);
}
.dev-signature-dark .dev-signature-name {
    color: rgba(255,255,255,0.7);
}
.dev-signature-dark .dev-signature-contact a {
    color: rgba(255,255,255,0.6);
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
}
.dev-signature-dark .dev-signature-contact a:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Sidebar footer signature (compact, inside footer) */
.sidebar-dev-signature {
    text-align: center;
    padding: 6px 16px 2px;
}
.sidebar-dev-signature small {
    font-size: 0.58rem;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.2px;
}
.sidebar-dev-signature a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    transition: color 0.2s ease;
}
.sidebar-dev-signature a:hover {
    color: rgba(255,255,255,0.65);
}

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.83rem;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   SCROLLBAR GLOBAL
   ========================================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   LOADING / EMPTY STATES
   ========================================================= */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}
.empty-state i {
    font-size: 2.8rem;
    margin-bottom: 14px;
    opacity: 0.25;
    color: var(--accent);
    display: block;
}
.empty-state p {
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =========================================================
   SIDEBAR OVERLAY (mobile)
   ========================================================= */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1035;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* =========================================================
   PRINT
   ========================================================= */
@media print {
    .sidebar, .topbar, .no-print, .sidebar-overlay,
    .pagination-wrapper, .btn-group, .btn-action,
    .page-loader, #ajaxLoader { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .kpi-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .badge { border: 1px solid #999 !important; color: #333 !important; background: #f5f5f5 !important; }
    thead th { background: #f0f0f0 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    tbody tr { animation: none !important; }
    .kpi-card { animation: none !important; }
    .page-content > * { animation: none !important; }
}

/* =========================================================
   ANIMATIONS - v3.0
   ========================================================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.page-content > * { animation: fadeInUp 0.3s ease-out; }
.kpi-card { animation: fadeInUp 0.35s ease-out backwards; }
.kpi-card:nth-child(1) { animation-delay: 0.03s; }
.kpi-card:nth-child(2) { animation-delay: 0.06s; }
.kpi-card:nth-child(3) { animation-delay: 0.09s; }
.kpi-card:nth-child(4) { animation-delay: 0.12s; }
.kpi-card:nth-child(5) { animation-delay: 0.15s; }
.kpi-card:nth-child(6) { animation-delay: 0.18s; }
.kpi-card:nth-child(7) { animation-delay: 0.21s; }

/* Modal animation */
.modal.fade .modal-dialog {
    transform: translateY(-20px) scale(0.98);
    transition: transform 0.25s ease-out;
}
.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* =========================================================
   DROPDOWN MENU
   ========================================================= */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 5px;
    animation: fadeInUp 0.15s ease-out;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 0.83rem;
    transition: background 0.12s;
}
.dropdown-item:hover { background: var(--bg-body); }
.dropdown-item:active { background: #e2e8f0; }

/* =========================================================
   PROGRESS BARS
   ========================================================= */
.progress { background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.progress-bar { transition: width 0.6s ease; }

/* =========================================================
   TICKET MODAL & RECEIPT - Thermal Printer Optimized v3.0
   ========================================================= */
.ticket-modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-width: 360px;
    margin: 0 auto;
}
.ticket-modal-footer {
    background: var(--bg-subtle);
    border-top: 1px solid #e9ecef;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
}
.ticket-modal-footer .btn { min-width: 130px; }

/* ---- Ticket Receipt ---- */
.ticket-receipt {
    font-family: 'Courier New', Courier, monospace;
    background: #fff;
    padding: 16px 16px 12px;
    font-size: 12px;
    color: #000;
    line-height: 1.35;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* En-tete commerce */
.ticket-header {
    text-align: center;
    padding-bottom: 6px;
}
.ticket-logo {
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #000;
    margin-bottom: 2px;
}
.ticket-address {
    font-size: 10px;
    color: #444;
    line-height: 1.4;
}

/* Separateurs */
.ticket-sep {
    border: none;
    border-top: 1px dashed #888;
    margin: 6px 0;
}
.ticket-sep-bold {
    border: none;
    border-top: 2px solid #000;
    margin: 6px 0;
}

/* Info vente */
.ticket-info {
    padding: 2px 0;
}
.ticket-info-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    font-size: 11px;
    color: #333;
}
.ticket-info-row span:last-child {
    font-weight: 700;
    color: #000;
    text-align: right;
}

/* Tableau articles */
.ticket-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin: 2px 0;
}
.ticket-table thead tr {
    border-bottom: 1px solid #000;
}
.ticket-table th {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 0;
    color: #000;
}
.ticket-table td {
    padding: 2px 0;
    vertical-align: top;
    border-bottom: 1px dotted #ccc;
    color: #000;
}
.ticket-table tbody tr:last-child td {
    border-bottom: none;
}
.tt-desc {
    text-align: left;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 42%;
    padding-right: 4px !important;
}
.tt-qty {
    text-align: center;
    width: 10%;
}
.tt-price {
    text-align: right;
    width: 24%;
    padding-right: 4px !important;
    font-size: 10px;
    color: #333;
}
.tt-total {
    text-align: right;
    width: 24%;
    font-weight: 700;
}

/* Grand total */
.ticket-grand-total {
    text-align: center;
    padding: 6px 0 4px;
}
.ticket-gt-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
    margin-bottom: 2px;
}
.ticket-gt-count {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    margin-left: 6px;
    color: #555;
}
.ticket-gt-amount {
    font-size: 22px;
    font-weight: 900;
    color: #000;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Paiement */
.ticket-pay {
    padding: 4px 0;
}
.ticket-pay-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    font-size: 11px;
    color: #333;
}
.ticket-pay-row span:last-child {
    font-weight: 700;
}
.ticket-pay-change {
    font-weight: 700;
    color: #000;
    font-size: 12px;
}
.ticket-pay-change span:last-child {
    font-weight: 900;
}

/* Pied de page */
.ticket-footer {
    text-align: center;
    padding: 4px 0 0;
}
.ticket-thanks {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #000;
}
.ticket-sub {
    margin: 2px 0 0;
    font-size: 9px;
    color: #777;
}

/* ---- Impression ticket thermique ---- */
@media print {
    body.printing-ticket * { visibility: hidden; }
    body.printing-ticket .ticket-receipt,
    body.printing-ticket .ticket-receipt * { visibility: visible; }
    body.printing-ticket .modal-backdrop,
    body.printing-ticket .ticket-modal-footer { display: none !important; }
    body.printing-ticket .modal { position: static; overflow: visible; }
    body.printing-ticket .modal-dialog { margin: 0; padding: 0; max-width: none; }
    body.printing-ticket .ticket-modal-content {
        position: static;
        max-width: none;
        width: 80mm;
        margin: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
    }
    body.printing-ticket .ticket-receipt {
        position: absolute;
        top: 0; left: 0;
        width: 80mm;
        padding: 4mm 3mm;
        font-size: 11px;
        line-height: 1.3;
    }
    body.printing-ticket .ticket-logo { font-size: 14px; }
    body.printing-ticket .ticket-address { font-size: 9px; }
    body.printing-ticket .ticket-info-row { font-size: 10px; }
    body.printing-ticket .ticket-table { font-size: 10px; }
    body.printing-ticket .ticket-table th { font-size: 9px; }
    body.printing-ticket .tt-price { font-size: 9px; }
    body.printing-ticket .ticket-gt-amount { font-size: 18px; }
    body.printing-ticket .ticket-gt-label { font-size: 10px; }
    body.printing-ticket .ticket-pay-row { font-size: 10px; }
    body.printing-ticket .ticket-thanks { font-size: 10px; }
    body.printing-ticket .ticket-sub { font-size: 8px; }
    body.printing-ticket .ticket-sep { border-top: 1px dashed #000; }
    body.printing-ticket .ticket-sep-bold { border-top: 2px solid #000; }

    @page {
        size: 80mm auto;
        margin: 0;
    }
}

/* Impression bilan ventes */
@media print {
    body.printing-bilan .sidebar,
    body.printing-bilan .main-content,
    body.printing-bilan .sidebar-overlay { display: none !important; }
    body.printing-bilan .bv-print-area {
        display: block !important;
        position: static;
        width: 100%;
        padding: 20px 30px;
        background: #fff;
    }
}

/* =========================================================
   GLOBAL LOADING SPINNER
   ========================================================= */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: flex;
    align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.spinner-overlay .spinner-border { width: 3rem; height: 3rem; color: var(--accent); }

/* =========================================================
   CARD TABLE
   ========================================================= */
.card > .table-responsive,
.card-body > .table-responsive { margin: -1px; }

/* =========================================================
   ACTION BUTTONS IN TABLES - v3.0
   ========================================================= */
.btn-group-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}
.btn-group-actions .btn {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: all 0.15s ease;
}
.btn-group-actions .btn:hover {
    transform: scale(1.1);
}

/* =========================================================
   HELPER CLASSES
   ========================================================= */
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fw-800 { font-weight: 800; }
.fs-7 { font-size: 0.85rem; }

/* =========================================================
   TOOLTIP
   ========================================================= */
.tooltip-inner {
    border-radius: 5px; padding: 5px 11px;
    font-size: 0.75rem;
    font-family: var(--font-ui);
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-subtle);
    border-radius: 0 0 var(--radius) var(--radius);
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-size {
    width: auto !important;
    min-width: 110px;
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
}

.pagination.pagination-sm .page-link {
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 0;
    color: var(--text-secondary);
    border-color: var(--border-color);
    font-weight: 600;
    transition: var(--transition-fast);
}

.pagination.pagination-sm .page-item:first-child .page-link { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pagination.pagination-sm .page-item:last-child .page-link  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.pagination.pagination-sm .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(67,97,238,0.25);
}

.pagination.pagination-sm .page-link:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.pagination.pagination-sm .page-item.disabled .page-link {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

@media (max-width: 576px) {
    .pagination-wrapper { flex-direction: column; align-items: stretch; text-align: center; }
    .pagination-wrapper > div { justify-content: center; }
}

/* =========================================================
   SWEETALERT OVERRIDES - v3.0
   ========================================================= */
.swal2-popup {
    font-family: var(--font-ui) !important;
    border-radius: var(--radius-lg) !important;
    padding: 2rem !important;
}
.swal2-title { font-weight: 700 !important; font-size: 1.2rem !important; color: var(--text-primary) !important; }
.swal2-html-container { font-size: 0.88rem !important; color: var(--text-secondary) !important; line-height: 1.6 !important; }
.swal2-confirm {
    font-weight: 600 !important;
    border-radius: var(--radius) !important;
    padding: 10px 28px !important;
    font-size: 0.88rem !important;
}
.swal2-cancel {
    font-weight: 500 !important;
    border-radius: var(--radius) !important;
    padding: 10px 28px !important;
    font-size: 0.88rem !important;
}
.swal2-icon { margin: 1.5rem auto !important; }
.swal2-actions { gap: 10px !important; }

/* =========================================================
   ENHANCED TABLE STYLING - v3.0
   ========================================================= */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--accent-rgb),0.04);
}

/* Alternating subtle stripes */
.table-hover tbody tr:nth-child(even) {
    background-color: var(--bg-subtle);
}
.table-hover tbody tr:nth-child(even):hover {
    background-color: rgba(var(--accent-rgb),0.04);
}

/* Active row (billetage) */
.table tbody tr.table-active {
    background-color: rgba(var(--accent-rgb),0.06) !important;
}
.table tbody tr.table-active td {
    font-weight: 600;
}

/* Last row no border */
.table tbody tr:last-child td {
    border-bottom: none;
}

/* =========================================================
   ENHANCED FORM STYLING - v3.0
   ========================================================= */
.form-control::placeholder,
.form-select::placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Input group refinements */
.input-group .form-control:focus { z-index: 3; }
.input-group-text { font-weight: 500; }

/* Checkbox & Radio */
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12);
    border-color: var(--accent);
}
.form-check-label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Form switch */
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    border-radius: 2em;
    cursor: pointer;
}

/* =========================================================
   ENHANCED BUTTON EFFECTS - v3.0
   ========================================================= */
.btn:active {
    transform: scale(0.97);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239,68,68,0.35);
    transform: translateY(-1px);
}

.btn-outline-info {
    border-width: 1.5px;
}

.btn-outline-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6,182,212,0.2);
}

/* Focus visible for accessibility */
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =========================================================
   ENHANCED ALERT STYLING - v3.0
   ========================================================= */
.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #155e75;
    border-left: 4px solid var(--info);
}

.alert i {
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* =========================================================
   TABLE CARD INTEGRATION
   ========================================================= */
.card > .card-body > .table-responsive {
    margin: -22px;
    margin-top: -8px;
}

.card > .card-body > .table-responsive > .table {
    margin-bottom: 0;
}

.card > .card-body > .table-responsive > .table thead th:first-child { padding-left: 22px; }
.card > .card-body > .table-responsive > .table thead th:last-child  { padding-right: 22px; }
.card > .card-body > .table-responsive > .table tbody td:first-child  { padding-left: 22px; }
.card > .card-body > .table-responsive > .table tbody td:last-child   { padding-right: 22px; }

/* =========================================================
   LOADING STATE FOR BUTTONS
   ========================================================= */
.btn .spinner-border-sm {
    width: 0.85rem;
    height: 0.85rem;
    border-width: 0.15em;
}

/* =========================================================
   TOPBAR UTILITIES
   ========================================================= */
.topbar .user-dropdown .chevron-icon { font-size: 0.7rem; color: var(--text-light); }
.topbar .user-role-text { font-size: 0.75rem; color: var(--text-secondary); }

/* =========================================================
   RESPONSIVE - Complete Adaptive Layout v3.0
   ========================================================= */

/* ---------- XL: Large desktops (< 1200px) ---------- */
@media (max-width: 1200px) {
    .kpi-card .kpi-value { font-size: clamp(0.88rem, 1.6vw, 1.1rem); }
    .page-content { padding: 20px 18px; }
    .page-header h2 { font-size: 1.15rem; }
}

/* ---------- LG: Laptops / Small desktops (< 992px) ---------- */
@media (max-width: 992px) {
    /* Sidebar: off-canvas on mobile */
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    .sidebar.show { margin-left: 0; }
    .main-content { margin-left: 0; width: 100%; }
    .page-content { padding: 18px 14px; }

    /* Topbar: reduce gap */
    .topbar .container-fluid { gap: 8px; }
    .topbar .d-flex.gap-3 { gap: 8px !important; }

    /* KPI cards: 2 per row on tablets */
    .kpi-row-auto > .col { flex: 0 0 50%; max-width: 50%; }

    /* POS: still side-by-side but tighter */
    .pos-toolbar-item .form-select { min-width: 110px; }
}

/* ---------- MD: Tablets (< 768px) ---------- */
@media (max-width: 768px) {
    /* Topbar */
    .topbar .commerce-badge { display: none !important; }
    .topbar { height: 56px; }
    .topbar .btn-sidebar-toggle { width: 38px; height: 38px; }

    /* Page content */
    .page-content { padding: 14px 12px; }
    .page-header { margin-bottom: 16px; gap: 8px; }
    .page-header h2 { font-size: 1.05rem; }

    /* KPI cards */
    .kpi-card { padding: 14px; }
    .kpi-card .kpi-bg-icon { font-size: 3rem; right: 8px; }

    /* Cards */
    .card-body { padding: 16px; }

    /* Filter bars: stack better */
    .row.g-3 { --bs-gutter-y: 0.5rem; --bs-gutter-x: 0.5rem; }
    .form-label { font-size: 0.72rem; margin-bottom: 2px; }
    .form-control, .form-select { font-size: 0.82rem; height: 38px; padding: 6px 10px; }

    /* Tables: compact */
    .table th { font-size: 0.72rem; padding: 8px 6px; }
    .table td { font-size: 0.78rem; padding: 7px 6px; }
    .btn-group-actions .btn { width: 28px; height: 28px; font-size: 0.72rem; }

    /* POS: stack vertically */
    .pos-layout { height: auto; flex-direction: column; }
    .pos-layout > .col-lg-8, .pos-layout > .col-lg-4 { flex: 0 0 100%; max-width: 100%; }
    .pos-left, .pos-right { height: auto; }
    .pos-left { border-right: none; border-bottom: 2px solid var(--border-color); }
    .pos-products-area { max-height: 45vh; }
    .pos-cart-header h5 { font-size: 0.88rem; }
    .pos-cart-total span:last-child { font-size: 1.1rem; }
    .pos-cart-items { max-height: 200px; }
    .pos-products-grid { grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); gap: 8px; }
    .pos-toolbar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
    .pos-toolbar-divider { display: none; }

    /* Billetage */
    .billetage-row { flex-wrap: wrap; }
    .billetage-table .denom-input { width: 55px; }

    /* Modals */
    .modal-dialog { margin: 12px; }
    .modal-body { padding: 18px 16px; }
    .modal-footer .btn { min-width: 110px; padding: 8px 16px; font-size: 0.82rem; }
    .modal-lg, .modal-xl { max-width: calc(100vw - 24px); }

    /* Fermeture journee */
    .fj-recap { padding: 16px; }
    .fj-total-value { font-size: 1.3rem; }
}

/* ---------- SM: Large phones (< 576px) ---------- */
@media (max-width: 576px) {
    /* Topbar */
    .topbar { height: 52px; }
    .topbar .user-info { display: none !important; }
    .topbar .d-flex.gap-3 { gap: 6px !important; }
    .topbar .user-dropdown .chevron-icon { display: none; }

    /* Page layout */
    .page-content { padding: 12px 10px; }
    .page-header { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
    .page-header h2 { font-size: 1rem; }
    .page-header .btn { width: 100%; justify-content: center; }

    /* KPI cards: still 2-col but smaller */
    .kpi-card { padding: 12px 10px; }
    .kpi-card .kpi-value { font-size: clamp(0.85rem, 3.5vw, 1rem); }
    .kpi-card .kpi-icon { width: 36px; height: 36px; font-size: 1rem; }
    .kpi-card .kpi-label { font-size: 0.6rem; letter-spacing: 0.3px; }
    .kpi-card .kpi-bg-icon { display: none; }

    /* Forms */
    .form-control, .form-select { font-size: 0.82rem; height: 40px; }
    .form-label { font-size: 0.72rem; }
    .btn { font-size: 0.78rem; padding: 7px 14px; }
    .btn-lg { font-size: 0.88rem; padding: 10px 20px; }

    /* Tables: touch-friendly */
    .table th { font-size: 0.7rem; padding: 6px 4px; white-space: nowrap; }
    .table td { font-size: 0.76rem; padding: 6px 4px; }
    .btn-group-actions { gap: 3px; }
    .btn-group-actions .btn { width: 30px; height: 30px; font-size: 0.75rem; }
    .td-money { white-space: nowrap; }

    /* Modals: full width */
    .modal-dialog { margin: 8px; }
    .modal-body { padding: 16px 14px; }
    .modal-header { padding: 12px 14px; }
    .modal-header .modal-title { font-size: 0.9rem; }
    .modal-footer { flex-direction: column; padding: 10px 14px; }
    .modal-footer .btn { width: 100%; min-width: auto; }
    .form-section { padding-bottom: 12px; margin-bottom: 12px; }
    .form-section-title { font-size: 0.7rem; }

    /* Cards */
    .card-body { padding: 14px 12px; }
    .card-header { padding: 10px 12px; }

    /* POS mobile */
    .pos-products-area { max-height: 40vh; padding: 8px; }
    .pos-products-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
    .pos-product-card { padding: 10px 6px 8px; }
    .pos-product-card .product-name { font-size: 0.7rem; min-height: 2em; margin-bottom: 4px; }
    .pos-product-card .product-price { font-size: 0.8rem; margin-bottom: 4px; }
    .pos-product-card .product-stock { font-size: 0.6rem; }
    .pos-toolbar { padding: 6px 10px; }
    .pos-toolbar .form-control, .pos-toolbar .form-select { height: 34px; font-size: 0.78rem; }
    .pos-cart-header { padding: 10px 12px; }
    .pos-cart-header h5 { font-size: 0.82rem; }
    .pos-cart-items { max-height: 180px; }
    .pos-cart-total { padding: 8px 12px; }
    .pos-cart-actions { padding: 8px 12px; gap: 6px; }

    /* Pagination compact */
    .pagination-wrapper { flex-direction: column; gap: 8px; align-items: center; }
    .pagination .page-link { padding: 4px 8px; font-size: 0.72rem; min-width: 28px; }

    /* Billetage */
    .billetage-table .denom-input { width: 50px; }

    /* Fermeture journee */
    .fj-recap { padding: 12px; }
    .fj-total-value { font-size: 1.1rem; }
    .fj-caisse-card .card-body { padding: 12px; }
}

/* ---------- XS: Small phones (< 400px) ---------- */
@media (max-width: 400px) {
    .page-content { padding: 10px 8px; }
    .topbar .container-fluid { padding-left: 8px; padding-right: 8px; }

    /* KPI: single column */
    .kpi-row-auto > .col { flex: 0 0 100%; max-width: 100%; }

    /* POS */
    .pos-products-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
    .pos-product-card .product-name { font-size: 0.65rem; }
    .pos-product-card .product-price { font-size: 0.72rem; }

    /* Tables */
    .table th { font-size: 0.65rem; }
    .table td { font-size: 0.72rem; }

    /* Sidebar */
    .sidebar-brand h5 { font-size: 0.95rem; }
    .sidebar-brand .brand-logo { width: 34px; height: 34px; font-size: 1rem; }
    .sidebar-nav .nav-link { font-size: 0.78rem; padding: 8px 12px; }
}

/* ---------- Touch-friendly: ensure min tap targets ---------- */
@media (pointer: coarse) {
    .btn-group-actions .btn { min-width: 34px; min-height: 34px; }
    .form-control, .form-select { min-height: 40px; }
    .nav-link { min-height: 44px; display: flex; align-items: center; }
    .dropdown-item { min-height: 40px; display: flex; align-items: center; }
    .pagination .page-link { min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
}

/* ---------- Landscape phones ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .pos-products-area { max-height: 60vh; }
    .pos-cart-items { max-height: 30vh; }
    .sidebar-brand { padding: 10px 16px 8px; }
    .sidebar-brand .brand-logo { width: 30px; height: 30px; font-size: 0.9rem; margin-bottom: 4px; }
    .sidebar-brand h5 { font-size: 0.9rem; }
    .sidebar-brand small { display: none; }
    .sidebar-nav .nav-link { padding: 6px 14px; min-height: 36px; font-size: 0.78rem; }
    .sidebar-nav .nav-section { padding: 8px 14px 4px; }
}

/* =========================================================
   FERMETURE JOURNEE - Cartes caisses
   ========================================================= */
.fj-caisse-card {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}
.fj-caisse-card.fj-caisse-cloturee {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16,185,129,0.03) 0%, #fff 100%);
}
.fj-caisse-card.fj-caisse-ouverte {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.03) 0%, #fff 100%);
}

.fj-caisse-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.fj-caisse-info i {
    margin-right: 4px;
    color: var(--accent);
}

.fj-caisse-stats {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.fj-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.fj-stat-row.fj-stat-total {
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: 3px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Recapitulatif */
.fj-recap {
    background: linear-gradient(135deg, rgba(16,185,129,0.06) 0%, rgba(67,97,238,0.04) 100%);
    border: 1.5px solid var(--success);
    border-radius: var(--radius);
    padding: 24px;
}
.fj-total-general {
    text-align: right;
}
.fj-total-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 500;
}
.fj-total-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--success);
    line-height: 1.2;
}

/* Bouton fermer journee */
.fj-btn-fermer {
    font-size: 1.05rem;
    padding: 14px 40px;
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(239,68,68,0.3);
    transition: var(--transition);
}
.fj-btn-fermer:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(239,68,68,0.4);
    transform: translateY(-2px);
}
.fj-btn-fermer:disabled {
    opacity: 0.5;
    box-shadow: none;
}

/* =========================================================
   TOAST OFFSET (below topbar)
   ========================================================= */
.toast-top-offset {
    margin-top: 72px !important;
}

/* =========================================================
   SKELETON LOADING (shimmer effect for tables)
   ========================================================= */
@keyframes skeletonShimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-row td {
    padding: 14px 12px !important;
}

.skeleton-cell {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f0f2f5 50%, #e2e8f0 75%);
    background-size: 800px 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.skeleton-cell.w-80 { width: 80%; }
.skeleton-cell.w-60 { width: 60%; }
.skeleton-cell.w-40 { width: 40%; }
.skeleton-cell.w-30 { width: 30%; }

.skeleton-row:nth-child(1) .skeleton-cell { animation-delay: 0s; }
.skeleton-row:nth-child(2) .skeleton-cell { animation-delay: 0.1s; }
.skeleton-row:nth-child(3) .skeleton-cell { animation-delay: 0.2s; }
.skeleton-row:nth-child(4) .skeleton-cell { animation-delay: 0.3s; }
.skeleton-row:nth-child(5) .skeleton-cell { animation-delay: 0.4s; }

/* =========================================================
   TABLE ROW FADE-IN
   ========================================================= */
@keyframes tableRowFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

tbody tr:not(.skeleton-row) {
    animation: tableRowFadeIn 0.25s ease-out backwards;
}

tbody tr:nth-child(1)  { animation-delay: 0s; }
tbody tr:nth-child(2)  { animation-delay: 0.02s; }
tbody tr:nth-child(3)  { animation-delay: 0.04s; }
tbody tr:nth-child(4)  { animation-delay: 0.06s; }
tbody tr:nth-child(5)  { animation-delay: 0.08s; }
tbody tr:nth-child(6)  { animation-delay: 0.10s; }
tbody tr:nth-child(7)  { animation-delay: 0.12s; }
tbody tr:nth-child(8)  { animation-delay: 0.14s; }
tbody tr:nth-child(9)  { animation-delay: 0.16s; }
tbody tr:nth-child(10) { animation-delay: 0.18s; }

/* =========================================================
   EMPTY STATE PULSE
   ========================================================= */
@keyframes emptyStatePulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50%      { opacity: 0.4;  transform: scale(1.05); }
}

.empty-state i {
    animation: emptyStatePulse 2.5s ease-in-out infinite;
}

.empty-state-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* =========================================================
   BUTTON LOADING STATE
   ========================================================= */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinnerRotate 0.6s linear infinite;
    vertical-align: middle;
}

/* =========================================================
   POS TOUCH TARGETS
   ========================================================= */
/* Invisible touch area for mobile */
.pos-cart-item-qty .btn {
    position: relative;
}

.pos-cart-item-qty .btn::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .pos-cart-item-qty .btn {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
}

/* =========================================================
   BILAN VENTES - Impression
   ========================================================= */
.bv-print-area { display: none; }

.bv-print-header { text-align: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid #333; }
.bv-print-title { font-size: 20px; font-weight: 800; margin: 0 0 4px; text-transform: uppercase; }
.bv-print-subtitle { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: #333; }
.bv-print-period { font-size: 13px; color: #666; margin: 0; }

.bv-print-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px; }
.bv-print-table th, .bv-print-table td { border: 1px solid #999; padding: 8px 12px; }
.bv-print-table thead th { background: #eee; font-weight: 600; }
.bv-print-total td { border-top: 2px solid #333; background: #f5f5f5; }
.bv-print-section-title { font-size: 14px; font-weight: 700; margin: 20px 0 8px; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.bv-print-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid #ccc; font-size: 12px; color: #666; }
.bv-print-date { margin-top: 8px; font-style: italic; font-size: 11px; }

/* =========================================================
   PRODUCT PHOTOS
   ========================================================= */

/* Miniature table produits */
.product-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.product-thumb-placeholder { width: 40px; height: 40px; border-radius: 6px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #adb5bd; }

/* Photo section horizontal layout */
.product-photo-section { display: flex; align-items: flex-start; gap: 20px; }
.product-photo-preview { width: 120px; height: 120px; min-width: 120px; border: 2px dashed #dee2e6; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #adb5bd; overflow: hidden; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; }
.product-photo-preview:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(67, 97, 238, 0.12); }
.product-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.product-photo-preview i { font-size: 2rem; margin-bottom: 4px; }
.product-photo-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
@media (max-width: 576px) { .product-photo-section { flex-direction: column; align-items: center; } }

/* Carte POS avec image */
.pos-product-img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.pos-product-icon { width: 70px; height: 70px; border-radius: 8px; background: rgba(67,97,238,0.08); display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 1.5rem; color: var(--accent); }

/* =========================================================
   DASHBOARD V2 — KPI Compare, Alertes, Top items
   ========================================================= */

/* --- KPI Compare Cards (Jour/Semaine/Mois) --- */
.kpi-card-compare {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    transition: transform 0.15s, box-shadow 0.2s;
    background: #fff;
    overflow: hidden;
    position: relative;
}
.kpi-card-compare::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #7c3aed);
}
.kpi-card-compare:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(67,97,238,0.1); }
.kpi-card-compare .card-body { padding: 18px 20px; }

.kpi-compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.kpi-compare-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kpi-compare-label i { font-size: 1.15rem; }

.kpi-variation {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.kpi-variation.up    { background: rgba(16,185,129,0.12); color: #10b981; }
.kpi-variation.down  { background: rgba(239,68,68,0.12);  color: #ef4444; }
.kpi-variation.neutral { background: rgba(108,117,125,0.12); color: #6c757d; }
.kpi-variation i { font-size: 0.9rem; }

.kpi-compare-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.1;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.kpi-compare-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
    gap: 8px;
    flex-wrap: wrap;
}
.kpi-compare-meta b { color: #495057; font-weight: 600; }
.kpi-compare-vs { font-size: 11px; }

/* --- Alertes intelligentes --- */
.dash-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.2s;
    height: 100%;
}
.dash-alert:hover { transform: translateX(3px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); text-decoration: none; color: inherit; }
.dash-alert.alert-critical { border-left-color: #ef4444; }
.dash-alert.alert-warning  { border-left-color: #f59e0b; }
.dash-alert.alert-info     { border-left-color: #06b6d4; }

.dash-alert-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.dash-alert.alert-critical .dash-alert-icon { background: rgba(239,68,68,0.12); color: #ef4444; }
.dash-alert.alert-warning  .dash-alert-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.dash-alert.alert-info     .dash-alert-icon { background: rgba(6,182,212,0.12); color: #06b6d4; }

.dash-alert-body { flex: 1; min-width: 0; }
.dash-alert-title { font-size: 13px; font-weight: 700; color: #1a1a2e; margin-bottom: 2px; }
.dash-alert-msg   { font-size: 12px; color: #6c757d; }
.dash-alert-chevron { color: #adb5bd; font-size: 1.1rem; }

/* --- Top Items (Produits & Caissiers) --- */
.top-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
}
.top-item:last-child { border-bottom: none; }

.top-rank {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.top-avatar-wrap {
    position: relative;
    width: 44px; height: 44px;
    flex-shrink: 0;
}
.top-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.top-avatar-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.top-medal {
    position: absolute;
    bottom: -3px;
    right: -3px;
    background: #fff;
    color: #f59e0b;
    border-radius: 50%;
    padding: 2px 4px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.top-content { flex: 1; min-width: 0; }
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.top-name {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}
.top-value {
    font-weight: 700;
    font-size: 13px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.top-sub {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 5px;
}
.top-progress {
    height: 5px;
    background: #f1f3f5;
    border-radius: 4px;
    overflow: hidden;
}
.top-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* --- Refresh spinner --- */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 0.6s linear infinite; }

/* --- Responsive dashboard --- */
@media (max-width: 768px) {
    .kpi-compare-value { font-size: 1.5rem; }
    .kpi-compare-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* =========================================================
   PLAN DE SALLE - Restaurant/Maquis
   ========================================================= */

.ps-zone-header {
    font-size: 13px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ps-zone-header i { color: var(--accent); }
.ps-zone-header .badge { font-size: 11px; }

.ps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.ps-table {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.ps-table:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.ps-table.ps-libre {
    border-color: rgba(16,185,129,0.3);
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
}
.ps-table.ps-libre:hover { border-color: #10b981; }

.ps-table.ps-occupee {
    border-color: rgba(239,68,68,0.4);
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}
.ps-table.ps-occupee:hover { border-color: #ef4444; }

.ps-table-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: center;
}
.ps-libre .ps-table-status {
    background: rgba(16,185,129,0.15);
    color: #10b981;
}
.ps-occupee .ps-table-status {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}

.ps-table-numero {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
    margin: 6px 0 2px;
    font-variant-numeric: tabular-nums;
}

.ps-table-libelle {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 4px;
}

.ps-table-capacity {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
}
.ps-table-capacity i { margin-right: 3px; }

.ps-table-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ef4444;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

.ps-table-meta {
    font-size: 10px;
    color: #6c757d;
}

@media (max-width: 576px) {
    .ps-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
    .ps-table-numero { font-size: 1.8rem; }
}

/* POS keyboard shortcuts indicator */
.pos-kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #6c757d;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    box-shadow: 0 1px 0 #ced4da;
    line-height: 1;
}

/* =========================================================
   FIDELITE & POS CLIENT
   ========================================================= */

/* Bloc fidelite dans le ticket */
.ticket-fidelity {
    background: linear-gradient(135deg, #fff8e1 0%, #fff 100%);
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 8px;
}
.ticket-fid-title {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 6px;
}
.ticket-fid-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 2px 0;
}
.ticket-fid-row span:first-child { color: #6c757d; }

/* Modal recherche client POS */
.pos-client-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.pos-client-item:hover {
    background: #f8f9fa;
    border-color: var(--accent);
    transform: translateX(3px);
}
.pos-client-info { flex: 1; }
.pos-client-name { font-weight: 600; color: #1a1a2e; font-size: 14px; }
.pos-client-meta { font-size: 11px; color: #6c757d; margin-top: 2px; }
.pos-client-meta i { margin-right: 2px; }

/* =========================================================
   PAGE D ACCUEIL PUBLIQUE - Landing
   ========================================================= */

.welcome-body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #fff;
    color: #1a1a2e;
    overflow-x: hidden;
}

/* ----- NAVBAR ----- */
.welcome-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #e9ecef;
}
.welcome-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}
.welcome-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.welcome-brand-logo svg { width: 40px; height: 40px; }
.welcome-brand-name {
    font-weight: 800;
    font-size: 22px;
    color: #1a1a2e;
    line-height: 1;
}
.welcome-brand-tagline {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.welcome-nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}
.welcome-nav-link {
    color: #495057;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}
.welcome-nav-link:hover { color: #4361ee; }
.welcome-btn-cta {
    background: #4361ee;
    border-color: #4361ee;
    padding: 9px 20px;
    font-weight: 600;
    border-radius: 8px;
}
@media (max-width: 768px) {
    .welcome-nav-links { gap: 12px; }
    .welcome-nav-link { display: none; }
}

/* ----- HERO ----- */
.welcome-hero {
    position: relative;
    padding: 80px 0 100px;
    background: linear-gradient(135deg, #0f1b2d 0%, #1a1a2e 50%, #16213e 100%);
    color: #fff;
    overflow: hidden;
}
.welcome-hero-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(67,97,238,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(124,58,237,0.12) 0%, transparent 50%);
    pointer-events: none;
}
.welcome-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(67,97,238,0.18);
    color: #a5b4fc;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid rgba(67,97,238,0.3);
}
.welcome-hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 24px;
    color: #fff;
    letter-spacing: -1.5px;
}
.welcome-hero-highlight {
    background: linear-gradient(135deg, #4361ee 0%, #a5b4fc 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.welcome-hero-subtitle {
    font-size: 1.15rem;
    color: #cbd5e1;
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 540px;
}
.welcome-hero-subtitle strong { color: #fff; }
.welcome-hero-cta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}
.welcome-btn-main {
    background: #4361ee;
    border-color: #4361ee;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 15px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(67,97,238,0.3);
    transition: all 0.2s;
}
.welcome-btn-main:hover { background: #3a52d4; border-color: #3a52d4; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(67,97,238,0.4); }
.welcome-btn-secondary {
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 15px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s;
}
.welcome-btn-secondary:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.5); color: #fff; }
.welcome-hero-trust {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 13px;
}
.trust-item i { color: #10b981; font-size: 16px; }

/* Hero visual mockups */
.welcome-hero-visual {
    position: relative;
    height: 480px;
}
.hero-mock-card {
    position: absolute;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    color: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
}
.hero-mock-main {
    width: 380px;
    top: 30px;
    right: 0;
    padding: 22px;
    transform: rotate(-2deg);
}
.hero-mock-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #4361ee;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.hero-mock-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.hero-mock-kpi {
    background: #f8f9fa;
    padding: 12px 14px;
    border-radius: 10px;
    border-left: 3px solid #4361ee;
}
.hero-mock-kpi-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.hero-mock-kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1a1a2e;
}
.hero-mock-kpi-var {
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
}
.hero-mock-kpi-var.up { color: #10b981; }
.hero-mock-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    padding: 0 4px;
}
.hero-mock-bar {
    flex: 1;
    background: linear-gradient(180deg, #4361ee 0%, #7c3aed 100%);
    border-radius: 4px 4px 0 0;
    animation: heroBarPulse 2s ease-in-out infinite alternate;
}
@keyframes heroBarPulse {
    from { opacity: 0.85; }
    to { opacity: 1; }
}
.hero-mock-alert {
    padding: 14px 18px;
    bottom: 80px;
    left: -10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: rotate(3deg);
    border-left: 4px solid #f59e0b;
}
.hero-mock-alert > i {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.hero-mock-alert-title { font-size: 13px; font-weight: 700; }
.hero-mock-alert-msg { font-size: 11px; color: #6c757d; }
.hero-mock-fidelity {
    padding: 14px 18px;
    bottom: 0;
    right: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: rotate(-3deg);
    border-left: 4px solid #f59e0b;
}
.hero-mock-fidelity > i {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.hero-mock-fid-title { font-size: 13px; font-weight: 700; }
.hero-mock-fid-points { font-size: 13px; color: #10b981; font-weight: 700; }

@media (max-width: 992px) {
    .welcome-hero { padding: 60px 0 80px; }
    .welcome-hero-title { font-size: 2.5rem; }
}
@media (max-width: 576px) {
    .welcome-hero-title { font-size: 2rem; }
    .welcome-hero-subtitle { font-size: 1rem; }
}

/* ----- SECTIONS ----- */
.welcome-section {
    padding: 90px 0;
    background: #fff;
}
.welcome-section-alt {
    background: #f8f9fa;
}
.welcome-section-header {
    text-align: center;
    margin-bottom: 60px;
}
.welcome-section-eyebrow {
    display: inline-block;
    color: #4361ee;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}
.welcome-section-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 16px;
    letter-spacing: -1px;
}
.welcome-section-lead {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ----- TYPE CARDS ----- */
.welcome-type-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 32px 24px;
    height: 100%;
    transition: all 0.25s;
}
.welcome-type-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-color: #4361ee;
}
.welcome-type-card .type-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.welcome-type-card h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: #1a1a2e;
}
.welcome-type-card p {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}
.welcome-type-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.welcome-type-card ul li {
    font-size: 13px;
    color: #495057;
    padding: 4px 0;
}
.welcome-type-card ul li i {
    color: #10b981;
    margin-right: 6px;
}

/* ----- FEATURES ----- */
.welcome-feature {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    height: 100%;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}
.welcome-feature:hover {
    transform: translateY(-3px);
    border-color: #4361ee;
    box-shadow: 0 12px 28px rgba(67,97,238,0.08);
}
.welcome-feature .feature-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #4361ee, #7c3aed);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 18px;
    box-shadow: 0 6px 16px rgba(67,97,238,0.25);
}
.welcome-feature h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a2e;
}
.welcome-feature p {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* ----- STATS ----- */
.welcome-stats-section {
    background: linear-gradient(135deg, #0f1b2d 0%, #1a1a2e 100%);
    color: #fff;
}
.welcome-stats-section .welcome-section-title { color: #fff; }
.welcome-stats-section .welcome-section-eyebrow { color: #a5b4fc; }
.welcome-stat {
    padding: 30px 20px;
}
.welcome-stat .stat-value {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #4361ee 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 8px;
}
.welcome-stat .stat-label {
    font-size: 14px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ----- CTA FINAL ----- */
.welcome-cta-final {
    padding: 80px 0;
    background: #f8f9fa;
}
.welcome-cta-card {
    background: linear-gradient(135deg, #4361ee 0%, #7c3aed 100%);
    border-radius: 24px;
    padding: 60px 40px;
    text-align: center;
    color: #fff;
    box-shadow: 0 30px 60px rgba(67,97,238,0.25);
}
.welcome-cta-card h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #fff;
}
.welcome-cta-card p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 28px;
}
.welcome-btn-final {
    background: #fff;
    color: #4361ee;
    padding: 14px 36px;
    font-weight: 700;
    font-size: 16px;
    border-radius: 10px;
    border: none;
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}
.welcome-btn-final:hover {
    background: #f8f9fa;
    color: #3a52d4;
    transform: translateY(-2px);
}

/* ----- FOOTER ----- */
.welcome-footer {
    padding: 30px 0;
    background: #1a1a2e;
    color: #94a3b8;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.welcome-footer a { color: #cbd5e1; text-decoration: none; }
.welcome-footer a:hover { color: #fff; }

/* =========================================================
   DARK MODE - Toggle persistant
   ========================================================= */

.btn-darkmode-toggle {
    background: rgba(67,97,238,0.08);
    border: 1px solid rgba(67,97,238,0.15);
    color: #4361ee;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-darkmode-toggle:hover {
    background: rgba(67,97,238,0.15);
    transform: translateY(-1px);
}

/* === Variables override en dark mode === */
html.dark-mode {
    color-scheme: dark;

    /* Les variables neutres sont redefinies ici : tout composant qui les
       utilise bascule automatiquement, sans regle dediee au mode sombre. */
    --bg-body: #0f1419;
    --bg-card: #1a2332;
    --bg-sidebar: #0a0e16;
    --bg-sidebar-hover: rgba(255,255,255,0.07);
    --bg-sidebar-active: rgba(67,97,238,0.28);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-light: #7c869a;
    --text-muted: #64748b;
    --border-color: #2a3548;
    --bg-subtle: #141c28;
    --accent-light: rgba(67,97,238,0.16);
    --success-light: rgba(16,185,129,0.14);
    --danger-light: rgba(239,68,68,0.14);
    --warning-light: rgba(245,158,11,0.14);
    --info-light: rgba(6,182,212,0.14);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.35);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 8px -2px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 22px -6px rgba(0,0,0,0.55);
    --shadow-xl: 0 22px 34px -10px rgba(0,0,0,0.6);
}

/* Zebrure et separateurs de tableau en mode sombre.
   Sans ces regles, une ligne sur deux affichait un texte sombre
   sur le fond sombre de la carte. */
html.dark-mode .table tbody td,
html.dark-mode .table tbody th {
    color: var(--text-primary);
    border-bottom-color: #232c3d;
}
html.dark-mode .table-hover tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.028);
}
html.dark-mode .table-hover tbody tr:hover,
html.dark-mode .table-hover tbody tr:nth-child(even):hover {
    background-color: rgba(255,255,255,0.06);
}
html.dark-mode .table thead th {
    background: #151d29;
    background-image: none;
}
html.dark-mode body {
    background: #0f1419 !important;
    color: #e2e8f0 !important;
}
html.dark-mode .main-content {
    background: #0f1419;
}
html.dark-mode .topbar {
    background: #1a2332 !important;
    border-bottom-color: #2a3548 !important;
}
html.dark-mode .topbar .commerce-badge {
    background: rgba(67,97,238,0.15);
    color: #a5b4fc;
    border-color: rgba(67,97,238,0.25);
}
html.dark-mode .btn-darkmode-toggle {
    background: rgba(255,193,7,0.1);
    border-color: rgba(255,193,7,0.2);
    color: #fbbf24;
}
html.dark-mode .user-name { color: #e2e8f0; }
html.dark-mode .user-role { color: #94a3b8; }
html.dark-mode .chevron-icon { color: #94a3b8; }

/* Sidebar reste sombre par defaut, ajustement leger */
html.dark-mode .sidebar { background: #0a0e16; }

/* Cards & containers */
html.dark-mode .card,
html.dark-mode .modal-content {
    background: #1a2332 !important;
    border-color: #2a3548 !important;
    color: #e2e8f0 !important;
}
html.dark-mode .card-header {
    background: #1a2332 !important;
    border-bottom-color: #2a3548 !important;
}
html.dark-mode .card-body { color: #e2e8f0; }
html.dark-mode .card-header h6,
html.dark-mode .card-header h5 { color: #e2e8f0; }

html.dark-mode .page-header h2 { color: #e2e8f0; }
html.dark-mode .text-muted { color: #94a3b8 !important; }

/* KPI cards */
html.dark-mode .kpi-card,
html.dark-mode .kpi-card-compare {
    background: #1a2332 !important;
    border-color: #2a3548 !important;
}
html.dark-mode .kpi-value,
html.dark-mode .kpi-compare-value { color: #e2e8f0; }
html.dark-mode .kpi-label,
html.dark-mode .kpi-compare-label,
html.dark-mode .kpi-compare-meta { color: #94a3b8; }
html.dark-mode .kpi-compare-meta b { color: #cbd5e1; }

/* Tables */
html.dark-mode .table {
    color: #e2e8f0;
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-hover-bg: rgba(255,255,255,0.04);
    --bs-table-hover-color: #fff;
    --bs-table-striped-bg: rgba(255,255,255,0.02);
    --bs-table-striped-color: #e2e8f0;
}
html.dark-mode .table thead {
    background: #0f1419;
}
html.dark-mode .table thead th {
    color: #94a3b8;
    border-bottom-color: #2a3548 !important;
}
html.dark-mode .table tbody td {
    border-color: #2a3548 !important;
}
html.dark-mode .table-active {
    background-color: rgba(67,97,238,0.1) !important;
    color: #e2e8f0;
}

/* Forms */
html.dark-mode .form-control,
html.dark-mode .form-select {
    background-color: #0f1419 !important;
    border-color: #2a3548 !important;
    color: #e2e8f0 !important;
}
html.dark-mode .form-control::placeholder { color: #64748b; }
html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus {
    background-color: #0f1419 !important;
    border-color: #4361ee !important;
    color: #e2e8f0 !important;
    box-shadow: 0 0 0 0.2rem rgba(67,97,238,0.25);
}
html.dark-mode .form-label { color: #cbd5e1; }
html.dark-mode .input-group-text {
    background: #0f1419 !important;
    border-color: #2a3548 !important;
    color: #94a3b8 !important;
}

/* Buttons */
html.dark-mode .btn-light {
    background: #2a3548 !important;
    border-color: #2a3548 !important;
    color: #e2e8f0 !important;
}
html.dark-mode .btn-light:hover { background: #354155 !important; }
html.dark-mode .btn-outline-secondary {
    color: #94a3b8;
    border-color: #2a3548;
}
html.dark-mode .btn-outline-secondary:hover {
    background: #2a3548;
    color: #e2e8f0;
    border-color: #2a3548;
}

/* Modals */
html.dark-mode .modal-header,
html.dark-mode .modal-footer {
    border-color: #2a3548 !important;
}
html.dark-mode .modal-title { color: #e2e8f0; }
html.dark-mode .btn-close {
    filter: invert(1) brightness(0.8);
}

/* Plan de salle */
html.dark-mode .ps-table {
    background: #1a2332;
    border-color: #2a3548;
}
html.dark-mode .ps-table.ps-libre {
    background: linear-gradient(135deg, rgba(16,185,129,0.08), #1a2332);
}
html.dark-mode .ps-table.ps-occupee {
    background: linear-gradient(135deg, rgba(239,68,68,0.08), #1a2332);
}
html.dark-mode .ps-table-numero { color: #e2e8f0; }
html.dark-mode .ps-zone-header { color: #94a3b8; border-bottom-color: #2a3548; }

/* Top items */
html.dark-mode .top-item { border-bottom-color: #2a3548; }
html.dark-mode .top-name { color: #e2e8f0; }
html.dark-mode .top-progress { background: #2a3548; }

/* Dash alert */
html.dark-mode .dash-alert {
    background: #1a2332;
    color: #e2e8f0;
}
html.dark-mode .dash-alert-title { color: #e2e8f0; }

/* Filter bars / cards body */
html.dark-mode .alert-info {
    background: rgba(6,182,212,0.1);
    border-color: rgba(6,182,212,0.3);
    color: #67e8f9;
}
html.dark-mode .alert-success {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.3);
    color: #6ee7b7;
}

/* Code/kbd elements */
html.dark-mode code { background: #2a3548; color: #fbbf24; }
html.dark-mode .pos-kbd { background: #2a3548; color: #94a3b8; border-color: #354155; box-shadow: 0 1px 0 #1a2332; }

/* POS specific */
html.dark-mode .pos-product-card {
    background: #1a2332;
    border-color: #2a3548;
}
html.dark-mode .pos-product-card .product-name { color: #e2e8f0; }
html.dark-mode .pos-cart { background: #1a2332; border-left-color: #2a3548; }
html.dark-mode .pos-toolbar { background: #1a2332; border-color: #2a3548; }

/* Page loader / overlay */
html.dark-mode .page-loader { background: #0f1419; }
html.dark-mode .loader-text { color: #e2e8f0; }

/* Charts background fix */
html.dark-mode canvas { filter: brightness(0.92); }

/* =========================================================
   PWA - Installation button + standalone mode
   ========================================================= */

.btn-install-pwa {
    background: linear-gradient(135deg, #4361ee, #7c3aed);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    animation: pwa-pulse 2s ease-in-out infinite;
}
.btn-install-pwa:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.45);
}
.btn-install-pwa i { font-size: 1.1rem; }

@keyframes pwa-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3); }
    50%      { box-shadow: 0 4px 20px rgba(67, 97, 238, 0.55); }
}

/* Mode PWA installee (standalone) - ajustements */
@media all and (display-mode: standalone) {
    .topbar {
        padding-top: env(safe-area-inset-top, 0);
    }
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    /* Masquer les elements non pertinents en mode app */
    body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
    input, textarea { -webkit-user-select: text; user-select: text; }
}

/* Mode sombre : bouton PWA garde sa couleur gradient, pas d'override */
html.dark-mode .btn-install-pwa {
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.5);
}

/* =========================================================
   CREDIT LOGOS STUDIO
   Marque Aperture officielle : deux arcs plus point central.
   ========================================================= */
.ls-credit-row {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ls-credit {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    padding: 5px 12px 5px 8px;
    border-radius: 999px;
    border: 1px solid rgba(201, 162, 75, .28);
    background: linear-gradient(120deg, rgba(255, 210, 122, .06), rgba(234, 140, 43, .05));
    transition: border-color .25s ease, background .25s ease, transform .25s ease;
}
.ls-credit:hover {
    border-color: rgba(201, 162, 75, .6);
    background: linear-gradient(120deg, rgba(255, 210, 122, .12), rgba(234, 140, 43, .09));
    transform: translateY(-1px);
}
.ls-credit:focus-visible {
    outline: 3px solid rgba(245, 166, 35, .55);
    outline-offset: 2px;
}

.ls-by {
    font-size: .74rem;
    color: rgba(255, 255, 255, .62);
    letter-spacing: .2px;
    white-space: nowrap;
}

.ls-lockup { display: inline-flex; align-items: center; gap: 8px; }

.ls-mark { flex: none; transition: transform .45s cubic-bezier(.22, 1, .36, 1); }
.ls-credit:hover .ls-mark { transform: rotate(-14deg); }

.ls-word { display: inline-flex; flex-direction: column; line-height: 1; }
.ls-word b {
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    letter-spacing: .2px;
}
.ls-word i {
    font-style: normal;
    font-size: .56rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #F5A623;
    text-transform: uppercase;
    margin-top: 3px;
}

.ls-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, .22);
    flex: none;
}
.ls-phone {
    font-size: .86rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: .2px;
}
.ls-phone:hover { color: #FFD27A; }

/* ---- Variante fond clair ---- */
.ls-credit--light .ls-by { color: var(--text-secondary); }
.ls-credit--light .ls-word b { color: #15171F; }
.ls-credit--light .ls-word i { color: #A8852F; }
.ls-credit-row.on-light .ls-sep { background: var(--border-color); }
.ls-credit-row.on-light .ls-phone { color: var(--text-primary); }
.ls-credit-row.on-light .ls-phone:hover { color: #A8852F; }

/* En mode sombre, la variante claire repasse en blanc */
html.dark-mode .ls-credit--light .ls-arc-solid { stroke: #fff; }
html.dark-mode .ls-credit--light .ls-dot { fill: #fff; }
html.dark-mode .ls-credit--light .ls-word b { color: #fff; }
html.dark-mode .ls-credit--light .ls-word i { color: #F5A623; }
html.dark-mode .ls-credit-row.on-light .ls-phone { color: #e2e8f0; }

/* ---- Compact : barre laterale et petits ecrans ---- */
.ls-credit-row.ls-compact { gap: 8px; }
.ls-credit-row.ls-compact .ls-credit { padding: 4px 10px 4px 7px; gap: 7px; }
.ls-credit-row.ls-compact .ls-by { font-size: .66rem; }
.ls-credit-row.ls-compact .ls-mark { width: 20px; height: 20px; }
.ls-credit-row.ls-compact .ls-word b { font-size: .86rem; }
.ls-credit-row.ls-compact .ls-word i { font-size: .5rem; letter-spacing: 3px; }
.ls-credit-row.ls-compact .ls-phone { font-size: .76rem; }
.ls-credit-row.ls-compact .ls-sep { height: 18px; }

@media (prefers-reduced-motion: reduce) {
    .ls-credit:hover .ls-mark { transform: none; }
    .ls-credit:hover { transform: none; }
}
