/* App stylesheet. Be Vietnam Pro / JetBrains Mono, white paper surface, blue #255CFF primary CTA.*/
/* Fonts self-hosted (latin subset) under static/fonts/ — no third-party runtime request,
   works offline. JetBrains Mono is a single variable file covering the 400–600 range. */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/be-vietnam-pro-400.woff2") format("woff2");
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/be-vietnam-pro-700.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
  --c-paper: #FFFFFF;
  --c-ink: #0A0A0A;
  --c-body: #444444;
  --c-mute: #767676;
  --c-accent: #255CFF;
  --shadow-cta: 0 4px 22px rgba(37, 92, 255, 0.40);
  --shadow-cta-grey: 0 4px 22px rgba(10, 10, 10, 0.22);
  --f-sans: "Be Vietnam Pro", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

body {
  font-family: var(--f-sans);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: var(--c-paper);
  color: var(--c-ink);
}

img.logo {
  width: min(420px, 80vw);
  height: auto;
}

/* Signed-in home: a centered logo (like the landing) over a welcome + who-you-are, a
   fixed distance below the navbar rather than floated to the vertical center. */
main.home-hero {
  align-self: center;
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}
.home-welcome {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  color: var(--c-ink);
}
.home-sub {
  margin: 0;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--c-mute);
}

/* Primary CTA — the .t-cta rule from theia.css. */
a.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--c-accent);
  color: var(--c-paper);
  border: none;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: var(--shadow-cta);
  text-decoration: none;
}
a.cta:hover,
a.cta:focus-visible {
  filter: brightness(1.05);
}

dl.card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px 20px;
  align-items: baseline;
}
dl.card dt {
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mute);
  text-align: left;
  align-self: center;
}
dl.card dd {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--c-ink);
}

p {
  color: var(--c-body);
}

/* Log out — upper-right, same mono type as the name/role/tenant labels. */
a.logout {
  position: fixed;
  top: 24px;
  right: 24px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mute);
  text-decoration: none;
}
a.logout:hover,
a.logout:focus-visible {
  color: var(--c-ink);
}

/* Top navigation bar — brand left, tabs, logout right; a fixed full-width header. */
nav.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 60px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}
nav.nav .brand {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--c-ink);
  text-decoration: none;
}
nav.nav .nav-tabs {
  display: flex;
  gap: 26px;
  flex: 1;
  align-items: center;
}
nav.nav .nav-tab,
nav.nav .nav-logout {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mute);
  text-decoration: none;
  transition: color 0.15s ease;
}
/* Logout is a form post (ADR 0013); strip the button chrome so it reads as a tab. */
nav.nav .nav-logout-form {
  margin: 0;
}
nav.nav .nav-logout {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
nav.nav .nav-tab {
  padding: 20px 0;
  border-bottom: 2px solid transparent;
}
nav.nav .nav-tab[aria-current="page"] {
  color: var(--c-ink);
  border-bottom-color: var(--c-accent);
}
nav.nav .nav-tab:hover,
nav.nav .nav-logout:hover {
  color: var(--c-ink);
}

/* Signed-in pages carry the fixed nav: top-left align the content, clear of the header. */
body:has(nav.nav) {
  justify-content: flex-start;
  align-items: flex-start;
  padding: 108px 48px 48px 78px;
}

/* Capture stage + home card: a left-aligned content column, no surrounding panel. */
main.pair {
  width: 100%;
}
.stage {
  /* Where the status chip sits: capture/extension.js rewrites it per stage from the
     visible title's width. The default only has to hold before the first stage shows. */
  --status-col: 236px;
  max-width: 460px;
  position: relative;  /* the anchor the quiet extension status sits on */
}
/* Shrink to the text so that width is the title's, not the column's. Settings shares the
   class and is left alone: only the capture stage is measured against. */
#stage .stage-title {
  width: max-content;
}
/* Page header: the capture screen's title, in small-caps at the stage-title scale. */
.page-title {
  margin: 0 0 26px;
  font-size: 38px;
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--c-ink);
}
/* Per-stage title, a subheader beneath .page-title (Ready to pair / Session live / No WMS configured). */
.stage-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--c-ink);
}
/* A pair stage's content column: title, sub-copy, and its button(s). */
.panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 26px;
}
.stage-sub {
  margin: 0;
  font-size: 16px;
  line-height: 1.9;
  color: var(--c-body);
}
.stage-sub span {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink);
}
.stage-sub a {
  color: var(--c-accent);
  text-decoration: none;
}
.stage-sub a:hover {
  text-decoration: underline;
}

/* Status dot next to the stage title: live (green) → warn (amber) → done (grey). */
.dot {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.dot.live {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}
.dot.warn {
  background: #f5a623;
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.16);
}
.dot.done {
  background: #b4b4b4;
}
[hidden] {
  display: none;
}

/* Buttons. .btn is the pill CTA; .secondary is the quiet variant. */
.btn,
button.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--c-paper);
  background: var(--c-accent);
  box-shadow: var(--shadow-cta);
  transition:
    filter 0.15s ease,
    transform 0.05s ease;
}
.btn:hover,
button.cta:hover {
  filter: brightness(1.06);
}
.btn:active {
  transform: translateY(1px);
}
.btn.secondary {
  color: var(--c-mute);
  background: #F4F4F5;
  border: 1px solid rgba(10, 10, 10, 0.1);
  box-shadow: var(--shadow-cta-grey);
}
.btn.secondary:hover {
  filter: brightness(1.03);
  color: var(--c-body);
  background: #ECECEE;
  border-color: rgba(10, 10, 10, 0.16);
  box-shadow: var(--shadow-cta-grey);
}
/* A gated control must read as gated: a dead button wearing its live colours reads as a
   broken page, not a locked one (e.g. Settings' Save while a save is in flight). */
.btn:disabled,
.btn:disabled:hover {
  cursor: not-allowed;
  opacity: 0.45;
  filter: none;
  box-shadow: none;
}
.btn:disabled:active {
  transform: none;
}
/* Compact variant for quiet, secondary actions (e.g. Settings' Retry). */
.btn.small {
  padding: 9px 16px;
  font-size: 10px;
}

/* The pairing QR on the scan-to-pair screen. A camera has to read it, so it sits on flat
   white — no tint, no texture — and the symbol carries its own quiet zone. */
.qr-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;  /* the hint strip lies across the symbol */
  box-sizing: border-box;
  width: 180px;
  height: 180px;
  padding: 6px;
  border: 1px solid rgba(10, 10, 10, 0.1);
  border-radius: 12px;
  background: var(--c-paper);
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}
/* Enlarged, the symbol is what the glasses camera reads at wearing distance. The size is
   the one tunable: raise it if a unit still misses the code. */
.qr-ph[aria-expanded="true"] {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  width: min(78vmin, 520px);
  height: auto;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(10, 10, 10, 0.35);
  cursor: zoom-out;
}
/* The affordance rides the symbol itself, since nothing else marks the QR as a control. The
   chip covers enough of it that the inline symbol is one to enlarge, not one to scan. */
.qr-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(236, 236, 238, 0.92);  /* a little of the symbol reads through the chip */
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;  /* the label's two rows are the <br>'s, not the chip's width */
  color: var(--c-ink);
}
.qr-ph[aria-expanded="true"] .qr-hint {
  display: none;  /* enlarged, the symbol is all camera: nothing lies across it */
}
/* Behind an enlarged QR: blurs the console so the symbol is the only thing in focus, and
   covers the viewport so a click anywhere outside the QR lands here and restores it. */
.qr-backdrop {
  display: none;
}
.qr-ph[aria-expanded="true"] + .qr-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 40;  /* under the QR's 50 */
  backdrop-filter: blur(6px);
}
.qr-ph img {
  width: 100%;
  height: auto;
}

/* Standing extension-relay status, the stage's first child: one chip beside the stage title,
   out of flow so no state moves the stage. Its tint tracks the state; the geometry never does. */
.ext-status {
  position: absolute;
  top: 0;
  left: var(--status-col);
  height: 24px;  /* the stage title's line box, so the chip centres against it */
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
/* The window before the extension answers is neutral; a proven relay green; silence red. */
.ext-status.checking {
  color: var(--c-mute);
  background: rgba(10, 10, 10, 0.06);
}
.ext-status.ok {
  color: #106b2f;
  background: rgba(16, 107, 47, 0.1);
}
.ext-status.down {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.1);
}

.field {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--c-ink);
  padding: 11px 14px;
  border: 1px solid rgba(10, 10, 10, 0.2);
  border-radius: 10px;
  background: var(--c-paper);
}
.field:focus {
  outline: none;
  border-color: var(--c-accent);
}

/* Captures table: one row per capture on the session, newest first. */
.captures {
  width: 100%;
  margin-top: 34px;
  overflow-x: auto;
}
.cap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.cap-table th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-mute);
  padding: 8px 14px;
  border-bottom: 1px solid rgba(10, 10, 10, 0.12);
}
.cap-table td {
  padding: 11px 14px;
  color: var(--c-body);
  border-bottom: 1px solid rgba(10, 10, 10, 0.06);
}
.cap-table td:first-child {
  font-family: var(--f-mono);
  color: var(--c-ink);
}
/* The open capture — the one still recording — stands out from the closed rows. */
.cap-table tr.active td {
  font-weight: 600;
  color: var(--c-ink);
}

/* Settings page: a left-aligned column of sections (Account, WMS Configuration). */
main.settings {
  width: 100%;
  max-width: 520px;
}
.settings-section {
  margin-top: 40px;
  gap: 10px;
}
/* A hairline divides one section from the next; the gap above it stays no larger than
   the gap below, so the divider doesn't crowd the section that follows. */
.settings-section + .settings-section {
  margin-top: 20px;
  padding-top: 28px;
  border-top: 1px solid rgba(10, 10, 10, 0.08);
}
.wms-config {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  gap: 12px;
}
/* The active card's backend row sits 18px above Update (6px + the 12px gap), the same
   gap as the form's WMS dropdown above Cancel/Save. */
.wms-config > dl.card {
  margin-bottom: 6px;
}
/* Configure form: stacked labelled fields, then Save and an inline error line. It fills
   the section width so a full base URL fits without clipping. */
.wms-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}
/* The picked backend's secret fields — revealed only once a WMS is chosen; the reveal
   gap matches the form's, so WMS → Base URL → API token → Save are evenly spaced. */
.wms-fields:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Dropdown reads as a grey italic placeholder until a WMS is picked, then upright black. */
.wms-select {
  font-style: italic;
  color: var(--c-mute);
}
.wms-select.chosen {
  font-style: normal;
  font-weight: 400;
  color: var(--c-ink);
}
.wms-select option {
  font-style: normal;
  color: var(--c-ink);
}
.wms-select option[value=""] {
  font-style: italic;
  color: var(--c-mute);
}
.wms-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mute);
}
.wms-field .field {
  width: 100%;
  box-sizing: border-box;
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--f-sans);
  font-variant-ligatures: none;
}
/* Cancel (left) + Save (right), side by side under the fields. */
.wms-actions {
  display: flex;
  gap: 12px;
}
.wms-error {
  margin: 0;
  font-size: 14px;
  color: #dc2626;
}
/* Search: the filter row, the results list and pager, and the viewer that replaces them. */
main.search {
  width: 100%;
  max-width: 880px;
}
/* `hidden` must beat the flex and button display rules below. */
main.search [hidden] {
  display: none;
}
/* Order number, the admin operator filter, and Search side by side; wraps when narrow. */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
/* The order box and the operator dropdown share one width, height and text size. */
.search-form .field {
  flex: 0 0 240px;
  box-sizing: border-box;
  height: 44px;
  font-size: 12px;
}
.search-operator {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--c-mute);
}
.search-status,
.page-info {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--c-mute);
}
.results {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.result-open {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  color: var(--c-body);
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  cursor: pointer;
}
.result-open:hover {
  background: rgba(37, 92, 255, 0.05);
}
.result-headline {
  font-family: var(--f-mono);
  color: var(--c-ink);
}
.result-meta {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--c-mute);
}
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
}
/* The viewer: the back arrow and title over the facts, with the video beside them. */
.detail {
  margin-top: 24px;
}
.detail-body {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}
/* Title and facts share one column so the video's top edge reads level with the title. */
.detail-main {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}
/* The back arrow in the viewer's top-left corner returns to the results. */
.back {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back:hover {
  background: rgba(10, 10, 10, 0.1);
}
/* A barcode or order id runs to 512 characters with no spaces, so it breaks mid-word
   rather than running across the video and out of the viewport. */
.detail-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--c-ink);
  overflow-wrap: anywhere;
}
/* The glasses record portrait, so the video is a narrow panel beside the facts. */
.detail-video {
  flex: none;
  width: 288px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* One bordered box per group of facts, its heading over a rule across the whole box. */
.facts {
  box-sizing: border-box;
  border: 1px solid rgba(10, 10, 10, 0.11);
  border-radius: 12px;
  padding: 18px 20px;
}
.facts-title {
  margin: 0 -20px 14px;
  padding: 0 20px 11px;
  border-bottom: 1px solid rgba(10, 10, 10, 0.09);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--c-ink);
}
/* One term/value pair per row: a box beside the video is too narrow for two. */
.facts dl.card {
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}
.facts dl.card dt {
  font-size: 11px;
  line-height: 1.5;
}
.facts dl.card dd {
  line-height: 1.5;
  overflow-wrap: anywhere;
}
/* The panel's width sets the box and the height follows the frames, so nothing is
   stretched, cropped, or left as ink down a portrait capture's sides. */
.player {
  display: block;
  width: 100%;
  height: auto;
  background: var(--c-ink);
  border-radius: 10px;
}
/* Too narrow to stand side by side: the video drops under the facts. */
@media (max-width: 700px) {
  .detail-body {
    display: block;
  }
  .detail-video {
    width: 100%;
    max-width: 288px;
    margin-top: 16px;
  }
}
/* A completeness label, coloured by kind: blue recording, grey uploading, green complete,
   amber incomplete, red failed. */
.label {
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.label-recording {
  color: var(--c-accent);
  background: rgba(37, 92, 255, 0.1);
}
.label-uploading {
  color: var(--c-body);
  background: rgba(10, 10, 10, 0.06);
}
.label-complete {
  color: #106b2f;
  background: rgba(16, 107, 47, 0.1);
}
.label-incomplete {
  color: #8a5300;
  background: rgba(138, 83, 0, 0.1);
}
.label-failed {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.1);
}

/* Legal prose (the privacy policy): a readable measure, left-aligned, since the body
   centers its children and a full-width paragraph is unreadable. */
main.legal {
  align-self: center;
  max-width: 68ch;
  margin: 64px 24px;
  text-align: left;
}
main.legal h2 {
  margin: 34px 0 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--c-ink);
}
main.legal p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.65;
}
main.legal code {
  font-family: var(--f-mono);
  font-size: 13px;
}
.legal-date {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--c-mute);
}
/* The contact address is the page's one link; without this it falls back to the
   browser default blue, which clashes with the accent. */
.legal a {
  color: var(--c-accent);
  text-decoration: none;
}
.legal a:hover {
  text-decoration: underline;
}
