:root {
  --bg: #0b1220;
  --panel: #111827;
  --panel-2: #172033;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --max: 1040px;
  --pad: 16px;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #0b1220 0%, #101a2d 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.app-shell { min-height: 100vh; }
.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--pad) 12px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}
.eyebrow { color: #93c5fd; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 4px 0 6px; font-size: 28px; }
.subtle { color: var(--muted); font-size: 13px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.badge-on { color: #bbf7d0; border-color: rgba(34,197,94,.35); background: rgba(22,163,74,.15); }
.badge-warn { color: #fde68a; border-color: rgba(245,158,11,.35); background: rgba(217,119,6,.15); }
.badge-off { color: #fecaca; border-color: rgba(220,38,38,.35); background: rgba(127,29,29,.18); }
.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) 40px;
  display: grid;
  gap: 16px;
}
.panel {
  background: linear-gradient(180deg, rgba(17,24,39,.95) 0%, rgba(17,24,39,.92) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 0;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.status-card {
  margin: 16px 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.status-ok { border-color: rgba(34,197,94,.35); background: rgba(22,163,74,.12); }
.status-warn { border-color: rgba(245,158,11,.35); background: rgba(217,119,6,.12); }
.status-err { border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.14); }
.status-title { font-weight: 700; margin-bottom: 6px; }
.status-message { color: #dbeafe; white-space: pre-wrap; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compact-metrics { padding: 0 18px 18px; }
.metric {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.metric-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.metric-value { font-size: 14px; word-break: break-word; }
#main { padding: 18px; }
.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  padding: 16px;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card h3 { margin: 0 0 12px; font-size: 18px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; margin-bottom: 6px; color: #cbd5e1; }
input[type="text"], textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(15,23,42,.8);
  color: var(--text);
  outline: none;
}
input[readonly] { opacity: .82; }
input:focus, textarea:focus { border-color: rgba(37,99,235,.7); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.helper { color: var(--muted); font-size: 12px; margin-top: 6px; }
.helper.err { color: #fecaca; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .05s ease, opacity .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: white; border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-secondary { background: rgba(255,255,255,.04); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.notice {
  border: 1px dashed rgba(148,163,184,.35);
  border-radius: 14px;
  padding: 12px 14px;
  color: #cbd5e1;
  background: rgba(255,255,255,.02);
}
.notice.ok { border-color: rgba(34,197,94,.35); background: rgba(22,163,74,.08); }
.notice.err { border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.08); }
.terms-box {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(15,23,42,.72);
}
.terms-box h4, .terms-box h5 { margin-top: 0; }
.terms-box p, .terms-box li { color: #e2e8f0; line-height: 1.55; }
.checkline { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; }
.checkline input { margin-top: 3px; }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 10px; }
.kv div { padding: 10px 0; border-bottom: 1px solid rgba(148,163,184,.12); min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.kv .k { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace; }
.hidden { display: none !important; }
@media (max-width: 780px) {
  .topbar { flex-direction: column; }
  .badges { justify-content: flex-start; }
  .grid.two, .row, .kv { grid-template-columns: 1fr; }
}

.compact-kv { grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); }

@media (max-width: 780px) {
  .compact-kv { grid-template-columns: 1fr; }
}
