/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
    --bg: #0b0c11;
    --panel: #0e1016;
    --card: #13161e;
    --card-hi: #181c26;
    --line: #272b37;
    --line-hi: #3d4453;
    --text: #e7e9f0;
    --dim: #8891a6;
    --faint: #5b6173;
    --accent: #6c8cff;
    --accent-2: #a46cff;
    --good: #3ecf8e;
    --warn: #f3b44c;
    --bad: #ff5c7a;

    --grad: linear-gradient(100deg, var(--accent), var(--accent-2));
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --sidebar: 260px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-hi); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── shell ──────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: var(--panel);
    border-right: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark {
    width: 30px; height: 30px; border-radius: var(--r-sm);
    background: var(--grad);
    display: grid; place-items: center;
    font-weight: 700; font-size: 15px; color: #fff;
}
.brand-name { font-weight: 600; }
.brand-name span { color: var(--faint); font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    color: var(--dim);
    font-size: 14.5px;
    transition: background .15s var(--ease), color .15s var(--ease);
    position: relative;
}
.nav-item:hover { background: var(--card-hi); color: var(--text); text-decoration: none; }
.nav-item.active { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--text); font-weight: 600; }
.nav-item.active::before {
    content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px;
    width: 3px; border-radius: 2px; background: var(--accent);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }

.nav-label {
    font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--faint); padding: 22px 12px 8px;
}

.sidebar-foot { margin-top: auto; }

.user-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r); padding: 12px;
}
.user-row { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 9px; background: var(--grad);
    display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 14px;
    flex: 0 0 32px;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-mail { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── content ────────────────────────────────────────────────────────────── */
.content { flex: 1; min-width: 0; padding: 30px 34px 44px; }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; padding-bottom: 20px; margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.page-head p { margin: 6px 0 0; color: var(--dim); font-size: 13.5px; }

/* ── cards + grid ───────────────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 18px 20px;
}
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-sub { color: var(--faint); font-size: 12.5px; }

.stat-label { color: var(--dim); font-size: 12.5px; }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 2px; }
.stat-delta { font-size: 12.5px; color: var(--faint); }
.stat-delta.up { color: var(--good); }
.stat-delta.down { color: var(--bad); }

/* ── bars ───────────────────────────────────────────────────────────────── */
.bar { height: 7px; border-radius: 4px; background: var(--card-hi); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--grad); transition: width .5s var(--ease); }
.bar.warn > i { background: linear-gradient(100deg, var(--warn), #ff9a4c); }
.bar.bad > i { background: linear-gradient(100deg, var(--bad), #ff4c9a); }

.limit + .limit { margin-top: 18px; }
.limit-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.limit-head small { color: var(--faint); font-size: 12.5px; }

/* ── chart ──────────────────────────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 14px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar {
    width: 100%; max-width: 30px; border-radius: 4px 4px 0 0;
    background: var(--grad); opacity: .85;
    transition: opacity .15s var(--ease), transform .15s var(--ease);
    min-height: 2px;
}
.chart-col:hover .chart-bar { opacity: 1; transform: scaleY(1.02); transform-origin: bottom; }
.chart-x { font-size: 11px; color: var(--faint); }

/* ── table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left; padding: 12px 16px;
    font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
    color: var(--faint); font-weight: 600;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid rgba(255, 255, 255, .04); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: var(--card-hi); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 500; }
.cell-sub { color: var(--faint); font-size: 12px; }

.empty { padding: 56px 20px; text-align: center; color: var(--faint); }
.empty strong { display: block; color: var(--dim); font-size: 15px; margin-bottom: 4px; }

/* ── badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.badge.good { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.badge.mute { color: var(--faint); background: var(--card-hi); border-color: var(--line); }

/* ── controls ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--card);
    color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background .15s var(--ease), border-color .15s var(--ease), transform .06s var(--ease);
}
.btn:hover { background: var(--card-hi); border-color: var(--line-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 4px 20px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 12%, var(--card)); border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }

.input, select.input, textarea.input {
    width: 100%; height: 40px; padding: 0 13px;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    color: var(--text); font: inherit; font-size: 14px;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
textarea.input { height: auto; padding: 10px 13px; resize: vertical; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--line-hi); }
.input:focus { outline: none; border-color: var(--accent); background: var(--card-hi); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 7px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 6px; }

.search { position: relative; }
.search .input { padding-left: 36px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 340px; }

.chips { display: flex; gap: 7px; }
.chip {
    height: 32px; padding: 0 13px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--card);
    color: var(--dim); font: inherit; font-size: 13px; cursor: pointer;
    transition: all .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip.on { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-weight: 600; }

/* setting rows */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: none; }
.set-row .set-text { min-width: 0; }
.set-row .set-text b { display: block; font-weight: 500; }
.set-row .set-text small { color: var(--faint); font-size: 12.5px; }
.set-row .set-control { flex: 0 0 auto; }

.switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
    position: absolute; inset: 0; border-radius: 999px;
    background: var(--card-hi); border: 1px solid var(--line);
    transition: background .2s var(--ease), border-color .2s var(--ease);
}
.switch i::after {
    content: ""; position: absolute; left: 3px; top: 3px;
    width: 16px; height: 16px; border-radius: 50%; background: var(--faint);
    transition: transform .2s var(--ease), background .2s var(--ease);
}
.switch input:checked + i { background: var(--grad); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ── login ──────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after {
    content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .30; pointer-events: none;
}
.login-wrap::before { width: 460px; height: 460px; background: var(--accent); top: -160px; left: -120px; }
.login-wrap::after { width: 520px; height: 520px; background: var(--accent-2); bottom: -200px; right: -140px; }

.login-card {
    position: relative; z-index: 1; width: 100%; max-width: 400px;
    background: color-mix(in srgb, var(--card) 92%, transparent);
    border: 1px solid var(--line); border-radius: 18px;
    padding: 32px; backdrop-filter: blur(12px);
    box-shadow: 0 24px 70px -20px rgba(0, 0, 0, .8);
}
.login-card .brand { justify-content: center; padding: 0 0 20px; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .card-sub { text-align: center; margin: 6px 0 24px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }
.alert.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }

.muted { color: var(--faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; }
.flex { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

#blazor-error-ui {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    display: none; padding: 12px 20px;
    background: var(--bad); color: #fff; font-size: 14px;
}
