/* ═══════════════════════════════════════════════════════════════════
   Aivrasol Flow AI — Global Design System
   Premium dark SaaS dashboard aesthetic
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Custom Properties (Overridden by PHP branding) ─────── */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #22c55e;
    --accent-light: #4ade80;
    --accent-dark: #16a34a;
    --bg-dark: #0b0f19;
    --bg-body: #0f1221;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-solid: #111827;
    --bg-sidebar: rgba(8, 11, 20, 0.95);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-focus: var(--primary);
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.15);
    --gradient-angle: 135deg;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --topnav-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; display: block; }

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    letter-spacing: -0.02em;
}
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ─── Layout: Admin Sidebar ─────────────────────────────────────── */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
}

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

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

.sidebar-brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand-text h2 {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.sidebar-brand-text span {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-section-title {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.sidebar-link.active {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-link .link-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link .link-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

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

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: var(--danger-light);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius);
    color: #fca5a5;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.sidebar-logout:hover {
    background: rgba(239,68,68,0.25);
    color: #fca5a5;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
    backdrop-filter: blur(4px);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 6px;
    line-height: 1;
}

/* ─── Layout: Top Navigation ────────────────────────────────────── */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
    height: var(--topnav-height);
    background: rgba(11, 15, 25, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.topnav-brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: var(--shadow-glow);
}

.topnav-brand h2 {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
}

.topnav-brand h2 .brand-highlight {
    color: var(--primary-light);
}

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

.topnav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.topnav-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(var(--gradient-angle), var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.topnav-user-info {
    display: flex;
    flex-direction: column;
}

.topnav-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.topnav-user-role {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topnav-link {
    padding: 8px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.topnav-link:hover, .topnav-link.active {
    color: var(--text);
    background: var(--bg-hover);
}

.topnav-link.active {
    color: var(--primary-light);
}

/* ─── Container ─────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.container-narrow {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ─── Page Header ───────────────────────────────────────────────── */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    backdrop-filter: blur(16px);
    transition: all var(--transition);
    animation: fadeIn 0.4s ease;
}

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

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

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    padding: 24px;
    backdrop-filter: blur(20px);
}

/* ─── Stat Cards ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    animation: slideUp 0.5s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition);
}

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

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Color variants for stat cards */
.stat-card.stat-primary .stat-value { color: var(--primary-light); }
.stat-card.stat-success .stat-value { color: var(--accent-light); }
.stat-card.stat-warning .stat-value { color: var(--warning); }
.stat-card.stat-danger .stat-value { color: var(--danger); }
.stat-card.stat-info .stat-value { color: var(--info); }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

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

.btn-primary {
    background: linear-gradient(var(--gradient-angle), var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(var(--gradient-angle), var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}
.btn-accent:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
    border-radius: var(--radius-lg);
}

.btn-block { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── Badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-success { background: var(--success-light); color: var(--accent-light); }
.badge-warning { background: var(--warning-light); color: #fcd34d; }
.badge-danger { background: var(--danger-light); color: #fca5a5; }
.badge-info { background: var(--info-light); color: #67e8f9; }
.badge-primary { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.badge-neutral { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.form-input::placeholder { color: var(--text-dim); }

.form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.form-select {
    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='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-select option {
    background: var(--bg-card-solid);
    color: var(--text);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

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

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

.form-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

/* ─── Tables ────────────────────────────────────────────────────── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 700px;
}

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

.table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

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

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

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

.table-user-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-user-cell strong {
    font-size: 13px;
    font-weight: 600;
}

.table-user-cell span {
    font-size: 11px;
    color: var(--text-secondary);
}

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

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 12px 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}

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

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* ─── Alerts ────────────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--accent-light);
}

.alert-error {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.alert-info {
    background: var(--info-light);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #67e8f9;
}

/* ─── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.25s ease;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ─── Avatar ────────────────────────────────────────────────────── */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(var(--gradient-angle), var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ─── Search ────────────────────────────────────────────────────── */
.search-wrapper {
    position: relative;
    max-width: 360px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-dim);
    pointer-events: none;
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
    color: var(--text-dim);
}

/* ─── Grid ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

/* ─── Utility ───────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ─── WhatsApp Widget ───────────────────────────────────────────── */
.wa-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
    transition: all var(--transition);
}
.wa-widget:hover {
    transform: scale(1.05);
    color: #fff;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.55);
}

/* ─── Progress Bar ──────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

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

/* ─── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.animate-fade { animation: fadeIn 0.4s ease; }
.animate-slide { animation: slideUp 0.5s ease; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .hamburger-btn { display: block; }
    .topbar-user-role { display: none !important; }
    .main-content { margin-left: 0; overflow-x: hidden; }
    .card { min-width: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 14px; }
}

@media (max-width: 768px) {
    .container, .container-narrow { padding: 20px 12px; }
    h1 { font-size: 22px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 20px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-auto { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .topnav { padding: 0 16px; height: 56px; }
    .topnav-user-info { display: none; }
    .tabs { gap: 4px; }
    .tab-btn { padding: 10px 12px; font-size: 11.5px; }
    .card { padding: 16px; border-radius: var(--radius-lg); }
    .modal { padding: 20px; margin: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .topnav-links { display: none; }
    .topnav-brand h2 { display: none; }
    .wa-widget { bottom: 16px; right: 16px; padding: 10px 14px; font-size: 11px; }
    .table-actions { flex-direction: column; }
    .btn-sm { width: 100%; }
}

/* ─── Print ─────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topnav, .wa-widget, .mobile-header, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ddd; background: #fff; box-shadow: none; }
}
