:root {
    --bg: #0b0d12;
    --bg-panel: #14171f;
    --bg-panel-2: #1a1e28;
    --border: #262c3a;
    --border-soft: #1e232e;
    --text: #eef0f4;
    --text-dim: #8b93a6;
    --text-faint: #565f72;

    --neon-pink: #ff5da2;
    --neon-purple: #a970ff;
    --sapphire: #3d6bff;

    --ok: #3ecf8e;
    --danger: #ff4d6a;
    --warn: #ffb020;

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 7px;

    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

@keyframes bodyGlowDrift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(40px, -30px) scale(1.08); } }
@keyframes bodyGlowDrift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-50px, 30px) scale(1.05); } }

body {
    margin: 0;
    font-family: var(--sans);
    background:
        radial-gradient(ellipse 420px 420px at 50% 40%, rgba(169, 112, 255, 0.08), transparent 70%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}
body::before, body::after {
    content: ''; position: fixed; border-radius: 50%; filter: blur(90px);
    pointer-events: none; z-index: 0;
}
body::before {
    width: 640px; height: 640px; top: -160px; left: -120px;
    background: radial-gradient(circle, rgba(255, 93, 162, 0.18), transparent 70%);
    animation: bodyGlowDrift1 14s ease-in-out infinite;
}
body::after {
    width: 560px; height: 560px; bottom: -180px; right: -120px;
    background: radial-gradient(circle, rgba(61, 107, 255, 0.18), transparent 70%);
    animation: bodyGlowDrift2 16s ease-in-out infinite;
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg-panel-2); padding: 2px 6px; border-radius: var(--radius-sm); }

/* ---------- status chips (brutalist accent) ---------- */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid currentColor;
    white-space: nowrap;
}
.status-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
}
.status-chip.alive { color: var(--ok); background: rgba(62, 207, 142, 0.08); }
.status-chip.banned { color: var(--danger); background: rgba(255, 77, 106, 0.08); }
.status-chip.unknown { color: var(--text-faint); background: rgba(86, 95, 114, 0.08); }

.id-tag {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
    border-right: 1px solid var(--border-soft);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--mono); font-weight: 600; font-size: 13px;
    text-transform: uppercase; letter-spacing: .06em; text-decoration: none;
}
.sidebar .brand .mark {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--neon-pink), var(--sapphire));
    display: flex; align-items: center; justify-content: center;
}
.sidebar .brand .mark svg { width: 18px; height: 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-md);
    color: var(--text-dim); text-decoration: none; font-size: 14px;
}
.nav a.active { background: var(--bg-panel-2); color: var(--text); }
.nav a .nav-icon { flex-shrink: 0; opacity: .65; }
.nav a.active .nav-icon { opacity: 1; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--bg-panel-2);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-chip .role { font-size: 11px; color: var(--text-faint); }

.main { padding: 28px 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* reserves the label+trigger footprint before xselect.js builds the wrapper —
   without this the form box grows ~53px once JS runs, pushing everything below it down */
.campaign-picker { display: flex; flex-direction: column; gap: 6px; min-width: 240px; min-height: 69px; }
.campaign-picker .picker-label {
    font-family: var(--mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-faint);
}

/* ---------- custom select (xselect) ---------- */
/* min-height reserves the trigger's footprint before JS runs, so the wrapper never
   collapses to 0px and then jumps to full height once xselect.js builds the trigger
   (that jump was the visible "page load flicker" — CLS 0.30, confirmed via trace). */
.xselect { position: relative; font-size: 14px; min-height: 47px; }
select[data-xselect] { display: none !important; }

.xselect-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: linear-gradient(160deg, rgba(255, 93, 162, 0.14), rgba(61, 107, 255, 0.08)), var(--bg-panel);
    border: 1px solid var(--neon-pink);
    color: var(--text); font-weight: 600; font-size: 15px;
    padding: 12px 16px; border-radius: var(--radius-md);
    box-shadow: 0 0 0 3px rgba(255, 93, 162, 0.08);
    cursor: pointer; user-select: none; min-width: 240px;
}
.xselect-trigger:hover { box-shadow: 0 0 0 4px rgba(255, 93, 162, 0.14); }
.xselect.open .xselect-trigger { box-shadow: 0 0 0 4px rgba(255, 93, 162, 0.22); }
.xselect-trigger .chev { color: var(--neon-pink); font-size: 11px; transition: transform .15s; flex-shrink: 0; }
.xselect.open .xselect-trigger .chev { transform: rotate(180deg); }
.xselect-trigger .placeholder { color: var(--text-dim); font-weight: 500; }

.xselect-panel {
    z-index: 1000;
    background: var(--bg-panel-2); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    max-height: 320px; overflow-y: auto; padding: 6px;
    display: none;
}
.xselect-panel.open { display: block; }

.xselect-search {
    width: 100%; background: var(--bg-panel); border: 1px solid var(--border);
    color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 6px; font-family: var(--sans); box-sizing: border-box;
}

.xselect-option {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.xselect-option:hover { background: var(--bg-panel); }
.xselect-option.selected { color: var(--neon-pink); }
.xselect-option.hidden { display: none; }
.xselect-empty { padding: 14px 10px; color: var(--text-faint); font-size: 13px; text-align: center; }
.xselect-empty.hidden { display: none; }

.xselect-group-label {
    font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-faint);
    padding: 10px 10px 4px; margin-top: 4px; border-top: 1px solid var(--border);
}
.xselect-group-label:first-child { border-top: none; margin-top: 0; }
.xselect-group-label.hidden { display: none; }

.xselect-option .checkbox {
    width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 4px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.xselect-option.selected .checkbox { background: var(--neon-pink); border-color: var(--neon-pink); }
.xselect-option .checkbox svg { display: none; width: 10px; height: 10px; }
.xselect-option.selected .checkbox svg { display: block; }

.xselect-option .radio {
    width: 14px; height: 14px; border: 1.5px solid var(--border); border-radius: 50%;
    flex-shrink: 0; position: relative;
}
.xselect-option.selected .radio { border-color: var(--neon-pink); }
.xselect-option.selected .radio::after {
    content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--neon-pink);
}

.xselect-count {
    background: var(--neon-pink); color: white; font-family: var(--mono); font-size: 11px;
    font-weight: 600; padding: 2px 7px; border-radius: 999px;
}

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.metric-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
}
.metric-card .label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.metric-card .value { font-size: 26px; font-weight: 700; }
.metric-card .value.accent-pink { color: var(--neon-pink); }
.metric-card .value.accent-ok { color: var(--ok); }
.metric-card .value.accent-danger { color: var(--danger); }

/* ---------- panel + table ---------- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}
.panel-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; gap: 12px;
}
.panel-head h2 { font-size: 15px; margin: 0; }
.panel-body { padding: 20px; }

select, input[type=text], input[type=password], input[type=number] {
    background: var(--bg-panel-2); border: 1px solid var(--border);
    color: var(--text); padding: 9px 14px; border-radius: var(--radius-md); font-size: 14px;
    font-family: var(--sans);
}

table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: 10px 20px; font-size: 11px; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-faint); font-weight: 500; border-bottom: 1px solid var(--border-soft);
}
td { padding: 14px 20px; font-size: 14px; border-bottom: 1px solid var(--border-soft); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.015); }

.domain-name { font-weight: 500; }
.empty-state { padding: 32px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* ---------- buttons ---------- */
button {
    font-family: var(--sans); font-size: 13px; padding: 8px 16px;
    border-radius: var(--radius-md); border: none; cursor: pointer;
}
.btn-primary { background: var(--neon-pink); color: white; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-row { display: flex; gap: 8px; }

.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row input { flex: 1; min-width: 140px; }

/* ---------- login (terminal style) ---------- */
@keyframes lgBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@keyframes lgCardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.lg-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }

.lg-term {
    border: 1px solid var(--neon-pink); background: var(--bg-panel);
    border-radius: var(--radius-md); width: 420px; max-width: calc(100vw - 40px);
    animation: .45s cubic-bezier(.2,.7,.3,1) lgCardIn;
    overflow: hidden; box-shadow: 0 0 0 3px rgba(255,93,162,0.08), 0 24px 60px rgba(0,0,0,0.5);
}
.lg-term-bar { background: var(--bg-panel-2); border-bottom: 1px solid var(--border-soft); align-items: center; gap: 10px; padding: 12px 16px; display: flex; }
.lg-dot { border-radius: 50%; width: 11px; height: 11px; flex-shrink: 0; }
.lg-dot.red { background: #ff5f56; }
.lg-dot.yellow { background: #ffbd2e; }
.lg-dot.green { background: #27c93f; }
.lg-term-logo { width: 20px; height: 20px; color: var(--neon-pink); flex-shrink: 0; margin-left: 6px; }
.lg-term-ttl { font-family: var(--mono); color: var(--text-faint); letter-spacing: 1px; font-size: 12px; font-weight: 700; }
.lg-term-status { margin-left: auto; display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--ok); text-transform: uppercase; letter-spacing: .06em; }
.lg-term-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.lg-term-body { padding: 26px 24px 28px; }
.lg-prompt { font-family: var(--mono); color: var(--text); margin-bottom: 24px; font-size: 18px; font-weight: 700; }
.lg-prompt .lg-pfx { color: var(--neon-pink); margin-right: 8px; }
.lg-cur { background: var(--neon-pink); vertical-align: -2px; width: 9px; height: 1.05em; margin-left: 4px; animation: 1s step-end infinite lgBlink; display: inline-block; }
.lg-err { color: var(--danger); font-family: var(--mono); background: rgba(255,77,106,0.1); border: 1px solid rgba(255,77,106,0.4); border-radius: var(--radius-sm); margin-bottom: 16px; padding: 10px 12px; font-size: 12.5px; }

.lg-row { align-items: center; gap: 12px; margin-bottom: 14px; display: flex; }
.lg-k { font-family: var(--mono); color: var(--text-faint); flex: 0 0 76px; width: 76px; font-size: 13px; }
.lg-pw-wrap { flex: 1; display: flex; position: relative; }
.lg-in { border: none; border-bottom: 1px solid var(--border); width: 100%; font-family: var(--mono); color: var(--text); background: transparent; outline: none; flex: 1; padding: 8px 2px; font-size: 14px; transition: border-color .15s; }
.lg-in:focus { border-bottom-color: var(--neon-pink); }
.lg-pw-wrap .lg-in { padding-right: 34px; }
.lg-eye { width: 30px; height: 30px; color: var(--text-faint); cursor: pointer; background: transparent; border: none; border-radius: var(--radius-sm); justify-content: center; align-items: center; display: flex; position: absolute; top: 50%; right: 0; transform: translateY(-50%); }
.lg-eye:hover { color: var(--text); }
.lg-eye svg { width: 16px; height: 16px; }

.lg-go { text-align: left; background: var(--neon-pink); color: white; width: 100%; font-family: var(--mono); cursor: pointer; border: none; border-radius: var(--radius-sm); margin-top: 18px; padding: 12px 15px; font-size: 14px; font-weight: 700; transition: filter .15s, transform 80ms; }
.lg-go:hover { filter: brightness(1.1); }
.lg-go:active { transform: translateY(1px); }
.error-text { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* ---------- error page ---------- */
.container { padding: 32px; max-width: 900px; margin: 0 auto; }

/* ---------- dashboard ---------- */
.alert-banner {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255, 77, 106, 0.08); border: 1px solid rgba(255, 77, 106, 0.3);
    border-radius: var(--radius-md); padding: 14px 18px; margin-bottom: 20px;
    font-size: 13px; color: var(--text); text-decoration: none;
}
.alert-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.alert-banner b { color: var(--danger); }
.alert-banner .alert-go { color: var(--text); text-decoration: underline; margin-left: auto; flex-shrink: 0; white-space: nowrap; }

.metrics-compact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

.panel-head-link { font-size: 13px; color: var(--text-dim); text-decoration: none; }
.panel-head-link:hover { color: var(--text); }

.campaign-row-list { display: flex; flex-direction: column; }
.campaign-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: var(--text);
    transition: background .12s;
}
.campaign-row:last-child { border-bottom: none; }
.campaign-row:hover { background: rgba(255, 255, 255, 0.02); }
.campaign-row .cr-name-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.campaign-row .cr-suffix-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.campaign-row .cr-name { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-row .cr-name .cr-id { color: var(--text-faint); font-family: var(--mono); font-size: 12px; font-weight: 400; margin-left: 6px; }
.campaign-row .cr-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 46px; }
.campaign-row .cr-stat .n { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.campaign-row .cr-stat .n.ok { color: var(--ok); }
.campaign-row .cr-stat .n.danger { color: var(--danger); }
.campaign-row .cr-stat .l { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }


/* ---------- users list + modal ---------- */
.users-list { display: flex; flex-direction: column; }
.user-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.user-row:last-child { border-bottom: none; }
.user-row .ur-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--bg-panel-2);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-row .ur-name { font-weight: 500; font-size: 14px; }
.user-row .ur-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.icon-btn {
    width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: transparent; color: var(--text-dim); display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; font-size: 14px;
}
.icon-btn:hover { border-color: var(--neon-pink); color: var(--neon-pink); }

.btn-primary-sm { font-size: 13px; padding: 8px 14px; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(5, 6, 10, 0.65);
    display: none; align-items: center; justify-content: center; z-index: 2000;
    backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-panel); border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg); width: 440px; max-width: calc(100vw - 40px);
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
}
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-close {
    width: 28px; height: 28px; border-radius: var(--radius-sm); border: none; background: transparent;
    color: var(--text-faint); cursor: pointer; font-size: 16px; display:flex; align-items:center; justify-content:center;
}
.modal-close:hover { color: var(--text); background: var(--bg-panel-2); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-body .field-label {
    font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-faint); margin-bottom: 6px; display: block;
}
.modal-body input, .modal-body select { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border-soft); }

.btn-logout {
    width: 100%; display: flex; align-items: center; gap: 8px; justify-content: center;
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
    padding: 9px 14px; border-radius: var(--radius-md); font-size: 13px; font-family: var(--sans); cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: rgba(255, 77, 106, 0.06); }
.btn-logout svg { width: 15px; height: 15px; flex-shrink: 0; }
