:root {
    --bg: #0b0f14;
    --bg-elevated: #11171f;
    --bg-card: #141b24;
    --bg-hover: #1a222d;
    --border: #1f2937;
    --border-strong: #2b3746;
    --text: #e6edf5;
    --text-muted: #8b9bb0;
    --text-dim: #5d6b7d;
    --accent: #19bd9c;
    --accent-hover: #14a487;
    --accent-soft: rgba(25, 189, 156, 0.12);
    --danger: #f2555a;
    --danger-soft: rgba(242, 85, 90, 0.12);
    --warn: #f2b544;
    --warn-soft: rgba(242, 181, 68, 0.12);
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }

p { margin: 0; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

[hidden] { display: none !important; }

.container {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 15, 20, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    height: 62px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 16px;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #2f8cff);
    display: grid;
    place-items: center;
    font-size: 14px;
    color: #04120e;
    font-weight: 800;
}

.topbar-spacer { flex: 1; }

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-nav a {
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, background-color 0.15s;
}

.topbar-nav a:hover { color: var(--text); background: var(--bg-hover); }
.topbar-nav a.active { color: var(--text); background: var(--bg-card); }

/* ----------------------------------------------------------------- button */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--accent);
    color: #04120e;
    font-weight: 620;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--accent); }

.btn-danger { background: transparent; border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ forms */

.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 15px; }

.label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.input, .select {
    width: 100%;
    padding: 10px 13px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder { color: var(--text-dim); }

.hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* ------------------------------------------------------------------- card */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.card-title {
    font-size: 15px;
    font-weight: 650;
    margin-bottom: 4px;
}

.card-sub { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* ------------------------------------------------------------------ badge */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-active { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--bg-hover); color: var(--text-dim); }

/* ------------------------------------------------------------------ alert */

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert-error { background: var(--danger-soft); border-color: rgba(242, 85, 90, 0.3); color: #ffb3b5; }
.alert-ok { background: var(--accent-soft); border-color: rgba(25, 189, 156, 0.3); color: #7fe8d2; }

/* ------------------------------------------------------------------ table */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text-muted); }

/* ------------------------------------------------------------------ modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 10, 0.72);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 100;
}

.modal {
    width: min(520px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ------------------------------------------------------------------ misc */

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 13px; }
.grow { flex: 1; }

.section { padding: 34px 0; }
.section-head { margin-bottom: 20px; }

.empty {
    padding: 52px 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.7;
}
