/* RSTF NCR Portal — "C1 calm blue": white, hairline cards, one calm accent. Tokens documented in DESIGN.md. */

:root {
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;          /* 4.83:1 on white, 4.63:1 on --soft */
  --faint: #a1a1aa;          /* decoration only, never text */
  --line: #e7e7ea;           /* card and row hairlines */
  --line-2: #d4d4d8;         /* dashed drop zones, empty dots */
  --field: #8f8f99;          /* input borders: 3.2:1 on white */
  --soft: #fafafa;
  --soft-2: #f4f4f5;
  --paper: #ffffff;
  --accent: #2563a8;         /* calm blue: 6.12:1 on white */
  --accent-hover: #1d4f88;
  --accent-tint: #eef4fb;    /* accent text on it: 5.53:1 */
  --accent-line: #c9dbef;
  --green: #15803d;  --green-tint: #f0fdf4;
  --amber: #a16207;  --amber-tint: #fefce8;
  --red: #b91c1c;    --red-tint: #fef2f2;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-card: 12px;
  --r-control: 10px;
  --page: 70rem;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 0.9375rem/1.55 var(--font); letter-spacing: -0.005em;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--display); color: var(--ink); margin: 0 0 0.75rem; }
h1 { font-size: clamp(1.75rem, 1.35rem + 1.3vw, 2.25rem); line-height: 1.12; letter-spacing: -0.032em; font-weight: 620; }
h2 { font-size: 1rem; line-height: 1.3; letter-spacing: -0.012em; font-weight: 600; }
h3 { font-size: 0.9375rem; font-weight: 600; }
p { margin: 0 0 1rem; max-width: 68ch; }
small, .small { font-size: 0.8125rem; }
.muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 0.2em; }
p a, .notice a, .auth-foot a, .link, .fine a { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 0.2em; }
p a:hover, .auth-foot a:hover, .link:hover { text-decoration-color: currentColor; }
.nav a, .nav a:hover, a.btn, .brand { text-decoration: none !important; }
td a b { color: var(--ink); }
td a:hover b { color: var(--accent); }
img { max-width: 100%; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[id] { scroll-margin-top: 5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 30; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; border-radius: var(--r-control); }
.skip-link:focus { top: 0.75rem; color: var(--paper); }
.i { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.15em; }

/* ---------- Top navigation ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar .in { max-width: var(--page); margin: 0 auto; padding: 0 1.5rem; min-height: 3.75rem; display: flex; align-items: center; gap: 0.5rem 1.75rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font: 650 0.9375rem var(--display); letter-spacing: -0.02em; color: var(--ink); }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark { width: 1.125rem; height: 1.125rem; border-radius: 5px; background: var(--accent); }
.nav { align-self: stretch; display: flex; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; }
.nav li { display: flex; }
.nav a { display: flex; align-items: center; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; padding-top: 2px; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.account form { margin: 0; }
.time-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--amber-tint); color: var(--amber); font-size: 0.8125rem; font-weight: 550; white-space: nowrap; }
.time-pill.is-open { background: var(--soft-2); color: var(--ink-2); }
.time-pill.is-closed { background: var(--red-tint); color: var(--red); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--soft-2); color: var(--ink); display: grid; place-items: center; font: 600 0.75rem var(--font); flex: none; object-fit: cover; }
.avatar-lg { width: 4.5rem; height: 4.5rem; font-size: 1.1rem; }
.avatar-tint { background: var(--accent-tint); color: var(--accent); }

/* ---------- Page scaffolding ---------- */
.page { flex: 1; width: 100%; max-width: var(--page); margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }
.page:focus { outline: none; }
.crumb { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.8125rem; flex-wrap: wrap; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem 2rem; flex-wrap: wrap; margin-bottom: 2rem; }
.head h1 { margin: 0.65rem 0 0.75rem; max-width: 22ch; }
.head h1:last-child { margin-bottom: 0; }
.head p.lede { margin: 0.25rem 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.facts { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; color: var(--muted); font-size: 0.875rem; margin: 0; padding: 0; list-style: none; }
.facts li { display: inline-flex; align-items: center; gap: 0.45rem; }
.sec { margin-top: 2.5rem; }
.sec:first-child { margin-top: 0; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.sec-h h2 { margin: 0; }
.sec-h span, .sec-h small { color: var(--muted); font-size: 0.8125rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; margin-top: 2.75rem; align-items: start; }
@media (min-width: 64rem) { .cols { grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.75rem; } .cols > aside { position: sticky; top: 1.5rem; } }
.card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper); }
.card-pad { padding: 1.4rem; }
.narrow { max-width: 34rem; }
.auth { max-width: 25rem; margin: 2.5rem auto 0; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head .brand-mark { display: block; width: 2.25rem; height: 2.25rem; border-radius: 9px; margin: 0 auto 1rem; }
.auth-head h1 { margin: 0 0 0.4rem; }
.auth-head p { margin: 0 auto; color: var(--muted); }
.auth-foot { text-align: center; color: var(--muted); font-size: 0.875rem; margin-top: 1.25rem; }
.auth-foot p { margin: 0 auto 0.4rem; }
.btn-google { font-weight: 550; }
.btn.btn-google[disabled] { background: var(--paper); border-color: var(--line); color: var(--muted); }
.btn-google[disabled] .g-logo { filter: grayscale(1); opacity: 0.55; }
.google-soon { margin: 0.45rem 0 0; text-align: center; color: var(--muted); font-size: 0.8125rem; }
.row .google-soon { text-align: right; }
.btn-google .g-logo { width: 1.125rem; height: 1.125rem; flex: none; }
.or-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.1rem 0; color: var(--muted); font-size: 0.8125rem; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.prose h3 { font-size: 0.9375rem; margin: 1.1rem 0 0.4rem; }
.prose h3:first-child { margin-top: 0; }
.prose ul { margin: 0 0 0.75rem; padding-left: 1.2rem; }
.prose li, .prose p { margin: 0 0 0.45rem; color: var(--ink-2); font-size: 0.9rem; }
.modal { width: min(36rem, calc(100% - 2rem)); max-height: min(40rem, calc(100dvh - 2rem)); padding: 0; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper); color: var(--ink); }
.modal::backdrop { background: rgb(24 24 27 / 0.4); }
.modal[open] { animation: modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal > form { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1.1rem 1.25rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.85rem 1.25rem; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
a.who-name { color: var(--muted); }
a.who-name:hover { color: var(--ink); }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.6rem; background: var(--accent-tint); color: var(--accent); white-space: nowrap; }
.status-draft { background: var(--accent-tint); color: var(--accent); }
.status-ok { background: var(--green-tint); color: var(--green); }
.status-off { background: var(--soft-2); color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 550; padding: 0.15rem 0.55rem; border-radius: 6px; background: var(--soft-2); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--green-tint); color: var(--green); }
.badge-missing { background: var(--red-tint); color: var(--red); }
.badge-wait { background: var(--amber-tint); color: var(--amber); }
.ok-text { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--green); font-size: 0.8125rem; }
.bad-text { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--red); font-size: 0.8125rem; }
.dot-status { display: inline-flex; align-items: center; gap: 0.45rem; }
.dot-status::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--green); }
.dot-status.is-off { color: var(--muted); }
.dot-status.is-off::before { background: transparent; border: 1px solid var(--muted); }

/* ---------- Project code box ---------- */
.codebox { border: 1px solid var(--line); border-radius: var(--r-card); padding: 0.9rem 1.15rem 1rem; min-width: 15rem; display: grid; gap: 0.1rem; }
.codebox small { color: var(--muted); font-size: 0.75rem; }
.codebox .code { font-size: 0.9375rem; font-weight: 550; color: var(--ink-2); margin-bottom: 0.65rem; }
.codebox .code.is-set { font: 600 1.3rem var(--mono); color: var(--accent); letter-spacing: 0.01em; }
.slots { display: flex; gap: 0.3rem; margin-top: 0.35rem; }
.slots i { width: 1.9rem; height: 0.3rem; border-radius: 3px; background: var(--line); }
.slots i.taken { background: var(--accent); }
.code-inline { font: 600 0.8125rem var(--mono); color: var(--accent); background: var(--accent-tint); border-radius: 6px; padding: 0.1rem 0.45rem; white-space: nowrap; }
.code-inline.is-draft { font-family: var(--font); font-weight: 550; color: var(--ink-2); background: var(--soft-2); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
@media (min-width: 48rem) { .timeline { grid-template-columns: repeat(5, 1fr); gap: 0; } }
/* Phones: a compact list with the dot beside each step. Wider: dots on a line above the labels. */
.tl { position: relative; padding: 0 0 0 1.4rem; }
.tl b { display: inline !important; margin-right: 0.4rem; }
.tl::after { content: ""; position: absolute; top: 0.4rem; left: 0; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--paper); border: 1px solid var(--line-2); }
@media (min-width: 48rem) {
  .tl { padding: 1.5rem 0.9rem 0 0; }
  .tl b { display: block !important; margin-right: 0; }
  .tl::after { top: 0; }
  .tl::before { content: ""; position: absolute; top: 0.27rem; left: 0.85rem; right: 0.15rem; height: 1px; background: var(--line-2); }
  .tl:last-child::before { display: none; }
  .tl.is-done::before { background: var(--accent); height: 2px; top: 0.24rem; }
}
.tl.is-done::after { background: var(--accent); border-color: var(--accent); }
.tl.is-now::after { width: 0.75rem; height: 0.75rem; margin: -0.07rem 0 0 -0.07rem; border: 2px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.tl b { display: block; font-size: 0.875rem; font-weight: 550; color: var(--muted); }
.tl.is-done b { color: var(--ink); }
.tl.is-now b { color: var(--accent); }
.tl small { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Document tiles with drop zones ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.75rem; }
.tile { display: flex; flex-direction: column; min-height: 10.5rem; border-radius: var(--r-card); }
.tile-filled { border: 1px solid var(--line); padding: 1rem; gap: 0.3rem; }
.tile-filled .doc-ic { width: 1.6rem; height: 1.6rem; color: var(--ink-2); stroke-width: 1.4; margin-bottom: 0.6rem; }
.tile-filled b { font-weight: 550; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; color: var(--muted); font-size: 0.8125rem; }
.tile-foot { margin-top: auto; padding-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.8125rem; }
.tile form { margin: 0; }
.drop { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; text-align: center; padding: 1.1rem; border: 1.5px dashed var(--accent-line); border-radius: var(--r-card); background: #f7fafd; color: var(--muted); cursor: pointer; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease); }
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--accent); background: var(--accent-tint); }
.drop .i { width: 1.25rem; height: 1.25rem; color: var(--accent); margin-bottom: 0.25rem; }
.drop b { color: var(--ink); font-weight: 550; }
.drop .hint { font-size: 0.8125rem; }
.drop .hint u { color: var(--accent); text-decoration-color: var(--accent-line); text-underline-offset: 0.2em; }
.drop-mini { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--accent); font-weight: 500; cursor: pointer; }
.drop-mini:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.drop-mini:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.nojs-submit { margin-top: 0.5rem; }
.js .nojs-submit { display: none; }
.tile-busy { font-size: 0.8125rem; color: var(--accent); }
.tile-closed { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; text-align: center; border: 1px solid var(--line); border-radius: var(--r-card); color: var(--muted); padding: 1rem; }

/* ---------- Bordered lists (students, documents for EPS) ---------- */
.list { border: 1px solid var(--line); border-radius: var(--r-card); }
.row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 9rem; }
.row .grow small { display: block; color: var(--muted); font-size: 0.8125rem; }
.row-actions { display: flex; align-items: center; gap: 0.5rem; }
.row-actions form { margin: 0; }
.list-add { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; color: var(--accent); font-weight: 500; border-radius: 0 0 var(--r-card) var(--r-card); }
.list-add:hover { background: var(--soft); text-decoration: none; }
.list-empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Readiness panel ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--r-card); padding: 1.4rem; }
.panel h2 { margin: 0; }
.panel .sub { color: var(--muted); font-size: 0.8125rem; margin: 0.15rem 0 0.85rem; }
.meter { height: 0.3rem; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 1.1rem; }
.meter i { display: block; height: 100%; background: var(--accent); }
.check { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: 0.7rem; font-size: 0.875rem; }
.check li { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--muted); }
.check .c { width: 1.05rem; height: 1.05rem; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; flex: none; margin-top: 0.1rem; color: #fff; }
.check .c .i { width: 0.65rem; height: 0.65rem; stroke-width: 2.6; visibility: hidden; }
.check li.is-done { color: var(--ink); }
.check li.is-done .c { background: var(--accent); border-color: var(--accent); }
.check li.is-done .c .i { visibility: visible; }
.check small { display: block; color: var(--muted); font-size: 0.75rem; }
.consent { display: flex; gap: 0.6rem; margin-bottom: 1rem; font-size: 0.8125rem; line-height: 1.5; color: var(--ink-2); }
.consent input { margin-top: 0.15rem; }
.fine { color: var(--muted); font-size: 0.8125rem; margin: 0.75rem 0 0; }
.done-line { display: flex; align-items: center; gap: 0.5rem; color: var(--green); font-weight: 550; margin: 0 0 0.5rem; }

/* ---------- Buttons ---------- */
.btn, button {
  font: inherit; font-weight: 600; letter-spacing: -0.005em; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.5rem; padding: 0 1rem; border: 1px solid var(--accent); border-radius: var(--r-control);
  background: var(--accent); color: #fff; text-decoration: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover, button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; text-decoration: none; }
.btn:active, button:active { transform: scale(0.98); }
.btn[disabled], button[disabled] { background: var(--soft-2); border-color: var(--soft-2); color: var(--muted); cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--paper); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { background: var(--soft); border-color: var(--field); color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--soft-2); border-color: transparent; color: var(--ink); }
.btn-link { background: none; border: 0; min-height: 0; padding: 0.25rem; color: var(--accent); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 0.2em; }
.btn-link:hover { background: none; color: var(--accent-hover); text-decoration-color: currentColor; }
.btn-danger { background: var(--paper); border-color: #f1c4c4; color: var(--red); }
.btn-danger:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }
.btn-link.btn-danger { background: none; color: var(--red); text-decoration-color: #f1c4c4; }
.btn-sm { min-height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-lg { min-height: 2.75rem; }
.btn-block { width: 100%; }
button[aria-busy="true"]::after { content: ""; width: 0.9em; height: 0.9em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (pointer: coarse) { .btn, button { min-height: 2.75rem; } .btn-link { min-height: 2.75rem; } }

/* ---------- Forms ---------- */
.form > div, .field { margin-bottom: 1.1rem; }
.form label, .field > label { display: block; font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); margin-bottom: 0.35rem; }
.form .helptext { display: block; color: var(--muted); font-size: 0.8125rem; margin: 0.35rem 0 0; }
.form .helptext ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background-color: var(--paper);
  width: 100%; min-height: 2.6rem; padding: 0.5rem 0.75rem;
  border: 1px solid var(--field); border-radius: var(--r-control);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input[type=number] { max-width: 9rem; }
select { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.85rem center; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); border-radius: var(--r-control); }
input[aria-invalid="true"], .errorlist + input, .errorlist + select { border-color: var(--red); }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--accent); flex: none; margin: 0.2rem 0 0; }
input[type=file] { font: inherit; font-size: 0.875rem; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; margin-right: 0.75rem; cursor: pointer; padding: 0.4rem 0.85rem; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); color: var(--ink); }
input[type=file]::file-selector-button:hover { background: var(--soft); }
.form div:has(> input[type=checkbox]) { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: flex-start; }
.form div:has(> input[type=checkbox]) > label { order: 2; flex: 1; margin: 0; font-size: 0.875rem; font-weight: 400; color: var(--ink-2); }
.form div:has(> input[type=checkbox]) > input { order: 1; }
.form div:has(> input[type=checkbox]) > .errorlist { order: 3; flex-basis: 100%; }
.errorlist { list-style: none; margin: 0 0 0.35rem; padding: 0; color: var(--red); font-size: 0.8125rem; font-weight: 500; }
.errorlist li::before { content: "Error: "; }
.errorlist.nonfield { margin-bottom: 1rem; padding: 0.7rem 0.9rem; background: var(--red-tint); border-radius: var(--r-control); font-size: 0.875rem; }
.errorlist.nonfield li::before { content: ""; }
.form-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }
.form-note { color: var(--muted); font-size: 0.8125rem; margin: 0.25rem 0 0; }
.photo-field { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }

/* ---------- Notices ---------- */
.notices { display: grid; gap: 0.5rem; margin-bottom: 1.75rem; }
.notice { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0; max-width: none; padding: 0.7rem 0.9rem; border-radius: var(--r-control); background: var(--accent-tint); color: var(--ink); font-size: 0.875rem; }
.notice .i { color: var(--accent); margin-top: 0.15rem; }
.notice-success { background: var(--green-tint); }
.notice-success .i { color: var(--green); }
.notice-warning, .notice-error { background: var(--red-tint); }
.notice-warning .i, .notice-error .i { color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; vertical-align: middle; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
thead th { font-size: 0.8125rem; font-weight: 500; color: var(--muted); white-space: nowrap; padding-top: 0.7rem; padding-bottom: 0.6rem; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: var(--soft); }
td b, td strong { font-weight: 550; }
td small { display: block; color: var(--muted); font-size: 0.8125rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td form { margin: 0; }
.empty-state { border: 1px dashed var(--line-2); border-radius: var(--r-card); padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }
.empty-state .i { width: 1.5rem; height: 1.5rem; color: var(--accent); margin-bottom: 0.5rem; }
.empty-state h2 { margin-bottom: 0.3rem; }
.empty-state p { margin: 0 auto 1.1rem; }
@media (max-width: 40rem) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td, .table-stack td.num { display: flex; gap: 0.75rem; padding: 0.2rem 0; border: 0; text-align: left; }
  .table-stack td[data-label]::before { content: attr(data-label); flex: 0 0 6.5rem; color: var(--muted); font-size: 0.8125rem; }
}

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); border: 1px solid var(--line); border-radius: var(--r-card); margin: 0 0 2rem; }
.stats > div { padding: 1rem 1.25rem; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats dt { color: var(--muted); font-size: 0.8125rem; }
.stats dd { margin: 0.15rem 0 0; font: 600 1.6rem/1.15 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stats dd span { font-size: 0.9375rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stats dd small { display: block; margin-top: 0.15rem; font: 400 0.8125rem/1.4 var(--font); color: var(--muted); letter-spacing: 0; }
@media (max-width: 40rem) { .stats > div { border-left: 0; border-top: 1px solid var(--line); } .stats > div:first-child { border-top: 0; } }

/* ---------- Quota (EPS) ---------- */
.quota { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; list-style: none; margin: 0; padding: 0; }
.quota li { display: flex; align-items: center; gap: 0.75rem; border: 1px solid var(--line); border-radius: var(--r-card); padding: 0.75rem 1rem; }
.quota li.is-full { border-color: var(--accent-line); background: #f7fafd; }
.quota .cat { flex: 1; min-width: 0; }
.quota .cat strong { font: 600 0.8125rem var(--mono); }
.quota .cat span { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.quota .count { text-align: right; font-size: 0.8125rem; white-space: nowrap; }
.quota .count b { font-weight: 600; }
.quota .slots { justify-content: flex-end; }
.quota .slots i { width: 1.2rem; }

/* ---------- Matrix ---------- */
.matrix td.num { font-family: var(--mono); font-size: 0.8125rem; }
.matrix th[scope=row] { font-weight: 500; }
.matrix td.zero { color: #b4b4bb; }
.matrix td.full { color: var(--accent); font-weight: 700; }
.matrix th, .matrix td { padding-top: 0.55rem; padding-bottom: 0.55rem; }

/* ---------- Danger zone ---------- */
details.danger-zone { margin-top: 2.5rem; border: 1px solid #f1c4c4; border-radius: var(--r-card); }
details.danger-zone > summary { cursor: pointer; padding: 0.9rem 1.2rem; font-weight: 550; color: var(--red); list-style: none; display: flex; align-items: center; gap: 0.5rem; }
details.danger-zone > summary::-webkit-details-marker { display: none; }
details.danger-zone > summary::after { content: "+"; margin-left: auto; color: var(--muted); }
details.danger-zone[open] > summary::after { content: "–"; }
details.danger-zone > div { padding: 0 1.2rem 1.2rem; }

/* ---------- Privacy disclosure ---------- */
details.disclosure { border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 1.25rem; }
details.disclosure > summary { cursor: pointer; padding: 0.8rem 1rem; font-weight: 550; display: flex; align-items: center; gap: 0.5rem; list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "+"; margin-left: auto; color: var(--muted); }
details.disclosure[open] > summary::after { content: "–"; }
details.disclosure > div { padding: 0 1rem 0.9rem; color: var(--ink-2); font-size: 0.875rem; }
details.disclosure > div p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer p { max-width: var(--page); margin: 0 auto; padding: 1.25rem 1.5rem; color: var(--muted); font-size: 0.8125rem; }

/* ---------- Narrow screens ---------- */
@media (max-width: 48rem) {
  .topbar .in { padding: 0.6rem 1rem; gap: 0.5rem 1rem; }
  .nav { order: 3; flex-basis: 100%; min-width: 0; }
  .nav ul { gap: 1.1rem; overflow-x: auto; min-width: 0; flex: 1; scrollbar-width: none; }
  .nav li { flex: none; }
  .nav a { padding: 0.5rem 0; }
  .page { padding: 1.75rem 1rem 4rem; }
  .codebox { min-width: 0; width: 100%; }
  .who-name { display: none; }
}

/* ---------- Preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .btn:active, button:active { transform: none; }
}
@media (prefers-contrast: more) {
  :root { --line: #a1a1aa; --line-2: #8f8f99; --muted: #52525b; }
}
@media print {
  .topbar, .site-footer, .no-print, .drop, .drop-mini, .danger-zone, .skip-link { display: none !important; }
}

/* ---------- Demo site ---------- */
.demo-banner { margin: 0; max-width: none; width: 100%; box-sizing: border-box; padding: 0.5rem 1rem; text-align: center; font-size: 0.8125rem; background: #fff7e8; color: #7c3d06; border-bottom: 1px solid #f6d9a8; }
.demo-pick { margin-bottom: 1rem; }
.demo-pick h2 { margin: 0 0 0.25rem; font-size: 1rem; }
.demo-roles { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.demo-roles form { margin: 0; }
