:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8b93a3;
  --accent: #4fb3ff;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --crit: #ff5d5d;
  --input-accent: #e0913f;
  --input-accent-bg: #3a2510;
  --step-text: #cf9a68;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.disclaimer {
  width: 100%;
  box-sizing: border-box;
  background: #241c0d;
  color: var(--muted);
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.72rem;
  line-height: 1.5;
  text-align: center;
  padding: 7px 16px;
}

.wrap {
  width: 100%;
  max-width: 720px;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header h1 {
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lang-switch {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lang-btn {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.lang-btn:hover { color: var(--text); border-color: var(--accent); }

.lang-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: #16233a;
}

.breadcrumb {
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0.7;
  text-align: center;
  padding: 0 16px;
}

.breadcrumb-alert {
  color: var(--crit);
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 160px;
}

.q-text {
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 600;
}

.q-text-with-refrigerant {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.q-refrigerant-chip {
  flex-shrink: 0;
  font-weight: 400;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn {
  border: 1px solid var(--panel-border);
  background: #1e2330;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.btn:hover { border-color: var(--accent); background: #202840; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:disabled:hover { border-color: var(--panel-border); background: #1e2330; }

.btn.ghost {
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 8px 12px;
}

.btn.ghost:hover { color: var(--text); border-color: var(--accent); }

.btn.ai {
  border-color: var(--accent);
  color: var(--accent);
  background: #16233a;
}

.btn.ai:hover { background: #1c2e4d; }

.btn.input-action {
  border-color: var(--input-accent);
  color: var(--input-accent);
  background: var(--input-accent-bg);
}

.btn.input-action:hover { background: #4a3018; }

.result-text {
  font-size: 0.98rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 6px;
}

.badge.info { background: #16233a; color: var(--accent); }
.badge.warning { background: #3a2f10; color: var(--warn); }
.badge.critical { background: #3a1616; color: var(--crit); }

.safety-banner {
  background: #3a1616;
  color: var(--crit);
  border: 1px solid var(--crit);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.related-checks {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.related-checks-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 6px;
}

.related-checks ul {
  margin: 0;
  padding-left: 1.2em;
}

textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  background: #0f1115;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  font-size: 0.95rem;
}

.numeric-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.numeric-input {
  /* Shared visual style, also reused (deliberately) for non-numeric
     fields that just want the same look — manufacturer/model/refrigerant
     selects — so this class itself must NOT assume a short numeric value.
     See .numeric-input.narrow below for the fields that actually are one. */
  flex: 1;
  min-width: 0;
  background: #0f1115;
  color: var(--text);
  border: 1px solid var(--input-accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1.3rem;
  box-shadow: 0 0 0 1px rgba(224, 145, 63, 0.15);
}

.numeric-input:focus {
  outline: none;
  border-color: var(--input-accent);
  box-shadow: 0 0 0 3px rgba(224, 145, 63, 0.25);
}

/* Readings here are a handful of digits (temps, pressures, amps) — 6ch is
   comfortable room without the field stretching across the card. Applied
   only to fields that actually take a typed number (numeric_input,
   measurement) — never to .numeric-input alone, which is also reused for
   non-numeric selects/inputs that need the same look at full width. */
.numeric-input.narrow {
  flex: 0 0 auto;
  width: 6ch;
}

.numeric-input.invalid {
  border-color: var(--crit);
  box-shadow: none;
}

.numeric-unit {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--input-accent);
  white-space: nowrap;
}

.numeric-hint {
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.1em;
}

/* Same muted small-print register as .numeric-hint above, and reserved
   height for the same reason: the line is always present, so nothing below
   it moves as the count changes while typing. Only goes loud (--warn, the
   palette's existing "pay attention, not an error" colour) in the last 10%. */
/* Quota warning. Deliberately quiet at the halfway mark and unmistakable in
   the last tenth: the point is to let a technician finish the job on the
   requests left, not to nag. The pink reads as "running out" without the
   alarm of an error state, which this is not — the checklist keeps working
   either way. */
.quota-notice {
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid rgba(139, 147, 163, 0.35);
}

.quota-notice.critical {
  color: #ffd7e4;
  background: rgba(255, 122, 168, 0.14);
  border-color: rgba(255, 122, 168, 0.55);
}

.char-counter {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  min-height: 1.1em;
  text-align: right;
}

.char-counter.near-limit {
  color: var(--warn);
}

.measurement-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.measurement-field-label {
  font-size: 0.82rem;
  color: var(--input-accent);
}

.measurement-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 2px solid var(--crit);
  background: #3a1616;
  color: #ffd6d6;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.measurement-alert-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.ai-box {
  border-top: 1px dashed var(--panel-border);
  padding-top: 14px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.intake-progress {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.intake-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.intake-item.current {
  border-color: var(--input-accent);
  background: rgba(224, 145, 63, 0.08);
}

/* select-type items only — the row border reflects whether the chosen
   reading matches `normal` (green), doesn't (red/amber), or was ruled N/A
   (neutral, no extra class). Checkbox items never get this: there's no
   "bad" outcome for them, only done/not-applicable. */
.intake-item.intake-select-normal {
  border-color: var(--ok);
  background: rgba(62, 207, 142, 0.08);
}

.intake-item.intake-select-abnormal {
  border-color: var(--crit);
  background: rgba(255, 93, 93, 0.08);
}

.intake-item-label {
  font-size: 0.92rem;
  line-height: 1.4;
}

.intake-item-field-row {
  display: flex;
  gap: 8px;
}

.intake-item-field-row .intake-toggle-btn {
  flex: 0 0 84px;
}

/* Button-toggle group shared by checkbox (Done/N-A) and select (options +
   N-A) items — replaces the old native checkbox + tiny "N/A" checkbox with
   large, unambiguous, glove-friendly tap targets (see CLAUDE.md intake UI
   task: the old checkbox-only UI was easy to misread at a glance). */
.intake-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.intake-toggle-btn {
  flex: 1;
  min-width: 64px;
  min-height: 52px;
  border: 1px solid var(--panel-border);
  background: #1e2330;
  color: var(--muted);
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.intake-toggle-btn:hover { border-color: var(--accent); color: var(--text); }

.intake-toggle-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Generic "selected" fill — used as-is for checkbox's Done button (no
   good/bad judgment, just an explicit confirmation) and as the base for
   select's normal/abnormal variants below. */
.intake-toggle-btn.active {
  background: #16233a;
  border-color: var(--accent);
  color: var(--text);
}

.intake-toggle-btn.active.normal {
  background: rgba(62, 207, 142, 0.18);
  border-color: var(--ok);
  color: var(--ok);
}

.intake-toggle-btn.active.abnormal {
  background: rgba(255, 93, 93, 0.18);
  border-color: var(--crit);
  color: #ffb3b3;
}

.intake-toggle-btn.intake-na-btn.active {
  background: #262b36;
  border-color: var(--muted);
  color: var(--text);
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--panel-border);
  padding-top: 14px;
  margin-top: 6px;
}

.checklist-progress {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  cursor: pointer;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--input-accent);
  flex-shrink: 0;
}

.checklist-field-input {
  flex: 1;
  min-width: 0;
  background: #0f1115;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
}

/* A field with a unit is always a numeric reading, never free text (see
   the field items in graph.json) — same 6ch reasoning as .numeric-input,
   instead of stretching across the row like a description field does. */
.checklist-field-input.numeric {
  flex: 0 0 auto;
  width: 6ch;
}

.report-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.report-intake-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: #1e2330;
  color: var(--text);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.report-intake-row:hover { border-color: var(--accent); }

.report-intake-row.done {
  border-color: var(--ok);
  background: rgba(62, 207, 142, 0.08);
}

.report-intake-row.pending {
  border-color: var(--input-accent);
  background: rgba(224, 145, 63, 0.08);
}

.report-intake-icon {
  font-weight: 700;
  flex: 0 0 auto;
}

.report-intake-row.done .report-intake-icon { color: var(--ok); }
.report-intake-row.pending .report-intake-icon { color: var(--input-accent); }

.mfg-doc-link {
  font-size: 0.85rem;
}

.mfg-doc-link a {
  color: var(--accent);
  text-decoration: none;
}

.mfg-doc-link a:hover {
  text-decoration: underline;
}

.ai-response {
  background: #0f1115;
  border: 1px solid #23324a;
  border-radius: 10px;
  padding: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-response.loading { color: var(--muted); font-style: italic; }
.ai-response.error { color: var(--crit); }

.ai-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.footer-disclaimer {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0.6;
  text-align: center;
  padding: 0 16px;
}

.version-info {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.6;
}

/* The source link sits in the same muted footer line as the commit hash and
   deliberately doesn't stand out — it's there to satisfy AGPL section 13 and
   for the curious, not to pull attention away from the diagnosis. */
.version-info a {
  color: inherit;
  text-decoration: underline;
}
