:root {
  --bg: #06080d;
  --bg-soft: #0b0f17;
  --panel: #111621;
  --panel-2: #151c2a;
  --line: #222c3d;
  --text: #e9eef8;
  --muted: #97a3ba;
  --red: #ff2d55;
  --red-dim: #ff2d5533;
  --cyan: #22d3ee;
  --cyan-dim: #22d3ee22;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 18px 50px #00000066;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 12% -10%, #ff2d5514, transparent 60%),
    radial-gradient(800px 500px at 95% 0%, #22d3ee12, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--cyan); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.shell { max-width: 1120px; margin: 0 auto; padding: 22px 18px 64px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 0 24px #ff2d5533; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.6px; }
.brand h1 span { color: var(--red); }
.brand small { display: block; color: var(--muted); font-weight: 400; letter-spacing: 0.2px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; margin-bottom: 22px;
  background: linear-gradient(180deg, #10151f, #0b0f17);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky; top: 12px; z-index: 20;
  backdrop-filter: blur(8px);
}

nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
nav.tabs button {
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 8px 14px; cursor: pointer; color: var(--muted); transition: 140ms ease;
}
nav.tabs button:hover { color: var(--text); background: #ffffff08; }
nav.tabs button.active {
  color: #fff; background: var(--red-dim); border-color: #ff2d5555;
  box-shadow: 0 0 18px #ff2d5530;
}

.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: #041014; font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), #6ee7ff);
}

.card {
  background: linear-gradient(180deg, #121826, #0d121b);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 4px; font-size: 17px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.spacer { flex: 1; }

label.field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  background: #0a0e16; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--text); outline: none; min-width: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #22d3ee88; box-shadow: 0 0 0 3px #22d3ee22;
}

button.primary, button.ghost, button.danger, button.soft {
  border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
}
button.primary {
  background: linear-gradient(135deg, #ff2d55, #ff5c3f); color: #fff; font-weight: 600;
  box-shadow: 0 10px 30px #ff2d5540;
}
button.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 34px #ff2d5555; }
button.ghost { background: #ffffff08; border-color: var(--line); color: var(--text); }
button.ghost:hover { border-color: #22d3ee66; color: #bff7ff; }
button.soft { background: var(--cyan-dim); color: #a5f3fc; border-color: #22d3ee44; }
button.danger { background: var(--red-dim); color: #ff9db0; border-color: #ff2d5555; }
button.danger:hover { background: #ff2d5533; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted);
}
.pill.ok { color: #a7f3d0; border-color: #34d39955; background: #34d39914; }
.pill.warn { color: #fde68a; border-color: #fbbf2455; background: #fbbf2412; }
.pill.bad { color: #fecdd3; border-color: #ff2d5555; background: #ff2d5514; }
.pill.cyan { color: #a5f3fc; border-color: #22d3ee55; background: #22d3ee14; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #1a2231; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 13px; }
td .addr { color: #dffbff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }

.stack { display: grid; gap: 8px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #101827; border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: 200ms ease; z-index: 60; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: #ff2d5566; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); animation: rise 420ms ease both; }
.auth-card .brand { margin-bottom: 18px; }
.auth-card h2 { font-size: 19px; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.banner {
  border: 1px solid #fbbf2444; background: #fbbf2410; color: #fde68a;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px;
}

.stat { background: #0b1018; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 24px; letter-spacing: 0.5px; }
.stat span { color: var(--muted); font-size: 12px; }
.bar { height: 8px; border-radius: 999px; background: #182031; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), #38bdf8); }
.bar.warn > i { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.bar.crit > i { background: linear-gradient(90deg, #ff2d55, #ff7a3d); }

.guide { counter-reset: step; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.guide li { position: relative; padding-left: 36px; color: #cdd6e6; font-size: 14px; }
.guide li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; color: #041014; font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), #67e8f9);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px;
  border-radius: 999px; background: #131a27; border: 1px solid var(--line); font-size: 13px;
}
.chip button { background: none; border: none; color: #ff9db0; cursor: pointer; padding: 0; }

dialog {
  background: #0f141e; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; max-width: 520px; width: 92vw;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: #000000aa; backdrop-filter: blur(3px); }
dialog h3 { margin-top: 0; }
.secret {
  font-family: "Cascadia Mono", Consolas, monospace; background: #0a0e16;
  border: 1px dashed #22d3ee66; border-radius: 10px; padding: 12px; word-break: break-all;
  color: #a5f3fc; margin: 10px 0;
}

.log { max-height: 340px; overflow: auto; font-size: 13px; }
.log div { padding: 7px 0; border-bottom: 1px solid #16202e; display: flex; gap: 10px; }
.log time { color: var(--muted); white-space: nowrap; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view { animation: rise 260ms ease both; }

@media (max-width: 760px) {
  header.topbar { flex-direction: column; align-items: flex-start; position: static; }
  nav.tabs { width: 100%; overflow-x: auto; }
  .userbox { width: 100%; justify-content: space-between; }
  table { font-size: 13px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  .shell { padding: 14px 10px 48px; }
}
