/* Bay IC Repair — Diagnostic Toolkit v1 */
:root {
  --bg: #0a0e13;
  --panel: #10161e;
  --panel2: #161e29;
  --panel3: #1d2734;
  --line: #233042;
  --line2: #2e3e54;
  --text: #dbe5f0;
  --muted: #8396ad;
  --dim: #5d6f86;
  --accent: #1fa4ea;
  --accent-2: #0a8fd6;
  --accent-bg: rgba(31, 164, 234, .12);
  --amber: #f5a524;
  --amber-bg: rgba(245, 165, 36, .12);
  --red: #f05252;
  --red-bg: rgba(240, 82, 82, .12);
  --green: #2fd17a;
  --green-bg: rgba(47, 209, 122, .12);
  --violet: #a78bfa;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 12px;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
  --r: 1;
  --on-accent: #001018;
  --view-bg: transparent;
}
:root[data-theme="light"] {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel2: #f5f8fb;
  --panel3: #e9eef4;
  --line: #d6dee8;
  --line2: #c3cfdc;
  --text: #15202d;
  --muted: #536479;
  --dim: #7b8ba0;
  --accent: #0089cf;
  --accent-2: #0072ad;
  --accent-bg: rgba(0, 142, 212, .10);
  --amber: #b86e00;
  --amber-bg: rgba(217, 119, 6, .12);
  --red: #c92a2a;
  --red-bg: rgba(201, 42, 42, .10);
  --green: #138a4a;
  --green-bg: rgba(19, 138, 74, .10);
  --violet: #6d4fd8;
  --shadow: 0 8px 24px rgba(20, 40, 70, .12);
  color-scheme: light;
  --on-accent: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 238px; flex: 0 0 238px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 40;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand:hover { text-decoration: none; }
.brand img { width: 172px; max-width: 100%; height: auto; display: block; }
.brand-sub { font: 600 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.logo-on-light { display: none !important; }
:root[data-tone="light"] .logo-on-light { display: block !important; }
:root[data-tone="light"] .logo-on-dark { display: none !important; }
.hero-mark { position: absolute; right: 34px; bottom: -24px; height: 210px; opacity: .14; pointer-events: none; }
.print-head { display: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: calc(9px * var(--r));
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: grid; place-items: center; color: var(--on-accent); font: 800 13px var(--mono);
}
.brand-text b { display: block; font-size: 14px; }
.brand-text span { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-sec { font: 600 10.5px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: calc(8px * var(--r)); color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: 0 0 17px; }
.side-foot { margin-top: auto; padding: 14px 18px; font: 11px var(--mono); color: var(--dim); border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.icon-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: calc(9px * var(--r)); cursor: pointer; display: grid; place-items: center; flex: 0 0 auto;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
#menuBtn { display: none; }
.search { position: relative; flex: 1; max-width: 640px; }
.search input { width: 100%; padding-left: 38px; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--dim); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line2); border-radius: calc(10px * var(--r));
  box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.sr-item { display: block; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.sr-item:hover, .sr-item.sel { background: var(--panel2); text-decoration: none; }
.sr-item small { display: block; color: var(--muted); }
.sr-kind { font: 600 10px var(--mono); color: var(--accent); text-transform: uppercase; margin-right: 6px; }

#view { padding: 24px; max-width: 1400px; width: 100%; }

/* ---------- primitives ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h p { color: var(--muted); margin: 0; max-width: 760px; }
.eyebrow { font: 600 11px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }

input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: calc(9px * var(--r)); padding: 9px 12px; font: inherit; outline: none; width: 100%;
}
textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--text);
  padding: 8px 14px; border-radius: calc(9px * var(--r)); font: 600 13px var(--sans); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line2); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: calc(999px * var(--r)); font: 500 11.5px var(--mono);
  background: var(--panel3); color: var(--muted); border: 1px solid var(--line);
}
.chip.acc { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.chip.amb { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip.red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip.grn { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { cursor: pointer; padding: 6px 13px; font-size: 12.5px; }
.filter-chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; font-size: 13.5px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--line2); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: var(--panel2); }
.t-wrap { overflow-x: auto; }

.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--accent-bg); padding: 12px 14px; border-radius: calc(9px * var(--r)); font-size: 13px; }
.callout.amb { border-left-color: var(--amber); background: var(--amber-bg); }
.callout.red { border-left-color: var(--red); background: var(--red-bg); }
.callout.grn { border-left-color: var(--green); background: var(--green-bg); }
.callout b { color: var(--text); }

/* ---------- home ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(1000px 300px at 90% -20%, rgba(0,142,212,.20), transparent 60%), var(--panel);
  border: 1px solid var(--line); border-radius: calc(16px * var(--r)); padding: 28px; margin-bottom: 20px;
}
.hero h1 { font-size: 30px; }
.hero p { color: var(--muted); max-width: 720px; }
.hero-trace { position: absolute; right: -20px; top: 0; bottom: 0; width: 46%; opacity: .5; pointer-events: none; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: calc(10px * var(--r)); padding: 12px 14px; }
.stat b { display: block; font: 700 22px var(--mono); color: var(--text); }
.stat span { font-size: 12px; color: var(--muted); }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: calc(12px * var(--r)); color: var(--text);
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.tile .ti { width: 36px; height: 36px; border-radius: calc(9px * var(--r)); background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; }
.tile .ti svg { width: 19px; height: 19px; }
.tile b { font-size: 14.5px; }
.tile span { color: var(--muted); font-size: 12.5px; }
.cat-tile { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: calc(12px * var(--r)); color: var(--text); }
.cat-tile:hover { border-color: var(--accent); text-decoration: none; }
.cat-tile .n { margin-left: auto; font: 600 12px var(--mono); color: var(--muted); }
.cat-ico { width: 38px; height: 38px; border-radius: calc(10px * var(--r)); display: grid; place-items: center; background: var(--panel3); font-size: 18px; }

/* ---------- device ---------- */
.dev-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: calc(12px * var(--r)); color: var(--text); }
.dev-card:hover { border-color: var(--accent); text-decoration: none; }
.dev-card h3 { margin: 0; font-size: 14.5px; }
.dev-card p { color: var(--muted); font-size: 12.5px; margin: 0; }
.dev-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.seq { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.seq li { position: relative; padding: 0 0 16px 40px; counter-increment: s; }
.seq li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel3); border: 1px solid var(--line2); display: grid; place-items: center; font: 600 12px var(--mono); color: var(--accent);
}
.seq li::after { content: ""; position: absolute; left: 12.5px; top: 27px; bottom: 2px; width: 1px; background: var(--line2); }
.seq li:last-child::after { display: none; }
.seq li.done::before { background: var(--green); color: var(--on-accent); border-color: var(--green); content: "✓"; }
.seq li label { cursor: pointer; display: block; }
.fault { border: 1px solid var(--line); border-radius: calc(10px * var(--r)); margin-bottom: 8px; background: var(--panel2); }
.fault summary { cursor: pointer; padding: 11px 14px; font-weight: 600; list-style: none; display: flex; gap: 10px; align-items: center; }
.fault summary::-webkit-details-marker { display: none; }
.fault summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
.fault[open] summary::before { transform: rotate(90deg); }
.fault .fb { padding: 0 14px 12px 34px; color: var(--muted); font-size: 13px; }
.fault .fb b { color: var(--text); }

/* ---------- wizard ---------- */
.wiz { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.tree-list a { display: block; padding: 9px 12px; border-radius: calc(8px * var(--r)); color: var(--text); font-size: 13px; }
.tree-list a:hover { background: var(--panel2); text-decoration: none; }
.tree-list a.on { background: var(--accent-bg); color: var(--accent); }
.tree-list .grp { font: 600 10.5px var(--mono); color: var(--dim); text-transform: uppercase; padding: 12px 12px 4px; letter-spacing: .08em; }
.step-q { font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.step-info { color: var(--muted); margin-bottom: 16px; }
.opts { display: grid; gap: 8px; }
.opt {
  text-align: left; padding: 13px 16px; background: var(--panel2); border: 1px solid var(--line2); border-radius: calc(10px * var(--r));
  color: var(--text); font: 500 14px var(--sans); cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.opt:hover { border-color: var(--accent); background: var(--accent-bg); }
.opt .k { font: 600 11px var(--mono); color: var(--accent); background: var(--panel3); padding: 2px 7px; border-radius: calc(5px * var(--r)); }
.trail { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.trail div { font-size: 12.5px; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--line2); }
.trail div b { color: var(--text); font-weight: 600; }
.verdict { border-radius: calc(12px * var(--r)); padding: 18px; border: 1px solid var(--line2); background: var(--panel2); }
.verdict h2 { display: flex; align-items: center; gap: 10px; }
.verdict ol { padding-left: 20px; margin: 8px 0; }
.verdict li { margin-bottom: 6px; }
.progress { height: 4px; background: var(--panel3); border-radius: calc(4px * var(--r)); overflow: hidden; margin-bottom: 16px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .25s; }

/* ---------- gauge ---------- */
.gauge { position: relative; height: 34px; border-radius: calc(8px * var(--r)); background: var(--panel3); overflow: hidden; margin: 12px 0 4px; border: 1px solid var(--line); }
.gauge .ok { position: absolute; top: 0; bottom: 0; background: var(--green-bg); border-left: 1px dashed var(--green); border-right: 1px dashed var(--green); }
.gauge .mk { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.gauge-l { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--dim); }
.result-big { font: 700 28px var(--mono); }
.verdict-pill { display: inline-block; padding: 5px 12px; border-radius: calc(8px * var(--r)); font-weight: 700; font-size: 13px; }
.v-ok { background: var(--green-bg); color: var(--green); }
.v-warn { background: var(--amber-bg); color: var(--amber); }
.v-bad { background: var(--red-bg); color: var(--red); }

/* ---------- library ---------- */
.drop {
  border: 2px dashed var(--line2); border-radius: calc(12px * var(--r)); padding: 28px; text-align: center; color: var(--muted);
  transition: all .15s; cursor: pointer; background: var(--panel2);
}
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.drop svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 6px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.doc-row:hover { background: var(--panel2); }
.doc-ico { width: 38px; height: 38px; border-radius: calc(8px * var(--r)); display: grid; place-items: center; font: 700 10px var(--mono); flex: 0 0 38px; background: var(--panel3); color: var(--accent); text-transform: uppercase; }
.doc-main { flex: 1; min-width: 0; }
.doc-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-main small { color: var(--muted); }

/* ---------- boardview ---------- */
.bv { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.bv-stage { position: relative; height: calc(100vh - 210px); min-height: 460px; background: #05080c; border: 1px solid var(--line); border-radius: calc(12px * var(--r)); overflow: hidden; }
:root[data-tone="light"] .bv-stage { background: #0b1118; }
.bv-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.bv-stage canvas:active { cursor: grabbing; }
.bv-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #8396ad; padding: 20px; }
.bv-hud { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.bv-hud .btn { background: rgba(16, 22, 30, .85); color: #dbe5f0; border-color: #2e3e54; }
.bv-side { max-height: calc(100vh - 210px); overflow-y: auto; }
.bv-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: calc(8px * var(--r)); }
.bv-list div { padding: 5px 10px; font: 12px var(--mono); cursor: pointer; border-bottom: 1px solid var(--line); }
.bv-list div:hover { background: var(--accent-bg); color: var(--accent); }

/* ---------- block diagrams ---------- */
.bd-wrap { overflow: auto; border: 1px solid var(--line); border-radius: calc(12px * var(--r)); background: var(--panel2); padding: 10px; }
.bd-wrap svg { display: block; height: auto; }
.bd-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.bd-legend i { display: inline-block; width: 12px; height: 12px; border-radius: calc(3px * var(--r)); vertical-align: -2px; margin-right: 5px; border: 1.5px solid; }
.bd-legend .ln { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--accent); vertical-align: 3px; margin-right: 5px; }
.bd-legend .ln.s { border-top: 2px dashed var(--amber); }
.bd-thumb { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: calc(12px * var(--r)); color: var(--text); }
.bd-thumb:hover { border-color: var(--accent); text-decoration: none; }
.bd-thumb .pv { height: 120px; overflow: hidden; border-radius: calc(8px * var(--r)); background: var(--panel2); display: grid; place-items: center; }
.bd-thumb .pv svg { width: 100%; height: 100%; }
.order { counter-reset: o; list-style: none; padding: 0; margin: 8px 0; }
.order li { counter-increment: o; padding: 5px 0 5px 30px; position: relative; font-size: 13px; border-bottom: 1px solid var(--line); }
.order li::before { content: counter(o); position: absolute; left: 0; top: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font: 600 11px var(--mono); display: grid; place-items: center; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line2); border-radius: calc(14px * var(--r)); width: min(1100px, 100%); max-height: 92vh; overflow: auto; padding: 20px; position: relative; box-shadow: var(--shadow); }
.modal-card.narrow { width: min(620px, 100%); }
.modal-close { position: absolute; right: 12px; top: 10px; background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.modal iframe, .modal .prev-img { width: 100%; height: 78vh; border: 0; border-radius: calc(8px * var(--r)); background: #fff; object-fit: contain; }
.modal .prev-img { background: var(--panel2); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel3); border: 1px solid var(--line2); color: var(--text); padding: 10px 18px; border-radius: calc(10px * var(--r)); opacity: 0; transition: all .25s; z-index: 200; box-shadow: var(--shadow); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--dim); margin-bottom: 8px; }
.res-link { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: calc(10px * var(--r)); background: var(--panel2); color: var(--text); }
.res-link:hover { border-color: var(--accent); text-decoration: none; }
.res-link small { display: block; color: var(--muted); }
.vend-links { display: flex; flex-wrap: wrap; gap: 6px; }
.vend-links a { font: 600 11.5px var(--mono); padding: 4px 9px; border-radius: calc(6px * var(--r)); background: var(--panel3); border: 1px solid var(--line); color: var(--text); }
.vend-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.vend-links a.intl { color: var(--muted); border-style: dashed; }
.status { font: 600 11px var(--mono); padding: 3px 8px; border-radius: calc(6px * var(--r)); }
.st-Intake { background: var(--panel3); color: var(--muted); }
.st-Diagnosing { background: var(--accent-bg); color: var(--accent); }
.st-Waiting { background: var(--amber-bg); color: var(--amber); }
.st-Repaired { background: var(--green-bg); color: var(--green); }
.st-Unrepairable { background: var(--red-bg); color: var(--red); }
.st-Returned { background: var(--panel3); color: var(--dim); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bv { grid-template-columns: 1fr; }
  .bv-side { max-height: none; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  #menuBtn { display: grid; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .wiz { grid-template-columns: 1fr; }
  #view { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .hero-trace { display: none; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 24px; }
}
@media print {
  .sidebar, .topbar, .btn { display: none !important; }
  .print-head { display: block; padding: 0 0 12px; border-bottom: 2px solid #0090d6; margin-bottom: 16px; }
  .print-head img { height: 54px; }
  body { background: #fff; color: #000; }
}
