:root {
    --bg: #0b0d14;
    --bg-2: #11141e;
    --card: #161a26;
    --card-2: #1c2130;
    --line: #262c3d;
    --text: #e8eaf2;
    --muted: #8a91a8;
    --faint: #5b6178;
    --accent: #ff5fa2;
    --accent-2: #8b5cf6;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #f87171;
    --radius: 14px;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(139, 92, 246, .14), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(255, 95, 162, .10), transparent 60%),
        var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ── */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px;
    background: rgba(11, 13, 20, .72);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand strong {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 10px;
    overflow: hidden;
    flex: none;
}
.brand-mark img {
    width: 100%; height: 100%;
    display: block;
    object-fit: cover;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-right form { margin: 0; }
.who { color: var(--muted); font-size: 14px; }

/* ── Page ── */
.page { max-width: 1100px; margin: 0 auto; padding: 32px 28px 64px; }
.page-center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumb { color: var(--muted); font-size: 14px; margin-bottom: 8px; display: inline-block; }

/* ── Cards ── */
.card {
    background: linear-gradient(180deg, var(--card), var(--bg-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}
.card + .card { margin-top: 18px; }
.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Stats ── */
.stat { padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat-value.accent {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 22px; border-top: 1px solid var(--line); }
th { color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-top: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
td.mono, .mono { font-family: var(--mono); font-size: 13px; }
td .muted, .muted { color: var(--muted); }
.row-link { color: var(--text); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 34px 0; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--green); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .25); }
.badge-amber { color: var(--amber); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .25); }
.badge-red { color: var(--red); background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .25); }
.badge-plain { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line); }
.badge-plain::before { display: none; }

/* ── Forms ── */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 7px; }
.field + .field { margin-top: 14px; }
input[type=text], input[type=password], input[type=date], input[type=number] {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }
.hint { margin-top: 6px; color: var(--faint); font-size: 12.5px; }

.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; margin: 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: 10px;
    font: inherit; font-weight: 600; font-size: 14px;
    border: 1px solid transparent; cursor: pointer;
    color: #fff; white-space: nowrap;
    transition: transform .08s, filter .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 20px -8px rgba(255, 95, 162, .6); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); }
.btn-danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); color: var(--red); }
.btn-ok { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .3); color: var(--green); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.copied { border-color: rgba(52, 211, 153, .4); color: var(--green); }

/* ── Chips (servers, IPs) ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 6px 6px 12px; border-radius: 999px;
    background: var(--card-2); border: 1px solid var(--line);
    font-family: var(--mono); font-size: 13px;
}
.chip form { margin: 0; }
.chip button {
    display: grid; place-items: center;
    width: 22px; height: 22px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, .06); color: var(--muted);
    cursor: pointer; font-size: 14px; line-height: 1;
}
.chip button:hover { background: rgba(248, 113, 113, .2); color: var(--red); }
.chip .tag { font-family: "Inter", sans-serif; font-size: 11px; color: var(--faint); }

/* ── Flash ── */
.flash { padding: 13px 16px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; border: 1px solid; }
.flash-error { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); color: #fecaca; }
.flash-ok { background: rgba(52, 211, 153, .08); border-color: rgba(52, 211, 153, .3); color: #a7f3d0; }

/* ── The key, shown once ── */
.reveal {
    position: relative; overflow: hidden;
    border: 1px solid rgba(255, 95, 162, .35);
    background: linear-gradient(135deg, rgba(255, 95, 162, .08), rgba(139, 92, 246, .08));
    border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px;
}
.reveal h2 { margin: 0 0 4px; font-size: 16px; }
.reveal p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.reveal-key { display: flex; gap: 10px; align-items: center; }
.reveal-key code {
    flex: 1; padding: 12px 14px; border-radius: 10px;
    background: var(--bg); border: 1px solid var(--line);
    font-family: var(--mono); font-size: 14px; word-break: break-all; color: var(--text);
}

/* ── Login ── */
.login { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 26px; font-size: 18px; }
.login .card { padding: 28px; }
.login h1 { margin: 0 0 6px; font-size: 20px; text-align: center; }
.login .sub { text-align: center; margin-bottom: 22px; }

.danger-zone { border-color: rgba(248, 113, 113, .25); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot-ok { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .6); }
.dot-bad { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, .6); }
.dot-none { background: var(--faint); }
