:root {
  --bg0: #0b1014;
  --bg1: #121a21;
  --bg2: #18232d;
  --bg3: #213040;
  --line: rgba(140, 190, 210, 0.14);
  --text: #e7eef3;
  --muted: #8aa0b0;
  --accent: #2ec4b6;
  --accent2: #f0a202;
  --danger: #ef5d60;
  --ok: #3ddc97;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --font: "Syne", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(46, 196, 182, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(240, 162, 2, 0.10), transparent 50%),
    linear-gradient(165deg, #070a0d 0%, var(--bg0) 40%, #0e161c 100%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(10, 14, 18, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.brand {
  padding: 0.4rem 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.brand h1 {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.nav button {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.18s ease;
}
.nav button:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav button.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(46,196,182,0.16), rgba(46,196,182,0.04));
  border-color: rgba(46,196,182,0.28);
}

.side-foot {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.6rem;
  border-top: 1px solid var(--line);
}
.side-foot .mono { font-family: var(--mono); color: var(--accent2); }

.main { padding: 1.4rem 1.6rem 2.5rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.topbar h2 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}
.topbar .sub { color: var(--muted); margin-top: 0.25rem; font-size: 0.9rem; }
.top-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn:hover { border-color: rgba(46,196,182,0.45); }
.btn.primary {
  background: linear-gradient(135deg, #2ec4b6, #1aa89c);
  border-color: transparent;
  color: #05332f;
  font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn.warn {
  background: rgba(240,162,2,0.15);
  border-color: rgba(240,162,2,0.35);
  color: #ffd27a;
}
.btn:disabled { opacity: 0.5; cursor: wait; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.3rem;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.05rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(255,255,255,0.03), transparent 40%),
    var(--bg1);
  box-shadow: var(--shadow);
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(46,196,182,0.18), transparent 70%);
  pointer-events: none;
}
.stat .label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value {
  margin-top: 0.45rem;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-family: var(--mono);
}
.stat .hint { margin-top: 0.25rem; color: var(--muted); font-size: 0.8rem; }

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(18, 26, 33, 0.88);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.panel-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; }
.panel-body { padding: 0.4rem 0; }

.table-wrap { overflow-x: auto; }
table.ops {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.ops th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.ops td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(140,190,210,0.08);
  vertical-align: top;
}
table.ops tr:hover td { background: rgba(46,196,182,0.04); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: rgba(61,220,151,0.35); background: rgba(61,220,151,0.08); }
.pill.warn { color: var(--accent2); border-color: rgba(240,162,2,0.35); background: rgba(240,162,2,0.08); }
.pill.bad { color: var(--danger); border-color: rgba(239,93,96,0.35); background: rgba(239,93,96,0.08); }

.mono { font-family: var(--mono); font-size: 0.82rem; }
.muted { color: var(--muted); }
.soft-list { margin: 0; padding: 0; list-style: none; }
.soft-list li { margin: 0.15rem 0; }

.email-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  min-width: 240px;
}
.email-row input[type="email"],
.email-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  background: var(--bg0);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}
.email-row input:focus {
  outline: none;
  border-color: rgba(46,196,182,0.55);
  box-shadow: 0 0 0 3px rgba(46,196,182,0.12);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--accent); }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.settings-grid .field { margin: 0; }
.settings-grid select {
  width: 100%;
  background: var(--bg0);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}
@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.server-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}
.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-top: 0.45rem;
}
.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  padding: 2rem 1.7rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, rgba(46,196,182,0.08), transparent 40%),
    var(--bg1);
  box-shadow: var(--shadow);
}
.login-card h1 {
  margin: 0.2rem 0 0.2rem;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}
.login-card .eyebrow {
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}
.login-card p { color: var(--muted); }
.field { margin: 0.9rem 0; }
.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  background: var(--bg0);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}
.err {
  color: #ffb4b6;
  background: rgba(239,93,96,0.12);
  border: 1px solid rgba(239,93,96,0.3);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  margin: 0.7rem 0;
  font-size: 0.88rem;
}
.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 50;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  box-shadow: var(--shadow);
  transform: translateY(120%);
  opacity: 0;
  transition: 0.25s ease;
  max-width: min(360px, 90vw);
}
.toast.show { transform: none; opacity: 1; }
.toast.ok { border-color: rgba(61,220,151,0.4); }
.toast.bad { border-color: rgba(239,93,96,0.4); }

.hidden { display: none !important; }
.view { animation: rise 0.35s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .server-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .side {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
}
