/* ============================================================
   INNONNEX Reseller Track — Dark Mode INNONNEX
   Design system : INNONNEX brand (Burgundy + Beige)
   Palette       : #0A0A0A bg, #4a0404 accent, #CCB490 beige
   Fonts         : Inter + OriginTech + OCR-A Extended
   ============================================================ */

/* --- @font-face: Local fonts --- */
@font-face {
    font-family: 'OriginTech';
    src: url('OriginTech%20personal%20use.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OCR-A Extended';
    src: url('OCRAEXT.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Backgrounds */
    --bg-page: #0A0A0A;
    --bg-panel: #1A1A1A;
    --bg-nav: #141414;
    --bg-surface: #1A1A1A;
    --bg-elevated: #2A2A2A;
    --bg-input: rgba(255, 255, 255, 0.03);
    --bg-input-hover: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-primary: #CCB490;
    --text-secondary: #A0A0A0;
    --text-tertiary: #808080;
    --text-muted: #6A6A6A;

    /* Accent (Burgundy INNONNEX) */
    --accent: #4a0404;
    --accent-hover: #6b0a0a;
    --accent-subtle: rgba(74, 4, 4, 0.2);

    /* Beige INNONNEX */
    --beige: #CCB490;
    --beige-subtle: rgba(204, 180, 144, 0.15);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-standard: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);

    /* Semantic */
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, 0.12);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info: #4a0404;
    --info-bg: rgba(74, 4, 4, 0.2);

    /* Typography */
    --font-display: 'OriginTech', sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'OCR-A Extended', 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

ul, ol {
    list-style: none;
}

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

::selection {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

/* --- Heading styles INNONNEX --- */
h2, h3 {
    font-family: var(--font-display);
}

h2 {
    color: var(--beige);
}

h3 {
    color: var(--text-secondary);
}

/* ==========================================================
   LOGIN PAGE
   ========================================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--bg-page);
}

.login-card {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-standard);
    box-shadow: var(--shadow-lg);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.25rem;
    letter-spacing: 0.04em;
    color: var(--beige);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.2;
    text-transform: uppercase;
}

.login-logo img {
    height: 48px;
    width: auto;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.login-card .form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.login-card .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.login-card .form-group .form-control {
    width: 100%;
}

.login-card .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
    margin-top: 0.5rem;
}

.login-card .login-footer {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-card .login-footer a {
    color: var(--accent);
    font-weight: 500;
}

.login-card .login-footer a:hover {
    color: var(--accent-hover);
}

/* ==========================================================
   DASHBOARD LAYOUT
   ========================================================== */
.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.dashboard-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-header .header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==========================================================
   NAVBAR
   ========================================================== */
.app-navbar,
.navbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-standard);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--beige);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.nav-brand img {
    height: 28px;
    width: auto;
    opacity: 0.9;
}

.nav-logo {
    height: 28px;
    width: auto;
    margin-right: 12px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--text-tertiary);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--border-standard);
}

.nav-links a.active {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.nav-user .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--beige-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--beige);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.375rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* ==========================================================
   STATS GRID
   ========================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

.stats-grid-6 .stat-card {
    padding: 0.875rem 1rem;
}

.stats-grid-6 .stat-card .stat-value {
    font-size: 1.15rem;
}

.stats-grid-6 .stat-card .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
}

.stats-grid-6 .stat-label {
    font-size: 0.6875rem;
}

@media (max-width: 1200px) {
    .stats-grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid,
    .stats-grid-6 {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color var(--transition-normal), background var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-standard);
    background: var(--bg-surface);
}

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

.stat-card .stat-icon.blue {
    background: var(--accent-subtle);
    color: var(--accent);
}

.stat-card .stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-card .stat-icon.gold {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-card .stat-icon.red {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-card .stat-body {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

/* ==========================================================
   CARDS
   ========================================================== */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color var(--transition-normal);
}

.card:hover {
    border-color: var(--border-standard);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-header .card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card-body {
    width: 100%;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--beige);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: transparent;
}

.btn-success:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.2);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-standard);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.9375rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    background: transparent;
    color: var(--text-tertiary);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-icon.btn-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-icon.btn-primary:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* ==========================================================
   FORMS
   ========================================================== */

.form-group label {
    color: var(--text-secondary);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group .form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), background var(--transition-fast);
    line-height: 1.5;
}

.form-control option,
.form-control optgroup {
    color: #4a0404;
}

.form-control:hover {
    background: var(--bg-input-hover);
    border-color: var(--border-strong);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23808080' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ==========================================================
   FILTER BAR
   ========================================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    min-width: 160px;
    flex: 1;
}

.filter-bar .form-control:first-child {
    flex: 2;
}

/* ==========================================================
   TABLES
   ========================================================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-panel);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.table thead th {
    background: transparent;
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

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

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

.table .cell-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

.table .cell-total {
    font-weight: 600;
    color: var(--text-primary);
}

.table .text-right {
    text-align: right;
}

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

.table .text-muted {
    color: var(--text-muted);
}

/* Paid / Unpaid row highlights */
.table .paid {
    background: rgba(34, 197, 94, 0.05);
}

.table .paid td:first-child {
    border-left: 3px solid var(--success);
}

.table .unpaid {
    background: rgba(239, 68, 68, 0.05);
}

.table .unpaid td:first-child {
    border-left: 3px solid var(--danger);
}

/* ==========================================================
   BADGES
   ========================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 20px;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-innonnex {
    background: var(--accent-subtle);
    color: var(--beige);
}

.badge-zeintech {
    background: var(--success-bg);
    color: var(--success);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

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

.badge-info {
    background: var(--info-bg);
    color: var(--beige);
}

/* ==========================================================
   PAID / UNPAID status classes
   ========================================================== */
.paid {
    color: var(--success);
}

.paid-bg {
    background: var(--success-bg);
    color: var(--success);
}

.unpaid {
    color: var(--danger);
}

.unpaid-bg {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ==========================================================
   MARGIN DISPLAY
   ========================================================== */
.margin-positive {
    color: var(--success);
    font-weight: 600;
}

.margin-negative {
    color: var(--danger);
    font-weight: 600;
}

.margin-zero {
    color: var(--text-muted);
}

/* ==========================================================
   MODAL
   ========================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active,
.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================
   ALERTS
   ========================================================== */
.alert {
    padding: 0.85rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.15);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.15);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.15);
}

.alert-info {
    background: var(--info-bg);
    color: var(--beige);
    border-color: rgba(74, 4, 4, 0.15);
}

/* ==========================================================
   FLASH MESSAGES (toast-style)
   ========================================================== */
.flash-message {
    position: fixed;
    top: 72px;
    right: 1.5rem;
    z-index: 3000;
    padding: 0.75rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-standard);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: slideInRight 0.25s ease-out;
    max-width: 400px;
}

.flash-message.flash-success {
    border-left: 3px solid var(--success);
}

.flash-message.flash-error {
    border-left: 3px solid var(--danger);
}

.flash-message.flash-info {
    border-left: 3px solid var(--accent);
}

.flash-message.flash-warning {
    border-left: 3px solid var(--warning);
}

.flash-message .flash-close {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.9375rem;
    background: none;
    border: none;
    color: inherit;
}

.flash-message .flash-close:hover {
    opacity: 1;
}

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

/* ==========================================================
   EMPTY STATE
   ========================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.empty-state p {
    font-size: 0.8125rem;
    max-width: 400px;
    margin: 0 auto 1rem;
}

/* ==========================================================
   TOGGLE / COLLAPSE
   ========================================================== */
.toggle-content {
    display: none;
}

.toggle-content.active {
    display: block;
}

/* ==========================================================
   LOADING SPINNER
   ========================================================== */
.spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--text-tertiary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==========================================================
   HELPER UTILITIES
   ========================================================== */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.6875rem; }
.text-lg { font-size: 1rem; }

.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-light { font-weight: 300; }

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.w-100 { width: 100%; }

.hidden { display: none !important; }

/* ==========================================================
   TOAST NOTIFICATIONS
   ========================================================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 16px 24px;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
    max-width: 450px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* ==========================================================
   CHART LOADER
   ========================================================== */
.chart-loader {
    min-height: 100px;
    max-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-loader + canvas {
    max-height: 140px !important;
}

.chart-loader::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 2px solid var(--beige);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinChart 0.8s linear infinite;
}

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

/* ==========================================================
   BREADCRUMBS
   ========================================================== */
.breadcrumbs {
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.breadcrumbs a {
    color: var(--beige);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent-hover);
}

.breadcrumbs .separator {
    margin: 0 8px;
    color: var(--text-muted);
}

/* ==========================================================
   TABS NAVIGATION
   ========================================================== */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-standard);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-nav a,
.tab-nav button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    margin-bottom: -1px;
}

.tab-nav a:hover,
.tab-nav button:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-strong);
}

.tab-nav a.active,
.tab-nav button.active {
    color: var(--beige);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

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

/* ==========================================================
   RESPONSIVE — Tablette (≤ 768px)
   ========================================================== */
@media (max-width: 768px) {
    .dashboard-content,
    .app-main {
        padding: 1rem;
    }

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

    .app-navbar,
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border-standard);
        padding: 0.5rem 0;
        box-shadow: var(--shadow-md);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.75rem 1.5rem;
        width: 100%;
        border-radius: 0;
    }

    .navbar-toggle {
        display: block;
    }

    .nav-user {
        gap: 0.5rem;
    }

    .nav-user span:not(.user-avatar) {
        display: none;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control {
        min-width: unset;
    }

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

    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.6rem;
    }

    .modal-content {
        max-width: 100%;
        margin: 0 0.5rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
}

/* ==========================================================
   RESPONSIVE — Mobile (≤ 480px)
   ========================================================== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h2 {
        font-size: 1.125rem;
    }

    .table {
        font-size: 0.75rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.4rem 0.5rem;
    }

    .badge {
        font-size: 0.625rem;
    }

    .btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }

    .flash-message {
        left: 1rem;
        right: 1rem;
        top: 64px;
        max-width: none;
    }

    .login-card {
        padding: 1.5rem 1.25rem;
    }
}