:root {
  --background: #0d0d12;
  --panel: #16161d;
  --panel-light: #1c1c24;
  --line: rgba(255, 255, 255, .09);
  --text: #f5f4f8;
  --muted: #92909d;
  --violet: #8068ff;
  --lime: #d9ff6f;
  --green: #67dd8c;
  --blue: #66a7ff;
  --danger: #ff7676;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 68% 12%, rgba(128, 104, 255, .11), transparent 34rem),
    var(--background);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.noise {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: .025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -.04em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #111117;
  background: var(--lime);
  font-size: 14px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--violet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 620px) 1fr;
}

.login-card {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 5vw, 76px);
  border-right: 1px solid var(--line);
  background: rgba(13, 13, 18, .94);
}

.login-copy { margin: auto 0 42px; }
.login-copy h1 {
  margin: 0;
  font-size: clamp(44px, 5vw, 69px);
  line-height: .98;
  letter-spacing: -.065em;
}
.login-copy p:last-child {
  max-width: 470px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

#login-form label {
  display: block;
  margin-bottom: 9px;
  color: #c4c1cc;
  font-size: 12px;
  font-weight: 650;
}

.password-field { position: relative; }
.password-field input {
  width: 100%;
  height: 56px;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 72px 0 17px;
  color: var(--text);
  background: var(--panel);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.password-field input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(128,104,255,.12);
}
.password-field button {
  position: absolute;
  right: 8px;
  top: 8px;
  height: 40px;
  border: 0;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.primary-button {
  width: 100%;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 0 20px;
  color: #111117;
  background: var(--lime);
  cursor: pointer;
  font-weight: 760;
}
.primary-button:disabled { opacity: .6; cursor: wait; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }
.security-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 28px 0 0;
  color: #696773;
  font-size: 11px;
}
.security-note i, .server-mini > i, .status-pill i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px rgba(103,221,140,.12);
}

.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(128,104,255,.16), transparent 21rem),
    linear-gradient(145deg, #111118, #0a0a0e);
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .23;
  background-image: radial-gradient(rgba(255,255,255,.34) 1px, transparent 1px);
  background-size: 25px 25px;
  mask-image: radial-gradient(circle, black, transparent 70%);
}
.orbit {
  position: absolute;
  left: 50%; top: 50%;
  border: 1px solid rgba(128,104,255,.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.orbit-one { width: 360px; height: 360px; }
.orbit-two { width: 610px; height: 610px; border-style: dashed; opacity: .55; }
.core {
  position: absolute;
  left: 50%; top: 50%;
  width: 120px; height: 120px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 34px;
  background: linear-gradient(145deg, #242332, #15151c);
  box-shadow: 0 30px 70px rgba(0,0,0,.4), 0 0 80px rgba(128,104,255,.15);
  transform: translate(-50%, -50%) rotate(8deg);
}
.core span { font-size: 30px; font-weight: 800; letter-spacing: -.08em; }
.core i { position: absolute; right: 13px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.signal {
  position: absolute;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: #aaa7b4;
  background: rgba(22,22,29,.78);
  backdrop-filter: blur(12px);
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.signal i { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.signal-one { left: 18%; top: 27%; }
.signal-two { right: 13%; top: 61%; }
.signal-three { left: 21%; bottom: 15%; }

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(13,13,18,.92);
  backdrop-filter: blur(18px);
}
.sidebar nav { display: grid; gap: 5px; margin-top: 55px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  border-radius: 11px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
}
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); background: var(--panel-light); }
.nav-icon { width: 18px; color: var(--violet); font-size: 17px; text-align: center; }
.sidebar-bottom { margin-top: auto; }
.server-mini { display: flex; align-items: center; gap: 11px; padding: 15px 10px; border-top: 1px solid var(--line); }
.server-mini div { display: grid; gap: 3px; }
.server-mini strong { font-size: 11px; }
.server-mini span { color: var(--muted); font-size: 9px; }
.logout-button {
  width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); background: transparent; cursor: pointer; font-size: 11px;
}
.logout-button:hover { color: var(--text); border-color: rgba(255,255,255,.18); }

.dashboard-main { min-width: 0; padding: 45px clamp(24px, 4vw, 60px) 70px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 36px; }
.topbar h1 { margin: 0; font-size: 41px; line-height: 1; letter-spacing: -.055em; }
.topbar h1 span { color: var(--violet); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.last-updated { color: var(--muted); font-size: 10px; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px;
  color: var(--text); background: var(--panel); cursor: pointer; font-size: 18px;
}
.icon-button.loading { animation: spin .7s linear infinite; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.metric-grid article, .panel {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(22,22,29,.78);
}
.metric-grid article { min-height: 151px; padding: 20px; }
.metric-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.metric-heading i { width: 8px; height: 8px; border-radius: 50%; }
.metric-heading .green { background: var(--green); }
.metric-heading .violet { background: var(--violet); }
.metric-heading .lime { background: var(--lime); }
.metric-heading .blue { background: var(--blue); }
.metric-grid strong { display: block; margin: 29px 0 4px; font-size: 38px; letter-spacing: -.06em; }
.metric-grid small { color: #6f6d79; font-size: 9px; }

.content-grid { display: grid; grid-template-columns: .72fr 1.28fr; gap: 13px; margin-top: 13px; }
.panel { padding: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.status-pill, .count-badge {
  display: inline-flex; align-items: center; gap: 8px; min-height: 27px;
  border: 1px solid var(--line); border-radius: 20px; padding: 0 10px;
  color: #b2afbb; background: rgba(255,255,255,.025); font-size: 9px;
}
.health-main { display: flex; align-items: center; gap: 22px; margin: 32px 0 25px; }
.health-ring {
  width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at center, var(--panel) 54%, transparent 56%), conic-gradient(var(--green) 0 91%, #292832 91%);
}
.health-ring span { font-size: 12px; font-weight: 800; }
.health-main > div:last-child { display: grid; gap: 4px; }
.health-main > div:last-child span, .health-main small { color: var(--muted); font-size: 9px; }
.health-main strong { font-size: 22px; letter-spacing: -.04em; }
.counter-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.counter {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 11px; border-radius: 9px; background: rgba(255,255,255,.025);
  color: var(--muted); font-size: 9px;
}
.counter strong { color: var(--text); font-size: 11px; }

.table-wrap { position: relative; min-height: 220px; margin-top: 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { padding: 0 10px 10px; color: #686673; font-size: 8px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .1em; }
td { padding: 14px 10px; border-top: 1px solid var(--line); color: #afacb8; }
td:first-child { color: var(--text); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sync-state { display: inline-flex; align-items: center; gap: 6px; }
.sync-state i { width: 5px; height: 5px; border-radius: 50%; background: #585661; }
.sync-state.active i { background: var(--green); box-shadow: 0 0 0 3px rgba(103,221,140,.1); }
.empty-state {
  min-height: 160px; display: grid; place-items: center; color: #666470;
  font-size: 10px; text-align: center;
}

.clients-panel { margin-top: 13px; }
.client-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 22px; }
.client {
  display: grid; grid-template-columns: 35px 1fr; gap: 11px; align-items: center;
  padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018);
}
.client-avatar {
  width: 35px; height: 35px; display: grid; place-items: center;
  border-radius: 10px; color: var(--lime); background: rgba(217,255,111,.08);
  font-size: 10px; font-weight: 800;
}
.client-info { min-width: 0; display: grid; gap: 4px; }
.client-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.client-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; }
.dashboard-error { min-height: 18px; color: var(--danger); font-size: 11px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .client-list { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .login-view { grid-template-columns: 1fr; }
  .login-card { min-height: 100vh; border-right: 0; }
  .login-visual { display: none; }
  .dashboard { display: block; }
  .sidebar {
    position: static; width: 100%; height: auto; flex-direction: row;
    align-items: center; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .sidebar nav { display: none; }
  .sidebar-bottom { display: flex; align-items: center; margin: 0 0 0 auto; }
  .server-mini { border: 0; }
  .logout-button { width: auto; padding-inline: 14px; }
  .dashboard-main { padding: 32px 14px 55px; }
}

@media (max-width: 540px) {
  .login-card { padding: 26px 18px; }
  .login-copy h1 { font-size: 44px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 34px; }
  .last-updated { display: none; }
  .metric-grid, .client-list { grid-template-columns: 1fr; }
  .metric-grid article { min-height: 135px; }
  .server-mini { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
