/* Admin UI styles. Everything is served from this origin: the Content-Security
   Policy allows no external host, which keeps the panel working air-gapped. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #d8dce3;
  --text: #1b1f24;
  --muted: #5c6570;
  --accent: #1f5fa9;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --ok: #1e6b3a;
  --ok-bg: #e7f4ec;
  --warn-bg: #fff5e0;
  --warn-border: #e0a800;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191d;
    --surface: #1f2429;
    --border: #333a42;
    --text: #e8eaed;
    --muted: #9aa4b0;
    --accent: #6aa3e8;
    --accent-text: #0f1317;
    --danger: #f2857c;
    --danger-bg: #3a1f1d;
    --ok: #7ed39f;
    --ok-bg: #1b3025;
    --warn-bg: #3a3016;
    --warn-border: #c99a20;
  }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

header.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

header.topbar .brand {
  font-weight: 600;
  letter-spacing: 0.01em;
}

header.topbar nav {
  display: flex;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
}

header.topbar nav a {
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text);
}

header.topbar nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

header.topbar .who {
  color: var(--muted);
  font-size: 0.875rem;
}

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.login-card {
  max-width: 26rem;
  margin: 4rem auto;
}

/* Tables scroll inside their own container so the page body never scrolls
   sideways on a narrow screen. */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

td.wrap, th.wrap { white-space: normal; }

label {
  display: block;
  margin: 0.85rem 0 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.85rem 0 0;
  padding: 0.5rem 0.9rem 0.9rem;
}

legend { color: var(--muted); font-size: 0.875rem; padding: 0 0.35rem; }

.checks { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.35rem; }
.checks label { display: flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--text); }
.checks input { width: auto; }

.actions { display: flex; gap: 0.6rem; margin-top: 1.1rem; flex-wrap: wrap; align-items: center; }

button, .button {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.secondary, .button.secondary {
  background: transparent;
  color: var(--accent);
}

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

.inline-form { display: inline; }

.flash {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash.error { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.flash.ok    { background: var(--ok-bg);     border-color: var(--ok);     color: var(--ok); }

/* The one-time secret panel. Deliberately loud: this value is unrecoverable
   once the page is closed. */
.secret {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.secret code {
  display: block;
  padding: 0.5rem 0.6rem;
  margin: 0.35rem 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill.active    { background: var(--ok-bg);     border-color: var(--ok);     color: var(--ok); }
.pill.suspended { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.hint  { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

.pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }

footer.foot {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}
