:root {
  --bg: #080b10;
  --bg-2: #0d1219;
  --panel: #10161f;
  --panel-2: #151d28;
  --line: #223041;
  --line-soft: #1a2532;
  --text: #e7eef7;
  --muted: #8ea0b5;
  --faint: #5f7288;
  --accent: #6ee7b7;
  --accent-2: #60a5fa;
  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(96, 165, 250, .10), transparent 60%),
              radial-gradient(900px 600px at 10% 110%, rgba(110, 231, 183, .07), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 620; }
p { margin: 0; }
code, pre, textarea, input, select { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #0a1017; border: 1px solid var(--line-soft); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
pre { background: #070b11; border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px; overflow: auto; font-size: 12px; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(16, 22, 31, .9), rgba(8, 11, 16, .9));
  display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061019; font-weight: 800; font-size: 13px;
  box-shadow: 0 8px 24px rgba(110, 231, 183, .18);
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--faint); font-size: 11px; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  color: var(--muted); padding: 9px 11px; border-radius: 8px;
  font-weight: 520; border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .03); text-decoration: none; }
.nav-link.active { color: var(--text); background: rgba(110, 231, 183, .08); border-color: rgba(110, 231, 183, .14); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-top: 1px solid var(--line-soft); padding-top: 16px; }

.main { padding: 28px 34px 60px; max-width: 1440px; width: 100%; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.topbar-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.eyebrow { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .16em; font-weight: 700; margin-bottom: 5px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 410px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.card { background: linear-gradient(180deg, rgba(21, 29, 40, .75), rgba(16, 22, 31, .92)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.02) inset; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-pad-0 { padding: 0; overflow: hidden; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.stat .label { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 650;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-healthy, .badge-running { color: var(--ok); background: rgba(52, 211, 153, .09); border-color: rgba(52, 211, 153, .2); }
.badge-idle, .badge-unknown, .badge-stopped { color: var(--muted); background: rgba(142, 160, 181, .08); border-color: rgba(142, 160, 181, .16); }
.badge-challenged, .badge-error, .badge-invalid_cookies, .badge-logged_out { color: var(--danger); background: rgba(251, 113, 133, .09); border-color: rgba(251, 113, 133, .2); }
.badge-starting, .badge-checking, .badge-rate_limited { color: var(--warn); background: rgba(251, 191, 36, .09); border-color: rgba(251, 191, 36, .2); }
.badge-platform { color: var(--accent-2); background: rgba(96, 165, 250, .08); border-color: rgba(96, 165, 250, .18); }
.badge-platform::before { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  padding: 8px 13px; font-size: 13px; font-weight: 580; cursor: pointer;
  transition: .15s ease; white-space: nowrap;
}
.btn:hover { border-color: #33465c; background: #1a2431; text-decoration: none; }
.btn-primary { background: linear-gradient(180deg, #7df0c3, #4bd3a0); color: #052016; border-color: transparent; }
.btn-primary:hover { background: linear-gradient(180deg, #8ff7cf, #5be0ad); }
.btn-danger { color: #ffd7dd; background: rgba(251, 113, 133, .12); border-color: rgba(251, 113, 133, .25); }
.btn-danger:hover { background: rgba(251, 113, 133, .18); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; background: rgba(7, 11, 17, .35); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .015); }
.table-wrap { overflow-x: auto; }

.avatar {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(96, 165, 250, .1); color: var(--accent-2); font-weight: 750; font-size: 13px;
  border: 1px solid rgba(96, 165, 250, .16); flex: 0 0 auto;
}
.identity { display: flex; align-items: center; gap: 10px; }
.identity .name { font-weight: 600; }
.identity .handle { color: var(--muted); font-size: 12px; }

.flash { border-radius: 10px; padding: 10px 13px; margin-bottom: 16px; font-size: 13px; border: 1px solid; }
.flash-ok { color: #bbf7d8; background: rgba(52, 211, 153, .08); border-color: rgba(52, 211, 153, .22); }
.flash-err { color: #fecdd3; background: rgba(251, 113, 133, .08); border-color: rgba(251, 113, 133, .22); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 560; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: #0a1017; color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(110, 231, 183, .5); box-shadow: 0 0 0 3px rgba(110, 231, 183, .08); }
textarea { min-height: 150px; resize: vertical; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field-help { color: var(--faint); font-size: 11px; font-weight: 400; }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); }
.section-title { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-weight: 750; margin: 4px 0 0; }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--faint); }
.kv .v { color: var(--text); overflow-wrap: anywhere; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #0a1017; border: 1px solid var(--line-soft); color: var(--muted); border-radius: 999px; padding: 3px 9px; font-size: 11px; font-family: ui-monospace, monospace; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.event { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.event:last-child { border-bottom: 0; }
.event .dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.event.error .dot, .event.challenged .dot, .event.logged_out .dot { background: var(--danger); }
.event.info .dot, .event.check .dot { background: var(--accent); }
.event .when { color: var(--faint); font-size: 11px; white-space: nowrap; }

.live-frame { width: 100%; height: calc(100vh - 230px); min-height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #000; }
.screenshot { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details summary:hover { color: var(--text); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 12px 16px; overflow-x: auto; }
  .nav { flex-direction: row; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; border: 0; padding: 0; }
  .main { padding: 20px 16px 40px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
