/* Online Fireworks Staff, on the same design system as the Ultrafire Building Compliance Manual.

   Lean industrial: precision instrumentation rather than a to-do app. Dark first, monospace for
   every figure, hairline rules instead of cards and drop shadows, square corners.

   One accent, used sparingly. Red only ever means something needs fixing, so state is never
   carried by colour alone: LEDs are filled or hollow, and always sit beside a word. */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-var.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-var.woff2') format('woff2-variations');
  font-weight: 400 600;
  font-display: swap;
}

:root,
:root[data-theme='dark'] {
  --canvas: #0b0c0e;
  --surface: #131519;
  --raised: #1a1d22;
  --hairline: #272b32;
  --hairline-strong: #3a3f48;
  --ink: #e8eaed;
  --ink-dim: #9ba1aa;
  --ink-faint: #6f7680;
  --accent: #35d6c8;
  --accent-ink: #05201e;
  --accent-wash: rgba(53, 214, 200, 0.09);
  --alert: #ff5a5a;
  --alert-bg: #2a1113;
  --graticule: rgba(255, 255, 255, 0.022);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --canvas: #faf9f6;
  --surface: #ffffff;
  --raised: #f2f1ec;
  --hairline: #e0dfd9;
  --hairline-strong: #c4c3bb;
  --ink: #16181b;
  --ink-dim: #575c64;
  --ink-faint: #767b82;
  --accent: #0d8177;
  --accent-ink: #ffffff;
  --accent-wash: rgba(13, 129, 119, 0.09);
  --alert: #c62828;
  --alert-bg: #fbeaea;
  --graticule: rgba(0, 0, 0, 0.03);
  color-scheme: light;
}

:root {
  --sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 2;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
}
.skip:focus { top: 0.5rem; }

/* ---------- Type ---------- */

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.15rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

p { max-width: 68ch; text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* Instrument-panel label: small, letterspaced, quiet. */
.label, legend, th, dt {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.data {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'zero' 1;
}

.dim { color: var(--ink-dim); }
.muted, .hint { color: var(--ink-faint); font-size: 0.8125rem; }

/* ---------- Shell ---------- */

.topbar { border-bottom: 1px solid var(--hairline); background: var(--canvas); }

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}

.mark { width: 30px; height: 30px; flex: none; color: var(--accent); }

.brand-text { display: grid; gap: 0.2rem; padding-left: 0.75rem; border-left: 1px solid var(--hairline-strong); }
.brand-name { font-size: 0.9375rem; font-weight: 600; line-height: 1; letter-spacing: -0.01em; }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; }

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 160ms var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a.current { color: var(--ink); }
.nav a.current::after {
  content: '';
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: calc(-0.875rem - 1px);
  height: 2px;
  background: var(--accent);
}

.count {
  min-width: 1.15rem;
  padding: 0.05rem 0.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.6875rem/1.35 var(--mono);
  text-align: center;
}

.tools { display: flex; align-items: center; gap: 0.75rem; color: var(--ink-faint); font-size: 0.75rem; }
.tools form { margin: 0; }
.tools button { font-size: 0.75rem; }

main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 2.25rem 1.5rem 5rem; flex: 1; }
main.narrow { max-width: 620px; }
main.single { max-width: 400px; padding-top: 12dvh; }

/* ---------- Page header and readouts ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.75rem;
}
.page-head .label { display: block; margin-bottom: 0.6rem; }
.page-head .sub { margin-top: 0.6rem; color: var(--ink-dim); }

.readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.75rem;
  padding: 1.25rem 0;
  margin-bottom: 2rem;
  border-block: 1px solid var(--hairline);
}
.readout { display: grid; gap: 0.5rem; min-width: 5.5rem; }
.readout .value {
  font: 400 clamp(1.45rem, 1.2rem + 1vw, 1.9rem)/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.readout.key .value { color: var(--accent); }
.readout .value.alert { color: var(--alert); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 0.875rem;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  font: 400 0.6875rem/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.steps li { display: flex; align-items: center; gap: 0.5rem; }
.steps .done { color: var(--ink-dim); }
.steps .now { color: var(--accent); }

/* ---------- Status lights ---------- */

.led {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: 400 0.6875rem/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.led::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border: 1px solid var(--hairline-strong);
}
.led.on { color: var(--ink); }
.led.alert { color: var(--alert); }
.led.alert::before { border-color: var(--alert); background: var(--alert); }
.led.on::before { background: var(--accent); border-color: var(--accent); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border-block: 1px solid var(--hairline); }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th, td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
}
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 120ms var(--ease); }
tbody tr:hover { background: var(--surface); }

.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: 'zero' 1; }
th.num { font-variant-numeric: normal; }
td.strong { color: var(--ink); font-weight: 500; }
td.emph { color: var(--accent); font-weight: 500; }
td.wrap { white-space: normal; min-width: 14rem; }
td .row-link { color: var(--ink); font-weight: 500; text-decoration: none; }
td .row-link:hover { color: var(--accent); }

tfoot td { border-top: 1px solid var(--hairline-strong); border-bottom: 0; color: var(--ink); font-weight: 500; }
tfoot td:first-child { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 400; }

/* The name stays in view while a wide pay table scrolls on a phone. */
.pinned th:first-child, .pinned td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--canvas);
  padding-right: 1rem;
}
.pinned tbody tr:hover td:first-child { background: var(--surface); }

td input { width: 6.5rem; min-height: 2.25rem; padding: 0.35rem 0.5rem; font-size: 0.875rem; }
td input.wide { width: 11rem; }
td input.day { width: 4.25rem; }
.row-actions { display: flex; gap: 1rem; }
td input.data { text-align: right; }

.empty {
  padding: 2.75rem 1.25rem;
  border: 1px dashed var(--hairline-strong);
  text-align: center;
  color: var(--ink-dim);
}
.empty p { margin: 0 auto; }
td.empty-cell { padding: 1.25rem 0; color: var(--ink-faint); white-space: normal; }

/* ---------- Forms ---------- */

.stack { display: grid; gap: 1.25rem; }

label { display: grid; gap: 0.5rem; font: 400 0.6875rem/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }

input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 0;
  color: var(--ink);
  font: 400 1rem/1.4 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
input.data, textarea.data { font-family: var(--mono); }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
textarea { resize: vertical; }

label.check {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem;
  font: 400 0.9375rem/1.45 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-dim);
  cursor: pointer;
}
label.check strong { color: var(--ink); font-weight: 600; }
label.check input {
  width: 1.2rem;
  height: 1.2rem;
  min-height: 0;
  margin: 0.1rem 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
}
label.check span:last-child { flex: 1; min-width: 12rem; }
label.check:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }

.field-error {
  flex-basis: 100%;
  order: -1;
  font: 400 0.8125rem/1.4 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  color: var(--alert);
}

.inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.25rem; align-items: end; }

.panel { padding: 1.5rem 0; border-top: 1px solid var(--hairline); }
.panel > p.hint { margin-top: 0; }

/* Staff form: numbered sections down a single measure. */
.sheet { counter-reset: section; display: grid; gap: 2.25rem; }
fieldset {
  counter-increment: section;
  display: grid;
  gap: 1.25rem;
  min-width: 0;
  margin: 0;
  padding: 1.25rem 0 0;
  border: 0;
  border-top: 1px solid var(--hairline-strong);
}
legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 0.25rem;
  color: var(--ink-dim);
}
legend::before {
  content: counter(section, decimal-leading-zero);
  margin-right: 0.75rem;
  color: var(--accent);
}
legend + * { clear: both; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.secure { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.secure svg { width: 13px; height: 13px; flex: none; color: var(--accent); }

/* The bank check: three lights and the number read back. */
.verify { background: var(--surface); border: 1px solid var(--hairline); padding: 1rem; display: grid; gap: 0.9rem; }
.verify-lights { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.readback {
  font: 400 clamp(1.05rem, 0.9rem + 1.3vw, 1.4rem)/1.2 var(--mono);
  font-feature-settings: 'zero' 1;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
.readback.ok { color: var(--accent); }
.bank-status { min-height: 1.3rem; color: var(--ink-dim); font-size: 0.875rem; }
.bank-status.bad { color: var(--alert); }

input.code {
  min-height: 3.75rem;
  font: 400 1.75rem/1 var(--mono);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-align: center;
}

/* ---------- Buttons ---------- */

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.95rem;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  border-radius: 0;
  color: var(--ink);
  font: 500 0.875rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), opacity 140ms var(--ease), transform 80ms var(--ease);
}
button:hover, .button-link:hover { background: var(--raised); }
button:active, .button-link:active { transform: translateY(1px); }

button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: var(--accent); opacity: 0.88; }
button.primary:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
button.full { width: 100%; min-height: 3rem; }

button.danger { border-color: var(--alert); color: var(--alert); }
button.danger:hover { background: var(--alert-bg); }

button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-weight: 400;
}
button.link:hover { background: none; color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1.25rem 0; }
.actions form { margin: 0; }
.spread { justify-content: space-between; }

.copy-field { display: flex; max-width: 34rem; margin-bottom: 1.75rem; }
.copy-field input { flex: 1; font-family: var(--mono); font-size: 0.875rem; min-height: 2.5rem; border-right: 0; color: var(--ink-dim); }
.copy-field button { flex: none; }

/* ---------- Messages ---------- */

.notice, .error, .warning {
  max-width: none;
  margin: 0 0 1.5rem;
  padding: 0.65rem 0.9rem;
  border-left: 2px solid;
  font-size: 0.875rem;
}
.notice { border-color: var(--accent); background: var(--accent-wash); color: var(--ink); }
.error, .warning { border-color: var(--alert); background: var(--alert-bg); color: var(--alert); }
.warning strong { font-weight: 600; }

/* ---------- Details ---------- */

dl.details { display: grid; grid-template-columns: minmax(7.5rem, 12rem) 1fr; margin: 0; border-top: 1px solid var(--hairline); }
dl.details dt, dl.details dd { padding: 0.7rem 0; border-bottom: 1px solid var(--hairline); }
dl.details dt { padding-top: 0.95rem; padding-right: 1rem; }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
dl.details dd.data { font-size: 0.9375rem; }
dl.details dd.changed { background: var(--accent-wash); box-shadow: -0.6rem 0 0 var(--accent-wash), 0.6rem 0 0 var(--accent-wash); color: var(--ink); font-weight: 500; }
dl.details .was { display: block; color: var(--ink-faint); font-weight: 400; font-size: 0.8125rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }

/* ---------- Sign-in and confirmation ---------- */

.graticule {
  background-image:
    linear-gradient(var(--graticule) 1px, transparent 1px),
    linear-gradient(90deg, var(--graticule) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
}

.single-head { margin-bottom: 2rem; }
.single-head h1 { font-size: 1.5rem; }
.single-head .label { display: block; margin-top: 0.5rem; }
.single-head + .dim { margin-bottom: 1.75rem; }
.single-form { padding-top: 1.75rem; border-top: 1px solid var(--hairline); }
.single-foot { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--hairline); font-size: 0.8125rem; color: var(--ink-faint); }

.burst { width: 72px; height: 72px; color: var(--accent); margin-bottom: 1.5rem; }
.burst .ray { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 620ms var(--ease) forwards; }
.burst .ray:nth-child(2n) { animation-delay: 90ms; }
.burst .ray:nth-child(3n) { animation-delay: 170ms; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .topbar-inner { padding: 0.75rem 1rem; }
  .nav { order: 3; width: calc(100% + 2rem); margin: 0 -1rem -0.75rem; padding: 0 0.5rem; flex-wrap: nowrap; overflow-x: auto; border-top: 1px solid var(--hairline); scrollbar-width: none; }
  .nav a { padding: 0.65rem 0.5rem; white-space: nowrap; }
  .nav a.current::after { left: 0.5rem; right: 0.5rem; bottom: 0; }
  main { padding: 1.5rem 1rem 4rem; }
  main.single { padding-top: 8dvh; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .readouts { gap: 1rem 2rem; }
}
