@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;900&family=Barlow:wght@400;500;600&display=swap');

:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface2: #1f2435;
  --border: #2a3048;
  --accent: #f5a623;
  --accent2: #e8441a;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #3b82f6;
  --text: #e8eaf0;
  --muted: #6b7280;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#root {
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

h1, h2, h3, h4 {
  font-family: 'Barlow Condensed', sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* Inputs & Selects */

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  /* 16px prevents iOS Safari from auto-zooming on focus */
  font-size: 16px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  /* Remove iOS default styling */
  -webkit-appearance: none;
  appearance: none;
}

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

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

select option {
  background: var(--surface2);
  color: var(--text);
}

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

/* Buttons */

.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  /* 44px min height for touch targets (Apple HIG / Material guidelines) */
  min-height: 44px;
  padding: 8px 16px;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  /* Eliminates 300ms tap delay on mobile */
  touch-action: manipulation;
  /* Prevent text selection on tap-hold */
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover:not(:disabled) {
  opacity: 0.88;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--accent);
  color: #111;
}

.btn-success {
  background: var(--green);
  color: #111;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-blue {
  background: var(--blue);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text);
  opacity: 1;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 36px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Card */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

/* Badge */

.badge {
  background: var(--accent);
  color: #111;
  border-radius: 4px;
  font-family: 'Barlow Condensed', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  display: inline-block;
}

.badge-muted {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.2);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Pill */

.pill {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
}

.pill-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.pill-yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
}

.pill-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.pill-muted {
  background: var(--surface2);
  color: var(--muted);
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(2px);
}

@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    padding: 16px;
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

@media (min-width: 600px) {
  .modal {
    border-radius: 12px;
    padding: 28px;
    max-width: 520px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Form */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group label .required {
  color: var(--accent);
  margin-left: 3px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Table */

table {
  width: 100%;
  border-collapse: collapse;
  /* Prevent table text from being tiny on mobile */
  font-size: 14px;
}

thead th {
  background: var(--surface2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 10px 12px;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

tbody td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Scrollbar */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Progress bar */

.progress-bar {
  background: var(--surface2);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}

/* Divider */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Stat card */

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 6px;
  text-transform: uppercase;
}

/* Bar chart row */

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.bar-row .bar-label {
  font-size: 13px;
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row .bar-track {
  flex: 1;
  background: var(--surface2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.bar-row .bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
}

.bar-row .bar-qty {
  color: var(--muted);
  font-size: 12px;
  min-width: 40px;
  text-align: right;
}

/* Section header */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

/* Grid layouts */

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Input with orange border (required) */

input.required-field {
  border-color: var(--accent);
}

/* Empty state */

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 32px;
  text-align: center;
}

/* Scan box */

.scan-box {
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.scan-box:hover {
  border-color: var(--accent);
}

.scan-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* Label card for printing */

.label-card {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #000;
  display: flex;
  flex-direction: column;
  font-family: 'Barlow Condensed', sans-serif;
  overflow: hidden;
  padding: 4px;
}

/* 3×3 inch labels at screen 96dpi */

.label-card.size-small {
  width: 216px;
  height: 216px;
}

.label-card.size-medium {
  width: 288px;
  height: 288px;
}

.label-card.size-large {
  width: 360px;
  height: 360px;
}

/* Print styles handled in the bottom @media print block */

#label-print-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
}

/* Filter chips */

.filter-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

/* Safe area support (iPhone X+ notch / home bar) */

#app header {
  padding-top: env(safe-area-inset-top);
}

main {
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* Scrollable containers */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Filter chips */

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  -webkit-overflow-scrolling: touch;
}

/* Media queries */

@media (max-width: 700px) {
  main {
    padding: 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

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

  .grid-2 {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 13px;
  }

  thead th, tbody td {
    padding: 8px;
  }

  /* Ensure touch targets stay reachable in table */
  tbody td .btn {
    min-height: 36px;
  }

  /* Bar chart label truncation on small screens */
  .bar-row .bar-label {
    min-width: 80px;
    font-size: 12px;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Print styles */

/* Print is handled by the popup window opened by handlePrint in LabelsView */
/*
 * Help centre styling.
 *
 * Two presentations of the same articles:
 *   .hc-app   — the browsable in-app help, on the shop's dark theme
 *   .hcp      — the procedure package, on paper, both on screen and in print
 *
 * The @media print block at the bottom is what turns the package into the
 * submitted document: it hides the application entirely and lays the package out
 * for letter paper.
 */

.hc-app {
  /* Local tokens. The global --muted is tuned for small labels and is too dark
     for a wall of body text, so prose gets its own lighter secondary. */
  --hc-prose: #d4d8e2;
  --hc-prose-dim: #9aa2b4;
  --hc-rule: #2a3048;
  --hc-sidebar: 268px;
  --hc-rail: 190px;

  display: grid;
  grid-template-columns: var(--hc-sidebar) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.hc-side {
  position: sticky;
  top: 118px; /* header 56 + tab bar 50, plus a little air */
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  border-right: 1px solid var(--hc-rule);
}

.hc-side-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.4px;
  margin: 0 0 2px;
}

.hc-side-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 14px;
}

.hc-search {
  width: 100%;
  margin-bottom: 16px;
}

.hc-nav-section {
  margin-bottom: 18px;
}

.hc-nav-heading {
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 6px;
  padding-left: 10px;
}

.hc-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--hc-prose-dim);
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
  font-size: 13.5px;
  line-height: 1.35;
  padding: 8px 10px;
  min-height: 36px;
  touch-action: manipulation;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.hc-nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.hc-nav-item.is-active {
  background: var(--surface2);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.hc-nav-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px;
}

/* Mobile: the sidebar becomes a disclosure above the article */
.hc-side-toggle { display: none; }

/* ── Article column ──────────────────────────────────────────────────────── */

.hc-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--hc-rail);
  gap: 32px;
  align-items: start;
}

.hc-article {
  min-width: 0;
  max-width: 74ch;
}

.hc-eyebrow {
  color: var(--accent);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hc-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.1;
  margin: 0 0 20px;
}

.hc-body {
  color: var(--hc-prose);
  font-size: 15px;
  line-height: 1.68;
}

.hc-body p { margin: 0 0 15px; }

.hc-body h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  margin: 34px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--hc-rule);
  scroll-margin-top: 130px;
}

.hc-body h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  margin: 26px 0 8px;
  scroll-margin-top: 130px;
}

.hc-body h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 6px;
}

.hc-body strong { color: var(--text); font-weight: 700; }

.hc-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.hc-body code {
  background: var(--surface2);
  border: 1px solid var(--hc-rule);
  border-radius: 4px;
  color: var(--accent);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.87em;
  padding: 1px 5px;
  white-space: nowrap;
}

.hc-pre {
  background: var(--surface);
  border: 1px solid var(--hc-rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  color: var(--hc-prose);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 16px;
  overflow-x: auto;
  padding: 14px 16px;
}

.hc-pre code {
  background: none;
  border: none;
  color: inherit;
  font-size: inherit;
  padding: 0;
  white-space: pre;
}

.hc-list { margin: 0 0 16px; padding-left: 22px; }
.hc-list li { margin-bottom: 7px; }
.hc-sublist { margin: 7px 0 0; padding-left: 20px; list-style: circle; }
.hc-sublist li { margin-bottom: 4px; color: var(--hc-prose-dim); }

.hc-hr { border: none; border-top: 1px solid var(--hc-rule); margin: 28px 0; }

/* AS PER ASME ticket stamp — a facsimile of what is printed on a certificate.
   Drawn rather than embedded as an image so it prints cleanly in the procedure
   package and carries no real welder's details. */
.hc-stamp { margin: 0 0 18px; }

.hc-stamp-sheet {
  background: #fff;
  border: 1px solid var(--hc-rule);
  border-radius: 6px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The blank form block the stamp is applied to. Representative, not a
   reproduction of the TSSA form. */
.hc-form {
  color: #1a1a1a;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 10px;
  line-height: 1.55;
}

.hc-form-bar {
  background: #1a1a1a;
  color: #fff;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  text-align: center;
  margin-bottom: 6px;
}

.hc-form-line { margin-bottom: 3px; }

.hc-form-check {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 3px;
}

.hc-form-box {
  border: 1px solid #1a1a1a;
  display: inline-block;
  flex: none;
  height: 9px;
  width: 9px;
}

.hc-form-cols {
  display: flex;
  gap: 22px;
  margin-top: 10px;
}

.hc-form-cols > div {
  border-top: 1px solid #1a1a1a;
  flex: 1;
  font-size: 9px;
  padding-top: 2px;
  text-align: center;
}

.hc-form-fine {
  font-size: 8.5px;
  font-style: italic;
  margin-top: 6px;
}

.hc-form-rule {
  border-bottom: 1px solid #1a1a1a;
  display: inline-block;
  min-width: 90px;
  margin: 0 3px;
  vertical-align: bottom;
  height: 0.85em;
}

.hc-stamp-box {
  align-self: flex-end;
  border: 2px solid #c62828;
  color: #c62828;
  font-family: 'Barlow Condensed', Helvetica, Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1.25;
  padding: 6px 12px;
  text-align: center;
  font-size: 15px;
}

.hc-stamp-box .hc-stamp-when {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.hc-stamp-foot {
  border-top: 1px solid #c62828;
  color: #c62828;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 10.5px;
  line-height: 1.5;
  padding-top: 7px;
}

.hc-stamp-foot .hc-stamp-head {
  font-weight: 700;
  font-size: 11.5px;
  margin-bottom: 2px;
}

/* Tables */
.hc-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 18px; }

.hc-table {
  border-collapse: collapse;
  font-size: 13.5px;
  width: 100%;
}

.hc-table th {
  background: var(--surface2);
  border-bottom: 1px solid var(--hc-rule);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 9px 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.hc-table td {
  border-bottom: 1px solid var(--hc-rule);
  padding: 9px 12px;
  vertical-align: top;
}

.hc-table tr:last-child td { border-bottom: none; }

/* Callouts */
.hc-callout {
  border: 1px solid var(--hc-rule);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  background: var(--surface);
  margin: 0 0 18px;
  padding: 13px 16px;
}

.hc-callout-body p { margin: 0 0 8px; }
.hc-callout-body p:last-child { margin-bottom: 0; }

.hc-callout-label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.hc-callout-note        { border-left-color: var(--blue); }
.hc-callout-note   .hc-callout-label { color: #7aa7f5; }
.hc-callout-tip         { border-left-color: var(--green); }
.hc-callout-tip    .hc-callout-label { color: var(--green); }
.hc-callout-important   { border-left-color: var(--accent); }
.hc-callout-important .hc-callout-label { color: var(--accent); }
.hc-callout-rule        { border-left-color: var(--accent); background: rgba(245, 166, 35, 0.07); }
.hc-callout-rule   .hc-callout-label { color: var(--accent); }
.hc-callout-record      { border-left-color: #a78bfa; }
.hc-callout-record .hc-callout-label { color: #a78bfa; }
.hc-callout-warning     { border-left-color: var(--red); background: rgba(239, 68, 68, 0.07); }
.hc-callout-warning .hc-callout-label { color: var(--red); }

/* Prev / next */
.hc-pager {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--hc-rule);
}

.hc-pager-btn {
  background: var(--surface);
  border: 1px solid var(--hc-rule);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  max-width: 300px;
  min-height: 44px;
  padding: 10px 14px;
  text-align: left;
  touch-action: manipulation;
  transition: border-color 0.12s;
}

.hc-pager-btn:hover { border-color: var(--accent); }
.hc-pager-btn.is-next { text-align: right; }
.hc-pager-cap { color: var(--muted); display: block; font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; }
.hc-pager-name { color: var(--text); display: block; font-size: 13.5px; font-weight: 600; margin-top: 2px; }

/* On this page */
.hc-rail {
  position: sticky;
  top: 118px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.hc-rail-title {
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.hc-rail a {
  border-left: 2px solid var(--hc-rule);
  color: var(--hc-prose-dim);
  display: block;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 5px 0 5px 11px;
  text-decoration: none;
}

.hc-rail a:hover { border-left-color: var(--accent); color: var(--text); }

/* ── The procedure package (paper) ───────────────────────────────────────── */

.hcp-bar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--hc-rule, #2a3048);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
}

.hcp-bar-note { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 200px; }

.hcp {
  background: #fff;
  color: #14181f;
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.62;
  margin: 0 auto;
  max-width: 8.5in;
  padding: 0.7in 0.75in;
}

.hcp p { margin: 0 0 12px; }
.hcp strong { font-weight: 700; }
.hcp a { color: #14181f; }

/* Cover */
.hcp-cover { text-align: left; padding-bottom: 24px; }

/* The binder cover is a print artifact — the sheet for the front sleeve. It is
   not part of reading the procedure, so it is kept out of the on-screen view
   and appears only on paper. Same for the spine labels, which are opt-in. */
.hcp-binder { display: none; }
/* Logo is 291x75 as uploaded; height-constrained so any replacement of a
   different aspect ratio still sits sensibly on the cover. */
.hcp-cover-logo {
  display: block;
  height: auto;
  max-height: 64px;
  max-width: 320px;
  margin-bottom: 4px;
  object-fit: contain;
}

.hcp-cover-co {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.hcp-cover-rule { border: none; border-top: 3px solid #14181f; margin: 10px 0 34px; }
.hcp-cover-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 54px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  margin: 0;
}
.hcp-cover-sub {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.5px;
  margin: 6px 0 40px;
}

.hcp-meta { border-collapse: collapse; font-size: 13px; width: 100%; }
.hcp-meta th {
  border: 1px solid #b9bfcb;
  font-weight: 700;
  padding: 7px 10px;
  text-align: left;
  white-space: nowrap;
  width: 1%;
  background: #f1f3f7;
}
.hcp-meta td { border: 1px solid #b9bfcb; padding: 7px 10px; }

.hcp-sign { margin-top: 40px; }
.hcp-sign-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 14px; }
.hcp-sign-cell { border-top: 1px solid #14181f; padding-top: 6px; }
.hcp-sign-line { height: 46px; }
.hcp-sign-cap { font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: #4a5262; }

/* ── Spine labels ──────────────────────────────────────────────────────── */

.hcp-spine-note {
  align-items: center;
  background: #fdf7e8;
  border: 1px solid #e0cfa0;
  border-radius: 6px;
  color: #4a5262;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 12px;
  justify-content: space-between;
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 10px 14px;
}

.hcp-spine-note > div:first-child { flex: 1; min-width: 240px; }
.hcp-spine-actions { display: flex; gap: 8px; flex: none; }

.hcp-spine-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.hcp-spine-item { margin: 0; }

/* Real inches, so what comes out of the printer fits the binder. */
/* Clipped as a hard guard: overflowing content once bled across the cover page
   and wrecked the whole preview. The type is measured and scaled to fit before
   paint, so nothing should reach this — it is here so a mis-fit spoils one
   label rather than the document. */
.hcp-spine {
  border: 1px dashed #8a93a3;
  box-sizing: border-box;
  height: 10in;
  overflow: hidden;
}

.hcp-spine.w1  { width: 1in; }
.hcp-spine.w15 { width: 1.5in; }
.hcp-spine.w2  { width: 2in; }
.hcp-spine.w3  { width: 3in; }

/*
 * Everything runs ALONG the spine.
 *
 * writing-mode: vertical-rl turns the inline axis vertical, so a flex row lays
 * items out top to bottom — down the length of the label. That leaves the
 * binder width to constrain only the type height, which is why a 1in label can
 * still carry the full title, subtitle and document number.
 *
 * Laying out in the real box rather than rotating with a transform means the
 * strip is genuinely the width it claims and prints at true size.
 */
.hcp-spine-inner {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 0.14in;
  height: 100%;
  justify-content: center;
  padding: 0.12in 0;
  white-space: nowrap;
  writing-mode: vertical-rl;
}

.hcp-spine-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}

.hcp-spine-sub {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
}

.hcp-spine-meta {
  color: #35404f;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.05em;
  line-height: 1;
}

.hcp-spine-dot { color: #8a93a3; line-height: 1; }

/*
 * One base size per binder width, all scaled together by --fit, which the
 * component sets after measuring the rendered length. Scaling everything by a
 * single factor keeps the proportions identical at every width, so a 1in label
 * reads the same as a 3in one, only smaller.
 */
.hcp-spine { --fit: 1; --base: 22px; }
.hcp-spine.w1  { --base: 22px; }
.hcp-spine.w15 { --base: 32px; }
.hcp-spine.w2  { --base: 42px; }
.hcp-spine.w3  { --base: 60px; }

.hcp-spine-title { font-size: calc(var(--base) * var(--fit)); }
.hcp-spine-sub   { font-size: calc(var(--base) * 0.46 * var(--fit)); }
.hcp-spine-meta  { font-size: calc(var(--base) * 0.36 * var(--fit)); }
.hcp-spine-dot   { font-size: calc(var(--base) * 0.42 * var(--fit)); }

/*
 * The logo is turned to match the reading direction, so it sits upright when
 * the binder is on a shelf.
 *
 * A CSS transform does not change an element's layout box: a 291x75 logo laid
 * out 0.6in tall still reserves 2.4in of width, which on a 1in spine pushed the
 * text off the label entirely. The slot reserves the ROTATED footprint —
 * narrow across the spine, long along it — and the image is painted rotated
 * inside it, centred on the same point.
 */
.hcp-spine-logo-slot {
  align-items: center;
  display: flex;
  flex: none;
  justify-content: center;
  overflow: hidden;
  writing-mode: horizontal-tb;
}

.hcp-spine-logo {
  flex: none;
  max-width: none;
  object-fit: contain;
  transform: rotate(90deg);
}

/* Slot: width = across the spine, height = along it. The logo is 3.88:1, so the
   slot is that much longer than it is wide once the image is turned. */
.hcp-spine { --logo-w: 0.40in; }
.hcp-spine.w1  { --logo-w: 0.40in; }
.hcp-spine.w15 { --logo-w: 0.60in; }
.hcp-spine.w2  { --logo-w: 0.80in; }
.hcp-spine.w3  { --logo-w: 1.15in; }

.hcp-spine-logo-slot {
  width: calc(var(--logo-w) * var(--fit));
  height: calc(var(--logo-w) * 3.88 * var(--fit));
}

.hcp-spine-logo { height: calc(var(--logo-w) * var(--fit)); }

.hcp-spine-cap {
  color: #4a5262;
  font-size: 10px;
  letter-spacing: 0.06em;
  margin-top: 6px;
  text-align: center;
  text-transform: uppercase;
}

.hcp-h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.4px;
  border-bottom: 2px solid #14181f;
  margin: 0 0 16px;
  padding-bottom: 6px;
}

/* Contents */
.hcp-toc-sec {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.4px;
  margin: 18px 0 6px;
}
.hcp-toc-row { display: flex; font-size: 13.5px; gap: 8px; padding: 3px 0 3px 26px; }
.hcp-toc-num { flex: 0 0 42px; color: #4a5262; }

/* Sections and articles */
.hcp-section { break-before: page; page-break-before: always; }
.hcp-section-head { border-bottom: 3px solid #14181f; margin-bottom: 8px; padding-bottom: 8px; }
.hcp-section-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5262;
}
.hcp-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.05;
  margin: 2px 0 0;
}
.hcp-section-blurb { color: #4a5262; font-size: 14px; margin: 8px 0 0; }

.hcp-article { break-before: page; page-break-before: always; }
.hcp-article-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #4a5262;
}
.hcp-article-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border-bottom: 1px solid #14181f;
  margin: 2px 0 16px;
  padding-bottom: 7px;
}

/* Article body on paper — same markup as .hc-body, paper colours */
.hcp .hc-body { color: #14181f; font-size: 13.5px; line-height: 1.6; }
.hcp .hc-body h2 {
  border-bottom: 1px solid #b9bfcb;
  color: #14181f;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 19px;
  margin: 22px 0 9px;
  padding-bottom: 4px;
}
.hcp .hc-body h3 { color: #14181f; font-size: 15.5px; margin: 16px 0 6px; }
.hcp .hc-body h4 { color: #14181f; }
.hcp .hc-body strong { color: #14181f; }
.hcp .hc-body code {
  background: #f1f3f7;
  border: 1px solid #d6dae2;
  color: #14181f;
}
.hcp .hc-pre {
  background: #f7f8fa;
  border: 1px solid #d6dae2;
  border-left: 3px solid #14181f;
  color: #14181f;
  font-size: 11.5px;
}
.hcp .hc-sublist li { color: #35404f; }
.hcp .hc-hr { border-top: 1px solid #d6dae2; }

.hcp .hc-table { font-size: 12px; }
.hcp .hc-table th {
  background: #f1f3f7;
  border: 1px solid #b9bfcb;
  color: #14181f;
  font-size: 10.5px;
}
.hcp .hc-table td { border: 1px solid #d6dae2; }

.hcp .hc-stamp-sheet {
  border: 1px solid #b9bfcb;
  padding: 12px 14px 10px;
}
.hcp .hc-stamp { break-inside: avoid; page-break-inside: avoid; }

.hcp .hc-callout {
  background: #f7f8fa;
  border: 1px solid #d6dae2;
  border-left: 3px solid #14181f;
}
.hcp .hc-callout-label { color: #14181f; }
.hcp .hc-callout-warning { background: #fdf1f1; border-left-color: #b02020; }
.hcp .hc-callout-warning .hc-callout-label { color: #b02020; }
.hcp .hc-callout-rule { background: #fdf7e8; border-left-color: #9a6b06; }
.hcp .hc-callout-rule .hc-callout-label { color: #9a6b06; }

.hcp-end { border-top: 2px solid #14181f; margin-top: 34px; padding-top: 10px; text-align: center; font-size: 12px; color: #4a5262; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .hc-main { grid-template-columns: minmax(0, 1fr); }
  .hc-rail { display: none; }
}

@media (max-width: 900px) {
  .hc-app { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hc-side {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--hc-rule);
    padding-bottom: 12px;
  }
  .hc-side.is-collapsed .hc-nav-list { display: none; }
  .hc-side-toggle {
    display: block;
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--hc-rule);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
    padding: 10px 14px;
    text-align: left;
    touch-action: manipulation;
    margin-bottom: 12px;
  }
  .hc-title { font-size: 27px; }
  .hcp { padding: 24px 18px; }
  .hcp-cover-title { font-size: 40px; }
  .hcp-sign-grid { grid-template-columns: 1fr; }
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
  @page { size: letter portrait; margin: 18mm 16mm 20mm; }

  /* Nothing but the procedure package goes to paper.
     Every hiding rule is scoped under .hc-print-package, a class HelpView puts
     on <html> only while the package is open. The QC weld counter also prints
     from this document, and it must keep printing exactly as it did. */
  .hc-print-package,
  .hc-print-package body { background: #fff !important; }

  .hc-print-package #app > header,
  .hc-print-package #app > nav,
  .hc-print-package .hc-app,
  .hc-print-package .hcp-bar,
  .hc-print-package [data-hc-noprint] { display: none !important; }

  /* Anything mounted alongside the app shell — toast container and the like */
  .hc-print-package #root > *:not(#app) { display: none !important; }

  .hc-print-package #app main { padding: 0 !important; }

  .hcp {
    background: #fff;
    color: #000;
    font-size: 10.5pt;
    line-height: 1.45;
    margin: 0;
    max-width: none;
    padding: 0;
  }

  .hcp p { margin: 0 0 7pt; orphans: 3; widows: 3; }

  .hcp-cover { break-after: page; page-break-after: always; }
  .hcp-binder { display: block; }

  /* Binder sheet on its own: everything else in the package is dropped, and the
     sheet itself must not force a trailing blank page. */
  .hc-print-cover-only .hcp > *:not(.hcp-binder) { display: none !important; }
  .hc-print-cover-only .hcp-binder { break-after: auto; page-break-after: auto; }

  /* Spine labels are binder furniture — never part of the procedure itself, so
     the ordinary print leaves the sheet out entirely. */
  .hcp-spine-sheet { display: none !important; }
  .hc-print-spine-only .hcp > *:not(.hcp-spine-sheet) { display: none !important; }
  .hc-print-spine-only .hcp-spine-sheet { display: block !important; }

  /* A 10in strip needs almost the whole sheet, so this page takes a narrow
     margin of its own. */
  @page spine { size: letter portrait; margin: 6mm; }
  .hc-print-spine-only .hcp-spine-sheet { page: spine; }
  .hc-print-spine-only .hcp-spine { border-style: dashed; border-color: #999; }
  .hcp-toc   { break-after: page; page-break-after: always; }
  .hcp-revs  { break-after: page; page-break-after: always; }

  .hcp-cover-logo { max-height: 20mm; max-width: 90mm; }
  .hcp-cover-title { font-size: 40pt; }
  .hcp-cover-sub { font-size: 19pt; }
  .hcp-section-title { font-size: 28pt; }
  .hcp-article-title { font-size: 19pt; }

  .hcp .hc-body { font-size: 10pt; line-height: 1.45; }
  .hcp .hc-body h2 { font-size: 14pt; margin: 14pt 0 6pt; break-after: avoid; page-break-after: avoid; }
  .hcp .hc-body h3 { font-size: 11.5pt; margin: 10pt 0 4pt; break-after: avoid; page-break-after: avoid; }
  .hcp .hc-table { font-size: 8.5pt; }
  .hcp .hc-table th { font-size: 8pt; padding: 4pt 6pt; }
  .hcp .hc-table td { padding: 4pt 6pt; }
  .hcp .hc-pre { font-size: 8.5pt; padding: 6pt 8pt; }

  /* Keep units together */
  .hcp .hc-table-scroll,
  .hcp .hc-stamp,
  .hcp .hc-callout,
  .hcp .hc-pre,
  .hcp-sign,
  .hcp li { break-inside: avoid; page-break-inside: avoid; }

  .hcp .hc-table-scroll { overflow: visible; }

  /* Links print as text, not as blue underlines */
  .hcp a { color: #000; text-decoration: none; }

  .hcp-end { break-inside: avoid; }
}
/* App-level styles — minimal, all main styles in index.css */
