/* ============================================================
   MAD Technologies — Dashboard CSS
   Modern SaaS Design System
   ============================================================ */

/* ============ 1. CSS Variables ============ */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --primary-hover: #1d4ed8;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --success: #22c55e;
    --success-light: #dcfce7;
    --success-dark: #16a34a;

    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #d97706;

    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-dark: #dc2626;

    --info: #06b6d4;
    --info-light: #cffafe;
    --info-dark: #0891b2;

    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --purple-dark: #7c3aed;

    --amber: #f59e0b;
    --amber-light: #fef3c7;

    --dark: #0f172a;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

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

    --sidebar-width: 256px;
    --header-height: 64px;

    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Legacy aliases used by existing pages */
    --mad-primary: var(--primary);
    --mad-primary-dark: var(--primary-dark);
    --mad-dark: var(--dark);
    --mad-text: var(--text-secondary);
    --mad-muted: var(--text-muted);
    --mad-border: var(--border);
    --mad-card: var(--surface);
    --mad-card-radius: var(--radius-lg);
    --mad-card-shadow: var(--shadow-md);
    --mad-sidebar: var(--surface);
    --sidebar-w: var(--sidebar-width);
    --mad-bg: var(--bg);
    --mad-glass: rgba(255, 255, 255, 0.92);
    --mad-butter: #f59e0b;
    --mad-mint: #22c55e;
    --mad-lavender: #8b5cf6;
    --mad-peach: #f97316;
    --accent: var(--primary);
}

/* ============ 2. Reset / Normalize ============ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

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

/* ============ 3. Typography ============ */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

/* ============ 4. Layout ============ */
.admin-layout {
    min-height: 100vh;
}

.admin-main {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

.content {
    padding: 28px 32px 52px;
    flex: 1;
    background: var(--bg);
}

/* ============ 5. Sidebar ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-slow);
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand img {
    height: 32px;
    border-radius: var(--radius-sm);
}

.sidebar-nav {
    padding: 12px 12px 24px;
    flex: 1;
}

.sidebar-nav .nav-section {
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 22px 12px 8px;
    font-weight: 700;
}

.sidebar-nav .nav-section:first-child {
    margin-top: 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.sidebar-nav a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.sidebar-nav a:hover i {
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    font-weight: 600;
}

.sidebar-nav a.active i {
    color: #fff;
}

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

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--danger-light);
    color: var(--danger) !important;
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.sidebar-logout i {
    width: 20px;
    text-align: center;
}

.sidebar-logout:hover {
    background: var(--danger);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.sidebar-secretary,
.sidebar-agent,
.sidebar-commercial_manager,
.sidebar-telemarketer,
.sidebar-client {
    background: var(--surface);
}

/* ============ 6. Topbar ============ */
.topbar {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.sidebar-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-link {
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.topbar-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* ============ 7. Notifications Bell ============ */
.topbar-bell {
    position: relative;
}

.bell-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

.bell-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bell-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 20px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.bell-badge.bounce {
    animation: bellBounce 0.5s;
}

@keyframes bellBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.notif-menu {
    width: 360px;
    max-width: calc(100vw - 24px);
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    background: var(--surface);
}

.notif-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}

.notif-menu-head strong {
    font-size: 14px;
    color: var(--text-primary);
}

.notif-mark-all {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.notif-mark-all:hover {
    text-decoration: underline;
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    position: relative;
    transition: background var(--transition-fast);
}

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

.notif-item:last-child {
    border-bottom: none;
}

.notif-item .notif-ico {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fff;
    background: var(--primary);
}

.notif-item .notif-txt {
    flex: 1;
    min-width: 0;
}

.notif-item .notif-txt strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.notif-item .notif-txt span {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

.notif-item .notif-txt small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-item .notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.notif-item.read .notif-dot {
    display: none;
}

.notif-empty {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============ 8. User Profile (topbar) ============ */
.topbar-user .user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.topbar-user .user-btn:hover {
    background: var(--bg);
}

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

.user-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.user-meta strong {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.user-meta small {
    color: var(--text-muted);
    font-size: 11.5px;
}

/* ============ 9. Page Header ============ */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}

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

.page-head p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ============ 10. Cards ============ */
.card-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card-title {
    margin: 0 0 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.card-head-row .card-title {
    margin: 0;
}

/* ============ 11. Stat Cards / KPI ============ */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent, var(--primary));
    opacity: 0.7;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    background: var(--accent, var(--primary));
    flex-shrink: 0;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card .label {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-card .sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ 12. Tables ============ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
    vertical-align: middle;
}

.table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    background: var(--surface-alt);
}

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

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

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

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

.table tbody tr:hover {
    background: var(--surface-alt);
}

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

.thumb-sm {
    width: 52px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.total-row td {
    font-weight: 700;
    color: var(--text-primary);
    border-top: 2px solid var(--border);
    background: var(--surface-alt);
}

/* ============ 13. Badges ============ */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-block;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-publie,
.badge-success { background: var(--success-light); color: var(--success-dark); }

.badge-brouillon,
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }

.badge-danger { background: var(--danger-light); color: var(--danger-dark); }

.badge-active { background: var(--primary-light); color: var(--primary-dark); }

.badge-info { background: var(--info-light); color: var(--info-dark); }

.badge-role { background: var(--purple-light); color: var(--purple-dark); }

.badge-client { background: var(--primary-light); color: var(--primary-dark); }

.badge-secretary { background: var(--success-light); color: var(--success-dark); }

.badge-admin { background: var(--warning-light); color: var(--warning-dark); }

.badge-superadmin { background: var(--danger-light); color: var(--danger-dark); }

.badge-agent { background: var(--purple-light); color: var(--purple-dark); }

.badge-commercial_manager { background: var(--warning-light); color: var(--warning-dark); }

.badge-telemarketer { background: var(--info-light); color: var(--info-dark); }

/* Postes de production (imprimerie) */
.badge-designer { background: #f3e8ff; color: #7e22ce; }
.badge-printer { background: #e0e7ff; color: #3730a3; }
.badge-finisher { background: #fef3c7; color: #92400e; }
.badge-workshop_manager { background: #fee2e2; color: #991b1b; }
.badge-storekeeper { background: #ecfdf5; color: #065f46; }
.badge-delivery { background: #e0f2fe; color: #075985; }
.badge-accountant { background: #ede9fe; color: #5b21b6; }

/* ============ 14. Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background: var(--text-secondary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--text-primary);
    box-shadow: none;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12.5px;
}

.btn-outline {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
    box-shadow: none;
}

.btn-danger {
    background: var(--danger);
    box-shadow: none;
}

.btn-danger:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--surface);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

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

.action-cell {
    display: flex;
    gap: 6px;
}

/* ============ 15. Forms ============ */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}

.form-control,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.5;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-check-label {
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-check-input {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--border);
    cursor: pointer;
    accent-color: var(--primary);
}

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

.form-inline .form-control,
.form-inline .form-select {
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
}

/* ============ 16. Modals ============ */
.mad-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.mad-modal.show {
    display: flex;
}

.mad-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.mad-modal-box {
    position: relative;
    width: min(420px, 92vw);
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
    padding: 32px 28px 24px;
    text-align: center;
    transform: translateY(-12px) scale(0.97);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.mad-modal.show .mad-modal-box {
    transform: none;
    opacity: 1;
}

.mad-modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.mad-modal.success .mad-modal-icon { background: var(--success-light); color: var(--success); }
.mad-modal.error .mad-modal-icon { background: var(--danger-light); color: var(--danger); }
.mad-modal.info .mad-modal-icon { background: var(--info-light); color: var(--info); }
.mad-modal.confirm .mad-modal-icon { background: var(--warning-light); color: var(--warning); }

.mad-modal-title {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
}

.mad-modal-message {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.mad-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mad-modal-actions .btn {
    min-width: 112px;
    justify-content: center;
}

/* ============ 17. Alerts ============ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: #bbf7d0;
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: #fecaca;
}

/* ============ 18. Dashboard Hero ============ */
.dash-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 50%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.dash-hero h1 {
    margin: 4px 0 6px;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}

.dash-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.dash-hero .hero-greeting {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.hero-left,
.hero-right {
    position: relative;
    z-index: 1;
}

.hero-right .btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-right .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
}

.hero-blob-1 {
    width: 200px;
    height: 200px;
    right: -40px;
    top: -80px;
    background: rgba(255, 255, 255, 0.1);
}

.hero-blob-2 {
    width: 140px;
    height: 140px;
    right: 120px;
    bottom: -60px;
    background: rgba(255, 255, 255, 0.08);
}

/* ============ 19. Dashboard Alert Boxes ============ */
.alert-box {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.alert-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.alert-box-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary-dark);
    background: var(--primary-light);
    flex-shrink: 0;
}

.alert-box-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.alert-box-label {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.alert-box-link {
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

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

.alert-box.danger .alert-box-icon { background: var(--danger-light); color: var(--danger); }
.alert-box.danger .alert-box-value { color: var(--danger); }
.alert-box.warn .alert-box-icon { background: var(--warning-light); color: var(--warning); }
.alert-box.warn .alert-box-value { color: var(--warning); }
.alert-box.info .alert-box-icon { background: var(--info-light); color: var(--info); }
.alert-box.ok .alert-box-icon { background: var(--success-light); color: var(--success); }

/* ============ 20. Dashboard Evolution ============ */
.evol {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
}

.evol-up { background: var(--success-light); color: var(--success-dark); }
.evol-down { background: var(--danger-light); color: var(--danger-dark); }

/* ============ 21. Charts ============ */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
    padding-top: 10px;
    overflow-x: auto;
}

.bar-chart-sm {
    height: 140px;
}

.bar-col {
    flex: 1;
    min-width: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar {
    width: 100%;
    background: var(--primary);
    border-radius: 6px 6px 0 0;
    min-height: 3px;
    transition: height 0.3s ease;
    opacity: 0.85;
}

.bar:hover {
    opacity: 1;
}

.bar-label {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 5px;
    white-space: nowrap;
}

.bar-col.today .bar {
    background: var(--primary-dark);
    opacity: 1;
}

.bar-col.today .bar-label {
    color: var(--text-primary);
    font-weight: 700;
}

.chart-sum {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.chart-sum small {
    font-weight: 600;
    color: var(--text-muted);
}

.chart-wrap {
    overflow-x: auto;
    padding: 4px 0;
}

.line-chart {
    position: relative;
    min-height: 180px;
}

.line-chart .axis {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed var(--border);
}

/* ============ 22. Donut Chart ============ */
.donut-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 34px;
    flex-wrap: wrap;
    padding: 6px 0 2px;
}

.donut-box {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.donut-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.donut-center .d-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.donut-center .d-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

.donut-legend .dl-row {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13px;
}

.donut-legend .dl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend .dl-name { color: var(--text-secondary); flex: 1; }
.donut-legend .dl-val { color: var(--text-primary); font-weight: 700; }
.donut-legend .dl-pct { color: var(--text-muted); font-size: 12px; width: 46px; text-align: right; }

.donut-legend .dl-track {
    height: 6px;
    background: var(--border-light);
    border-radius: 20px;
    overflow: hidden;
    width: 100%;
    margin-top: 2px;
}

.donut-legend .dl-track span {
    display: block;
    height: 100%;
    border-radius: 20px;
    background: var(--primary);
}

/* ============ 23. Quick Access Tiles ============ */
.qa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.qa-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.qa-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--tile);
    color: var(--text-primary);
}

.qa-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--tile);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all var(--transition-fast);
}

.qa-tile:hover .qa-icon {
    background: var(--tile);
    color: #fff;
}

.qa-tile > span:last-child {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* ============ 24. Mini Lists & Visits ============ */
.mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
}

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

.mini-label { color: var(--text-secondary); }
.mini-label i { width: 20px; color: var(--text-muted); }

.mini-count {
    background: var(--bg);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 12.5px;
    padding: 3px 12px;
    border-radius: 20px;
}

.visit-big {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.visit-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 2px 0 16px;
}

/* ============ 25. Top Products ============ */
.top-prod { margin-bottom: 14px; }
.top-prod:last-child { margin-bottom: 0; }

.top-prod-head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.top-prod-head span { color: var(--text-secondary); }
.top-prod-head strong { color: var(--text-primary); }

.top-prod-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 20px;
    overflow: hidden;
}

.top-prod-bar span {
    display: block;
    height: 100%;
    border-radius: 20px;
    background: var(--primary);
}

/* ============ 26. Invoice Line Items ============ */
.inv-line {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: var(--surface-alt);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.line-total {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
}

/* ============ 27. Statistics Page Extras ============ */
.range-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
}

.peak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--amber-light);
    color: var(--warning-dark);
    font-size: 11px;
    font-weight: 700;
}

.cell-num {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.mini-track {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: var(--border-light);
    border-radius: 20px;
    overflow: hidden;
    vertical-align: middle;
    margin-left: 6px;
}

.mini-fill {
    display: block;
    height: 100%;
    border-radius: 20px;
    background: var(--primary);
}

tr.is-today {
    background: var(--primary-light) !important;
}

/* ============ 28. Kanban Board ============ */
.kanban-wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-col {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.kanban-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.kanban-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 20px;
}

.kanban-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kanban-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
    padding: 20px 0;
}

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: box-shadow var(--transition-fast);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
}

.kb-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.kb-prod {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

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

.kb-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.kb-meta2 {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kb-actions {
    margin-top: 10px;
    display: flex;
    gap: 6px;
}

/* ============ 29. Dropdown (Bootstrap override) ============ */
.dropdown-menu {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 8px 12px;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 18px;
}

/* ============ 30. Login Page ============ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 50%, #3b82f6 100%);
}

.login-card {
    background: var(--surface);
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}

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

.login-brand img {
    height: 46px;
}

.login-card h2 {
    text-align: center;
    color: var(--text-primary);
    margin: 0 0 6px;
    font-size: 22px;
}

.login-card .sub {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
}

.demo {
    background: var(--surface-alt);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 18px;
    line-height: 1.6;
}

.demo code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-dark);
}

/* ============ 31. Utility Classes ============ */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.col {
    flex: 1;
    min-width: 230px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.mt-3 { margin-top: 20px; }
.mb-3 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.fw-700 { font-weight: 700; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }

/* Read-only input style */
.form-control[readonly] {
    background: var(--surface-alt);
    color: var(--text-muted);
}

/* Color picker input */
input[type="color"] {
    width: 48px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    background: var(--surface);
    cursor: pointer;
}

/* Profile page max-width */
.profile-card {
    max-width: 560px;
}

/* Summary max-width */
.summary-right {
    max-width: 520px;
    margin-left: auto;
    text-align: right;
}

/* Info row */
.info-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

/* Section heading (used in card forms) */
.section-heading {
    margin-top: 0;
    color: var(--text-primary);
    font-size: 16px;
}

/* Compact status select */
.form-control-compact {
    width: auto;
    padding: 7px 10px;
    font-size: 13px;
}

/* ============ 32. Backdrop (mobile) ============ */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
    display: none;
    backdrop-filter: blur(2px);
}

.backdrop.show {
    display: block;
}

/* ============ 33. Scrollbar ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============ 34. Responsive ============ */
@media (max-width: 1200px) {
    .kanban-wrap {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .content {
        padding: 20px 16px 40px;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-hero {
        padding: 22px 20px;
    }

    .dash-hero h1 {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 16px;
    }

    .user-meta {
        display: none;
    }

    .topbar-link {
        display: none;
    }

    .kanban-wrap {
        grid-template-columns: 1fr;
    }

    .page-head h1 {
        font-size: 18px;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .donut-wrap {
        flex-direction: column;
        align-items: center;
    }

    .dash-hero {
        flex-direction: column;
        text-align: center;
    }

    .info-row {
        flex-direction: column;
        gap: 8px;
    }

    .summary-right {
        max-width: 100%;
        text-align: left;
    }

    .table {
        font-size: 12.5px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }
}

@media (max-width: 576px) {
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .row {
        flex-direction: column;
    }

    .col {
        min-width: 100%;
    }

    .content {
        padding: 16px 12px 32px;
    }

    .card-box {
        padding: 16px;
    }

    .qa-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .inv-line {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-control,
    .form-inline .form-select {
        width: 100%;
    }
}

/* ============ 35. Dashboard Color Config ============ */

.dash-color-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.dash-color-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dash-color-section-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.dash-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}

.dash-color-item {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.dash-color-item input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    cursor: pointer;
    background: transparent;
    transition: border-color .2s;
}

.dash-color-item input[type="color"]:hover {
    border-color: var(--primary);
}

.dash-color-item label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}

.dash-color-item .form-control-sm {
    font-size: .75rem;
    font-family: var(--font-mono);
    padding: .2rem .45rem;
    text-transform: lowercase;
}

/* ============ 35. Session Timeout Warning ============ */

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .form-control {
    padding-right: 2.75rem;
}

.input-icon-btn {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .25rem;
    font-size: .9rem;
    transition: color .2s;
    line-height: 1;
}

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

#sessionTimeoutBar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--danger);
    color: #fff;
    padding: .65rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .85rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
    animation: slideUp .3s ease;
}

#sessionTimeoutBar .btn {
    background: rgba(255,255,255,.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,.3);
    padding: .25rem .75rem;
    font-size: .8rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s;
}

#sessionTimeoutBar .btn:hover {
    background: rgba(255,255,255,.35);
}

#sessionTimeoutBar .btn-secondary {
    background: transparent;
    border-color: rgba(255,255,255,.4);
}

#sessionTimeoutBar .btn-secondary:hover {
    background: rgba(255,255,255,.15);
}

#sessionTimeoutBar strong {
    font-family: var(--font-mono);
    min-width: 3ch;
    display: inline-block;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============ 36. Print ============ */
@media print {
    .sidebar,
    .topbar,
    .sidebar-toggle,
    .backdrop,
    .btn,
    .action-cell,
    #sessionTimeoutBar {
        display: none !important;
    }

    .admin-main {
        margin-left: 0 !important;
    }

    .content {
        padding: 0 !important;
    }

    .card-box {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}
