﻿/* ==========================================
   Dark-first Modern Panel Design
   ========================================== */

:root {
    --bg-primary: #07090f;
    --bg-secondary: #0b0f1a;
    --bg-card: #0d1324;
    --bg-glass: #0b1020;
    --orange: #8b5cf6;
    --orange-light: #a78bfa;
    --orange-dark: #7c3aed;
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e1;
    --border: rgba(139, 92, 246, 0.18);
    --shadow: rgba(2, 6, 23, 0.45);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

:root[data-theme="light"] {
    --bg-primary: #f5f3ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-glass: #ede9fe;
    --orange: #7c3aed;
    --orange-light: #8b5cf6;
    --orange-dark: #6d28d9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #ddd6fe;
    --shadow: rgba(15, 23, 42, 0.08);
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, p, label, span, td, th, li, a {
    color: var(--text-primary);
}

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

code {
    color: var(--orange-light);
}

small {
    color: var(--text-muted);
}

/* ==========================================
   Scrollbar Styling
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.6); }

/* ==========================================
   Sidebar Layout
   ========================================== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.2s ease;
}

.sidebar-brand {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.sidebar-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    list-style: none;
    padding: 0 1rem;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background 0.2s ease, color 0.2s ease;
    font-weight: 500;
}

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

.sidebar-nav a.active {
    background: rgba(139, 92, 246, 0.18);
    color: var(--orange-light);
    border-left: 4px solid var(--orange);
    padding-left: calc(1rem - 4px);
}

.sidebar-nav i {
    width: 20px;
    text-align: center;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 2.5rem 3rem;
    width: calc(100% - 240px);
}

.content-area {
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================
   Top Bar
   ========================================== */
.topbar {
    background: transparent;
    padding: 0 0 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.topbar-left h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.balance-badge {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    font-weight: 600;
}

.balance-badge .amount {
    color: var(--orange);
}

/* ==========================================
   Cards & Glassmorphism
   ========================================== */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 6px 18px var(--shadow);
    transition: box-shadow 0.2s ease;
}

.glass-card:hover {
    box-shadow: 0 10px 22px var(--shadow);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--orange);
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card.orange .icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--orange);
}

.stat-card.success .icon {
    background: rgba(34, 197, 94, 0.16);
    color: var(--success);
}

.stat-card.warning .icon {
    background: rgba(245, 158, 11, 0.16);
    color: var(--warning);
}

.stat-card .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==========================================
   Forms
   ========================================== */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control,
.form-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-card);
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
    color: var(--text-primary);
    outline: none;
}

.form-control::placeholder {
    color: rgba(178, 189, 214, 0.9);
}

.form-check-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

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

/* ==========================================
   Buttons
   ========================================== */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.9375rem;
}

.btn-orange {
    background: var(--orange);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-orange:hover {
    background: var(--orange-dark);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35);
    color: white;
}

.btn-outline-orange {
    background: transparent;
    border: 1px solid var(--orange);
    color: var(--orange);
}

.btn-outline-orange:hover {
    background: var(--orange);
    color: white;
}

.btn-glass {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* ==========================================
   Tables
   ========================================== */
.table-responsive {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
}

.modern-table {
    width: 100%;
    margin: 0;
}

.modern-table thead {
    background: var(--bg-glass);
}

.modern-table th {
    padding: 1rem 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.modern-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.modern-table tbody tr {
    transition: background 0.2s ease;
}

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

/* ==========================================
   Badges
   ========================================== */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-orange {
    background: var(--orange);
    color: white;
}

.bg-orange {
    background-color: var(--orange) !important;
    color: #fff;
}

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

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

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

.badge-glass {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ==========================================
   Alerts
   ========================================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

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

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

/* ==========================================
   Login Page
   ========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(59, 130, 246, 0.1) 50%, var(--bg-secondary) 100%);
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="80" height="80"><circle cx="40" cy="40" r="3" fill="rgba(59,130,246,0.1)"/></svg>') repeat;
    pointer-events: none;
}

.login-container {
    max-width: 450px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 3rem;
    box-shadow: 0 20px 40px var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    position: relative;
    background: var(--bg-card);
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.4s ease;
}

/* ==========================================
   Mobile Menu Toggle
   ========================================== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: var(--orange);
    color: white;
    border: none;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--shadow);
    transition: all 0.3s ease;
    min-width: 50px;
}

.mobile-menu-toggle:hover {
    background: var(--orange-dark);
    transform: scale(1.05);
}

.mobile-menu-toggle i {
    font-size: 1.4rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(4px);
}

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

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        max-height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem 1rem;
        padding-top: 4.5rem;
    }

    .topbar {
        flex-direction: row;
        gap: 1rem;
        align-items: center;
        padding: 1rem;
        flex-wrap: wrap;
    }

    .topbar h1 {
        font-size: 1.5rem;
        flex: 1;
    }

    .topbar-right {
        gap: 0.75rem;
    }

    /* Stats grid - 2 columns on tablet */
    .grid-2, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

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

    /* Glass card - more breathing room */
    .glass-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Table as cards on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: -0.5rem;
        padding: 0.5rem;
    }

    .modern-table {
        font-size: 0.85rem;
    }

    .modern-table th,
    .modern-table td {
        padding: 0.875rem 0.75rem;
        white-space: nowrap;
    }

    /* Form responsive */
    .row.g-3 {
        gap: 1rem !important;
    }

    .col-md-6, .col-md-12 {
        width: 100% !important;
    }

    /* Button sizing - more tap area */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .btn-sm {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        min-height: 38px;
    }

    /* Login/Register card */
    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .login-card h1 {
        font-size: 1.75rem;
    }

    /* Alert more breathing room */
    .alert {
        font-size: 0.9rem;
        padding: 1rem;
        margin-bottom: 1.25rem;
    }

    /* Badge larger for readability */
    .badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Domain list - card style */
    .site-list-item {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .site-list-item h5 {
        font-size: 1.05rem;
        margin-bottom: 0.75rem;
    }

    .site-list-item small {
        display: block;
        margin-bottom: 0.5rem;
    }

    /* Sidebar navigation more spacing */
    .sidebar-nav li {
        margin-bottom: 0.5rem;
    }

    .sidebar-nav a {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 0.875rem;
        padding-top: 4rem;
    }

    .topbar {
        padding: 1rem 0.875rem;
        gap: 0.75rem;
    }

    .topbar h1 {
        font-size: 1.35rem;
    }

    /* Stats - single column, more breathing room */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .glass-card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .stat-card {
        padding: 1.5rem;
        text-align: center;
    }

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

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

    /* Button group full width */
    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Table mobile card view */
    .table-responsive {
        overflow: visible;
    }

    .modern-table {
        display: block;
        border: none;
    }

    .modern-table thead {
        display: none;
    }

    .modern-table tbody {
        display: block;
    }

    .modern-table tr {
        display: block;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .modern-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border: none;
        border-bottom: 1px solid var(--border);
    }

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

    .modern-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 1rem;
    }

    /* Login card */
    .login-card {
        padding: 1.75rem;
        margin: 1rem;
    }

    .login-card h1 {
        font-size: 1.65rem;
    }

    /* Form inputs - larger for mobile */
    .form-control, .form-select {
        padding: 0.875rem;
        font-size: 1rem;
        border-radius: 10px;
    }

    /* Labels more readable */
    .form-label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }

    /* Site list - card view */
    .site-list-item {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .site-list-item h5 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .site-list-item small {
        font-size: 0.85rem;
        line-height: 1.6;
        display: block;
        margin-bottom: 0.5rem;
    }

    /* Buttons more spacing */
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border-radius: 10px;
    }

    .btn-sm {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Sidebar more compact but readable */
    .sidebar-brand h2 {
        font-size: 1.5rem;
    }

    .sidebar-nav a {
        padding: 1.125rem 1.5rem;
        font-size: 1rem;
    }

    /* Alert more spacing */
    .alert {
        padding: 1.125rem;
        margin-bottom: 1.5rem;
        border-radius: 10px;
    }

    /* Badge more visible */
    .badge {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* ==========================================
   Utilities
   ========================================== */
.text-orange {
    color: var(--orange);
}

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

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

.table,
.table td,
.table th,
.modern-table td,
.modern-table th {
    color: var(--text-primary);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium { font-weight: 500; }

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

.w-100 { width: 100%; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.75rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.75rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.profile-dropdown .dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px var(--shadow);
}

.profile-dropdown .dropdown-item {
    color: var(--text-secondary);
}

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

.nav-tabs {
    border-bottom: 1px solid var(--border);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: var(--border);
}

.nav-tabs .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-card);
    border-color: var(--border) var(--border) transparent;
}

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

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

.profile-button {
    border-radius: 999px;
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.profile-button .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
}


/* =========================================================
   PPCX v3 Theme Override (Aurora Glass / Completely Different)
   - New layout classes: app-*
   - Old panel styles become irrelevant
   ========================================================= */

:root {
    --bg-primary: #07090f;
    --bg-secondary: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --accent: #8b5cf6;
    --accent-2: #a78bfa;
    --accent-3: #7c3aed;
    --text-primary: #f8fafc;
    --text-secondary: rgba(226, 232, 240, 0.82);
    --text-muted: rgba(148, 163, 184, 0.85);
    --border: rgba(139, 92, 246, 0.15);
    --shadow: rgba(0, 0, 0, 0.45);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Keep legacy variable names alive */
    --orange: var(--accent);
    --orange-light: #a78bfa;
    --orange-dark: #7c3aed;
}

:root[data-theme="light"] {
    --bg-primary: #f5f3ff;
    --bg-secondary: rgba(2, 6, 23, 0.04);
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.55);
    --accent: #7c3aed;
    --accent-2: #8b5cf6;
    --accent-3: #6d28d9;
    --text-primary: #0b1220;
    --text-secondary: rgba(15, 23, 42, 0.78);
    --text-muted: rgba(30, 41, 59, 0.62);
    --border: rgba(124, 58, 237, 0.15);
    --shadow: rgba(2, 6, 23, 0.12);

    --orange: var(--accent);
    --orange-light: #8b5cf6;
    --orange-dark: #6d28d9;
}

body {
    font-family: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(1200px 800px at 15% 10%, rgba(139, 92, 246, 0.25), transparent 55%),
        radial-gradient(1000px 700px at 85% 15%, rgba(124, 58, 237, 0.18), transparent 55%),
        radial-gradient(900px 600px at 60% 95%, rgba(167, 139, 250, 0.12), transparent 60%),
        var(--bg-primary);
}

/* New app shell */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin: 1.25rem 1.25rem 0;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 30px var(--shadow);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.app-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    position: relative;
    background:
        radial-gradient(12px 12px at 28% 32%, rgba(255,255,255,0.30), transparent 60%),
        conic-gradient(from 210deg, var(--accent), #0b0f1a, var(--accent-2), #0b0f1a, var(--accent));
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.22);
    overflow: hidden;
    transform: rotate(-6deg);
}

.app-brand-mark::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 12px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.08);
}

.app-brand-mark::after {
    content: 'X';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: -0.08em;
    font-size: 18px;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 10px 30px rgba(0,0,0,0.55);
}

/* Reusable brand sigil (login/register/admin login) */
.delta-sigil {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    position: relative;
    background:
        radial-gradient(14px 14px at 28% 32%, rgba(255,255,255,0.30), transparent 60%),
        conic-gradient(from 210deg, var(--accent), #0b0f1a, var(--accent-2), #0b0f1a, var(--accent));
    box-shadow: 0 18px 60px rgba(139, 92, 246, 0.20);
    overflow: hidden;
    transform: rotate(-6deg);
}

.delta-sigil::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 14px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.08);
}

.delta-sigil::after {
    content: 'P';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: -0.06em;
    font-size: 22px;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 12px 32px rgba(0,0,0,0.55);
}

.app-brand-name {
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.app-header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.app-navlink {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 700;
    transition: background 0.2s ease, color 0.2s ease;
}

.app-navlink:hover {
    background: rgba(139, 92, 246, 0.10);
    color: var(--text-primary);
}

.app-navlink.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(124, 58, 237, 0.12));
    color: var(--text-primary);
    border: 1px solid rgba(139, 92, 246, 0.20);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-iconbtn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.2s ease;
}

.app-iconbtn:hover {
    background: rgba(139, 92, 246, 0.10);
    transform: translateY(-1px);
}

.app-profile {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
}

.app-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.app-main {
    flex: 1;
    padding: 1.25rem;
}

.app-pagehead {
    margin: 1.25rem 1.25rem 0;
    padding: 0.25rem 0.25rem 0.75rem;
}

.app-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.content-area {
    max-width: 1200px;
    margin: 0 auto;
}

/* Drawer (mobile) */
.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 320px;
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--border);
    z-index: 1100;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.app-drawer.active {
    transform: translateX(0);
}

.app-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.app-drawer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.app-drawer-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-drawer-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    font-weight: 700;
}

.app-drawer-link:hover {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.10);
}

.app-drawer-link.active {
    color: var(--text-primary);
    border-color: rgba(139, 92, 246, 0.18);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(124, 58, 237, 0.10));
}

/* Mobile toggle button (keep id/class from template) */
.mobile-menu-toggle {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 1200;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-primary);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 26px var(--shadow);
}

@media (min-width: 992px) {
    .mobile-menu-toggle { display: none; }
}

/* Modernize cards while keeping old class names */
.glass-card,
.stat-card,
.table-responsive {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px var(--shadow);
}

.stat-card::before {
    height: 6px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.stat-card .value {
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* Forms / buttons */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(139, 92, 246, 0.60);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
    outline: none;
}

.btn-orange {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    border: none;
    box-shadow: 0 14px 30px rgba(139, 92, 246, 0.18);
}

.btn-outline-orange {
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-orange:hover {
    background: rgba(139, 92, 246, 0.10);
    color: var(--text-primary);
}

/* Auth pages still supported (we'll also add auth-shell in markup next) */
.login-page {
    background:
        radial-gradient(1100px 760px at 15% 10%, rgba(139, 92, 246, 0.22), transparent 55%),
        radial-gradient(1000px 700px at 85% 15%, rgba(124, 58, 237, 0.14), transparent 55%),
        var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 28px 70px var(--shadow);
}

/* Auth shell (new markup in login/register) */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.auth-aside {
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-aside::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(900px 700px at 30% 20%, rgba(139, 92, 246, 0.28), transparent 55%),
        radial-gradient(800px 600px at 70% 70%, rgba(124, 58, 237, 0.18), transparent 60%),
        radial-gradient(700px 520px at 60% 10%, rgba(167, 139, 250, 0.12), transparent 60%);
    filter: blur(0px);
    opacity: 0.9;
}

.auth-aside-inner {
    position: relative;
    width: min(520px, 100%);
    padding: 2rem 2rem 2.25rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
    box-shadow: 0 30px 90px var(--shadow);
}

:root[data-theme="light"] .auth-aside-inner {
    background: rgba(255, 255, 255, 0.55);
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-heading {
    margin: 1.25rem 0 0.5rem;
    font-size: 2.25rem;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.auth-subtitle {
    margin: 0 0 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.6;
}

.auth-points {
    display: grid;
    gap: 0.75rem;
}

.auth-point {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-weight: 700;
}

.auth-point .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.13);
    flex: 0 0 auto;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.auth-main .login-page {
    width: 100%;
    background: transparent;
}

.auth-main .login-container {
    max-width: 520px;
}

@media (max-width: 992px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-aside {
        padding: 2rem 1.25rem 0;
    }
    .auth-main {
        padding: 1.25rem;
    }
}

