/* portal.css — /portal and /admin. Same ground as the public site: black, Roboto, orange. */

@font-face {
  font-family: "Roboto";
  src: url("../fonts/roboto-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ground: #000;
  --panel: #121212;
  --panel-2: #1b1b1b;
  --line: #2c2c2c;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --accent: #FC7E00;
  --ok: #3fb950;
  --warn: #e3b341;
  --bad: #f85149;
  --info: #58a6ff;
  --radius: 8px;
  --font-body: "Roboto", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font: 300 16px/1.6 var(--font-body);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-weight: 400; line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: 28px; font-weight: 300; }
h2 { font-size: 20px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.cd-icon { vertical-align: -3px; flex: none; }

/* ── Top bar ─────────────────────────────────────────────────── */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; font-weight: 300; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 500; }
.brand img { border-radius: 50%; }
.area {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius); }
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.signout { margin: 0; }
.signout button {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font: inherit; font-size: 14px; padding: 5px 10px; cursor: pointer;
}
.signout button:hover { color: var(--text); border-color: var(--muted); }

/* ── Main ────────────────────────────────────────────────────── */
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 16px 48px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.narrow { max-width: 460px; margin-inline: auto; }

/* ── Forms ───────────────────────────────────────────────────── */
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=url], select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin: 0 0 14px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--accent); color: #111;
  border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 500; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn--ghost { background: none; color: var(--text); border: 1px solid var(--line); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ── Badges, flash, empty ────────────────────────────────────── */
.cd-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; border: 1px solid currentColor;
}
.cd-badge--ok { color: var(--ok); }
.cd-badge--warn { color: var(--warn); }
.cd-badge--bad { color: var(--bad); }
.cd-badge--info { color: var(--info); }
.cd-badge--muted { color: var(--muted); }
.cd-flash {
  padding: 12px 16px; margin: 0 0 20px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
}
.cd-flash--success { border-color: var(--ok); }
.cd-flash--error { border-color: var(--bad); }
.cd-flash--info { border-color: var(--info); }
.cd-empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.cd-empty p { margin-top: 10px; }
.notfound { max-width: 560px; margin: 32px auto; text-align: center; }
.notfound .cd-icon { color: var(--muted); }
.notfound .actions { justify-content: center; margin-top: 18px; }

/* ── Sign-in pages ───────────────────────────────────────────── */
.small { font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: -8px 0 14px; }
.form-links { margin: 18px 0 0; font-size: 14px; }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.qr { display: flex; justify-content: center; margin: 0 0 16px; }
.qr svg { max-width: 100%; height: auto; border-radius: var(--radius); }
.secret code { font-size: 16px; letter-spacing: 0.06em; word-break: break-all; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.codes {
  list-style: none; padding: 0; margin: 0 0 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.codes li { background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; text-align: center; }
.codes code { font-size: 16px; letter-spacing: 0.06em; }
input[readonly] { color: var(--muted); }

/* ── Admin pages ─────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.crumb { font-size: 14px; margin: 0 0 6px; }
.btn--small { padding: 5px 12px; font-size: 14px; }
.btn--danger { background: none; color: var(--bad); border: 1px solid var(--bad); }
form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; margin: 0 0 14px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
input[type=file] { margin: 0 0 14px; color: var(--muted); font: inherit; font-size: 14px; }
.errors { margin: 0; padding-left: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0 0 16px; }
.filters select, .filters input { width: auto; margin: 0; padding: 7px 10px; font-size: 14px; }
.filters input[type=search] { min-width: 200px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; font-size: 14px; }
.tabs a { color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: #111; background: var(--accent); border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); }
a.stat:hover { border-color: var(--muted); text-decoration: none; }
.stat .num { display: block; font-size: 30px; font-weight: 300; line-height: 1.2; }
.stat .lbl { color: var(--muted); font-size: 14px; }
.stat--warn .num { color: var(--warn); }
.stat--bad .num { color: var(--bad); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; }
.list li:last-child { border-bottom: 0; }
.meta { color: var(--muted); font-size: 13px; }
.num-cell { text-align: right; white-space: nowrap; }
td.nowrap, th.nowrap { white-space: nowrap; }
tr.is-inactive td { color: var(--muted); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.thread { list-style: none; padding: 0; margin: 0 0 20px; }
.thread li { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--ground); }
.thread li.internal { border-style: dashed; border-color: var(--warn); }
.thread .who { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 6px; }
.chip button:hover { color: var(--bad); }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
input.date-inline { width: auto; margin: 0; padding: 5px 8px; font-size: 14px; }
.side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ── Footer ──────────────────────────────────────────────────── */
.foot {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

@media (max-width: 600px) {
  .nav { margin-left: 0; width: 100%; }
  h1 { font-size: 24px; }
}
@media (max-width: 800px) {
  .grid-2, .grid-3, .cols, .side { grid-template-columns: minmax(0, 1fr); }
}
