:root {
  --bg: #080a0d;
  --panel: #11151a;
  --panel2: #171c23;
  --line: #252c36;
  --text: #eef2f7;
  --muted: #8c96a5;
  --accent: #ff8a2a;
  --accent2: #ffb15c;
  --danger: #ff5c6c;
  --ok: #57d68d;
  --warning: #ffc857;
  --radius: 16px;
  --shadow: 0 22px 70px rgba(0, 0, 0, .45);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 138, 42, .16), transparent 65%),
    radial-gradient(800px 500px at 95% 0%, rgba(75, 115, 255, .10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%);
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(8, 10, 13, .72);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .12em;
  font-weight: 800;
  font-size: 18px;
}
.brand small {
  color: var(--muted);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .22em;
  margin-left: 2px;
}
.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff5a00);
  color: #120b05;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(255, 122, 26, .3);
}

nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
nav a, .linkbtn {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  transition: .15s ease;
}
nav a:hover, .linkbtn:hover { color: var(--text); background: rgba(255,255,255,.05); }
nav a.active { color: var(--text); border-color: var(--line); background: var(--panel); }

.app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  align-items: center;
  padding: 26px 0 18px;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: .98;
  letter-spacing: -.04em;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); max-width: 560px; font-size: 16px; }
.hero-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.hero-card .row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.055); }
.hero-card .row:last-child { border-bottom: 0; }
.hero-card b { color: var(--accent2); font-weight: 700; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 16px 44px rgba(0,0,0,.22);
}
.card h2, .card h3 { margin: 0 0 8px; letter-spacing: -.02em; }
.card p.sub { margin: 0 0 18px; color: var(--muted); }
.card.tight { padding: 16px; }

.stat { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }

form { display: grid; gap: 12px; }
label { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b0e12;
  color: var(--text);
  border-radius: 11px;
  padding: 12px 13px;
  font: inherit;
  outline: none;
  transition: .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(255,138,42,.7); box-shadow: 0 0 0 3px rgba(255,138,42,.12); }
textarea { min-height: 110px; resize: vertical; }
.formrow { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: .15s ease;
  background: linear-gradient(135deg, var(--accent), #ff6a00);
  color: #150b03;
  box-shadow: 0 10px 28px rgba(255,120,20,.2);
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: rgba(255,255,255,.04); color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.danger { background: rgba(255,92,108,.12); color: var(--danger); border-color: rgba(255,92,108,.35); box-shadow: none; }
.btn.small { padding: 7px 10px; font-size: 13px; border-radius: 9px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.03);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: rgba(87,214,141,.3); background: rgba(87,214,141,.08); }
.badge.warn { color: var(--warning); border-color: rgba(255,200,87,.3); background: rgba(255,200,87,.08); }
.badge.bad { color: var(--danger); border-color: rgba(255,92,108,.3); background: rgba(255,92,108,.08); }

.list { display: grid; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.item .meta { color: var(--muted); font-size: 12px; }
.item .title { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { height: 14px; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}
.tabs button.active { color: var(--text); background: rgba(255,255,255,.05); border-color: rgba(255,138,42,.45); }

.keybox {
  border: 1px dashed rgba(255,138,42,.45);
  background: rgba(255,138,42,.06);
  border-radius: 12px;
  padding: 16px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 18px;
  letter-spacing: .08em;
  word-break: break-all;
}
.notice {
  border: 1px solid rgba(255,200,87,.28);
  background: rgba(255,200,87,.06);
  color: #f3dca6;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
}
.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #141a21;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(87,214,141,.35); }
.toast.bad { border-color: rgba(255,92,108,.4); }

.footer { margin-top: 34px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.three { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .formrow { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: 1fr; }
  .topbar { padding: 16px 18px; }
  .brand small { display: none; }
  .app { width: calc(100% - 24px); padding-top: 24px; }
}
