/* CaptFlo operator console.
 *
 * The visual reference is the artifact CaptFlo itself prints: an ArUco marker
 * sheet. Plain-text identifiers, generous quiet zones, square fiducials, and a
 * bar labelled "this line is exactly 100 mm - measure it". A sheet that exists
 * to be measured against, not to look impressive. This surface has the same job:
 * report the true state of the instance without flattering it.
 *
 * Monospace does most of the work. That is partly honesty for an operator
 * console and partly a constraint: this instance must run with no network, so
 * there are no webfonts to load. System stacks only.
 *
 * No build step. One stylesheet, served from the web container.
 */

:root {
  /* Neutral-cool paper rather than cream: this is a measurement sheet. */
  --paper:     #f1f2f4;
  --panel:     #ffffff;
  --ink:       #14171a;
  --graphite:  #5c646c;
  --rule:      #d5d9dd;
  --rule-firm: #b9c0c7;

  /* Registration cyan, from the printer's plate. The one saturated colour. */
  --mark:      #06697a;
  --mark-soft: #e2eef0;

  --ok:        #1d6a4a;
  --warn:      #8a5200;
  --danger:    #a31d1d;
  --warn-soft: #f7eeda;
  --danger-soft: #f7e4e4;

  --shadow: 0 1px 2px rgb(20 23 26 / 6%), 0 4px 12px rgb(20 23 26 / 4%);
  --radius: 3px;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo,
          Consolas, "DejaVu Sans Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #101215;
    --panel:     #181b1f;
    --ink:       #e5e8ea;
    --graphite:  #98a1a9;
    --rule:      #292e34;
    --rule-firm: #3a4048;

    --mark:      #4bb8ca;
    --mark-soft: #123035;

    --ok:        #55c294;
    --warn:      #d9a13c;
    --danger:    #e8756a;
    --warn-soft: #2e2413;
    --danger-soft: #33191a;

    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---- the signature: a measured rule ------------------------------------
 * Section headings sit above a ruler with real tick marks, echoing the
 * verification bar on a printed marker sheet. It is the only ornament in the
 * design, and it says the same thing the whole application says: this figure
 * was measured, not asserted.
 */
.rule {
  height: 7px;
  border-bottom: 1px solid var(--rule-firm);
  background-image: repeating-linear-gradient(
    to right,
    var(--rule-firm) 0 1px,
    transparent 1px 12px
  );
  background-position: bottom;
  background-repeat: repeat-x;
  background-size: 12px 4px;
  margin: 0 0 1.15rem;
}
.rule--short { max-width: 8rem; }

/* ---- layout ---- */
.shell { display: flex; min-height: 100vh; align-items: stretch; }

.rail {
  flex: 0 0 15rem;
  background: var(--panel);
  border-right: 1px solid var(--rule);
  padding: 1.5rem 0;
}
.rail__brand {
  font: 600 13px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 0 1.25rem 1rem;
  color: var(--ink);
}
.rail__group {
  font: 500 10px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--graphite);
  padding: 1.25rem 1.25rem .5rem;
}
.rail a {
  display: block;
  padding: .4rem 1.25rem;
  color: var(--graphite);
  text-decoration: none;
  font: 13px/1.5 var(--mono);
  border-left: 2px solid transparent;
}
.rail a:hover { color: var(--ink); background: var(--mark-soft); }
.rail a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--mark);
  background: var(--mark-soft);
}

.content { flex: 1 1 auto; min-width: 0; padding: 2.25rem clamp(1rem, 4vw, 3rem) 5rem; }
.content--narrow { max-width: 46rem; margin: 0 auto; }

/* ---- type ---- */
h1 { font: 600 1.5rem/1.25 var(--sans); letter-spacing: -.015em; margin: 0 0 .35rem; }
h2 { font: 600 1.05rem/1.3 var(--sans); margin: 2.25rem 0 .35rem; }
h3 { font: 600 .95rem/1.3 var(--sans); margin: 1.5rem 0 .35rem; }
p  { margin: 0 0 .9rem; max-width: 62ch; }

.eyebrow {
  font: 500 10px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--graphite);
  display: block;
  margin-bottom: .55rem;
}
.lede { color: var(--graphite); max-width: 62ch; }
.muted { color: var(--graphite); }
.mono { font-family: var(--mono); font-size: .875em; }

code, .code {
  font: .85em var(--mono);
  background: var(--mark-soft);
  padding: .12em .38em;
  border-radius: var(--radius);
  /* break-all split CAPTFLO_ADMIN_EMAIL mid-identifier. Break only when a token
     genuinely cannot fit. */
  word-break: normal;
  overflow-wrap: anywhere;
}

/* ---- panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin: 0 0 1.15rem;
  box-shadow: var(--shadow);
}
.panel__title {
  font: 600 .95rem/1.3 var(--sans);
  margin: 0 0 .2rem;
}

/* ---- status marks ---------------------------------------------------------
 * Squares, not dots. A fiducial marker is a square, and the shape carries the
 * association everywhere it appears.
 */
.mark {
  display: inline-block;
  width: .62em; height: .62em;
  margin-right: .5em;
  vertical-align: baseline;
  background: var(--graphite);
}
.mark--ok     { background: var(--ok); }
.mark--warn   { background: var(--warn); }
.mark--danger { background: var(--danger); }
.mark--idle   { background: var(--rule-firm); }

.state {
  font: 500 11px/1 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- key/value readouts ---- */
.readout { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.5rem; margin: 0; }
.readout dt {
  font: 500 10px/1.6 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--graphite);
}
.readout dd { margin: 0; font: .875rem/1.6 var(--mono); word-break: break-word; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  font: 500 10px/1.6 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--graphite);
  padding: 0 .9rem .5rem 0;
  border-bottom: 1px solid var(--rule-firm);
  white-space: nowrap;
}
td {
  padding: .6rem .9rem .6rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
td.mono, td .mono { font-family: var(--mono); font-size: .84rem; }
/* Timestamps and status cells read as one token; wrapping them mid-value makes
   a table of them much harder to scan down. */
.nowrap, td.nowrap { white-space: nowrap; }

/* ---- forms ---- */
.field { margin: 0 0 1.15rem; }
label { display: block; font: 500 12px/1.4 var(--sans); margin-bottom: .3rem; }
.field__hint { font-size: .8rem; color: var(--graphite); margin: .3rem 0 0; max-width: 58ch; }

input[type="text"], input[type="email"], input[type="number"], input[type="url"],
input[type="password"], select, textarea {
  width: 100%;
  padding: .5rem .6rem;
  font: .875rem var(--mono);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-firm);
  border-radius: var(--radius);
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
}
input[type="checkbox"] { width: auto; accent-color: var(--mark); }

.btn {
  display: inline-block;
  font: 500 12px/1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .6rem .95rem;
  border: 1px solid var(--rule-firm);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--mark); color: var(--mark); }
.btn--primary { background: var(--mark); border-color: var(--mark); color: #fff; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.1); color: #fff; }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn--small { padding: .35rem .6rem; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---- notices ---- */
.notice {
  border-left: 3px solid var(--rule-firm);
  background: var(--panel);
  padding: .8rem 1rem;
  margin: 0 0 1.15rem;
  font-size: .9rem;
}
.notice p:last-child { margin-bottom: 0; }
.notice--ok     { border-left-color: var(--ok); }
.notice--warn   { border-left-color: var(--warn); background: var(--warn-soft); }
.notice--danger { border-left-color: var(--danger); background: var(--danger-soft); }

/* ---- test session banner ---- */
.test-banner {
  background: var(--warn);
  color: #fff;
  padding: .55rem clamp(1rem, 4vw, 3rem);
  font: 600 11px/1.5 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

/* ---- wizard steps ---------------------------------------------------------
 * Numbered because the setup flow genuinely is a sequence: the database has to
 * work before storage can be validated against it. Order carries information.
 */
.steps { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.steps li { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--graphite); }
.steps li[aria-current="step"] { color: var(--mark); }
.steps li.is-done { color: var(--ok); }
.steps .n { display: inline-block; min-width: 1.6em; }

/* ---- small screens ---- */
@media (max-width: 46rem) {
  .shell { display: block; }
  .rail { border-right: none; border-bottom: 1px solid var(--rule); padding: 1rem 0; }
  .rail a { display: inline-block; }
  .content { padding: 1.5rem 1rem 3rem; }
  .readout { grid-template-columns: 1fr; gap: .1rem .5rem; }
  .readout dd { margin-bottom: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   Landing page
   ---------------------------------------------------------------------------
   The hero is the object CaptFlo actually prints: a marker sheet. A black
   fiducial, a generous quiet zone, plain-text identifiers, and a bar labelled
   "this line is exactly 100 mm - measure it". It is rendered as a physical
   sheet -- white, with a shadow -- in both themes, because an ArUco marker is
   black-on-white by definition and a sheet of paper on a dark desk is still a
   sheet of paper.

   Namespaced .lp- so nothing here can collide with the console styles above.
   =========================================================================== */

.lp { max-width: 66rem; margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2.5rem); }

.lp-nav {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 1.5rem 0 0;
}
.lp-wordmark {
  font: 600 15px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
}
.lp-nav__meta { font: 500 11px/1 var(--mono); letter-spacing: .1em; color: var(--graphite); }

/* ---- hero ---- */
.lp-hero {
  display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center; padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
}
.lp-hero__copy { min-width: 0; }
.lp-h1 {
  font: 600 clamp(1.9rem, 4.6vw, 2.9rem)/1.1 var(--sans);
  letter-spacing: -.03em; margin: 0 0 1rem;
  /* No text-wrap:balance -- the headline carries an explicit <br> between its
     two sentences, and balance fought it, orphaning "Capture a" on line one. */
}
.lp-h1 em { font-style: normal; color: var(--mark); }
.lp-sub {
  font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--graphite);
  max-width: 34ch; margin: 0 0 1.75rem;
}

/* ---- the marker sheet ---- */
.lp-sheet {
  background: #fff; padding: 1.35rem 1.35rem 1rem;
  text-wrap: pretty;
  box-shadow: 0 1px 1px rgb(0 0 0 / 10%), 0 10px 34px rgb(0 0 0 / 14%);
  border-radius: 2px; width: 16.5rem; flex: 0 0 auto;
}
.lp-sheet svg { display: block; width: 100%; height: auto; }
.lp-sheet__id {
  font: 500 9px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: #4a4a4a; display: flex; justify-content: space-between; margin-top: .7rem;
}
.lp-sheet__bar { margin-top: .55rem; }
.lp-sheet__bar svg { width: 100%; }
.lp-sheet__cap {
  font: 500 8.5px/1.4 var(--mono); color: #6a6a6a; text-align: center;
  margin-top: .25rem; letter-spacing: .02em; text-wrap: balance;
}

/* ---- sections ---- */
.lp-section { padding: clamp(2.5rem, 6vw, 4rem) 0; border-top: 1px solid var(--rule); }
.lp-kicker {
  font: 500 10px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase;
  color: var(--graphite); display: block; margin-bottom: .9rem;
}
.lp-h2 {
  font: 600 clamp(1.3rem, 2.6vw, 1.65rem)/1.2 var(--sans);
  letter-spacing: -.02em; margin: 0 0 1.5rem; max-width: 26ch;
}

.lp-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.75rem; }
.lp-pair h3 { font: 600 1rem/1.3 var(--sans); margin: 0 0 .4rem; }
.lp-pair p  { color: var(--graphite); font-size: .93rem; margin: 0; }
.lp-pair__tag {
  font: 500 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--mark); display: block; margin-bottom: .55rem;
}

/* The capture flow is a genuine sequence -- the plan has to exist before you
   print it, the markers before you shoot. Numbering carries information here. */
.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.lp-steps li {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: .9rem; align-items: baseline;
  padding: .7rem 0; border-bottom: 1px solid var(--rule);
}
.lp-steps li:last-child { border-bottom: none; }
.lp-steps .n { font: 500 10px/1.6 var(--mono); letter-spacing: .1em; color: var(--mark); }
.lp-steps b  { font: 600 .95rem/1.5 var(--sans); }
.lp-steps span { color: var(--graphite); font-size: .9rem; }

.lp-note {
  border-left: 2px solid var(--mark); padding: .15rem 0 .15rem 1.15rem;
  max-width: 46ch; color: var(--graphite); font-size: .95rem;
}
.lp-note strong { color: var(--ink); font-weight: 600; }

/* ---- sign-in ---- */
.lp-cta { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.lp-signin {
  display: inline-flex; align-items: center; gap: .6rem;
  background: var(--mark); color: #fff; text-decoration: none;
  padding: .78rem 1.2rem; border-radius: var(--radius);
  font: 500 12px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
}
.lp-signin:hover { filter: brightness(1.1); }
.lp-signin svg { width: 15px; height: 15px; }
.lp-access { font-size: .85rem; color: var(--graphite); margin: .9rem 0 0; max-width: 40ch; }

/* ---- signed-in panel ---- */
.lp-you {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--panel); padding: 1.1rem 1.25rem; margin: 0 0 1.5rem;
}
.lp-you__who { font: .9rem/1.5 var(--mono); margin: 0 0 .75rem; }

.lp-foot {
  border-top: 1px solid var(--rule); padding: 1.5rem 0 3rem;
  font: 500 10px/1.7 var(--mono); letter-spacing: .09em;
  color: var(--graphite); display: flex; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; text-transform: uppercase;
}
.lp-foot a { color: var(--graphite); }

@media (max-width: 48rem) {
  .lp-hero { grid-template-columns: 1fr; }
  .lp-sheet { width: min(16.5rem, 100%); order: -1; margin-inline: auto; }
}
