/* ════════════════════════════════════════════════════
   LVIMS Pro — Admin Dashboard Premium CSS
   BS5 + Alpine.js — Flat, Clean, Professional Design
   ════════════════════════════════════════════════════ */

/* ─── CSS Variables / Design Tokens ─────────────────── */
:root {
    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-width: 264px;
    --sidebar-collapsed-width: 72px;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f1f5f9;
    --sidebar-active-bg: #6366f1;
    --sidebar-active-text: #ffffff;
    --sidebar-section-label: #475569;
    --sidebar-border: #1e293b;

    /* Header */
    --header-bg: #ffffff;
    --header-height: 64px;
    --header-border: #e2e8f0;

    /* Content */
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-radius: 10px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Accents */
    --accent: #6366f1;
    --accent-light: #eef2ff;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #0ea5e9;
    --info-light: #f0f9ff;

    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

/* ─── Dark Theme Overrides ──────────────────────────── */
[data-bs-theme="dark"] {
    --header-bg: #1e293b;
    --header-border: #334155;

    --content-bg: #0f172a;

    --card-bg: #1e293b;
    --card-border: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;

    --accent-light: rgba(99, 102, 241, 0.15);
    --success-light: rgba(34, 197, 94, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --info-light: rgba(14, 165, 233, 0.15);
}

/* Fix Bootstrap input backgrounds in dark mode for custom fields */
[data-bs-theme="dark"] .search-input {
    background: #0f172a;
    color: #f8fafc;
    border-color: #334155;
}

[data-bs-theme="dark"] .search-input:focus {
    background: #0f172a;
}

[data-bs-theme="dark"] .search-kbd {
    background: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .notif-dropdown,
[data-bs-theme="dark"] .user-dropdown-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .notif-item {
    border-color: #334155;
}

[data-bs-theme="dark"] .notif-item.unread {
    background: #0f172a;
}

[data-bs-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: var(--content-bg) !important;
}

[data-bs-theme="dark"] .card-body[style*="#fcfdfe"] {
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-bs-theme="dark"] .text-secondary {
    color: var(--text-secondary) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .border {
    border-color: var(--card-border) !important;
}

[data-bs-theme="dark"] .card-body[style*="#fcfdfe"] {
    background-color: #0f172a !important;
}

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

html,
body {
    overflow-x: clip;
}

body {
    font-family: var(--font-family);
    background-color: var(--content-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[x-cloak] {
    display: none !important;
}

/* ─── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════ */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow: hidden;
}

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

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: #f8fafc;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* ─── Navigation ────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px;
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-label);
    padding: 16px 10px 6px;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    position: relative;
}

.nav-item i:first-child {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

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

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-item.active:hover {
    background: #5558e6;
}

/* Arrow */
.nav-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.5;
    transition: transform 0.15s ease;
}

.nav-toggle.is-open .nav-arrow {
    transform: rotate(90deg);
}

/* Submenu */
.nav-submenu {
    padding-left: 44px;
}

.nav-sub-item {
    display: block;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    white-space: nowrap;
}

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

.nav-sub-item.active {
    color: var(--sidebar-text-hover);
    font-weight: 600;
}

/* ─── Sidebar Footer ───────────────────────────────── */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-meta {
    overflow: hidden;
}

.user-name {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--sidebar-text);
    font-size: 0.72rem;
    font-weight: 500;
}

/* ─── Sidebar Overlay (Mobile) ──────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

/* ════════════════════════════════════════════════════
   MAIN WRAPPER
   ════════════════════════════════════════════════════ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════ */
.admin-header {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Header button */
.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    position: relative;
}

.header-btn:hover {
    background: var(--content-bg);
    color: var(--text-primary);
}

/* Breadcrumb */
.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.bc-item {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

.bc-sep {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.bc-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Search */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 260px;
    height: 38px;
    padding: 0 40px 0 36px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--content-bg);
    font-family: var(--font-family);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

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

.search-kbd {
    position: absolute;
    right: 10px;
    font-size: 0.65rem;
    font-family: var(--font-family);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Notification badge */
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Notification dropdown */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.12);
    z-index: 1050;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--card-border);
}

.notif-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.9rem;
}

.notif-mark-read {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
}

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

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    align-items: flex-start;
}

.notif-item.unread {
    background: #fafbff;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.notif-text {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.notif-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.notif-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--card-border);
}

.notif-footer a {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

/* ─── User Dropdown ─────────────────────────────────── */
.user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 5px 12px 5px 5px;
    cursor: pointer;
    font-family: var(--font-family);
}

.user-trigger:hover {
    background: var(--content-bg);
}

.user-trigger-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
}

.user-trigger-avatar img,
.udm-avatar img,
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.user-trigger-meta {
    text-align: left;
    line-height: 1.2;
}

.user-trigger-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-trigger-email {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-trigger-arrow {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.header-user-dropdown {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    padding: 6px;
}

.udm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

.udm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.udm-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.udm-email {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.udm-divider {
    height: 1px;
    background: var(--card-border);
    margin: 4px 0;
}

.udm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
}

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

.udm-item i {
    font-size: 1rem;
}

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

.udm-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ════════════════════════════════════════════════════
   CONTENT AREA
   ════════════════════════════════════════════════════ */
.admin-content {
    flex: 1;
    padding: 16px 20px;
}

/* ════════════════════════════════════════════════════
   DASHBOARD COMPONENTS (used in home.blade.php)
   ════════════════════════════════════════════════════ */

/* ─── Page Header ───────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-header-left p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Stat Cards ────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 22px;
}

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

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

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

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

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

.stat-card-icon.info {
    background: var(--info-light);
    color: var(--info);
}

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

.stat-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.stat-badge.up {
    background: var(--success-light);
    color: var(--success);
}

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

.stat-badge.neutral {
    background: var(--content-bg);
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ─── Dashboard Cards ──────────────────────────────── */
.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
}

.dash-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.dash-card-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.dash-card-body {
    padding: 0 22px 22px;
}

.dash-card-body.no-pt {
    padding-top: 0;
}

/* ─── Activity Feed ─────────────────────────────────── */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--card-border);
    align-items: flex-start;
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin: 0 0 2px;
    font-weight: 500;
    line-height: 1.4;
}

.activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Quick Actions ─────────────────────────────────── */
.quick-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-bg);
    text-decoration: none;
    cursor: pointer;
}

.quick-action-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.qa-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.qa-text h6 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.qa-text p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Data Table ────────────────────────────────────── */
.admin-table {
    width: 100%;
    font-size: 0.82rem;
}

.admin-table thead th {
    background: var(--content-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    border: none;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
    color: var(--text-primary);
}

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

/* User row */
.table-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

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

.table-user-email {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
}

.status-badge.active {
    background: var(--success-light);
    color: var(--success);
}

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

.status-badge.inactive {
    background: var(--content-bg);
    color: var(--text-muted);
}

/* ─── Server Status Widget ──────────────────────────── */
.server-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}

.server-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.server-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.server-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.server-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.server-percent {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── Progress Bars ─────────────────────────────────── */
.mini-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--content-bg);
    overflow: hidden;
}

.mini-progress-bar {
    height: 100%;
    border-radius: 3px;
}

/* ─── Buttons ───────────────────────────────────────── */
.btn-admin {
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-admin:hover {
    background: var(--content-bg);
    color: var(--text-primary);
}

.btn-admin-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-admin-primary:hover {
    background: #5558e6;
    border-color: #5558e6;
    color: #fff;
}

/* ════════════════════════════════════════════════════
   SIDEBAR COLLAPSED STATE (Desktop)
   ════════════════════════════════════════════════════ */
.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-arrow,
.sidebar-collapsed .nav-submenu,
.sidebar-collapsed .user-meta {
    display: none;
}

.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 20px 0 16px;
}

.sidebar-collapsed .sidebar-nav {
    padding: 12px 8px;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .nav-item i:first-child {
    width: auto;
}

.sidebar-collapsed .sidebar-footer {
    padding: 12px 8px;
}

.sidebar-collapsed .sidebar-user-card {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */

/* ─── XL breakpoint: ≤1199px (Sidebar off-canvas) ──── */
@media (max-width: 1199.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .sidebar-mobile-open .admin-sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

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

    .admin-content {
        padding: 20px 16px;
    }
}

/* ─── LG breakpoint: ≤991px ────────────────────────── */
@media (max-width: 991.98px) {
    .admin-header {
        padding: 0 16px;
        gap: 8px;
    }

    .header-right {
        gap: 8px;
    }

    /* Shrink search on tablets */
    .search-input {
        width: 200px;
    }

    /* User dropdown: position for smaller screens */
    .user-dropdown-menu {
        right: -10px;
    }

    .notif-dropdown {
        width: 320px;
        right: -40px;
    }

    .admin-content {
        padding: 16px 14px;
    }

    .page-header {
        margin-bottom: 22px;
    }

    .page-header-left h1 {
        font-size: 1.35rem;
    }

    /* Stat cards — tighten */
    .stat-card {
        padding: 18px;
    }

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

    /* Dashboard card bodies */
    .dash-card-header {
        padding: 16px 18px 12px;
    }

    .dash-card-body {
        padding: 0 18px 18px;
    }
}

/* ─── MD breakpoint: ≤767px (Phone landscape / small tablet) */
@media (max-width: 767.98px) {
    .admin-header {
        padding: 0 12px;
        height: 56px;
    }

    .header-right {
        gap: 6px;
    }

    /* Smaller header buttons on mobile */
    .header-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        border-radius: 6px;
    }

    .admin-content {
        padding: 12px 14px !important;
        overflow-x: hidden;
    }

    /* Override Bootstrap px-4/py-4 on child containers in admin-content */
    .admin-content>.container-fluid,
    .admin-content .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .admin-content .container-fluid.px-4,
    .admin-content .container-fluid.px-3,
    .admin-content .container-fluid.px-md-4 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .admin-content .container-fluid.py-4,
    .admin-content .container-fluid.py-3 {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    /* Keep row gutters aligned with admin-content padding */
    .admin-content .row {
        --bs-gutter-x: 0.75rem;
        margin-left: -6px !important;
        margin-right: -6px !important;
    }

    .admin-content .row>* {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Compact spacing utilities on mobile */
    .admin-content .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .admin-content .my-4 {
        margin-top: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .admin-content .py-4 {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
    }

    .admin-content .px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .admin-content .card-body {
        padding: 12px 10px;
    }


    /* Stat cards */
    .stat-value {
        font-size: 1.35rem;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    /* Page header */
    .page-header {
        margin-bottom: 18px;
        gap: 12px;
    }

    .page-header-left h1 {
        font-size: 1.2rem;
    }

    .page-header-left p {
        font-size: 0.8rem;
    }

    .page-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Notification dropdown — full width anchored */
    .notif-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--card-radius) var(--card-radius) 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    }

    .notif-list {
        max-height: 45vh;
    }

    /* User dropdown — full width on mobile */
    .user-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: var(--card-radius) var(--card-radius) 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    }

    /* User trigger: hide text, show avatar only */
    .user-trigger {
        padding: 4px;
        border: none;
    }

    /* Dashboard cards */
    .dash-card-header {
        padding: 14px 16px 10px;
    }

    .dash-card-title {
        font-size: 0.88rem;
    }

    .dash-card-body {
        padding: 0 16px 16px;
    }

    /* Activity feed */
    .activity-item {
        gap: 10px;
        padding: 10px 0;
    }

    .activity-icon {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .activity-text {
        font-size: 0.78rem;
    }

    /* Quick actions */
    .quick-action-card {
        padding: 12px;
        gap: 10px;
    }

    .qa-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .qa-text h6 {
        font-size: 0.8rem;
    }

    .qa-text p {
        font-size: 0.7rem;
    }

    /* ─── Universal Responsive Tables ─── */
    .table-responsive {
        -webkit-overflow-scrolling: touch !important;
        border-radius: var(--card-radius);
        margin-bottom: 0.75rem;
        max-width: 100%;
        overflow-x: auto !important;
    }

    .table-responsive .table,
    .table-responsive>table,
    .table-premium table,
    .table:not(.table-sm-compact):not(.table-borderless) {
        min-width: 600px;
        font-size: 0.8rem !important;
    }

    .table thead th,
    .admin-table thead th {
        font-size: 0.7rem !important;
        padding: 8px 10px !important;
        white-space: nowrap !important;
        text-transform: uppercase !important;
        letter-spacing: 0.03em !important;
    }

    .table tbody td,
    .admin-table tbody td {
        padding: 8px 10px !important;
        font-size: 0.78rem !important;
        vertical-align: middle !important;
    }

    /* Badges in tables */
    .table .badge,
    .table .status-badge {
        font-size: 0.68rem !important;
        padding: 3px 7px !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
    }

    /* Action buttons in table cells */
    .table td .btn,
    .table td .btn-sm,
    .table td .action-btn {
        padding: 4px 8px !important;
        font-size: 0.74rem !important;
        line-height: 1.2 !important;
        border-radius: 6px !important;
    }

    .table td .btn-group {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        gap: 2px !important;
    }

    .table td.text-end,
    .table th.text-end {
        white-space: nowrap !important;
    }

    /* ─── Filter Cards & Search Bars ─── */
    .filter-card {
        padding: 12px 10px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    .filter-card .row {
        --bs-gutter-y: 0.5rem;
        row-gap: 8px !important;
    }

    .filter-card .form-control,
    .filter-card .form-select,
    .filter-card .search-input,
    .filter-card .input-group {
        height: 38px !important;
        font-size: 0.84rem !important;
        width: 100% !important;
    }

    .filter-card .input-group-text {
        font-size: 0.84rem !important;
        padding: 0 10px !important;
    }

    .filter-card .btn,
    .filter-card button {
        min-height: 38px !important;
        font-size: 0.82rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .filter-card .view-toggle {
        display: inline-flex !important;
        gap: 4px !important;
    }

    .filter-card .float-right,
    .filter-card .float-end {
        float: none !important;
    }

    /* ─── Action Buttons & Header Actions ─── */
    .page-header-actions,
    .header-content-wrap {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .page-header-actions .btn,
    .header-content-wrap .btn,
    .page-header .btn-lg,
    .licenses-header .btn-lg,
    .payments-header .btn-lg {
        font-size: 0.82rem !important;
        padding: 6px 12px !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .btn-admin {
        font-size: 0.78rem;
        padding: 6px 14px;
    }

    /* Dropdown Menus */
    .dropdown-menu {
        max-width: calc(100vw - 24px) !important;
        border-radius: 10px !important;
        font-size: 0.82rem !important;
    }

    .dropdown-item {
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
    }

    /* Pagination / Table Footers */
    .pagination-container,
    .card-footer .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        text-align: center !important;
    }

    .pagination {
        flex-wrap: wrap !important;
        justify-content: center !important;
        margin-bottom: 0 !important;
    }

    .pagination .page-link {
        padding: 4px 8px !important;
        font-size: 0.78rem !important;
        min-width: 32px !important;
        height: 32px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Server widget */
    .server-item {
        padding: 10px 0;
    }

    .server-name {
        font-size: 0.78rem;
    }

    .server-detail {
        font-size: 0.68rem;
    }
}

/* ─── SM breakpoint: ≤575px (Phone portrait) ──────── */
@media (max-width: 575.98px) {
    .admin-header {
        padding: 0 10px;
        height: 52px;
    }

    .header-left,
    .header-right {
        gap: 6px;
    }

    .header-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .admin-content {
        padding: 10px 12px !important;
        overflow-x: hidden;
    }

    .admin-content>.container-fluid,
    .admin-content .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .admin-content .container-fluid.px-4,
    .admin-content .container-fluid.px-3,
    .admin-content .container-fluid.px-2,
    .admin-content .container-fluid.px-md-4 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .admin-content .container-fluid.py-4,
    .admin-content .container-fluid.py-3,
    .admin-content .container-fluid.py-2 {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .admin-content .row {
        --bs-gutter-x: 0.5rem;
        margin-left: -4px !important;
        margin-right: -4px !important;
    }

    .admin-content .row>* {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .admin-content .card {
        margin-bottom: 8px;
    }

    .admin-content .card-body {
        padding: 10px 8px;
    }

    .admin-content .card-header {
        padding: 10px 8px;
    }

    .admin-content .card-footer {
        padding: 8px;
    }

    .admin-content .mb-4 {
        margin-bottom: 10px !important;
    }

    .admin-content .my-4 {
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }

    .admin-content .py-4 {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .admin-content .px-4 {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .admin-content .p-4 {
        padding: 8px !important;
    }

    .admin-content .mb-3 {
        margin-bottom: 8px !important;
    }

    /* ===== Support Tickets (admin) ===== */
    .adm-ticket-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1.1rem;
        border-bottom: 1px solid var(--adm-border);
        flex-wrap: wrap;
    }

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

    .adm-ticket-row:hover {
        background: var(--adm-surface-2);
    }

    .adm-priority-pill {
        display: inline-flex;
        align-items: center;
        gap: .3rem;
        padding: .22rem .6rem;
        border-radius: 20px;
        font-size: .7rem;
        font-weight: 700;
    }

    .adm-priority-low {
        background: rgba(100, 116, 139, .12);
        color: #64748b;
    }

    .adm-priority-medium {
        background: var(--adm-warning-soft);
        color: var(--adm-warning);
    }

    .adm-priority-high {
        background: rgba(234, 88, 12, .14);
        color: #ea580c;
    }

    .adm-priority-urgent {
        background: var(--adm-danger-soft);
        color: var(--adm-danger);
    }

    .adm-ticket-head {
        background: var(--adm-surface);
        border: 1px solid var(--adm-border);
        border-radius: var(--adm-radius);
        padding: 1.5rem;
        box-shadow: var(--adm-shadow);
        margin-bottom: 1.25rem;
    }

    .adm-ticket-thread {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .adm-msg-bubble {
        max-width: 75%;
        padding: 1rem 1.15rem;
        border-radius: 14px;
        position: relative;
    }

    .adm-msg-bubble-user {
        background: var(--adm-surface-2);
        border: 1px solid var(--adm-border);
        align-self: flex-start;
        border-top-left-radius: 4px;
    }

    .adm-msg-bubble-staff {
        background: var(--adm-accent-grad);
        color: #fff;
        align-self: flex-end;
        border-top-right-radius: 4px;
        margin-left: auto;
    }

    .adm-msg-meta {
        font-size: .74rem;
        margin-bottom: .4rem;
        font-weight: 700;
        opacity: .85;
    }

    .adm-msg-bubble-staff .adm-msg-meta {
        color: rgba(255, 255, 255, .85);
    }

    .adm-msg-bubble-user .adm-msg-meta {
        color: var(--adm-text-muted);
    }

    .adm-msg-attachment {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        font-size: .78rem;
        margin-top: .6rem;
        padding: .4rem .7rem;
        border-radius: 8px;
        background: rgba(0, 0, 0, .06);
        color: inherit;
        text-decoration: none;
    }

    .adm-msg-bubble-staff .adm-msg-attachment {
        background: rgba(255, 255, 255, .18);
        color: #fff;
    }

    @media (max-width:767.98px) {
        .adm-msg-bubble {
            max-width: 92%;
        }
    }

    .adm-compose-box {
        background: var(--adm-surface);
        border: 1px solid var(--adm-border);
        border-radius: var(--adm-radius);
        padding: 1.25rem;
        box-shadow: var(--adm-shadow);
    }

    /* ===== FAQ Management ===== */
    .faq-drag-row {
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: .85rem 1rem;
        border-bottom: 1px solid var(--adm-border);
    }

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

    .faq-drag-handle {
        cursor: grab;
        color: var(--adm-text-muted);
    }


    /* 2x2 Grid for Stat cards on mobile */
    .row.g-3.mb-4>.col-md-3,
    .row.g-2.mb-3>.col-md-3,
    .row.mb-4>.col-md-3,
    .row>.col-md-3 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .stat-card,
    .stats-card {
        padding: 10px 8px !important;
        border-radius: 10px !important;
        margin-bottom: 6px !important;
    }

    .stat-value,
    .stats-card .value {
        font-size: 1.15rem !important;
        line-height: 1.2 !important;
        margin: 2px 0 !important;
        letter-spacing: -0.02em;
    }

    .stat-label,
    .stats-card .label {
        font-size: 0.68rem !important;
        line-height: 1.2 !important;
    }

    .stat-card-icon,
    .stats-card .icon {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.85rem !important;
        border-radius: 6px !important;
    }

    .stat-card .display-6,
    .stats-card .display-6 {
        font-size: 1.4rem !important;
    }

    .stat-badge {
        font-size: 0.62rem;
        padding: 2px 6px;
    }

    /* Page header */
    .page-header {
        margin-bottom: 14px;
        gap: 10px;
    }

    .page-header-left h1 {
        font-size: 1.1rem;
    }

    .page-header-left p {
        font-size: 0.76rem;
    }

    .page-header-actions {
        gap: 6px;
    }

    .page-header-actions .btn-admin {
        font-size: 0.72rem;
        padding: 5px 10px;
    }

    /* Dashboard cards */
    .dash-card-header {
        padding: 12px 14px 8px;
    }

    .dash-card-title {
        font-size: 0.82rem;
    }

    .dash-card-body {
        padding: 0 14px 14px;
    }

    /* Activity feed */
    .activity-item {
        gap: 8px;
        padding: 8px 0;
    }

    .activity-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .activity-text {
        font-size: 0.75rem;
    }

    .activity-time {
        font-size: 0.65rem;
    }

    /* Quick actions */
    .quick-action-card {
        padding: 10px;
        gap: 8px;
        border-radius: 8px;
    }

    .qa-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .qa-text h6 {
        font-size: 0.76rem;
    }

    .qa-text p {
        font-size: 0.65rem;
    }

    /* Tables */
    .table-responsive .table,
    .table-responsive>table,
    .table-premium table,
    .table:not(.table-sm-compact):not(.table-borderless) {
        min-width: 560px;
        font-size: 0.76rem !important;
    }

    .table thead th,
    .admin-table thead th {
        font-size: 0.65rem !important;
        padding: 6px 8px !important;
    }

    .table tbody td,
    .admin-table tbody td {
        padding: 6px 8px !important;
        font-size: 0.74rem !important;
    }

    /* Modals on small screens */
    .modal-dialog {
        margin: 8px !important;
        max-width: calc(100% - 16px) !important;
    }

    .modal-content {
        border-radius: 12px !important;
    }

    .modal-header {
        padding: 10px 12px !important;
    }

    .modal-body {
        padding: 12px 10px !important;
    }

    .modal-footer {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    .table-user {
        gap: 8px;
    }

    .table-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }

    .table-user-name {
        font-size: 0.75rem;
    }

    .table-user-email {
        font-size: 0.65rem;
    }

    /* Status badges */
    .status-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
        gap: 3px;
    }

    /* Server widget */
    .server-item {
        padding: 8px 0;
        flex-wrap: wrap;
        gap: 4px;
    }

    .server-name {
        font-size: 0.75rem;
    }

    .server-percent {
        font-size: 0.78rem;
    }

    /* Progress bars */
    .mini-progress {
        height: 5px;
    }

    /* Buttons */
    .btn-admin {
        font-size: 0.75rem;
        padding: 6px 12px;
        gap: 4px;
    }

    /* Notification items */
    .notif-item {
        padding: 12px 16px;
        gap: 10px;
    }

    .notif-text {
        font-size: 0.78rem;
    }

    .notif-time {
        font-size: 0.68rem;
    }

    .notif-header {
        padding: 14px 16px 10px;
    }

    .notif-header h6 {
        font-size: 0.85rem;
    }

    /* Sidebar (when open on mobile) */
    .admin-sidebar {
        width: min(var(--sidebar-width), 85vw);
    }

    .sidebar-brand {
        padding: 16px 16px 12px;
    }

    .brand-text {
        font-size: 1.05rem;
    }

    .nav-item {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .sidebar-user-card {
        padding: 8px;
        gap: 8px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .user-name {
        font-size: 0.78rem;
    }

    .user-role {
        font-size: 0.68rem;
    }

    /* User dropdown header */
    .udm-header {
        padding: 12px 16px;
    }

    .udm-item {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* ════════════════════════════════════════════════════
   SELECT2 THEME INTEGRATION
   ════════════════════════════════════════════════════ */
.select2-container--default .select2-selection--single {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    height: 38px !important;
    border-radius: 6px !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    padding-left: 12px !important;
    padding-right: 20px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-secondary) !important;
}

.select2-dropdown {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 6px !important;
    z-index: 9999;
}

.select2-container--default .select2-search--dropdown {
    padding: 8px !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--content-bg) !important;
    border: 1px solid var(--card-border) !important;
    color: var(--text-primary) !important;
    border-radius: 4px !important;
    padding: 6px !important;
}

.select2-container--default .select2-results__option {
    color: var(--text-primary) !important;
    background-color: transparent !important;
    padding: 6px 12px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--content-bg) !important;
    color: var(--text-primary) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--card-border) !important;
}

/* ─── Purple Utilities & Badges ───────────────────────── */
.bg-purple-subtle {
    background-color: #f3e8ff !important;
}

.text-purple {
    color: #7e22ce !important;
}

.border-purple-subtle {
    border-color: #d8b4fe !important;
}

.border-purple {
    border-color: #9333ea !important;
}

.badge.bg-purple-subtle {
    background-color: #f3e8ff !important;
    color: #7e22ce !important;
    border: 1px solid #d8b4fe !important;
    font-weight: 600;
}

[data-bs-theme="dark"] .bg-purple-subtle,
.dark-mode .bg-purple-subtle {
    background-color: rgba(147, 51, 234, 0.25) !important;
}

[data-bs-theme="dark"] .text-purple,
.dark-mode .text-purple {
    color: #d8b4fe !important;
}

[data-bs-theme="dark"] .border-purple-subtle,
.dark-mode .border-purple-subtle {
    border-color: rgba(147, 51, 234, 0.45) !important;
}

[data-bs-theme="dark"] .badge.bg-purple-subtle,
.dark-mode .badge.bg-purple-subtle {
    background-color: rgba(147, 51, 234, 0.25) !important;
    color: #e9d5ff !important;
    border: 1px solid rgba(147, 51, 234, 0.5) !important;
}

/* ════════════════════════════════════════════════════
   GLOBAL COMPONENTS: STATS CARDS & VIEW TOGGLE
   ════════════════════════════════════════════════════ */

/* ─── Gradient Stats Cards ──────────────────────────── */
.stats-card {
    border-radius: 12px;
    padding: 1.5rem;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    transform: translate(30%, -30%);
    pointer-events: none;
}

.stats-card .icon {
    font-size: 2.5rem;
    opacity: 0.9;
    line-height: 1;
}

.stats-card .value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1.1;
}

.stats-card .label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

/* ─── View Toggle (List / Grid Switcher) ─────────────── */
.view-toggle {
    background: #ffffff;
    border-radius: 8px;
    padding: 0.25rem;
    display: inline-flex;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.view-toggle button {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.25s ease;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
}

.view-toggle button:hover {
    color: #0f172a;
}

.view-toggle button.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

[data-bs-theme="dark"] .view-toggle {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border);
}

[data-bs-theme="dark"] .view-toggle button {
    color: var(--text-muted);
}

[data-bs-theme="dark"] .view-toggle button:hover {
    color: var(--text-primary);
}

[data-bs-theme="dark"] .view-toggle button.active {
    color: #ffffff;
}

/* ─── Responsive Stats Cards & View Toggle ─────────── */
@media (max-width: 767.98px) {
    .stats-card {
        padding: 1rem;
        border-radius: 10px;
    }

    .stats-card .icon {
        font-size: 2rem;
    }

    .stats-card .value {
        font-size: 1.5rem;
        margin: 0.25rem 0;
    }

    .stats-card .label {
        font-size: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .stats-card {
        padding: 0.85rem;
    }

    .stats-card .icon {
        font-size: 1.5rem;
    }

    .stats-card .value {
        font-size: 1.2rem;
    }

    .stats-card .label {
        font-size: 0.68rem;
    }

    .stats-card::before {
        width: 60px;
        height: 60px;
    }

    .view-toggle button {
        padding: 0.4rem 0.75rem;
        font-size: 0.78rem;
    }

    .form-select {
        font-size: 0.82rem;
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }
}

/* ─── Flex Utility ─────────────────────────────────── */
.min-w-0 {
    min-width: 0 !important;
}

/* ─── Global Button Styling & Padding Fixes ─────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    line-height: 1.25;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #ffffff !important;
}

.btn.rounded-pill {
    padding: 0.6rem 1.35rem;
}

.btn.rounded-pill.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
}

.btn.rounded-pill.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.05rem;
}

/* ════════════════════════════════════════════════════
   COMPACT MODE (matches editor theme density)
   Enabled by default; toggle from the header.
   ════════════════════════════════════════════════════ */
body.compact-mode {
    --header-height: 49px;
    --sidebar-width: 210px;
    --sidebar-collapsed-width: 58px;
}

body.compact-mode .admin-header {
    padding: 0 16px;
}

body.compact-mode .header-left,
body.compact-mode .header-right {
    gap: 10px;
}

body.compact-mode .header-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
}

body.compact-mode .search-input {
    width: 234px;
    height: 34px;
}

body.compact-mode .user-trigger {
    padding: 4px 10px 4px 4px;
}

body.compact-mode .user-trigger-avatar {
    width: 29px;
    height: 29px;
}

body.compact-mode .admin-content {
    padding: 0.75rem 0.9rem !important;
}

body.compact-mode .sidebar-brand {
    padding: 14px 16px 12px;
}

body.compact-mode .nav-section-label {
    padding: 10px 8px 4px;
}

body.compact-mode .nav-item {
    padding: 6px 10px;
    font-size: 0.82rem;
}

body.compact-mode .nav-item i:first-child {
    font-size: 1rem;
}

body.compact-mode .nav-sub-item {
    padding: 5px 10px;
    font-size: 0.78rem;
}

body.compact-mode .page-header {
    margin-bottom: 0.8rem !important;
    gap: 0.75rem;
}

body.compact-mode .page-header-left h1 {
    font-size: 1.15rem;
}

body.compact-mode .page-header-left p {
    font-size: 0.78rem;
}

body.compact-mode .stat-card,
body.compact-mode .stats-card {
    padding: 0.85rem 0.9rem !important;
    border-radius: 10px !important;
}

body.compact-mode .stat-icon-wrapper {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-radius: 9px;
}

body.compact-mode .stat-card-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border-radius: 8px;
}

body.compact-mode .stats-card .icon {
    font-size: 1.6rem;
}

body.compact-mode .stat-value {
    font-size: 1.35rem;
    margin-top: 0.6rem;
    margin-bottom: 0.15rem;
}

body.compact-mode .stats-card .value {
    font-size: 1.35rem;
    margin: 0.25rem 0;
}

body.compact-mode .stats-card .label {
    font-size: 0.7rem;
}

body.compact-mode .dash-card-header {
    padding: 0.7rem 0.9rem 0.45rem;
}

body.compact-mode .dash-card-head {
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.45rem;
}

body.compact-mode .dash-card-title {
    font-size: 0.85rem;
}

body.compact-mode .dash-card-subtitle {
    font-size: 0.72rem;
}

body.compact-mode .dash-card-body {
    padding: 0 0.9rem 0.9rem;
}

body.compact-mode .dash-card {
    padding: 0.7rem 0.75rem;
}

body.compact-mode .filter-card {
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.6rem;
}

body.compact-mode .admin-content .card {
    margin-bottom: 0.75rem;
    border-radius: 10px;
}

body.compact-mode .admin-content .card-header {
    padding: 0.65rem 0.85rem;
}

body.compact-mode .admin-content .card-body {
    padding: 0.75rem 0.85rem;
}

body.compact-mode .admin-content .card-footer {
    padding: 0.55rem 0.85rem;
}

body.compact-mode .admin-table {
    font-size: 0.78rem;
}

body.compact-mode .admin-table thead th {
    padding: 0.4rem 0.6rem;
    font-size: 0.64rem;
}

body.compact-mode .admin-table tbody td {
    padding: 0.45rem 0.6rem;
}

body.compact-mode .admin-content .table > :not(caption) > * > * {
    padding: 0.45rem 0.6rem;
}

body.compact-mode .btn-admin,
body.compact-mode .view-toggle {
    height: 30px;
}

body.compact-mode .btn-admin {
    padding: 0 0.7rem;
    font-size: 0.78rem;
}

body.compact-mode .btn-admin-icon {
    width: 30px;
    height: 30px;
}

body.compact-mode .view-toggle button,
body.compact-mode .view-toggle a {
    padding: 0 0.55rem;
    font-size: 0.78rem;
}

body.compact-mode .btn.rounded-pill {
    padding: 0.4rem 1rem;
}

body.compact-mode .btn.rounded-pill.btn-sm {
    padding: 0.28rem 0.7rem;
}

body.compact-mode .badge-status {
    padding: 0.12rem 0.4rem;
    font-size: 0.6rem;
}

body.compact-mode .alert {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
}

body.compact-mode .admin-content .mb-4 {
    margin-bottom: 0.7rem !important;
}

body.compact-mode .admin-content .my-4 {
    margin-top: 0.7rem !important;
    margin-bottom: 0.7rem !important;
}

body.compact-mode .admin-content .mb-3 {
    margin-bottom: 0.5rem !important;
}

body.compact-mode .admin-content .mt-3 {
    margin-top: 0.5rem !important;
}

body.compact-mode .admin-content .gap-3 {
    gap: 0.5rem !important;
}

body.compact-mode .admin-content .g-4 {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
}

body.compact-mode .admin-content .g-3 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

body.compact-mode .admin-content .py-5 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

body.compact-mode .admin-content .py-4 {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
}

body.compact-mode .admin-content .p-4 {
    padding: 0.8rem !important;
}

body.compact-mode .admin-content .px-4 {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}

body.compact-mode .admin-content .fs-2 {
    font-size: 1.25rem !important;
}

body.compact-mode .admin-content .form-control-sm,
body.compact-mode .admin-content .form-select-sm {
    font-size: 0.78rem;
    padding: 0.28rem 0.5rem;
}

/* Compact typography: match the editor's smaller content scale. */
body.compact-mode .admin-content {
    font-size: 0.92rem;
    line-height: 1.45;
}

body.compact-mode .admin-content .h1 {
    font-size: 1.35rem;
}

body.compact-mode .admin-content .h2 {
    font-size: 1.25rem;
}

body.compact-mode .admin-content .h3 {
    font-size: 1.18rem;
}

body.compact-mode .admin-content .h4 {
    font-size: 1.05rem;
}

body.compact-mode .admin-content .h5 {
    font-size: 0.95rem;
}

body.compact-mode .admin-content .h6 {
    font-size: 0.85rem;
}

body.compact-mode .admin-content h1:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 1.35rem;
}

body.compact-mode .admin-content h2:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 1.25rem;
}

body.compact-mode .admin-content h3:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 1.18rem;
}

body.compact-mode .admin-content h4:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 1.05rem;
}

body.compact-mode .admin-content h5:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 0.95rem;
}

body.compact-mode .admin-content h6:not(.h1):not(.h2):not(.h3):not(.h4):not(.h5):not(.h6) {
    font-size: 0.85rem;
}

body.compact-mode .admin-content .form-control,
body.compact-mode .admin-content .form-select {
    font-size: 0.85rem;
}

body.compact-mode .admin-content .form-label {
    font-size: 0.82rem;
}

body.compact-mode .admin-content .btn {
    font-size: 0.82rem;
}

body.compact-mode .admin-content .card-title {
    font-size: 0.95rem;
}

body.compact-mode .admin-content .card-header {
    font-size: 0.9rem;
}

body.compact-mode .admin-content .pagination {
    font-size: 0.82rem;
}

/* Keep the compact density intact on small screens. */
@media (max-width: 767.98px) {
    body.compact-mode .admin-content {
        padding: 0.65rem 0.75rem !important;
    }

    body.compact-mode .page-header {
        margin-bottom: 0.65rem !important;
    }
}

@media (max-width: 575.98px) {
    body.compact-mode .admin-content {
        padding: 0.55rem 0.65rem !important;
    }

    body.compact-mode .stat-card,
    body.compact-mode .stats-card {
        padding: 0.7rem 0.75rem !important;
    }
}
/* Fractional spacing utilities (Tailwind parity) */
.p-0.5 { padding: 0.125rem; }
.p-1.5 { padding: 0.375rem; }
.p-2.5 { padding: 0.625rem; }
.p-3.5 { padding: 0.875rem; }
.px-0.5 { padding-left: 0.125rem; padding-right: 0.125rem; }
.px-1.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.py-0.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.pt-0.5 { padding-top: 0.125rem; }
.pt-1.5 { padding-top: 0.375rem; }
.pt-2.5 { padding-top: 0.625rem; }
.pt-3.5 { padding-top: 0.875rem; }
.pb-0.5 { padding-bottom: 0.125rem; }
.pb-1.5 { padding-bottom: 0.375rem; }
.pb-2.5 { padding-bottom: 0.625rem; }
.pb-3.5 { padding-bottom: 0.875rem; }
.pl-0.5 { padding-left: 0.125rem; }
.pl-1.5 { padding-left: 0.375rem; }
.pl-2.5 { padding-left: 0.625rem; }
.pl-3.5 { padding-left: 0.875rem; }
.pr-0.5 { padding-right: 0.125rem; }
.pr-1.5 { padding-right: 0.375rem; }
.pr-2.5 { padding-right: 0.625rem; }
.pr-3.5 { padding-right: 0.875rem; }
.ps-0.5 { padding-inline-start: 0.125rem; }
.ps-1.5 { padding-inline-start: 0.375rem; }
.ps-2.5 { padding-inline-start: 0.625rem; }
.ps-3.5 { padding-inline-start: 0.875rem; }
.pe-0.5 { padding-inline-end: 0.125rem; }
.pe-1.5 { padding-inline-end: 0.375rem; }
.pe-2.5 { padding-inline-end: 0.625rem; }
.pe-3.5 { padding-inline-end: 0.875rem; }
.m-0.5 { margin: 0.125rem; }
.m-1.5 { margin: 0.375rem; }
.m-2.5 { margin: 0.625rem; }
.m-3.5 { margin: 0.875rem; }
.mx-0.5 { margin-left: 0.125rem; margin-right: 0.125rem; }
.mx-1.5 { margin-left: 0.375rem; margin-right: 0.375rem; }
.mx-2.5 { margin-left: 0.625rem; margin-right: 0.625rem; }
.mx-3.5 { margin-left: 0.875rem; margin-right: 0.875rem; }
.my-0.5 { margin-top: 0.125rem; margin-bottom: 0.125rem; }
.my-1.5 { margin-top: 0.375rem; margin-bottom: 0.375rem; }
.my-2.5 { margin-top: 0.625rem; margin-bottom: 0.625rem; }
.my-3.5 { margin-top: 0.875rem; margin-bottom: 0.875rem; }
.mt-0.5 { margin-top: 0.125rem; }
.mt-1.5 { margin-top: 0.375rem; }
.mt-2.5 { margin-top: 0.625rem; }
.mt-3.5 { margin-top: 0.875rem; }
.mb-0.5 { margin-bottom: 0.125rem; }
.mb-1.5 { margin-bottom: 0.375rem; }
.mb-2.5 { margin-bottom: 0.625rem; }
.mb-3.5 { margin-bottom: 0.875rem; }
.ms-0.5 { margin-inline-start: 0.125rem; }
.ms-1.5 { margin-inline-start: 0.375rem; }
.ms-2.5 { margin-inline-start: 0.625rem; }
.ms-3.5 { margin-inline-start: 0.875rem; }
.me-0.5 { margin-inline-end: 0.125rem; }
.me-1.5 { margin-inline-end: 0.375rem; }
.me-2.5 { margin-inline-end: 0.625rem; }
.me-3.5 { margin-inline-end: 0.875rem; }
.gap-0.5 { gap: 0.125rem; }
.gap-1.5 { gap: 0.375rem; }
.gap-2.5 { gap: 0.625rem; }
.gap-3.5 { gap: 0.875rem; }

/* Extra utilities */
.min-w-0 { min-width: 0; }

/* Compact mode: Bootstrap alerts */
body.compact-mode .alert {
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

body.compact-mode .alert .btn-close {
    padding: 0.6rem 0.9rem;
}

.transition-all { transition: all 0.2s ease-in-out; }
.cursor-pointer { cursor: pointer; }
