/* Meters admin — VectorFoundry "Kiln" tokens (UX standard v1.0, section 21). */

:root {
  --vf-bg: #f7f6f2;
  --vf-surface: #ffffff;
  --vf-surface-subtle: #fbfaf6;
  --vf-text: #24221d;
  --vf-text-muted: #615d53;
  --vf-border: rgba(60, 50, 30, .11);
  --vf-border-strong: rgba(60, 50, 30, .17);

  --vf-accent: #0c6b63;
  --vf-accent-hover: #095049;
  --vf-accent-subtle: #e7f2f0;
  --vf-on-accent: #ffffff;
  --vf-success: #15773a;
  --vf-success-bg: #e9f5ee;
  --vf-warning: #9a5b00;
  --vf-warning-bg: #fbf3e4;
  --vf-danger: #ba2e28;
  --vf-danger-bg: #fbebea;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-subtle: 0 8px 30px rgba(0, 0, 0, .055);
  --shadow-overlay: 0 24px 80px rgba(0, 0, 0, .16);

  --motion-fast: 140ms;
  --motion-standard: 200ms;
  --motion-overlay: 240ms;
}

/* --- Reset and base --------------------------------------------------- */

* { box-sizing: border-box; }

/* The `hidden` attribute must always win. Without this rule, a later
   `display` declaration at equal specificity can beat the browser's
   own `[hidden] { display: none }` default, and a "hidden" element
   still shows. `:not([hidden])` rules below still set the element's
   visible display value when the attribute is absent. */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  /* A wide table inside `.table-wrap` scrolls in its own box (see
     Tables below). Without this, some browsers still let that width
     push the whole page into a horizontal scroll. */
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--vf-text);
  background: var(--vf-bg);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }

a { color: var(--vf-accent); }

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- App shell ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 64px;
  padding: 0 var(--space-6);
  background: var(--vf-surface);
  border-bottom: 1px solid var(--vf-border);
}

.topbar .brand {
  font-size: 17px;
  font-weight: 650;
  color: var(--vf-text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  cursor: pointer;
  background: var(--vf-surface);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--vf-border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--vf-text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex: 1;
}

.nav-links a {
  position: relative;
  padding: var(--space-2) 0;
  color: var(--vf-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--motion-fast) ease-out;
}

.nav-links a:hover { color: var(--vf-text); }

.nav-links a[aria-current="page"] {
  color: var(--vf-text);
  box-shadow: inset 0 -2px 0 var(--vf-accent);
}

.session-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
  white-space: nowrap;
}

.session-info .account-link {
  color: var(--vf-text-muted);
  font-size: 13px;
  text-decoration: none;
}
.session-info .account-link:hover { color: var(--vf-text); text-decoration: underline; }

.logout-form { margin: 0; }

.content {
  padding: var(--space-6);
  max-width: 1180px;
  margin: 0 auto;
}

/* --- Page opening pattern ------------------------------------------------ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.page-header-text h1 {
  font-size: 26px;
}

.page-header-text .page-purpose {
  margin-top: var(--space-2);
  color: var(--vf-text-muted);
  font-size: 14px;
  max-width: 60ch;
}

.page-header .btn-primary { flex-shrink: 0; }

section + section,
.page-section + .page-section {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--vf-border);
}

.section-title {
  font-size: 18px;
  margin-bottom: var(--space-4);
}

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

/* `.btn-primary` and `.btn-secondary` style both a <button> and an
   <a>, so a button-styled link looks and behaves the same as a real
   button: no underline, same padding, radius, hover, focus, active. */
button, .btn, .btn-primary, .btn-secondary {
  display: inline-block;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out, transform 100ms ease-out;
}

button:disabled { cursor: not-allowed; opacity: 0.55; }

.btn-primary {
  background: var(--vf-accent);
  color: var(--vf-on-accent);
  border: 1px solid var(--vf-accent);
  padding: var(--space-3) var(--space-4);
}
.btn-primary:hover:not(:disabled) { background: var(--vf-accent-hover); border-color: var(--vf-accent-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }

.btn-secondary {
  background: var(--vf-surface);
  color: var(--vf-text);
  border: 1px solid var(--vf-border-strong);
  padding: var(--space-3) var(--space-4);
}
.btn-secondary:hover:not(:disabled) { background: var(--vf-surface-subtle); }

.btn-danger {
  background: transparent;
  color: var(--vf-danger);
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
}
.btn-danger:hover:not(:disabled) { color: #8f231e; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--vf-accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
}
.link-button:hover { color: var(--vf-accent-hover); }

.cancel-link {
  align-self: center;
  color: var(--vf-text-muted);
  font-size: 14px;
  text-decoration: none;
}
.cancel-link:hover { color: var(--vf-text); }

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

.form-section legend,
.form-legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--vf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0;
  margin-bottom: var(--space-3);
}

fieldset.form-section {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-5) 0;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 420px;
}

.field label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--vf-text);
}

.field .optional {
  font-weight: 400;
  color: var(--vf-text-muted);
}

.field-hint {
  font-size: 12px;
  color: var(--vf-text-muted);
}

.field-error {
  font-size: 12px;
  color: var(--vf-danger);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  max-width: none;
}
.checkbox-field label { font-weight: 500; }

input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--vf-text);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--vf-border-strong);
  border-radius: var(--radius-sm);
  background: var(--vf-surface);
  min-height: 40px;
}

input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; }

textarea { min-height: 80px; resize: vertical; }

input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--vf-accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

.supporting-text {
  color: var(--vf-text-muted);
  font-size: 13px;
}

.import-hint { margin-bottom: var(--space-5); }

/* --- Feedback --------------------------------------------------------------- */

.banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: var(--space-5);
}

.banner-error {
  background: var(--vf-danger-bg);
  color: var(--vf-danger);
}

.banner-success {
  background: var(--vf-success-bg);
  color: var(--vf-success);
}

.banner-warning {
  background: var(--vf-warning-bg);
  color: var(--vf-warning);
}

.banner a { color: inherit; text-decoration: underline; }

.temp-password-banner p { margin-bottom: var(--space-2); }
.temp-password-banner p:last-child { margin-bottom: 0; }
.temp-password-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-2) 0;
}
.temp-password-value {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 650;
  padding: var(--space-2) var(--space-3);
  background: var(--vf-surface);
  border: 1px solid var(--vf-border-strong);
  border-radius: var(--radius-sm);
  color: var(--vf-text);
}

.inline-form { margin: 0; }
.inline-form select { min-height: 32px; padding: var(--space-1) var(--space-2); font-size: 13px; }

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

.table-wrap { overflow-x: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--vf-border);
  font-size: 14px;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--vf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  transition: background-color var(--motion-fast) ease-out;
}
tbody tr:hover { background: var(--vf-surface-subtle); }

td.num, th.num { text-align: right; }

.text-muted { color: var(--vf-text-muted); }

.row-actions { display: flex; gap: var(--space-3); white-space: nowrap; }
.row-actions form { margin: 0; }

/* --- Empty state ------------------------------------------------------------ */

.empty-state {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  border: 1px dashed var(--vf-border-strong);
  border-radius: var(--radius-md);
  color: var(--vf-text-muted);
}
.empty-state h3 { color: var(--vf-text); margin-bottom: var(--space-2); font-size: 16px; }
.empty-state p { max-width: 44ch; margin: 0 auto; font-size: 14px; }
.empty-state .btn-primary { margin-top: var(--space-4); }

/* --- Overview stats --------------------------------------------------------- */

.overview-status {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  font-size: 15px;
}
.overview-status.is-complete {
  background: var(--vf-success-bg);
  color: var(--vf-success);
}
.overview-status.has-gaps {
  background: var(--vf-warning-bg);
  color: var(--vf-warning);
}

.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.kpi {
  min-width: 140px;
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) ease-out;
}
.kpi:hover .kpi-value { color: var(--vf-accent); }

.kpi-value {
  display: block;
  font-size: 32px;
  font-weight: 650;
  line-height: 1.1;
}

.kpi-label {
  display: block;
  margin-top: var(--space-1);
  font-size: 13px;
  color: var(--vf-text-muted);
}

.gap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.gap-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--vf-border);
  font-size: 14px;
}

.gap-list li:last-child { border-bottom: none; }

.gap-count { font-weight: 600; }

/* --- Onboarding checklist ----------------------------------------------- */

.onboarding-embed {
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  border: 1px solid var(--vf-border);
  border-radius: var(--radius-md);
  background: var(--vf-surface);
}

.onboarding-embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.onboarding-embed-header .section-title { margin-bottom: 0; }

.onboarding-resume-link { margin-bottom: var(--space-6); }

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--vf-border);
}
.checklist-item:last-child { border-bottom: none; }

.checklist-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--vf-surface-subtle);
  border: 1px solid var(--vf-border-strong);
  font-size: 13px;
  font-weight: 650;
  color: var(--vf-text-muted);
}
.checklist-item.is-done .checklist-status {
  background: var(--vf-success-bg);
  border-color: var(--vf-success);
  color: var(--vf-success);
}

.checklist-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.checklist-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--vf-text);
  text-decoration: none;
}
.checklist-label:hover { color: var(--vf-accent); }
.checklist-item.is-done .checklist-label { color: var(--vf-text-muted); font-weight: 500; }

.checklist-detail {
  font-size: 12px;
  color: var(--vf-text-muted);
}

.checklist-state {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--vf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.checklist-item.is-done .checklist-state { color: var(--vf-success); }

.checklist-skip { margin-top: var(--space-5); }

/* --- Login ------------------------------------------------------------------- */

.login-page {
  max-width: 360px;
  margin: var(--space-8) auto 0;
  padding: 0 var(--space-4);
}

.login-page h1 { font-size: 24px; margin-bottom: var(--space-6); text-align: center; }

.login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.login-form .btn-primary { width: 100%; }

/* --- Landing --------------------------------------------------------------- */

.landing-page {
  max-width: 560px;
  margin: var(--space-8) auto 0;
  padding: 0 var(--space-4);
  text-align: center;
}
.landing-page h1 { font-size: 40px; margin-bottom: var(--space-4); }
.landing-purpose {
  color: var(--vf-text-muted);
  font-size: 16px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 0 auto var(--space-6);
}
.landing-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
}

/* --- Sign-up ----------------------------------------------------------------- */

.signup-page {
  max-width: 420px;
  margin: var(--space-7) auto 0;
  padding: 0 var(--space-4) var(--space-7);
}
.signup-page h1 { font-size: 24px; margin-bottom: var(--space-2); text-align: center; }
.signup-page .page-purpose { text-align: center; margin-bottom: var(--space-6); }
.signup-form { display: flex; flex-direction: column; gap: var(--space-4); }
.signup-form .field { max-width: none; }
.signup-form .btn-primary { width: 100%; margin-top: var(--space-2); }
.signup-login-link { text-align: center; font-size: 13px; color: var(--vf-text-muted); margin-top: var(--space-5); }

/* --- Labels ------------------------------------------------------------------ */

.label-picker-actions {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.checkbox-list {
  list-style: none;
  margin: 0 0 var(--space-5) 0;
  padding: 0;
  columns: 3;
  column-gap: var(--space-5);
}

.checkbox-list li {
  break-inside: avoid;
  padding: var(--space-1) 0;
  font-size: 14px;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 400;
}

.label-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.label-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.label {
  border: 1px dashed var(--vf-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  text-align: center;
}

.label-unit { font-size: 22px; font-weight: 650; margin-top: var(--space-2); }
.label-serial, .label-site { font-size: 12px; color: var(--vf-text-muted); }

@media print {
  .no-print { display: none !important; }
  .content { max-width: none; padding: 0; margin: 0; }
  .label-grid { gap: 0; grid-template-columns: repeat(3, 1fr); }
  .label { border: 1px solid #000; border-radius: 0; }
  body { background: #fff; }
}

/* --- Cycle and reading review (spec 03) --------------------------------------- */

.breadcrumb {
  margin-bottom: var(--space-4);
  font-size: 13px;
}
.breadcrumb a { color: var(--vf-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--vf-text); }

.cycle-review-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.cycle-review-actions form { margin: 0; }

.section-summary {
  cursor: pointer;
  list-style: revert;
}
.section-summary::marker { color: var(--vf-text-muted); }

.reading-photo {
  display: block;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-md);
  background: var(--vf-surface-subtle);
}

.reading-review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.reading-review-actions form { margin: 0; }

.reveal-panel {
  max-width: 420px;
  padding-top: var(--space-4);
  border-top: 1px solid var(--vf-border);
}

/* The admin types corrected digits with a real keyboard, unlike the
   reader's on-screen keypad, so the caret must stay visible here. */
.admin-digit-boxes .digit-input { caret-color: var(--vf-text); }

/* `.reader-ai-label` centres itself for the narrow reader PWA column;
   the admin review page is left-aligned like the rest of its content.
   (A `p` qualifier outranks the later `.reader-ai-label` rule below,
   which shares its plain-class specificity but comes after it in the
   cascade.) */
p.admin-ai-label { text-align: left; }

/* --- Reader app (floor-user PWA, section 10.3) --------------------------------
   Phone-only: one column, large touch targets, few choices. Not the
   admin shell above: a management console and a floor PWA do not
   share density. */

.reader-body {
  min-height: 100vh;
  background: var(--vf-bg);
}

/* Block pull-to-refresh on the reader PWA. A downward swipe on the
   confirm or review step must not reload the page and lose the
   pending read; `resumePendingRead` in reader.js is the recovery
   path for a reload that still happens for another reason. Scoped to
   the reader layout only, through the `.reader-body` class that only
   `reader/_base.html` sets on `<body>`. */
body.reader-body {
  overscroll-behavior-y: none;
}

/* A separate rule, not joined to the one above by a comma: an older
   browser that does not know `:has()` drops a whole comma-joined
   selector list, which would silently lose the `body` rule too. */
html:has(> body.reader-body) {
  overscroll-behavior-y: none;
}

.reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 var(--space-4);
  background: var(--vf-surface);
  border-bottom: 1px solid var(--vf-border);
}

.reader-brand {
  font-size: 16px;
  font-weight: 650;
  color: var(--vf-text);
}

.reader-main {
  display: flex;
  justify-content: center;
}

.reader-page {
  width: 100%;
  max-width: 480px;
  padding: var(--space-5) var(--space-4) calc(var(--space-7) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.reader-eyebrow {
  font-size: 13px;
  color: var(--vf-text-muted);
}

.reader-back {
  color: var(--vf-text-muted);
  text-decoration: none;
  font-size: 13px;
}
.reader-back:hover { color: var(--vf-text); }

.reader-title { font-size: 24px; }

.reader-subtitle {
  color: var(--vf-text-muted);
  font-size: 14px;
}

/* Which meter the reader is on, shown above every step (meter,
   camera, confirm, review), so it never scrolls out of reach behind
   a hidden view. */
.reader-meter-header { margin-bottom: 0; }

/* Every reader step is a <section class="reader-view">, only one
   visible at a time via `hidden`. The admin `section + section` rule
   (style.css, "Page opening pattern") adds a top border and margin
   between adjacent <section> elements, and CSS sibling selectors
   match DOM order, not visibility: a hidden `<section>` still counts
   as the "previous section" for its visible neighbour. Without this
   reset, every step but the first shows a stray hairline and gap. */
.reader-view {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.reader-progress { font-size: 16px; }

.reader-hint {
  color: var(--vf-text-muted);
  text-align: center;
  font-size: 14px;
}

/* Marks the digit boxes below as the model's suggestion, not yet
   confirmed (section 13: AI output must be visually distinguishable,
   not by colour/tint alone). */
.reader-ai-label {
  color: var(--vf-accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.reader-previous,
.reader-value-line,
.reader-consumption {
  font-size: 16px;
}

.reader-value-line { font-weight: 650; }

/* :not([hidden]) keeps this authored `display` from beating the
   browser's own `[hidden] { display: none }` rule: an author style
   always wins over a user-agent style at equal specificity, so a
   plain `.reader-summary { display: flex }` would show the element
   even while its `hidden` attribute is set. */
.reader-summary:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.reader-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.reader-flags {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reader-spinner {
  color: var(--vf-text-muted);
  text-align: center;
}

/* A button-styled control that is easy to hit with a thumb. */
.btn-large {
  width: 100%;
  min-height: 56px;
  font-size: 16px;
  text-align: center;
}

/* -- Reader meter list -- */

.reader-meter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reader-meter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 var(--space-4);
  border: 1px solid var(--vf-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--vf-text);
  font-size: 15px;
  transition: border-color var(--motion-fast) ease-out;
}
.reader-meter-row:hover { border-color: var(--vf-border-strong); }

.reader-meter-status { color: var(--vf-text-muted); }
.reader-meter-row.is-done .reader-meter-status { color: var(--vf-success); font-weight: 600; }

/* -- Camera guide frame (meter photo and QR scan) -- */

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
}

#camera-video,
#scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A 5:1 rectangle at 90% width, for the meter register. The
   box-shadow dims every part of the video outside the frame. */
.guide-frame {
  position: absolute;
  top: 50%;
  left: 5%;
  width: 90%;
  aspect-ratio: 5 / 1;
  transform: translateY(-50%);
  border: 3px solid var(--vf-accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* A square guide, centred, for the QR label. */
.scan-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 65%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 3px solid var(--vf-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.capture-button {
  display: block;
  width: 72px;
  height: 72px;
  min-height: 0;
  margin: var(--space-4) auto 0;
  border-radius: 50%;
  border: 4px solid var(--vf-surface);
  outline: 1px solid var(--vf-border-strong);
  background: var(--vf-accent);
  cursor: pointer;
}
.capture-button:active { background: var(--vf-accent-hover); }

#photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.reader-crop-image:not([hidden]) {
  width: 100%;
  border-radius: var(--radius-md);
  display: block;
}

/* -- Digit boxes and keypad -- */

.digit-boxes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.digit-input {
  width: 38px;
  height: 54px;
  min-height: 0;
  padding: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 650;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  border: 1px solid var(--vf-border-strong);
  border-radius: var(--radius-sm);
  background: var(--vf-surface);
  color: var(--vf-text);
  caret-color: transparent;
}

.digit-input.is-active {
  border-color: var(--vf-accent);
  box-shadow: 0 0 0 3px var(--vf-accent-subtle);
}

/* An AI-suggested digit, not yet confirmed by the reader (section 13). */
.digit-input.is-ai-suggested {
  background: var(--vf-accent-subtle);
  border-color: var(--vf-accent);
  color: var(--vf-accent-hover);
}

.digit-input.mid-roll {
  background: var(--vf-warning-bg);
  border-color: var(--vf-warning);
  color: var(--vf-warning);
}

.digit-separator {
  font-size: 24px;
  font-weight: 650;
  padding: 0 var(--space-1);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.keypad-key {
  min-height: 56px;
  font-size: 20px;
  font-weight: 600;
  background: var(--vf-surface);
  border: 1px solid var(--vf-border-strong);
  border-radius: var(--radius-sm);
  color: var(--vf-text);
}
.keypad-key:hover:not(:disabled) { background: var(--vf-surface-subtle); }

.keypad-key-blank {
  background: transparent;
  border-color: transparent;
}

/* --- Responsive: compact (< 760px) ------------------------------------------- */

@media (max-width: 759px) {
  .topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .content { padding: var(--space-4); }

  .topbar { position: relative; }
  .nav-toggle { display: inline-flex; order: 2; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--vf-surface);
    border-bottom: 1px solid var(--vf-border);
    box-shadow: var(--shadow-overlay);
    padding: var(--space-3) var(--space-4);
    z-index: 20;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { width: 100%; padding: var(--space-3) 0; }
  .nav-links a[aria-current="page"] { box-shadow: none; font-weight: 650; }

  .session-info { order: 3; margin-left: 0; }
  .session-info .account-link { display: none; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn-primary { align-self: flex-start; }

  .kpi-row { gap: var(--space-5); }

  .checkbox-list { columns: 1; }
  .label-grid { grid-template-columns: repeat(2, 1fr); }

  .cycle-review-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .cycle-review-actions form,
  .cycle-review-actions .btn-primary,
  .cycle-review-actions .btn-secondary { width: 100%; text-align: center; }

  .reading-review-actions { flex-direction: column; align-items: stretch; }
  .reading-review-actions form,
  .reading-review-actions .btn-primary,
  .reading-review-actions .btn-secondary { width: 100%; }

  .reveal-panel { max-width: none; }
}
