/* SPECTR DM — admin console */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0b0e13; --bg2: #0e131b; --panel: #141b26; --panel2: #1a2330;
  --line: #243040; --line2: #2f3d52;
  --txt: #e7edf5; --muted: #8896a8; --dim: #5f6b7c;
  --aqua: #2fe3c6; --aqua-dim: #16a58f; --violet: #8b7bff;
  --amber: #f5b23d; --red: #ff5f6d; --green: #3ddc84;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 12px 40px -12px rgba(0,0,0,.6);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --disp: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 600px at 82% -8%, rgba(47,227,198,.06), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(139,123,255,.05), transparent 55%),
    var(--bg);
  color: var(--txt); font-family: var(--body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26303f; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #33415a; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; box-shadow: var(--shadow);
}
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-card .brand .mark { font-size: 26px; }
.login-card h1 { font-family: var(--disp); font-size: 21px; margin: 0; letter-spacing: .5px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 26px; letter-spacing: .3px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0d131c, #0a0e15); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.logo .mark { font-size: 24px; filter: drop-shadow(0 0 10px rgba(47,227,198,.5)); }
.logo b { font-family: var(--disp); font-size: 16px; letter-spacing: .6px; }
.logo small { display: block; color: var(--aqua); font-size: 10px; letter-spacing: 2.5px; font-family: var(--mono); text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav .group { color: var(--dim); font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  font-family: var(--mono); padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 13.5px; position: relative; transition: .15s;
}
.nav a .ico { width: 17px; text-align: center; opacity: .85; font-size: 14px; }
.nav a:hover { background: #131c28; color: var(--txt); }
.nav a.active { background: linear-gradient(90deg, rgba(47,227,198,.14), rgba(47,227,198,.02)); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--aqua); box-shadow: 0 0 12px var(--aqua); }
.nav a .badge { margin-left: auto; background: #26303f; color: var(--muted); font-family: var(--mono);
  font-size: 10.5px; padding: 1px 7px; border-radius: 20px; }
.nav a .badge.hot { background: rgba(255,95,109,.16); color: var(--red); }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.side-foot .who { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.side-foot .who .av { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--aqua-dim), var(--violet)); color: #071018; font-weight: 700;
  font-family: var(--disp); }
.side-foot .who small { color: var(--dim); font-size: 11px; }

/* ---------- main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(11,14,19,.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-family: var(--disp); font-size: 18px; margin: 0; letter-spacing: .3px; }
.topbar .crumb { color: var(--dim); font-size: 12px; font-family: var(--mono); }

/* server status rail — the signature element */
.statusrail { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.statusrail .metric { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.statusrail .metric b { font-family: var(--mono); font-size: 14px; }
.statusrail .metric span { color: var(--dim); font-size: 9.5px; letter-spacing: 1.5px; text-transform: uppercase; }
.statuspill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 30px;
  font-weight: 600; font-size: 12.5px; font-family: var(--mono); border: 1px solid transparent;
}
.statuspill.up { background: rgba(61,220,132,.1); color: var(--green); border-color: rgba(61,220,132,.25); }
.statuspill.down { background: rgba(255,95,109,.1); color: var(--red); border-color: rgba(255,95,109,.25); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.statuspill.up .dot { box-shadow: 0 0 0 0 rgba(61,220,132,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,.5); } 70% { box-shadow: 0 0 0 7px rgba(61,220,132,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); } }

.content { padding: 26px; flex: 1; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- cards / stat tiles ---------- */
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 20px; }
.tile {
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.tile .k { color: var(--muted); font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; font-family: var(--mono); }
.tile .v { font-family: var(--disp); font-size: 27px; font-weight: 600; margin-top: 8px; }
.tile .ic { position: absolute; right: 14px; top: 14px; font-size: 18px; opacity: .5; }
.tile.accent { border-color: rgba(47,227,198,.3); }
.tile.accent .v { color: var(--aqua); }

.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.card .card-h { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card .card-h h3 { font-family: var(--disp); font-size: 15px; margin: 0; letter-spacing: .3px; }
.card .card-h .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card .card-b { padding: 4px 0; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 340px; }
.search input { width: 100%; padding-left: 34px; }
.search::before { content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dim); font-size: 15px; }

/* ---------- inputs ---------- */
input, select, textarea {
  background: #0c1119; border: 1px solid var(--line); color: var(--txt); border-radius: var(--radius-sm);
  padding: 9px 12px; font-family: var(--body); font-size: 13.5px; outline: none; transition: .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--aqua-dim); box-shadow: 0 0 0 3px rgba(47,227,198,.12); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 5px; letter-spacing: .3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); font-weight: 600; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #3d4d66; background: #1e2836; }
.btn.primary { background: var(--aqua); color: #06120f; border-color: var(--aqua); }
.btn.primary:hover { background: #46ecd2; }
.btn.danger { background: rgba(255,95,109,.12); color: var(--red); border-color: rgba(255,95,109,.3); }
.btn.danger:hover { background: rgba(255,95,109,.2); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--txt); border-color: var(--line2); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 10.5px; letter-spacing: 1.2px;
  text-transform: uppercase; font-family: var(--mono); padding: 11px 18px; border-bottom: 1px solid var(--line); }
td { padding: 12px 18px; border-bottom: 1px solid rgba(36,48,64,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #131c28; }
td.mono, .mono { font-family: var(--mono); }
td .id { color: var(--dim); font-family: var(--mono); font-size: 12px; }
.money { color: var(--green); font-family: var(--mono); }
.empty { text-align: center; color: var(--dim); padding: 40px; }
.empty .big { font-size: 30px; opacity: .5; margin-bottom: 8px; }

/* ---------- chips / tags ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; font-family: var(--mono); }
.chip.grey { background: #232f3f; color: var(--muted); }
.chip.aqua { background: rgba(47,227,198,.14); color: var(--aqua); }
.chip.violet { background: rgba(139,123,255,.16); color: var(--violet); }
.chip.amber { background: rgba(245,178,61,.16); color: var(--amber); }
.chip.red { background: rgba(255,95,109,.16); color: var(--red); }
.chip.green { background: rgba(61,220,132,.16); color: var(--green); }

/* ---------- pagination ---------- */
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 14px 18px; color: var(--muted); font-size: 12.5px; }
.pager .mono { color: var(--txt); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(6,9,14,.7); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 24px; animation: fade .2s; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-h h3 { font-family: var(--disp); margin: 0; font-size: 17px; }
.modal-h .x { margin-left: auto; background: none; border: none; color: var(--dim); font-size: 22px; line-height: 1; }
.modal-h .x:hover { color: var(--txt); }
.modal-b { padding: 22px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

/* detail rows */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

/* ---------- console ---------- */
.console { background: #05080c; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; height: 62vh; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.console .ln { color: #b9c6d6; }
.console .ln.err { color: var(--red); }
.console .ln.warn { color: var(--amber); }
.console .ln.ok { color: var(--green); }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--aqua);
  padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 240px; max-width: 360px;
  font-size: 13px; animation: slidein .25s; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--aqua);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.hide { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.gap { gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 236px; height: 100vh; transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .content { padding: 18px; }
  .statusrail .metric { display: none; }
  .burger { display: inline-flex !important; }
}
.burger { display: none; background: none; border: 1px solid var(--line); color: var(--txt); width: 38px; height: 38px; border-radius: 8px; align-items: center; justify-content: center; font-size: 18px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
