:root {
  color-scheme: light;
  --zinc: #e4e8ea;      /* galvanized steel background */
  --panel: #ffffff;
  --steel: #15232e;     /* ink, OX navy-steel */
  --steel-2: #4b5b67;   /* quiet text */
  --line: #c6cfd5;
  --ready: #1d7a43;
  --attn: #c98e00;      /* safety amber */
  --stop: #b8132a;
  --gold: #a87d27;      /* OX gold, brand only */
  --radius: 10px;
  --tap: 56px;          /* gloved-finger target */
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--steel);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--zinc); }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3, .cond { font-family: 'Barlow Condensed', 'Barlow', sans-serif; letter-spacing: 0.01em; }
h1 { font-size: 2.6rem; line-height: 1.05; margin: 0; font-weight: 800; }
h2 { font-size: 1.6rem; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 1.25rem; margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--steel); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--steel); color: #fff;
}
.bar { flex-wrap: wrap; row-gap: 4px; }
.bar .mark { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.3rem; white-space: nowrap; }
.bar .btn { white-space: nowrap; font-size: 0.85rem; }
@media (max-width: 560px) { .bar .company { order: 9; flex-basis: 100%; } }
.bar .mark span { color: #d9b56a; }
.bar .company { color: #b9c6cf; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.lang { display: flex; gap: 2px; background: #22323e; border-radius: 8px; padding: 2px; }
.lang button { background: none; border: 0; color: #b9c6cf; font: inherit; font-size: 0.85rem; padding: 6px 9px; border-radius: 6px; cursor: pointer; min-height: 36px; }
.lang button[aria-pressed='true'] { background: #fff; color: var(--steel); font-weight: 600; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 96px; }

/* ---------- Buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--radius);
  border: 2px solid var(--steel); background: var(--steel); color: #fff;
  font: 600 1rem 'Barlow', sans-serif; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--steel); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 20px 0; }
label.field { display: block; margin-bottom: 14px; font-weight: 600; }
label.field span { display: block; margin-bottom: 6px; font-size: 0.95rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; font: inherit;
  border: 2px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--steel);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--steel); outline: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notice { padding: 12px 14px; border-radius: var(--radius); background: #fff; border-left: 6px solid var(--attn); margin: 12px 0; }
.notice.bad { border-left-color: var(--stop); }
.muted { color: var(--steel-2); }
.panel { background: var(--panel); border-radius: var(--radius); padding: 18px; margin: 16px 0; }

/* ---------- Sign in ---------- */
.gate { max-width: 420px; margin: 8vh auto 0; }
.gate .wordmark { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.gate .wordmark span { color: var(--gold); }
.gate .tag { font-size: 1.15rem; color: var(--steel-2); margin-bottom: 28px; }

/* ---------- Readiness hero ---------- */
.hero { margin: 8px 0 4px; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); }
.hero .sub { font-size: 1.1rem; color: var(--steel-2); margin-top: 6px; }
.strip { display: flex; gap: 4px; margin: 18px 0 6px; height: 22px; }
.strip i { flex: 1; border-radius: 3px; }
.s-ready { background: var(--ready); }
.s-attention { background: var(--attn); }
.s-out_of_service { background: var(--stop); }
.s-retired { background: var(--line); }
.cost { font-weight: 600; color: var(--stop); margin-top: 6px; }

/* ---------- Equipment plates (the signature element) ---------- */
.plates { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.plate {
  position: relative; display: block; text-decoration: none; color: var(--steel);
  background: linear-gradient(180deg, #fbfcfc, #eef1f3);
  border: 2px solid #9fadb6; border-radius: 8px; padding: 14px 16px 14px 26px;
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 #d5dce0;
}
.plate::before { /* status edge */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; border-radius: 6px 0 0 6px;
  background: var(--edge, var(--line));
}
.plate::after { /* rivets */
  content: ''; position: absolute; right: 9px; top: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #8d9aa3); box-shadow: 0 calc(100% + 0px) 0 0 transparent;
}
.plate .unit { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.9rem; line-height: 1; }
.plate .meta { font-size: 0.92rem; color: var(--steel-2); margin-top: 4px; }
.plate .state { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 0.95rem; }
.plate.ready { --edge: var(--ready); }
.plate.attention { --edge: var(--attn); }
.plate.out_of_service { --edge: var(--stop); }
.plate.out_of_service .state { color: var(--stop); }
.plate:active { transform: translateY(1px); }

/* ---------- Asset detail ---------- */
.big-plate { font-size: 1.15em; padding: 20px 20px 20px 34px; }
.big-plate .unit { font-size: 3rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--steel-2); }
.kv dd { margin: 0; font-weight: 600; }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr canvas, .qr img { background: #fff; padding: 8px; border-radius: 8px; border: 2px solid var(--line); }

/* ---------- Inspection ---------- */
.progress { position: sticky; top: var(--barH, 56px); z-index: 5; background: var(--zinc); padding: 10px 0; }
.progress .track { height: 10px; background: #fff; border-radius: 5px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--steel); transition: width .25s; }
.section { background: var(--panel); border-radius: var(--radius); margin: 16px 0; padding: 4px 0 8px; }
.section header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.item { padding: 12px 16px; border-top: 1px solid #e3e8eb; }
.item .label { font-weight: 600; margin-bottom: 10px; }
.item .label small { display: inline-block; margin-left: 6px; font-weight: 600; color: var(--stop); font-size: 0.8rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr 0.6fr; gap: 6px; }
.seg button {
  min-height: var(--tap); border-radius: 8px; border: 2px solid var(--line); background: #fff;
  font: 600 1rem 'Barlow', sans-serif; color: var(--steel); cursor: pointer;
}
.seg button.ok[aria-pressed='true'] { background: var(--ready); border-color: var(--ready); color: #fff; }
.seg button.bad[aria-pressed='true'] { background: var(--stop); border-color: var(--stop); color: #fff; }
.seg button.na[aria-pressed='true'] { background: var(--steel-2); border-color: var(--steel-2); color: #fff; }
.detail { margin-top: 10px; display: grid; gap: 8px; }
.photo-btn { display: flex; align-items: center; gap: 10px; }
.photo-btn img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 2px solid var(--line); }
.need { color: var(--stop); font-weight: 600; font-size: 0.9rem; }
.reg { font-size: 0.95rem; color: var(--steel-2); border-left: 4px solid var(--gold); padding-left: 12px; }

/* ---------- Result ---------- */
.result { text-align: left; padding: 28px 22px; border-radius: var(--radius); color: #fff; margin: 12px 0 20px; }
.result.pass { background: var(--ready); }
.result.pass_with_defects { background: var(--attn); color: var(--steel); }
.result.out_of_service { background: var(--stop); }
.result h1 { font-size: 2.6rem; }

/* ---------- Problems ---------- */
.defect { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; border-left: 8px solid var(--line); }
.defect.critical { border-left-color: var(--stop); }
.defect.major { border-left-color: var(--attn); }
.defect .top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.defect .sev { font-weight: 600; font-size: 0.9rem; }
.thumbs { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; }

/* ---------- Scanner ---------- */
.scanner video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 3 / 4; object-fit: cover; }

/* ---------- Print QR sheet ---------- */
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sticker { background: #fff; border: 2px dashed #9fadb6; border-radius: 8px; padding: 12px; text-align: center; break-inside: avoid; }
.sticker .unit { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.6rem; }
.sticker small { display: block; color: var(--steel-2); }
@media print {
  .bar, .no-print { display: none !important; }
  body, html { background: #fff; }
  main { padding: 0; max-width: none; }
}
@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .sheet { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--steel); color: #fff; padding: 12px 18px; border-radius: var(--radius); z-index: 50;
  max-width: calc(100% - 32px);
}
