/* Shared theme. Lives under /survey/ because that path stays public behind Cloudflare Access. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #15213b;        /* navy */
  --ink-2: #47536b;
  --ink-3: #7b8597;
  --rule: #e2e5ea;
  --rule-2: #cfd4dc;
  --accent: #8b1e2d;     /* burgundy */
  --accent-soft: #f6e8ea;
  --ok: #1f6b4a;
  --ok-soft: #e4f2ea;
  --mark-report: #fbe3a1;
  --mark-infer: #c9ecdf;
  --mark-anter: #e3dcf3;
  --serif: "IBM Plex Serif", Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(21, 33, 59, .05), 0 1px 1px rgba(21, 33, 59, .03);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; color: var(--ink); }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.005em; }
h2 { font-size: 1.2rem; line-height: 1.3; }
h3 { font-size: 1.02rem; }
code, .mono { font-family: var(--mono); font-size: .84em; }

/* institutional bar + app header */
.inst { background: var(--ink); color: #dfe4ee; font-size: .78rem; letter-spacing: .02em; }
.inst .in { max-width: 1240px; margin: 0 auto; padding: 7px 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inst b { color: #fff; font-weight: 500; }
.appbar { background: var(--surface); border-bottom: 1px solid var(--rule); }
.appbar .in { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; min-height: 58px; flex-wrap: wrap; }
.brand { font: 600 1.08rem var(--serif); color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 10px; height: 22px; background: var(--accent); border-radius: 2px; }
.appbar nav { display: flex; gap: 4px; }
.appbar nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .9rem; padding: 18px 10px 16px; border-bottom: 2px solid transparent; }
.appbar nav a:hover { color: var(--ink); }
.appbar nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.appbar .user { margin-left: auto; font-size: .8rem; color: var(--ink-3); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 24px 72px; }
.page-head { margin-bottom: 22px; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 70ch; }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px 22px; }
.section-title { font: 600 .72rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }

label.field { display: block; margin: 0 0 16px; }
label.field > span, .field-label { display: block; font-weight: 600; font-size: .82rem; color: var(--ink-2); margin-bottom: 6px; }
textarea, input[type="text"], input[type="number"], select {
  width: 100%; font: .95rem/1.5 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 9px 11px;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,33,59,.12); }
textarea.source { font-family: var(--serif); font-size: 1.15rem; line-height: 1.4; min-height: 76px; }

.btn {
  appearance: none; border: 1px solid var(--ink); background: var(--ink); color: #fff; font: 600 .9rem/1 var(--sans);
  padding: 11px 16px; border-radius: var(--radius); cursor: pointer; transition: background .15s, box-shadow .15s;
}
.btn:hover { background: #0d1628; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(139,30,45,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn.small { padding: 8px 12px; font-size: .82rem; }

.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 6px 10px; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); font-size: .85rem; transition: all .12s; }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(21,33,59,.18); }
.chip input:disabled + span { color: var(--ink-3); background: var(--surface-2); border-style: dashed; }

.muted { color: var(--ink-3); }
.small { font-size: .84rem; }
.err { color: var(--accent); }
.notice { border: 1px solid #ecd2d6; background: var(--accent-soft); color: #5d1520; padding: 10px 14px; border-radius: var(--radius); font-size: .9rem; }
.badge { display: inline-block; font: 500 .72rem/1 var(--sans); padding: 4px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2); }

mark { padding: 0 .12em; border-radius: 2px; color: inherit; }
mark.report { background: var(--mark-report); }
mark.infer { background: var(--mark-infer); }
mark.anter { background: var(--mark-anter); }
.key { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); }
.key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
table.data thead th { font: 600 .72rem/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: fade .25s ease-out both; }

@media (max-width: 720px) {
  .wrap { padding: 20px 16px 56px; }
  .inst .in, .appbar .in { padding-left: 16px; padding-right: 16px; }
  .inst .in > span:last-child { display: none; }
  .inst .in > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar .in { gap: 0; flex-direction: column; align-items: stretch; min-height: 0; }
  .brand { padding: 12px 0 2px; }
  .appbar nav { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 8px; }
  .appbar nav::-webkit-scrollbar { display: none; }
  .appbar nav a { padding: 10px 8px 10px; white-space: nowrap; }
  .appbar .user { display: none; }
  h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }
