/* ===================================================================
   ParsinX — Control Panel Stylesheet
   Dark, glossy, glowing RTL design system applied across the whole app.
   Built on tokens/*.css; bridges legacy variable names; adds motion.
   =================================================================== */

@import url('/css/vazirmatn-local.css');
@import url('/css/tokens/colors.css');
@import url('/css/tokens/spacing.css');
@import url('/css/tokens/typography.css');
@import url('/css/tokens/motion.css');
@import url('/css/tokens/effects.css');
@import url('/css/tokens/backgrounds.css');
@import url('/css/tokens/themes.css');
@import url('/css/tokens/base.css');
@import url('/css/slider-presets.css');

/* ===== Mono stack (offline-safe; no Google CDN) ===== */
:root {
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo,
                 Consolas, "Liberation Mono", "Courier New", monospace;

    /* ===== Legacy → ParsinX bridge (keeps inline var() refs working) ===== */
    --bg-primary: var(--surface-app);
    --bg-secondary: var(--surface-sunken);
    --bg-card: var(--surface-card);
    --bg-card-hover: var(--surface-raised);
    --bg-glass: var(--surface-glass);
    --bg-glass-hover: var(--hover-veil);
    --border-glass: var(--border-subtle);
    --border-glass-hover: var(--border-default);

    --accent-primary: var(--accent);
    --accent-primary-hover: var(--accent-hover);
    --accent-primary-glow: color-mix(in srgb, var(--px-azure) 35%, transparent);
    --accent-secondary: var(--px-violet);
    --accent-gradient: var(--gloss-accent);
    --accent-gradient-hover: linear-gradient(180deg, var(--px-azure-bright), var(--px-azure));

    --text-accent: var(--px-azure-bright);

    --success: var(--status-online);
    --success-bg: var(--status-online-soft);
    --success-border: color-mix(in srgb, var(--px-emerald) 40%, transparent);
    --warning: var(--status-warn);
    --warning-bg: var(--status-warn-soft);
    --warning-border: color-mix(in srgb, var(--px-amber) 40%, transparent);
    --error: var(--status-error);
    --error-bg: var(--status-error-soft);
    --error-border: color-mix(in srgb, var(--px-rose) 40%, transparent);
    --info: var(--px-cyan);
    --info-bg: color-mix(in srgb, var(--px-cyan) 14%, transparent);
    --info-border: color-mix(in srgb, var(--px-cyan) 40%, transparent);

    --shadow-glow: var(--glow-accent);
    --transition-fast: var(--dur-fast) var(--ease-standard);
    --transition-normal: var(--dur-base) var(--ease-standard);
    --transition-slow: var(--dur-slow) var(--ease-standard);

    --sidebar-width: 264px;
    --topbar-height: 66px;
}

/* ===== Reset (pages rely on a zeroed baseline) ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { background: none; border: none; cursor: pointer; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; }

/* ===== Base / document ===== */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--surface-app);
    color: var(--text-primary);
    direction: rtl;
    line-height: var(--lh-relaxed);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated aurora void behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(120% 80% at 50% -12%, rgba(61,123,255,0.14), transparent 60%),
        radial-gradient(90% 60% at 100% 0%, rgba(139,92,246,0.10), transparent 55%),
        radial-gradient(70% 60% at 0% 100%, rgba(34,211,238,0.06), transparent 60%);
}
body::after {
    content: '';
    position: fixed;
    width: 60vw; height: 60vw;
    top: -20vw; inset-inline-start: -10vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(61,123,255,0.10) 0%, transparent 70%);
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    animation: px-aurora-float 24s var(--ease-in-out) infinite;
}
@keyframes px-aurora-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(14vw, 10vw) scale(1.2); }
}
[data-theme="light"] body::after { opacity: 0.5; }

a { color: var(--text-accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--px-azure-bright); }

h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-bold); line-height: var(--lh-snug); color: var(--text-primary); }

/* Mono helper */
.mono, .px-ltr-mono { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }

/* Inline data-icon hydration target */
[data-icon] { display: inline-flex; align-items: center; vertical-align: -0.15em; }
[data-icon] svg { width: 1.1em; height: 1.1em; }
.card-header h3 [data-icon] { color: var(--px-azure-bright); margin-inline-end: 8px; }
.card-header h3 { display: inline-flex; align-items: center; }

/* status dots (replace status emoji) */
.statedot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-inline-end: 5px; }
.statedot.on { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); animation: px-pulse 2.4s var(--ease-in-out) infinite; }
.statedot.off { background: var(--status-error); box-shadow: 0 0 8px color-mix(in srgb,var(--px-rose) 60%, transparent); }
.statedot.idle { background: var(--text-muted); }
.tab [data-icon], .btn [data-icon] { margin-inline-end: 2px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: var(--fw-semibold);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-control);
    background: var(--gloss-raised);
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    box-shadow: var(--inner-top-highlight), var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                border-color var(--transition-fast), background var(--transition-fast);
    white-space: nowrap;
}
.btn:hover { transform: translateY(var(--hover-lift)); box-shadow: var(--inner-top-highlight), var(--shadow-md); border-color: var(--border-strong); }
.btn:active { transform: scale(var(--press-scale)); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* sweeping sheen */
.btn::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.28), transparent);
    transform: translateX(-160%) skewX(-18deg);
    z-index: 2;
    pointer-events: none;
}
.btn:hover::after { animation: px-sheen 0.9s var(--ease-standard); }

.btn-primary {
    background: var(--gloss-accent);
    border-color: transparent;
    color: var(--accent-text-on);
    box-shadow: var(--inner-top-highlight-strong), var(--shadow-sm), var(--glow-accent);
}
.btn-primary:hover { background: var(--accent-gradient-hover); box-shadow: var(--inner-top-highlight-strong), var(--shadow-md), var(--glow-accent); }

.btn-success { background: linear-gradient(180deg, color-mix(in srgb,var(--px-emerald) 92%, white), var(--px-emerald-deep)); border-color: transparent; color: #04211a; box-shadow: var(--inner-top-highlight), var(--shadow-sm), var(--glow-online); }
.btn-success:hover { filter: brightness(1.08); }
.btn-warning { background: linear-gradient(180deg, color-mix(in srgb,var(--px-amber) 92%, white), color-mix(in srgb,var(--px-amber) 80%, black)); border-color: transparent; color: #2a1a02; box-shadow: var(--inner-top-highlight), var(--shadow-sm); }
.btn-warning:hover { filter: brightness(1.08); }
.btn-danger { background: linear-gradient(180deg, color-mix(in srgb,var(--px-rose) 95%, white), var(--px-rose-deep)); border-color: transparent; color: #fff; box-shadow: var(--inner-top-highlight), var(--shadow-sm); }
.btn-danger:hover { filter: brightness(1.08); }

.btn-ghost { background: transparent; border-color: var(--border-subtle); box-shadow: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--hover-veil); color: var(--text-primary); border-color: var(--border-default); box-shadow: none; }

.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 15px 28px; font-size: 1.02rem; }
.btn-icon { padding: 9px; width: 40px; height: 40px; }
.btn .icon, .btn svg { width: 17px; height: 17px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 8px; font-size: 0.85rem; font-weight: var(--fw-semibold); color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    color: var(--text-primary);
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
    box-shadow: var(--inset-well);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: var(--inset-well), var(--glow-focus);
    background: var(--surface-card);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 110px; resize: vertical; line-height: var(--lh-normal); }
.form-select { cursor: pointer; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: left 16px center, left 11px center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-inline-start: 38px;
}
.form-select option { background: var(--surface-card); color: var(--text-primary); }

/* ===== Cards ===== */
.card {
    background: var(--gloss-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 22px;
    box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
}
.card:hover { box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-lg); border-color: var(--border-default); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
.card-header h3, .card-title { font-size: var(--text-h4); font-weight: var(--fw-bold); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: var(--gloss-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}
.stat-card:hover { transform: translateY(var(--hover-lift)); box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-lg); border-color: var(--border-default); }
.stat-card::before { content: ''; position: absolute; top: 0; inset-inline: 0; height: 3px; background: var(--accent); opacity: 0.9; }
.stat-card.purple::before { background: var(--px-violet); }
.stat-card.green::before  { background: var(--status-online); }
.stat-card.blue::before   { background: var(--px-azure); }
.stat-card.orange::before { background: var(--status-warn); }
.stat-card.red::before    { background: var(--status-error); }
.stat-icon {
    width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.35rem;
    margin-bottom: 14px;
    background: var(--accent-soft);
    color: var(--px-azure-bright);
    box-shadow: var(--inner-top-highlight);
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.purple { background: color-mix(in srgb,var(--px-violet) 16%, transparent); color: color-mix(in srgb,var(--px-violet) 80%, white); }
.stat-icon.green  { background: var(--status-online-soft); color: var(--status-online); }
.stat-icon.blue   { background: var(--accent-soft); color: var(--px-azure-bright); }
.stat-icon.orange { background: var(--status-warn-soft); color: var(--status-warn); }
.stat-icon.red    { background: var(--status-error-soft); color: var(--status-error); }
.stat-value { font-size: 2rem; font-weight: var(--fw-black); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

/* ===== Layout: sidebar + topbar ===== */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border-inline-start: 1px solid var(--border-subtle);
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
    box-shadow: var(--glass-shadow);
}
.sidebar-brand { padding: 20px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-subtle); }
.sidebar-brand .brand-logo { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(61,123,255,0.5)); }
.sidebar-brand .brand-text h2 {
    font-size: 1.15rem; font-weight: var(--fw-black); letter-spacing: var(--ls-tight);
    background: var(--px-glow-linear); background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: px-glow-flow 8s linear infinite;
}
.sidebar-brand .brand-text small { color: var(--text-muted); font-size: 0.72rem; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 18px; }
.nav-section-title { font-size: 0.66rem; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--ls-overline); color: var(--text-muted); padding: 0 12px; margin-bottom: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem; font-weight: var(--fw-medium);
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.nav-link:hover { background: var(--hover-veil); color: var(--text-primary); transform: translateX(-3px); }
.nav-link.active { background: var(--accent-soft); color: var(--px-azure-bright); }
.nav-link.active::before { content: ''; position: absolute; inset-inline-end: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; border-radius: 3px; background: var(--accent); box-shadow: var(--glow-accent); }
.nav-link .icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.nav-link .icon svg { width: 19px; height: 19px; }
.nav-link .badge { margin-inline-start: auto; }

.main-content { flex: 1; margin-right: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

.topbar {
    height: var(--topbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky; top: 0; z-index: 50;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: var(--text-h3); font-weight: var(--fw-bold); }
.topbar-left { display: flex; align-items: center; gap: 12px; }

.notification-btn, .theme-toggle {
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    background: var(--gloss-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    position: relative;
    box-shadow: var(--inner-top-highlight);
    transition: transform var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.notification-btn:hover, .theme-toggle:hover { color: var(--text-primary); transform: translateY(-2px); box-shadow: var(--inner-top-highlight), var(--shadow-sm); }
.notification-btn svg, .theme-toggle svg { width: 19px; height: 19px; }
.notification-badge { position: absolute; top: -4px; inset-inline-start: -4px; min-width: 18px; height: 18px; padding: 0 5px; display: flex; align-items: center; justify-content: center; font-size: 0.66rem; font-weight: 700; color: #fff; background: var(--status-error); border-radius: 999px; box-shadow: 0 0 10px color-mix(in srgb,var(--px-rose) 60%, transparent); }

.user-avatar {
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--gloss-accent);
    color: #fff; font-weight: var(--fw-bold); font-size: 0.92rem;
    box-shadow: var(--inner-top-highlight-strong), var(--glow-accent);
    cursor: default;
}

.page-content { padding: 26px; flex: 1; animation: px-rise var(--dur-slow) var(--ease-standard) both; }

/* staggered entrance for direct blocks */
.page-content > * { animation: px-rise var(--dur-slow) var(--ease-standard) both; }
.page-content > *:nth-child(1) { animation-delay: 0.02s; }
.page-content > *:nth-child(2) { animation-delay: 0.06s; }
.page-content > *:nth-child(3) { animation-delay: 0.10s; }
.page-content > *:nth-child(4) { animation-delay: 0.14s; }
.page-content > *:nth-child(5) { animation-delay: 0.18s; }

/* ===== Tables ===== */
.table-container { background: var(--gloss-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-md); }
.table-container table, table.data-table { width: 100%; border-collapse: collapse; }
.table-container th, table th {
    text-align: right; padding: 14px 16px;
    font-size: 0.72rem; font-weight: var(--fw-bold);
    text-transform: uppercase; letter-spacing: var(--ls-wide);
    color: var(--text-muted); white-space: nowrap;
    background: color-mix(in srgb, var(--surface-sunken) 70%, transparent);
    border-bottom: 1px solid var(--border-default);
}
.table-container td, table td { padding: 14px 16px; font-size: 0.9rem; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); }
.table-container tbody tr { transition: background var(--transition-fast); }
.table-container tbody tr:hover { background: var(--hover-veil); }
.table-container tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; font-size: 0.74rem; font-weight: var(--fw-semibold); border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; }
.badge-success { background: var(--status-online-soft); color: var(--status-online); border-color: var(--success-border); }
.badge-warning { background: var(--status-warn-soft); color: var(--status-warn); border-color: var(--warning-border); }
.badge-error   { background: var(--status-error-soft); color: var(--status-error); border-color: var(--error-border); }
.badge-info    { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge-purple  { background: color-mix(in srgb,var(--px-violet) 14%, transparent); color: color-mix(in srgb,var(--px-violet) 82%, white); border-color: color-mix(in srgb,var(--px-violet) 38%, transparent); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success .dot { box-shadow: 0 0 8px currentColor; animation: px-pulse 2.4s var(--ease-in-out) infinite; }

/* ===== Modals ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,5,10,0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity var(--transition-normal), visibility var(--transition-normal); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--gloss-raised); border: 1px solid var(--border-default); border-radius: var(--radius-xl); box-shadow: var(--inner-top-highlight), var(--shadow-xl); transform: translateY(20px) scale(0.96); opacity: 0; transition: transform var(--transition-normal) var(--ease-emphasized), opacity var(--transition-normal); }
.modal-overlay.active .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border-subtle); }
.modal-header h3 { font-size: var(--text-h3); font-weight: var(--fw-bold); }
.modal-close { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: none; background: var(--hover-veil); color: var(--text-secondary); cursor: pointer; font-size: 1.2rem; transition: background var(--transition-fast), color var(--transition-fast); }
.modal-close:hover { background: var(--status-error-soft); color: var(--status-error); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--border-subtle); }

/* ===== Toasts ===== */
.toast-container { position: fixed; top: 20px; inset-inline-start: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 12px; }
.toast {
    display: flex; align-items: center; gap: 12px;
    min-width: 280px; max-width: 380px;
    padding: 14px 16px;
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    animation: px-toast-in var(--dur-base) var(--ease-emphasized) both;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}
@keyframes px-toast-in { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-inline-end: 3px solid var(--status-online); }
.toast.error   { border-inline-end: 3px solid var(--status-error); }
.toast.warning { border-inline-end: 3px solid var(--status-warn); }
.toast.info    { border-inline-end: 3px solid var(--accent); }
.toast-icon { font-size: 1.2rem; display: inline-flex; }
.toast-icon svg { width: 20px; height: 20px; }
.toast-message { flex: 1; font-size: 0.88rem; }

/* ===== Progress / meters ===== */
.progress-bar { height: 8px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; box-shadow: var(--inset-well); }
.progress-fill { height: 100%; border-radius: 999px; background: var(--gloss-accent); box-shadow: 0 0 12px color-mix(in srgb,var(--px-azure) 50%, transparent); transition: width var(--transition-slow) var(--ease-standard); }
.progress-fill.green  { background: linear-gradient(90deg, var(--px-emerald), var(--px-emerald-deep)); box-shadow: 0 0 12px color-mix(in srgb,var(--px-emerald) 50%, transparent); }
.progress-fill.orange { background: linear-gradient(90deg, var(--px-amber), color-mix(in srgb,var(--px-amber) 70%, black)); box-shadow: 0 0 12px color-mix(in srgb,var(--px-amber) 45%, transparent); }
.progress-fill.red    { background: linear-gradient(90deg, var(--px-rose), var(--px-rose-deep)); box-shadow: 0 0 12px color-mix(in srgb,var(--px-rose) 50%, transparent); }
.resource-meter { margin-bottom: 16px; }
.resource-meter-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.resource-meter-label { font-size: 0.85rem; color: var(--text-secondary); }
.resource-meter-value { font-size: 0.85rem; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }

/* ===== Empty state / spinner ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.6rem; margin-bottom: 12px; opacity: 0.7; }
.empty-state p { color: var(--text-secondary); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border-default); border-top-color: var(--accent); border-radius: 50%; animation: px-spin 0.7s linear infinite; }
@keyframes px-spin { to { transform: rotate(360deg); } }

/* ===== Range slider ===== */
.range-slider { width: 100%; }
.range-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.range-label { font-size: 0.85rem; color: var(--text-secondary); }
.range-value { font-size: 0.9rem; font-weight: var(--fw-bold); color: var(--px-azure-bright); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-sunken); box-shadow: var(--inset-well); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--gloss-accent); box-shadow: var(--inner-top-highlight-strong), var(--glow-accent); cursor: pointer; transition: transform var(--transition-fast); }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: none; border-radius: 50%; background: var(--px-azure); box-shadow: var(--glow-accent); cursor: pointer; }

/* ===== Pricing cards ===== */
.pricing-card { background: var(--gloss-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); padding: 28px; position: relative; box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-md); transition: transform var(--transition-normal), box-shadow var(--transition-normal); }
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-lg); }
.pricing-card.featured { border-color: transparent; }
.pricing-card.featured::before { content: ''; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; background: var(--px-glow-linear); background-size: 300% 100%; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; animation: px-glow-flow 6s linear infinite; }
.pricing-plan-name { font-size: var(--text-h3); font-weight: var(--fw-bold); margin-bottom: 6px; }
.pricing-price { font-size: 2.4rem; font-weight: var(--fw-black); color: var(--px-azure-bright); font-variant-numeric: tabular-nums; }
.pricing-period { color: var(--text-muted); font-size: 0.85rem; }
.pricing-features { list-style: none; margin: 20px 0; padding: 0; }
.pricing-features li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.9rem; color: var(--text-secondary); }
.pricing-features li::before { content: '✓'; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--status-online-soft); color: var(--status-online); font-size: 0.7rem; flex-shrink: 0; }

/* ===== Auth ===== */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 420px; background: var(--gloss-raised); border: 1px solid var(--border-default); border-radius: var(--radius-2xl); padding: 38px 34px; box-shadow: var(--inner-top-highlight), var(--shadow-xl); position: relative; isolation: isolate; animation: px-rise var(--dur-slow) var(--ease-emphasized) both; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { width: 56px; height: 56px; object-fit: contain; margin-bottom: 12px; filter: drop-shadow(0 0 16px rgba(61,123,255,0.55)); }
.auth-logo h1 { font-size: var(--text-h2); font-weight: var(--fw-black); background: var(--px-glow-linear); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: px-glow-flow 8s linear infinite; }
.auth-logo p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* ===== Landing ===== */
.landing-nav { position: fixed; top: 0; inset-inline: 0; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, 5vw); background: color-mix(in srgb, var(--surface-app) 70%, transparent); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%); backdrop-filter: blur(var(--glass-blur)) saturate(140%); border-bottom: 1px solid var(--border-subtle); z-index: 100; }
.landing-hero { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 120px 24px 80px; position: relative; }
.hero-content { max-width: 820px; }
.hero-content h1 { font-size: clamp(2.2rem, 6vw, var(--text-display-xl)); font-weight: var(--fw-black); line-height: 1.12; margin-bottom: 20px; }
.hero-content h1 span { background: var(--px-glow-linear); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: px-glow-flow 8s linear infinite; }
.hero-content p { font-size: clamp(1rem, 2.5vw, var(--text-body-lg)); color: var(--text-secondary); max-width: 620px; margin: 0 auto 32px; line-height: var(--lh-relaxed); }
.hero-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.landing-section { padding: 80px max(24px, 5vw); max-width: var(--container-wide); margin: 0 auto; }
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { font-size: clamp(1.7rem, 4vw, var(--text-display-lg)); font-weight: var(--fw-black); margin-bottom: 12px; }
.section-title p { color: var(--text-secondary); max-width: 560px; margin: 0 auto; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; max-width: var(--container-max); margin: 0 auto; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.feature-card { background: var(--gloss-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); padding: 26px; box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-sm); transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal); }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--inner-top-highlight), var(--inner-ring), var(--shadow-lg); border-color: var(--border-accent); }
.feature-icon { width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--px-azure-bright); font-size: 1.5rem; margin-bottom: 16px; box-shadow: var(--inner-top-highlight); }
.feature-icon svg { width: 26px; height: 26px; }
.feature-card h3 { font-size: var(--text-h4); margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.92rem; }
.landing-footer { padding: 40px 24px; text-align: center; color: var(--text-muted); border-top: 1px solid var(--border-subtle); font-size: 0.85rem; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface-sunken); border-radius: var(--radius-md); box-shadow: var(--inset-well); margin-bottom: 22px; width: fit-content; }
.tab { padding: 9px 18px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: var(--fw-medium); color: var(--text-secondary); cursor: pointer; border: none; background: transparent; transition: all var(--transition-fast); }
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--gloss-raised); color: var(--text-primary); box-shadow: var(--inner-top-highlight), var(--shadow-sm); }

/* ===== Theme toggle thumb icon swap ===== */
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: inline-flex; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ===== Hamburger ===== */
.hamburger { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--gloss-raised); color: var(--text-primary); font-size: 1.2rem; cursor: pointer; }

/* ===== Utilities ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--status-online); }
.text-warning { color: var(--status-warn); }
.text-error { color: var(--status-error); }
.text-accent { color: var(--px-azure-bright); }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: var(--fw-bold); }
.tnum { font-variant-numeric: tabular-nums; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .hamburger { display: inline-flex; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .page-content { padding: 18px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 26px 22px; }
    .modal { margin: 10px; }
}
