/* Interface SYDRACI */

:root {
    /* Color Palette - HSL Dark Mode Default */
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-input: #1f293d;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);

    /* Accent & Brand Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --secondary: #06b6d4;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Status Colors */
    --badge-completed: rgba(16, 185, 129, 0.15);
    --badge-completed-text: #34d399;
    --badge-pending: rgba(245, 158, 11, 0.15);
    --badge-pending-text: #fbbf24;
    --badge-failed: rgba(239, 68, 68, 0.15);
    --badge-failed-text: #f87171;

    /* Layout Geometry */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    /* Fonts */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --bg-input: #edf2f7;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;

    --badge-completed: rgba(16, 185, 129, 0.12);
    --badge-completed-text: #059669;
    --badge-pending: rgba(245, 158, 11, 0.12);
    --badge-pending-text: #d97706;
    --badge-failed: rgba(239, 68, 68, 0.12);
    --badge-failed-text: #dc2626;
}

/* Reset & Base Settings */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* App Layout Grid */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-bounce);
    z-index: 100;
    backdrop-filter: blur(16px);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-sub,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .status-text,
.sidebar.collapsed .badge {
    display: none;
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Profile Switcher Card */
.profile-card {
    margin: 16px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;

}

.profile-info {
    flex: 1;
    overflow: hidden;
}

.profile-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-glow);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.profile-switcher-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.profile-switcher-btn:hover {
    background: var(--primary-hover);
    color: #fff;
}

/* Navigation Links */
.sidebar-nav {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 1.2px;
    margin: 16px 8px 8px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: var(--shadow-glow);
    font-weight: 600;
}

.badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    margin-left: auto;
    font-weight: 700;
}

.badge-accent {
    background: rgba(6, 182, 212, 0.2);
    color: var(--secondary);
}

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

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.status-indicator.online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.status-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
}

.status-sub {
    display: block;
    font-size: 9px;
    color: var(--text-dim);
}

/* Main Content Layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Top App Bar */
.top-bar {
    height: var(--topbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(16px);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    width: 280px;
    transition: var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 13px;
    width: 100%;
}

.search-box svg {
    color: var(--text-dim);
}

.queue-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.queue-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
}

.icon-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-main);
    border-color: var(--primary);
}

/* Content Body */
.content-body {
    padding: 32px;
    flex: 1;
}

/* Metric Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
    backdrop-filter: blur(12px);
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-subtle);
}

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

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon.indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.metric-icon.emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.metric-icon.cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.metric-icon.amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.metric-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric-sub.positive { color: var(--accent); }

/* Card Containers */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
}

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

.panel-title {
    font-size: 16px;
    font-weight: 700;
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-detail-grid,
.partners-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.network-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 20px;
}

.architecture-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.reporting-actions {
    display: flex;
    gap: 10px;
}

.reporting-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.7fr) repeat(6, minmax(135px, 1fr));
    gap: 14px;
    padding: 18px;
    margin-bottom: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 7px;
}

.filter-field span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.filter-field input,
.filter-field select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-main);
    font: 500 13px var(--font-sans);
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.filter-buttons {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.reporting-result-count {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.reporting-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    font-size: 13px;
    font-weight: 700;
}

.reporting-pagination .btn:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.reporting-loading,
.reporting-error {
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-card);
    border-top: 5px solid #ff7900;
    color: var(--text-main);
    font-weight: 800;
    text-align: center;
}

.reporting-error {
    flex-direction: column;
    gap: 12px;
}

.reporting-loading {
    flex-direction: column;
    gap: 16px;
}

.reporting-loading::before {
    content: "";
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, #ff7900 0 10deg, transparent 10deg 30deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 0);
    animation: sydraci-loading-spin .85s linear infinite;
}

.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .38);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.global-loading-overlay[hidden] { display: none; }
.global-loading-overlay.active { opacity: 1; visibility: visible; }

.global-loading-card {
    display: flex;
    width: min(88vw, 310px);
    min-height: 230px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    text-align: center;
}

.global-loading-spinner {
    width: 76px;
    height: 76px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, #ff7900 0 11deg, rgba(100, 116, 139, .22) 11deg 25deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 0);
    animation: sydraci-loading-spin .85s linear infinite;
}

.global-loading-card strong { font-size: 17px; }
.global-loading-card span { color: var(--text-muted); font-size: 12px; }

@keyframes sydraci-loading-spin { to { transform: rotate(1turn); } }

@media (prefers-reduced-motion: reduce) {
    .global-loading-spinner,
    .reporting-loading::before { animation-duration: 1.8s; }
}

.reporting-error span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.filter-field select[multiple] {
    min-height: 86px;
}

.reporting-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.empty-table {
    padding: 40px 16px !important;
    color: var(--text-muted) !important;
    text-align: center;
}

/* Button UI Components */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* Table UI Component */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.font-mono {
    font-family: var(--font-mono);
}

/* Status Badges */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.badge-status.terminer, .badge-status.termine {
    background: var(--badge-completed);
    color: var(--badge-completed-text);
}

.badge-status.en_attente {
    background: var(--badge-pending);
    color: var(--badge-pending-text);
}

.badge-status.echoue {
    background: var(--badge-failed);
    color: var(--badge-failed-text);
}

.badge-status.completed {
    background: var(--badge-completed);
    color: var(--badge-completed-text);
}

.badge-status.pending {
    background: var(--badge-pending);
    color: var(--badge-pending-text);
}

.badge-status.failed,
.badge-status.cancelled {
    background: var(--badge-failed);
    color: var(--badge-failed-text);
}

.transaction-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

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

/* Import Engine Dropzone & Progress UI */
.import-tabs { display: flex; margin-bottom: 16px; border-bottom: 2px solid var(--border-color); overflow-x: auto; }
.import-tab { border: 0; border-bottom: 4px solid transparent; background: transparent; color: var(--text-muted); padding: 14px 22px 12px; font: inherit; font-weight: 700; cursor: pointer; }
.import-tab:hover { color: var(--text-primary); }
.import-tab.active { color: var(--text-primary); border-bottom-color: #ff7900; }

@media (max-width: 600px) {
    .import-tabs { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); }
    .import-tab { padding-inline: 8px; }
}

.upload-dropzone {
    border: 2px dashed var(--border-highlight);
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    text-align: center;
    background: rgba(99, 102, 241, 0.03);
    cursor: pointer;
    transition: var(--transition-fast);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary);
}

.upload-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.progress-container {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
}

.progress-bar-track {
    height: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.stat-box {
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-num {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-mono);
}

.stat-lbl {
    font-size: 11px;
    color: var(--text-dim);
}

/* Modal Overlay */
.transaction-filters { display:grid; grid-template-columns:2fr repeat(5,minmax(120px,1fr)); gap:12px; padding:18px; margin-bottom:16px; background:var(--bg-input); border:1px solid var(--border-color); }
.transaction-filters label,.transaction-form label { display:flex; flex-direction:column; gap:7px; min-width:0; }
.transaction-filters label span,.transaction-form label span { font-size:11px; font-weight:800; text-transform:uppercase; color:var(--text-muted); }
.transaction-filters input,.transaction-filters select,.transaction-form input,.transaction-form select { width:100%; min-height:42px; padding:9px 11px; color:var(--text-primary); background:var(--bg-card); border:1px solid var(--border-highlight); border-radius:0; }
.transaction-filters .filter-buttons { grid-column:1/-1; display:flex; justify-content:flex-end; gap:10px; }
.transaction-totals { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:18px; }
.transaction-totals div { padding:14px; background:var(--bg-input); border-left:4px solid #ff7900; }
.transaction-totals span { display:block; color:var(--text-muted); font-size:11px; margin-bottom:5px; }
.transaction-totals strong { font-size:14px; }
.state-report-wallet-table th,
.state-report-wallet-table td { vertical-align: middle; }
.state-report-wallet-table { width: 100%; table-layout: fixed; }
.state-report-wallet-table .state-col-date { width: 11%; }
.state-report-wallet-table .state-col-distributor { width: 14%; }
.state-report-wallet-table .state-col-name { width: 15%; }
.state-report-wallet-table .state-col-money { width: 15%; }
.state-money-heading { text-align: right !important; }
.state-money-cell { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.state-currency-unit { display: block; margin-top: 2px; font-size: .82em; }
.state-wallet-label { display: block; margin-top: 5px; color: #ff7900; font-weight: 800; }
.state-wallet-name { color: var(--text-main); font-weight: 900; }
.state-row-group { vertical-align: top !important; font-weight: 800; }
.state-report-wallet-table tbody tr:nth-child(4n + 1),
.state-report-wallet-table tbody tr:nth-child(4n + 2) { background: rgba(255, 121, 0, .055); }
.state-report-wallet-table tbody tr:nth-child(2n + 1) td { border-top: 2px solid var(--border-highlight); }
.state-final-balance { font-weight: 900; }
.transaction-modal-card { max-width:820px; max-height:92vh; overflow:auto; border-radius:0; }
.session-modal-card { max-width:620px; border-radius:0; }
.session-modal-card .modal-header p { margin-top:5px; color:var(--text-muted); font-size:12px; }
.session-opening-total { padding:16px; background:var(--bg-input); border-left:4px solid #ff7900; display:flex; justify-content:space-between; gap:12px; }
.transaction-modal-card .modal-header p { margin-top:5px; color:var(--text-muted); font-size:12px; }
.transaction-form { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:20px; }
.transaction-form .form-wide { grid-column:1/-1; }
.transaction-form .form-actions { display:flex; justify-content:flex-end; gap:10px; padding-top:8px; }
.transaction-form label small { color:var(--text-muted); font-size:11px; font-weight:600; }
.transaction-type-fieldset { margin:0; padding:0; border:0; }
.transaction-type-fieldset legend { width:100%; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--border-color); color:var(--text-primary); font-size:14px; font-weight:900; }
.transaction-type-buttons { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.transaction-type-btn { min-height:82px; padding:14px 12px; border:2px solid var(--border-highlight); background:var(--bg-input); color:var(--text-primary); font-weight:800; cursor:pointer; transition:border-color .15s,background .15s,color .15s; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:9px; }
.transaction-type-btn:hover { border-color:#ff7900; }
.transaction-type-btn.active { border-color:#ff7900; background:#ff7900; color:#111; box-shadow:inset 0 -3px 0 #1113; }
.transaction-type-icon { font-size:22px; line-height:1; }
.transaction-section-title { margin-top:8px; padding-bottom:12px; border-bottom:1px solid var(--border-color); font-size:14px; font-weight:900; }
.transaction-form [hidden] { display:none !important; }
.empty-table { padding:32px !important; text-align:center; color:var(--text-muted); }

@media (max-width: 1000px) {
    .transaction-filters { grid-template-columns:repeat(2,1fr); }
    .transaction-totals { grid-template-columns:repeat(2,1fr); }
}

@media (max-width: 640px) {
    .transaction-filters,.transaction-form,.transaction-totals { grid-template-columns:1fr; }
    .transaction-form .form-wide { grid-column:auto; }
    .transaction-type-buttons { grid-template-columns:1fr; }
    .transaction-table thead { display:none; }
    .session-table thead { display:none; }
    .transaction-table,.transaction-table tbody,.transaction-table tr,.transaction-table td,.session-table,.session-table tbody,.session-table tr,.session-table td { display:block; width:100%; }
    .transaction-table tr,.session-table tr { padding:12px; border-bottom:1px solid var(--border-color); }
    .transaction-table td,.session-table td { display:flex; justify-content:space-between; gap:16px; padding:7px 4px !important; border:0; text-align:right; }
    .transaction-table td::before,.session-table td::before { content:attr(data-label); color:var(--text-muted); font-weight:700; text-align:left; }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay[hidden] {
    display: none;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(1);
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.state-pdf-shortcut {
    color: var(--accent);
}

.state-pdf-modal-card {
    max-width: 680px;
}

.state-pdf-intro {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

.state-pdf-form {
    margin-top: 22px;
}

.state-pdf-scope {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border-highlight);
}

.state-pdf-scope legend {
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.state-pdf-scope label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.state-pdf-scope input {
    width: auto;
    min-height: auto;
}

.state-pdf-form .form-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.state-columns-modal-card { max-width: 760px; }
.state-columns-form { display: grid; gap: 18px; margin-top: 20px; }
.state-columns-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.state-columns-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 48vh; overflow-y: auto; padding: 4px; }
.state-columns-grid label { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid var(--border-color); border-radius: 7px; background: var(--surface); font-size: 12px; font-weight: 700; line-height: 1.3; }
.state-columns-grid input { width: auto; margin-top: 1px; accent-color: var(--primary); }
.state-columns-form .form-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 640px) {
    .state-pdf-modal-card { width: calc(100% - 24px); padding: 20px; max-height: calc(100vh - 24px); overflow-y: auto; }
    .state-pdf-scope { align-items: flex-start; flex-direction: column; gap: 12px; }
    .state-columns-modal-card { width: calc(100% - 24px); padding: 20px; max-height: calc(100vh - 24px); overflow-y: auto; }
    .state-columns-grid { grid-template-columns: 1fr; max-height: 45vh; }
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.role-card:hover, .role-card.active {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.role-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
}

.role-icon.admin { background: #6366f1; }
.role-icon.bridge { background: #06b6d4; }
.role-icon.comm { background: #10b981; }
.role-icon.pos { background: #f59e0b; }
.role-icon.partner { background: #ec4899; }
.role-icon.read { background: #64748b; }

.role-title { font-size: 13px; font-weight: 700; }
.role-desc { font-size: 10px; color: var(--text-dim); }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: min(86vw, var(--sidebar-width));
        z-index: 300;
        box-shadow: 20px 0 50px rgba(0, 0, 0, .35);
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .mobile-menu-btn {
        display: block;
    }
    .top-bar {
        padding: 0 16px;
    }
    .content-body {
        padding: 16px;
    }
    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 250;
        background: rgba(2, 6, 23, .66);
        backdrop-filter: blur(2px);
    }
    .reporting-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .filter-search {
        grid-column: span 2;
    }
    .dashboard-detail-grid,
    .network-grid,
    .partners-grid,
    .architecture-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .top-bar {
        height: auto;
        min-height: var(--topbar-height);
        padding: 10px 14px;
        gap: 10px;
    }
    .top-bar-left {
        min-width: 0;
        flex: 1;
    }
    .page-title-group {
        min-width: 0;
    }
    .page-title {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .page-subtitle,
    .queue-chip {
        display: none;
    }
    .top-bar-right {
        gap: 8px;
    }
    .search-box {
        width: 42px;
        height: 42px;
        padding: 0 12px;
    }
    .search-box:focus-within {
        position: absolute;
        left: 14px;
        right: 62px;
        width: auto;
        z-index: 2;
    }
    .search-box input {
        min-width: 0;
    }
    .content-body {
        padding: 12px;
    }
    .panel-card,
    .metric-card {
        padding: 16px;
        border-radius: var(--radius-md);
    }
    .panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .reporting-actions,
    .reporting-actions .btn {
        width: 100%;
    }
    .reporting-actions .btn {
        justify-content: center;
    }
    .reporting-filters,
    .dashboard-detail-grid,
    .network-grid,
    .partners-grid,
    .architecture-grid,
    .role-grid {
        grid-template-columns: 1fr;
    }
    .filter-search {
        grid-column: auto;
    }
    .filter-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .filter-buttons .btn {
        justify-content: center;
        padding-inline: 10px;
    }
    .reporting-toggles {
        flex-direction: column;
    }
    .metrics-grid,
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .metric-value,
    .stat-num {
        font-size: 20px;
        overflow-wrap: anywhere;
    }
    .data-table {
        min-width: 820px;
    }
    .data-table th,
    .data-table td {
        padding: 11px 12px;
    }
    .upload-dropzone {
        padding: 30px 14px;
    }
    .modal-card {
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        padding: 18px;
    }
}

/* Responsive product layout */
.app-layout {
    width: 100%;
}

.dashboard-detail-grid > *,
.network-grid > *,
.partners-grid > *,
.architecture-grid > *,
.metrics-grid > * {
    min-width: 0;
}

@media (max-width: 1180px) {
    .reporting-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .filter-search {
        grid-column: span 2;
    }
    .search-box {
        width: 220px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transition: left .2s ease;
    }
    .sidebar-toggle {
        display: none;
    }
    .main-content {
        width: 100%;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
    .top-bar {
        z-index: 200;
    }
    .reporting-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .filter-search {
        grid-column: span 2;
    }
    .network-grid {
        grid-template-columns: 1fr 1fr;
    }
    .network-grid > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .top-bar-right {
        flex: 0 0 auto;
    }
    .icon-btn,
    .mobile-menu-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        align-items: center;
        justify-content: center;
    }
    .mobile-menu-btn {
        padding: 0;
    }
    .panel-subtitle {
        display: block;
        margin-top: 3px;
        line-height: 1.35;
    }
    .reporting-filters {
        padding: 14px;
        grid-template-columns: 1fr;
    }
    .filter-search,
    .network-grid > :last-child {
        grid-column: auto;
    }
    .panel-card {
        overflow: hidden;
    }
    .table-responsive {
        margin-inline: -16px;
        width: calc(100% + 32px);
        padding-inline: 16px;
    }
    .partners-grid > div > div,
    .dashboard-detail-grid > div > div {
        max-width: 100%;
    }
}

@media (max-width: 540px) {
    .search-box {
        display: none;
    }
    .top-bar {
        padding-inline: 10px;
    }
    .content-body {
        padding: 10px;
    }
    .panel-card,
    .metric-card {
        padding: 14px;
        margin-bottom: 12px;
    }
    .table-responsive {
        margin-inline: -14px;
        width: calc(100% + 28px);
        padding-inline: 14px;
    }
    .page-title {
        font-size: 17px;
    }
    .reporting-actions .btn,
    .filter-buttons .btn {
        width: 100%;
    }
    .filter-buttons {
        grid-template-columns: 1fr;
    }
    .metric-header {
        align-items: flex-start;
    }
    .metric-icon {
        width: 36px;
        height: 36px;
    }
    .progress-header {
        gap: 8px;
        flex-direction: column;
    }
    .reporting-pagination {
        align-items: stretch;
        flex-direction: column;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 420px) {
    .filter-buttons {
        grid-template-columns: 1fr;
    }
}

.login-screen { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #ff790033, transparent 38%), #0f172a; }
.login-screen[hidden] { display: none; }
.login-card { width: min(100%, 430px); padding: 38px; border-radius: 18px; background: #fff; color: #0f172a; box-shadow: 0 24px 70px #0007; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font-size: 15px; font-weight: 900; letter-spacing: .12em; }
.login-brand > span { display: grid; place-items: center; width: 42px; height: 42px; background: #0f172a; color: #fff; font-size: 24px; }
.login-card h1 { margin: 0 0 8px; font-size: 30px; }
.login-card > p { margin: 0 0 26px; color: #64748b; }
.login-form { display: grid; gap: 10px; }
.login-form label { font-size: 13px; font-weight: 800; }
.login-form input[type="text"], .login-form input[type="password"] { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.login-form input:focus { outline: 3px solid #ff790033; border-color: #ff7900; }
.password-field { position: relative; }
.password-field input { padding-right: 82px !important; }
.password-field button { position: absolute; top: 0; right: 5px; height: 48px; border: 0; background: transparent; color: #475569; font-weight: 700; cursor: pointer; }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 600 !important; }
.login-error { min-height: 20px; color: #b91c1c; font-size: 13px; font-weight: 700; white-space: pre-line; overflow-wrap: anywhere; }
.login-submit { min-height: 50px; border: 0; border-radius: 8px; background: #ff7900; color: #111; font: inherit; font-weight: 900; cursor: pointer; }
.login-submit:disabled { opacity: .65; cursor: wait; }
.logout-btn { width: 100%; margin-bottom: 12px; padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 6px; background: transparent; color: var(--text-muted); font-weight: 700; cursor: pointer; }
.logout-btn:hover { border-color: #ff7900; color: #ff7900; }
body:not(.authenticated) #app { visibility: hidden; }
@media (max-width: 480px) { .login-card { padding: 28px 22px; } }

/* Dashboard inspiré de l’application Laravel historique */
.legacy-dashboard { display:grid; gap:28px; color:var(--text-primary); }
.legacy-dashboard-hero { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.legacy-dashboard-hero h2 { margin:0; font-size:30px; font-weight:900; letter-spacing:-.04em; }
.legacy-dashboard-hero p { margin:6px 0 0; color:var(--text-muted); font-size:13px; }
.legacy-dashboard-actions { display:flex; gap:12px; }
.legacy-dashboard-actions .btn { min-height:44px; border-radius:0; padding:0 18px; font-weight:900; }
.legacy-primary { border:1px solid #ff7900; background:#ff7900; color:#111; box-shadow:none; }
.legacy-secondary { border:1px solid var(--border-color); background:var(--bg-card); color:var(--text-primary); }
.legacy-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:16px; }
.legacy-stat { position:relative; overflow:hidden; min-width:0; padding:20px; border:1px solid var(--border-color); border-top:4px solid #111; border-radius:0; background:var(--bg-card); }
.legacy-stat:nth-child(2),.legacy-stat:nth-child(4) { border-top-color:#ff7900; }
.legacy-stat::after { content:""; position:absolute; top:-30px; right:-25px; width:90px; height:90px; border-radius:50%; background:#64748b0d; filter:blur(12px); }
.legacy-stat.green::after { background:#10b98118; }.legacy-stat.orange::after { background:#ff790018; }.legacy-stat.blue::after { background:#38bdf818; }
.legacy-stat-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.legacy-stat-head > span { color:var(--text-muted); font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.legacy-stat-head i { display:grid; place-items:center; width:30px; height:30px; border-radius:8px; background:var(--bg-input); color:var(--text-muted); }
.legacy-stat.green .legacy-stat-head i { background:#10b98118; color:#10b981; }.legacy-stat.orange .legacy-stat-head i { background:#ff790018; color:#ff7900; }.legacy-stat.blue .legacy-stat-head i { background:#38bdf818; color:#38bdf8; }
.legacy-stat-head svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; }
.legacy-stat > strong { display:block; overflow-wrap:anywhere; font-size:21px; font-weight:900; letter-spacing:-.04em; }
.legacy-stat > small { display:flex; align-items:center; gap:6px; min-height:18px; margin-top:5px; color:var(--text-muted); font-size:10px; font-style:normal; }
.legacy-stat > small em { color:#38bdf8; font-style:normal; font-weight:900; }
.live-dot { width:6px; height:6px; border-radius:50%; background:#10b981; box-shadow:0 0 0 4px #10b98117; }.live-dot.orange { background:#ff7900; box-shadow:0 0 0 4px #ff790017; }
.legacy-analytics { display:grid; grid-template-columns:2fr 1fr; gap:24px; }
.legacy-chart-card,.legacy-ranking { padding:24px; border:1px solid var(--border-color); border-top:4px solid #111; border-radius:0; background:var(--bg-card); }
.legacy-chart-card { border-top-color:#ff7900; }
.legacy-chart-card header,.legacy-ranking header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.legacy-chart-card h3,.legacy-ranking h3 { margin:0; font-size:16px; font-weight:900; }.legacy-chart-card header p { margin:4px 0 0; color:var(--text-muted); font-size:11px; }
.legacy-chart-card header > span { display:flex; align-items:center; gap:7px; padding:5px 10px; border:1px solid var(--border-color); border-radius:8px; color:var(--text-muted); font-size:10px; font-weight:800; }.legacy-chart-card header > span i { width:9px; height:9px; border-radius:50%; background:#ff7900; }
.legacy-chart { height:250px; margin-top:20px; position:relative; }.legacy-chart svg { width:100%; height:215px; overflow:visible; }.legacy-chart svg line { stroke:var(--border-color); stroke-dasharray:4; }.legacy-chart .chart-line { fill:none; stroke:#ff7900; stroke-width:3.5; vector-effect:non-scaling-stroke; }.legacy-chart circle { fill:#ff7900; stroke:var(--bg-card); stroke-width:3; vector-effect:non-scaling-stroke; }
.legacy-chart-labels { display:flex; justify-content:space-between; padding-top:8px; border-top:1px solid var(--border-color); color:var(--text-muted); font-size:9px; font-weight:800; text-transform:uppercase; }
.legacy-ranking header > span { padding:4px 8px; border:1px solid #ff790025; border-radius:5px; background:#ff790012; color:#ff7900; font-size:9px; font-weight:900; text-transform:uppercase; }
.legacy-ranking-list { display:grid; gap:18px; margin-top:24px; }.legacy-ranking-list > div { display:flex; align-items:center; gap:12px; }.legacy-ranking-list > div > b { display:grid; place-items:center; flex:0 0 34px; height:34px; border-radius:9px; background:#ff790015; color:#ff7900; font-size:11px; }.legacy-ranking-list section { display:grid; min-width:0; margin-right:auto; }.legacy-ranking-list section strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }.legacy-ranking-list section small { margin-top:3px; color:var(--text-muted); font-size:9px; }.legacy-ranking-list em { white-space:nowrap; font-size:11px; font-style:normal; font-weight:900; }.legacy-empty { padding:45px 0; color:var(--text-muted); text-align:center; font-size:12px; }
.legacy-ranking-link { width:100%; margin-top:24px; padding:10px; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-input); color:var(--text-muted); font-weight:800; cursor:pointer; }.legacy-ranking-link:hover { color:#ff7900; border-color:#ff7900; }
@media (max-width:1100px) { .legacy-stats { grid-template-columns:repeat(2,1fr); }.legacy-stat:last-child { grid-column:span 2; } }
@media (max-width:800px) { .legacy-dashboard-hero { align-items:flex-start; flex-direction:column; }.legacy-analytics { grid-template-columns:1fr; } }
@media (max-width:540px) { .legacy-stats { grid-template-columns:1fr; }.legacy-stat:last-child { grid-column:auto; }.legacy-dashboard-actions { width:100%; flex-direction:column; }.legacy-dashboard-actions .btn { width:100%; }.legacy-chart-card,.legacy-ranking { padding:18px; } }

/* Orange-inspired visual identity: bold contrast, square geometry, clear actions */
:root {
    --primary: #ff7900;
    --primary-hover: #e86f00;
    --primary-glow: rgba(255, 121, 0, .18);
    --secondary: #ffb400;
    --accent: #50be87;
    --warning: #ffd200;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --shadow-subtle: 0 8px 24px rgba(0, 0, 0, .09);
    --shadow-glow: none;
    --font-sans: Arial, Helvetica, sans-serif;
}

[data-theme="light"] {
    --bg-primary: #f4f4f4;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-input: #f1f1f1;
    --border-color: #d5d5d5;
    --border-highlight: #ff7900;
    --text-main: #111111;
    --text-muted: #555555;
    --text-dim: #767676;
}

body {
    letter-spacing: -.01em;
}

.sidebar {
    background: #050505;
    border-right: 0;
    color: #fff;
    backdrop-filter: none;
}

.sidebar-header {
    border-bottom: 1px solid #353535;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: #ff7900;
    border-radius: 0;
    box-shadow: none;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 6px;
    font-size: 25px;
    line-height: 1;
}

.logo-dot {
    color: #fff;
}

.brand-name {
    background: none;
    color: #fff;
    -webkit-text-fill-color: initial;
    font-size: 20px;
}

.brand-sub,
.profile-role-badge {
    color: #ff7900;
}

.profile-card,
.system-status {
    background: #151515;
    border-color: #343434;
}

.profile-avatar {
    background: #ff7900;
    border-radius: 0;
    color: #000;
}

.profile-switcher-btn,
.icon-btn {
    border-radius: 0;
}

.nav-section-label {
    color: #929292;
}

.nav-item {
    color: #dedede;
    border-radius: 0;
    border-left: 4px solid transparent;
    padding-left: 12px;
}

.nav-item:hover {
    background: #1e1e1e;
    color: #fff;
    border-left-color: #ff7900;
}

.nav-item.active {
    background: #ff7900;
    color: #000;
    border-left-color: #ff7900;
    box-shadow: none;
    font-weight: 800;
}

.badge-accent {
    background: #fff;
    color: #000;
}

.sidebar-footer {
    border-color: #353535;
}

.top-bar {
    background: #fff;
    border-bottom: 3px solid #ff7900;
    backdrop-filter: none;
}

.page-title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -.04em;
}

.search-box,
.icon-btn {
    background: #fff;
    border: 2px solid #111;
}

.search-box {
    border-radius: 0;
}

.search-box:focus-within {
    border-color: #ff7900;
    box-shadow: 0 0 0 2px rgba(255, 121, 0, .2);
}

.queue-chip {
    background: #111;
    border: 0;
    border-radius: 0;
}

.queue-label {
    color: #fff;
}

.panel-card,
.metric-card {
    border: 1px solid #d0d0d0;
    border-top: 4px solid #111;
    box-shadow: none;
    backdrop-filter: none;
}

.metric-card:first-child,
.panel-card:hover {
    border-top-color: #ff7900;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: #ff7900;
    box-shadow: var(--shadow-subtle);
}

.metric-title,
.panel-title,
.stat-lbl {
    color: #111;
    font-weight: 800;
}

.panel-title {
    font-size: 20px;
    letter-spacing: -.025em;
}

.metric-value,
.stat-num {
    font-family: var(--font-sans);
    font-weight: 900;
}

.metric-icon.indigo,
.metric-icon.emerald,
.metric-icon.cyan,
.metric-icon.amber {
    background: #ff7900;
    color: #000;
    border-radius: 0;
}

.btn {
    min-height: 42px;
    border-radius: 0;
    font-weight: 800;
}

.btn-primary {
    background: #ff7900;
    color: #000;
    box-shadow: none;
}

.btn-primary:hover {
    background: #000;
    color: #fff;
}

.btn-secondary {
    background: #000;
    border-color: #000;
    color: #fff;
}

.btn-secondary:hover {
    background: #ff7900;
    border-color: #ff7900;
    color: #000;
}

.reporting-filters,
.reporting-toggles,
.stat-box {
    background: #f3f3f3;
    border-radius: 0;
}

.filter-field input,
.filter-field select {
    background: #fff;
    border: 2px solid #9a9a9a;
    border-radius: 0;
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: #ff7900;
    box-shadow: none;
}

.data-table {
    border: 1px solid #d2d2d2;
}

.data-table th {
    background: #050505;
    color: #fff;
    border-color: #050505;
    padding-block: 16px;
}

.data-table tbody tr:nth-child(even) {
    background: #f6f6f6;
}

.data-table tbody tr:hover {
    background: rgba(255, 121, 0, .1);
}

.badge-status {
    border-radius: 0;
}

.upload-dropzone {
    border-color: #111;
    border-radius: 0;
    background: #fafafa;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: #ff7900;
    background: rgba(255, 121, 0, .08);
}

.upload-icon {
    background: #ff7900;
    color: #000;
    border-radius: 0;
}

.modal-card {
    border-radius: 0;
    border-top: 6px solid #ff7900;
}

.role-card {
    border-radius: 0;
}

.role-card:hover,
.role-card.active {
    border-color: #ff7900;
    background: rgba(255, 121, 0, .1);
}

[data-theme="dark"] .top-bar,
[data-theme="dark"] .search-box,
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .filter-field input,
[data-theme="dark"] .filter-field select {
    background: #0a0a0a;
}

[data-theme="dark"] .metric-title,
[data-theme="dark"] .panel-title,
[data-theme="dark"] .stat-lbl {
    color: #fff;
}

[data-theme="dark"] .reporting-filters,
[data-theme="dark"] .reporting-toggles,
[data-theme="dark"] .stat-box {
    background: #161616;
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) {
    background: #151515;
}

[data-theme="dark"] .upload-dropzone {
    background: #101010;
    border-color: #b8b8b8;
}

.metric-card:hover {
    transform: none;
    box-shadow: none;
}

.progress-bar-fill {
    background: #ff7900;
}

@media (max-width: 720px) {
    .top-bar {
        border-bottom-width: 2px;
    }
    .page-title {
        font-size: 19px;
    }
    .panel-card,
    .metric-card {
        border-radius: 0;
    }
}

.wallet-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.commission-summary > h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 900;
}

.commission-summary .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.commission-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 20px 0 24px;
}

.commission-print-heading,.commission-summary-print-heading { display:none; }
.logo-icon { padding:2px; overflow:hidden; background:#fff; }
.logo-icon img { width:100%; height:100%; object-fit:cover; }
.login-logo { display:block; width:min(250px,75vw); height:auto; margin:0 auto; }
.login-brand { justify-content:center; }

/* Générateur d'états */
.state-controls {
    position: relative;
    overflow: hidden;
    border-top-color: #ff7900;
}

.state-controls .panel-header {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}

.state-controls .panel-title {
    font-size: 21px;
    letter-spacing: -.3px;
}

.state-controls .panel-subtitle {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

.state-filters {
    grid-template-columns: repeat(2, minmax(150px, .8fr)) repeat(2, minmax(155px, .8fr)) minmax(280px, 1.6fr);
    align-items: end;
    gap: 18px;
    margin: 0;
    padding: 22px;
    border: 1px solid #d7d7d7;
    border-left: 4px solid #ff7900;
    background: linear-gradient(135deg, #fafafa 0%, #f1f1f1 100%);
}

.state-filters label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.state-filters label > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .55px;
    line-height: 1;
    text-transform: uppercase;
}

.state-filters input,
.state-filters select {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #aaa;
    border-radius: 4px;
    outline: none;
    background: #fff;
    color: #111;
    font: 600 13px var(--font-sans);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.state-filters input:hover,
.state-filters select:hover {
    border-color: #555;
}

.state-filters input:focus,
.state-filters select:focus {
    border-color: #ff7900;
    box-shadow: 0 0 0 3px rgba(255, 121, 0, .16);
}

.state-distributor-field {
    position: relative;
}

.state-distributor-match {
    min-height: 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.state-distributor-match.matched { color: #177245; }
.state-distributor-match.not-found { color: var(--danger); }

.commission-summary-table th,
.commission-summary-table td {
    white-space: nowrap;
    text-align: right;
}

.commission-summary-table th:first-child,
.commission-summary-table td:first-child { text-align: left; }

.commission-summary-table thead th {
    white-space: normal;
    vertical-align: bottom;
    background: #d9e2f3;
    color: #000;
}

.commission-summary-table thead th:nth-child(7),
.commission-summary-table tbody td:nth-child(7),
.commission-summary-table tfoot th:nth-child(7) { background: #f4b183; }

.commission-summary-table thead th:nth-child(8),
.commission-summary-table tbody td:nth-child(8),
.commission-summary-table tfoot th:nth-child(8) { background: #ffff00; }

.commission-summary-table thead th:nth-child(12),
.commission-summary-table tbody td:nth-child(12),
.commission-summary-table tfoot th:nth-child(12) { background: #c6e0b4; }

.commission-summary-table tfoot th {
    border-top: 2px solid #ff7900;
    background: #d9e2f3;
    color: #000;
}

.commission-summary-note {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 11px;
}

.commission-category-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}
.commission-kpi-card {
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.commission-kpi-card span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9a3412;
    letter-spacing: 0.5px;
}
.commission-kpi-card strong {
    font-size: 14px;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.commission-kpi-card.commission-kpi-total {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.commission-kpi-card.commission-kpi-total span {
    color: #1e40af;
}
.commission-category-summary-wrap {
    margin-bottom: 22px;
}
.commission-category-summary-title,
.commission-pdv-detail-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary, #111);
    margin: 14px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.commission-category-summary-table {
    width: 100%;
    margin-bottom: 12px;
}
.commission-category-summary-table thead th {
    background: #d9e2f3;
    font-weight: 700;
}
.commission-category-summary-table tfoot th {
    background: #fed7aa;
    font-weight: 800;
}

.settings-tabs { display:flex; border-bottom:1px solid var(--border-color); margin-bottom:22px; }
.settings-tab { border:0; border-bottom:3px solid #ff7900; background:transparent; padding:12px 18px; color:var(--text-primary); font:700 14px var(--font-sans); }
.utility-panel { display:grid; gap:22px; }
.utility-warning { display:flex; flex-direction:column; gap:6px; padding:16px; border-left:4px solid #ff7900; background:rgba(255,121,0,.08); }
.utility-warning span,.utility-form small,.utility-delete-form small { color:var(--text-muted); font-size:12px; }
.utility-form,.utility-delete-form { display:flex; align-items:end; gap:14px; flex-wrap:wrap; }
.utility-form label,.utility-delete-form label { display:grid; gap:7px; min-width:280px; }
.utility-form select,.utility-form input,.utility-delete-form input { min-height:44px; padding:0 12px; border:1px solid var(--border-color); border-radius:6px; background:var(--bg-card); color:var(--text-primary); }
.utility-result { display:grid; gap:18px; padding-top:18px; border-top:1px solid var(--border-color); }
.utility-success { color:#177245; font-weight:700; }

.state-filters .filter-buttons {
    margin-top: 2px;
    padding-top: 18px;
    border-top: 1px solid #d5d5d5;
}

.state-filters .filter-buttons .btn {
    min-width: 148px;
    min-height: 46px;
    justify-content: center;
    padding-inline: 22px;
    font-weight: 800;
}

.state-filters-without-distributor {
    grid-template-columns: minmax(190px, 1fr) repeat(2, minmax(170px, 1fr));
}

.state-filters-group {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.procurement-table-wrap { max-height: 70vh; }
.procurement-tracking-table { width: max-content; min-width: 100%; font-size: 10px; }
.procurement-tracking-table th,
.procurement-tracking-table td { min-width: 74px; padding: 7px 6px; white-space: nowrap; text-align: right; }
.procurement-tracking-table th:first-child,
.procurement-tracking-table td:first-child { position: sticky; left: 0; z-index: 2; min-width: 180px; text-align: left; background: var(--bg-card); }
.procurement-tracking-table thead th { position: sticky; top: 0; z-index: 3; background: #d9e2f3; color: #111; }
.procurement-tracking-table thead tr:nth-child(2) th { top: 37px; }
.procurement-tracking-table thead th:first-child { z-index: 4; }
.procurement-tracking-table tfoot th { border-top: 2px solid #ff7900; background: #d9e2f3; color: #111; }
.procurement-performance { font-weight: 800; text-align: center !important; }
.procurement-performance.yes { color: #177245; background: #e2f0d9; }
.procurement-performance.no { color: #a12622; background: #fce4d6; }
.procurement-other-toggle { display:flex; flex-direction:column; align-items:flex-start; gap:2px; width:100%; padding:0; border:0; background:transparent; color:#d86100; font:inherit; font-weight:800; text-align:left; cursor:pointer; }
.procurement-other-toggle small { color:var(--text-muted); font-size:9px; font-weight:600; }
.procurement-other-toggle:hover span { text-decoration:underline; }
.procurement-other-toggle:focus-visible { outline:2px solid #ff7900; outline-offset:3px; border-radius:3px; }
.procurement-other-details td:first-child { position:static; min-width:0; padding:12px; white-space:normal; background:var(--bg-secondary); }
.procurement-other-details > td > div { position:sticky; left:12px; width:min(900px, 80vw); text-align:left; }
.procurement-other-details-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.procurement-pdv-download { min-height:34px; padding:7px 11px; white-space:nowrap; }
.procurement-pdv-list { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; max-height:220px; overflow:auto; }
.procurement-pdv-list span { padding:5px 8px; border:1px solid var(--border-color); border-radius:5px; background:var(--bg-card); color:var(--text-main); font-size:11px; }
.state-export-actions { display:flex; align-items:center; justify-content:flex-end; gap:9px; flex-wrap:wrap; }
.state-excel-dropdown { position:relative; }
.state-excel-dropdown-toggle { display:flex; align-items:center; gap:8px; }
.state-excel-dropdown-menu { position:absolute; z-index:30; top:calc(100% + 7px); right:0; min-width:190px; overflow:hidden; border:1px solid var(--border-color); border-radius:8px; background:var(--bg-card); box-shadow:0 14px 32px rgba(15,23,42,.18); }
.state-excel-dropdown-menu[hidden] { display:none; }
.state-excel-dropdown-menu button { display:block; width:100%; padding:11px 14px; border:0; border-bottom:1px solid var(--border-color); background:transparent; color:var(--text-main); font:inherit; font-size:12px; font-weight:700; text-align:left; cursor:pointer; }
.state-excel-dropdown-menu button:last-child { border-bottom:0; }
.state-excel-dropdown-menu button:hover,.state-excel-dropdown-menu button:focus-visible { background:var(--bg-secondary); color:var(--primary); outline:0; }
.procurement-print-one { min-height: 32px; padding: 6px 9px; font-size: 10px; white-space: nowrap; }
.procurement-commercial-print-pages { display: none; }

[data-theme="dark"] .state-filters {
    border-color: #383838;
    border-left-color: #ff7900;
    background: linear-gradient(135deg, #181818 0%, #111 100%);
}

[data-theme="dark"] .state-filters input,
[data-theme="dark"] .state-filters select {
    border-color: #555;
    background: #080808;
    color: #fff;
}

[data-theme="dark"] .state-filters .filter-buttons {
    border-top-color: #383838;
}

@media (max-width: 1280px) {
    .state-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .state-distributor-field { grid-column: span 2; }
}

@media (max-width: 760px) {
    .state-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px; }
}

@media (max-width: 520px) {
    .state-filters { grid-template-columns: 1fr; padding: 15px; }
    .state-distributor-field { grid-column: auto; }
    .state-filters .filter-buttons { grid-template-columns: 1fr; }
    .state-filters .filter-buttons .btn { width: 100%; }
}

@media print {
    @page { size: landscape; margin: 10mm; }
    @page state-report { size: A4 portrait; margin: 12mm; }
    @page procurement-commercial { size: A4 portrait; margin: 6mm; }
    body { background:#fff !important; color:#000 !important; }
    .sidebar,.top-bar,.modal-overlay,.reporting-filters,.reporting-actions,.reporting-pagination,.state-controls,.state-print-button,.state-export-actions { display:none !important; }
    .app-layout,.main-content,.content-body { display:block !important; width:100% !important; margin:0 !important; padding:0 !important; }
    .commission-print-area { border:0 !important; box-shadow:none !important; padding:0 !important; }
    .commission-print-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:14px; padding-bottom:10px; border-bottom:2px solid #ff7900; font-size:12px; }
    .commission-print-heading div { display:flex; align-items:center; gap:12px; }
    .commission-print-heading img { width:72px; height:54px; object-fit:contain; }
    .commission-metrics { grid-template-columns:repeat(4,1fr) !important; break-inside:avoid; }
    .commission-metrics .stat-box { border:1px solid #aaa; padding:8px; }
    .commission-print-area .table-responsive { overflow:visible; }
    .commission-print-area .data-table { font-size:8px; }
    .commission-print-area .data-table th,.commission-print-area .data-table td { padding:5px 4px; color:#000 !important; background:#fff !important; }
    .commission-print-area .data-table th { border-bottom:2px solid #000; }
    .state-print-area { border:0 !important; box-shadow:none !important; padding:0 !important; }
    .state-print-area .table-responsive { overflow:visible !important; }
    .state-print-area .data-table { font-size:8px; }
    .state-print-area .data-table th,.state-print-area .data-table td { padding:5px 4px; color:#000 !important; background:#fff !important; }
    .state-print-area .data-table thead { display:table-header-group; }
    .state-print-area .data-table tr { break-inside:avoid; }
    .procurement-other-details { display:none !important; }
    .procurement-other-toggle { color:#000 !important; cursor:default; }
    .procurement-other-toggle small { display:none !important; }
    .state-report-wallets { page: state-report; }
    .commission-summary-print-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; margin:0 0 8mm; padding:0 0 4mm; border-bottom:2px solid #ff7900; font-size:9px; }
    .commission-summary-print-heading > div { display:flex; align-items:center; gap:10px; }
    .commission-summary-print-heading > div:last-child { flex-direction:column; align-items:flex-end; gap:2px; }
    .commission-summary-print-heading img { width:62px; height:42px; object-fit:contain; }
    .commission-summary-print-heading strong { display:block; font-size:15px; text-transform:uppercase; }
    .commission-summary-print-heading span { display:block; }
    .commission-summary-print > .panel-header { display:none !important; }
    .commission-summary-print { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
    .commission-category-kpis { display:flex !important; justify-content:space-between; gap:4px; margin:0 0 3mm; }
    .commission-kpi-card { flex:1; padding:3px 5px; border:1px solid #fed7aa !important; background:#fff7ed !important; border-radius:3px; }
    .commission-kpi-card span { font-size:6px; font-weight:700; color:#9a3412 !important; }
    .commission-kpi-card strong { font-size:7.5px; font-weight:700; color:#000 !important; }
    .commission-kpi-card.commission-kpi-total { background:#eff6ff !important; border-color:#bfdbfe !important; }
    .commission-kpi-card.commission-kpi-total span { color:#1e40af !important; }
    .commission-category-summary-title,
    .commission-pdv-detail-title { font-size:7.5px; font-weight:700; margin:2.5mm 0 1mm; text-transform:uppercase; color:#000 !important; }
    .commission-category-summary-table { width:100%; border-collapse:collapse; font-size:6px; margin-bottom:2.5mm; }
    .commission-category-summary-table th,
    .commission-category-summary-table td { padding:2px 3px; border:1px solid #111 !important; text-align:right; }
    .commission-category-summary-table th:first-child,
    .commission-category-summary-table td:first-child { text-align:left; }
    .commission-category-summary-table thead th { background:#d9e2f3 !important; font-weight:700; }
    .commission-category-summary-table tfoot th { background:#fed7aa !important; font-weight:800; }
    .commission-summary-print .data-table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:6.5px; line-height:1.15; }
    .commission-summary-print .data-table thead { display:table-header-group; }
    .commission-summary-print .data-table tfoot { display:table-row-group; }
    .commission-summary-print .data-table th,.commission-summary-print .data-table td { white-space:normal; overflow-wrap:anywhere; padding:3px 2px; border:1px solid #111 !important; text-align:right; }
    .commission-summary-print .data-table th:first-child,.commission-summary-print .data-table td:first-child { text-align:left; }
    .commission-summary-print .data-table thead th { height:42px; vertical-align:bottom; background:#d9e2f3 !important; font-weight:700; }
    .commission-summary-print .data-table thead th:nth-child(5),.commission-summary-print .data-table tbody td:nth-child(5) { background:#f4b183 !important; }
    .commission-summary-print .data-table thead th:nth-child(6),.commission-summary-print .data-table tbody td:nth-child(6) { background:#fff200 !important; }
    .commission-summary-print .data-table thead th:nth-child(10),.commission-summary-print .data-table tbody td:nth-child(10) { background:#c6e0b4 !important; }
    .commission-summary-print .data-table tfoot th { background:#d9e2f3 !important; border-top:2px solid #111 !important; font-weight:800; }
    .commission-summary-print .data-table tfoot th:nth-child(5) { background:#f4b183 !important; }
    .commission-summary-print .data-table tfoot th:nth-child(6) { background:#fff200 !important; }
    .commission-summary-print .data-table tfoot th:nth-child(10) { background:#c6e0b4 !important; }
    .commission-summary-note { color:#000 !important; font-size:8px; }
    .procurement-tracking-print { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
    .procurement-tracking-print > .panel-header { display:none !important; }
    .procurement-tracking-print .procurement-table-wrap { max-height:none; overflow:visible !important; }
    .procurement-tracking-print .procurement-tracking-table { width:100%; min-width:0; table-layout:fixed; font-size:4px; line-height:1.05; }
    .procurement-tracking-print .procurement-tracking-table th,.procurement-tracking-print .procurement-tracking-table td { position:static; min-width:0; padding:2px 1px; white-space:normal; border:1px solid #333 !important; }
    .procurement-tracking-print .procurement-tracking-table th:first-child,.procurement-tracking-print .procurement-tracking-table td:first-child { width:24mm; background:#fff !important; }
    .procurement-tracking-print .procurement-tracking-table thead th,.procurement-tracking-print .procurement-tracking-table tfoot th { background:#d9e2f3 !important; }
    .procurement-tracking-print .procurement-performance.yes { background:#e2f0d9 !important; }
    .procurement-tracking-print .procurement-performance.no { background:#fce4d6 !important; }
    body.procurement-print-mode .procurement-screen-summary { display:none !important; }
    body.procurement-print-mode .procurement-commercial-print-pages { display:block !important; }
    body.procurement-print-single .procurement-commercial-page:not(.print-target) { display:none !important; }
    .procurement-commercial-page {
        page: procurement-commercial;
        display:flex;
        flex-direction:column;
        box-sizing:border-box;
        width:100%;
        height:284mm;
        overflow:hidden;
        break-after:page;
        page-break-after:always;
        color:#111;
        background:#fff;
        font-family:Arial,sans-serif;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }
    .procurement-commercial-page:last-child,
    body.procurement-print-single .procurement-commercial-page.print-target { break-after:auto; page-break-after:auto; }
    .procurement-commercial-header { display:flex; align-items:center; gap:4mm; min-height:16mm; padding-bottom:2.5mm; border-bottom:1.2pt solid #ff7900; }
    .procurement-commercial-header img { width:19mm; height:13mm; object-fit:contain; }
    .procurement-commercial-header h2 { margin:0 0 1mm; font-size:14pt; line-height:1; letter-spacing:.2pt; }
    .procurement-commercial-header p { margin:0; font-size:8.5pt; }
    .procurement-commercial-identity { padding:2.2mm 0 1.8mm; }
    .procurement-commercial-identity h3 { margin:0 0 1.2mm; color:#d86100; font-size:12pt; line-height:1; }
    .procurement-commercial-identity > div { display:grid; grid-template-columns:1fr .55fr 1fr; gap:3mm; font-size:8pt; }
    .procurement-commercial-kpis { display:grid; grid-template-columns:repeat(3,1fr); gap:1.2mm; margin-bottom:2mm; }
    .procurement-commercial-kpis div { display:flex; align-items:center; justify-content:space-between; gap:2mm; min-height:8mm; padding:1.2mm 1.8mm; border:1px solid #bbb; background:#f5f5f5 !important; }
    .procurement-commercial-kpis span { font-size:7.2pt; font-weight:700; text-transform:uppercase; }
    .procurement-commercial-kpis strong { font-size:8.3pt; white-space:nowrap; }
    .procurement-commercial-kpis .is-performing { background:#e2f0d9 !important; }
    .procurement-commercial-kpis .is-not-performing { background:#fce4d6 !important; }
    .procurement-commercial-daily { width:100%; border-collapse:collapse; table-layout:fixed; font-size:7.2pt; line-height:1; font-variant-numeric:tabular-nums; }
    .procurement-commercial-daily th,
    .procurement-commercial-daily td { height:4.65mm; box-sizing:border-box; padding:.55mm 1.5mm; border:.5pt solid #aaa; text-align:right; }
    .procurement-commercial-daily th:first-child,
    .procurement-commercial-daily td:first-child { width:22%; text-align:left; }
    .procurement-commercial-daily thead th { height:5.4mm; background:#d9e2f3 !important; font-size:7.4pt; }
    .procurement-commercial-daily tbody tr:nth-child(even) td { background:#f8f8f8 !important; }
    .procurement-commercial-daily tbody tr.has-activity td { background:#fff1e6 !important; font-weight:700; }
    .procurement-commercial-daily tfoot th { height:5.4mm; border-top:1.2pt solid #111; background:#d9e2f3 !important; font-weight:800; }
    .procurement-commercial-page footer { display:flex; justify-content:space-between; gap:5mm; margin-top:auto; padding-top:1.5mm; color:#444; font-size:6.8pt; }
    .state-report-wallets .panel-header { margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid #ff7900; }
    .state-report-wallet-table { font-size: 10px !important; border: 1px solid #555; }
    .state-report-wallet-table th { overflow-wrap: anywhere; background: #f2f2f2 !important; border: 1px solid #555 !important; font-size: 8px; line-height: 1.2; }
    .state-report-wallet-table td { border: 1px solid #777 !important; padding: 9px 4px !important; }
    .state-report-wallet-table th:nth-child(-n+3),
    .state-report-wallet-table td:nth-child(-n+3) { font-size: 8.5px; }
    .state-report-wallet-table .state-money-cell { font-size: 9px; letter-spacing: -.15px; }
    .state-report-wallet-table .state-row-group,
    .state-report-wallet-table .state-wallet-name { overflow-wrap: anywhere; }
    .state-wallet-label,.state-wallet-name { color: #000 !important; font-size: 9px; }
}

.wallet-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 5px solid #ff7900;
    padding: 18px;
}

.wallet-summary h4 {
    margin-bottom: 16px;
    font-size: 17px;
    font-weight: 900;
}

.recharge-summary {
    border-top-color: var(--accent);
}

.wallet-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.wallet-values div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.wallet-values span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.wallet-values strong {
    overflow-wrap: anywhere;
    font-size: 18px;
    font-weight: 900;
}

.amount-debit { color: var(--danger); }
.amount-credit { color: var(--accent); }
.amount-final { color: #ff7900; }

@media (max-width: 720px) {
    .wallet-summary-grid {
        grid-template-columns: 1fr;
    }
    .commission-summary .metrics-grid {
        grid-template-columns: 1fr;
    }
    .commission-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .wallet-values {
        grid-template-columns: 1fr;
    }
}
.import-preview{margin-top:20px;padding:20px;border:1px solid var(--border-color);border-radius:14px;background:var(--surface)}
.import-preview-header,.import-preview-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.import-preview-header div{display:grid;gap:4px}.import-preview-header span,.import-preview-sheets small{color:var(--text-muted)}
.import-preview-sheets{display:grid;gap:10px;margin:16px 0}.import-preview-sheets article{display:grid;grid-template-columns:minmax(140px,1fr) auto;gap:4px 16px;padding:12px;border-radius:10px;background:var(--background)}.import-preview-sheets small{grid-column:1/-1;overflow-wrap:anywhere}
.import-warning,.import-error{padding:10px 12px;border-radius:8px;margin:8px 0}.import-warning{background:rgba(245,158,11,.12);color:var(--warning)}.import-error{background:rgba(239,68,68,.12);color:var(--danger)}.import-preview-actions{justify-content:flex-end;margin-top:16px}
.portfolio-wizard-steps{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:20px 0}.portfolio-wizard-steps>div{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--border-color);border-radius:10px;color:var(--text-muted);background:var(--background)}.portfolio-wizard-steps span{display:grid;place-items:center;width:26px;height:26px;flex:0 0 26px;border-radius:50%;background:var(--surface);font-weight:800}.portfolio-wizard-steps .active{border-color:var(--primary);color:var(--primary);background:rgba(249,115,22,.08)}.portfolio-wizard-steps .active span{color:#fff;background:var(--primary)}.portfolio-wizard-steps .complete{color:var(--accent);border-color:rgba(34,197,94,.35)}.portfolio-wizard-steps .complete span{color:#fff;background:var(--accent)}
.portfolio-wizard-panel{display:grid;gap:16px;min-height:240px}.portfolio-wizard-panel[hidden]{display:none}.portfolio-step-intro{display:grid;gap:5px;padding:16px;border-radius:10px;background:var(--background)}.portfolio-step-intro h4,.portfolio-step-heading h4{margin:0}.portfolio-step-intro p,.portfolio-step-heading p{margin:0;color:var(--text-muted)}.portfolio-step-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.portfolio-period-choice{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px;border:1px solid rgba(249,115,22,.35);border-radius:10px;background:rgba(249,115,22,.06)}.portfolio-period-choice span{display:grid;gap:4px}.portfolio-period-choice small{color:var(--text-muted)}.portfolio-period-choice input{min-width:190px;padding:10px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}
.portfolio-link-list{display:grid;gap:10px}.portfolio-links-focus:not(.show-validated) .portfolio-link-row.is-auto-validated{display:none}.portfolio-use-suggestion{width:max-content;margin-top:3px;padding:6px 9px;font-size:11px}.portfolio-success-message{margin:0;padding:14px;border-radius:10px;color:var(--accent);background:rgba(34,197,94,.1);font-weight:700}.portfolio-review-grid{display:grid;grid-template-columns:repeat(3,minmax(150px,1fr));gap:12px}.portfolio-review-grid>div{display:grid;gap:6px;padding:16px;border:1px solid var(--border-color);border-radius:10px;background:var(--background)}.portfolio-review-grid span{color:var(--text-muted);font-size:12px}.portfolio-review-grid strong{font-size:20px}.portfolio-history-notice{margin:14px 0 0;padding:14px;border-left:4px solid var(--primary);border-radius:8px;background:rgba(249,115,22,.08)}
.portfolio-duplicate-modal{z-index:1200}.portfolio-duplicate-modal .modal-card{width:min(680px,calc(100vw - 32px))}.portfolio-duplicate-comparison{display:grid;grid-template-columns:1fr auto 1fr;align-items:stretch;gap:12px;margin:18px 0}.portfolio-duplicate-comparison>div:not(.portfolio-duplicate-arrow){display:grid;gap:7px;padding:16px;border:1px solid var(--border-color);border-radius:10px;background:var(--background)}.portfolio-duplicate-comparison span,.portfolio-duplicate-comparison small{color:var(--text-muted)}.portfolio-duplicate-comparison small{line-height:1.45}.portfolio-duplicate-arrow{display:grid;place-items:center;color:var(--primary);font-size:24px;font-weight:900}.portfolio-duplicate-help{padding:12px;border-radius:8px;background:rgba(249,115,22,.08);color:var(--text-muted)}.portfolio-duplicate-actions{flex-wrap:wrap}.portfolio-duplicate-actions .btn{margin:0}
.portfolio-preview-stats{margin:16px 0}.portfolio-resolutions{display:grid;gap:12px;margin:16px 0;padding:16px;border:1px solid var(--border-color);border-radius:10px;background:var(--background)}.portfolio-resolutions h4{margin:0}.portfolio-resolutions>p,.portfolio-assistant>p{margin:0;color:var(--text-muted)}.portfolio-resolutions label{display:grid;grid-template-columns:minmax(220px,1fr) minmax(260px,1fr);align-items:center;gap:12px}.portfolio-resolutions select{width:100%;padding:10px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}
.portfolio-link-row{display:grid;grid-template-columns:minmax(280px,1fr) minmax(320px,1fr);gap:10px 16px;align-items:center;padding:12px;border:1px solid var(--border-color);border-radius:9px;background:var(--surface)}.portfolio-link-row>div:first-child{display:grid;gap:5px}.portfolio-commercial-choice{display:grid;gap:5px;min-width:0}.portfolio-commercial-choice input,.portfolio-commercial-choice select{width:100%;padding:10px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}.portfolio-commercial-choice input:focus{border-color:var(--primary);outline:2px solid rgba(249,115,22,.14)}.portfolio-commercial-choice small{color:var(--text-muted);line-height:1.35}.portfolio-confidence{width:max-content;padding:3px 7px;border-radius:999px;color:var(--text-muted);background:var(--background)}.portfolio-confidence.high{color:var(--accent)}.portfolio-confidence.medium{color:var(--warning)}.portfolio-confidence.none{color:var(--danger)}.portfolio-new-commercial{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:10px;padding:12px;border-radius:8px;background:rgba(249,115,22,.08)}.portfolio-new-commercial[hidden]{display:none}.portfolio-new-commercial input,.portfolio-new-commercial select{width:100%;padding:10px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}
.portfolio-assistant{display:grid;gap:10px;margin:16px 0;padding:16px;border:1px solid rgba(249,115,22,.35);border-radius:10px;background:rgba(249,115,22,.06)}.portfolio-assistant h4{margin:0}.portfolio-assistant label{display:flex;align-items:flex-start;gap:10px;padding:10px;border-radius:8px;background:var(--surface)}.portfolio-assistant label span{display:grid;gap:3px}.portfolio-assistant label input[type="month"]{margin-left:auto;min-width:180px;padding:9px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}.portfolio-assistant small{color:var(--text-muted);overflow-wrap:anywhere}.portfolio-final-validation{display:flex;align-items:center;gap:10px;margin:16px 0;padding:14px;border-radius:10px;background:rgba(34,197,94,.1);font-weight:600}
@media(max-width:760px){.import-tabs{display:flex}.portfolio-wizard-steps{grid-template-columns:repeat(2,1fr)}.portfolio-step-heading,.portfolio-period-choice{align-items:stretch;flex-direction:column}.portfolio-period-choice input{width:100%;min-width:0}.portfolio-review-grid{grid-template-columns:1fr 1fr}.portfolio-resolutions label,.portfolio-link-row,.portfolio-new-commercial{grid-template-columns:1fr}}
.portfolio-pdv-exception-form{display:grid;grid-template-columns:minmax(180px,1fr) minmax(240px,1.5fr) auto;gap:10px}.portfolio-pdv-exception-form input,.portfolio-pdv-exception-form select{width:100%;padding:10px;border:1px solid var(--border-color);border-radius:8px;background:var(--surface);color:var(--text-primary)}[data-pdv-overrides-list]{display:flex;flex-wrap:wrap;gap:8px}.portfolio-pdv-override{display:inline-flex;align-items:center;gap:6px;padding:7px 9px;border-radius:999px;background:var(--surface);border:1px solid var(--border-color)}.portfolio-pdv-override button{border:0;background:none;color:var(--danger);font-size:17px;cursor:pointer}
@media(max-width:480px){.portfolio-wizard-steps,.portfolio-review-grid,.portfolio-duplicate-comparison,.portfolio-pdv-exception-form{grid-template-columns:1fr}.portfolio-duplicate-arrow{transform:rotate(90deg)}.portfolio-wizard-steps>div{padding:8px}.import-preview-actions{display:grid;grid-template-columns:1fr 1fr}.import-preview-actions .btn{width:100%}}

/* =====================================================================
   MODULE PORTFEUILLE, COMMISSIONS CI & ANNUAIRE UTILISATEURS (DESIGN PRO)
   ===================================================================== */

.users-management-container {
    display: flex;
    flex-direction: column;
    gap: 22px;
    animation: fadeIn 0.25s ease-out;
}

/* 1. Hero Header */
.users-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px 28px;
    box-shadow: var(--shadow-subtle);
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

.users-page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    opacity: 0.85;
}

.users-page-title-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.users-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
    width: fit-content;
}

.users-main-heading {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.4px;
}

.users-main-desc {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 720px;
}

.users-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* 2. Subtabs Navigation */
.portfolio-nav-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 2px;
}

.portfolio-tabs {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 5px;
    border-radius: var(--radius-lg);
    gap: 6px;
    backdrop-filter: blur(10px);
}

.portfolio-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.portfolio-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .portfolio-tab:hover {
    background: rgba(0, 0, 0, 0.04);
}

.portfolio-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.tab-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge-alert-pill {
    background: var(--danger);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.2;
    animation: pulseSlow 2s infinite ease-in-out;
}

.badge-count-pill {
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.2;
}

.portfolio-tab:not(.active) .badge-count-pill {
    background: var(--bg-input);
    color: var(--text-muted);
}

/* 3. KPI Stats Grid */
.portfolio-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.portfolio-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    backdrop-filter: blur(10px);
}

.portfolio-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-subtle);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.portfolio-stat-card:hover .stat-icon-wrapper {
    transform: scale(1.05);
}

.stat-icon-wrapper.indigo {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.stat-icon-wrapper.cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--secondary);
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.stat-icon-wrapper.emerald {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-icon-wrapper.amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-sub {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 600;
}

.stat-pill-sm {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
    font-weight: 700;
}

.stat-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--bg-input);
    overflow: hidden;
    margin: 4px 0 2px;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    transition: width 0.4s ease;
}

.stat-desc {
    font-size: 11.5px;
    color: var(--text-dim);
    line-height: 1.35;
}

.stat-pill-tag {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}

.portfolio-stat-card.card-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.04);
}

.portfolio-stat-card.card-warning .stat-value {
    color: var(--warning);
}

.portfolio-stat-card.card-success {
    border-color: rgba(16, 185, 129, 0.3);
}

/* 4. Alert Banner */
.portfolio-alert-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--text-main);
    font-size: 13px;
}

.portfolio-alert-banner .alert-icon-svg {
    color: var(--warning);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* 5. Toolbar & Search */
.portfolio-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.portfolio-toolbar .search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 280px;
    max-width: 520px;
}

.portfolio-toolbar .search-icon-svg {
    position: absolute;
    left: 14px;
    color: var(--text-dim);
    pointer-events: none;
}

.portfolio-toolbar .search-box input {
    width: 100%;
    padding: 10px 36px 10px 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.portfolio-toolbar .search-box input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.portfolio-toolbar .clear-search-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.portfolio-toolbar .clear-search-btn:hover {
    color: var(--text-main);
}

.portfolio-toolbar .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-icon-only {
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 6. Commercials Portfolio Cards */
.commercials-portfolio-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.commercial-portfolio-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.commercial-portfolio-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-subtle);
}

.commercial-portfolio-card.inactive {
    opacity: 0.72;
    border-style: dashed;
}

.commercial-card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.commercial-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.commercial-main-info {
    flex: 1;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.commercial-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.commercial-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

.status-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-indicator-dot.online {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: pulseSlow 2s infinite ease-in-out;
}

.status-indicator-dot.offline {
    background: var(--danger);
    opacity: 0.8;
}

.commercial-sub-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.info-pill {
    font-size: 11.5px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Financial Stat Chip */
.commercial-financial-summary {
    display: flex;
    align-items: center;
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    padding: 8px 14px;
}

.financial-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.financial-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.financial-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.financial-value small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Rates Widget (4 OMY Categories) */
.commercial-rates-widget {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    min-width: 240px;
}

.rates-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rates-widget-title {
    font-size: 10.5px;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-ghost-icon {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-ghost-icon:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #ffffff;
}

.rates-categories-chips {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rate-cat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 3px 8px;
    min-width: 48px;
    transition: border-color var(--transition-fast);
}

.rate-cat-pill:hover {
    border-color: var(--accent);
}

.rate-cat-label {
    font-size: 9.5px;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
}

.rate-cat-val {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--accent);
}

/* Commercial Card Toolbar */
.commercial-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-toggle-pdvs {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-toggle-pdvs:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-hover);
}

.toggle-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-icon-wrap.expanded {
    transform: rotate(180deg);
}

.pdv-count-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
}

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

/* Expandable Drawer & Subtable */
.commercial-pdvs-drawer {
    margin-top: 4px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.18s ease-out;
}

.pdv-subtable {
    margin: 0;
    font-size: 12.5px;
}

.pdv-subtable th {
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdv-subtable td {
    padding: 8px 12px;
}

.pdv-number-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-main);
}

.location-chip {
    color: var(--text-muted);
    font-size: 12px;
}

.orange-balance-cell {
    color: var(--text-main);
    font-size: 13px;
}

.orange-balance-cell small {
    color: var(--text-dim);
    font-size: 10.5px;
}

.empty-pdvs-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 22px;
    color: var(--text-dim);
    font-size: 13px;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
}

/* 7. Orphans Section */
.orphans-section {
    border-radius: var(--radius-lg);
    margin-top: 6px;
}

.orphans-section.has-orphans {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, transparent 100%);
}

.flex-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.title-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.title-icon-badge.amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.title-icon-badge.emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-count-tag {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
}

.orphan-table th {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

/* 8. User Directory Panel */
.directory-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.directory-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.directory-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User Directory Filters */
.users-filters-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.users-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.users-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.users-filter-field span {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim), #94a3b8;
    letter-spacing: 0.5px;
}

.users-filter-field select {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.users-filter-field select:focus {
    border-color: var(--primary);
}

.users-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.users-input-wrapper svg {
    position: absolute;
    left: 10px;
    color: var(--text-dim);
    pointer-events: none;
}

.users-input-wrapper input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.users-input-wrapper input:focus {
    border-color: var(--primary);
}

.users-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* User Directory Table */
.user-table {
    margin: 0;
}

.user-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
}

.user-table td {
    padding: 10px 14px;
    vertical-align: middle;
}

.user-cell-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.user-avatar-sm.role-admin {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #ffffff;
}

.user-avatar-sm.role-bridge {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
}

.user-avatar-sm.role-commercial {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #ffffff;
}

.user-avatar-sm.role-pos {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.user-avatar-sm.role-partner {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.user-avatar-sm.role-consult {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #ffffff;
}

.user-name-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-display-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 13.5px;
}

.user-sub-contact {
    font-size: 11px;
    color: var(--text-dim);
}

.badge-role {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-role-admin {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-role-bridge {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.badge-role-commercial {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-role-pos {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-role-partner {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-role-consult {
    background: rgba(100, 116, 139, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

.distributor-badge {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-main);
    font-weight: 600;
}

.rate-cluster-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rate-badge-sm {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
    font-weight: 700;
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 6px;
}

.rate-badge-sm.rate-badge-multi {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-size: 11px;
    letter-spacing: -0.2px;
}

.user-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 9. Modals (Taux, Affectation, Transfert, Utilisateur) */
.user-form-modal-card {
    width: min(720px, calc(100vw - 32px));
}

.user-modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.modal-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.modal-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.rate-modal-card {
    width: min(680px, calc(100vw - 32px));
}

.rate-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
}

.rate-uniform-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rate-uniform-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

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

.rate-uniform-input-wrap input {
    width: 72px;
    padding: 5px 22px 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
    outline: none;
    transition: border-color var(--transition-fast);
}

.rate-uniform-input-wrap input:focus {
    border-color: var(--primary);
}

.rate-uniform-input-wrap span {
    position: absolute;
    right: 8px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.modal-rate-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.modal-rate-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color var(--transition-fast);
}

.modal-rate-card:hover {
    border-color: var(--border-highlight);
}

.rate-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rate-base-pill {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
}

.rate-base-pill.highlight {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
}

.rate-input-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.rate-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.rate-input-wrapper input {
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    outline: none;
    transition: border-color var(--transition-fast);
}

.rate-input-wrapper input:focus {
    border-color: var(--primary);
}

.rate-input-unit {
    position: absolute;
    right: 12px;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 13px;
    pointer-events: none;
}

.rate-input-hint {
    font-size: 11px;
    color: var(--text-dim);
}

.form-help-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.help-box-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.empty-results-card {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 10. Buttons & Micro Utilities */
.btn-xs {
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-danger-subtle {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger-subtle:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

@keyframes pulseSlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.97); }
}

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

/* 11. Responsive Media Queries */
@media (max-width: 900px) {
    .commercial-card-header {
        align-items: flex-start;
    }
    .commercial-financial-summary,
    .commercial-rates-widget {
        width: 100%;
    }
    .commercial-financial-summary {
        justify-content: space-between;
    }
    .financial-stat-chip {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .users-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    .users-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .portfolio-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .portfolio-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .portfolio-toolbar .search-box {
        max-width: 100%;
        min-width: 0;
    }
    .portfolio-toolbar .toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .modal-rate-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .portfolio-stats-grid {
        grid-template-columns: 1fr;
    }
    .portfolio-tabs {
        width: 100%;
        display: flex;
    }
    .portfolio-tab {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12.5px;
    }
    .commercial-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    .rates-categories-chips {
        justify-content: space-between;
    }
    .commercial-card-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .commercial-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
