:root {
  --bg: #f0f1ed;
  --card: #ffffff;
  --text: #16201e;
  --muted: #59655f;
  --line: #d3d8d1;
  --line-strong: #b5bdb4;
  --panel: #e8ebe5;
  --accent: #17615b;
  --accent-soft: #e2eeec;
  --accent-mid: #8fbcb6;
  --water: #b6d5d1;
  --error: #dc2626;
  --caution: #fff0d0;
  --caution-text: #6d4200;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 Inter, system-ui, sans-serif;
}

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

button, input { font: inherit; color: inherit; }

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.head { padding: 4px 0; }
.eyebrow { color: var(--muted); font-size: 14px; }
h1 { font-size: 24px; font-weight: 500; line-height: 1.25; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.label { font-size: 14px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.link {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 8px 0;
  min-height: 44px;
  color: var(--muted);
  text-decoration: underline;
  font-size: 14px;
}

.error-line { color: var(--error); font-size: 14px; }

/* Top bar: motor type */
.topbar {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 44px;
  padding: 2px 12px;
  border: 0;
  background: none;
  line-height: 1.2;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn b { font-weight: 500; font-size: 15px; }
.seg-btn span { font-size: 12px; color: var(--muted); }
.seg-btn[aria-pressed="true"] { background: var(--accent-soft); outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.seg-btn[aria-pressed="true"] b, .seg-btn[aria-pressed="true"] span { color: var(--accent); }

/* Saved motor nameplate */
.topbar { flex-wrap: wrap; row-gap: 4px; }
.np-chip {
  flex-basis: 100%;
  text-align: right;
  min-height: 32px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
}
.np-chip { display: flex; justify-content: flex-end; align-items: center; text-decoration: none; }

/* Motor data form */
.md-list { display: flex; flex-direction: column; }
.md-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; min-height: 56px; padding: 6px 0; }
.md-row + .md-row { border-top: 1px solid var(--line); }
.md-cpm { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); }
.md-name { font-size: 15px; font-weight: 500; display: flex; flex-direction: column; }
.md-req { color: var(--error); font-weight: 500; }
.md-note { font-size: 12px; font-weight: 400; color: var(--muted); }
.md-in { display: flex; align-items: center; gap: 6px; }
.md-in .small { min-width: 26px; }
.md-select { min-height: 40px; width: 172px; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font: inherit; font-size: 14px; color: var(--text); }
.md-seg .seg-btn { min-width: 0; padding: 2px 10px; }
.md-seg .seg-btn b { font-size: 14px; }
.md-show { display: flex; flex-direction: column; gap: 2px; }
.md-show p { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: baseline; font-size: 15px; }
.md-show p > span:first-child { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); }
.md-show b { font-family: ui-monospace, Consolas, monospace; font-weight: 500; }
.md-show .gap { display: block; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.md-show .np-inline { align-self: flex-end; margin-top: 8px; }
.btn-a { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* Bottom tab bar, fixed on every screen */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tb {
  flex: 1; max-width: 96px; min-height: 56px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none;
  border-top: 2px solid transparent; margin-top: -1px;
}
.tb[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }
.page { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

/* 2-column cards: home choices, symptoms, boards, recent */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
  min-height: 76px; padding: 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: var(--text); font: inherit; font-size: 16px; font-weight: 500; text-decoration: none;
}
.tile:active { background: var(--bg); }
.tile-big { min-height: 96px; font-size: 17px; justify-content: flex-end; overflow-wrap: anywhere; }
.tile .more { align-self: flex-end; color: var(--muted); margin-left: 0; transition: transform 0.15s; }
.tile[aria-expanded="true"] { border-color: var(--accent); }
.tile[aria-expanded="true"] .more { transform: rotate(90deg); }
.tile-sub { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-left: 12px; border-left: 2px solid var(--accent); }
.tile-sub[hidden] { display: none; }
.tile-code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); font-weight: 400; }
.tile-sub-text { font-size: 13px; color: var(--muted); font-weight: 400; }

/* Home: saved motor */
.mycard { display: flex; flex-direction: column; gap: 8px; }
.mycard-head { display: flex; justify-content: space-between; align-items: center; }
.mycard-head .link-sm { text-decoration: none; font-size: 16px; }
.mycard-val { font-size: 15px; color: var(--muted); }
.mycard-maker { font-size: 13px; color: var(--muted); min-height: 18px; }
.mycard-model {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0;
  border: 0; background: none; text-align: left; font: inherit; color: var(--text);
}
.mycard-name { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.mycard-model .site-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mycard-model .more { margin-left: auto; color: var(--muted); transition: transform 0.15s; }
.mycard-model[aria-expanded="true"] .more { transform: rotate(180deg); }

/* Sites the motor is used at: the technician's own notes */
.sites { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sites[hidden] { display: none; }
.site-row { display: grid; grid-template-columns: auto 1fr 44px; gap: 8px; align-items: center; }
.site-no { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 44px; }
.site-x { min-height: 44px; border: 0; background: none; color: var(--muted); font-size: 20px; }
.site-add { align-self: flex-start; min-height: 44px; }
.sites-undo { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.sites-undo:empty { display: none; }
.md-text {
  width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font: inherit; font-size: 15px; color: var(--text);
}
.md-row-text { grid-template-columns: 72px 1fr; }
.md-del { display: flex; gap: 16px; align-items: center; justify-content: center; min-height: 52px; margin-top: 8px; font-size: 14px; }
.md-del .bad { color: var(--error); }

/* Other saved motors */
.tile-motor .tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-motor { min-width: 0; }
.tile-add { justify-content: center; align-items: center; color: var(--accent); border-style: dashed; }
.group > .tiles { margin-top: 10px; }
button.row { width: 100%; border: 0; background: none; text-align: left; font: inherit; }
button.row .row-desc { padding-left: 0; }

/* Main action of a screen (one per screen) */
.btn-primary {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

/* Symptom groups */
.sub summary { list-style: none; cursor: pointer; }
.sub summary::-webkit-details-marker { display: none; }
.more { margin-left: auto; color: var(--muted); transition: transform 0.15s; }
.sub[open] .more { transform: rotate(90deg); }
.sub-list { border-top: 1px solid var(--line); }
.sub-list .row { padding-left: 32px; }
.row-title .seen-tag { margin-left: auto; }

/* Home */
.search {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.list-wrap { display: flex; flex-direction: column; gap: 16px; }
.group { display: flex; flex-direction: column; gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
}
.row:active { background: var(--bg); }
.row-title { font-weight: 500; display: flex; align-items: baseline; gap: 10px; }
.row-code { font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: var(--muted); min-width: 28px; white-space: nowrap; }
/* Several codes on one guide: numbers on their own line above the title */
.row-codes { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); white-space: nowrap; }
.row-desc {
  font-size: 13px;
  color: var(--muted);
  padding-left: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag {
  margin-left: auto;
  padding: 0 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  line-height: 20px;
}

/* Control panel LCD */
.lcd-card { display: flex; flex-direction: column; gap: 12px; }
.lcd {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.lcd .k { color: var(--muted); }
.lcd-split { display: flex; justify-content: space-between; padding-right: 24px; }
.lcd-hl {
  background: var(--text);
  color: #fff;
  margin: 2px -4px;
  padding: 0 4px;
  border-radius: 4px;
}
.lcd-hl .k { color: var(--line-strong); }
.lcd-hl b { font-weight: 500; }
/* Panel menu name as a key: [VIEW] */
.key {
  display: inline-block; padding: 0 5px; border: 1px solid var(--text); border-radius: 4px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; font-weight: 500;
  line-height: 1.35; color: var(--text); background: var(--card); white-space: nowrap;
}
/* VIEW screen: SPM0–SPM7, five rows */
.spmv { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.spmv-key { font-size: 14px; }
.spmv-lcd { padding: 6px 10px; line-height: 1.7; }
.spmv-row { display: grid; grid-template-columns: 44px 48px 1fr; gap: 6px; align-items: baseline; }
.spmv-row b { font-weight: 500; text-align: right; }
.spmv-l { color: var(--muted); font-size: 12px; }
.spmv-row.lcd-hl .spmv-l { color: var(--line-strong); }
.spmv-more { text-align: center; font-size: 10px; line-height: 1; color: var(--muted); }
.spmv-row.spmv-warn { background: var(--caution); color: var(--caution-text); margin: 0 -4px; padding: 0 4px; border-radius: 4px; }
.spmv-row.spmv-warn .k, .spmv-row.spmv-warn .spmv-l { color: var(--caution-text); }
/* Balance run: empty car top ↔ bottom with live SPM3–5 */
.brun { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.brun { position: relative; }
.cpm-row.br-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.br-btns .btn-ghost { min-width: 0; padding: 4px; font-size: 13px; line-height: 1.2; }
.br-btns .btn-ghost:first-child { font-size: 16px; font-weight: 500; }
.br-tbl.br-ok b { color: var(--accent); }
.br-tbl.br-ng b { color: var(--error); }
.br-tbl b { transition: color 0.3s; }
.br-verdict { min-height: 1.5em; }
.br-fly {
  position: absolute; z-index: 2; pointer-events: none;
  font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 0 4px;
  transition: transform 0.6s ease-in-out;
}
.br-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.br-pause { align-self: flex-end; min-height: 32px; }
.br { display: block; width: 100%; height: auto; }
.br-rope { stroke: var(--muted); stroke-width: 1.2; fill: none; }
.br-mid { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.br-mid-t.on { fill: var(--accent); font-weight: 600; }
.br-cw { fill: var(--muted); }
.br-cw.br-cw-heavy { fill: var(--text); }
.br-cw.br-cw-light { fill: var(--line-strong); }
.br-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.br-side .spmv-lcd { padding: 6px 10px; font-size: 15px; line-height: 1.8; }
.br-side .spmv-row { grid-template-columns: auto 1fr; }
.br-side .spmv-row b { font-size: 16px; }
.br-tbl-h { font-size: 13px; color: var(--muted); margin-top: 4px; }
.br-tbl { display: grid; grid-template-columns: auto 1fr 1fr; gap: 2px 10px; font-size: 15px; }
.br-tbl .k { color: var(--muted); font-size: 13px; }
.br-tbl b { font-family: ui-monospace, Consolas, monospace; font-weight: 500; }

/* Step flow */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.node { display: flex; flex-direction: column; gap: 12px; }
.node-num { font-size: 14px; color: var(--muted); }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Location badge; turns blue when the technician has to move */
.loc {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.loc-moved { border-color: var(--accent); color: var(--accent); }
.node h3 { font-size: 18px; font-weight: 500; line-height: 1.35; }

/* Passed step: question on top, the chosen answer below (never squeezed side by side) */
.node.done {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 16px;
  cursor: pointer;
}
.node.done h3 { font-size: 16px; }
.node.done .chosen { font-size: 14px; color: var(--accent); font-weight: 500; }

.node.result { border-color: var(--text); }
.node.result.fault h3 { color: var(--error); }

.why { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 2px solid var(--line); }
.why p:last-child { font-size: 15px; color: var(--muted); }
.action { font-weight: 500; }

.options { display: flex; flex-direction: column; gap: 8px; }
.q { font-size: 14px; font-weight: 500; color: var(--muted); }

.btn-option {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  padding: 0 16px;
}
.btn-option:active { background: var(--bg); }
.btn-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-option.seen { color: var(--muted); }
.seen-tag { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }

.btn-ghost {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
}

/* Data tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { font-weight: 500; white-space: nowrap; }

/* Figures */
.fig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.fig-media {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  background: #fff;
  cursor: zoom-in;
  text-align: left;
}
.fig-media svg { display: block; width: 100%; height: auto; }
.fig-media img { display: block; width: 100%; height: 180px; object-fit: contain; }
.fig-media > div { pointer-events: none; }
div.fig-media { cursor: auto; }
div.fig-media > div { pointer-events: auto; }
.fig figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.link-sm {
  border: 0;
  background: none;
  padding: 8px 0 8px 8px;
  min-height: 36px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* SVG figure parts */
.fg-board { fill: #fff; stroke: var(--muted); stroke-width: 1.5; }
.fg-part { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; }
.fg-conn { fill: #fff; stroke: var(--line-strong); stroke-width: 1; }
.fg-pin { fill: #fff; stroke: var(--muted); stroke-width: 1; }
.fg-wire { stroke: var(--muted); stroke-width: 1.5; }
.fg-dot { fill: var(--muted); }
.fg-label { font: 500 10px Inter, system-ui, sans-serif; fill: var(--muted); }
.fg-title { font: 500 13px Inter, system-ui, sans-serif; fill: var(--text); }
.fg-sig { font: 500 12px Inter, system-ui, sans-serif; fill: var(--text); }
.fg-hit { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.fg-hit-label { font: 500 11px Inter, system-ui, sans-serif; fill: var(--accent); }
.fg-brace { fill: none; stroke-width: 2; }
.fg-accent { stroke: var(--accent); }
.fg-strong { stroke: var(--text); }
.fg-muted { stroke: var(--line-strong); }
.fg-group { font: 500 12px Inter, system-ui, sans-serif; }
.fg-accent-text { fill: var(--accent); }
.fg-strong-text { fill: var(--text); }
.fg-muted-text { fill: var(--muted); }

/* Unplug animation: each connector turns red and slides out in turn, then returns. */
.fg-unplug {
  transform-box: fill-box;
  animation: unplug var(--T) infinite;
  animation-delay: var(--d);
}
@keyframes unplug {
  0%, 4% { stroke: var(--line-strong); opacity: 1; transform: none; }
  8% { stroke: var(--error); stroke-width: 2; opacity: 1; transform: none; }
  14%, 86% { stroke: var(--error); stroke-width: 2; opacity: 0.35; transform: translate(var(--dx), var(--dy)); }
  92%, 100% { stroke: var(--line-strong); opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fg-unplug { animation: none; stroke: var(--error); stroke-width: 2; stroke-dasharray: 3 2; }
}

/* Balance: empty car down, then up. Weight moves the other way. */
.bal-run .bal-car { animation: bal-car 7s ease-in-out infinite; }
.bal-run .bal-cw { animation: bal-cw 7s ease-in-out infinite; }
.bal-run .bal-down { animation: bal-down 7s infinite; }
.bal-run .bal-up { animation: bal-up 7s infinite; }
@keyframes bal-car { 0%, 6% { transform: none; } 40%, 56% { transform: translateY(120px); } 90%, 100% { transform: none; } }
@keyframes bal-cw { 0%, 6% { transform: none; } 40%, 56% { transform: translateY(-126px); } 90%, 100% { transform: none; } }
@keyframes bal-down { 0%, 48% { opacity: 1; } 50%, 98% { opacity: 0.3; } 100% { opacity: 1; } }
@keyframes bal-up { 0%, 48% { opacity: 0.3; } 50%, 98% { opacity: 1; } 100% { opacity: 0.3; } }

/* Photo figure, with numbered marks drawn over it */
.fig-photo .fig-media img { height: auto; max-height: 420px; }
.mk-wrap { position: relative; display: block; width: fit-content; max-width: 100%; margin: 0 auto; }
.mk-wrap img { max-width: 100%; }
.mk { position: absolute; inset: 0; width: 100%; height: 100%; }
.mk rect { fill: none; stroke: var(--accent); }
.mk circle { fill: var(--accent); }
.mk text { fill: #fff; font-family: Inter, system-ui, sans-serif; font-weight: 500; text-anchor: middle; dominant-baseline: central; }
.mk-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 500; }
.mk-legend b {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-right: 8px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500;
}

/* Pin grid (connector as seen on the board) */
.fg-cell-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.fg-cell-strong { fill: var(--line); stroke: var(--text); stroke-width: 1.5; }
.fg-cell-muted { fill: #fff; stroke: var(--line-strong); stroke-width: 1; }

/* CPM value blocks: 1st / 2nd / 3rd side by side */
.cpmb { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; font-size: 14px; }
.cpmb-common { font-weight: 500; }
.cpmb-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cpmb-col { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.cpmb-col p { display: flex; justify-content: space-between; gap: 4px; }
.cpmb-col .cpmb-head { font-family: Inter, system-ui, sans-serif; font-weight: 500; color: var(--accent); margin-bottom: 2px; }
.cpmb-col .gap { color: var(--muted); }
.cpmb-notes { color: var(--muted); }

/* CPM screen: live lift */
.ls-rope { stroke: var(--muted); stroke-width: 1.5; }
.ls-motor-box { fill: #fff; stroke: var(--muted); stroke-width: 1.5; transition: fill 0.2s, stroke 0.2s; }
.ls-car-box { fill: #fff; stroke: var(--text); stroke-width: 1.5; }
.ls-cup { fill: #fff; stroke: var(--muted); stroke-width: 1.2; }
.ls-water { fill: var(--water); }
.ls-drops { fill: var(--accent-mid); opacity: 0; }
.ls-spill .ls-drops { opacity: 1; }
.ls-heat, .ls-sound { fill: none; stroke-width: 2; stroke-linecap: round; opacity: 0; }
.ls-heat { stroke: var(--error); }
.ls-sound { stroke: var(--text); }
.ls-hot .ls-heat, .ls-loud .ls-sound { opacity: 1; }
.ls-hot .ls-motor-box { fill: #fef2f2; stroke: var(--error); stroke-width: 2.5; }
.ls-limit { stroke: var(--error); stroke-width: 1.2; stroke-dasharray: 3 3; }

/* Lift on the left, lamps + SPM3 + current values on the right */
.ls-wrap { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; }
.ls-wrap svg { display: block; width: 100%; height: auto; }
.ls-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ls-lamps { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.ls-lamps li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--line-strong); vertical-align: -1px; }
.ls-lamps li.on { color: var(--accent); font-weight: 500; }
.ls-lamps li.on::before { background: var(--accent); border-color: var(--accent); }
.ls-spm { display: grid; grid-template-columns: auto 1fr 40px; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.ls-spm b { font-weight: 500; color: var(--text); text-align: right; }
.ls-meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); }
.ls-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.ls-meter i.over { background: var(--error); }
.ls-meter em { position: absolute; left: 90.9%; top: -3px; bottom: -3px; border-left: 1.5px dashed var(--error); }
.ls-status { font-size: 15px; font-weight: 500; min-height: 22px; }
.ls-status.bad { color: var(--error); }

.cpm-sim { display: flex; flex-direction: column; gap: 8px; }
.cpm-sim .link { align-self: flex-end; min-height: 32px; padding: 2px 0; }
.cpm-sim .seg { align-self: stretch; }
.seg.kw .seg-btn { min-width: 0; flex: 1; padding: 2px 2px; }
.seg.kw .seg-btn b { font-size: 12px; white-space: nowrap; }
.cpm-big { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 2px 10px; align-items: baseline; }
.cpm-big .k { font-size: 12px; color: var(--muted); }
.cpm-big b { font-family: ui-monospace, Consolas, monospace; font-size: 17px; font-weight: 500; }
.cpm-big b.hit { color: var(--accent); }
.cpm-big .grp { grid-column: 1 / -1; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.cpm-in { width: 72px; min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: 16px; }
.cpm-calc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; }
.cpm-range.bad { accent-color: var(--error); }
.cpm-row .btn-ghost.bad[aria-pressed="true"] { border-color: var(--error); color: var(--error); background: #fef2f2; }
.np-inline { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-height: 40px; padding: 0 10px; font-weight: 500; color: var(--accent); text-decoration: none; }
.cpm-calc b { font-family: ui-monospace, Consolas, monospace; font-weight: 500; font-size: 18px; color: var(--accent); }
.cpm-range { width: 100%; accent-color: var(--accent); margin: 4px 0 0; min-height: 32px; }

/* Recommended start + how to adjust */
.cpm-rec { font-size: 15px; font-weight: 500; margin-top: 4px; }
.kw-mark { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 4px; font-weight: 500; white-space: nowrap; }
.cpm-gauge { position: relative; }
.cpm-finger {
  position: absolute; top: 2px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--accent-soft); opacity: 0.85; pointer-events: none;
  transition: left 0.12s linear;
}
.cpm-finger[hidden] { display: none; }
.cpm-dir { font-size: 13px; margin-top: -2px; }
.cpm-dir .on { color: var(--accent); font-weight: 500; }
.cpm-sym { width: fit-content; color: var(--caution-text); font-weight: 500; font-size: 14px; line-height: 1.3; margin-top: 6px; }
.cpm-sym:not(:empty) { background: var(--caution); border-radius: 6px; padding: 4px 8px; }
@media (prefers-reduced-motion: reduce) { .cpm-finger { transition: none; } }
.cpm-ends { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.cpm-ends span { max-width: 46%; }
.cpm-ends span:last-child { text-align: right; }
.cpm-ticks { position: relative; height: 18px; font-size: 12px; color: var(--accent); font-weight: 500; }
.cpm-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.cpm-step { font-weight: 500; }
.cpm-vals { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 2px 8px; font-size: 14px; align-items: baseline; }
.cpm-vals .k { color: var(--muted); font-size: 13px; }
.cpm-vals b { font-family: ui-monospace, Consolas, monospace; font-weight: 500; font-size: 15px; }
.cpm-vals b.hit { color: var(--accent); }
.cpm-bars { display: grid; grid-template-columns: 64px 1fr; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.cpm-bar { position: relative; height: 12px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.cpm-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); transition: width 0.3s; }
.cpm-bar.run i { background: var(--accent-mid); }
.cpm-bar em { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--text); transition: left 0.3s; }
.cpm-fold summary { cursor: pointer; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.cpm-fold[open] summary { margin-bottom: 8px; }
.cpm-fold h3 { margin-top: 16px; }
.cpm-fold h3:first-of-type { margin-top: 0; }
.cpm-fold > * + * { margin-top: 8px; }
.cpm-fold svg { display: block; width: 100%; height: auto; }
.cpm-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cpm-row .btn-ghost[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* Advanced: one motor */
.mf { display: block; width: 100%; height: auto; }
.mf-box { fill: #fff; stroke: var(--text); stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; }
.mf-fin { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.mf-heat { fill: none; stroke: var(--error); stroke-width: 2; stroke-linecap: round; opacity: 0; transition: opacity 0.3s; }
.mf-hot .mf-box { fill: #fef2f2; stroke: var(--error); stroke-width: 2.5; }
.mf-hot .mf-heat { opacity: 1; }
.mf-view { display: flex; align-items: baseline; gap: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
.mf-view span:first-child { color: var(--muted); font-size: 13px; }
.mf-view b { font-size: 20px; font-weight: 500; min-width: 56px; }
.mf-view b.bad, .mf-msg.bad { color: var(--error); }
.mf-msg { font-family: Inter, system-ui, sans-serif; font-size: 14px; font-weight: 500; }
.cpm-calc b.bad, .cpm-in.bad { color: var(--error); }
.cpm-in.bad { border-color: var(--error); }
.cpm-in { width: 96px; }
/* CPM48: title with ⓘ, ruler of 5 values, time constant curve */
.tau-h { display: flex; align-items: center; gap: 4px; }
.info-btn { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 20px; cursor: pointer; }
.info-btn[aria-expanded="true"] { color: var(--text); }
.tau-info { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.tau-info[hidden] { display: none; }
.tau-info > * + * { margin-top: 8px; }
.tau-info .cpm-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tau-info .btn-ghost { min-width: 0; padding: 4px; font-size: 13px; line-height: 1.2; }
.tau-ruler { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); }
.tau-ruler::before { content: ""; position: absolute; left: 10%; right: 10%; top: 21px; border-top: 1px solid var(--line-strong); }
.tau-tick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 64px; padding: 14px 0 6px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.tau-tick i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); background: var(--card); }
.tau-tick.mid i { border-radius: 2px; transform: rotate(45deg); }
.tau-tick span { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.tau-tick[aria-pressed="true"] { color: var(--accent); font-weight: 500; }
.tau-tick[aria-pressed="true"] i { border-color: var(--accent); background: var(--accent); }
.tau-tick:disabled { cursor: default; opacity: 0.6; }
.tau-out { font-weight: 500; color: var(--accent); }
.tau-out.muted { font-weight: 400; color: var(--muted); }
.tc-guide { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tc .tc-curve { stroke: var(--accent); }
.tc .tc-curve.gc-bad { stroke: var(--error); }
.tc-dot { fill: var(--accent); }
.tc-bad .tc-dot { fill: var(--error); }
.tc-tau { fill: var(--accent); font-weight: 500; }
.tc-bad .tc-tau { fill: var(--error); }
.cpm-tune p + p { margin-top: 4px; }
.mm-note { font-weight: 500; }
.mm-note.bad { color: var(--error); }
.mm-note.good { color: var(--accent); }
.mm-note p + p { margin-top: 4px; }

.ld { display: block; width: 100%; height: auto; }
.ld-floor { stroke: var(--text); stroke-width: 2; }
.ld-thud { fill: none; stroke: var(--error); stroke-width: 1.8; stroke-linecap: round; opacity: 0; }
.ld-state.bad { fill: var(--error); }
.cpm-list { font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
.cpm-list p { display: grid; grid-template-columns: 72px auto; }
.cpm-list span { color: var(--muted); }
.cpm-list b { font-weight: 500; }
.cpm-list b.bad { color: var(--error); }
.cpm-list .gap { color: var(--muted); }
.cpm-k { font-family: ui-monospace, Consolas, monospace; font-size: 18px; font-weight: 500; }
.cpm-zone { font-weight: 500; }
.cpm-zone.bad { color: var(--error); }
.cpm-zone.good { color: var(--accent); }
.cpm-all { width: 100%; border-collapse: collapse; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.cpm-all th, .cpm-all td { padding: 4px 2px; text-align: right; border-bottom: 1px solid var(--line); }
.cpm-all th { font-family: Inter, system-ui, sans-serif; font-weight: 500; color: var(--muted); }
.cpm-all tr.hit td { color: var(--accent); font-weight: 500; }
.btn-link { text-decoration: none; color: var(--accent); border-color: var(--accent); }

.gc-ceil { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.gc-bad { stroke: var(--error); }
.gc-bad-text { fill: var(--error); }
.gc-ref { stroke: var(--line-strong); stroke-dasharray: 4 3; }

/* Gain chart (greyscale, line style only) */
.gc-zone { fill: var(--panel); }
.gc-axis { stroke: var(--text); stroke-width: 1.2; fill: none; }
.gc-split { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.gc-line { fill: none; stroke: var(--text); stroke-width: 2; }
.gc-dash { stroke-dasharray: 7 4; }
.gc-dot { stroke-dasharray: 2 3; stroke: var(--muted); }

/* Nameplate ↔ CPM */
.np { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 4px 0; }
.np-plate { border: 1.5px solid var(--muted); border-radius: 6px; padding: 8px; background: var(--bg); }
.np-title { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; margin-bottom: 4px; }
.np-cpm { display: flex; flex-direction: column; }
.np-row { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; padding: 2px 4px; border-radius: 4px; color: var(--muted); }
.np-row b { font-weight: 400; color: var(--text); white-space: nowrap; }
.np-row.hit, .np-row.hit b { color: var(--accent); font-weight: 500; background: var(--accent-soft); }
.np-eq { font-size: 18px; color: var(--muted); }

/* Value sequence */
.seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; }
.seq-item { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.seq-item b { font-weight: 500; font-size: 15px; }
.seq-item span { font-size: 12px; color: var(--muted); }
.seq-item.hit { border-color: var(--accent); background: var(--accent-soft); }
.seq-item.hit b { color: var(--accent); }
.seq-sep { color: var(--muted); font-size: 16px; }

/* LCD key sequence */
.lcdm { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.lcdm-step { display: flex; flex-direction: column; gap: 4px; }
.lcdm-key { font-size: 14px; font-weight: 500; }
.lcdm-screen { position: relative; font-size: 13px; }
.lcdm-menu {
  position: absolute; right: 12px; top: 8px;
  list-style: none; margin: 0; padding: 4px 8px;
  background: #fff; border: 1px solid var(--text); border-radius: 4px;
}
.lcdm-menu li { padding: 0 4px; }

/* LCD row stepping through values */
.lcdc { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.lcdc .lcd { font-size: 15px; }
.lcdc .lcd b { font-weight: 500; }
.lcdc .lcdc-end b { color: var(--accent); }
.lcdc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; color: var(--muted); }
.lcdc-steps li + li::before { content: "→ "; color: var(--line-strong); }
.lcdc-steps li.on { color: var(--accent); font-weight: 500; }

/* PLS counter */
.pls { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.pls .lcd { font-size: 18px; }
.pls .lcd b { font-weight: 500; }
.pls-state { min-height: 21px; font-size: 14px; font-weight: 500; color: var(--accent); }

/* Path list */
.route { list-style: none; margin: 0; padding: 4px 0 4px 4px; }
.route li {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 14px 22px;
}
.route li::before {
  content: "";
  position: absolute;
  left: 4px; top: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: #fff;
}
.route li::after {
  content: "";
  position: absolute;
  left: 9px; top: 19px; bottom: 0;
  border-left: 2px solid var(--line);
}
.route li:last-child { padding-bottom: 0; }
.route li:last-child::after { display: none; }
.route b { font-weight: 500; font-size: 15px; }
.route span { font-size: 14px; color: var(--muted); }
.route .route-end b { color: var(--accent); }
.route .route-end::before { border-color: var(--accent); background: var(--accent); }

/* Drawing viewer */
.viewer {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #fff;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(15, 23, 42, 0.6); }
.viewer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.viewer-cap { flex: 1; font-size: 14px; font-weight: 500; }
.viewer-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}
.viewer-body img, .viewer-body svg { display: block; width: 100%; height: auto; }
.viewer.zoomed .viewer-body img, .viewer.zoomed .viewer-body svg, .viewer.zoomed .viewer-body .route { width: 250%; max-width: none; }

/* Real danger only (shock, heat) */
.warn { background: var(--caution); color: var(--caution-text); border: 1px solid #f0d49a; border-radius: 8px; padding: 8px 12px; font-size: 15px; }

/* Board page */
.fact { display: flex; flex-direction: column; gap: 2px; }
.row-desc-flat { padding-left: 0; }

.lcd-note { display: flex; flex-direction: column; gap: 2px; }
.br-tbl b.br-na { color: var(--muted); }
/* Measure points: one per line, OK rule, NG example, why */
.ms { display: flex; flex-direction: column; gap: 10px; padding: 2px 0; text-align: left; }
.ms-g { display: flex; flex-direction: column; gap: 4px; }
.ms-h { font-weight: 500; }
.ms-pts { list-style: none; margin: 0; padding: 0 0 0 4px; font-family: ui-monospace, Consolas, monospace; font-size: 15px; line-height: 1.7; }
.ms-pts li::after { content: ""; display: inline-block; width: 64px; margin-left: 8px; border-bottom: 1px solid var(--line-strong); }
.ms-ok { color: var(--accent); font-weight: 500; }
.ms-ng { font-size: 14px; color: var(--muted); line-height: 1.6; }
.ms-ng b { font-weight: 500; color: var(--text); }
.ms-ng b.bad { color: var(--error); }
.ms-tag { display: inline-block; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.ms-why { font-size: 14px; }
.ms-extra ol { margin: 2px 0 0; padding-left: 20px; font-size: 14px; }
.ms-pair { white-space: nowrap; }
.ms-photo summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14px; min-height: 36px; display: flex; align-items: center; }
.ms-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; }
.ms-photo-cap { font-size: 13px; color: var(--muted); margin-top: 4px; }
.br-btns .br-has-sub { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.br-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
