/* ==========================================================================
   Hoda Admin — Design System
   Enterprise SaaS admin panel (Stripe / Linear inspired)
   ========================================================================== */

:root {
    /* Brand */
    --brand-50: #f5f3ff;
    --brand-100: #ede9fe;
    --brand-200: #ddd6fe;
    --brand-300: #c4b5fd;
    --brand-400: #a78bfa;
    --brand-500: #7c3aed;
    --brand-600: #6d28d9;
    --brand-700: #5b21b6;
    --brand-800: #4c1d95;

    /* Neutrals */
    --gray-25: #fcfcfd;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --color-bg: var(--gray-50);
    --color-surface: #ffffff;
    --color-border: var(--gray-200);
    --color-border-subtle: var(--gray-100);
    --color-text: var(--gray-800);
    --color-text-secondary: var(--gray-500);
    --color-text-muted: var(--gray-400);
    --color-primary: var(--brand-500);
    --color-primary-hover: var(--brand-600);
    --color-primary-subtle: var(--brand-50);
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-info: #2563eb;
    --color-info-bg: #eff6ff;

    /* Accent palette */
    --accent-teal: #0d9488;
    --accent-teal-bg: #ccfbf1;
    --accent-blue: #2563eb;
    --accent-blue-bg: #dbeafe;
    --accent-orange: #ea580c;
    --accent-orange-bg: #ffedd5;
    --accent-green: #16a34a;
    --accent-green-bg: #dcfce7;
    --accent-yellow: #ca8a04;
    --accent-yellow-bg: #fef9c3;
    --accent-pink: #db2777;
    --accent-pink-bg: #fce7f3;
    --accent-indigo: #4338ca;
    --accent-indigo-bg: #e0e7ff;
    --accent-violet: #7e22ce;
    --accent-violet-bg: #f3e8ff;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 60px;
    --content-max-width: 1440px;

    /* Spacing scale (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Typography */
    --font-family: 'Vazirmatn', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

    /* Transitions */
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Legacy aliases */
    --hoda-purple: var(--brand-500);
    --hoda-purple-dark: var(--brand-700);
    --hoda-purple-light: var(--brand-100);
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    background: var(--color-bg);
    color: var(--color-text);
    margin: 0;
}

:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Layout Shell
   ========================================================================== */

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.admin-wrapper.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

.admin-sidebar .brand {
    height: var(--header-height);
    padding: 0 var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
}

.admin-sidebar .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--text-lg);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.admin-sidebar .brand h1 {
    font-size: var(--text-lg);
    margin: 0;
    font-weight: var(--font-bold);
    color: var(--gray-900);
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.admin-wrapper.sidebar-collapsed .brand h1,
.admin-wrapper.sidebar-collapsed .sidebar-nav-label,
.admin-wrapper.sidebar-collapsed .sidebar-nav a span,
.admin-wrapper.sidebar-collapsed .sidebar-badge,
.admin-wrapper.sidebar-collapsed .sidebar-footer span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-3) var(--space-2);
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.sidebar-nav-section {
    margin-bottom: var(--space-4);
}

.sidebar-nav-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: var(--space-2) var(--space-3);
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
}

.sidebar-nav a:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.sidebar-nav a.active {
    background: var(--brand-50);
    color: var(--brand-600);
    font-weight: var(--font-semibold);
}

.sidebar-nav a.active i {
    color: var(--brand-500);
}

.sidebar-nav a i {
    font-size: var(--text-md);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--gray-400);
    transition: color var(--transition-fast);
}

.sidebar-nav a:hover i { color: var(--gray-600); }

.sidebar-badge {
    margin: 0 var(--space-3) var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--brand-50), var(--brand-100));
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    color: var(--brand-700);
    line-height: var(--leading-normal);
    transition: opacity var(--transition-base);
}

.sidebar-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border-subtle);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    position: absolute;
    left: -12px;
    top: calc(var(--header-height) / 2 - 12px);
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    font-size: 12px;
}

.sidebar-collapse-btn:hover {
    background: var(--gray-50);
    color: var(--gray-800);
    border-color: var(--gray-300);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

.admin-main {
    margin-right: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    transition: margin-right var(--transition-slow);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-wrapper.sidebar-collapsed .admin-main {
    margin-right: var(--sidebar-collapsed-width);
}

/* Header / Topbar */
.admin-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.admin-header .header-start {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.admin-header .search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.admin-header .search-box input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
    background: var(--gray-50);
    font-size: var(--text-sm);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.admin-header .search-box input::placeholder { color: var(--color-text-muted); }

.admin-header .search-box input:hover {
    border-color: var(--gray-300);
    background: var(--color-surface);
}

.admin-header .search-box input:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    background: var(--color-surface);
}

.admin-header .search-box i {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    pointer-events: none;
}

.admin-header .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-right: auto;
}

.admin-header .header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.admin-header .header-icon-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-right: var(--space-3);
    border-right: 1px solid var(--color-border-subtle);
    margin-right: var(--space-2);
}

.admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--brand-100);
    color: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.admin-user-info .admin-user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--gray-800);
    line-height: var(--leading-tight);
}

.admin-user-info .admin-user-role {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: var(--leading-tight);
}

/* Content area */
.admin-content {
    padding: var(--space-6);
    flex: 1;
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Page Header & Breadcrumbs
   ========================================================================== */

.page-header {
    margin-bottom: var(--space-6);
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-3);
    font-size: var(--text-sm);
}

.page-breadcrumb li {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-text-muted);
}

.page-breadcrumb li:not(:last-child)::after {
    content: '/';
    margin-right: var(--space-1);
    color: var(--gray-300);
}

.page-breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.page-breadcrumb a:hover { color: var(--brand-500); }

.page-breadcrumb li:last-child {
    color: var(--color-text);
    font-weight: var(--font-medium);
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin: 0;
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

.page-description {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: var(--space-1) 0 0;
    max-width: 640px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-4);
}

.row > [class*="col"] > .panel,
.row > [class*="col"] > .stat-card {
    height: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
}

.panel-title {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.panel-title i { color: var(--color-text-muted); font-size: var(--text-base); }

.panel-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.panel-body-flush {
    margin: calc(var(--space-5) * -1);
    margin-top: 0;
}

/* Stat / KPI cards */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    box-shadow: var(--shadow-xs);
    height: 100%;
    margin-bottom: var(--space-4);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--gray-300);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.stat-body { flex: 1; min-width: 0; }

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-1);
}

.stat-trend {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    margin-top: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.stat-trend.up { color: var(--color-success); }
.stat-trend.down { color: var(--color-danger); }

.stat-card-purple .stat-icon { background: var(--brand-100); color: var(--brand-500); }
.stat-card-orange .stat-icon { background: var(--accent-orange-bg); color: var(--accent-orange); }
.stat-card-teal .stat-icon { background: var(--accent-teal-bg); color: var(--accent-teal); }
.stat-card-blue .stat-icon { background: var(--accent-blue-bg); color: var(--accent-blue); }
.stat-card-green .stat-icon { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-card-yellow .stat-icon { background: var(--accent-yellow-bg); color: var(--accent-yellow); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-hoda {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: inherit;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    line-height: 1.4;
    white-space: nowrap;
}

.btn-hoda:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-hoda-primary {
    background: var(--brand-500);
    color: #fff;
    border-color: var(--brand-500);
}

.btn-hoda-primary:hover:not(:disabled) {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.btn-hoda-secondary {
    background: var(--color-surface);
    color: var(--gray-700);
    border-color: var(--color-border);
}

.btn-hoda-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

.btn-hoda-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-hoda-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-hoda-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-hoda-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-hoda-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-hoda-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

/* Bootstrap overrides */
.btn-primary {
    --bs-btn-bg: var(--brand-500);
    --bs-btn-border-color: var(--brand-500);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-focus-shadow-rgb: 124, 58, 237;
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.btn-outline-secondary {
    --bs-btn-color: var(--gray-600);
    --bs-btn-border-color: var(--color-border);
    --bs-btn-hover-bg: var(--gray-50);
    --bs-btn-hover-border-color: var(--gray-300);
    --bs-btn-hover-color: var(--gray-800);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-500);
    --bs-btn-border-color: var(--brand-300);
    --bs-btn-hover-bg: var(--brand-50);
    --bs-btn-hover-border-color: var(--brand-400);
    --bs-btn-hover-color: var(--brand-600);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.btn-sm { border-radius: var(--radius-md); }

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.quick-btn {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    color: #fff;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: #fff;
}

.quick-btn-teal { background: var(--accent-teal); }
.quick-btn-blue { background: var(--accent-blue); }
.quick-btn-purple { background: var(--brand-500); }
.quick-btn-pink { background: var(--accent-pink); }
.quick-btn-yellow { background: var(--accent-yellow); }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-control,
.form-select {
    font-size: var(--text-sm);
    border-color: var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    color: var(--color-text);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--gray-300);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--color-danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.invalid-feedback {
    font-size: var(--text-xs);
    color: var(--color-danger);
    margin-top: var(--space-1);
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-section {
    margin-bottom: var(--space-6);
}

.form-section-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--gray-800);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-subtle);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.form-check-input:checked {
    background-color: var(--brand-500);
    border-color: var(--brand-500);
}

.form-check-input:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Filter toolbar */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--gray-50);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.filter-toolbar .filter-field {
    flex: 1;
    min-width: 140px;
}

.filter-toolbar .filter-actions {
    display: flex;
    gap: var(--space-2);
    margin-right: auto;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.hoda-table-wrapper {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-subtle);
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    font-size: var(--text-sm);
}

.table > thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--color-border);
}

.table > thead > tr > th {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-secondary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: var(--space-3) var(--space-4);
    vertical-align: middle;
    color: var(--gray-700);
    border-bottom: 1px solid var(--color-border-subtle);
}

.table > tbody > tr:last-child > td {
    border-bottom: none;
}

.table > tbody > tr:hover > td {
    background: var(--gray-25);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.table-toolbar-search {
    position: relative;
    max-width: 280px;
    flex: 1;
}

.table-toolbar-search input {
    width: 100%;
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-8);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--color-surface);
}

.table-toolbar-search i {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* DataTables overrides */
.dataTables_wrapper {
    font-size: var(--text-sm);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-md) !important;
    margin: 0 2px;
    border: 1px solid var(--color-border) !important;
    font-size: var(--text-sm) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand-500) !important;
    border-color: var(--brand-500) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_info {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.dataTables_processing {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--color-text-secondary) !important;
}

/* ==========================================================================
   Badges & Status
   ========================================================================== */

.hoda-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    line-height: 1.5;
    white-space: nowrap;
}

.hoda-badge-success { background: var(--color-success-bg); color: var(--color-success); }
.hoda-badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.hoda-badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.hoda-badge-info { background: var(--color-info-bg); color: var(--color-info); }
.hoda-badge-neutral { background: var(--gray-100); color: var(--gray-600); }
.hoda-badge-brand { background: var(--brand-100); color: var(--brand-600); }

.hoda-badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.report-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    margin: var(--space-1);
}

.report-badge.open { background: var(--color-info-bg); color: #1d4ed8; }
.report-badge.reviewing { background: var(--color-warning-bg); color: #a16207; }
.report-badge.critical { background: var(--color-danger-bg); color: #b91c1c; }

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-content {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: var(--space-5) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--gray-900);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-3) var(--space-5) var(--space-5);
    border-top: 1px solid var(--color-border-subtle);
    gap: var(--space-2);
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

/* Dashboard layout */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
}

.dashboard-welcome {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin: 0;
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

.dashboard-toolbar-sub {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: var(--space-1) 0 0;
}

.dashboard-layout {
    display: flex;
    gap: var(--space-5);
    align-items: flex-start;
}

.dashboard-content {
    flex: 1;
    min-width: 0;
}

.dashboard-page .row > [class*="col"] {
    align-self: flex-start;
}

.dashboard-page .row > [class*="col"] > .panel,
.dashboard-page .panel.dashboard-mini-panel {
    height: auto;
}

.dashboard-page #statCards > [class*="col"] > .stat-card {
    height: auto;
}

.dashboard-page .panel.mt-4 {
    margin-top: var(--space-4) !important;
}

.dashboard-quick-nav {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-3);
    box-shadow: var(--shadow-xs);
}

.dashboard-quick-nav-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: var(--space-2) var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    margin-bottom: var(--space-2);
}

.dashboard-quick-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dashboard-quick-nav a:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.dashboard-quick-nav a i {
    width: 18px;
    text-align: center;
    font-size: var(--text-base);
    color: var(--brand-500);
}

.dashboard-quick-nav a.active {
    background: var(--brand-50);
    color: var(--brand-600);
}

.dashboard-load-error {
    margin-bottom: var(--space-4);
}

.dashboard-section-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--gray-700);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dashboard-priority-alerts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dashboard-alert {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-alert:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.dashboard-alert-warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.dashboard-alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.dashboard-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dashboard-mini-panel {
    padding: var(--space-4) !important;
    margin-bottom: 0;
}

.dashboard-mini-title {
    font-size: var(--text-sm);
    font-weight: 600;
    margin: 0 0 var(--space-3);
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dashboard-mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-mini-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
}

.dashboard-mini-list li:last-child { border-bottom: none; }

.dashboard-profile-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.dashboard-profile-stats > div:not(.dashboard-profile-bar) {
    display: flex;
    justify-content: space-between;
}

.dashboard-profile-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 999px;
    overflow: hidden;
    margin-top: var(--space-1);
}

.dashboard-profile-bar > div {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
    border-radius: 999px;
}

.dashboard-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}

.dashboard-queue-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-subtle);
    background: var(--gray-50);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-queue-card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
    color: inherit;
}

.dashboard-queue-card.is-zero {
    opacity: 0.45;
}

.dashboard-queue-card.is-urgent:not(.is-zero) {
    border-color: #fdba74;
    background: #fff7ed;
}

.dashboard-queue-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--brand-600);
}

.dashboard-queue-card.is-urgent:not(.is-zero) .dashboard-queue-icon {
    background: #ffedd5;
    color: #c2410c;
}

.dashboard-queue-label {
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.4;
}

.dashboard-queue-count {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-900);
}

.dashboard-finance-list,
.dashboard-payment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-finance-list li,
.dashboard-payment-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
}

.dashboard-finance-list li:last-child,
.dashboard-payment-list li:last-child { border-bottom: none; }

.dashboard-report-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.dashboard-report-item {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    border: 1px solid var(--color-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--text-xs);
}

.dashboard-report-item strong {
    font-size: var(--text-lg);
    color: var(--gray-900);
}

.dashboard-report-item.report-critical { border-color: #fecaca; background: #fef2f2; }
.dashboard-report-item.report-spam { border-color: #fed7aa; background: #fff7ed; }
.dashboard-report-item.report-sensitive { border-color: #fde68a; background: #fffbeb; }

.dashboard-quick-notify .form-label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.chart-type-filter .btn {
    font-size: var(--text-xs);
    padding: 4px 10px;
}

.dashboard-panel-priority {
    border-color: color-mix(in srgb, var(--brand-400) 30%, var(--color-border));
}

.dashboard-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
}

.module-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: inherit;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-300);
    color: inherit;
}

.module-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.module-card-title { font-weight: var(--font-semibold); font-size: var(--text-sm); color: var(--gray-900); }
.module-card-desc { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: 2px; }
.module-card-arrow { margin-right: auto; color: var(--color-text-muted); font-size: var(--text-sm); }

.module-card-purple .module-card-icon { background: var(--brand-100); color: var(--brand-500); }
.module-card-teal .module-card-icon { background: var(--accent-teal-bg); color: var(--accent-teal); }
.module-card-blue .module-card-icon { background: var(--accent-blue-bg); color: var(--accent-blue); }
.module-card-indigo .module-card-icon { background: var(--accent-indigo-bg); color: var(--accent-indigo); }
.module-card-pink .module-card-icon { background: var(--accent-pink-bg); color: var(--accent-pink); }
.module-card-orange .module-card-icon { background: var(--accent-orange-bg); color: var(--accent-orange); }
.module-card-violet .module-card-icon { background: var(--accent-violet-bg); color: var(--accent-violet); }
.module-card-slate .module-card-icon { background: var(--gray-100); color: var(--gray-600); }

.queue-item, .fin-row, .payment-item, .notif-item, .ad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
    transition: background var(--transition-fast);
}

.queue-item:last-child { border-bottom: none; }

.track-stat {
    text-align: center;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
}

.track-stat span {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}

.track-stat strong {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
}

.track-stat.pending { background: var(--color-warning-bg); border-color: #fde68a; }
.track-stat.approved { background: var(--color-success-bg); border-color: #a7f3d0; }
.track-stat.rejected { background: var(--color-danger-bg); border-color: #fecaca; }

.approval-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    margin: var(--space-1);
    font-size: var(--text-xs);
    transition: all var(--transition-fast);
}

.approval-chip strong {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--brand-600);
    margin-top: 2px;
}

.pro-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--color-border-subtle);
}

.pro-stat-item:last-child { border-bottom: none; }

.chart-container {
    height: 300px;
    position: relative;
    padding-top: var(--space-2);
}

.period-filter .btn {
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    padding: var(--space-1) var(--space-3);
}

.period-filter .btn.active {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: #fff;
}

.queue-item-link,
.approval-chip-link {
    text-decoration: none;
    color: inherit;
}

.queue-item-link:hover {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin: 0 calc(var(--space-2) * -1);
    padding-right: var(--space-2);
    padding-left: var(--space-2);
}

.approval-chip-link:hover {
    background: var(--brand-50);
    border-color: var(--brand-200);
}

.activity-feed { list-style: none; padding: 0; margin: 0; }

.activity-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--gray-800); }
.activity-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-6);
    color: var(--color-text-secondary);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: var(--text-2xl);
    color: var(--color-text-muted);
}

.empty-state-title {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--gray-800);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 360px;
    margin: 0 auto;
}

/* ==========================================================================
   Settings & Reports
   ========================================================================== */

.settings-item {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.settings-item:last-child { border-bottom: none; }

.settings-item-key {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--gray-900);
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

.settings-item-desc {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.settings-item-value {
    font-size: var(--text-xs);
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--gray-50);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    color: var(--gray-700);
}

.report-output {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: var(--text-xs);
    background: var(--gray-50);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
    max-height: 500px;
    line-height: 1.6;
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-900);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(124, 58, 237, 0.35), transparent),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(13, 148, 136, 0.15), transparent);
    padding: var(--space-4);
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
}

.login-card .brand-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.login-card h2 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.login-card .form-control-lg {
    border-radius: var(--radius-md);
    font-size: var(--text-base);
}

.login-card .btn-primary {
    padding: var(--space-3);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}

.alert-danger {
    background: var(--color-danger-bg);
    border-color: #fecaca;
    color: #991b1b;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-muted { color: var(--color-text-muted) !important; }
.gap-section { margin-bottom: var(--space-6); }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 992px) {
    .sidebar-collapse-btn { display: flex; }
    .admin-sidebar { transform: none !important; }
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(100%);
        box-shadow: var(--shadow-xl);
        width: var(--sidebar-width) !important;
    }

    .admin-sidebar.show { transform: translateX(0); }

    .admin-main,
    .admin-wrapper.sidebar-collapsed .admin-main {
        margin-right: 0;
    }

    .admin-wrapper.sidebar-collapsed .admin-sidebar {
        width: var(--sidebar-width) !important;
    }

    .sidebar-collapse-btn { display: none !important; }

    .admin-header .search-box { display: none; }
    .admin-user-info { display: none !important; }
}

@media (max-width: 991.98px) {
    .dashboard-layout { flex-direction: column-reverse; }
    .dashboard-quick-nav {
        width: 100%;
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1);
        padding: var(--space-3);
    }
    .dashboard-quick-nav-title {
        width: 100%;
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: var(--space-1);
    }
    .dashboard-quick-nav a {
        flex: 1 1 auto;
        justify-content: center;
        min-width: calc(50% - var(--space-1));
    }
}

@media (max-width: 575.98px) {
    .admin-content { padding: var(--space-4); }
    .admin-header { padding: 0 var(--space-4); }
    .quick-actions { flex-direction: column; }
    .quick-btn { width: 100%; justify-content: center; }
    .page-title { font-size: var(--text-xl); }
    .dashboard-welcome { font-size: var(--text-lg); }
    .filter-toolbar { flex-direction: column; }
    .filter-toolbar .filter-field { width: 100%; }
    .filter-toolbar:not(.filters-expanded) .filter-field { display: none; }
    .filter-toolbar.filters-expanded .filter-field { display: block; }
    .filter-toolbar .filter-actions { width: 100%; }
    .dashboard-quick-nav a { min-width: 100%; }
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    padding: var(--space-4);
}

.admin-form-field-check {
    display: flex;
    align-items: flex-end;
}

.admin-form-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border-subtle);
}

.admins-page-row > [class*="col"] {
    align-self: flex-start;
}

.admins-page-row > [class*="col"] > .panel {
    height: auto;
}

#rolesPanel .roles-list {
    padding: 0;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
}

.role-card {
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    overflow: visible;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.role-card.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.role-card-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 0;
    background: transparent;
    text-align: right;
}

.role-card-head:hover {
    background: var(--gray-50);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.role-card-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.5;
}

.role-code-badge {
    flex-shrink: 0;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    line-height: 1.3;
}

.role-card-body {
    padding: 0 var(--space-4) var(--space-4);
    overflow: visible;
}

.role-card-desc {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.7;
    white-space: normal;
    overflow: visible;
}

.role-super-note {
    margin: 0 0 var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-primary) 18%, transparent);
    font-size: var(--text-xs);
    color: var(--gray-700);
    line-height: 1.6;
}

.role-super-note i {
    color: var(--color-primary);
    margin-left: 4px;
}

.role-module-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-2);
    border-top: 1px solid var(--color-border-subtle);
    padding-top: var(--space-2);
}

.role-module-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 6px 0;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.role-module-row.is-partial .role-module-name {
    color: var(--color-warning, #b45309);
}

.role-module-name {
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: 1.4;
}

.role-module-switch {
    flex-shrink: 0;
}

.role-module-switch .form-check-input {
    cursor: pointer;
    margin: 0;
}

.role-module-switch .form-check-input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.permission-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--gray-100);
    border: 1px solid var(--color-border-subtle);
    font-size: var(--text-xs);
    color: var(--gray-700);
    line-height: 1.4;
}

@media (max-width: 767.98px) {
    .admin-form-grid {
        grid-template-columns: 1fr;
    }
}

/* User management (USR) */
.users-page .filter-toolbar {
    gap: var(--space-2);
}

.user-profile-page .user-profile-row {
    align-items: flex-start;
}

.user-profile-page .user-profile-row > [class*="col"] {
    align-self: flex-start;
}

.user-profile-page .user-profile-row > [class*="col"] > .panel {
    height: auto;
    margin-bottom: var(--space-3);
}

.user-profile-card {
    text-align: center;
}

.user-profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.user-profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border-subtle);
    background: var(--gray-100);
}

.user-profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    text-align: center;
}

.user-profile-stats strong {
    display: block;
    font-size: var(--text-lg);
}

.user-profile-meta {
    text-align: right;
    font-size: var(--text-sm);
}

.user-profile-meta p {
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    justify-content: center;
}

.user-detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: flex-start;
}

.user-detail-grid .user-detail-item {
    flex: 0 0 auto;
    width: fit-content;
    max-width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
}

.user-detail-grid .user-detail-item strong {
    display: block;
    margin-top: 2px;
}

.user-badges-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.user-badge-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
}

.user-badge-item .bi-award {
    font-size: 1.5rem;
    color: var(--brand-500);
}

/* Moderation center (MOD) */
.moderation-page .moderation-tabs .nav-link {
    color: var(--gray-700);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: var(--space-2) var(--space-4);
}

.moderation-page .moderation-tabs .nav-link.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-500);
    background: transparent;
    font-weight: 600;
}

.news-page .panel {
    height: auto;
}

/* Moderation center (MOD) */
.moderation-page .mod-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 280px;
    font-size: var(--text-sm);
}

/* LTR layout (English admin UI) */
html[dir="ltr"] .admin-sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--color-border);
}

html[dir="ltr"] .admin-main {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}

html[dir="ltr"] .admin-wrapper.sidebar-collapsed .admin-main {
    margin-right: 0;
    margin-left: var(--sidebar-collapsed-width);
}

html[dir="ltr"] .sidebar-collapse-btn {
    left: auto;
    right: -14px;
}

html[dir="ltr"] .filter-actions {
    margin-right: 0;
    margin-left: auto;
}

html[dir="ltr"] .module-card-arrow {
    margin-right: 0;
    margin-left: auto;
}
