/* styles.css — connector-admin UI.
 *
 * Visual system ported from the internal Heroku deployments dashboard
 * (docs/DESIGN.md): papery cool blue-tinted light theme over a faint
 * blueprint grid, Chakra Petch display type for structural labels only,
 * JetBrains Mono for data, blue accent for navigation/selection and an
 * amber gradient for primary actions. Dark theme (same dashboard's dark
 * tokens) via prefers-color-scheme. Fonts are self-hosted latin subsets
 * (CSP forbids external origins). All colors flow through the variables
 * below.
 */

@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./vendor/fonts/chakra-petch-600.woff2") format("woff2");
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./vendor/fonts/chakra-petch-700.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("./vendor/fonts/jetbrains-mono-var.woff2") format("woff2");
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Chakra Petch", "Avenir Next Condensed", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f6fa;
  --grid: rgba(31, 111, 235, 0.05);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #d8dee8;
  --border-soft: rgba(15, 23, 42, 0.08);
  --border-strong: #cfd8e3;
  --text: #1f2937;
  --text-strong: #0b1220;
  --text-dim: #475569;
  --text-faint: #64748b;
  --text-fade: #94a3b8;

  --accent: #1f6feb;
  --accent-text: #1f4eb4;
  --accent-strong: #1e40af;
  --accent-soft: rgba(31, 111, 235, 0.08);
  --accent-bd: rgba(31, 111, 235, 0.3);
  --row-hover: #eef3fa;

  --ok: #15803d;
  --ok-bg: rgba(21, 128, 61, 0.08);
  --ok-bd: rgba(21, 128, 61, 0.32);
  --warn: #b45309;
  --warn-bg: rgba(245, 158, 11, 0.13);
  --warn-bd: rgba(217, 119, 6, 0.45);
  --err: #b91c1c;
  --err-bg: rgba(220, 38, 38, 0.06);
  --err-bd: rgba(220, 38, 38, 0.32);
  --info: #1f4eb4;
  --info-bg: rgba(31, 111, 235, 0.08);
  --info-bd: rgba(31, 111, 235, 0.3);
  --neutral: #64748b;
  --neutral-bg: rgba(15, 23, 42, 0.04);
  --neutral-bd: rgba(15, 23, 42, 0.14);

  --stripe: linear-gradient(90deg, #1f6feb, #58a6ff 55%, #f59e0b);
  --thead: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);

  --btn-bg: #ffffff;
  --btn-bd: #cfd8e3;
  --btn-bg-h: #eaf2ff;
  --btn-glow-h: 0 1px 0 rgba(15, 23, 42, 0.04), 0 6px 14px -8px rgba(31, 111, 235, 0.4);
  --btn-primary-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --btn-primary-bg-h: linear-gradient(135deg, #fbbf24, #f59e0b);
  --btn-primary-bd: rgba(180, 83, 9, 0.7);
  --btn-primary-text: #ffffff;

  --input-bg: #f8fafc;
  --input-bd: #cfd8e3;

  --rail-bg: #eef2f7;
  --rail-border: #d8dee8;

  --log-bg: #06090d;
  --log-border: #21262d;
  --log-text: #c9d1d9;
  --log-dim: #6e7681;

  --wrap-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 1px 0 rgba(15, 23, 42, 0.04), 0 14px 32px -12px rgba(15, 23, 42, 0.18);
  --shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px -14px rgba(15, 23, 42, 0.18);
  --shadow-modal: 0 24px 56px -16px rgba(15, 23, 42, 0.25), 0 2px 0 rgba(15, 23, 42, 0.04);
  --backdrop: rgba(15, 23, 42, 0.35);
  --flash: rgba(31, 111, 235, 0.12);
  --radius: 6px;
  --radius-lg: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06090d;
    --grid: rgba(31, 111, 235, 0.03);
    --surface: #0d1117;
    --surface-2: #11161d;
    --border: #21262d;
    --border-soft: rgba(33, 38, 45, 0.8);
    --border-strong: #30363d;
    --text: #c9d1d9;
    --text-strong: #e6edf3;
    --text-dim: #8b949e;
    --text-faint: #6e7681;
    --text-fade: #484f58;

    --accent: #58a6ff;
    --accent-text: #79b8ff;
    --accent-strong: #79b8ff;
    --accent-soft: rgba(31, 111, 235, 0.1);
    --accent-bd: rgba(31, 111, 235, 0.25);
    --row-hover: #161b22;

    --ok: #56d364;
    --ok-bg: rgba(86, 211, 100, 0.1);
    --ok-bd: rgba(86, 211, 100, 0.3);
    --warn: #fbbf24;
    --warn-bg: rgba(245, 158, 11, 0.1);
    --warn-bd: rgba(245, 158, 11, 0.4);
    --err: #f87171;
    --err-bg: rgba(220, 38, 38, 0.08);
    --err-bd: rgba(220, 38, 38, 0.3);
    --info: #79b8ff;
    --info-bg: rgba(31, 111, 235, 0.1);
    --info-bd: rgba(31, 111, 235, 0.25);
    --neutral: #8b949e;
    --neutral-bg: rgba(110, 118, 129, 0.12);
    --neutral-bd: rgba(110, 118, 129, 0.35);

    --thead: linear-gradient(180deg, #13181f 0%, #0d1117 100%);

    --btn-bg: linear-gradient(135deg, #0d1f35, #0c1a2e);
    --btn-bd: #1c3d5e;
    --btn-bg-h: linear-gradient(135deg, #1c3d5e, #1a3358);
    --btn-glow-h: 0 0 12px rgba(56, 139, 253, 0.25);
    --btn-primary-bg: linear-gradient(135deg, #b45309, #92400e);
    --btn-primary-bg-h: linear-gradient(135deg, #d97706, #b45309);
    --btn-primary-bd: rgba(245, 158, 11, 0.6);
    --btn-primary-text: #fff7ed;

    --input-bg: #06090d;
    --input-bd: #21262d;

    --rail-bg: #080c12;
    --rail-border: #21262d;

    --wrap-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset, 0 16px 64px rgba(0, 0, 0, 0.7);
    --shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7);
    --backdrop: rgba(0, 0, 0, 0.55);
    --flash: rgba(88, 166, 255, 0.16);
  }
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; display: block; height: 2px;
  background: var(--stripe);
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--text-fade); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.boot {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--text-faint); letter-spacing: 0.02em;
}

/* ── App shell / nav rail ─────────────────────────────────────────────────── */

.app-shell { display: grid; grid-template-columns: 176px 1fr; min-height: calc(100vh - 2px); }

.rail {
  background: var(--rail-bg);
  border-right: 1px solid var(--rail-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.rail-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 12px 10px;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-weight: 700; font-size: 12px; line-height: 1.3;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
}
.rail-links { flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  display: block; width: 100%; text-align: left;
  padding: 4px 10px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
a.rail-link:hover { text-decoration: none; }
.rail-link:hover { color: var(--accent-text); background: var(--accent-soft); }
.rail-link.active {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-bd);
}
.rail-foot { padding: 8px 6px; border-top: 1px solid var(--rail-border); }

.main { min-width: 0; }
.page { padding: 14px 18px 36px; max-width: 1520px; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-strong);
}
.page-title .mono {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  letter-spacing: 0; text-transform: none;
}
.page-sub { color: var(--text-dim); margin-top: 3px; font-size: 12.5px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-chips { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

.overline {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-faint);
}

/* ── Chips / badges ───────────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral);
  border: 1px solid var(--neutral-bd);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.chip-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.chip-err { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }
.chip-info { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.chip-run { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.chip-run .dot { animation: pulse 1.2s ease-in-out infinite; }
.chip-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-bd); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.tag {
  display: inline-block; padding: 0 6px; border-radius: 4px;
  border: 1px solid var(--border-strong);
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap;
}

.trend-up { color: var(--ok); font-weight: 650; }
.trend-down { color: var(--err); font-weight: 650; }

/* ── Type logos ───────────────────────────────────────────────────────────── */

/* Brand marks sit on a white app-icon tile in both themes so dark brand
 * glyphs (GitHub, Notion, Zendesk) stay legible in dark mode. */
.type-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: #fff; border: 1px solid var(--border-soft);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  vertical-align: middle;
}
.type-logo img { width: 14px; height: 14px; display: block; }
.type-logo-lg { width: 34px; height: 34px; border-radius: 8px; }
.type-logo-lg img { width: 21px; height: 21px; }
.type-logo.logo-missing img { display: none; }
.type-logo.logo-missing::before {
  content: attr(data-letter);
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  color: var(--accent);
}
.type-logo-lg.logo-missing::before { font-size: 15px; }

.name-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--text);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s;
}
.btn:hover {
  background: var(--btn-bg-h); border-color: var(--accent);
  color: var(--accent-text); box-shadow: var(--btn-glow-h);
  text-decoration: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--btn-primary-bg); border-color: var(--btn-primary-bd);
  color: var(--btn-primary-text);
}
.btn-primary:hover {
  background: var(--btn-primary-bg-h); border-color: var(--btn-primary-bd);
  color: var(--btn-primary-text); box-shadow: none;
}
.btn-danger { color: var(--err); border-color: var(--err-bd); background: var(--err-bg); }
.btn-danger:hover {
  background: var(--err-bg); border-color: var(--err);
  color: var(--err); box-shadow: none;
}
.btn-sm { padding: 2px 9px; font-size: 11.5px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); box-shadow: none; }

.icon-btn {
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-faint); font-size: 13px; padding: 2px 6px; border-radius: 4px;
}
.icon-btn:hover { color: var(--text); background: var(--neutral-bg); }

.link-btn { border: 0; background: none; color: var(--accent-text); cursor: pointer; padding: 0; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ── Switch (enabled toggles) ─────────────────────────────────────────────── */

.switch {
  appearance: none; -webkit-appearance: none;
  width: 30px; height: 17px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  cursor: pointer; flex: none; margin: 0;
  transition: background 0.15s;
  vertical-align: middle;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left 0.15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 15px; background: #fff; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards / panels ───────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: 10px 12px; }
.card + .card { margin-top: 10px; }
.card-title {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-strong);
  margin-bottom: 6px;
}

.section { margin-bottom: 14px; }
.section-head { margin-bottom: 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */

.strip {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 6px 10px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.strip-item { display: flex; align-items: baseline; gap: 7px; }
.strip-item b { font-family: var(--mono); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-sep { width: 1px; align-self: stretch; background: var(--border); }
.worker-item { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.worker-item .mono { color: var(--text); }
.worker-stale { color: var(--warn); }

.cards-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.hcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 5px;
}
.hcard-warn { border-color: var(--warn-bd); }
.hcard-error { border-color: var(--err-bd); }
.hcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hcard-name { font-weight: 650; font-size: 13.5px; }
.hcard-name a { color: var(--text-strong); }
.hcard-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hcard-stats { display: flex; gap: 10px; font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 12px; flex-wrap: wrap; }
.hcard-stats b { color: var(--text); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.alert-line { font-size: 11.5px; display: flex; gap: 5px; align-items: baseline; }
.alert-warn { color: var(--warn); }
.alert-error { color: var(--err); }

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--wrap-shadow);
}
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; padding: 5px 10px;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  background: var(--thead); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 4px 10px; border-bottom: 1px solid var(--border-soft);
  vertical-align: middle; font-variant-numeric: tabular-nums;
  transition: background-color 0.12s;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: var(--row-hover); }
.table .num { text-align: right; }
.table .dim { color: var(--text-dim); }
.table .empty-cell { color: var(--text-faint); text-align: center; padding: 18px 10px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-col { max-width: 640px; min-width: 0; flex: 1; }
.form-layout { display: flex; gap: 18px; align-items: flex-start; }

.field { margin-bottom: 9px; }
.field > label { display: block; font-size: 12px; font-weight: 620; margin-bottom: 2px; }
.req { color: var(--err); margin-left: 2px; }
.help { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; line-height: 1.45; }
.field-error { font-size: 11.5px; color: var(--err); margin-top: 3px; font-weight: 570; }
.field.has-error .input { border-color: var(--err); }

.input, select.input, textarea.input {
  width: 100%; padding: 3px 8px;
  border: 1px solid var(--input-bd); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 12.5px;
}
textarea.input { resize: vertical; min-height: 48px; }
.input:focus { outline: none; border-color: var(--accent); }
.input-mono { font-family: var(--mono); font-size: 12px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.input-narrow { max-width: 180px; }

.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.check-row label { font-size: 12.5px; font-weight: 570; cursor: pointer; }
.check-row .help { margin: 0; }
.check-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px 16px; }

fieldset.schema-group {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 8px 10px 2px; margin: 0 0 10px;
  background: var(--surface);
}
fieldset.schema-group > legend {
  padding: 0 6px;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint);
}
details.advanced { margin: 2px 0 8px; }
details.advanced > summary {
  cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--text-dim);
  user-select: none; list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸"; font-size: 10px; transition: transform 0.12s; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced > .advanced-body { margin-top: 6px; padding-left: 10px; border-left: 1px solid var(--border); }

.one-of { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; padding: 5px 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.one-of label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 570; cursor: pointer; }

.file-saved { font-size: 11.5px; color: var(--text-dim); font-style: italic; display: block; margin-bottom: 4px; }
.file-picked { font-family: var(--mono); font-size: 11.5px; color: var(--ok); margin-right: 8px; }
.mode-toggle { display: flex; gap: 12px; margin-bottom: 6px; }
.mode-toggle label { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-dim); cursor: pointer; }

.cron-ok { color: var(--ok); }
.cron-bad { color: var(--warn); }

.form-footer { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

.side-notes {
  width: 270px; flex: none; position: sticky; top: 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 9px 11px; font-size: 12px; color: var(--text-dim);
}
.side-notes h4 {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px;
}
.side-notes ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 5px; }
@media (max-width: 980px) { .side-notes { display: none; } }

/* ── Type picker ──────────────────────────────────────────────────────────── */

.type-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 8px; }
.type-card {
  text-align: left; padding: 8px 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.15s, box-shadow 0.2s;
}
.type-card:hover { border-color: var(--accent); box-shadow: var(--btn-glow-h); }
.type-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.type-card-label { font-weight: 650; font-size: 13px; color: var(--text-strong); }
.type-card p { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.unsched-note { margin-top: 14px; font-size: 11.5px; color: var(--text-faint); max-width: 720px; }
.unsched-note dt { font-weight: 650; color: var(--text-dim); float: left; clear: left; margin-right: 6px; }
.unsched-note dd { margin: 0 0 5px 0; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  border: 0; background: none; cursor: pointer;
  padding: 5px 2px 6px; margin-bottom: -1px;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text-strong); }
.tab.active { color: var(--text-strong); border-bottom-color: var(--accent); }

/* ── KV lists (config, system info) ───────────────────────────────────────── */

.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 3px 16px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .mono { font-size: 11.5px; }
.mask-val { color: var(--text-faint); letter-spacing: 0.12em; }

/* ── Banners / empty states / skeletons ───────────────────────────────────── */

.banner {
  padding: 6px 10px; border-radius: var(--radius); margin-bottom: 10px;
  font-size: 12.5px; border: 1px solid;
}
.banner-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.banner-error { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }
.banner .mono { font-size: 11.5px; }

.empty-state {
  padding: 28px 16px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-dim);
}
.empty-state h3 { font-size: 14px; font-weight: 650; color: var(--text-strong); margin-bottom: 4px; }
.empty-state p { margin-bottom: 10px; font-size: 12.5px; }

.skeleton {
  display: inline-block; color: transparent !important; border-radius: 4px; min-height: 0.9em;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  user-select: none;
}
.skeleton-block { display: block; height: 84px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toasts ───────────────────────────────────────────────────────────────── */

.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal); font-size: 12.5px;
  animation: toast-in 0.18s ease-out;
}
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast-error { border-color: var(--err-bd); color: var(--err); }
.toast-warn { border-color: var(--warn-bd); color: var(--warn); }
.toast-ok { border-color: var(--ok-bd); color: var(--ok); }
.toast-info { border-color: var(--info-bd); color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Modals ───────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: var(--backdrop);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
  width: 100%; max-width: 460px; max-height: 80vh; overflow-y: auto;
  animation: toast-in 0.15s ease-out;
}
.modal-wide { max-width: 620px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px 8px; border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-strong);
}
.modal-body { padding: 10px 12px; }
.modal-body p { margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 0 2px; margin-top: 12px; }

/* ── Login ────────────────────────────────────────────────────────────────── */

.login-wrap { min-height: calc(100vh - 2px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--wrap-shadow); padding: 18px 18px 16px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-strong);
}
.login-card h1 { font-size: 15px; font-weight: 650; color: var(--text-strong); margin-bottom: 4px; }
.login-card .page-sub { margin-bottom: 16px; }
.login-error { margin: 0 0 12px; }

/* ── Run detail / metric strip / log viewer ───────────────────────────────── */

.metric-strip {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.metric { background: var(--surface); padding: 6px 10px 5px; }
.metric-value { font-family: var(--mono); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-label {
  font-family: var(--font-display);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint);
  margin-top: 2px; white-space: nowrap;
}
.metric-ok .metric-value { color: var(--ok); }
.metric-warn .metric-value { color: var(--warn); }
.metric-err .metric-value { color: var(--err); }

.error-panel {
  background: var(--err-bg); border: 1px solid var(--err-bd);
  border-radius: var(--radius); padding: 8px 10px; margin-bottom: 10px;
  max-height: 220px; overflow-y: auto;
}
.error-panel h4 { color: var(--err); font-size: 12px; margin-bottom: 6px; }
.error-panel ol { margin: 0; padding-left: 18px; font-family: var(--mono); font-size: 11.5px; color: var(--err); display: flex; flex-direction: column; gap: 3px; }

.log-viewer { position: relative; margin-top: 4px; }
.log-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 10px;
  background: var(--thead); border: 1px solid var(--border);
  border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); flex: none; }
.conn-streaming .conn-dot { background: var(--ok); animation: pulse 1.4s ease-in-out infinite; }
.conn-connecting .conn-dot, .conn-reconnecting .conn-dot { background: var(--warn); animation: pulse 0.8s ease-in-out infinite; }
.conn-complete .conn-dot { background: var(--neutral); }
.log-pane {
  background: var(--log-bg); color: var(--log-text);
  border: 1px solid var(--log-border); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  height: 420px; overflow: auto; overscroll-behavior: contain;
  padding: 8px 10px;
}
.log-pane pre {
  margin: 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.log-trunc { color: var(--log-dim); font-size: 11px; font-style: italic; padding-bottom: 6px; }
.log-empty { color: var(--log-dim); font-style: italic; font-size: 12px; }
.jump-btn {
  position: absolute; right: 16px; bottom: 14px;
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--text); font-size: 11.5px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-modal);
  transition: border-color 0.15s, color 0.15s;
}
.jump-btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* ── Settings ─────────────────────────────────────────────────────────────── */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; align-items: start; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.spacer { flex: 1; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 56px 1fr; }
  .rail-brand { justify-content: center; padding-left: 8px; padding-right: 8px; }
  .rail-brand span:last-child, .rail-link .rail-label { display: none; }
  .rail-link { text-align: center; padding: 8px 0; }
  .page { padding: 10px 10px 32px; }
}

/* ── Google sign-in + rail identity ──────────────────────────────────────── */

.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.g-mark { flex: none; background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }

.rail-user { display: flex; align-items: center; gap: 8px; padding: 6px 10px 8px; min-width: 0; }
.rail-avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-bd);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
}
.rail-user-text { display: flex; flex-direction: column; min-width: 0; }
.rail-user-name { font-size: 12px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user-sub { font-size: 10.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .rail-user { justify-content: center; padding: 6px 0 8px; }
}

/* ── Activity page ───────────────────────────────────────────────────────── */

.leader-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; align-items: start; margin-bottom: 10px; }
.rank { color: var(--text-faint); font-weight: 600; }
.audit-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.input-sm { padding: 4px 8px; font-size: 12px; width: auto; }
.details-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-more { margin-top: 10px; text-align: center; }
