/* Unit Roster web UI (UR-013 / UR-100). Local asset only -- no
   external fonts, no CDN, nothing fetched off-box (airgap rule).

   Theme: Standard Issue (design/THEME-BOARDS.md), the product
   default. Every colour pair below is one of the pairs computed
   and passed in design/ACCESSIBILITY-508.md section 10:
     Ink   #111417 on Paper #FFFFFF        18.48:1
     Steel #4A5560 on Paper                7.61:1
     Steel #4A5560 on Pasteboard #E4E7EA   6.13:1
     Action #1B4F72 on Paper (and reverse) 8.72:1
     Green #1E6B3A on Paper                6.52:1
     Red   #9E1B1B on Paper                8.00:1
     Black on Section fill #E8E8E8         17.14:1
   Do not introduce a pair that is not on that list without
   re-checking it against A11Y-G-4 (4.5:1 text, 3:1 non-text). */

:root {
  /* Standard Issue is a light theme. Declaring it keeps form
     controls from rendering in an unverified dark palette under
     an OS dark mode (the dark direction, Night Watch, has a
     known failing pair and is deferred -- ACCESSIBILITY-508
     section 10). */
  color-scheme: light;
  --paper: #FFFFFF;
  --ink: #111417;
  --steel: #4A5560;
  --pasteboard: #E4E7EA;
  --action: #1B4F72;
  --ok: #1E6B3A;
  --bad: #9E1B1B;
  --section-fill: #E8E8E8;
}

body { max-width: 64rem; background: var(--paper); color: var(--ink); }

/* A11Y-G-2: visible focus on every interactive element, always.
   2 px solid outline, 2 px offset, in the action colour (8.72:1
   on paper, above the 3:1 non-text floor). Nothing in this file
   removes an outline without replacing it. */
:focus { outline: 2px solid var(--action); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%); border: 0; white-space: nowrap;
}

/* A11Y-G-14: the skip link is the first Tab stop; invisible until
   focused, then fully visible in the action colours. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--action); color: var(--paper);
  padding: 0.75rem 1rem; font-weight: 700;
}
.skip-link:focus { left: 0; }

header nav ul {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem;
  list-style: none; margin: 0.5rem 0; padding: 0; align-items: center;
}
header nav .who { color: var(--steel); }

main { display: block; margin-top: 1rem; }
main h2 { margin-top: 0; }

a { color: var(--action); text-decoration: underline; }

/* A11Y-G-9: primary actions are at least 44 x 44 CSS px. */
button, .button {
  display: inline-block; min-height: 44px; min-width: 44px;
  padding: 0.55rem 1.1rem; font: inherit; font-weight: 700;
  color: var(--paper); background: var(--action);
  border: 2px solid var(--action); border-radius: 4px;
  cursor: pointer; text-decoration: none; text-align: center;
}
button.secondary, .button.secondary {
  background: var(--paper); color: var(--action);
}
button.danger { background: var(--bad); border-color: var(--bad); }
button.small { min-height: 40px; padding: 0.35rem 0.8rem; }
button[disabled] { opacity: 0.55; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1rem 0; }

form .field { margin-bottom: 1.1rem; }
form label, form legend {
  display: block; font-weight: 700; margin-bottom: 0.3rem;
}
form .check label { display: inline; font-weight: 400; }
form .check { display: flex; gap: 0.6rem; align-items: center; min-height: 44px; }
form .check input { width: 1.4rem; height: 1.4rem; flex: none; }
fieldset {
  border: 1px solid var(--steel); border-radius: 4px;
  padding: 1rem; margin: 0 0 1.4rem;
}
fieldset legend { padding: 0 0.4rem; }
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="date"], input[type="number"],
select, textarea {
  display: block; width: 100%; min-height: 44px; font: inherit;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--steel); border-radius: 4px;
  padding: 0.5rem 0.6rem; box-sizing: border-box;
}
textarea { min-height: 6rem; }
textarea.paste { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
input[aria-invalid="true"], select[aria-invalid="true"],
textarea[aria-invalid="true"] { border: 2px solid var(--bad); }
.help { color: var(--steel); margin: 0.3rem 0 0; }
.required-note { font-weight: 400; color: var(--steel); }

/* A11Y-G-6: errors are words -- a summary that takes focus, plus
   a message at each field. The red is never the only signal. */
.error-summary {
  border: 2px solid var(--bad); border-radius: 4px;
  padding: 0.8rem 1rem; margin-bottom: 1.2rem; background: var(--paper);
}
.error-summary h3 { color: var(--bad); margin: 0 0 0.4rem; }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.field-error { color: var(--bad); font-weight: 700; margin: 0.3rem 0 0; }

.status-box {
  border: 1px solid var(--steel); border-left: 6px solid var(--ok);
  border-radius: 4px; background: var(--pasteboard);
  color: var(--ink); padding: 0.8rem 1rem; margin-bottom: 1.2rem;
}
.status-box h3 { margin: 0 0 0.4rem; }

.facts { color: var(--ink); }
.facts .sep { color: var(--steel); }
dl.fact-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
dl.fact-list dt { font-weight: 700; }
dl.fact-list dd { margin: 0; }

ul.unit-list { list-style: none; padding: 0; }
ul.unit-list > li {
  border: 1px solid var(--steel); border-radius: 4px;
  padding: 0.8rem 1rem; margin-bottom: 0.8rem;
}
ul.unit-list h3 { margin: 0 0 0.3rem; }
ul.unit-list p { margin: 0.2rem 0; }

.table-scroll { overflow-x: auto; }
table.roster, table.preview {
  border-collapse: collapse; width: 100%; margin-bottom: 1.4rem;
}
table.roster th, table.roster td,
table.preview th, table.preview td {
  border: 1px solid var(--steel); padding: 0.45rem 0.6rem;
  text-align: left; vertical-align: top;
}
table.roster thead th, table.preview thead th {
  background: var(--section-fill); color: #000000;
}
/* Row-level text links are the A11Y-G-9 dense-table exception:
   at least 24 px tall, and never the only path to a destructive
   action (this UI has no destructive row actions). */
table.roster td a { display: inline-block; min-height: 24px; padding: 0.15rem 0; }

.word-chip {
  display: inline-block; border: 1px solid var(--steel);
  border-radius: 999px; padding: 0.05rem 0.6rem; margin: 0.1rem 0.2rem 0.1rem 0;
  background: var(--pasteboard); color: var(--ink); font-weight: 700;
}

.contact-row, .editor-block {
  border: 1px solid var(--steel); border-radius: 4px;
  padding: 0.8rem 1rem; margin-bottom: 0.8rem;
}
.contact-row h4, .editor-block h4 { margin: 0 0 0.6rem; }
.contact-row .grid { display: grid; gap: 0.8rem; }
@media (min-width: 40rem) {
  .contact-row .grid { grid-template-columns: 1fr 1.4fr 1fr; }
  form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
}

ul.point-list, ul.plain-list { padding-left: 1.2rem; }
ul.point-list li, ul.plain-list li { margin-bottom: 0.4rem; }
.verified-word { font-weight: 700; }

/* -- UI part 2: recalls, question sets, owner admin -------------
   Same Standard Issue pairs as above; nothing new is introduced. */

/* A11Y-R-1: a recall state is symbol + word + count. The counts
   sit beside the state chips in a wrapping row. */
.state-counts {
  list-style: none; padding: 0; margin: 0.6rem 0 1rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem;
}
.state-counts li {
  display: flex; align-items: center; gap: 0.4rem; font-weight: 700;
}
.big-accounted { font-size: 1.5rem; font-weight: 700; margin: 0.4rem 0; }

/* A11Y-R-3: answer and option rows are at least 48 px tall --
   the check-in is used standing, walking, gloved. The label
   fills the row so the whole row is the target. */
.radio-row {
  display: flex; gap: 0.6rem; align-items: center;
  min-height: 48px; border: 1px solid var(--steel);
  border-radius: 4px; padding: 0.35rem 0.6rem; margin-bottom: 0.5rem;
}
.radio-row input { width: 1.5rem; height: 1.5rem; flex: none; }
.radio-row label { flex: 1; font-weight: 400; }

/* UR-148: template thumbnails -- the live preview document
   framed at a quarter scale inside a fixed window. Inert:
   choosing happens through the radio beside it. */
.template-card { align-items: flex-start; }
.template-thumb-box {
  flex: none; width: 180px; height: 132px; overflow: hidden;
  border: 1px solid var(--steel); background: #fff;
  position: relative;
}
.template-thumb {
  width: 720px; height: 528px; border: 0;
  transform: scale(0.25); transform-origin: top left;
  pointer-events: none;
}

/* UR-145: the current logo in the designer. */
.logo-preview { max-width: 92px; max-height: 80px; display: block; }

/* UR-149: the per-group new-row toggle in Arrange mode. */
.arrange-shelf-toggle {
  display: inline-flex; gap: 0.35rem; align-items: center;
  margin-left: 0.8rem; font-weight: 400;
}
.arrange-shelf-toggle input { width: 1.25rem; height: 1.25rem; }

/* UR-151 / UR-152: the unit settings section. */
.unit-settings { margin-top: 2rem; }
.check-row {
  display: flex; gap: 0.5rem; align-items: center;
  min-height: 40px; font-weight: 400;
}
.check-row input { width: 1.25rem; height: 1.25rem; flex: none; }
.check-row.inline { display: inline-flex; margin-right: 0.8rem; }

.checkin-panel {
  border: 2px solid var(--action); border-radius: 4px;
  padding: 1rem; margin: 1rem 0;
}
.checkin-panel h3 { margin-top: 0; }
.checkin-submit { width: 100%; min-height: 52px; }

/* A11Y-G-6: the inline confirmation step for hard-to-reverse
   actions. Words carry it; the border is decoration. */
.confirm-box {
  border: 2px solid var(--action); border-radius: 4px;
  padding: 0.8rem 1rem; margin: 1rem 0; background: var(--paper);
}
.confirm-box.danger { border-color: var(--bad); }
.confirm-box h3 { margin: 0 0 0.4rem; }

.final-banner {
  border: 2px solid var(--ink); border-radius: 4px;
  background: var(--section-fill); color: #000000;
  padding: 0.8rem 1rem; margin-bottom: 1.2rem;
}
.final-banner h3 { margin: 0 0 0.4rem; }
.final-banner p { margin: 0.2rem 0; }

.poll-line {
  color: var(--steel); display: flex; flex-wrap: wrap;
  gap: 0.5rem 0.75rem; align-items: center;
}

.invite-token {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pre-wrap { white-space: pre-wrap; }

.option-row {
  border-top: 1px solid var(--pasteboard);
  padding: 0.6rem 0 0.2rem; margin-top: 0.6rem;
}
.option-row h5 { margin: 0 0 0.5rem; font-size: 1rem; }

/* Roster designer (UR-040). The block list is one Tab stop with
   roving focus (aria-activedescendant); the focused row carries a
   visible outline in Action on Paper (8.72:1, a passed pair). */
.block-list {
  border: 1px solid var(--steel);
  border-radius: 6px;
  overflow: hidden;
}
.block-item {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.4rem 0.9rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--pasteboard);
  background: var(--paper);
}
.block-item:last-child { border-bottom: none; }
.block-item.block-focused {
  outline: 3px solid var(--action);
  outline-offset: -3px;
}
.block-item.block-anchor { background: var(--section-fill); }
.block-item .block-name { font-weight: 700; min-width: 11rem; }
.block-item .block-zone { color: var(--steel); flex: 1; }
.block-item .block-state { font-weight: 700; }
.block-item .block-controls { display: flex; gap: 0.4rem; }
.block-item .block-controls button { min-height: 2.75rem; }

.designer-preview {
  width: 100%; height: 36rem;
  border: 1px solid var(--steel);
  background: var(--paper);
}
.designer-save-state { margin-top: 1rem; }
.designer-form fieldset { margin-bottom: 1rem; }

/* Arrange chart (UR-045): the manual chart arrangement as
   labelled column stacks. Every operation is a button (the
   GAP-005 rule: a pointer is never the only way), so there is
   no roving-focus machinery here -- plain tab order, visible
   labels, target sizes like the block list's. */
.arrange-group {
  border: 1px solid var(--steel);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--paper);
}
.arrange-group-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.4rem 0.9rem; margin: 0 0 0.5rem;
}
.arrange-columns {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: flex-start;
}
.arrange-column {
  border: 1px solid var(--pasteboard);
  border-radius: 6px;
  padding: 0.5rem;
  min-width: 14rem;
}
.arrange-column-head { font-weight: 700; margin: 0 0 0.4rem; }
.arrange-block {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.3rem 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--pasteboard);
}
.arrange-block:last-of-type { border-bottom: none; }
.arrange-block-name { font-weight: 700; flex: 1; }
.arrange-controls { display: flex; gap: 0.3rem; }
.arrange-controls button { min-height: 2.75rem; }

/* Search (UR-026): the header search box and the roster filter.
   Layout only -- colours stay the Standard Issue variables. */
.nav-search { margin-top: 0.75rem; }
.nav-search .field { margin-bottom: 0.25rem; }
.roster-filter { margin: 1rem 0; }
.roster-filter .field { margin-bottom: 0.25rem; }

/* Step-up prompt (UR-119) + MFA (UR-118): the confirm overlay
   and the recovery-code list. Layout only -- colours stay the
   Standard Issue variables. */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem; overflow-y: auto;
}
.dialog {
  background: var(--paper, #fff); color: var(--ink, #111);
  max-width: 30rem; width: 100%;
  border: 2px solid var(--ink, #111); padding: 1rem 1.25rem 1.25rem;
}
.recovery-codes { columns: 2; }
.recovery-codes li { break-inside: avoid; margin-bottom: 0.35rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none; transition: none; }
}
