/**
 * PlayGo Admin Panel — Dark Cinematic
 * Design tokens + component styles with dark/light theme support
 */

/* =========================================================
   DESIGN TOKENS
   ========================================================= */

:root {
    /* Brand */
    --brand-primary:     #00D4FF;
    --brand-primary-dim: #0099CC;
    --brand-secondary:   #0066FF;
    --brand-accent:      #FF3366;

    /* Dark theme (default) */
    --bg-base:     #0A0A0F;
    --bg-surface:  #14141C;
    --bg-elevated: #1E1E2A;
    --bg-hover:    #25253A;
    --text-primary:   #F0F0F5;
    --text-secondary: #A0A0B8;
    --text-muted:     #60607A;

    /* Semantic */
    --success: #00E676;
    --warning: #FFB020;
    --danger:  #FF3366;
    --info:    #00D4FF;

    /* Success/warning/danger tints (for backgrounds) */
    --success-tint: rgba(0, 230, 118, 0.12);
    --warning-tint: rgba(255, 176, 32, 0.12);
    --danger-tint:  rgba(255, 51, 102, 0.12);
    --info-tint:    rgba(0, 212, 255, 0.12);

    /* Borders & Dividers */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);

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

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00D4FF 0%, #0066FF 100%);
    --gradient-accent:  linear-gradient(135deg, #FF3366 0%, #FF6B9E 100%);
    --gradient-hero:    radial-gradient(circle at top right, rgba(255,51,102,0.15), rgba(0,102,255,0.1), transparent 60%);
    --gradient-card:    linear-gradient(135deg, rgba(0,212,255,0.08), rgba(255,51,102,0.04));

    /* Layout */
    --sidebar-width:           260px;
    --sidebar-collapsed-width: 72px;
    --header-height:           64px;
    --transition-speed:        0.2s;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Typography */
    --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;

    /* Type scale */
    --text-xs:   0.72rem;
    --text-sm:   0.82rem;
    --text-base: 0.92rem;
    --text-lg:   1.02rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.55rem;
    --text-3xl:  2.25rem;
}

/* Light theme override */
[data-theme="light"] {
    --bg-base:     #F7F7FA;
    --bg-surface:  #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-hover:    #EEF0F5;
    --text-primary:   #14141C;
    --text-secondary: #4A4A5C;
    --text-muted:     #8A8AA0;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 24px rgba(0, 212, 255, 0.2);
    --gradient-hero: radial-gradient(circle at top right, rgba(255,51,102,0.08), rgba(0,102,255,0.06), transparent 60%);
    --gradient-card: linear-gradient(135deg, rgba(0,212,255,0.05), rgba(255,51,102,0.02));
}

/* =========================================================
   BASE
   ========================================================= */

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    background-image: var(--gradient-hero);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--brand-primary-dim);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus ring */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* =========================================================
   LAYOUT
   ========================================================= */

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    width: 100%;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0;
    text-decoration: none;
}

.sidebar-header .logo:hover {
    color: var(--brand-primary);
}

.sidebar-header .logo-img {
    display: block;
    width: 154px;
    max-width: 100%;
    height: auto;
    max-height: 44px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 6px 16px rgba(0, 102, 255, 0.18));
}

.sidebar-header .logo-img-mark {
    display: none;
    width: 42px;
    max-height: 42px;
}

.sidebar-header .logo-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

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

.sidebar-nav .nav-section-label {
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 16px 24px 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar-nav .nav-item {
    margin: 2px 12px;
    position: relative;
}

.sidebar-nav .nav-link {
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

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

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(0,212,255,0.12), transparent);
    color: var(--brand-primary);
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 10%;
    bottom: 10%;
    width: 3px;
    background: var(--brand-primary);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--brand-primary);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav .nav-link .submenu-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-speed) ease;
    margin-right: 0;
    width: auto;
}

.sidebar-nav .nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    padding-left: 40px;
    margin-top: 2px;
}

.submenu .nav-item {
    margin: 1px 0;
}

.submenu .nav-link {
    padding: 7px 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.submenu .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.submenu .nav-link.active {
    color: var(--brand-primary);
    background: transparent;
}

.submenu .nav-link.active::before {
    display: none;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-footer .user-info small {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-footer .user-info p {
    color: var(--text-primary);
    margin-top: 2px;
}

/* Collapsed sidebar */
[data-sidebar="collapsed"] .sidebar {
    width: var(--sidebar-collapsed-width);
}

[data-sidebar="collapsed"] .sidebar .logo-text,
[data-sidebar="collapsed"] .sidebar .nav-link span,
[data-sidebar="collapsed"] .sidebar .submenu-arrow,
[data-sidebar="collapsed"] .sidebar .nav-section-label,
[data-sidebar="collapsed"] .sidebar .sidebar-footer .user-info {
    opacity: 0;
    visibility: hidden;
}

[data-sidebar="collapsed"] .sidebar .submenu {
    display: none;
}

[data-sidebar="collapsed"] .sidebar .nav-link {
    justify-content: center;
    padding: 10px;
}

[data-sidebar="collapsed"] .sidebar .nav-link i {
    margin-right: 0;
}

[data-sidebar="collapsed"] .sidebar-header .logo {
    justify-content: center;
}

[data-sidebar="collapsed"] .sidebar-header .logo-img-full {
    display: none;
}

[data-sidebar="collapsed"] .sidebar-header .logo-img-mark {
    display: block;
}

/* Tooltip for collapsed sidebar */
[data-sidebar="collapsed"] .sidebar .nav-link[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1100;
    box-shadow: var(--shadow-md);
}

[data-sidebar="collapsed"] .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

/* Top Navbar */
.main-content .navbar {
    background: rgba(20, 20, 28, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 12px 24px;
    min-height: var(--header-height);
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 900;
    margin-bottom: 0 !important;
}

[data-theme="light"] .main-content .navbar {
    background: rgba(255, 255, 255, 0.8) !important;
}

.main-content .navbar .nav-link {
    color: var(--text-primary);
}

.main-content .navbar .dropdown-toggle::after {
    display: none;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    margin-right: 12px;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: inline-block; }
[data-theme="light"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 24px;
}

/* =========================================================
   BOOTSTRAP OVERRIDES & COMPONENTS
   ========================================================= */

/* Text utilities (Bootstrap) */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--brand-primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header .title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
}

.card-header .title i {
    color: var(--text-muted);
    margin-right: 10px;
    font-size: 0.9em;
}

.card-header .subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 400;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-subtle);
    padding: 14px 20px;
    color: var(--text-secondary);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-surface);
    background-image: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--brand-primary);
    opacity: 0.9;
}

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

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.info::before    { background: var(--info); }
.stat-card.accent::before  { background: var(--brand-accent); }

.stat-card .stat-icon {
    font-size: 1.25rem;
    color: var(--brand-primary);
    position: absolute;
    right: 20px;
    top: 20px;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--info-tint);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transform: none;
}

.stat-card.success .stat-icon { color: var(--success); background: var(--success-tint); }
.stat-card.warning .stat-icon { color: var(--warning); background: var(--warning-tint); }
.stat-card.danger  .stat-icon { color: var(--danger);  background: var(--danger-tint); }
.stat-card.info    .stat-icon { color: var(--info);    background: var(--info-tint); }
.stat-card.accent  .stat-icon { color: var(--brand-accent); background: rgba(255,51,102,0.12); }

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

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.stat-card .stat-delta.up    { color: var(--success); background: var(--success-tint); }
.stat-card .stat-delta.down  { color: var(--danger);  background: var(--danger-tint); }
.stat-card .stat-delta.flat  { color: var(--text-muted); background: var(--border-subtle); }

.stat-card .stat-sparkline {
    position: absolute;
    right: 20px;
    bottom: 18px;
    width: 100px;
    height: 36px;
    opacity: 0.75;
    pointer-events: none;
}

.stat-value-with-dot {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.stat-value-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

/* Online users list (dashboard) */
.online-list {
    padding: 2px 0;
}

.online-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-speed) ease;
}

.online-item:last-child { border-bottom: 0; }
.online-item:hover { background: var(--bg-hover); }

.online-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s infinite;
    grid-row: 1 / 3;
    align-self: center;
    flex-shrink: 0;
}

.online-item__name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    grid-column: 2;
    grid-row: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-item__ago {
    font-size: var(--text-xs);
    color: var(--text-muted);
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
}

.online-item__meta {
    grid-column: 2 / 4;
    grid-row: 2;
    font-size: var(--text-xs);
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
    line-height: 1.4;
}

.online-item__meta span + span::before {
    content: '·';
    margin-right: 6px;
    color: var(--border-strong);
}

.online-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.online-empty i {
    font-size: 1.75rem;
    margin-bottom: 10px;
    opacity: 0.5;
    display: block;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-actions .btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 10px 16px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.quick-actions .btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.quick-actions .btn i {
    margin-right: 6px;
}

/* =========================================================
   OPERATIONAL DASHBOARD
   ========================================================= */

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

.dashboard-hero h1 {
    font-size: 1.85rem;
    margin: 0 0 6px;
    letter-spacing: 0;
}

.dashboard-hero p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 760px;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.ops-alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.ops-alert {
    display: flex;
    gap: 14px;
    min-height: 116px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.ops-alert:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.ops-alert.danger {
    border-left-color: var(--danger);
}

.ops-alert.warning {
    border-left-color: var(--warning);
}

.ops-alert.info {
    border-left-color: var(--info);
}

.ops-alert.ok {
    border-left-color: var(--success);
}

.ops-alert-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--brand-primary);
    flex-shrink: 0;
}

.ops-alert.danger .ops-alert-icon {
    color: var(--danger);
    background: var(--danger-tint);
}

.ops-alert.warning .ops-alert-icon {
    color: var(--warning);
    background: var(--warning-tint);
}

.ops-alert.info .ops-alert-icon {
    color: var(--info);
    background: var(--info-tint);
}

.ops-alert.ok .ops-alert-icon {
    color: var(--success);
    background: var(--success-tint);
}

.ops-alert strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: .95rem;
}

.ops-alert p {
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: .84rem;
    line-height: 1.45;
}

.ops-alert span {
    color: var(--brand-primary);
    font-size: .78rem;
    font-weight: 600;
}

.ops-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 118px;
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.ops-kpi:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.ops-kpi-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--info-tint);
    color: var(--info);
    flex-shrink: 0;
}

.ops-kpi.success .ops-kpi-icon {
    background: var(--success-tint);
    color: var(--success);
}

.ops-kpi.warning .ops-kpi-icon {
    background: var(--warning-tint);
    color: var(--warning);
}

.ops-kpi.danger .ops-kpi-icon {
    background: var(--danger-tint);
    color: var(--danger);
}

.ops-kpi.muted .ops-kpi-icon {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.ops-kpi-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.ops-kpi-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: .88rem;
}

.ops-kpi-hint {
    color: var(--text-muted);
    font-size: .75rem;
    margin-top: 2px;
}

.ops-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.ops-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.ops-panel-header h2 {
    font-size: 1.05rem;
    margin: 0 0 4px;
    letter-spacing: 0;
}

.ops-panel-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: .82rem;
}

.ops-online-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: .82rem;
}

.ops-online-container {
    max-height: 424px;
    overflow-y: auto;
}

.ops-health-list,
.ops-metric-list,
.ops-priority-list {
    display: flex;
    flex-direction: column;
}

.ops-health-item,
.ops-metric-row,
.ops-priority-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    text-decoration: none;
}

.ops-health-item:last-child,
.ops-metric-row:last-child,
.ops-priority-item:last-child {
    border-bottom: 0;
}

.ops-health-item:hover,
.ops-priority-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.ops-health-item strong,
.ops-priority-item strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text-primary);
    font-size: .9rem;
}

.ops-health-item span,
.ops-priority-item span,
.ops-metric-row span {
    display: block;
    color: var(--text-secondary);
    font-size: .8rem;
}

.ops-health-item em,
.ops-priority-item em,
.ops-metric-row strong {
    font-style: normal;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
}

.ops-health-item.ok em {
    color: var(--success);
}

.ops-health-item.warning em {
    color: var(--warning);
}

.ops-health-item.danger em {
    color: var(--danger);
}

.ops-priority-list.compact .ops-priority-item {
    padding-top: 11px;
    padding-bottom: 11px;
}

.ops-empty {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}

.ops-empty i {
    font-size: 1.8rem;
    color: var(--success);
    opacity: .9;
}

@media (max-width: 991.98px) {
    .dashboard-hero {
        flex-direction: column;
    }

    .dashboard-actions {
        justify-content: flex-start;
    }

    .ops-panel-header,
    .ops-health-item,
    .ops-metric-row,
    .ops-priority-item {
        align-items: flex-start;
    }

    .ops-health-item,
    .ops-priority-item {
        flex-direction: column;
    }
}

/* Tables */
.table {
    margin-bottom: 0;
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-subtle);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: var(--bg-hover);
    --bs-table-hover-color: var(--text-primary);
}

[data-theme="light"] .table {
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
}

.table thead th {
    background: transparent;
    border-bottom: 1px solid var(--border-strong);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 14px 16px;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

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

.table-hover tbody tr:hover {
    --bs-table-accent-bg: var(--bg-hover);
    color: var(--text-primary);
}

/* DataTables customization */
.dataTables_wrapper {
    color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: transparent !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    margin: 0 3px !important;
    padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-strong) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--gradient-primary) !important;
    border-color: transparent !important;
    color: white !important;
}

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

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-weight: 500;
    font-family: var(--font-sans);
    transition: all var(--transition-speed) ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: #0A0A0F;
    font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--gradient-primary);
    filter: brightness(1.1);
    color: #0A0A0F;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #0A0A0F;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #FFFFFF;
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #0A0A0F;
}

.btn-info {
    background: var(--info);
    border-color: var(--info);
    color: #0A0A0F;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    color: #0A0A0F;
}

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

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-link {
    color: var(--brand-primary);
}

.btn-link:hover {
    color: var(--brand-primary-dim);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--brand-primary);
    font-weight: 500;
    font-size: var(--text-sm);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

.btn-ghost:hover,
.btn-ghost:focus {
    color: var(--brand-primary-dim);
    background: var(--info-tint);
    text-decoration: none;
}

.btn-ghost i {
    font-size: 0.85em;
    transition: transform var(--transition-speed) ease;
}

.btn-ghost:hover i {
    transform: translateX(3px);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* Forms */
.form-control,
.form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: all var(--transition-speed) ease;
}

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

.form-control:focus,
.form-select:focus {
    background: var(--bg-elevated);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
    color: var(--text-primary);
}

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

.form-label {
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.badge.bg-primary { background: var(--info-tint) !important; color: var(--brand-primary) !important; }
.badge.bg-success { background: var(--success-tint) !important; color: var(--success) !important; }
.badge.bg-warning { background: var(--warning-tint) !important; color: var(--warning) !important; }
.badge.bg-danger  { background: var(--danger-tint) !important;  color: var(--danger) !important; }
.badge.bg-info    { background: var(--info-tint) !important;    color: var(--info) !important; }
.badge.bg-secondary { background: var(--bg-hover) !important; color: var(--text-secondary) !important; }

/* Alerts */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 14px 18px;
}

.alert-success {
    background-color: var(--success-tint);
    color: var(--success);
    border-color: rgba(0, 230, 118, 0.25);
}

.alert-danger {
    background-color: var(--danger-tint);
    color: var(--danger);
    border-color: rgba(255, 51, 102, 0.25);
}

.alert-warning {
    background-color: var(--warning-tint);
    color: var(--warning);
    border-color: rgba(255, 176, 32, 0.25);
}

.alert-info {
    background-color: var(--info-tint);
    color: var(--info);
    border-color: rgba(0, 212, 255, 0.25);
}

/* Modal */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 18px 22px;
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 22px;
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 14px 22px;
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop.show {
    opacity: 1;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(2);
}

[data-theme="light"] .btn-close {
    filter: none;
}

/* Dropdown */
.dropdown-menu {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    color: var(--text-primary);
}

.dropdown-item {
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

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

.dropdown-item.text-danger {
    color: var(--danger) !important;
}

.dropdown-item.text-warning {
    color: var(--warning) !important;
}

.dropdown-divider {
    border-top: 1px solid var(--border-subtle);
    margin: 4px 0;
}

/* Footer */
.footer {
    background: transparent;
    border-top: 1px solid var(--border-subtle);
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer .text-muted {
    color: var(--text-muted) !important;
}

/* Avatar */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--brand-primary);
}

.avatar-lg {
    width: 56px;
    height: 56px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
}

.status-badge i {
    font-size: 0.85em;
}

.status-active,
.status-paid {
    background-color: var(--success-tint);
    color: var(--success);
}

.status-inactive,
.status-overdue {
    background-color: var(--danger-tint);
    color: var(--danger);
}

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

.table-logo-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: #05070d;
    padding: 6px;
    vertical-align: middle;
}

.table-logo-preview img {
    max-width: 100%;
    max-height: 24px;
    object-fit: contain;
}

.table-logo-preview.empty {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: var(--text-muted);
}

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

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.page-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
}

.breadcrumb-item,
.breadcrumb-item.active {
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--brand-primary);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* Credit Badge */
.credit-badge {
    animation: pulse 2s infinite;
}

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

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    color: var(--brand-primary);
}

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
    color: var(--text-muted);
}

.empty-state h5 {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-family: var(--font-display);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-hover) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
}

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

/* Chip (filter / tag) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.chip:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.chip.active {
    background: var(--info-tint);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

/* List group (tweak for dark) */
.list-group-item {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.list-group-flush .list-group-item {
    border-left: 0;
    border-right: 0;
}

.list-group-flush .list-group-item:first-child { border-top: 0; }
.list-group-flush .list-group-item:last-child  { border-bottom: 0; }

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 18px;
    min-width: 260px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    pointer-events: auto;
    animation: toast-slide-in 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-item.success { border-left-color: var(--success); }
.toast-item.error   { border-left-color: var(--danger); }
.toast-item.warning { border-left-color: var(--warning); }
.toast-item.info    { border-left-color: var(--info); }

.toast-item i.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-item.success i.toast-icon { color: var(--success); }
.toast-item.error   i.toast-icon { color: var(--danger); }
.toast-item.warning i.toast-icon { color: var(--warning); }
.toast-item.info    i.toast-icon { color: var(--info); }

.toast-item.hiding {
    animation: toast-slide-out 0.2s ease forwards;
}

@keyframes toast-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toast-slide-out {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* Utility Classes */
.text-primary-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-primary-gradient {
    background: var(--gradient-primary);
}

.bg-surface   { background: var(--bg-surface) !important; }
.bg-elevated  { background: var(--bg-elevated) !important; }

.shadow-primary {
    box-shadow: var(--shadow-glow);
}

/* Bootstrap utility overrides that use theme tokens */
.bg-white {
    background: var(--bg-surface) !important;
    color: var(--text-primary);
}

.bg-light {
    background: var(--bg-elevated) !important;
    color: var(--text-primary);
}

.border {
    border-color: var(--border-subtle) !important;
}

/* =========================================================
   DESKTOP COMPACT DENSITY
   ========================================================= */

@media (min-width: 992px) {
    html {
        font-size: 90.625%;
    }

    :root {
        --sidebar-width: 244px;
        --sidebar-collapsed-width: 64px;
        --header-height: 58px;
        --radius-md: 8px;
        --radius-lg: 12px;
        --radius-xl: 18px;

        --text-xs: 0.7rem;
        --text-sm: 0.8rem;
        --text-base: 0.9rem;
        --text-lg: 1rem;
        --text-xl: 1.16rem;
        --text-2xl: 1.42rem;
        --text-3xl: 2rem;
    }

    h1, h2, h3, h4, h5, h6,
    .page-header h1,
    .dashboard-hero h1,
    .stat-card .stat-value,
    .ops-kpi-value {
        letter-spacing: 0;
    }

    .sidebar-header {
        padding: 14px 18px;
    }

    .sidebar-header .logo-img {
        width: 140px;
        max-height: 38px;
    }

    .sidebar-header .logo-img-mark {
        width: 36px;
        max-height: 36px;
    }

    .sidebar-nav {
        padding: 10px 0;
    }

    .sidebar-nav .nav-section-label {
        padding: 12px 18px 6px;
        font-size: 0.64rem;
    }

    .sidebar-nav .nav-item {
        margin: 1px 10px;
    }

    .sidebar-nav .nav-link {
        padding: 8px 12px;
        font-size: 0.86rem;
    }

    .sidebar-nav .nav-link i {
        width: 18px;
        margin-right: 10px;
        font-size: 0.94rem;
    }

    .submenu {
        padding-left: 34px;
    }

    .submenu .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .sidebar-footer {
        padding: 12px 18px;
        font-size: 0.8rem;
    }

    [data-sidebar="collapsed"] .sidebar .nav-link {
        padding: 8px;
    }

    [data-sidebar="collapsed"] .sidebar .nav-link[data-tooltip]:hover::after {
        padding: 5px 10px;
        font-size: 0.76rem;
    }

    .main-content .navbar {
        padding: 9px 18px;
    }

    .sidebar-toggle {
        padding: 6px 10px;
    }

    .theme-toggle,
    .avatar {
        width: 34px;
        height: 34px;
    }

    .content-wrapper,
    .content-wrapper.px-4 {
        padding: 18px !important;
    }

    .row.g-2 {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    .gap-3 {
        gap: 0.65rem !important;
    }

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

    .page-header h1 {
        font-size: 1.42rem;
        margin-bottom: 2px;
    }

    .dashboard-hero {
        gap: 16px;
        margin-bottom: 18px;
    }

    .dashboard-hero h1 {
        font-size: 1.48rem;
        margin-bottom: 3px;
    }

    .quick-actions {
        gap: 8px;
        margin-bottom: 16px;
    }

    .quick-actions .btn {
        padding: 8px 13px;
    }

    .card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: 11px 16px;
        gap: 10px;
    }

    .card-body {
        padding: 16px;
    }

    .card > .card-body:has(> .table-responsive:first-child:last-child),
    .card > .card-body:has(> .dataTables_wrapper:first-child:last-child) {
        padding: 12px;
    }

    .card-footer {
        padding: 11px 16px;
    }

    .stat-card {
        min-height: 106px;
        padding: 16px 18px;
    }

    .stat-card .stat-icon {
        width: 34px;
        height: 34px;
        right: 16px;
        top: 16px;
        font-size: 1.05rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
        margin-bottom: 2px;
    }

    .stat-card .stat-label {
        font-size: 0.76rem;
    }

    .stat-card .stat-delta {
        margin-top: 6px;
        padding: 2px 7px;
        font-size: 0.72rem;
    }

    .online-item {
        gap: 2px 10px;
        padding: 9px 14px;
    }

    .online-empty {
        padding: 24px 16px;
    }

    .ops-alert-grid,
    .ops-priority-list {
        gap: 10px;
    }

    .ops-alert {
        min-height: 96px;
        padding: 12px;
        gap: 11px;
    }

    .ops-alert-icon,
    .ops-kpi-icon {
        width: 34px;
        height: 34px;
    }

    .ops-alert strong {
        margin-bottom: 3px;
        font-size: 0.88rem;
    }

    .ops-alert p {
        margin-bottom: 6px;
        font-size: 0.78rem;
    }

    .ops-kpi {
        min-height: 96px;
        padding: 14px;
        gap: 11px;
    }

    .ops-kpi-value {
        font-size: 1.48rem;
        margin-bottom: 3px;
    }

    .ops-kpi-label {
        font-size: 0.82rem;
    }

    .ops-panel-header,
    .ops-health-item,
    .ops-metric-row,
    .ops-priority-item {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ops-panel-header {
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .ops-online-toolbar {
        padding: 8px 16px;
    }

    .ops-health-item,
    .ops-metric-row,
    .ops-priority-item {
        padding-top: 11px;
        padding-bottom: 11px;
        gap: 10px;
    }

    .table thead th {
        padding: 10px 12px;
        font-size: 0.66rem;
    }

    .table tbody td {
        padding: 8px 12px;
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .table strong {
        font-weight: 600;
    }

    .dataTables_wrapper {
        font-size: 0.84rem;
    }

    .dataTables_wrapper > .row {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    .dataTables_wrapper > .row.mb-3 {
        margin-bottom: 0.65rem !important;
    }

    .dataTables_wrapper > .row.mt-3 {
        margin-top: 0.65rem !important;
    }

    .dataTables_wrapper .dataTables_length label,
    .dataTables_wrapper .dataTables_filter label {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        margin-bottom: 0;
        color: var(--text-secondary);
    }

    .dataTables_wrapper .dataTables_filter input,
    .dataTables_wrapper .dataTables_length select {
        padding: 5px 10px;
        min-height: 31px;
        font-size: 0.82rem;
    }

    .dataTables_wrapper .dataTables_filter {
        display: flex;
        justify-content: flex-end;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: min(240px, 100%);
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 3px 8px !important;
        font-size: 0.78rem;
    }

    .dataTables_wrapper .dataTables_info {
        padding-top: 0 !important;
        font-size: 0.78rem;
    }

    .btn {
        padding: 6px 12px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 0.76rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .btn-group-sm > .btn,
    .btn-group-sm .btn {
        padding: 4px 7px;
        font-size: 0.74rem;
    }

    .form-control,
    .form-select {
        padding: 7px 11px;
        min-height: 34px;
        font-size: 0.86rem;
    }

    .form-label {
        margin-bottom: 4px;
        font-size: 0.78rem;
    }

    .badge,
    .status-badge {
        padding: 4px 8px;
        font-size: 0.68rem;
    }

    .alert {
        padding: 11px 14px;
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 12px 18px;
    }

    .dropdown-menu {
        padding: 5px;
    }

    .dropdown-item {
        padding: 6px 10px;
        font-size: 0.84rem;
    }

    .toast-item {
        padding: 10px 14px;
        font-size: 0.84rem;
    }

    .empty-state {
        padding: 36px 16px;
    }

    .empty-state i {
        font-size: 2.25rem;
        margin-bottom: 12px;
    }
}

/* Sidebar mobile drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
}

body.sidebar-open {
    overflow: hidden;
}

.admin-form-layout {
    row-gap: 24px;
}

.mobile-inline-actions {
    display: flex;
    gap: 8px;
}

.mobile-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 991.98px) {
    .sidebar {
        width: min(320px, 88vw);
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        min-width: 0;
    }

    .main-content .navbar {
        padding: 10px 14px;
    }

    .main-content .navbar .container-fluid {
        padding-left: 0;
        padding-right: 0;
        gap: 8px;
        min-width: 0;
    }

    .main-content .navbar .navbar-nav {
        min-width: 0;
        gap: 8px;
    }

    .main-content .navbar .dropdown-toggle {
        min-width: 0;
    }

    .sidebar-toggle {
        display: inline-flex !important;
        width: 40px;
        height: 40px;
        padding: 0;
        flex-shrink: 0;
    }

    [data-sidebar="collapsed"] .sidebar {
        width: min(320px, 88vw);
    }

    [data-sidebar="collapsed"] .main-content {
        margin-left: 0;
    }

    [data-sidebar="collapsed"] .sidebar-header .logo {
        justify-content: flex-start;
    }

    [data-sidebar="collapsed"] .sidebar .logo-text,
    [data-sidebar="collapsed"] .sidebar .nav-link span,
    [data-sidebar="collapsed"] .sidebar .submenu-arrow,
    [data-sidebar="collapsed"] .sidebar .nav-section-label,
    [data-sidebar="collapsed"] .sidebar .sidebar-footer .user-info {
        opacity: 1;
        visibility: visible;
    }

    [data-sidebar="collapsed"] .sidebar .submenu {
        display: block;
    }

    [data-sidebar="collapsed"] .sidebar .nav-link {
        justify-content: flex-start;
        padding: 10px 14px;
    }

    [data-sidebar="collapsed"] .sidebar .nav-link i {
        margin-right: 12px;
    }

    [data-sidebar="collapsed"] .sidebar-header .logo-img-full {
        display: block;
    }

    [data-sidebar="collapsed"] .sidebar-header .logo-img-mark {
        display: none;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .content-wrapper {
        padding: 16px;
    }

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

    .page-header.d-flex,
    .page-header .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-header.d-flex {
        align-items: flex-start !important;
    }

    .page-header > form,
    .page-header > .d-flex,
    .page-header > .btn,
    .page-header > a.btn {
        max-width: 100%;
    }

    .card-header.d-flex,
    .card-header {
        flex-wrap: wrap;
    }

    .admin-form-layout {
        row-gap: 18px;
    }

    .admin-form-layout > [class*="col-lg-"],
    .admin-form-layout > [class*="col-md-"] {
        min-width: 0;
    }

    .admin-form-layout .card + .card {
        margin-top: 16px;
    }

    .responsive-stat-grid > .col,
    .responsive-stat-grid > [class*="col-"] {
        flex: 1 1 140px;
    }

    .stat-card {
        min-height: 112px;
        padding: 18px 18px;
    }

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

    .stat-card .stat-value {
        font-size: 1.85rem;
    }
}

@media (max-width: 767.98px) {
    .main-content .navbar .nav-item .badge.fs-6 {
        max-width: 132px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.76rem !important;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        margin-right: 4px;
        flex-shrink: 0;
    }

    .avatar {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

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

    .page-header.d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    .page-header > .d-flex,
    .page-header > form {
        width: 100%;
    }

    .page-header > form .form-select,
    .page-header > form .form-control {
        width: 100%;
    }

    .page-header > .d-flex {
        flex-wrap: wrap;
    }

    .mobile-action-row {
        width: 100%;
    }

    .page-header > .d-flex > .btn,
    .page-header > .d-flex > a.btn,
    .page-header > .d-flex > button.btn {
        flex: 1 1 auto;
    }

    .page-header .btn {
        justify-content: center;
    }

    .page-header .form-control,
    .page-header .form-select {
        max-width: 100%;
    }

    .page-header > .btn,
    .page-header > a.btn {
        width: 100%;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: 12px 14px;
        align-items: flex-start;
    }

    .card-body {
        padding: 16px;
    }

    .card-footer {
        padding: 12px 14px;
    }

    .table-responsive {
        border-radius: var(--radius-md);
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive.mobile-card-responsive {
        overflow-x: visible;
    }

    .table-responsive > .table:not(.datatable) {
        min-width: 680px;
    }

    .table-responsive.mobile-card-responsive > .table {
        min-width: 0 !important;
    }

    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: left !important;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0 !important;
    }

    .dataTables_wrapper .dataTables_length label {
        width: 100%;
    }

    .dataTables_wrapper .dataTables_paginate {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 2px;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 4px 8px !important;
        margin: 0 2px !important;
    }

    .modal-dialog.modal-xl,
    .modal-dialog.modal-lg {
        max-width: none;
        margin: 0;
        min-height: 100vh;
    }

    .modal-dialog.modal-xl .modal-content,
    .modal-dialog.modal-lg .modal-content {
        min-height: 100vh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-footer {
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    .form-control[style*="width"],
    .form-control[style*="max-width"],
    .form-select[style*="width"],
    .form-select[style*="max-width"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .row > .col-auto {
        width: 100%;
    }

    .btn-group {
        white-space: nowrap;
    }

    .admin-form-layout .card-body > form > .row,
    .admin-form-layout form > .row {
        row-gap: 2px;
    }

    .admin-form-layout h5 {
        font-size: 1rem;
        line-height: 1.3;
    }

    .admin-form-layout .form-control,
    .admin-form-layout .form-select,
    .admin-form-layout .input-group-text {
        min-height: 42px;
    }

    .admin-form-layout textarea.form-control {
        min-height: auto;
    }

    .admin-form-layout .form-text,
    .admin-form-layout .form-label,
    .admin-form-layout small.text-muted {
        line-height: 1.4;
    }

    .admin-form-layout .input-group {
        flex-wrap: nowrap;
    }

    .admin-form-layout .input-group > .btn {
        width: 44px;
        flex: 0 0 44px;
        padding-left: 0;
        padding-right: 0;
    }

    .admin-form-layout .input-group-text {
        min-width: 44px;
        justify-content: center;
    }

    .admin-form-layout .form-check {
        min-height: 32px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .admin-form-layout .form-check-label {
        line-height: 1.35;
    }

    .admin-filter-form > .col,
    .admin-filter-form > .col-auto {
        width: 100%;
    }

    .admin-filter-form.d-flex {
        align-items: stretch !important;
        flex-direction: column;
    }

    .admin-filter-form .btn {
        justify-content: center;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast-item {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    body {
        background-attachment: scroll;
    }

    .main-content .navbar {
        padding: 8px 12px;
    }

    .main-content .navbar .dropdown-toggle > div:not(.avatar) {
        display: none;
    }

    .content-wrapper,
    .content-wrapper.px-4 {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .page-header h1 {
        font-size: 1.25rem;
        line-height: 1.2;
    }

    .page-header .breadcrumb {
        display: none;
    }

    .stat-card {
        min-height: 98px;
        padding: 15px 16px;
    }

    .stat-card .stat-icon {
        width: 34px;
        height: 34px;
        right: 14px;
        top: 14px;
        font-size: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.55rem;
        padding-right: 40px;
    }

    .stat-card .stat-label {
        font-size: 0.72rem;
        letter-spacing: 0.02em;
    }

    .btn {
        min-height: 40px;
    }

    .empty-state {
        padding: 32px 14px;
    }

    .empty-state i {
        font-size: 2.25rem;
    }

    .admin-form-layout .alert .ms-3 {
        margin-left: 0.35rem !important;
    }

    .admin-form-layout .d-flex.justify-content-between {
        gap: 8px;
    }

    .admin-form-layout .d-flex.justify-content-between > span:first-child {
        color: var(--text-muted);
    }

    .admin-form-layout code {
        white-space: normal;
        word-break: break-all;
    }

    .admin-form-layout form > .d-flex.justify-content-end,
    .admin-form-layout .card-body > form > .d-flex.justify-content-end {
        align-items: stretch !important;
        flex-direction: column-reverse;
    }

    .admin-form-layout form > .d-flex.justify-content-end .btn,
    .admin-form-layout .card-body > form > .d-flex.justify-content-end .btn {
        justify-content: center;
        width: 100%;
    }

    .admin-form-layout form > button[type="submit"].btn,
    .admin-form-layout form > .btn {
        justify-content: center;
        width: 100%;
    }

    .admin-form-layout .row.text-center {
        row-gap: 12px;
    }

    .mobile-inline-actions {
        align-items: stretch !important;
        flex-direction: column;
    }

    .mobile-action-row {
        align-items: stretch !important;
        flex-direction: column;
    }

    .mobile-action-row .btn {
        justify-content: center;
        width: 100%;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }

    .mobile-inline-actions .btn,
    .admin-filter-form .btn {
        width: 100%;
    }

    .scroll-table.mobile-card-responsive {
        max-height: none;
        overflow: visible;
    }

    .admin-form-layout .table-sm td,
    .admin-form-layout .table-sm th {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    .specs-table td {
        display: block;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        border-top: 0;
    }

    .specs-table tr + tr td:first-child {
        padding-top: 10px;
        border-top: 1px solid var(--border-subtle);
    }

    .mobile-card-table {
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table,
    .mobile-card-table tbody,
    .mobile-card-table tfoot,
    .mobile-card-table tr,
    .mobile-card-table td,
    .mobile-card-table th {
        display: block;
        width: 100% !important;
    }

    .mobile-card-table tbody tr {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        margin-bottom: 10px;
        overflow: hidden;
    }

    .mobile-card-table tbody tr:hover {
        background: var(--bg-surface);
        border-color: var(--border-strong);
    }

    .mobile-card-table tbody tr[data-empty="1"] {
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .mobile-card-table tbody tr[data-empty="1"] td {
        display: block;
        padding: 0;
    }

    .mobile-card-table tbody tr[data-empty="1"] td::before {
        display: none;
    }

    .mobile-card-table tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        min-height: 42px;
        padding: 10px 12px;
        border-top: 1px solid var(--border-subtle);
        text-align: right !important;
        white-space: normal;
        word-break: break-word;
    }

    .mobile-card-table tbody td:first-child {
        border-top: 0;
    }

    .mobile-card-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 38%;
        max-width: 42%;
        color: var(--text-muted);
        font-family: var(--font-display);
        font-size: 0.68rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        line-height: 1.35;
        text-align: left;
        text-transform: uppercase;
        word-break: normal;
    }

    .mobile-card-table tbody td > * {
        max-width: 100%;
    }

    .mobile-card-table tbody td .d-flex {
        min-width: 0;
        justify-content: flex-end;
    }

    .mobile-card-table tbody td .btn-group,
    .mobile-card-table tbody td .online-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
        white-space: normal;
    }

    .mobile-card-table tbody td .btn-group .btn,
    .mobile-card-table tbody td .online-actions .btn {
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-card-table tbody td form.d-inline {
        display: inline-flex !important;
    }

    .mobile-card-table tfoot tr {
        background: var(--bg-elevated);
        border: 1px solid var(--border-strong);
        border-radius: var(--radius-md);
        margin-top: 10px;
        overflow: hidden;
    }

    .mobile-card-table tfoot th {
        display: flex;
        justify-content: space-between;
        gap: 14px;
        padding: 10px 12px;
        border-top: 1px solid var(--border-subtle);
        text-align: right !important;
        white-space: normal;
    }

    .mobile-card-table tfoot th:first-child {
        border-top: 0;
    }
}

/* Small tweaks for gap visual harmony in Bootstrap text elements */
small, .small { color: inherit; }
.text-dark { color: var(--text-primary) !important; }
