:root {
  --bg:             #0d1117;
  --bg-secondary:   #090d12;
  --surface:        #161b22;
  --surface-soft:   #1c2330;
  --surface-hover:  #21262d;
  --text:           #e6edf3;
  --muted:          #8b949e;
  --muted-light:    #6e7681;
  --line:           #30363d;
  --line-soft:      #21262d;
  --primary:        #25d366;
  --primary-dark:   #1aad4e;
  --primary-glow:   rgba(37, 211, 102, 0.12);
  --secondary:      #00d4aa;
  --secondary-dark: #009980;
  --danger:         #f85149;
  --danger-bg:      rgba(248, 81, 73, 0.1);
  --warning:        #d29922;
  --ok:             #3fb950;
  --ok-bg:          rgba(63, 185, 80, 0.1);
  --radius:         10px;
  --radius-sm:      6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

.app-shell { min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand img { display: block; height: 30px; width: auto; }

.brand-wordmark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}

.brand-wordmark em {
  font-style: normal;
  color: var(--primary);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.top-nav a,
.top-nav button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  padding: 7px 14px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}

.top-nav a:hover,
.top-nav button:hover { color: var(--text); background: var(--surface-hover); }

.top-nav .btn-cta {
  border-color: var(--primary);
  color: #062012;
  background: var(--primary);
  font-weight: 600;
  margin-left: 6px;
}

.top-nav .btn-cta:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* ── Container ──────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

/* ── Grid ───────────────────────────────────────── */
.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)); }

/* ── Panel / Card ───────────────────────────────── */
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; color: var(--text); }
.panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }

/* ── Typography ─────────────────────────────────── */
.hint { margin: 0; color: var(--muted); font-size: 13px; }

.metric {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0 2px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 10px 0 5px;
}

/* ── Form Controls ──────────────────────────────── */
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder { color: var(--muted-light); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea { min-height: 110px; resize: vertical; }

select option { background: var(--surface); color: var(--text); }

/* ── Row ────────────────────────────────────────── */
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Buttons ────────────────────────────────────── */
button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

button:hover { background: var(--surface-hover); border-color: #484f58; }

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #062012;
  font-weight: 600;
}

button.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

button.danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

button.danger:hover { background: rgba(248, 81, 73, 0.2); }

button.ok {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}

/* ── Flash / Status messages ────────────────────── */
.flash    { font-size: 13px; margin-top: 8px; color: var(--muted); min-height: 18px; }
.loading  { color: var(--secondary) !important; }
.error    { color: var(--danger) !important; }
.success  { color: var(--ok) !important; }
.empty    { color: var(--muted); font-size: 13px; padding: 24px 0; text-align: center; }

/* ── Table ──────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-soft);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

/* ── Status Badges ──────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status.ok    { background: var(--ok-bg);    color: var(--ok);      border-color: rgba(63,185,80,.3); }
.status.warn  { background: rgba(210,153,34,.1); color: var(--warning); border-color: rgba(210,153,34,.3); }
.status.off   { background: var(--danger-bg); color: var(--danger);  border-color: rgba(248,81,73,.3); }

/* ── Legal ──────────────────────────────────────── */
.legal-container { max-width: 820px; }

.legal-panel h1 { margin: 0 0 8px; font-size: 30px; }

.legal-panel h2 {
  margin: 28px 0 8px;
  font-size: 17px;
  color: var(--secondary);
}

.legal-panel p { margin: 0; color: var(--muted); line-height: 1.65; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .topbar { position: static; }
  .top-nav a[href^="/#"]  { display: none; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 16px; }
  .container { padding: 24px 16px 40px; }
}
