/*
 * gate.css, CrewGate.
 * The redesign's own system: tokens, the base and the type roles.
 *
 * Nothing here reaches outside CrewGate's new screens. Every rule applies
 * inside an element with the class "gate", or to a class that starts with
 * "gate-", and every token is named --g-*, so a page can load this beside
 * the platform stylesheet and neither changes the other. The platform's
 * own custom properties keep their names and values.
 *
 * Breakpoints, which a custom property cannot express inside a media
 * query: 600px, 900px and 1280px, the only three any screen uses.
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/platform/assets/fonts/inter-latin-var.woff2") format("woff2");
}

.gate {
  /* ── ink ── text, from strongest to disabled. Disabled is never used
     for words that have to be read: it measures 3:1 on white. */
  --g-ink: #16212E;
  --g-ink-2: #3D4B5C;
  --g-ink-3: #5F6D7E;
  --g-ink-disabled: #8C97A5;

  /* ── surfaces ── the ground under a page, what sits on it, and the two
     lines. --g-line separates (cards, rows, the bar); --g-control-line
     outlines a field or a control, and meets 3:1 against white and
     against the ground so a field can be found by its edge. */
  --g-ground: #F2F4F7;
  --g-surface: #FFFFFF;
  --g-sunken: #F7F8FA;
  --g-hover: #F0F3F7;
  --g-selected: #E8F1F9;
  --g-line: #E2E7ED;
  --g-control-line: #7F8A98;

  /* ── accent ── white on --g-accent reads at 6.0:1. */
  --g-accent: #0A66A8;
  --g-accent-hover: #08578F;
  --g-accent-weak: #E7F1F9;
  --g-accent-text: #0A5C97;
  --g-focus: #0A66A8;

  /* ── status ── one meaning per colour: OK and No gaps are ok; Gaps,
     Skipped, Missing docs and REDO are warn; Query is info; NO, FAIL and
     blockers are bad; Checking and Reviewed are neutral. */
  --g-ok: #1B6B3F;      --g-ok-bg: #E3F2E9;      --g-ok-line: #B7DCC6;
  --g-warn: #8A5100;    --g-warn-bg: #FCF0DA;    --g-warn-line: #EFD39F;
  --g-info: #1B5A9C;    --g-info-bg: #E7EFF9;    --g-info-line: #C3D6EE;
  --g-bad: #A5271C;     --g-bad-bg: #FBE8E5;     --g-bad-line: #EFC3BD;
  --g-bad-hover: #8B2017;
  --g-neutral: #4E5B6B; --g-neutral-bg: #EDF1F5; --g-neutral-line: #D5DCE4;

  /* ── check-in dots ── always with the word beside them. */
  --g-dot-open: #1F9D55;
  --g-dot-closed: #D0342C;

  /* ── timeline ── the history bar and its legend. */
  --g-tl-work: #0A66A8;
  --g-tl-education: #7FAAD6;
  --g-tl-additional: #6E9C8E;
  --g-tl-explained: #C8D1DC;
  --g-tl-gap: #D98A1F;

  /* ── type ── Inter, weights 400, 500 and 600 only. */
  --g-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --g-size-page: 24px;    --g-leading-page: 32px;
  --g-size-record: 22px;  --g-leading-record: 28px;
  --g-size-section: 16px; --g-leading-section: 24px;
  --g-size-body: 14px;    --g-leading-body: 20px;
  --g-size-meta: 13px;    --g-leading-meta: 18px;
  --g-size-caption: 12px; --g-leading-caption: 16px;

  /* ── space ── every gap and padding comes from this list. */
  --g-space-1: 4px;
  --g-space-2: 8px;
  --g-space-3: 12px;
  --g-space-4: 16px;
  --g-space-5: 20px;
  --g-space-6: 24px;
  --g-space-7: 32px;
  --g-space-8: 48px;

  /* ── shape ── controls, cards and tiles, overlays, badges. */
  --g-radius-control: 6px;
  --g-radius-card: 10px;
  --g-radius-overlay: 14px;
  --g-radius-pill: 999px;

  /* ── depth ── only what floats casts a shadow. */
  --g-shadow-raised: 0 1px 2px rgba(22, 33, 46, .06);
  --g-shadow-popover: 0 8px 24px rgba(22, 33, 46, .12), 0 2px 6px rgba(22, 33, 46, .06);
  --g-shadow-overlay: 0 24px 64px rgba(22, 33, 46, .22), 0 4px 12px rgba(22, 33, 46, .08);
  --g-scrim: rgba(22, 33, 46, .38);

  /* ── layers ── overlays stack in the order they open. */
  --g-layer-sticky: 10;
  --g-layer-popover: 20;
  --g-layer-sheet: 30;
  --g-layer-dialog: 40;
  --g-layer-toast: 50;

  /* ── motion ── a change explained, and nothing else. */
  --g-duration-fast: 120ms;
  --g-duration-base: 200ms;
  --g-duration-slow: 300ms;
  --g-ease: cubic-bezier(.2, 0, 0, 1);

  font-family: var(--g-font);
  font-size: var(--g-size-body);
  line-height: var(--g-leading-body);
  font-weight: 400;
  color: var(--g-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* One switch for motion: the system setting, or CrewGate's own (the
   platform's reduce-motion class on the body). Either one stills it all. */
@media (prefers-reduced-motion: reduce) {
  .gate { --g-duration-fast: 0ms; --g-duration-base: 0ms; --g-duration-slow: 0ms; }
}
body.reduce-motion .gate,
.gate.reduce-motion { --g-duration-fast: 0ms; --g-duration-base: 0ms; --g-duration-slow: 0ms; }

/* ── base ────────────────────────────────────────────────────
   Inside .gate the platform's element rules stop counting: headings take
   their size from a role, not from their level, and paragraphs, buttons and
   fields take the system's type. The .gate class alone outranks the
   platform's bare h1, h2 and a rules; :where() keeps it at that, so any
   gate- class written after it still wins. */
.gate *, .gate *::before, .gate *::after { box-sizing: border-box; }
/* hidden means hidden, whatever display a component gives itself. */
.gate [hidden], .gate[hidden] { display: none !important; }
.gate :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin: 0; }
.gate :where(h1, h2, h3, h4, h5, h6) {
  font: inherit; letter-spacing: normal; text-transform: none; text-wrap: initial; color: inherit;
}
.gate :where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: inherit; }
.gate :where(a) { color: var(--g-accent-text); text-underline-offset: 2px; }
.gate :focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate ::selection { background: var(--g-accent-weak); color: var(--g-ink); }

/* ── type roles ─────────────────────────────────────────────── */
.gate-text-page    { font-size: var(--g-size-page);    line-height: var(--g-leading-page);    font-weight: 600; letter-spacing: -.012em; }
.gate-text-record  { font-size: var(--g-size-record);  line-height: var(--g-leading-record);  font-weight: 600; letter-spacing: -.01em; }
.gate-text-section { font-size: var(--g-size-section); line-height: var(--g-leading-section); font-weight: 600; }
.gate-text-body    { font-size: var(--g-size-body);    line-height: var(--g-leading-body);    font-weight: 400; }
.gate-text-meta    { font-size: var(--g-size-meta);    line-height: var(--g-leading-meta);    font-weight: 400; color: var(--g-ink-3); }
.gate-text-label   { font-size: var(--g-size-meta);    line-height: var(--g-leading-meta);    font-weight: 600; color: var(--g-ink-2); }
.gate-text-caption { font-size: var(--g-size-caption); line-height: var(--g-leading-caption); font-weight: 500; color: var(--g-ink-3); }
.gate-num { font-variant-numeric: tabular-nums; }

/* ── icons ──────────────────────────────────────────────────── */
.gate-icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.gate-icon-20 { width: 20px; height: 20px; }

/* ════════════════════════════════════════════════════════════
   Components. Each has its states written out, and each works by
   keyboard; gate.js carries the behaviour the markup cannot.
   ════════════════════════════════════════════════════════════ */

/* ── layout helpers ─────────────────────────────────────────── */
.gate-row     { display: flex; align-items: center; gap: var(--g-space-2); }
.gate-row--end { justify-content: flex-end; }
.gate-wrap    { flex-wrap: wrap; }
.gate-between { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); }
.gate-stack   { display: grid; gap: var(--g-space-4); align-content: start; }
.gate-stack-tight { display: grid; gap: var(--g-space-2); align-content: start; }
.gate-hidden-text {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.gate-locked { overflow: hidden; }

/* ── buttons ────────────────────────────────────────────────
   One word on each. Primary, secondary, tertiary, danger; 36px, or 32px
   small; 44px wherever the pointer is a finger. Never full width in a
   form. Danger is for the confirming press only. */
.gate-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--g-space-2);
  height: 36px; padding: 0 14px; border-radius: var(--g-radius-control);
  border: 1px solid var(--g-control-line); background: var(--g-surface); color: var(--g-ink);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--g-duration-fast) var(--g-ease), border-color var(--g-duration-fast) var(--g-ease),
              color var(--g-duration-fast) var(--g-ease);
}
.gate-btn:hover { background: var(--g-hover); color: var(--g-ink); }
.gate-btn:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-btn--primary { background: var(--g-accent); border-color: var(--g-accent); color: #FFFFFF; }
.gate-btn--primary:hover { background: var(--g-accent-hover); border-color: var(--g-accent-hover); color: #FFFFFF; }
.gate-btn--tertiary { background: transparent; border-color: transparent; color: var(--g-ink-2); }
.gate-btn--tertiary:hover { background: var(--g-hover); color: var(--g-ink); }
.gate-btn--danger { background: var(--g-bad); border-color: var(--g-bad); color: #FFFFFF; }
.gate-btn--danger:hover { background: var(--g-bad-hover); border-color: var(--g-bad-hover); color: #FFFFFF; }
.gate-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.gate-btn--icon { width: 36px; padding: 0; }
.gate-btn--icon.gate-btn--sm { width: 32px; }
.gate-btn:disabled, .gate-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.gate-btn.is-armed { background: var(--g-bad-bg); border-color: var(--g-bad); color: var(--g-bad); }
.gate-btn[aria-busy="true"] { cursor: progress; }
.gate-btn[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: gate-spin 700ms linear infinite;
}
.gate-btn-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--g-radius-pill); font-size: 12px; font-weight: 700; line-height: 1;
  background: var(--g-neutral-bg); color: var(--g-ink-2);
}
.gate-btn--primary .gate-btn-count { background: rgba(255, 255, 255, .22); color: #FFFFFF; }
@media (pointer: coarse) {
  .gate-btn { min-height: 44px; }
  .gate-btn--icon { min-width: 44px; }
}

/* ── badges, dots, chips, counts ────────────────────────────
   A word always rides with the colour; the colour is never the message. */
.gate-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--g-radius-pill); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--g-neutral-bg); color: var(--g-neutral);
}
.gate-badge--ok   { background: var(--g-ok-bg);   color: var(--g-ok); }
.gate-badge--warn { background: var(--g-warn-bg); color: var(--g-warn); }
.gate-badge--info { background: var(--g-info-bg); color: var(--g-info); }
.gate-badge--bad  { background: var(--g-bad-bg);  color: var(--g-bad); }
.gate-badge--lg   { height: 28px; padding: 0 10px; font-size: 13px; }

.gate-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--g-ink-2); white-space: nowrap; }
.gate-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--g-dot-closed); }
.gate-status--open::before { background: var(--g-dot-open); }

.gate-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 10px;
  border-radius: var(--g-radius-pill); border: 1px solid var(--g-neutral-line);
  font-size: 12px; font-weight: 600; line-height: 18px; background: var(--g-surface); color: var(--g-ink-2);
}
.gate-chip--warn { background: var(--g-warn-bg); color: var(--g-warn); border-color: var(--g-warn-line); }
.gate-chip--bad  { background: var(--g-bad-bg);  color: var(--g-bad);  border-color: var(--g-bad-line); }
.gate-chip--info { background: var(--g-info-bg); color: var(--g-info); border-color: var(--g-info-line); }
button.gate-chip { cursor: pointer; }
button.gate-chip:hover { border-color: var(--g-control-line); }
button.gate-chip:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; }

.gate-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: var(--g-radius-pill); background: var(--g-neutral-bg); color: var(--g-ink-2);
  font-size: 12px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.gate-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--g-accent-weak); color: var(--g-accent-text); font-size: 12px; font-weight: 700;
}
.gate-spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: gate-spin 700ms linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .gate .gate-spinner, .gate .gate-btn[aria-busy="true"]::before { animation: none; }
}
body.reduce-motion .gate .gate-spinner, body.reduce-motion .gate .gate-btn[aria-busy="true"]::before { animation: none; }

/* ── fields ─────────────────────────────────────────────────
   A label above every field; a placeholder is never the only name. The
   edge meets 3:1, focus draws the ring, an error names itself under the
   field. 16px text on phones, so nothing zooms. */
.gate-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.gate-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--g-ink-2); }
.gate-input, .gate-select, .gate-textarea {
  display: block; width: 100%; min-height: 36px; margin: 0; padding: 7px 12px;
  background: var(--g-surface); color: var(--g-ink); border: 1px solid var(--g-control-line);
  border-radius: var(--g-radius-control); font-size: 14px; line-height: 20px;
  transition: border-color var(--g-duration-fast) var(--g-ease), box-shadow var(--g-duration-fast) var(--g-ease);
}
.gate-input::placeholder, .gate-textarea::placeholder { color: var(--g-ink-3); opacity: 1; }
.gate-input:hover, .gate-select:hover, .gate-textarea:hover { border-color: var(--g-ink-3); }
.gate-input:focus, .gate-select:focus, .gate-textarea:focus { outline: none; border-color: var(--g-focus); box-shadow: 0 0 0 1px var(--g-focus); }
.gate-input:focus-visible, .gate-select:focus-visible, .gate-textarea:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 1px; box-shadow: none; }
.gate-input[aria-invalid="true"], .gate-select[aria-invalid="true"], .gate-textarea[aria-invalid="true"] { border-color: var(--g-bad); }
.gate-input:disabled, .gate-select:disabled, .gate-textarea:disabled { background: var(--g-sunken); color: var(--g-ink-disabled); cursor: not-allowed; }
.gate-textarea { min-height: 88px; resize: vertical; }
.gate-select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6D7E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px 16px;
}
.gate-field-error { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--g-bad); }
.gate-search { position: relative; display: flex; align-items: center; min-width: 0; }
.gate-search > .gate-icon { position: absolute; left: 11px; color: var(--g-ink-3); pointer-events: none; }
.gate-search > .gate-input { padding-left: 34px; }
/* A date is a short answer: the button is as wide as a date, never the row. */
.gate-date { display: inline-flex; align-items: center; gap: var(--g-space-2); width: auto; min-width: 190px; max-width: 100%; justify-self: start; text-align: left; cursor: pointer; }
.gate-date > .gate-icon { color: var(--g-ink-3); }
.gate-date:not([data-value]) , .gate-date[data-value=""] { color: var(--g-ink-3); }
@media (max-width: 600px) {
  .gate-input, .gate-select, .gate-textarea { font-size: 16px; }
}

/* Calendar: Monday first, today outlined, the chosen day filled. */
.gate-popover-anchor { position: relative; }
.gate-field > .gate-popover-anchor:has(> .gate-date) { justify-self: start; max-width: 100%; }
.gate-calendar {
  position: absolute; z-index: var(--g-layer-popover); top: calc(100% + 6px); left: 0; width: 292px;
  padding: var(--g-space-3); background: var(--g-surface); border: 1px solid var(--g-line);
  border-radius: var(--g-radius-card); box-shadow: var(--g-shadow-popover);
}
.gate-calendar[hidden] { display: none; }
.gate-calendar--end { left: auto; right: 0; }
.gate-calendar--float { position: fixed; top: 0; left: 0; right: auto; }
.gate-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-2); margin-bottom: var(--g-space-2); }
.gate-calendar-title { font-size: 14px; font-weight: 600; }
.gate-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.gate-calendar-grid--months { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gate-calendar-dow { height: 24px; display: grid; place-items: center; font-size: 12px; font-weight: 500; color: var(--g-ink-3); }
.gate-calendar-cell {
  height: 36px; border: 0; border-radius: var(--g-radius-control); background: transparent; color: var(--g-ink);
  font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.gate-calendar-cell:hover { background: var(--g-hover); }
.gate-calendar-cell:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 1px; }
.gate-calendar-cell.is-today { box-shadow: inset 0 0 0 1px var(--g-control-line); }
.gate-calendar-cell[aria-selected="true"] { background: var(--g-accent); color: #FFFFFF; font-weight: 600; }
.gate-calendar-cell.is-outside { color: var(--g-ink-3); }

/* Segmented control: real radios, so arrows move between the options. */
.gate-seg {
  display: inline-flex; flex-wrap: wrap; padding: 2px; gap: 2px; background: var(--g-sunken);
  border: 1px solid var(--g-line); border-radius: 8px; margin: 0; min-width: 0;
}
.gate-seg > label { position: relative; display: inline-flex; }
.gate-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.gate-seg span {
  display: inline-grid; place-items: center; min-width: 36px; height: 32px; padding: 0 12px;
  border-radius: var(--g-radius-control); font-size: 13px; font-weight: 600; color: var(--g-ink-3); white-space: nowrap;
}
.gate-seg input:hover + span { color: var(--g-ink); }
.gate-seg input:checked + span { background: var(--g-surface); color: var(--g-ink); box-shadow: var(--g-shadow-raised), 0 0 0 1px var(--g-line); }
.gate-seg--accent input:checked + span { background: var(--g-accent); color: #FFFFFF; box-shadow: none; }
.gate-seg input:focus-visible + span { outline: 2px solid var(--g-focus); outline-offset: 1px; }
.gate-seg input:disabled + span { opacity: .45; }
.gate-seg input:disabled { cursor: not-allowed; }
@media (pointer: coarse) { .gate-seg span { height: 44px; } }

.gate-check { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--g-accent); cursor: pointer; }
.gate-check-label { display: inline-flex; align-items: center; gap: var(--g-space-2); cursor: pointer; }

/* ── tabs ───────────────────────────────────────────────────── */
.gate-tabs {
  display: flex; gap: var(--g-space-6); border-bottom: 1px solid var(--g-line);
  overflow-x: auto; scrollbar-width: none;
}
.gate-tabs::-webkit-scrollbar { display: none; }
.gate-tab {
  display: inline-flex; align-items: center; gap: var(--g-space-2); height: 40px; padding: 0; margin: 0;
  border: 0; background: none; color: var(--g-ink-3); font-size: 14px; font-weight: 500;
  white-space: nowrap; text-decoration: none; cursor: pointer; box-shadow: inset 0 -2px 0 transparent;
}
.gate-tab:hover { color: var(--g-ink); }
.gate-tab:focus-visible { outline: 2px solid var(--g-focus); outline-offset: -2px; border-radius: 4px; }
.gate-tab[aria-selected="true"], .gate-tab[aria-current="page"] { color: var(--g-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--g-accent); }
.gate-tab .gate-count { height: 18px; min-width: 20px; font-size: 11px; }
.gate-tabpanel[hidden] { display: none; }
@media (pointer: coarse) { .gate-tab { height: 44px; } }

/* ── cards and tables ───────────────────────────────────────── */
.gate-card { background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius-card); min-width: 0; }
.gate-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); padding: 14px 16px 0; }
.gate-card-title { font-size: 14px; line-height: 20px; font-weight: 600; }
.gate-card-body { padding: 12px 16px 16px; }
.gate-card--flush { overflow: hidden; }
.gate-card--flush > .gate-card-head { padding: 12px 16px; border-bottom: 1px solid var(--g-line); }

.gate-table-wrap { overflow-x: auto; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius-card); }
.gate-card > .gate-table-wrap { border: 0; border-radius: 0; }
.gate-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.gate-table th {
  height: 40px; padding: 0 16px; text-align: left; vertical-align: middle; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--g-ink-3); background: var(--g-sunken); border-bottom: 1px solid var(--g-line);
}
.gate-table th .gate-sort {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer;
}
.gate-table th .gate-sort:hover { color: var(--g-ink); }
.gate-table th .gate-sort:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; border-radius: 4px; }
.gate-table th[aria-sort="ascending"] .gate-sort::after { content: "↑"; }
.gate-table th[aria-sort="descending"] .gate-sort::after { content: "↓"; }
.gate-table td { height: 52px; padding: 8px 16px; vertical-align: middle; border-bottom: 1px solid var(--g-line); }
.gate-table tbody tr:last-child td { border-bottom: 0; }
.gate-table tbody tr[data-href] { cursor: pointer; }
.gate-table tbody tr[data-href]:hover td { background: var(--g-hover); }
.gate-table tbody tr[aria-selected="true"] td { background: var(--g-selected); }
.gate-table .is-right { text-align: right; }
.gate-table .is-nowrap { white-space: nowrap; }
.gate-cell-strong { font-weight: 600; color: var(--g-ink); }
a.gate-cell-strong { text-decoration: none; }
a.gate-cell-strong:hover { text-decoration: underline; }
.gate-cell-sub { display: block; font-size: 13px; line-height: 18px; color: var(--g-ink-3); font-weight: 400; }
.gate-table-empty td { height: 96px; text-align: center; color: var(--g-ink-3); }

.gate-pager {
  display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); padding: 10px 16px;
  font-size: 13px; color: var(--g-ink-3); border-top: 1px solid var(--g-line); font-variant-numeric: tabular-nums;
}
.gate-empty { display: grid; justify-items: center; gap: var(--g-space-3); padding: var(--g-space-7) var(--g-space-4); text-align: center; color: var(--g-ink-3); }
.gate-empty--page { padding-top: 96px; color: var(--g-ink); }

/* ── log: a tool's own output, line by line ─────────────────────── */
.gate-log {
  margin: 0; padding: 10px 12px; list-style: none; max-height: 360px; overflow: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 20px;
  color: var(--g-ink-2); background: var(--g-sunken); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.gate-log:empty { display: none; }
.gate-log .is-muted { color: var(--g-ink-3); }

/* ── outcome: what a run did, group by group ────────────────────── */
.gate-outcome { display: grid; }
.gate-outcome:empty { display: none; }
.gate-outcome-group { padding: 10px 0; border-top: 1px solid var(--g-line); }
.gate-outcome-group:first-child { padding-top: 0; border-top: 0; }
.gate-outcome-group:last-child { padding-bottom: 0; }
.gate-outcome-head { display: flex; align-items: center; gap: var(--g-space-2); margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.gate-outcome-list { display: grid; gap: 2px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; color: var(--g-ink-2); overflow-wrap: anywhere; }
.gate-outcome-group.is-bad .gate-outcome-list { color: var(--g-bad); }

/* ── menus ──────────────────────────────────────────────────── */
.gate-menu-anchor { position: relative; display: inline-flex; }
.gate-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: var(--g-layer-popover);
  min-width: 200px; padding: 6px; background: var(--g-surface); border: 1px solid var(--g-line);
  border-radius: var(--g-radius-card); box-shadow: var(--g-shadow-popover);
}
.gate-menu[hidden] { display: none; }
.gate-menu--start { right: auto; left: 0; }
.gate-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; margin: 0;
  border: 0; border-radius: var(--g-radius-control); background: none; color: var(--g-ink);
  font-size: 14px; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.gate-menu-item:hover, .gate-menu-item:focus-visible { background: var(--g-hover); outline: none; }
.gate-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--g-focus); }
.gate-menu-item[aria-checked="true"] { font-weight: 600; }
.gate-menu-item--danger { color: var(--g-bad); }
.gate-menu-item[aria-disabled="true"] { color: var(--g-ink-disabled); cursor: not-allowed; }
.gate-menu-sep { height: 1px; margin: 6px 0; border: 0; background: var(--g-line); }
@media (pointer: coarse) { .gate-menu-item { min-height: 44px; } }

/* ── overlays: dialog, drawer, focus sheet ──────────────────────
   Mounted at the page, stacked in the order they open (gate.js sets the
   layer), focus held inside, Escape closes the top one only. */
.gate-overlay {
  position: fixed; inset: 0; z-index: var(--g-layer-dialog);
  display: flex; align-items: center; justify-content: center; padding: var(--g-space-6);
  background: var(--g-scrim); animation: gate-fade var(--g-duration-fast) var(--g-ease);
}
.gate-overlay[hidden] { display: none; }
.gate-overlay--drawer { justify-content: flex-end; align-items: stretch; padding: 0; z-index: var(--g-layer-sheet); }
.gate-overlay--sheet { align-items: stretch; padding: var(--g-space-7) var(--g-space-6); z-index: var(--g-layer-sheet); }

.gate-dialog {
  width: min(440px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: var(--g-space-6);
  background: var(--g-surface); border-radius: var(--g-radius-overlay); box-shadow: var(--g-shadow-overlay);
  animation: gate-rise var(--g-duration-base) var(--g-ease);
}
.gate-dialog--merge { width: min(500px, 100%); }
.gate-dialog--wide { width: min(640px, 100%); }
.gate-dialog-title { font-size: 18px; line-height: 26px; font-weight: 600; margin-bottom: var(--g-space-4); }
.gate-dialog-title:focus { outline: none; }
.gate-dialog-body { display: grid; gap: var(--g-space-4); }
.gate-dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--g-space-2); margin-top: var(--g-space-6); }

.gate-drawer {
  width: min(560px, 100%); height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--g-surface); box-shadow: var(--g-shadow-overlay);
  animation: gate-slide var(--g-duration-base) var(--g-ease);
}
.gate-drawer--wide { width: min(620px, 100%); }
.gate-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); padding: 16px 24px; border-bottom: 1px solid var(--g-line); }
.gate-drawer-title { font-size: 18px; line-height: 26px; font-weight: 600; }
.gate-drawer-title:focus { outline: none; }
.gate-drawer-body { padding: 20px 24px; overflow: auto; display: grid; align-content: start; gap: var(--g-space-5); }
.gate-drawer-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--g-space-2); padding: 16px 24px; border-top: 1px solid var(--g-line); }

.gate-sheet {
  width: min(1120px, 100%); margin: 0 auto; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--g-surface); border-radius: var(--g-radius-overlay); box-shadow: var(--g-shadow-overlay); overflow: hidden;
  animation: gate-rise var(--g-duration-slow) var(--g-ease);
}
.gate-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); padding: 16px 24px; border-bottom: 1px solid var(--g-line); }
.gate-sheet-title { font-size: 18px; line-height: 26px; font-weight: 600; }
.gate-sheet-title:focus { outline: none; }
.gate-sheet-main { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; }
.gate-steps { display: grid; align-content: start; gap: 2px; padding: 16px 12px; background: var(--g-sunken); border-right: 1px solid var(--g-line); overflow: auto; }
.gate-step {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; color: var(--g-ink-2); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.gate-step:hover { background: var(--g-hover); color: var(--g-ink); }
.gate-step:focus-visible { outline: 2px solid var(--g-focus); outline-offset: -2px; }
.gate-step[aria-current="step"] { background: var(--g-surface); color: var(--g-ink); font-weight: 600; box-shadow: var(--g-shadow-raised), 0 0 0 1px var(--g-line); }
.gate-step-mark {
  width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--g-surface); border: 1px solid var(--g-control-line); color: var(--g-ink-3);
}
.gate-step.is-done .gate-step-mark { background: var(--g-ok-bg); border-color: var(--g-ok-line); color: var(--g-ok); }
.gate-step .gate-count { margin-left: auto; }
.gate-sheet-content { padding: 24px 32px; overflow: auto; display: grid; align-content: start; gap: var(--g-space-5); }
.gate-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); padding: 12px 24px; border-top: 1px solid var(--g-line); }

@keyframes gate-fade  { from { opacity: 0; } }
@keyframes gate-rise  { from { opacity: 0; transform: translateY(12px); } }
@keyframes gate-slide { from { opacity: 0; transform: translateX(24px); } }

@media (max-width: 900px) {
  .gate-overlay { padding: var(--g-space-4); }
  .gate-overlay.gate-overlay--sheet, .gate-overlay.gate-overlay--drawer { padding: 0; }
  .gate-sheet { border-radius: 0; width: 100%; }
  .gate-sheet-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .gate-steps { display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--g-line); }
  .gate-step { flex: none; }
  .gate-sheet-content { padding: 20px 16px; }
  .gate-drawer, .gate-drawer--wide { width: 100%; }
}

/* ── messages ───────────────────────────────────────────────── */
.gate-toaster {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: var(--g-layer-toast); display: grid; gap: var(--g-space-2); justify-items: center; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.gate-toast {
  padding: 10px 16px; border-radius: 8px; background: var(--g-ink); color: #FFFFFF; box-shadow: var(--g-shadow-popover);
  font-size: 14px; line-height: 20px; font-weight: 500; animation: gate-rise var(--g-duration-base) var(--g-ease);
}
.gate-toast--action { display: flex; align-items: center; gap: var(--g-space-4); pointer-events: auto; }
.gate-toast-action {
  margin: -4px -6px -4px 0; padding: 4px 6px; border: 0; border-radius: 4px; background: none; color: #FFFFFF;
  font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.gate-toast-action:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 1px; }
.gate-notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--g-warn-bg); color: var(--g-warn); font-size: 13px; line-height: 18px; font-weight: 500;
}
.gate-notice > .gate-icon { margin-top: 1px; }
.gate-notice > :not(.gate-icon) { flex: 1; min-width: 0; }
.gate-notice--info { background: var(--g-info-bg); color: var(--g-info); }
.gate-notice--bad  { background: var(--g-bad-bg);  color: var(--g-bad); }
.gate-notice--ok   { background: var(--g-ok-bg);   color: var(--g-ok); }

/* ── document tiles ─────────────────────────────────────────────
   The face, the kind, the facts. Actions sit over the face on hover and
   focus, never over the words, and live in ⋯ where there is no hover. */
.gate-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--g-space-4); }
.gate-tile {
  position: relative; display: grid; grid-template-rows: auto 1fr; min-width: 0;
  background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius-card); overflow: hidden;
}
.gate-tile:focus-within { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-tile.is-picked { border-color: var(--g-accent); box-shadow: 0 0 0 1px var(--g-accent); }
.gate-tile.is-flagged { border-color: var(--g-warn-line); }
.gate-tile.is-busy { pointer-events: none; }
.gate-tile.is-busy .gate-tile-thumb { opacity: .5; }
.gate-tile.is-dragging { opacity: .5; }
.gate-tile.is-drop-target { border-color: var(--g-accent); box-shadow: 0 0 0 2px var(--g-accent); background: var(--g-accent-weak); }
.gate-tile-thumb { position: relative; height: 196px; display: grid; place-items: center; overflow: hidden; background: var(--g-sunken); }
.gate-tile-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.gate-tile[data-file], .gate-tile[data-file] .gate-tile-thumb { cursor: pointer; }
.gate-tile-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--g-space-2); padding: 10px 12px; }
.gate-tile-kind { font-size: 13px; line-height: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-tile-meta { grid-column: 1; font-size: 12px; line-height: 16px; color: var(--g-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-tile-foot .gate-menu-anchor { grid-column: 2; grid-row: 1 / span 2; }
.gate-tile-pick {
  position: absolute; top: 10px; left: 10px; z-index: 2; width: 26px; height: 26px; margin: 0; border-radius: 50%;
  border: 1.5px solid var(--g-control-line); background: rgba(255, 255, 255, .96); color: var(--g-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums;
}
.gate-tile-pick:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-tile.is-picked .gate-tile-pick { background: var(--g-accent); border-color: var(--g-accent); color: #FFFFFF; }
.gate-tile-stamp { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 4px; }
.gate-tile-actions {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 2; display: flex; justify-content: center; gap: 6px;
  opacity: 0; transition: opacity var(--g-duration-fast) var(--g-ease);
}
.gate-tile:hover .gate-tile-actions, .gate-tile:focus-within .gate-tile-actions { opacity: 1; }
.gate-tile-actions .gate-btn { background: var(--g-surface); box-shadow: var(--g-shadow-raised); }
@media (hover: none) { .gate-tile-actions { display: none; } }
.gate-tile--missing {
  display: grid; place-items: center; align-content: center; gap: var(--g-space-2); min-height: 250px; padding: var(--g-space-4);
  border: 1.5px dashed var(--g-control-line); background: transparent; text-align: center; color: var(--g-ink-3);
}
.gate-tile--missing .gate-tile-kind { white-space: normal; color: var(--g-ink-2); }
.gate-dropzone {
  display: grid; place-items: center; gap: var(--g-space-2); min-height: 72px; padding: var(--g-space-4);
  border: 1.5px dashed var(--g-control-line); border-radius: var(--g-radius-card); color: var(--g-ink-3); text-align: center;
}
button.gate-dropzone { width: 100%; background: none; font: inherit; cursor: pointer; }
button.gate-dropzone:hover { border-color: var(--g-accent); color: var(--g-accent-text); }
button.gate-dropzone:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-dropzone.is-over { border-color: var(--g-accent); background: var(--g-accent-weak); color: var(--g-accent-text); }

/* ── timeline bar ───────────────────────────────────────────── */
.gate-timeline { display: flex; height: 12px; gap: 2px; border-radius: 6px; overflow: hidden; background: var(--g-sunken); }
.gate-timeline > i { display: block; height: 100%; min-width: 2px; }
.gate-timeline .is-work { background: var(--g-tl-work); }
.gate-timeline .is-education { background: var(--g-tl-education); }
.gate-timeline .is-additional { background: var(--g-tl-additional); }
.gate-timeline .is-explained { background: var(--g-tl-explained); }
.gate-timeline .is-gap { background: var(--g-tl-gap); }
.gate-timeline-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; line-height: 16px; color: var(--g-ink-3); }
.gate-timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gate-timeline-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--g-line)); }

/* ── the QR plate ───────────────────────────────────────────── */
.gate-qr { display: inline-grid; place-items: center; padding: var(--g-space-4); background: #FFFFFF; border: 1px solid var(--g-line); border-radius: var(--g-radius-card); }

/* ── check-in: the code beside the names arriving ───────────────── */
.gate-checkin { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: var(--g-space-5); align-items: start; }
.gate-checkin--closed { grid-template-columns: minmax(0, 1fr); }
.gate-checkin-code { display: grid; justify-items: center; gap: var(--g-space-4); padding: 24px 16px 20px; }
.gate-checkin-code > .gate-row { justify-content: center; }
.gate-copy { position: relative; display: flex; align-items: center; width: 100%; }
.gate-copy > .gate-input { padding-right: 44px; background: var(--g-sunken); color: var(--g-ink-2); font-size: 13px; text-overflow: ellipsis; }
.gate-copy > .gate-btn { position: absolute; right: 2px; }
.gate-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g-space-3); }
.gate-stat { display: grid; gap: 2px; padding: 12px 14px; background: var(--g-sunken); border-radius: 8px; }
.gate-stat-value { font-size: 24px; line-height: 32px; font-weight: 600; }
@media (max-width: 900px) {
  .gate-checkin { grid-template-columns: minmax(0, 1fr); }
}

/* ── add: what went on, and each line that did not ───────────────── */
.gate-add-note { display: grid; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--g-sunken); font-size: 13px; line-height: 18px; color: var(--g-ink-2); }
.gate-add-note strong { color: var(--g-ink); font-weight: 600; }
.gate-qr svg { width: 200px; height: 200px; display: block; }
@media (max-width: 900px) { .gate-qr svg { width: 160px; height: 160px; } }

/* ── top bar and breadcrumb ─────────────────────────────────────
   The one translucent surface: white at 92% over a 12px blur, sticky. */
.gate-topbar {
  position: sticky; top: 0; z-index: var(--g-layer-sticky); height: 56px;
  display: flex; align-items: center; gap: 28px; padding: 0 24px;
  background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--g-line);
}
.gate-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--g-ink-2); text-decoration: none; flex: none; }
.gate-brand img { height: 26px; width: auto; display: block; }
.gate-brand b { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.gate-nav { display: flex; gap: 2px; }
.gate-nav a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--g-radius-control);
  color: var(--g-ink-2); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.gate-nav a:hover { background: var(--g-hover); color: var(--g-ink); }
.gate-nav a:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 1px; }
.gate-nav a[aria-current="page"] { background: var(--g-selected); color: var(--g-ink); font-weight: 600; }
.gate-topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--g-space-3); }
.gate-topbar-search { width: 280px; }
.gate-topbar-search .gate-input { background: var(--g-sunken); }
.gate-topbar-compact { display: none; }
.gate-user { display: inline-flex; align-items: center; gap: var(--g-space-2); height: 36px; padding: 0 6px 0 4px; border: 0; border-radius: var(--g-radius-control); background: none; color: var(--g-ink-2); font-weight: 500; cursor: pointer; }
.gate-user:hover { background: var(--g-hover); color: var(--g-ink); }
.gate-user:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 1px; }
@media (max-width: 900px) {
  .gate-topbar { gap: var(--g-space-3); padding: 0 16px; }
  .gate-nav, .gate-topbar-search, .gate-user-name { display: none; }
  .gate-topbar-compact { display: inline-flex; }
}

.gate-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-2); font-size: 13px; line-height: 18px; color: var(--g-ink-3); }
.gate-crumbs a { color: var(--g-ink-3); text-decoration: none; }
.gate-crumbs a:hover { color: var(--g-ink); text-decoration: underline; }
.gate-crumbs [aria-current="page"] { color: var(--g-ink-2); }
.gate-menu-head { display: grid; gap: 2px; padding: 6px 10px 4px; }

/* The bar's search sits sunken until it is used. */
.gate-topbar-search .gate-input:focus { background: var(--g-surface); }

/* ════════════════════════════════════════════════════════════
   Templates: a list page, a record page, the workspace with its roster,
   a tool page. 32px gutters; every width from 390px up.
   ════════════════════════════════════════════════════════════ */
.gate-app { margin: 0; min-height: 100vh; background: var(--g-ground); }
.gate-page { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--g-space-6) var(--g-space-7) var(--g-space-8); }
.gate-page-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--g-space-4) var(--g-space-6); margin-bottom: var(--g-space-5); }
.gate-page-titles { display: grid; gap: 6px; min-width: 0; }
.gate-page-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--g-space-3); min-width: 0; }
.gate-page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--g-space-3); font-size: 13px; line-height: 18px; color: var(--g-ink-3); }
.gate-page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--g-space-2); }
.gate-page .gate-crumbs { margin-bottom: var(--g-space-2); }
.gate-page .gate-tabs { margin-bottom: var(--g-space-5); }
.gate-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--g-space-2); margin-bottom: var(--g-space-4); }
.gate-filters .gate-field { min-width: 180px; }
.gate-filters .gate-search { width: 320px; max-width: 100%; }
.gate-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: var(--g-space-5); align-items: start; }
.gate-tool { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: var(--g-space-5); align-items: start; }
.gate-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g-space-4); align-items: start; }
.gate-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--g-space-4); align-items: start; }
.gate-span-2 { grid-column: span 2; }
.gate-span-all { grid-column: 1 / -1; }

/* The workspace: a day's roster beside the record being worked. */
.gate-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.gate-roster {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; display: grid; align-content: start; gap: 4px;
  padding: var(--g-space-4) var(--g-space-3); background: var(--g-surface); border-right: 1px solid var(--g-line);
}
.gate-roster-head { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-2); padding: 0 4px var(--g-space-2); }
.gate-roster-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.gate-roster-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--g-space-2);
  padding: 9px 10px; border-radius: 8px; color: var(--g-ink); text-decoration: none;
}
.gate-roster-item:hover { background: var(--g-hover); }
.gate-roster-item:focus-visible { outline: 2px solid var(--g-focus); outline-offset: -2px; }
.gate-roster-item[aria-current="page"] { background: var(--g-selected); }
.gate-roster-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-roster-item[aria-current="page"] .gate-roster-name { font-weight: 600; }
.gate-roster-toggle { display: none; }
.gate-record { min-width: 0; padding: var(--g-space-5) var(--g-space-7) var(--g-space-8); }
.gate-saved { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--g-ink-3); }

/* The arrival beat after sign-in: the mark, once, then the page. */
.gate-arrive {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--g-ground);
  transition: opacity var(--g-duration-slow) var(--g-ease);
}
.gate-arrive img { width: 140px; height: auto; animation: gate-rise var(--g-duration-slow) var(--g-ease); }
.gate-arrive.is-done { opacity: 0; }

@media (max-width: 1279px) {
  .gate-workspace { grid-template-columns: minmax(0, 1fr); }
  .gate-roster { display: none; }
  .gate-roster.is-open {
    display: grid; position: fixed; z-index: var(--g-layer-sheet); left: 0; top: 56px; bottom: 0; width: min(320px, 88vw);
    height: auto; box-shadow: var(--g-shadow-overlay);
  }
  .gate-roster-toggle { display: inline-flex; }
  .gate-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate-record { padding: var(--g-space-4) var(--g-space-6) var(--g-space-8); }
}
@media (max-width: 900px) {
  .gate-page { padding: var(--g-space-4) var(--g-space-4) var(--g-space-7); }
  .gate-record { padding: var(--g-space-4) var(--g-space-4) var(--g-space-7); }
  .gate-split, .gate-tool, .gate-grid-3, .gate-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .gate-span-2 { grid-column: auto; }
  .gate-filters .gate-search, .gate-filters .gate-field:has(> .gate-search) { width: 100%; }
  .gate-filters .gate-field { min-width: 0; }
}

/* ── picker: a searchable list behind a button ─────────────────── */
.gate-picker-button { display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-2); min-width: 240px; text-align: left; cursor: pointer; }
.gate-picker-button > span { display: inline-flex; align-items: center; gap: var(--g-space-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-picker {
  position: absolute; z-index: var(--g-layer-popover); top: calc(100% + 6px); left: 0; width: max(100%, 320px); max-height: 360px;
  display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 6px; background: var(--g-surface);
  border: 1px solid var(--g-line); border-radius: var(--g-radius-card); box-shadow: var(--g-shadow-popover);
}
.gate-picker[hidden] { display: none; }
.gate-picker-search { margin-bottom: 6px; }
.gate-picker-list { display: grid; align-content: start; gap: 2px; overflow: auto; }
.gate-picker-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--g-space-3); min-height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--g-radius-control); background: none; color: var(--g-ink); font-size: 14px;
  text-align: left; text-decoration: none; cursor: pointer;
}
.gate-picker-option:hover, .gate-picker-option:focus-visible { background: var(--g-hover); outline: none; }
.gate-picker-option:focus-visible { box-shadow: inset 0 0 0 2px var(--g-focus); }
.gate-picker-option[aria-current="true"] { font-weight: 600; }
.gate-picker-option[hidden] { display: none; }
.gate-picker-when { font-size: 13px; color: var(--g-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gate-picker-none { padding: 8px 10px; color: var(--g-ink-3); }
.gate-reports-none { margin: calc(-1 * var(--g-space-2)) 0 var(--g-space-4); }
@media (pointer: coarse) { .gate-picker-option { min-height: 44px; } }
.gate-search-results { right: 0; left: auto; width: 420px; max-width: calc(100vw - 32px); }
.gate-search-results .gate-picker-option { min-height: 52px; padding: 6px 10px; }
.gate-search-who { display: grid; gap: 1px; min-width: 0; }
.gate-search-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-search-who .gate-picker-when { overflow: hidden; text-overflow: ellipsis; }

/* ════════════════════════════════════════════════════════════
   The candidate workspace: the roster, the record header, the five
   tabs, the focus sheet and what opens over them.
   ════════════════════════════════════════════════════════════ */
.gate-record-crumbs { flex-wrap: wrap; margin-bottom: var(--g-space-2); }
.gate-record-crumbs .gate-crumbs { margin: 0; }
.gate-roster-day { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--g-ink); text-decoration: none; }
.gate-roster-day:hover { text-decoration: underline; }
.gate-roster-day .gate-num { color: var(--g-ink-3); font-weight: 500; }
.gate-roster-find { margin: 0 2px var(--g-space-2); }
.gate-roster-none { padding: 8px 10px; }
.gate-roster-list > li { list-style: none; }

.gate-ws-head { margin-bottom: var(--g-space-4); }
.gate-ws-head .gate-page-titles { gap: var(--g-space-2); }
.gate-ws-head .gate-page-meta { color: var(--g-ink-2); }
.gate-ws-request { padding: 0 8px; color: var(--g-accent-text); }
.gate-ws-status--ok   { color: var(--g-ok);   background: var(--g-ok-bg);   border-color: var(--g-ok-line); }
.gate-ws-status--warn { color: var(--g-warn); background: var(--g-warn-bg); border-color: var(--g-warn-line); }
.gate-ws-status--info { color: var(--g-info); background: var(--g-info-bg); border-color: var(--g-info-line); }
.gate-ws-status--bad  { color: var(--g-bad);  background: var(--g-bad-bg);  border-color: var(--g-bad-line); }

.gate-ws-line { display: flex; align-items: flex-start; gap: 10px; }
.gate-ws-line-icon { margin-top: 2px; color: var(--g-bad); }
.gate-ws-rows { display: grid; }
.gate-ws-rows > * { padding: 8px 0; border-bottom: 1px solid var(--g-line); }
.gate-ws-rows > :first-child { padding-top: 0; }
.gate-ws-rows > :last-child { padding-bottom: 0; border-bottom: 0; }
.gate-ws-six { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 24px; }
.gate-ws-six-item { display: flex; align-items: center; gap: var(--g-space-2); }
.gate-ws-six-item > .gate-icon { color: var(--g-ok); flex: none; }
.gate-ws-six-item.is-missing, .gate-ws-six-item.is-missing > .gate-icon { color: var(--g-bad); }

.gate-ws-docs-bar { margin-bottom: var(--g-space-3); }
.gate-ws-docs-bar + .gate-notice { margin-bottom: var(--g-space-3); }
label.gate-tile-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
label.gate-tile-pick:focus-within { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-tiles.is-reading { pointer-events: none; animation: gate-breathe 1.6s var(--g-ease) infinite; }
.gate-tile--missing.is-busy { opacity: .5; pointer-events: none; }
.gate-ws-dropzone { margin-top: var(--g-space-5); }
.gate-ws-attach-log { margin-top: var(--g-space-3); }
.gate-log .is-bad { color: var(--g-bad); }
.gate-ws-tile-menu { position: fixed; top: 0; left: 0; right: auto; }
@keyframes gate-breathe { 0%, 100% { opacity: .55; } 50% { opacity: .35; } }

.gate-ws-interview-bar { margin-bottom: var(--g-space-4); }
.gate-ws-said { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--g-sunken); }
.gate-ws-seg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--g-space-2) var(--g-space-3); padding: 4px 0; }
.gate-ws-setall .gate-btn { min-width: 36px; justify-content: center; }
.gate-ws-ask > div { display: grid; gap: 2px; }
.gate-ws-q { display: grid; gap: var(--g-space-2); padding: var(--g-space-4); border: 1px solid var(--g-line); border-radius: var(--g-radius-card); background: var(--g-surface); }
.gate-ws-q.is-said { background: var(--g-sunken); }
.gate-ws-q.is-said > .gate-between .gate-cell-strong { color: var(--g-ink-2); }
.gate-ws-approved { justify-self: start; }

.gate-ws-section > .gate-card-head { padding: 12px 16px; border-bottom: 1px solid var(--g-line); }
.gate-ws-entries { display: grid; }
.gate-ws-entry { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: center; gap: var(--g-space-3); padding: 10px 16px; border-top: 1px solid var(--g-line); }
.gate-ws-entries > .gate-ws-entry:first-child { border-top: 0; }
.gate-ws-entry-when { font-size: 13px; color: var(--g-ink-2); }
.gate-ws-entry-when.is-undated { color: var(--g-warn); font-weight: 600; }
.gate-ws-entry-what { min-width: 0; overflow-wrap: anywhere; }
.gate-ws-entry-do { opacity: 0; transition: opacity var(--g-duration-fast) var(--g-ease); }
.gate-ws-entry:hover .gate-ws-entry-do, .gate-ws-entry:focus-within .gate-ws-entry-do { opacity: 1; }
@media (hover: none) { .gate-ws-entry-do { opacity: 1; } }
.gate-ws-entry-none { padding: 12px 16px; }
.gate-ws-entry-form { display: grid; gap: var(--g-space-3); padding: 12px 16px; border-top: 1px solid var(--g-line); background: var(--g-sunken); }
.gate-ws-q .gate-ws-entry-form { border: 0; border-radius: 8px; }
.gate-ws-entry-form.is-busy { opacity: .6; pointer-events: none; }
.gate-ws-entry-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-2); }
.gate-ws-entry-line .gate-select { width: auto; min-width: 150px; }
.gate-ws-entry-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--g-space-2); }
.gate-ws-month .gate-date { min-width: 160px; }
.gate-ws-cover-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; line-height: 16px; color: var(--g-ink-3); }

.gate-sheet-content > .gate-ws-step { border: 0; background: none; }
.gate-sheet-content > .gate-ws-step > .gate-card-head { padding: 0 0 var(--g-space-2); }
.gate-sheet-content > .gate-ws-step > .gate-card-body { padding: 0; }
.gate-sheet-content > #cgHistory { padding-top: var(--g-space-2); }
.gate-ws-next { min-width: 76px; justify-content: center; }
/* Armed, Next reads Skip: the warning's own pair, dark amber on light amber
   (5.7:1), hovered or not. It had red words on a solid amber, unreadable. */
.gate-ws-next.is-armed, .gate-ws-next.is-armed:hover { background: var(--g-warn-bg); border-color: var(--g-warn); color: var(--g-warn); }

.gate-ws-facts { display: grid; grid-template-columns: 92px minmax(0, 1fr); row-gap: 10px; margin: 0; font-size: 14px; line-height: 20px; }
.gate-ws-facts dt { font-size: 13px; color: var(--g-ink-3); }
.gate-ws-facts dd { margin: 0; font-weight: 600; }
.gate-ws-facts .gate-ws-missing { color: var(--g-bad); font-weight: 500; }
.gate-ws-grow { flex: 1; min-width: 0; }
.gate-ws-mail { padding: 20px 22px; overflow: auto; }
.gate-ws-viewer-figure { display: grid; gap: var(--g-space-2); max-width: 92vw; margin: 0; padding: 12px; border-radius: var(--g-radius-overlay); background: var(--g-surface); box-shadow: var(--g-shadow-overlay); }
.gate-ws-viewer-figure img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; object-fit: contain; }
.gate-ws-viewer-figure iframe { display: block; width: min(88vw, 960px); height: 78vh; border: 0; border-radius: 6px; background: #FFFFFF; }

@media (max-width: 900px) {
  .gate-ws-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate-ws-entry { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .gate-ws-entry-do { opacity: 1; }
  .gate-ws-head .gate-page-actions { width: 100%; }
}

/* ── sign-in: the one place for a large brand mark ─────────────── */
.gate-auth { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 36px; padding: var(--g-space-6) var(--g-space-4) 80px; }
.gate-auth-home { display: block; border-radius: var(--g-radius-card); }
.gate-auth-mark { display: block; width: auto; height: 120px; }
.gate-auth-card { width: min(400px, calc(100vw - 32px)); display: grid; gap: var(--g-space-5); padding: 28px; border-color: transparent; box-shadow: var(--g-shadow-popover); }
@media (max-width: 600px) { .gate-auth-mark { height: 88px; } .gate-auth { gap: 28px; } }

/* ════════════════════════════════════════════════════════════
   Candidate pages: check-in and the later upload. The same components
   in the Aircrew theme — a candidate here came for an Aircrew day and
   has never seen CrewGate. One card, the Aircrew mark at its head, and
   the yellow forward button candidates already know.
   ════════════════════════════════════════════════════════════ */
.gate.gate-theme-aircrew {
  --g-ink: #111827;
  --g-ink-2: #374151;
  --g-ink-3: #5B6472;
  --g-ground: #EEF3FA;
  --g-accent: #0B3A8C;
  --g-accent-hover: #082F72;
  --g-accent-weak: #E6EDF8;
  --g-accent-text: #0B3A8C;
  --g-focus: #0B3A8C;
  --g-cta: #FFD93D;
  --g-cta-hover: #F7CB12;
  --g-cta-ink: #0B2A66;
}
.gate-btn--cta { background: var(--g-cta); border-color: var(--g-cta); color: var(--g-cta-ink); }
.gate-btn--cta:hover { background: var(--g-cta-hover); border-color: var(--g-cta-hover); color: var(--g-cta-ink); }
.gate-btn--lg { height: 44px; padding: 0 22px; font-size: 15px; }
.gate-btn--lg.gate-btn--tertiary { padding: 0 16px; }

.gate-public { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px 64px; }
.gate-public-card { width: min(560px, 100%); border: 0; border-radius: 16px; box-shadow: 0 10px 30px rgba(17, 24, 39, .08); overflow: hidden; }
.gate-public-head { display: flex; justify-content: center; padding: 16px 20px; border-bottom: 1px solid var(--g-line); }
.gate-public-head img { display: block; width: auto; height: 34px; }
.gate-public-body { display: grid; gap: var(--g-space-4); align-content: start; padding: 24px; }
.gate-public-title { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; color: var(--g-ink); }
.gate-public-title:focus { outline: none; }
.gate-public-lead { color: var(--g-ink-2); }
.gate-public-form { display: grid; gap: var(--g-space-4); }
.gate-public-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--g-space-3); }
.gate-public .gate-input, .gate-public .gate-select { min-height: 44px; font-size: 16px; }
.gate-public .gate-btn--sm { height: 36px; }
.gate-public-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-2); }
.gate-public .section-enter { animation: gate-rise var(--g-duration-slow) var(--g-ease) backwards; }
.gate-public .section-exit { animation: gate-sink var(--g-duration-base) var(--g-ease) forwards; }
@keyframes gate-sink { to { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 600px) {
  .gate-public { padding: 16px 12px 40px; }
  .gate-public-body { padding: 20px 16px; }
  .gate-public-pair { grid-template-columns: minmax(0, 1fr); gap: var(--g-space-4); }
}

/* A document slot: what it is, what was chosen, how far it has gone. The
   file input itself stays in the page and takes the focus; the button
   beside it shows the ring. */
.gate-slots { display: grid; gap: var(--g-space-3); }
.gate-slot {
  position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: var(--g-space-3); padding: 12px;
  background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius-card);
  transition: border-color var(--g-duration-fast) var(--g-ease), background-color var(--g-duration-fast) var(--g-ease);
}
.gate-slot-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px;
  background: var(--g-accent-weak); color: var(--g-accent);
}
.gate-slot-icon .gate-icon { width: 20px; height: 20px; }
.gate-slot-icon .is-done { display: none; }
.gate-slot.is-filled .gate-slot-icon { background: var(--g-ok-bg); color: var(--g-ok); }
.gate-slot.is-filled .gate-slot-icon .is-kind { display: none; }
.gate-slot.is-filled .gate-slot-icon .is-done { display: block; }
.gate-slot-main { flex: 1 1 140px; min-width: 0; display: grid; gap: 2px; }
.gate-slot-name { font-weight: 600; color: var(--g-ink); }
.gate-slot-file { font-size: 13px; line-height: 18px; color: var(--g-ink-3); overflow-wrap: anywhere; white-space: pre-wrap; }
.gate-slot-file:empty { display: none; }
.gate-slot-err { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--g-bad); }
.gate-slot-do { display: flex; flex-wrap: wrap; gap: var(--g-space-2); margin-left: auto; }
.gate-slot.is-over { border-color: var(--g-accent); background: var(--g-accent-weak); }
.gate-slot.is-bad { border-color: var(--g-bad); }
.gate-slot.is-bad .gate-slot-icon { background: var(--g-bad-bg); color: var(--g-bad); }
.gate-file { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.gate-file:focus-visible + .gate-btn { outline: 2px solid var(--g-focus); outline-offset: 2px; }
.gate-file:disabled + .gate-btn { opacity: .45; cursor: not-allowed; pointer-events: none; }
.gate-progress { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--g-line); overflow: hidden; }
.gate-progress-fill {
  display: block; width: 100%; height: 100%; background: var(--g-accent);
  transform: scaleX(0); transform-origin: left; transition: transform var(--g-duration-slow) var(--g-ease);
}

/* The questions a check comes back with. */
.gate-asks { display: grid; gap: var(--g-space-3); }
.gate-asks:empty { display: none; }
.gate-ask {
  display: grid; gap: var(--g-space-3); padding: 16px; background: var(--g-surface);
  border: 1px solid var(--g-line); border-radius: var(--g-radius-card);
  animation: gate-rise var(--g-duration-slow) var(--g-ease) backwards;
  transition: background-color var(--g-duration-slow) var(--g-ease), border-color var(--g-duration-slow) var(--g-ease);
}
.gate-ask.is-answered { background: var(--g-ok-bg); border-color: var(--g-ok-line); }
.gate-ask-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-2) var(--g-space-3); }
.gate-ask-when { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--g-ink); }
.gate-ask-question { color: var(--g-ink-2); }
.gate-ask-said { overflow-wrap: anywhere; color: var(--g-ink); }
.gate-suggests { display: flex; flex-wrap: wrap; gap: 6px; }
.gate-suggests .gate-chip { min-height: 32px; padding: 5px 12px; font-size: 13px; font-weight: 500; background: var(--g-sunken); border-color: var(--g-line); color: var(--g-ink-2); text-align: left; }
.gate-suggests .gate-chip:hover { background: var(--g-accent-weak); border-color: var(--g-accent); color: var(--g-accent-text); }
@media (pointer: coarse) { .gate-suggests .gate-chip { min-height: 40px; } }
.gate-notes { display: grid; gap: var(--g-space-2); }
.gate-notes:empty { display: none; }
.gate-add { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-3); }
.gate-add-say { color: var(--g-ink-3); }
.gate-entry { flex: 1 1 100%; display: grid; gap: var(--g-space-3); padding: 14px; border-radius: var(--g-radius-card); background: var(--g-sunken); border: 1px solid var(--g-line); }
.gate-entry-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-space-2); }
.gate-entry-line > .gate-select { width: auto; min-width: 140px; }
.gate-entry-when { display: inline-flex; gap: 6px; }
.gate-entry-when .gate-select { width: auto; min-width: 116px; }
.gate-entry-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--g-space-2); }
.gate-entry-fields:empty { display: none; }

/* Done: what arrived, file by file. */
.gate-done-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--g-ok-bg); color: var(--g-ok); }
.gate-done-mark .gate-icon { width: 28px; height: 28px; stroke-width: 2.25; }
.gate-received { display: grid; gap: var(--g-space-2); }
.gate-received:empty { display: none; }
.gate-received-row { display: grid; grid-template-columns: 16px auto minmax(0, 1fr) auto; align-items: center; gap: var(--g-space-2); }
.gate-received-row > .gate-icon { color: var(--g-ok); }
.gate-received-what { font-weight: 600; color: var(--g-ink); }
.gate-received-file { min-width: 0; font-size: 13px; color: var(--g-ink-3); overflow-wrap: anywhere; }
.gate-skip-list { display: grid; gap: var(--g-space-2); margin-top: var(--g-space-4); }
.gate-skip-list:empty { display: none; }
.gate-skip-item { padding: 10px 12px; border-radius: 8px; background: var(--g-sunken); color: var(--g-ink-2); font-size: 13px; line-height: 18px; }
.gate-skip-item b { color: var(--g-ink); font-weight: 600; }

/* The wait: a page being read, for a wait whose length nobody knows. The
   scan line passes down the page, fading in at the top and out at the foot,
   with the part it has just read tinted above it. */
.gate-waiting {
  position: fixed; inset: 0; z-index: var(--g-layer-dialog); display: flex; align-items: center; justify-content: center;
  padding: var(--g-space-4); background: var(--g-scrim); animation: gate-fade var(--g-duration-base) var(--g-ease);
}
.gate-waiting.is-going { animation: gate-fade-out var(--g-duration-base) var(--g-ease) forwards; }
@keyframes gate-fade-out { to { opacity: 0; } }
.gate-waiting-card {
  width: min(240px, 100%); display: grid; justify-items: center; gap: var(--g-space-4); padding: 32px 24px;
  background: var(--g-surface); border-radius: var(--g-radius-overlay); box-shadow: var(--g-shadow-overlay); text-align: center;
}
.gate-scan { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 18px; background: var(--g-accent-weak); }
.gate-scan-page {
  position: relative; width: 48px; height: 60px; display: grid; align-content: start; gap: 5px; padding: 9px 7px; overflow: hidden;
  border: 2px solid var(--g-accent); border-radius: 6px; background: var(--g-surface);
}
.gate-scan-page i { display: block; height: 4px; border-radius: 2px; background: var(--g-accent); opacity: .22; }
.gate-scan-page i:nth-child(1) { width: 70%; }
.gate-scan-page i:nth-child(3) { width: 55%; }
.gate-scan-page i:nth-child(4) { width: 85%; }
.gate-scan-page i:nth-child(5) { width: 65%; }
.gate-scan-line {
  position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--g-accent);
  animation: gate-scan 1.7s cubic-bezier(.45, 0, .55, 1) infinite;
}
.gate-scan-line::before { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 12px; background: var(--g-accent); opacity: .12; }
@keyframes gate-scan {
  0%       { transform: translateY(0); opacity: 0; }
  12%, 88% { opacity: 1; }
  100%     { transform: translateY(56px); opacity: 0; }
}
.gate-waiting-line { min-height: 24px; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--g-accent-text); }
@media (prefers-reduced-motion: reduce) {
  .gate .gate-scan-line { animation: none; transform: translateY(24px); }
  .gate .gate-waiting, .gate .gate-ask, .gate .gate-public .section-enter, .gate .gate-public .section-exit { animation: none; }
}
.gate.reduce-motion .gate-scan-line { animation: none; transform: translateY(24px); }
.gate.reduce-motion .gate-waiting, .gate.reduce-motion .gate-ask,
.gate.reduce-motion .gate-public .section-enter, .gate.reduce-motion .gate-public .section-exit { animation: none; }
