/* =============================================
   Admin Panel CSS - Simplified & Responsive
   ============================================= */

/* =============================================
   Primary Action Button (canonical style from vinnypux-web)
   Big orange-gold gradient button for main actions
   ============================================= */
.btn-primary-vp {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--color-orange), var(--color-gold));
    border: none;
    border-radius: 12px;
    color: #0a0a0a;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(var(--color-orange-rgb), 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary-vp:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(var(--color-orange-rgb), 0.5);
}

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

.btn-primary-vp:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Auto-width compact variant (for inline buttons) */
.btn-primary-vp.btn-primary-vp-sm {
    width: auto;
    padding: 0.55rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* =============================================
   Custom Animated Checkbox (.sc-check)
   Used across admin panel for binary checkboxes
   ============================================= */
.sc-check {
    --sc-check-size: 22px;
    --sc-check-active: var(--color-orange);
    --sc-check-idle: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    position: relative;
}

.sc-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.sc-check-box {
    position: relative;
    width: var(--sc-check-size);
    height: var(--sc-check-size);
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--sc-check-idle);
    border-radius: 7px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-check:hover .sc-check-box {
    border-color: rgba(var(--color-orange-rgb), 0.4);
    transform: scale(1.05);
}

.sc-check input:checked ~ .sc-check-box {
    background: var(--sc-check-active);
    border-color: var(--sc-check-active);
    box-shadow: 0 4px 12px rgba(var(--color-orange-rgb), 0.35);
}

.sc-check input:focus-visible ~ .sc-check-box {
    outline: 3px solid rgba(var(--color-orange-rgb), 0.4);
    outline-offset: 2px;
}

.sc-check input:active ~ .sc-check-box {
    transform: scale(0.85);
}

.sc-check-box svg {
    width: 70%;
    height: 70%;
    fill: none;
    stroke: #fff;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    transition: stroke-dashoffset 0.3s ease;
    transition-delay: 0.1s;
}

.sc-check input:checked ~ .sc-check-box svg {
    stroke-dashoffset: 0;
}

.sc-check-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.2s;
}

.sc-check:hover .sc-check-label {
    color: var(--color-white);
}

/* Compact variant for table rows */
.sc-check.sc-check-sm {
    --sc-check-size: 18px;
    gap: 0;
}
.sc-check.sc-check-sm .sc-check-box {
    border-width: 1.5px;
    border-radius: 5px;
}

/* Subpage server/app picker compact */
.json-server-item.sc-check,
.platform-app-picker-item.sc-check {
    --sc-check-size: 18px;
}
.json-server-item.sc-check .sc-check-box,
.platform-app-picker-item.sc-check .sc-check-box {
    border-width: 1.5px;
    border-radius: 5px;
}
.json-server-item.sc-check .sc-check-box svg,
.platform-app-picker-item.sc-check .sc-check-box svg {
    stroke-width: 5;
}

[data-theme="light"] .sc-check {
    --sc-check-idle: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .sc-check-box {
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .sc-check-label {
    color: rgba(0, 0, 0, 0.75);
}



/* CSS Variables */
/* Native checkbox + radio follow the brand primary everywhere by default.
   Individual pages can still override via .some-class input { accent-color: X }. */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--color-orange);
}

/* =============================================
   DESIGN TOKENS - 4.0 "design-system lite"
   Keys mirror Mantine v7 so the 5.0 React rewrite promotes them mechanically:
     --space-*  -> --mantine-spacing-*      --radius-* -> --mantine-radius-*
     --shadow-* -> --mantine-shadow-*       status     -> theme named colors
   Admin is dark-only (no light theme); values match what the code already used,
   so tokenizing is a refactor, not a recolor. Legacy --color- and --border-radius
   names kept as aliases - existing pages keep working.
   ============================================= */
:root {
    /* spacing - 8px base */
    --space-2xs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 999px;

    /* elevation */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);

    /* brand - DERIVE from --color-orange/--color-gold below; brand.js + SSR
       brand_inject override those inline per franchise config (settings/config),
       so --brand and everything built on it follow the configured brand. */
    --brand: var(--color-orange);
    --brand-rgb: var(--color-orange-rgb);
    --brand-hover: var(--color-orange);
    --brand-2: var(--color-gold);
    --brand-gradient: linear-gradient(135deg, var(--brand), var(--brand-2));

    /* surfaces */
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --surface-2: #252525;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* text */
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.4);

    /* status - tokenizes the greens/reds/ambers/blues already used ad-hoc */
    --success: #10b981;
    --success-fg: #34d399;
    --danger: #ef4444;
    --danger-fg: #f87171;
    --warning: #f59e0b;
    --warning-fg: #fbbf24;
    --info: #3b82f6;
    --info-fg: #60a5fa;

    /* liquid-glass surface - the ONE canonical card backing, used everywhere.
       Edit here to restyle every card/panel at once (.ds-glass + .remnawave-*). */
    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.06);
    --glass-blur: blur(40px) saturate(150%);
    --glass-sheen: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    --glass-shadow: 0 10px 36px rgba(0, 0, 0, 0.38);
    --glass-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.48);
    --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.1);

    /* layout + legacy aliases (do not remove - referenced across SPAs) */
    --sidebar-width: 280px;
    --sidebar-width-lg: 300px;
    --color-orange: #ff6b35;
    --color-orange-rgb: 255, 107, 53;
    --color-gold: #ffb800;
    --color-gold-rgb: 255, 184, 0;
    --color-white: #ffffff;
    --color-black: var(--bg);
    --color-dark: var(--surface);
    --color-darker: #050505;
    --transition: all 0.3s ease;
    --border-radius: var(--radius-md);
    --border-radius-lg: var(--radius-lg);
}

/* =============================================
   RESPONSIVE BREAKPOINTS - the canonical set. Use ONLY these in new/edited CSS
   (CSS can't tokenize media-query values; this is the convention to follow).
   Aligned with Mantine v7 (sm/md/lg) for the 5.0 migration:
     mobile   @media (max-width: 767px)                      < sm
     tablet   @media (min-width: 768px) and (max-width: 1023px)  sm..md
     desktop  @media (min-width: 1024px)                     >= md
     wide     @media (min-width: 1440px)                     >= lg
   Boundary rule: tablet ends at 1023, desktop starts at 1024 (no 1px gap).
   NOTE: legacy code still has ad-hoc breakpoints (1025/1280/1600/1920/2560 and a
   1024 gap) - migrate them to this set page-by-page; don't refactor all at once.
   ============================================= */

/* =============================================
   DESIGN-SYSTEM COMPONENTS (.ds-*)
   Reusable, token-built primitives for new/redesigned admin screens.
   Namespaced `ds-` to avoid collisions in the global stylesheet; map 1:1 onto
   Mantine components (Card/Button/Badge/Table/TextInput) in 5.0.
   ============================================= */
.ds-card {
    background: var(--surface);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.ds-glass {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--glass-shadow), var(--glass-inset);
    transition: var(--transition);
}

.ds-glass::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: var(--glass-sheen);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ds-glass:hover {
    border-color: var(--border-strong);
    box-shadow: var(--glass-shadow-hover), var(--glass-inset);
}

.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 0.6rem var(--space-md);
    border-radius: var(--radius-sm);
    border: var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.ds-btn:hover {
    background: rgba(var(--brand-rgb), 0.1);
    border-color: rgba(var(--brand-rgb), 0.35);
    color: var(--brand);
}

.ds-btn:active { transform: scale(0.98); }

.ds-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chrome 149/macOS smears an element-level gradient past the radius on glass
   cards. The gradient lives on an inner ::before instead: the button itself
   paints nothing, the pseudo is clipped by overflow, box-shadow survives. */
.ds-btn--primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: none;
    border: none;
    color: #1a1008;
    box-shadow: 0 4px 16px rgba(var(--brand-rgb), 0.3);
}

.ds-btn--primary::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--brand-gradient);
}

.ds-btn--primary:hover {
    background: none;
    color: #1a1008;
    filter: brightness(1.08);
    box-shadow: 0 6px 22px rgba(var(--brand-rgb), 0.45);
}

.ds-btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.ds-btn--success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--success);
}

.ds-btn--success:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--success);
}

.ds-btn--danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--danger-fg);
}

.ds-btn--danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger-fg);
}

.ds-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.ds-chip--success { color: var(--success-fg); border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }
.ds-chip--danger { color: var(--danger-fg); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.ds-chip--warning { color: var(--warning-fg); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.ds-chip--info { color: var(--info-fg); border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.1); }

/* THE toggle switch (canonized 2026-07-08 from three page-local copies:
   tariffs .switch, branding .design-toggle, raffles .raffle-toggle).
   Markup: <label class="ds-toggle"><input type="checkbox">
             <span class="ds-toggle-slider"></span>
             [<span class="ds-toggle-label">…</span>]</label> */
.ds-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.ds-toggle input {
    display: none;
}

.ds-toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.ds-toggle-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ds-toggle input:checked + .ds-toggle-slider {
    background: rgba(var(--brand-rgb), 0.55);
    border-color: rgba(var(--brand-rgb), 0.8);
}

.ds-toggle input:checked + .ds-toggle-slider::after {
    transform: translateX(18px);
}

.ds-toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

/* Multi-select segment picker - trigger + checkbox menu + removable chips.
   Markup is built by AdminSegments.mountPicker (js/admin/segments.js);
   selected chips reuse .ds-chip. */
.ds-segpick { position: relative; }

.ds-segpick-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.ds-segpick-trigger:hover { border-color: rgba(255, 255, 255, 0.16); }

.ds-segpick-chevron { flex-shrink: 0; transition: transform 0.2s ease; opacity: 0.6; }
.ds-segpick-trigger[aria-expanded="true"] .ds-segpick-chevron { transform: rotate(180deg); }

.ds-segpick-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 260px;
    overflow-y: auto;
    background: #17181c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.35rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.ds-segpick-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    user-select: none;
}

.ds-segpick-option:hover { background: rgba(255, 255, 255, 0.06); }
.ds-segpick-option input { accent-color: var(--brand); flex-shrink: 0; }

.ds-segpick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.ds-segpick-chips:empty { display: none; }
.ds-segpick-chip { display: inline-flex; align-items: center; gap: 0.35rem; }

.ds-segpick-chip-x {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    opacity: 0.6;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.ds-segpick-chip-x:hover { opacity: 1; }

/* Segmented switch - small group of mutually-exclusive tabs (modeled on the
   broadcast bc-target-switch). Toggle .is-active on the buttons. */
.ds-seg {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--surface);
    padding: 0.2rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ds-seg-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ds-seg-btn:hover {
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.07);
}

.ds-seg-btn.is-active {
    background: rgba(var(--brand-rgb), 0.22);
    color: var(--brand);
}

/* Compact variant: chart-card filters and other tight headers. */
.ds-seg--sm .ds-seg-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
}

/* Row icon button - square icon action inside list rows/cards (delete,
   toggle, copy...). Head actions keep .admin-head-icon-btn. Modifiers set
   the hover accent; .is-success is a state (e.g. copied feedback). */
.ds-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--surface-2);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ds-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

.ds-icon-btn--danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

.ds-icon-btn--info:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--info);
    color: var(--info);
}

.ds-icon-btn.is-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.ds-icon-btn--muted { opacity: 0.5; }
.ds-icon-btn--sm { width: 30px; height: 30px; }

/* DEPRECATED in favour of the .form-field/.field-label/.field-input family
   below (the de-facto canonical form set every modal uses). Kept only for
   design-system.html; physical rename lands with the 5.0 rewrite. */
.ds-input {
    width: 100%;
    padding: 0.6rem var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font-size: 0.9rem;
    transition: var(--transition);
}

.ds-input::placeholder { color: var(--text-dim); }

.ds-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.ds-label {
    display: block;
    margin-bottom: var(--space-2xs);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ds-table th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-strong);
}

.ds-table td {
    padding: var(--space-sm) var(--space-md);
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.ds-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

.ds-stat {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.ds-stat-label { color: var(--text-dim); font-size: 0.78rem; font-weight: 600; margin-bottom: var(--space-2xs); }
.ds-stat-value { color: var(--text); font-size: 1.25rem; font-weight: 800; }
.ds-stat-value--success { color: var(--success); }
.ds-stat-value--warning { color: var(--warning); }
.ds-stat-value--danger { color: var(--danger); }

/* Period-over-period delta under a stat value («↑ 12%» vs the previous
   period). Fades in once computed; up/down carry the status colours. */
.ds-stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: var(--space-2xs);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ds-stat-delta.is-visible { opacity: 1; }
.ds-stat-delta--up { color: var(--success); }
.ds-stat-delta--down { color: var(--danger); }

/* Indeterminate loading bar - drop into any container (card body, list,
   modal) while its data is in flight. Brand-gradient highlight sweeps a
   dim track; remove/replace the element when content arrives. */
.ds-loading-bar {
    position: relative;
    height: 3px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin: 0.75rem 0;
}

.ds-loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    border-radius: inherit;
    background: var(--brand-gradient);
    animation: ds-loading-sweep 1.1s ease-in-out infinite;
}

@keyframes ds-loading-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* =============================================
   Base Styles
   ============================================= */

html, body {
    margin: 0;
    padding: 0;
    scrollbar-color: rgba(var(--color-orange-rgb), 0.4) #0a0a0a;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-orange-rgb), 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-orange-rgb), 0.6);
}

/* =============================================
   Auth Container (Login Page)
   ============================================= */

.admin-auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.admin-auth-card {
    background: rgba(42, 42, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.admin-auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.admin-auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-orange), var(--color-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.5rem 0;
}

.admin-auth-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(var(--color-orange-rgb), 0.3);
    border-radius: var(--border-radius);
    color: var(--color-white);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px rgba(var(--color-orange-rgb), 0.1);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
}

.toggle-password.visible {
    opacity: 1;
    visibility: visible;
}

.toggle-password:hover {
    color: var(--color-orange);
}

.error-message {
    background: rgba(var(--color-orange-rgb), 0.2);
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.btn-auth {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, var(--color-orange), var(--color-gold));
    color: var(--color-black);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(var(--color-orange-rgb), 0.3);
}
.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-orange-rgb), 0.4);
}

.btn-generate-copy {
    width: 100%;
    background: rgba(var(--color-orange-rgb), 0.2);
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-generate-copy:hover {
    background: rgba(var(--color-orange-rgb), 0.3);
}

/* =============================================
   Admin Layout
   ============================================= */

/* Visible from the first frame: every admin page sits behind nginx
   auth_request (no session → 302 to login, the HTML is never served), so the
   old display:none-until-checkAuth gate protected nothing - it only made the
   sidebar miss first paint, and its named view-transition group faded to a
   blank white canvas on every navigation. `.visible` kept as a no-op class
   for back-compat with admin.js callers. */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
}

/* =============================================
   Cross-document View Transitions (Chrome 126+, Safari 18+)
   Adds a subtle fade between admin pages. Browsers without support fall
   back to instant nav (no animation).

   The sidebar is deliberately NOT a named group: its glass style
   (translucent bg + backdrop-filter) cannot be snapshotted - a lifted
   layer has no backdrop to blur, so the snapshot composites a 75%-alpha
   strip over the transition canvas → the white sidebar flash on every
   nav. Inside the ROOT snapshot the glass is already baked into pixels,
   and since the sidebar renders identically on both pages, the root
   cross-fade keeps it visually static for free.
   ============================================= */
@view-transition {
    navigation: auto;
}

/* Belt: the transition canvas defaults to white; any sliver not covered
   by a snapshot must be dark. Literal color - custom-property inheritance
   into view-transition pseudos is unreliable across Chrome versions. */
::view-transition {
    background-color: #0a0a0a;
}

/* Instant swap, NO cross-fade. The default plus-lighter crossfade is
   mathematically lossless, but its GPU compositing broke on Chrome 149/macOS
   (normal-blend fallback → the whole page washed out for ~1s on every nav).
   With animation:none the transition keeps its real job - holding the old
   frame until the new page is ready (no white gap between documents) - and
   there is simply nothing left to blend. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
}

/* =============================================
   Sidebar
   ============================================= */

.admin-sidebar {
    /* No view-transition-name here - see the View Transitions block above:
       a lifted glass (backdrop-filter) snapshot loses its backdrop and
       flashes white. The root cross-fade keeps the sidebar stable instead. */
    width: var(--sidebar-width);
    background: rgba(16, 16, 16, 0.75);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    /* Smooth animation when user clicks the toggle. Initial paint is gated
       by html.admin-no-transition (set in HEAD prelude, removed after 2 RAFs)
       so layout flips from the html[data-sidebar-collapsed] attribute happen
       instantly during page load - animation only kicks in for user actions. */
    transition: transform 0.3s ease;
}

.admin-sidebar::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(var(--brand-rgb), 0.22), transparent);
    pointer-events: none;
}

.admin-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--color-orange-rgb), 0.2);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-logo svg {
    width: 24px;
    height: 24px;
    color: var(--color-orange);
}

.sidebar-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-logo [hidden] { display: none !important; }

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.sidebar-close:hover {
    color: var(--color-orange);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
    /* Reserve a fixed gutter so the scrollbar doesn't sit on top of links */
    scrollbar-gutter: stable;
    /* Firefox: thin themed scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
    /* Visible buffer between links and the scrollbar gutter */
    padding-right: 0.75rem;
}

/* WebKit / Chromium: very narrow translucent scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Collapsible nav groups */
.nav-group {
    margin-bottom: var(--space-2xs);
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    margin: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-group-toggle:hover {
    color: var(--text-muted);
}

.nav-group-chevron {
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.25s ease;
}

.nav-group.open .nav-group-chevron {
    transform: rotate(180deg);
}

/* Smooth height via grid 0fr -> 1fr (no magic max-height) */
.nav-group-items {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.nav-group.open .nav-group-items {
    grid-template-rows: 1fr;
}

.nav-group-inner {
    overflow: hidden;
    min-height: 0;
}

/* Nav links */
.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
}

/* nested links sit slightly indented under their group header */
.nav-group-inner .sidebar-link {
    padding-left: 1.25rem;
}

.sidebar-link svg,
.sidebar-link .sidebar-link-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
.sidebar-link .sidebar-link-icon {
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

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

.sidebar-link:hover .sidebar-link-icon {
    opacity: 0.9;
}

/* Active: subtle left accent bar + soft tint (premium, not a loud filled pill) */
.sidebar-link.active {
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 1.15rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--brand);
}

.sidebar-link.active .sidebar-link-icon {
    opacity: 1;
}

/* =============================================
   Sidebar Backdrop (Mobile/Tablet Only)
   ============================================= */

/* Sidebar Backdrop - only visible on mobile/tablet, behind sidebar */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 280px; /* Starts to the right of the sidebar so it doesn't overlap */
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998; /* Below sidebar (99999) */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* No backdrop-filter here - it's applied to admin-main instead */
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* On mobile devices backdrop should be to the right of the sidebar */
@media (max-width: 767px) {
    .sidebar-backdrop {
        left: 280px; /* Sidebar width */
    }
}

/* =============================================
   Main Content Area
   ============================================= */

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    /* Smooth animation when user toggles sidebar. Same gate as .admin-sidebar
       - html.admin-no-transition disables this during initial paint. */
    transition: margin-left 0.3s ease, width 0.3s ease, max-width 0.3s ease;
    overflow-y: visible;
    overflow-x: hidden;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.admin-sidebar.collapsed ~ .admin-main,
.admin-layout.sidebar-collapsed .admin-main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
}

.admin-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    overflow-y: visible;
    overflow-x: hidden;
}

/* Responsive max-widths for different screens */
@media (min-width: 1440px) {
    .admin-content {
        max-width: 1600px;
        padding: 0 3rem;
    }
}

@media (min-width: 1920px) {
    .admin-content {
        max-width: 1800px;
        padding: 0 4rem;
    }
}

@media (min-width: 2560px) {
    .admin-content {
        max-width: 2200px;
        padding: 0 5rem;
    }
}

/* MacBook 13" and smaller screens */
@media (max-width: 1440px) {
    .admin-content {
        max-width: 100%;
        padding: 0 1.5rem;
    }
}

/* =============================================
   Form Cards - Liquid Glass Style
   ============================================= */

.admin-form-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: visible;
}

.admin-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

/* =============================================
   Domains List
   ============================================= */

.domains-list {
    margin-top: 1.5rem;
}

.domains-list h2 {
    color: var(--color-white);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.domain-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.01) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    transition: var(--transition);
}

.domain-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.domain-info h3 {
    color: var(--color-white);
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
}

.domain-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

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

.status-online {
    background: var(--color-gold);
    box-shadow: 0 0 8px var(--color-gold);
}

.status-offline {
    background: rgba(255, 255, 255, 0.3);
}

.btn-remove-domain {
    background: rgba(var(--color-orange-rgb), 0.2);
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-remove-domain:hover {
    background: rgba(var(--color-orange-rgb), 0.3);
}

/* =============================================
   Subpage Settings (Glass Effect Cards)
   ============================================= */

.subpage-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    overflow: visible;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.subpage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.subpage-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.subpage-title-group h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-white);
    margin: 0 0 0.5rem 0;
}

.status-indicator-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.status-light-on {
    background: var(--color-gold);
    box-shadow: 0 0 8px var(--color-gold);
}

.status-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.subpage-card-body {
    padding: 1.5rem;
}

.info-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(var(--color-orange-rgb), 0.1);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: var(--border-radius);
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.info-message svg {
    flex-shrink: 0;
    color: var(--color-orange);
}

.info-message.small {
    font-size: 0.8rem;
    padding: 0.75rem;
}

/* Toggle Switch */
.toggle-switch-wrapper {
    display: flex;
    align-items: center;
}

.toggle-switch-label {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-input-modern {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-modern {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider-modern::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--color-white);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-input-modern:checked + .toggle-slider-modern {
    background: var(--color-orange);
}

.toggle-input-modern:checked + .toggle-slider-modern::before {
    transform: translateX(22px);
}

/* Settings Groups */
.settings-expanded {
    margin-top: 1rem;
}

.settings-group {
    background: rgba(26, 26, 26, 0.5);
    border: 1px solid rgba(var(--color-orange-rgb), 0.1);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-white);
    margin: 0 0 1rem 0;
}

.form-field {
    margin-bottom: 1rem;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.field-label svg {
    color: var(--color-orange);
}

.field-input,
.field-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: var(--border-radius);
    color: var(--color-white);
    font-size: 0.9rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.field-input:focus,
.field-textarea:focus {
    outline: none;
    border-color: var(--color-orange);
}

/* The native select arrow ignores padding (Safari pins it to the border and
   indents the text): own chevron inside the field, text aligned with inputs. */
select.field-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.55)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    cursor: pointer;
}

select.field-input option {
    background: #1a1a1a;
    color: #fff;
}

.field-textarea {
    resize: vertical;
    min-height: 80px;
}

.field-hint {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.btn-add-server {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(var(--color-orange-rgb), 0.2);
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-add-server:hover {
    background: rgba(var(--color-orange-rgb), 0.3);
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.glass-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =============================================
   Users, Partners, and Data Tables
   ============================================= */

.admin-table-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    overflow: visible;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.admin-table-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(var(--color-orange-rgb), 0.1);
}

.admin-table th {
    background: rgba(26, 26, 26, 0.5);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.admin-table td {
    color: var(--color-white);
    font-size: 0.9rem;
}

.admin-table tr:hover td {
    background: rgba(var(--color-orange-rgb), 0.05);
}

/* =============================================
   Utility Classes
   ============================================= */

.text-orange { color: var(--color-orange); }
.text-gold { color: var(--color-gold); }
.text-muted { color: rgba(255, 255, 255, 0.6); }

.glass-effect {
    background: rgba(42, 42, 42, 0.6);
    backdrop-filter: blur(20px);
}

.glass-inner {
    background: rgba(26, 26, 26, 0.5);
}

/* =============================================
   RESPONSIVE STYLES - MOBILE (< 768px)
   ============================================= */

@media (max-width: 767px) {
    /* Mobile: Sidebar as full overlay */
    .admin-sidebar {
        width: 280px;
        z-index: 99999 !important;
        touch-action: auto !important;
        -webkit-touch-callout: none;
        pointer-events: auto !important;
        /* Ensure sidebar is not dimmed */
        filter: none !important;
        opacity: 1 !important;
        background: rgba(15, 15, 15, 0.98) !important;
    }
    
    /* Ensure sidebar nav is scrollable and interactive */
    .admin-sidebar .sidebar-nav {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        pointer-events: auto !important;
    }
    
    /* Sidebar links - must be native <a> behavior */
    .admin-sidebar .sidebar-link {
        display: flex !important;
        align-items: center;
        min-height: 48px;
        padding: 0.75rem 1rem;
        pointer-events: auto !important;
        touch-action: auto !important;
        -webkit-tap-highlight-color: rgba(var(--color-orange-rgb), 0.3);
        cursor: pointer;
        text-decoration: none;
        position: relative;
        z-index: 10;
    }
    
    /* Ensure link content doesn't block clicks */
    .admin-sidebar .sidebar-link * {
        pointer-events: none;
    }
    
    .sidebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 48px;
        min-height: 48px;
        touch-action: manipulation !important;
        pointer-events: auto !important;
        z-index: 10;
    }
    
    /* Main content - NO POSITION CHANGES, only visual effects. Padding
       comes from the shared topbar layout standard (end of this file). */
    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        overflow-y: auto;
        min-height: 100vh;
    }

    /* When sidebar is open, dim content with overlay (no filter - avoids z-index issues with fixed wavy-dots) */
    body.sidebar-open .admin-main {
        pointer-events: none !important;
        user-select: none;
    }
    body.sidebar-open .admin-main::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9997;
        pointer-events: none;
    }
    
    /* Make sure body doesn't scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden !important;
    }
    
    /* Auth card */
    .admin-auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .admin-auth-header h1 {
        font-size: 1.5rem;
    }
    
    /* Domain cards */
    .domain-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-remove-domain {
        width: 100%;
        text-align: center;
    }
    
    /* Subpage settings */
    .subpage-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .toggle-switch-wrapper {
        margin-top: 0.5rem;
    }
}

/* =============================================
   RESPONSIVE STYLES - TABLET (768px - 1023px)
   ============================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    /* Sidebar behavior like mobile - overlay */
    .admin-sidebar {
        z-index: 99999 !important;
        touch-action: auto !important;
        pointer-events: auto !important;
    }
    
    .sidebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Backdrop controlled by JS */
    
    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
        /* base rule caps max-width at calc(100% - sidebar); clear it or the
           content stays narrowed to 540px even with the sidebar hidden */
        max-width: 100% !important;
        position: relative !important;
    }

    /* When sidebar is open on tablet, dim content with overlay */
    body.sidebar-open .admin-main {
        pointer-events: none !important;
    }
    body.sidebar-open .admin-main::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9997;
        pointer-events: none;
    }
    
}

/* =============================================
   RESPONSIVE STYLES - DESKTOP (1024px+)
   ============================================= */

@media (min-width: 1024px) {
    /* Desktop: Sidebar inline, content adjusts */
    .admin-sidebar {
        width: var(--sidebar-width);
    }
    
    .sidebar-close {
        display: none;
    }
    
    .sidebar-backdrop {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    /* No blur effect on desktop */
    body.sidebar-open .admin-main {
        filter: none !important;
        pointer-events: auto !important;
    }
    
    /* Ensure body is not locked on desktop */
    body.sidebar-open {
        overflow: auto !important;
        position: static !important;
    }
    
    /* Main content adjusts for sidebar - default state with sidebar open */
    .admin-main {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        max-width: calc(100% - var(--sidebar-width));
        padding: 2rem;
    }
    
    /* When sidebar is collapsed - use class on admin-layout */
    .admin-layout.sidebar-collapsed .admin-main {
        margin-left: 0;
        width: 100%;
    }
    
    /* Auth styles */
    .admin-auth-card {
        padding: 2.5rem;
        max-width: 420px;
    }
    
}

/* =============================================
   RESPONSIVE STYLES - LARGE DESKTOP (1280px+)
   ============================================= */

@media (min-width: 1280px) {
    :root {
        --sidebar-width: 300px;
    }
    
    .admin-sidebar {
        padding: 2rem;
    }
    
    .sidebar-logo {
        font-size: 1.375rem;
    }
    
    .sidebar-link {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .admin-main {
        padding: 2.5rem;
    }
    
    .admin-auth-card {
        padding: 3rem;
        max-width: 480px;
    }
    
    .admin-auth-header h1 {
        font-size: 2rem;
    }
    
}

/* =============================================
   RESPONSIVE STYLES - EXTRA LARGE (1600px+)
   ============================================= */

@media (min-width: 1600px) {
    :root {
        --sidebar-width: 320px;
    }
    
    .admin-sidebar {
        padding: 2.5rem;
    }
    
    .sidebar-logo {
        font-size: 1.5rem;
    }
    
    .sidebar-logo svg {
        width: 28px;
        height: 28px;
    }
    
    .sidebar-link {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .admin-main {
        padding: 3rem;
    }
    
    .admin-auth-card {
        padding: 4rem;
        max-width: 550px;
        border-radius: 28px;
    }
    
    .admin-auth-header h1 {
        font-size: 2.5rem;
    }
    
    .form-group input {
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
    }
    
    .btn-auth {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
}

/* =============================================
   Users Page Styles
   ============================================= */

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.users-count {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.users-count span {
    font-weight: 700;
    color: var(--color-orange);
}

.btn-sync {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(var(--color-orange-rgb), 0.2);
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 0.625rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-sync:hover {
    background: rgba(var(--color-orange-rgb), 0.3);
}

.btn-sync.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-sync.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =============================================
   Remnawave Page Styles
   ============================================= */

.remnawave-glass-container {
    max-width: 600px;
    margin: 0 auto;
}

.remnawave-glass-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 2.5rem;
    overflow: visible;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.remnawave-glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    border-radius: 24px 24px 0 0;
}

.glass-card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(var(--color-orange-rgb), 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.remnawave-hero {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.remnawave-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(var(--color-orange-rgb), 0.1);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: 20px;
    margin: 0 auto 1.5rem;
}

.remnawave-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-white);
    margin: 0 0 0.75rem 0;
}

.remnawave-hero-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

.remnawave-actions-container {
    position: relative;
    z-index: 1;
}

.remnawave-errors-container {
    margin-top: 1.5rem;
}

.errors-card {
    border-color: rgba(239, 68, 68, 0.3);
}

.errors-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.errors-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #ef4444;
    margin: 0;
}

.errors-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.error-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* Sync Progress */
.sync-progress {
    text-align: center;
}

.sync-progress-bar {
    height: 8px;
    background: rgba(var(--color-orange-rgb), 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.sync-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-orange), var(--color-gold));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sync-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* =============================================
   Broadcast Page Styles
   ============================================= */

.broadcast-container {
    max-width: 800px;
    margin: 0 auto;
}

.broadcast-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: visible;
}

.broadcast-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.broadcast-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.broadcast-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: var(--border-radius);
    color: var(--color-white);
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
}

.broadcast-textarea:focus {
    outline: none;
    border-color: var(--color-orange);
}

.broadcast-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.broadcast-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.broadcast-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-orange);
}

.btn-broadcast {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--color-orange), var(--color-gold));
    border: none;
    border-radius: var(--border-radius);
    color: var(--color-black);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-broadcast:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-orange-rgb), 0.4);
}

.btn-broadcast:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   Partners Page Styles
   ============================================= */

.partners-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.partners-stats {
    display: flex;
    gap: 1.5rem;
}

/* Legacy partners styles removed - the page uses .partner-row (admin-partners.css). */

/* =============================================
   Settings Pages Styles (Config & Tariffs)
   ============================================= */

.settings-container {
    max-width: 900px;
    margin: 0 auto;
}

.settings-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: visible;
}

.settings-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--color-orange-rgb), 0.1);
}

.settings-card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-white);
    margin: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(var(--color-orange-rgb), 0.1);
}

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

.settings-row-info {
    flex: 1;
}

.settings-row-label {
    font-weight: 500;
    color: var(--color-white);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.settings-row-description {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.settings-row-control {
    flex-shrink: 0;
}

.settings-input {
    padding: 0.625rem 1rem;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(var(--color-orange-rgb), 0.2);
    border-radius: 8px;
    color: var(--color-white);
    font-size: 0.9rem;
    min-width: 150px;
}

.settings-input:focus {
    outline: none;
    border-color: var(--color-orange);
}

/* =============================================
   Modals
   ============================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Above the sidebar (9999) - a modal must dim the whole viewport. */
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Lock page scroll (layout scrolls on window) while any modal is open. */
body:has(.modal-overlay.active) {
    overflow: hidden;
}

.modal {
    /* Canonical modal chrome (matches the users modal). */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-white);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--color-orange);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-modal {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-modal-primary {
    background: rgba(var(--color-orange-rgb), 0.14);
    border: 1px solid rgba(var(--color-orange-rgb), 0.35);
    color: var(--color-orange);
    font-weight: 600;
}

.btn-modal-primary:hover {
    background: rgba(var(--color-orange-rgb), 0.22);
    border-color: rgba(var(--color-orange-rgb), 0.55);
}

.btn-modal-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-white);
}

.btn-modal-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* =============================================
   Global Toast Notification (window.adminToast)
   ============================================= */
.admin-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100vw - 40px);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.admin-toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.admin-toast--success {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(20, 30, 25, 0.9);
}
.admin-toast--success .admin-toast-icon { color: #34d399; }

.admin-toast--error {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(30, 20, 22, 0.9);
}
.admin-toast--error .admin-toast-icon { color: #f87171; }

.admin-toast--info {
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(20, 25, 35, 0.9);
}
.admin-toast--info .admin-toast-icon { color: #60a5fa; }

@media (max-width: 767px) {
    .admin-toast {
        bottom: 20px;
        font-size: 12px;
        padding: 10px 16px;
        max-width: calc(100vw - 24px);
    }
}

/* =============================================
   Print Styles
   ============================================= */

@media print {
    .admin-sidebar {
        display: none !important;
    }

    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Auto-applied when brand.js detects that the uploaded logo has a
   non-transparent background (corner-pixel sampling). Turns a square-cropped
   artwork into a soft app-icon shape that integrates with dark UIs. */
img[data-brand="logo"].has-bg {
    border-radius: 22%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* =============================================
   Admin confirm modal (window.adminConfirm)
   Full-screen blurred overlay + centred glass card. Fades in/out over 200ms;
   body-scroll is locked via JS so the backdrop doesn't jitter on mobile.
   ============================================= */
.admin-confirm-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 8, 0.55);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 1rem;
}
.admin-confirm-backdrop.open { opacity: 1; }

.admin-confirm-modal {
    width: 100%;
    max-width: 400px;
    background: rgba(26, 26, 28, 0.88);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    /* Center title + message; actions override this via their own align. */
    text-align: center;
}
.admin-confirm-backdrop.open .admin-confirm-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.admin-confirm-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
}
.admin-confirm-message {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin: 0 0 1.25rem;
}
.admin-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.admin-confirm-btn {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 200px;
    padding: 0.7rem 1.1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

/* Mobile: stack buttons full-width and tighten padding. */
@media (max-width: 480px) {
    .admin-confirm-backdrop { padding: 0.75rem; }
    .admin-confirm-modal { padding: 1.5rem 1.25rem 1.25rem; border-radius: 14px; }
    .admin-confirm-title { font-size: 1rem; }
    .admin-confirm-message { font-size: 0.88rem; }
    .admin-confirm-actions { flex-direction: column-reverse; gap: 0.5rem; }
    .admin-confirm-btn { flex: 1 1 auto; max-width: none; width: 100%; }
}
.admin-confirm-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
}
.admin-confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.admin-confirm-ok {
    background: rgba(var(--color-orange-rgb), 0.18);
    border: 1px solid rgba(var(--color-orange-rgb), 0.4);
    color: var(--color-orange);
}
.admin-confirm-ok:hover {
    background: rgba(var(--color-orange-rgb), 0.28);
    border-color: rgba(var(--color-orange-rgb), 0.6);
}
.admin-confirm-ok.is-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}
.admin-confirm-ok.is-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
}

/* Form-variant of the confirm modal - wider, left-aligned, with inputs. */
.admin-confirm-modal.is-form {
    max-width: 440px;
    text-align: left;
}
.admin-confirm-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0.25rem 0 1.25rem;
}
.admin-confirm-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.admin-confirm-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
}
.admin-confirm-field input,
.admin-confirm-field select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.65rem 0.8rem;
    border-radius: 9px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.admin-confirm-field input:focus,
.admin-confirm-field select:focus {
    border-color: rgba(var(--color-orange-rgb), 0.5);
    background: rgba(255, 255, 255, 0.08);
}
.admin-confirm-field .admin-confirm-hint {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.15rem;
}
.admin-confirm-field .admin-confirm-field-error {
    font-size: 0.72rem;
    color: #f87171;
    margin-top: 0.15rem;
    min-height: 0.95rem;
}

/* ============================================================
   Admin topbar (shared component: components/admin-topbar.html,
   inlined into every page at build). Fixed glass bar: left =
   hamburger↔X toggle morphing with the sidebar state, right =
   account controls (logout now; language etc. later). Hides on
   scroll down, returns on scroll up. JS wiring in admin.js.
   Every admin page carries the component - the layout rules
   below ARE the admin layout standard.
   ============================================================ */

/* Strict 3-block layout: topbar on top, sidebar left, full-bleed
   content. Ancestors are forced overflow:visible so the WINDOW is
   the scroll container - otherwise their overflow-x:hidden computes
   overflow-y to auto, traps position:sticky, and the topbar
   wouldn't stick. Content offset = topbar height + gap. */
.admin-layout { overflow: visible; }
.admin-main { padding: 0; overflow: visible; }
/* Side gutters are part of the layout standard - pages must not add their own. */
.admin-content { max-width: none; margin: 0; padding: 76px 20px 20px; overflow: visible; }

/* =============================================
   Page section head (subpage pattern, admin-wide): icon chip + title +
   animated count badge on the left, icon actions on the right.
   ============================================= */

.admin-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.1rem;
    border: var(--glass-border);
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    margin-bottom: 1rem;
}

.admin-page-head-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.admin-page-head-title h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
}

.admin-page-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(var(--brand-rgb), 0.14);
    border: 1px solid rgba(var(--brand-rgb), 0.22);
    flex-shrink: 0;
}
.admin-page-head-icon img { width: 22px; height: 22px; filter: brightness(0) invert(1); }

.admin-page-head-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.admin-head-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.admin-head-icon-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.admin-head-icon-btn:disabled { opacity: 0.6; cursor: default; }
.admin-head-icon-btn svg { width: 20px; height: 20px; display: block; }

/* Refresh-style buttons: icon winds in on hover, unwinds on leave
   (same feel as the panels sync button). */
.admin-head-icon-btn--spin-hover svg { transition: transform 0.5s ease; }
.admin-head-icon-btn--spin-hover:hover:not(:disabled) svg { transform: rotate(180deg); }

/* Icon rotation while an action is in flight (uses the shared spin keyframes). */
.spin { animation: spin 1s linear infinite; }

/* Count badge (purple pill, count-up via window.adminAnimateCount). Ships
   EMPTY (no whitespace - :empty!) and stays hidden until the first real
   count lands, so '0 → N' never flashes during load. */
.badge-server-count {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.2rem 0.5rem;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 6px;
    color: rgb(196, 181, 253);
    min-width: 24px;
    text-align: center;
}

.badge-server-count:empty {
    display: none;
}

/* Canonical save button (subpage header design - THE save button
   everywhere: page heads, modal footers). Icon = icons/save.svg. */
.btn-save-header {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-save-header:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(var(--color-gold-rgb), 0.2) 0%, rgba(var(--color-orange-rgb), 0.15) 100%);
    border-color: rgba(var(--color-gold-rgb), 0.35);
    box-shadow: 0 4px 16px rgba(var(--color-gold-rgb), 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-save-header:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-save-header:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-save-header img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

/* Labeled stat in the page head: muted caption + count badge. */
.admin-head-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.75rem;
}

.admin-head-stat-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
}

@media (max-width: 767px) {
    .admin-head-stat-label { display: none; }
}

/* Canonical pagination (window.renderAdminPagination) - one design for
   every paged list. Active page = brand tint. */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.admin-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Solid surface - the dotted page background must not show through. */
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.admin-page-btn:hover:not(:disabled):not(.active) {
    background: linear-gradient(0deg, rgba(var(--brand-rgb), 0.1), rgba(var(--brand-rgb), 0.1)), var(--surface-2);
    border-color: rgba(var(--brand-rgb), 0.3);
    color: var(--text);
}

.admin-page-btn.active {
    background: linear-gradient(0deg, rgba(var(--brand-rgb), 0.15), rgba(var(--brand-rgb), 0.15)), var(--surface-2);
    border-color: rgba(var(--brand-rgb), 0.4);
    color: var(--brand);
    cursor: default;
}

.admin-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.admin-page-dots {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
    padding: 0 2px;
}

/* Generic empty state: big dim icon + muted caption (tickets pattern). */
/* The hidden attribute must win over the explicit display:flex (trap #5) */
.ds-empty-state[hidden] {
    display: none !important;
}

.ds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 20px;
    min-height: 280px;
}

.ds-empty-icon {
    width: 56px;
    height: 56px;
    opacity: 0.35;
    filter: brightness(0) invert(1);
}

.ds-empty-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    font-weight: 500;
}

/* Compact variant: modals and small lists, where 280px would balloon the layout. */
.ds-empty-state--compact {
    min-height: 0;
    padding: 20px 16px;
    gap: 10px;
}

.ds-empty-state--compact .ds-empty-icon {
    width: 32px;
    height: 32px;
}

/* Overlay variant: sits on top of a chart canvas inside a position:relative
   wrapper; hidden until JS adds .visible (no data). */
.ds-empty-state--overlay {
    display: none;
    position: absolute;
    inset: 0;
    min-height: 0;
    padding: 0;
}

.ds-empty-state--overlay.visible { display: flex; }

.ds-empty-state--compact .ds-empty-text {
    font-size: 13px;
}

/* Fixed like the sidebar → the content's rubber-band overscroll never
   drags it. left tracks the sidebar width (0 when collapsed / on mobile). */
.admin-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 60;
    box-sizing: border-box;
    height: 64px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    margin: 0;
    /* Glass: nearly clear, the blur does the work (not a dark slab). */
    background: rgba(20, 20, 26, 0.12);
    backdrop-filter: blur(28px) saturate(170%);
    -webkit-backdrop-filter: blur(28px) saturate(170%);
    border-bottom: 1px solid transparent;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease, left 0.3s ease;
}
html[data-sidebar-collapsed] .admin-topbar,
.admin-layout.sidebar-collapsed .admin-topbar,
body:has(.admin-sidebar.collapsed) .admin-topbar { left: 0; }
@media (max-width: 1023px) { .admin-topbar { left: 0; } }
[data-theme="light"] .admin-topbar { background: rgba(248, 248, 252, 0.35); }
/* Subtle divider once the page is scrolled under the bar. */
.admin-topbar.is-stuck { border-bottom-color: var(--border); }
.admin-topbar.is-hidden {
    transform: translateY(-115%);
    opacity: 0;
    pointer-events: none;
}
.admin-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Borderless menu toggle: 3 bars that morph into an X. */
.admin-topbar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
}
.admin-menu-icon { position: relative; width: 22px; height: 16px; }
.admin-menu-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}
.admin-menu-icon span:nth-child(1) { top: 0; }
.admin-menu-icon span:nth-child(2) { top: 7px; }
.admin-menu-icon span:nth-child(3) { top: 14px; }
.admin-topbar-toggle:hover { color: var(--brand); }
/* Sidebar open → X. */
.admin-menu-icon.is-open span:nth-child(1) { top: 7px; transform: rotate(45deg); }
.admin-menu-icon.is-open span:nth-child(2) { opacity: 0; }
.admin-menu-icon.is-open span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

/* Right-side control buttons (logout, and later language/etc.). */
.admin-topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.admin-topbar-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}
.admin-topbar-btn svg { width: 20px; height: 20px; display: block; }
/* Logout uses the brand accent (follows the branding config). */
.admin-topbar-logout {
    color: var(--brand);
    border-color: rgba(var(--brand-rgb), 0.4);
}
.admin-topbar-logout:hover {
    background: rgba(var(--brand-rgb), 0.14);
    border-color: var(--brand);
    color: var(--brand);
}
