:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --green: #16a34a;
    --green-light: #dcfce7;
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --red: #dc2626;
    --red-light: #fef2f2;
    --blue-light: #eff6ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --bg-body: #f9fafb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --sidebar-width: 260px;
}

html.dark {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --green: #22c55e;
    --green-light: #052e16;
    --orange: #f97316;
    --orange-light: #431407;
    --red: #ef4444;
    --red-light: #450a0a;
    --blue-light: #172554;
    --gray-50: #1a1a2e;
    --gray-100: #1f2037;
    --gray-200: #2a2b3d;
    --gray-300: #3b3d56;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;
    --bg-body: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-sidebar: #141425;
    --bg-input: #1f2037;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #2a2b3d;
    --border-light: #1f2037;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    transition: none;
}

/* Transition activée uniquement lors d'un changement de thème manuel */
html.theme-transitioning body,
html.theme-transitioning .sidebar,
html.theme-transitioning .main-content {
    transition: background-color 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
}

.nav-links {
    list-style: none;
    padding: 12px;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-links li a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    text-decoration: none;
}

.nav-links li a.active {
    background: var(--blue-light);
    color: var(--primary);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-weight: 500;
    text-decoration: none;
}

.sidebar-footer a:hover {
    background: var(--red-light);
    color: var(--red);
    text-decoration: none;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 99;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    max-width: 1200px;
}

.main-full {
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

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

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.back-link:hover { color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-danger {
    background: var(--red);
    color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-warning {
    background: var(--orange);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-warning:hover { background: #c2410c; }

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-full { width: 100%; justify-content: center; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
}

.stat-card-sm {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--blue-light); color: var(--primary); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.red { background: var(--red-light); color: var(--red); }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--gray-900); }

.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: var(--gray-50);
}

td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

tr:last-child td { border-bottom: none; }

.total-row td {
    border-top: 2px solid var(--gray-300);
    background: var(--gray-50);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    color: var(--gray-400);
    padding: 32px !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: var(--orange-light); color: var(--orange); }
.badge-accepted { background: var(--green-light); color: var(--green); }
.badge-refused { background: var(--red-light); color: var(--red); }
.badge-returned { background: var(--blue-light); color: var(--primary); }
.badge-partially_returned { background: var(--orange-light); color: var(--orange); }
.badge-active { background: var(--green-light); color: var(--green); }
.badge-archived { background: var(--gray-100); color: var(--gray-500); }
.badge-restock { background: var(--blue-light); color: var(--primary); }
.badge-return { background: var(--green-light); color: var(--green); }
.badge-loss { background: var(--red-light); color: var(--red); }
.badge-assignment { background: var(--orange-light); color: var(--orange); }
.badge-adjustment { background: var(--gray-100); color: var(--gray-600); }

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

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

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
}

/* Sections */
.section {
    margin-top: 24px;
}

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

.section h2,
.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.section-header h2 { margin-bottom: 0; }
.section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* Detail Cards */
.detail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 4px 0;
    box-shadow: var(--shadow);
}

.detail-row {
    display: flex;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    gap: 16px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 160px;
    flex-shrink: 0;
}

/* Period Filter */
.period-filter {
    display: flex;
    gap: 8px;
}

/* Item Rows (assignment form) */
.item-row {
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.item-row .form-row {
    align-items: center;
    margin-bottom: 0;
}

.item-row .form-group { margin-bottom: 0; }

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    color: var(--text-primary);
}

.modal-lg { max-width: 640px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0;
    line-height: 1;
}

.modal-close:hover { color: var(--gray-600); }

.modal form {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Login */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 16px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    margin-top: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.login-header p {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
}

.error-message {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--red-light);
    color: var(--red);
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}

/* Confirm (public) */
.confirm-container {
    width: 100%;
    max-width: 640px;
    padding: 16px;
}

.confirm-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.confirm-header {
    text-align: center;
    margin-bottom: 32px;
}

.confirm-header h1 {
    margin-top: 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}

.confirm-header p {
    margin-top: 8px;
    font-size: 16px;
    color: var(--gray-600);
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 24px;
}

.confirm-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.confirm-icon.green { color: var(--green); }
.confirm-icon.red { color: var(--red); }

.text-center { text-align: center; }

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.3s ease;
    min-width: 200px;
}

.toast-success {
    background: var(--green);
    color: white;
}

.toast-error {
    background: var(--red);
    color: white;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Flash messages */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
}
.flash-error { background: var(--red-light); color: var(--red); }
.flash-success { background: var(--green-light); color: var(--green); }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
}

.tab:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Settings */
.form-help {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 20px;
    line-height: 1.5;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.form-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.test-email-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.test-email-group input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    width: 240px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.test-email-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.status-message {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
}

.status-success {
    background: var(--green-light);
    color: var(--green);
}

.status-error {
    background: var(--red-light);
    color: var(--red);
}

.status-info {
    background: var(--blue-light);
    color: var(--primary);
}

/* Variables reference */
.variables-reference {
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.variables-reference h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.variables-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    align-items: center;
}

.variables-grid code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--primary);
    border: 1px solid var(--border-color);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.variables-grid span {
    font-size: 13px;
    color: var(--gray-600);
}

.variables-reference .form-hint {
    margin-top: 10px;
}

.variables-reference .form-hint code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* Template selector */
.template-selector {
    margin-bottom: 16px;
}

.template-selector label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.template-selector select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.code-textarea {
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    tab-size: 2;
}

/* Preview */
.preview-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-top: 16px;
    box-shadow: var(--shadow);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.preview-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.preview-body h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.preview-body h3 {
    font-size: 15px;
    margin: 12px 0 8px;
}

.preview-body ul {
    margin: 8px 0;
    padding-left: 20px;
}

.preview-body a {
    color: var(--primary);
}

/* Theme Toggle */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s;
    margin-bottom: 4px;
}

.theme-toggle-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.icon-sun { display: none; }
.icon-moon { display: inline; }
.theme-label-dark { display: none; }
.theme-label-light { display: inline; }

html.dark .icon-sun { display: inline; }
html.dark .icon-moon { display: none; }
html.dark .theme-label-dark { display: inline; }
html.dark .theme-label-light { display: none; }

.theme-toggle-float {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text-secondary);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-float:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

html.dark .modal-overlay {
    background: rgba(0,0,0,0.7);
}

html.dark select option {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: block; }
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 64px;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header > div:last-child { width: 100%; }
    .page-header > div:last-child .btn { flex: 1; justify-content: center; }
    .confirm-actions { flex-direction: column; }
    .tabs { flex-wrap: wrap; }
    .tab { padding: 10px 14px; font-size: 13px; }
    .test-email-group { flex-direction: column; width: 100%; }
    .test-email-group input { width: 100%; }
    .form-actions { flex-direction: column; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .actions { flex-direction: column; }
}

/* Barre d'action mobile fixe en bas */
.mobile-action-bar {
    display: none;
}
@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        padding: 12px 16px;
        gap: 10px;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
    }
    .mobile-action-bar .btn {
        flex: 1;
        justify-content: center;
    }
    /* Espace en bas de page pour ne pas masquer le contenu */
    .has-mobile-bar {
        padding-bottom: 80px;
    }
    /* Masquer les boutons du header sur mobile si barre fixe présente */
    .page-header-actions-mobile-hidden {
        display: none !important;
    }
}

/* ── Table responsive mobile (stacked cards) ─────────────────────── */
@media (max-width: 640px) {
    .table-responsive-mobile table,
    .table-responsive-mobile thead,
    .table-responsive-mobile tbody,
    .table-responsive-mobile th,
    .table-responsive-mobile td,
    .table-responsive-mobile tr {
        display: block;
    }
    .table-responsive-mobile thead tr {
        display: none;
    }
    .table-responsive-mobile tbody tr {
        border-bottom: 1px solid var(--border-color);
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .table-responsive-mobile td {
        padding: 2px 0;
        border: none;
        font-size: 14px;
    }
    .table-responsive-mobile td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        display: block;
        margin-bottom: 2px;
    }
    .table-responsive-mobile td.actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        display: flex;
        padding-top: 8px;
    }
    .table-responsive-mobile td.actions::before {
        display: none;
    }
}

/* ── Scanner box ─────────────────────────────────────────────────── */
.scanner-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
#reader {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    min-height: 320px;
}
#reader video {
    width: 100% !important;
    height: auto !important;
    min-height: 280px;
    border-radius: var(--radius);
    display: block !important;
    object-fit: cover;
}
#reader__scan_region {
    width: 100% !important;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 280px;
}
#reader__scan_region img {
    display: none !important;
}
#reader__dashboard {
    padding: 8px 0 0;
}
#reader__dashboard_section_csr button {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 18px !important;
    cursor: pointer !important;
    font-size: 14px !important;
}
#reader__dashboard_section_swaplink,
#reader__filescan_input {
    display: none !important;
}
