:root {
    /* ── Palette ── */
    --bg:            #080c14;
    --bg-2:          #0d1220;
    --surface:       #111827;
    --surface-2:     #1a2236;
    --surface-3:     #212d45;
    --border:        rgba(255,255,255,0.06);
    --border-bright: rgba(255,255,255,0.11);
    --border-focus:  rgba(99,160,255,0.55);

    --text:          #edf2fc;
    --text-2:        #8b9abf;
    --text-3:        #4d5e80;

    /* Blue accent — slightly cooler, more saturated */
    --accent:        #4f8ef7;
    --accent-2:      #63a0ff;
    --accent-dim:    rgba(79,142,247,0.13);
    --accent-hover:  #3a7ae8;
    --accent-glow:   rgba(79,142,247,0.28);

    /* Purple complement for gradients */
    --purple:        #8b5cf6;
    --purple-dim:    rgba(139,92,246,0.12);

    --green:         #34d399;
    --green-dim:     rgba(52,211,153,0.10);
    --amber:         #fbbf24;
    --amber-dim:     rgba(251,191,36,0.10);
    --red:           #f87171;
    --red-dim:       rgba(248,113,113,0.10);

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.5);
    --shadow-md:  0 4px 20px rgba(0,0,0,0.6);
    --shadow-lg:  0 16px 48px rgba(0,0,0,0.75);
    --shadow-glow: 0 0 0 1px rgba(79,142,247,0.2), 0 8px 32px rgba(79,142,247,0.15);

    --radius-sm: 7px;
    --radius:    11px;
    --radius-lg: 15px;
    --radius-xl: 20px;

    --sidebar-w: 230px;
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ─── LAYOUT ─────────────────────────────────── */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* subtle inner glow on sidebar right edge */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(79,142,247,0.18) 35%,
        rgba(139,92,246,0.12) 65%,
        transparent 100%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79,142,247,0.35);
}

.brand > div strong {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.1px;
}

.brand > div span,
.sidebar .brand span {
    display: block;
    font-size: 10.5px;
    color: var(--text-3);
    margin-top: 1px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 10px;
    margin-bottom: -14px;
}

.nav-tabs {
    display: grid;
    gap: 2px;
}

.nav-tab {
    text-align: left;
    background: transparent;
    color: var(--text-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    position: relative;
}

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

.nav-tab.active {
    background: var(--accent-dim);
    color: var(--accent-2);
    border-color: rgba(79,142,247,0.18);
}

/* active indicator bar */
.nav-tab.active::before {
    content: '';
    position: absolute;
    left: -1px; top: 20%; bottom: 20%;
    width: 2px;
    background: var(--accent);
    border-radius: 99px;
}

.nav-tab .nav-icon {
    width: 15px;
    height: 15px;
    opacity: 0.65;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.nav-tab.active .nav-icon { opacity: 1; }
.nav-tab:hover .nav-icon { opacity: 0.9; }

.sidebar-spacer { flex: 1; }

/* ─── GHOST BUTTON ───────────────────────────── */
.ghost-button {
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    min-height: 36px;
    padding: 0 14px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ghost-button:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border-color: var(--border-bright);
}

.full { width: 100%; }

/* ─── MAIN ───────────────────────────────────── */
.main {
    padding: 30px 36px;
    overflow: auto;
    min-height: 100vh;
    background: var(--bg);
    /* Subtle noise texture feel via gradient */
    background-image:
        radial-gradient(ellipse 70% 40% at 70% 0%, rgba(79,142,247,0.05) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 100% 80%, rgba(139,92,246,0.04) 0%, transparent 60%);
}

/* ─── TOPBAR ─────────────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 5px;
    opacity: 0.85;
}

.topbar h1 {
    font-size: 23px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.4px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── INPUTS ─────────────────────────────────── */
input, textarea, select {
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    font-size: 13.5px;
}

input:hover, textarea:hover, select:hover {
    border-color: rgba(255,255,255,0.17);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    background: var(--surface-2);
}

input::placeholder, textarea::placeholder {
    color: var(--text-3);
}

select option { background: var(--surface-2); }

.search-input {
    width: min(360px, 36vw);
    padding-left: 36px;
    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='%234d5e80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 11px center;
}

/* ─── BUTTONS ────────────────────────────────── */
.primary-button, .secondary-button, .danger-button {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    min-height: 38px;
    padding: 0 16px;
    font-size: 13.5px;
    font-weight: 600;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active { transform: scale(0.98); }

.primary-button {
    background: linear-gradient(135deg, var(--accent) 0%, #5a9bff 100%);
    color: #fff;
    border-color: rgba(99,160,255,0.4);
}
.primary-button:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: 0 3px 16px rgba(79,142,247,0.4);
}

.secondary-button {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-bright);
}
.secondary-button:hover {
    background: var(--surface-3);
    border-color: rgba(255,255,255,0.16);
}

.danger-button {
    background: var(--red);
    color: #fff;
}
.danger-button:hover {
    background: #e55c5c;
    box-shadow: 0 3px 12px rgba(248,113,113,0.35);
}

/* ─── TAB VIEWS ──────────────────────────────── */
.tab-view { display: none; }
.tab-view.active { display: block; }

/* ─── METRICS ────────────────────────────────── */
.metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: default;
}

/* Gradient shimmer top bar */
.metric::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--purple) 100%);
    opacity: 0;
    transition: opacity 0.25s;
}

/* subtle bottom glow */
.metric::before {
    content: '';
    position: absolute;
    bottom: -20px; left: 10%; right: 10%;
    height: 40px;
    background: radial-gradient(ellipse, rgba(79,142,247,0.12) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.25s;
}

.metric:hover {
    border-color: rgba(79,142,247,0.25);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}
.metric:hover::after,
.metric:hover::before { opacity: 1; }

.metric span {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

.metric strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -1.2px;
    color: var(--text);
    line-height: 1.1;
}

/* ─── PANEL ──────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 16px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}

.panel-head > span {
    font-size: 11.5px;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

.panel-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-head-actions > span {
    font-size: 11.5px;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

.compact {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

/* ─── DASHBOARD GRID ─────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 16px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
    gap: 16px;
}

.analytics-panel {
    display: grid;
    gap: 14px;
}

.analytics-head {
    align-items: flex-start;
}

.analytics-head > div:first-child {
    display: grid;
    gap: 5px;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.chart-mode {
    min-height: 30px;
    border: 1px solid rgba(123, 222, 255, 0.16);
    border-radius: 8px;
    padding: 0 10px;
    background: rgba(7, 14, 29, 0.72);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 700;
    transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.16s;
}

.chart-mode:hover {
    color: var(--text);
    border-color: rgba(8, 220, 255, 0.34);
    transform: translateY(-1px);
}

.chart-mode.active {
    color: #03101b;
    background: linear-gradient(135deg, #18f2ff 0%, #0a8dff 100%);
    border-color: rgba(101, 233, 255, 0.75);
    box-shadow: 0 10px 24px rgba(0, 132, 255, 0.20);
}

.chart-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.chart-kpis article {
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid rgba(123, 222, 255, 0.12);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(8, 220, 255, 0.08), rgba(19, 120, 255, 0.035));
}

.chart-kpis span,
.chart-kpis small {
    display: block;
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chart-kpis strong {
    display: block;
    margin: 5px 0 2px;
    color: var(--text);
    font-size: 20px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-stage {
    min-height: 340px;
    border: 1px solid rgba(123, 222, 255, 0.11);
    border-radius: var(--radius);
    padding: 10px;
    background:
        linear-gradient(145deg, rgba(2, 8, 18, 0.54), rgba(8, 18, 36, 0.34)),
        repeating-linear-gradient(90deg, rgba(8, 220, 255, 0.025) 0 1px, transparent 1px 54px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.chart-insights {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-top: 2px;
}

.chart-insights strong,
.chart-insights span {
    display: block;
}

.chart-insights strong {
    color: var(--text);
    font-size: 13px;
}

.chart-insights span {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 11.5px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(123, 222, 255, 0.12);
    border-radius: 999px;
    background: rgba(7, 14, 29, 0.58);
    color: var(--text-2);
    font-size: 11px;
}

.chart-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px currentColor;
}

.chart-legend b {
    color: var(--text);
    font-weight: 800;
}

.legend-color-0 { color: #08dcff; background: #08dcff !important; }
.legend-color-1 { color: #1378ff; background: #1378ff !important; }
.legend-color-2 { color: #34d399; background: #34d399 !important; }
.legend-color-3 { color: #fbbf24; background: #fbbf24 !important; }
.legend-color-4 { color: #f87171; background: #f87171 !important; }
.legend-color-5 { color: #8b5cf6; background: #8b5cf6 !important; }
.legend-color-6 { color: #2dd4bf; background: #2dd4bf !important; }
.legend-color-7 { color: #60a5fa; background: #60a5fa !important; }

/* ─── FORM GRID ───────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 16px;
    align-items: start;
}

.fields { display: grid; gap: 14px; }

label {
    display: grid;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

label input, label textarea, label select {
    color: var(--text);
    font-size: 13.5px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

textarea { resize: vertical; }

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-2);
    text-transform: none;
    font-size: 13.5px;
    font-weight: 400;
    letter-spacing: 0;
}

.check-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── TABLE ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }

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

th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
    color: var(--text-2);
    transition: background 0.1s;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.018); }

td strong { color: var(--text); font-weight: 600; }
td small { font-size: 11px; color: var(--text-3); }

.key {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--accent-2);
    background: var(--accent-dim);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(79,142,247,0.15);
}

/* ─── BADGES ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 99px;
    padding: 3px 10px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 5px currentColor;
}

.badge.success {
    color: var(--green);
    background: var(--green-dim);
    border: 1px solid rgba(52,211,153,0.15);
}
.badge.warning {
    color: var(--amber);
    background: var(--amber-dim);
    border: 1px solid rgba(251,191,36,0.15);
}
.badge.danger  {
    color: var(--red);
    background: var(--red-dim);
    border: 1px solid rgba(248,113,113,0.15);
}

/* ─── ROW ACTIONS ────────────────────────────── */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.row-actions button {
    min-height: 27px;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-2);
    padding: 0 9px;
    font-size: 11.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.row-actions button:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: rgba(255,255,255,0.15);
}

.row-actions .danger-text { color: var(--red); }
.row-actions .danger-text:hover {
    background: var(--red-dim);
    border-color: rgba(248,113,113,0.25);
}

/* ─── EVENTS ─────────────────────────────────── */
.event-list {
    display: grid;
    gap: 7px;
    max-height: 736px;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-gutter: stable;
}

.event-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    min-height: 76px;
    display: grid;
    gap: 4px;
    transition: border-color 0.15s, background 0.15s;
    background: rgba(255,255,255,0.01);
}

.event-item:hover {
    border-color: var(--border-bright);
    background: rgba(255,255,255,0.025);
}

.event-item strong {
    font-size: 12.5px;
    color: var(--text);
    font-weight: 500;
}

.event-item small {
    font-size: 11px;
    color: var(--text-3);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
}

.audit-panel {
    min-height: 640px;
}

.audit-head {
    align-items: flex-start;
}

.audit-head > div:first-child {
    display: grid;
    gap: 5px;
}

.audit-filters {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.audit-filters select {
    min-width: 190px;
}

.audit-filters .search-input {
    width: min(420px, 36vw);
}

.audit-log-list {
    display: grid;
    gap: 10px;
    max-height: 680px;
    overflow-y: auto;
    padding-right: 7px;
    scrollbar-gutter: stable;
}

.audit-log-item {
    position: relative;
    display: grid;
    gap: 11px;
    padding: 14px 16px;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(14, 26, 48, 0.88), rgba(7, 14, 29, 0.80));
    overflow: hidden;
}

.audit-log-item::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--green);
    opacity: 0.85;
}

.audit-log-item.danger::before {
    background: var(--red);
}

.audit-log-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.audit-log-top > div {
    display: grid;
    gap: 5px;
}

.audit-log-top strong {
    color: var(--text);
    font-size: 14px;
}

.audit-log-top time {
    flex-shrink: 0;
    color: var(--text-3);
    font-size: 11.5px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.audit-category {
    width: fit-content;
    border: 1px solid rgba(8, 220, 255, 0.22);
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(8, 220, 255, 0.08);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.audit-log-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.audit-log-meta span {
    min-width: 0;
    border: 1px solid rgba(123, 222, 255, 0.10);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(2, 8, 18, 0.26);
    color: var(--text-3);
    font-size: 11px;
}

.audit-log-meta b {
    display: block;
    margin-top: 2px;
    color: var(--text-2);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-log-item p,
.audit-log-item small {
    margin: 0;
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.audit-log-item small {
    color: var(--text-3);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.server-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.server-report {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 14px;
    display: grid;
    gap: 9px;
    background: rgba(255,255,255,0.012);
    transition: border-color 0.15s;
}

.server-report:hover { border-color: var(--border-bright); }

.server-report > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.server-report strong,
.server-report small {
    display: block;
}

.server-report small {
    margin-top: 3px;
    color: var(--text-3);
    font-size: 11px;
}

.server-report p {
    margin: 0;
    color: var(--text-2);
    font-size: 11.5px;
    line-height: 1.5;
}

/* ─── CODE BLOCK ─────────────────────────────── */
.code-block {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    color: #b8caf0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    line-height: 1.75;
}

#validation-chart {
    width: 100%;
    height: 320px;
    display: block;
}

/* ─── REASON GRID ────────────────────────────── */
.reason-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.reason-grid span {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-2);
    background: var(--surface-2);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    cursor: default;
}

.reason-grid span:hover {
    border-color: rgba(79,142,247,0.35);
    color: var(--accent-2);
    background: var(--accent-dim);
}

/* ─── TOAST ──────────────────────────────────── */
.toast {
    position: fixed;
    right: 20px;
    bottom: 24px;
    max-width: min(360px, calc(100vw - 40px));
    padding: 11px 16px;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    animation: slideUp 0.22s cubic-bezier(0.16,1,0.3,1);
    z-index: 100;
    /* subtle left accent */
    border-left: 3px solid var(--accent);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hidden { display: none !important; }

/* ─── MODAL ──────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 5, 10, 0.80);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-card {
    width: min(1120px, calc(100vw - 36px));
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(79,142,247,0.08);
    padding: 24px;
    animation: modalIn 0.22s cubic-bezier(0.16,1,0.3,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.modal-head h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.3px;
}

.modal-head span {
    display: block;
    margin-top: 4px;
    color: var(--text-3);
    font-size: 12px;
}

/* ─── SERVER SUMMARY ─────────────────────────── */
.server-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.server-summary article {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color 0.15s;
}

.server-summary article:hover { border-color: var(--border-bright); }

.server-summary span {
    color: var(--text-3);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.server-summary strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.8px;
}

.server-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.server-card {
    position: relative;
    min-height: 260px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.008) 100%);
    padding: 14px;
    display: grid;
    gap: 12px;
    align-content: start;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.server-card:hover {
    border-color: var(--border-bright);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.server-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--red);
}

.server-card.online::before { background: var(--green); }
.server-card.offline { opacity: 0.78; }

.server-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.server-card-top > span:last-child {
    color: var(--text-3);
    font-size: 10.5px;
    text-align: right;
}

.server-card h3 {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.25;
}

.server-card p {
    margin: -6px 0 0;
    color: var(--text-3);
    font-size: 11.5px;
}

.server-card-gridline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.14);
}

.server-card-gridline span {
    color: var(--text-3);
    font-size: 10.5px;
}

.server-card-gridline strong {
    color: var(--text);
    font-size: 11px;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.server-card-mods {
    max-height: 155px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.14);
    padding: 8px;
    scrollbar-gutter: stable;
}

.mod-tools {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 7px;
    margin-bottom: -6px;
}

.icon-button {
    min-height: 30px;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    background: rgba(79,142,247,0.07);
    color: var(--accent);
    display: grid;
    place-items: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-button:hover {
    background: var(--accent-dim);
    border-color: rgba(79,142,247,0.4);
    color: var(--accent-2);
}

.icon-button svg {
    width: 14px;
    height: 14px;
}

.mod-search {
    width: 100%;
    min-height: 30px;
    padding: 6px 10px 6px 30px;
    font-size: 12px;
    background-color: rgba(0,0,0,0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%234d5e80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.mod-list {
    margin: 0;
    padding-left: 26px;
    display: grid;
    gap: 5px;
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.35;
}

.mod-list li {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: rgba(255,255,255,0.02);
    overflow-wrap: anywhere;
    transition: border-color 0.12s;
}

.mod-list li:hover { border-color: var(--border-bright); }

.mod-list li::marker {
    color: var(--accent);
    font-weight: 700;
}

.mod-empty {
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
    padding: 12px 4px;
}

.empty-state {
    border: 1px dashed rgba(255,255,255,0.09);
    border-radius: var(--radius);
    padding: 28px;
    color: var(--text-3);
    text-align: center;
    grid-column: 1 / -1;
    font-size: 13px;
}

.modal.hidden { display: none !important; }

.block-modal-card {
    width: min(820px, calc(100vw - 36px));
}

.block-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.block-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.015);
    padding: 14px;
}

.block-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.block-panel-head h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
}

.block-panel-head span {
    min-width: 28px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-3);
    font-size: 11.5px;
    padding: 2px 8px;
}

.block-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 12px;
}

.block-list {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.block-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.12);
    padding: 7px 7px 7px 10px;
}

.block-item span {
    color: var(--text-2);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.block-item button {
    min-height: 26px;
    border: 1px solid rgba(248,113,113,0.2);
    border-radius: 5px;
    background: var(--red-dim);
    color: var(--red);
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.block-item button:hover {
    background: rgba(248,113,113,0.2);
}

.empty-mini {
    border: 1px dashed rgba(255,255,255,0.07);
    border-radius: var(--radius-sm);
    padding: 18px;
    color: var(--text-3);
    text-align: center;
    font-size: 12px;
}

.server-card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.mini-danger-button {
    min-height: 32px;
    border: 1px solid rgba(248,113,113,0.24);
    border-radius: 8px;
    background: rgba(248,113,113,0.09);
    color: #ff9a9a;
    font-size: 11.5px;
    font-weight: 800;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.mini-danger-button:hover:not(:disabled) {
    background: rgba(248,113,113,0.16);
    border-color: rgba(248,113,113,0.44);
    transform: translateY(-1px);
}

.mini-allow-button {
    min-height: 32px;
    border: 1px solid rgba(34,211,238,0.28);
    border-radius: 8px;
    background: rgba(34,211,238,0.10);
    color: #67e8f9;
    font-size: 11.5px;
    font-weight: 800;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.mini-allow-button:hover:not(:disabled) {
    background: rgba(34,211,238,0.18);
    border-color: rgba(34,211,238,0.48);
    transform: translateY(-1px);
}

.mini-danger-button:disabled,
.mini-allow-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

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

.entity-card {
    display: grid;
    gap: 12px;
    min-width: 0;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius);
    padding: 16px;
    background:
        linear-gradient(145deg, rgba(15, 28, 52, 0.82), rgba(7, 14, 29, 0.72)),
        linear-gradient(90deg, rgba(8, 220, 255, 0.035), transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.entity-card.warning { border-color: rgba(251,191,36,0.24); }
.entity-card.danger { border-color: rgba(248,113,113,0.26); }

.entity-card-top,
.alert-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.entity-card strong,
.alert-item strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    line-height: 1.25;
}

.entity-card span,
.entity-card p,
.alert-item p,
.alert-item small {
    color: var(--text-3);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.entity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entity-meta span {
    border: 1px solid rgba(123, 222, 255, 0.12);
    border-radius: 999px;
    padding: 4px 9px;
    background: rgba(2, 8, 18, 0.26);
}

.entity-meta b { color: var(--text-2); }

.entity-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.entity-chip-list span {
    max-width: 100%;
    border: 1px solid rgba(8, 220, 255, 0.16);
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(8, 220, 255, 0.07);
    color: #b8f7ff;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.entity-chip-list.muted-chips span {
    border-color: rgba(123, 222, 255, 0.10);
    background: rgba(255,255,255,0.025);
    color: var(--text-3);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.alert-list {
    display: grid;
    gap: 10px;
}

.alert-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius);
    padding: 14px;
    background: rgba(7, 14, 29, 0.58);
}

.alert-item.high {
    border-color: rgba(248,113,113,0.30);
    background: linear-gradient(145deg, rgba(248,113,113,0.10), rgba(7, 14, 29, 0.62));
}

.alert-item.medium {
    border-color: rgba(251,191,36,0.28);
    background: linear-gradient(145deg, rgba(251,191,36,0.09), rgba(7, 14, 29, 0.62));
}

.alert-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(8, 220, 255, 0.20);
    background: rgba(8, 220, 255, 0.09);
    color: var(--accent);
    font-weight: 900;
}

.alert-item.high .alert-icon {
    border-color: rgba(248,113,113,0.32);
    background: rgba(248,113,113,0.12);
    color: var(--red);
}

.alert-item.medium .alert-icon {
    border-color: rgba(251,191,36,0.30);
    background: rgba(251,191,36,0.11);
    color: var(--amber);
}

.alert-item p {
    margin-top: 6px;
    color: var(--text-2);
}

.alert-item small {
    display: block;
    margin-top: 7px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.settings-menu {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(15, 28, 52, 0.78), rgba(7, 14, 29, 0.66));
}

.settings-menu-item {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.settings-menu-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
}

.settings-menu-item.active {
    border-color: rgba(8, 220, 255, 0.18);
    background: linear-gradient(135deg, rgba(8, 220, 255, 0.14), rgba(19, 120, 255, 0.08));
    color: #d9fbff;
}

.security-panel .panel-head > div {
    display: grid;
    gap: 4px;
}

.security-panel,
.settings-form-panel {
    grid-column: 2;
}

.settings-form-panel {
    margin-bottom: 0;
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: grid;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-group {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius);
    padding: 15px;
    background: rgba(2, 8, 18, 0.24);
}

.settings-group h3 {
    color: var(--text);
    font-size: 13px;
    line-height: 1.2;
}

.identity-order-group {
    grid-column: 1 / -1;
}

.settings-hint {
    color: var(--text-3);
    font-size: 12px;
    line-height: 1.5;
}

.hidden-setting-field {
    display: none;
}

.identity-order-table {
    overflow-x: auto;
    border: 1px solid rgba(123, 222, 255, 0.10);
    border-radius: var(--radius-sm);
    background: rgba(5, 12, 26, 0.38);
}

.identity-order-table table {
    min-width: 640px;
}

.identity-order-table th,
.identity-order-table td {
    padding: 10px 12px;
}

.identity-order-table td strong,
.identity-order-table td small {
    display: block;
}

.identity-order-table td small {
    margin-top: 2px;
}

.order-pill {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(8, 220, 255, 0.22);
    background: rgba(8, 220, 255, 0.08);
    color: var(--accent);
    font-weight: 800;
    font-size: 12px;
}

.identity-order-actions {
    display: flex;
    gap: 7px;
}

.identity-order-actions .icon-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.security-panel .panel-head > div span {
    color: var(--text-3);
    font-size: 11.5px;
}

.security-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
    gap: 14px;
}

.security-card {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
    border: 1px solid rgba(123, 222, 255, 0.13);
    border-radius: var(--radius);
    padding: 16px;
    background:
        linear-gradient(145deg, rgba(8, 220, 255, 0.07), rgba(19, 120, 255, 0.035)),
        rgba(2, 8, 18, 0.24);
}

.security-card-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.security-card-head strong,
.security-card-head span {
    display: block;
}

.security-card-head strong {
    color: var(--text);
    font-size: 14px;
}

.security-card-head span {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 12px;
}

.security-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--accent);
    border: 1px solid rgba(8, 220, 255, 0.24);
    background: rgba(8, 220, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 12px 24px rgba(0, 132, 255, 0.12);
}

.danger-icon {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.28);
    background: rgba(248, 113, 113, 0.10);
}

.security-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-wrap {
    width: 180px;
    height: 180px;
    justify-self: center;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(8, 220, 255, 0.24);
    background: #f8fbff;
    box-shadow: 0 18px 44px rgba(0, 132, 255, 0.18);
}

.qr-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.copy-row input {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.compact-actions {
    margin-top: 0;
    padding-top: 12px;
}

.status-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.status-card {
    width: min(760px, 100%);
    margin: 0;
}

.status-brand {
    width: fit-content;
    margin-bottom: 22px;
}

.status-card h1 {
    margin-bottom: 18px;
    font-size: 26px;
    letter-spacing: -0.4px;
}

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

.status-grid article {
    min-height: 104px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    border: 1px solid rgba(123, 222, 255, 0.14);
    border-radius: var(--radius);
    padding: 15px;
    background: linear-gradient(145deg, rgba(8, 220, 255, 0.08), rgba(19, 120, 255, 0.03));
}

.status-grid span {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.status-grid strong {
    color: var(--text);
    font-size: 26px;
    line-height: 1;
}

/* ─── MUTED ──────────────────────────────────── */
.muted { color: var(--text-3); }

/* ─── LOGIN ──────────────────────────────────── */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bg);
    /* Dual radial glow behind the card */
    background-image:
        radial-gradient(ellipse 55% 45% at 50% 0%, rgba(79,142,247,0.14) 0%, transparent 65%),
        radial-gradient(ellipse 30% 25% at 80% 85%, rgba(139,92,246,0.08) 0%, transparent 60%);
}

.login-shell {
    width: min(400px, calc(100vw - 32px));
}

.login-panel {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-xl);
    padding: 36px 34px;
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px rgba(79,142,247,0.06),
        inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}

/* Ambient glow blob inside the card */
.login-panel::before {
    content: '';
    position: absolute;
    top: -60px; left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(79,142,247,0.09) 0%, transparent 70%);
    pointer-events: none;
}

.login-panel .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 15px;
    box-shadow: 0 6px 20px rgba(79,142,247,0.45);
}

.login-panel h1 {
    margin: 18px 0 5px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
}

.login-panel .muted {
    font-size: 13px;
    color: var(--text-3);
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

/* Override label style for login to be less shouty */
.login-form label {
    font-size: 11.5px;
    letter-spacing: 0.04em;
}

.login-form input {
    background: var(--surface-2);
    border-color: rgba(255,255,255,0.09);
}

.login-form .primary-button {
    min-height: 44px;
    font-size: 14px;
    margin-top: 4px;
    border-radius: var(--radius);
}

.form-message {
    min-height: 20px;
    font-size: 12.5px;
    color: var(--red);
    margin-top: 6px;
    text-align: center;
}

/* ─── CANCEL EDIT ────────────────────────────── */
#cancel-edit {
    min-height: 30px;
    padding: 0 12px;
    font-size: 11.5px;
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1000px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    .sidebar::after { display: none; }
    .nav-tabs {
        grid-template-columns: repeat(5, auto);
        width: 100%;
    }
    .sidebar-spacer { display: none; }
    .topbar, .topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .search-input { width: 100%; }
    .metrics,
    .dashboard-grid,
    .analytics-grid,
    .form-grid,
    .settings-layout,
    .security-grid,
    .settings-form-grid { grid-template-columns: 1fr; }
    .security-panel,
    .settings-form-panel { grid-column: auto; }
    .chart-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-controls,
    .chart-legend {
        justify-content: flex-start;
    }
    .chart-insights {
        display: grid;
    }
    .audit-filters {
        justify-content: stretch;
    }
    .audit-filters select,
    .audit-filters .search-input {
        width: 100%;
    }
    .audit-log-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .main { padding: 20px 16px; }
}

@media (max-width: 600px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .chart-kpis { grid-template-columns: 1fr; }
    .chart-stage {
        min-height: 300px;
        padding: 8px;
    }
    #validation-chart {
        height: 285px;
    }
    .nav-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .audit-log-top {
        display: grid;
    }
    .audit-log-meta {
        grid-template-columns: 1fr;
    }
}

/* ─── FOCUS VISIBLE ──────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ─── REDUCED MOTION ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Modern brand polish */
:root {
    --bg:            #050814;
    --bg-2:          #07101f;
    --surface:       rgba(12, 20, 38, 0.86);
    --surface-2:     rgba(18, 31, 55, 0.88);
    --surface-3:     rgba(28, 47, 78, 0.92);
    --border:        rgba(123, 222, 255, 0.10);
    --border-bright: rgba(123, 222, 255, 0.20);
    --border-focus:  rgba(5, 217, 255, 0.62);
    --text:          #f1f8ff;
    --text-2:        #9ab0cd;
    --text-3:        #60718f;
    --accent:        #08dcff;
    --accent-2:      #1378ff;
    --accent-dim:    rgba(8, 220, 255, 0.13);
    --accent-hover:  #00bff0;
    --accent-glow:   rgba(8, 220, 255, 0.34);
    --purple:        #194cff;
    --purple-dim:    rgba(25, 76, 255, 0.12);
    --shadow-glow:   0 0 0 1px rgba(8, 220, 255, 0.18), 0 20px 70px rgba(0, 117, 255, 0.16);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background:
        linear-gradient(135deg, rgba(5, 8, 20, 0.98) 0%, rgba(8, 16, 33, 0.98) 46%, rgba(2, 8, 19, 0.98) 100%),
        repeating-linear-gradient(120deg, rgba(8, 220, 255, 0.025) 0 1px, transparent 1px 22px);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(110deg, transparent 0%, rgba(8, 220, 255, 0.06) 33%, transparent 60%),
        linear-gradient(180deg, rgba(0, 119, 255, 0.08), transparent 42%);
    background-size: 180% 180%, 100% 100%;
    animation: brandDrift 18s ease-in-out infinite alternate;
}

@keyframes brandDrift {
    from { background-position: 0% 0%, 0 0; }
    to { background-position: 100% 100%, 0 0; }
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(7, 16, 31, 0.96), rgba(5, 11, 24, 0.98)),
        linear-gradient(90deg, rgba(8, 220, 255, 0.06), transparent 40%);
    box-shadow: inset -1px 0 0 rgba(8, 220, 255, 0.12), 18px 0 60px rgba(0, 0, 0, 0.18);
}

.brand {
    padding: 7px 8px 3px;
    border-radius: var(--radius);
    background: rgba(8, 220, 255, 0.035);
    border: 1px solid rgba(8, 220, 255, 0.08);
}

.brand-mark.logo-mark {
    position: relative;
    overflow: visible;
    border: 1px solid rgba(86, 225, 255, 0.42);
    background: #020715;
    box-shadow: 0 0 22px rgba(8, 220, 255, 0.34), inset 0 0 14px rgba(8, 220, 255, 0.15);
    isolation: isolate;
}

.brand-mark.logo-mark::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    border: 1px solid rgba(8, 220, 255, 0.16);
    opacity: 0.85;
    animation: logoPulse 2.8s ease-in-out infinite;
    z-index: -1;
}

.brand-mark.logo-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); opacity: 0.45; }
    50% { transform: scale(1.12); opacity: 0.95; }
}

.nav-tab {
    border-radius: 9px;
    transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}

.nav-tab:hover {
    transform: translateX(2px);
    background: rgba(8, 220, 255, 0.07);
}

.nav-tab.active {
    color: #d9fbff;
    background: linear-gradient(135deg, rgba(8, 220, 255, 0.17), rgba(19, 120, 255, 0.10));
    border-color: rgba(8, 220, 255, 0.28);
    box-shadow: inset 0 0 0 1px rgba(8, 220, 255, 0.06), 0 10px 28px rgba(0, 107, 255, 0.08);
}

.main {
    background:
        linear-gradient(135deg, rgba(7, 12, 27, 0.76), rgba(5, 8, 20, 0.82)),
        repeating-linear-gradient(90deg, rgba(8, 220, 255, 0.018) 0 1px, transparent 1px 46px);
}

.topbar {
    align-items: center;
}

.topbar h1 {
    color: #f4fbff;
    text-shadow: 0 0 28px rgba(8, 220, 255, 0.14);
}

.eyebrow {
    color: var(--accent);
}

input, textarea, select {
    background: rgba(7, 14, 29, 0.88);
    border-color: rgba(123, 222, 255, 0.16);
}

input:focus, textarea:focus, select:focus {
    border-color: rgba(8, 220, 255, 0.85);
    box-shadow: 0 0 0 3px rgba(8, 220, 255, 0.12), 0 0 24px rgba(8, 220, 255, 0.10);
}

.primary-button {
    color: #02101d;
    background: linear-gradient(135deg, #18f2ff 0%, #0a8dff 52%, #0b4fff 100%);
    border-color: rgba(101, 233, 255, 0.70);
    box-shadow: 0 12px 28px rgba(0, 118, 255, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.primary-button:hover {
    background: linear-gradient(135deg, #5bf7ff 0%, #0ab7ff 45%, #0c67ff 100%);
    box-shadow: 0 16px 36px rgba(0, 161, 255, 0.30);
}

.secondary-button,
.ghost-button {
    background: rgba(13, 28, 51, 0.72);
    border-color: rgba(123, 222, 255, 0.18);
}

.secondary-button:hover,
.ghost-button:hover {
    background: rgba(8, 220, 255, 0.09);
    border-color: rgba(8, 220, 255, 0.34);
}

.metric,
.panel,
.modal-card,
.login-panel {
    background:
        linear-gradient(145deg, rgba(15, 28, 52, 0.90), rgba(9, 16, 32, 0.88)),
        linear-gradient(180deg, rgba(8, 220, 255, 0.035), transparent);
    border-color: rgba(123, 222, 255, 0.14);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(14px);
}

.metric {
    min-height: 132px;
}

.metric::after {
    opacity: 0.65;
    height: 3px;
    background: linear-gradient(90deg, #08dcff, #1378ff, #08dcff);
    background-size: 200% 100%;
    animation: lineSweep 4.5s linear infinite;
}

.metric:hover,
.panel:hover {
    border-color: rgba(8, 220, 255, 0.30);
    box-shadow: var(--shadow-glow), 0 24px 60px rgba(0, 0, 0, 0.26);
}

.metric strong {
    color: #ffffff;
    text-shadow: 0 0 22px rgba(8, 220, 255, 0.18);
}

@keyframes lineSweep {
    from { background-position: 0% 0; }
    to { background-position: 200% 0; }
}

.table-wrap {
    border-radius: var(--radius);
}

th {
    color: #6d86ac;
}

tr {
    transition: background 0.16s;
}

tbody tr:hover {
    background: rgba(8, 220, 255, 0.035);
}

.key {
    border-color: rgba(8, 220, 255, 0.20);
    background: rgba(8, 220, 255, 0.10);
    color: #9df4ff;
}

.modal {
    background: rgba(1, 6, 15, 0.76);
}

.modal-card {
    border-color: rgba(8, 220, 255, 0.22);
}

.server-summary article,
.server-card,
.block-panel {
    background: linear-gradient(145deg, rgba(14, 26, 48, 0.92), rgba(8, 15, 30, 0.88));
    border-color: rgba(123, 222, 255, 0.13);
}

.server-summary article:hover,
.server-card:hover,
.block-panel:hover {
    border-color: rgba(8, 220, 255, 0.30);
    box-shadow: 0 16px 34px rgba(0, 116, 255, 0.12);
}

.server-card::before {
    height: 3px;
    background: linear-gradient(90deg, var(--red), rgba(248, 113, 113, 0.25));
}

.server-card.online::before {
    background: linear-gradient(90deg, var(--green), var(--accent));
}

.server-card-gridline,
.server-card-mods,
.block-item {
    background: rgba(2, 8, 18, 0.36);
    border-color: rgba(123, 222, 255, 0.12);
}

.icon-button {
    background: linear-gradient(135deg, rgba(8, 220, 255, 0.14), rgba(19, 120, 255, 0.10));
    border-color: rgba(8, 220, 255, 0.24);
    color: #81f4ff;
}

.icon-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(8, 220, 255, 0.14);
}

.login-body {
    background:
        linear-gradient(145deg, rgba(4, 8, 18, 0.98), rgba(3, 11, 24, 0.98)),
        repeating-linear-gradient(120deg, rgba(8, 220, 255, 0.03) 0 1px, transparent 1px 24px);
}

.login-panel::before {
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transform: none;
    background: linear-gradient(90deg, #08dcff, #1378ff, #08dcff);
    background-size: 200% 100%;
    animation: lineSweep 4.5s linear infinite;
}

.login-panel .brand-mark.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    margin: 0 auto 8px;
}

.login-panel h1,
.login-panel .muted {
    text-align: center;
}

@media (max-width: 600px) {
    .brand {
        width: 100%;
    }

    .topbar {
        align-items: stretch;
    }

    .login-panel .brand-mark.login-logo {
        width: 62px;
        height: 62px;
    }
}

/* CSP-safe page-specific fixes */
.metric {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 112px;
    padding: 16px 18px;
}

.metric-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 26px;
    height: 26px;
    color: var(--accent);
    opacity: 0.72;
    filter: drop-shadow(0 0 10px rgba(8, 220, 255, 0.28));
}

.metric:hover .metric-icon {
    opacity: 1;
}

.metric span {
    margin-top: 38px;
}

.metric strong {
    font-size: 28px;
    margin-top: 8px;
}

#logout-button,
#refresh-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

#logout-button {
    font-size: 13px;
    color: var(--text-3);
    border-color: var(--border);
}

#logout-button:hover {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.30);
    background: var(--red-dim);
}

#tab-api .panel + .panel {
    margin-top: 0;
}

#tab-home .panel-head h2 {
    font-size: 14px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 4px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    font-size: 10.5px;
    color: var(--text-3);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    padding-right: 44px;
}

.pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-3);
    display: grid;
    place-items: center;
    transition: color 0.15s, background 0.15s;
}

.pw-toggle:hover {
    color: var(--accent);
    background: rgba(8, 220, 255, 0.08);
}

.pw-toggle svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.form-message.success {
    color: var(--green);
}

.form-message:not(:empty) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 11.5px;
    color: var(--text-3);
}

.login-panel {
    width: 100%;
    padding: 32px 34px 34px;
}

.login-panel .brand-mark.login-logo {
    box-shadow: 0 0 0 1px rgba(8, 220, 255, 0.28), 0 14px 34px rgba(0, 132, 255, 0.20);
}

.login-panel .brand-mark.login-logo img {
    object-fit: cover;
}

@media (max-width: 700px) {
    .metric {
        min-height: 104px;
    }

    .metric-icon {
        width: 22px;
        height: 22px;
    }
}
