/* Keel admin console — dense internal-tool styling, no framework.
   13px body / 11px meta, 4px grid, hairline borders (no shadows). */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #1c1c1c;
  --text-2: #6b6b6b;
  --accent: #2456d6;
  --danger: #b3261e;
  --ok: #1a7f37;
  --radius-control: 4px;
  --radius-card: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --surface: #1e1e1e;
    --border: #333333;
    --text: #e6e6e6;
    --text-2: #9a9a9a;
    --accent: #7ba1f5;
    --danger: #f2938c;
    --ok: #6fcf8f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand { font-weight: 600; }

.nav { display: flex; gap: 8px; }
.nav a {
  color: var(--text-2);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-control);
}
.nav a.active { color: var(--text); background: var(--bg); font-weight: 500; }
.nav a:hover { color: var(--text); }

.token-form { margin-left: auto; display: flex; gap: 4px; }
.token-form input { width: 240px; }

main { max-width: 1080px; margin: 0 auto; padding: 16px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
}
h1 { font-size: 16px; font-weight: 600; margin: 0; }
h2 { font-size: 13px; font-weight: 500; margin: 16px 0 4px; }

.status { padding: 4px 16px; margin: 0; color: var(--text-2); }
.status.error { color: var(--danger); }
.hint { color: var(--text-2); font-size: 11px; margin: 4px 0 8px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
th, td {
  text-align: left;
  padding: 0 8px;
  height: 32px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tr:last-child > td { border-bottom: none; }
th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}
td.wrap { white-space: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}
.meta { color: var(--text-2); font-size: 11px; }

.detail-row > td {
  height: auto;
  padding: 8px;
  background: var(--bg);
  white-space: normal;
}

button, input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  height: 24px;
  padding: 0 8px;
}
button { cursor: pointer; }
button:hover { border-color: var(--text-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }
input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.row-form { display: flex; gap: 4px; margin: 8px 0; }
.row-form input { width: 280px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
}
.badge.active { color: var(--ok); border-color: var(--ok); }
.badge.suspended { color: var(--danger); border-color: var(--danger); }

.actions { display: flex; gap: 4px; }

.usage-controls { display: flex; gap: 4px; align-items: center; margin: 4px 0; }
.usage-controls .on { background: var(--bg); font-weight: 500; }

.detail-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 8px;
  margin: 4px 0;
}
.detail-row-card p { margin: 0; }

.invite-link {
  display: block;
  margin-top: 4px;
  word-break: break-all;
  white-space: normal;
}

.empty { color: var(--text-2); padding: 16px; }


/* Login-first gate */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* display:flex above would otherwise beat the UA's [hidden] rule, leaving
   the gate covering the app after a successful sign-in. */
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 340px;
  border: 1px solid #d9ded9;
  border-radius: 10px;
  padding: 26px 24px;
  background: #fff;
}
.gate-card h1 { margin: 0 0 4px; font-size: 20px; }
.gate-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.gate-card input { padding: 9px 10px; }
#who { margin-left: auto; margin-right: 10px; }
