:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --border: #2a323c;
  --text: #e6e9ee;
  --muted: #9aa4b2;
  --accent: #4f9cf9;
  --danger: #ff5d5d;
  --danger-bg: #3a1414;
  --safe: #2ea36b;
  --safe-bg: #10261c;
  --warn: #f5a623;
  --code-bg: #0b0e12;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 28px;
}
.login-card h1 { margin: 12px 0 4px; font-size: 22px; }
.badge {
  display: inline-block; background: var(--warn); color: #1b1b1b;
  font-weight: 700; font-size: 11px; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 6px;
}

/* Layout */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { font-weight: 600; display: flex; gap: 10px; align-items: center; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.panel h3 { margin: 16px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.target-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; font-size: 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.target-label { color: var(--muted); }
.target-url { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.tenant { color: var(--muted); margin-left: auto; }
.switch { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; }
.switch-opt { border: none; background: none; color: var(--muted); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; }
.switch-opt.active { background: var(--accent); color: #08121f; font-weight: 700; }
.switch-opt.active[data-target="production"] { background: var(--danger); color: #fff; }
.switch-opt:disabled { opacity: .4; cursor: not-allowed; }
.prod-warning { padding: 10px 20px; font-size: 14px; background: var(--danger-bg);
  color: #ffd5d5; border-bottom: 1px solid #6a1f1f; }

/* Form */
label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%; padding: 9px 10px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coord-actions { display: flex; gap: 8px; margin-top: 4px; }

button {
  cursor: pointer; font: inherit; border-radius: 8px; border: 1px solid var(--border);
  padding: 10px 14px; background: var(--panel-2); color: var(--text);
}
button.primary { width: 100%; margin-top: 16px; background: var(--accent); border-color: var(--accent); color: #08121f; font-weight: 700; }
button.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.ghost { flex: 1; font-size: 13px; padding: 7px; }
button.linkbtn { background: none; border: none; color: var(--muted); padding: 4px; }

.loc-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.distance { margin-top: 12px; font-size: 14px; min-height: 20px; }
.distance .inside { color: var(--safe); font-weight: 600; }
.distance .outside { color: var(--danger); font-weight: 600; }

.alert { padding: 8px 10px; border-radius: 8px; margin: 10px 0; font-size: 14px; }
.alert.error { background: var(--danger-bg); color: #ffd5d5; border: 1px solid #6a1f1f; }

.verdict { padding: 12px; border-radius: 8px; font-weight: 600; }
.verdict.empty { background: var(--panel-2); color: var(--muted); font-weight: 400; }
.verdict.accepted { background: var(--danger-bg); color: #ffd5d5; border: 1px solid #6a1f1f; }
.verdict.rejected { background: var(--safe-bg); color: #c7f0da; border: 1px solid #1f5a3f; }

.code {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 320px;
}
