/* ============================================================
   Brief admin — "Document" direction (canvas: B · Document — admin).
   White page, Regesto throughout, hairlines, pill controls, four
   stat tiles over a table. Self-contained: tokens.css + this file.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

.ba-body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--dn-font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.ba-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- Frame ---------------------------------------------------------- */
.ba-app { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; padding: 28px var(--dn-gutter) 40px; }
.ba-top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-size: 13px; line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; color: #4c4c4c; font-weight: 500;
}
.ba-top b { color: #000; font-weight: 500; }
.ba-top-brand { text-decoration: none; }
.ba-link { text-decoration: underline; text-underline-offset: 0.15em; }
.ba-link:hover { color: #e72b25; }
.ba-view { flex: 1 1 auto; }

.ba-kicker { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: #4c4c4c; font-weight: 500; }
.ba-h1 { margin: 10px 0 0; font-weight: 500; font-size: clamp(36px, 3.6vw, 52px); line-height: 0.95; letter-spacing: -0.03em; }
.ba-hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-top: 56px; }
.ba-hero .ba-h1 { margin: 0; }
.ba-sub { margin: 12px 0 0; color: #4c4c4c; max-width: 60ch; }

/* ---- Buttons / pills ------------------------------------------------- */
.ba-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px 15px; background: #000; color: #fff; border-radius: 999px;
  font-size: 15px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap;
}
.ba-btn:hover { background: #e72b25; }
.ba-btn[disabled] { opacity: 0.4; cursor: default; }
.ba-btn.is-ghost { background: none; color: #000; border: 1px solid #000; }
.ba-btn.is-ghost:hover { border-color: #e72b25; color: #e72b25; background: none; }
.ba-btn.is-small { padding: 8px 14px 9px; font-size: 13px; }
.ba-btn.is-danger:hover { background: #000; }

.ba-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px 9px; border: 1px solid #e5e5e5; border-radius: 999px;
  font-size: 13px; font-weight: 500; line-height: 1; color: #4c4c4c; white-space: nowrap;
}
.ba-chip:hover { border-color: #000; color: #000; }
.ba-chip.is-on { border-color: #000; color: #000; }
.ba-chip.is-solid { background: #000; color: #fff; border-color: #000; }

.ba-tag { display: inline-block; padding: 5px 10px 6px; border-radius: 999px; border: 1px solid #000; font-size: 12px; line-height: 1; font-weight: 500; white-space: nowrap; }
.ba-tag.completed { background: #000; color: #fff; }
.ba-tag.in_progress { border-color: #e72b25; color: #e72b25; }
.ba-tag.pending { border-color: #e5e5e5; color: #4c4c4c; }
.ba-tag.archived { border-style: dashed; color: #4c4c4c; border-color: #9f9f9f; }

/* ---- Stat tiles ------------------------------------------------------ */
.ba-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 40px; }
.ba-tile { padding: 18px 0 20px; border-top: 1px solid #000; }
.ba-tile .k { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: #4c4c4c; font-weight: 500; }
.ba-tile .v { margin: 10px 0 0; font-size: 40px; line-height: 1; font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ba-tile .v small { font-size: 16px; color: #4c4c4c; margin-left: 6px; letter-spacing: 0; }
.ba-tile.is-red .v { color: #e72b25; }

/* ---- Filters + table ------------------------------------------------- */
.ba-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.ba-table-wrap { overflow-x: auto; margin-top: 18px; }
.ba-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.3; }
.ba-table th { text-align: left; padding: 0 12px 12px 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #9f9f9f; font-weight: 500; border-bottom: 1px solid #000; white-space: nowrap; }
.ba-table td { padding: 16px 12px 16px 0; border-bottom: 1px solid #e5e5e5; vertical-align: middle; }
.ba-table td:last-child, .ba-table th:last-child { padding-right: 0; }
.ba-table tr.is-archived td { color: #9f9f9f; }
.ba-proj b { display: block; font-weight: 500; }
.ba-proj a { text-decoration: none; }
.ba-proj a:hover { text-decoration: underline; text-decoration-color: #e72b25; }
.ba-proj span { color: #4c4c4c; font-size: 13px; }
.ba-muted { color: #4c4c4c; }
.ba-bar { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ba-bar i { display: block; width: 110px; height: 3px; border-radius: 2px; background: linear-gradient(to right, #000 var(--p, 0%), #e5e5e5 var(--p, 0%)); }
.ba-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.ba-acts .ba-chip { padding: 7px 12px 8px; }
.ba-empty { padding: 48px 0; color: #4c4c4c; border-bottom: 1px solid #e5e5e5; }

/* ---- Forms ----------------------------------------------------------- */
.ba-form { max-width: 720px; margin-top: 40px; }
.ba-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.ba-field { display: block; margin-top: 26px; }
.ba-label { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: #4c4c4c; font-weight: 500; margin-bottom: 8px; }
.ba-field input[type="text"], .ba-field input[type="email"], .ba-field input[type="password"] {
  width: 100%; padding: 10px 0 11px; border: 0; border-bottom: 1px solid #000; border-radius: 0; background: none;
  font-size: 17px; line-height: 1.3; outline: none; -webkit-appearance: none; appearance: none;
}
.ba-field input:focus { border-bottom-width: 2px; padding-bottom: 10px; }
.ba-field input::placeholder { color: #9f9f9f; }
.ba-field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px #fff inset; -webkit-text-fill-color: #000; }
.ba-hint { margin: 8px 0 0; font-size: 13px; color: #4c4c4c; }
.ba-error { margin: 16px 0 0; color: #e72b25; font-size: 14px; }

.ba-who, .ba-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.ba-pill-radio { position: relative; }
.ba-pill-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ba-pill-radio span { display: inline-block; padding: 10px 16px 11px; border: 1px solid #e5e5e5; border-radius: 999px; font-size: 15px; font-weight: 500; line-height: 1; color: #4c4c4c; }
.ba-pill-radio input:checked + span { background: #000; color: #fff; border-color: #000; }
.ba-pill-radio input:focus-visible + span { outline: 2px solid #e72b25; outline-offset: 2px; }
.ba-pill-radio:hover span { border-color: #000; color: #000; }
.ba-pill-radio input:checked:hover + span { color: #fff; }

/* Section rows: a switch, the title, the question count, and a disclosure
   that lists the questions with per-question hide toggles. */
.ba-sections { margin-top: 12px; border-top: 1px solid #000; }
.ba-sec { border-bottom: 1px solid #e5e5e5; }
.ba-sec-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.ba-sec-row.is-off .ba-sec-title { color: #9f9f9f; }
.ba-switch { position: relative; width: 38px; height: 22px; flex: none; }
.ba-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ba-switch span { position: absolute; inset: 0; border-radius: 999px; background: #e5e5e5; transition: background var(--dn-dur-fast); }
.ba-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--dn-dur-fast) var(--dn-ease-out); }
.ba-switch input:checked + span { background: #000; }
.ba-switch input:checked + span::after { transform: translateX(16px); }
.ba-switch input:focus-visible + span { outline: 2px solid #e72b25; outline-offset: 2px; }
.ba-sec-title { flex: 1 1 auto; font-weight: 500; }
.ba-sec-title small { font-weight: 400; color: #4c4c4c; margin-left: 8px; }
.ba-sec-more { font-size: 13px; color: #4c4c4c; text-decoration: underline; text-underline-offset: 0.15em; }
.ba-sec-more:hover { color: #000; }
.ba-qs { padding: 0 0 14px 52px; }
.ba-q { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; font-size: 14px; }
.ba-q input { margin: 3px 0 0; accent-color: #000; }
.ba-q.is-hidden span { color: #9f9f9f; text-decoration: line-through; text-decoration-color: #e72b25; }
.ba-q .t { color: #9f9f9f; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; margin-left: auto; white-space: nowrap; }

.ba-check { display: flex; align-items: center; gap: 10px; margin-top: 26px; }
.ba-check input { accent-color: #000; width: 16px; height: 16px; }
.ba-actions { display: flex; align-items: center; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid #e5e5e5; flex-wrap: wrap; }

/* ---- Detail ---------------------------------------------------------- */
.ba-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 40px; flex-wrap: wrap; }
.ba-meta { margin: 12px 0 0; color: #4c4c4c; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ba-linkbox { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding: 14px 0; border-top: 1px solid #000; border-bottom: 1px solid #e5e5e5; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.ba-linkbox code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.ba-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 48px; margin-top: 40px; }
.ba-progress-list { margin: 0; padding: 0; list-style: none; }
.ba-progress-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e5e5e5; font-size: 14px; }
.ba-progress-list li span:first-child { flex: 1 1 auto; }
.ba-h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: #4c4c4c; font-weight: 500; }
.ba-answers section { margin-top: 32px; }
.ba-answers h3 { margin: 0 0 8px; font-weight: 500; font-size: 22px; letter-spacing: -0.01em; padding-bottom: 8px; border-bottom: 1px solid #000; }
.ba-answers dl { margin: 0; }
.ba-answers dt { margin-top: 18px; font-weight: 500; }
.ba-answers dd { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #000; }
.ba-answers dd.is-blank { color: #9f9f9f; }
.ba-answers dd a { color: #000; }
.ba-events { margin: 0; padding: 0; list-style: none; font-size: 13px; color: #4c4c4c; }
.ba-events li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; display: flex; gap: 12px; }
.ba-events li b { font-weight: 500; color: #000; min-width: 110px; }

/* ---- Health line ------------------------------------------------------ */
.ba-health { margin-top: 48px; padding-top: 14px; border-top: 1px solid #e5e5e5; font-size: 13px; color: #4c4c4c; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ba-health .bad { color: #e72b25; }
.ba-health .ok::before { content: "✓ "; }

/* ---- Toast ------------------------------------------------------------ */
.ba-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 12px 18px; background: #000; color: #fff; border-radius: 999px; font-size: 14px; z-index: 10; }
.ba-toast.is-bad { background: #e72b25; }

/* ---- Login ----------------------------------------------------------- */
.ba-login { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: var(--dn-gutter); }
.ba-login-card { width: min(420px, 100%); }
.ba-login-card .ba-h1 { margin-bottom: 28px; }
.ba-login-card .ba-btn { margin-top: 28px; }

/* ---- Small screens ----------------------------------------------------- */
@media (max-width: 900px) {
  .ba-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ba-cols { grid-template-columns: 1fr; }
  .ba-grid2 { grid-template-columns: 1fr; }
  .ba-hero { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
  .ba-tiles { grid-template-columns: 1fr 1fr; gap: 16px; }
  .ba-tile .v { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .ba-switch span, .ba-switch span::after { transition: none; }
}
