/* The test bench and the document view (viewer + results panel). On wide screens the bench is
   one screen with no page scroll: the rail, the page viewer and the panel each scroll inside
   themselves. Colours come from css/tokens.css. */

/* Bench layout. */
.view-bench { height: calc(100dvh - var(--top-h)); display: grid; grid-template-columns: 320px minmax(0, 1fr); }
@media (min-width: 2200px) { .view-bench { grid-template-columns: 380px minmax(0, 1fr); } }

/* Rail. */
.rail { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-right: 1px solid var(--border); background: var(--card); min-height: 0; }
.rail-head { display: none; }
.drop { display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-l); padding: 16px 12px; cursor: pointer; background: var(--raise); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { display: none; }
.drop strong { font-size: 13.5px; font-weight: 600; }
.drop span { color: var(--muted-fg); font-size: 11.5px; }
.drop-icon { width: 34px !important; height: 34px !important; padding: 8px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.opts { border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--raise); }
.opts summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 600; font-size: 13px; }
.opts summary::-webkit-details-marker { display: none; }
.opts summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--muted-fg); border-bottom: 1.5px solid var(--muted-fg); transform: rotate(45deg); transition: transform .15s; }
.opts[open] summary::after { transform: rotate(225deg); }
.opts-sum { color: var(--muted-fg); font-weight: 400; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-group { padding: 4px 12px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); font-size: 12px; color: var(--muted-fg); background: transparent; transition: all .12s; }
.chip input:checked + span { background: var(--muted); border-color: var(--border-strong); color: var(--fg); font-weight: 500; }
.chip input:checked + span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.chip input:focus-visible + span { outline: 2px solid var(--ring); }
.opt-row { display: flex; gap: 10px; margin-top: 8px; }
.opt-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted-fg); flex: 1; }
.opt-row select { padding: 4px 8px; font-size: 12.5px; color: var(--fg); }
.rail-tabs button { flex: 1; justify-content: center; }
/* A batch of files being read (bench.js): progress, then a summary. */
.batch { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--raise); font-size: 12.5px; }
.batch > [data-icon] { width: 15px; height: 15px; color: var(--ok-ink); }
.batch .spin { width: 13px; height: 13px; border-width: 1.5px; color: var(--info-ink); }
.batch-text { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-bar { grid-column: 1 / -1; grid-row: 2; height: 4px; border-radius: 2px; background: var(--muted); overflow: hidden; }
.batch-bar i { display: block; height: 100%; background: var(--info); border-radius: 2px; transition: width .2s; }
.batch .btn { grid-column: 3; grid-row: 1; margin: -4px -6px; }
.item .s.bad { color: var(--bad-ink); }
.rail-body { flex: 1; min-height: 0; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.list { display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 1px solid transparent; background: none; padding: 7px 8px; border-radius: 10px; cursor: pointer; min-width: 0; }
.item:hover { background: var(--muted); }
.item.active { background: var(--muted); border-color: var(--border-strong); }
.item .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.item .t { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted-fg); font-size: 11.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .score { color: var(--muted-fg); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.item-row { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.item-row .item { flex: 1; }
.item-row .jobs-link { flex: none; opacity: 0; width: 28px; height: 28px; }
.item-row:hover .jobs-link, .item-row .item.active + .jobs-link, .jobs-link:focus-visible { opacity: 1; }
@media (hover: none) { .item-row .jobs-link { opacity: 1; } }
.ftype { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; background: var(--muted); color: var(--fg-2); overflow: hidden; }
.ftype img { width: 100%; height: 100%; object-fit: cover; }
.ftype.jpg, .ftype.png, .ftype.heic, .ftype.webp { background: hsl(199 89% 48% / 16%); color: var(--info-ink); }
.ftype.pdf { background: hsl(25 90% 55% / 16%); color: hsl(25 95% 62%); }
.ftype.eml, .ftype.html, .ftype.htm { background: hsl(280 65% 66% / 16%); color: hsl(280 70% 76%); }
.ftype.txt, .ftype.docx, .ftype.doc, .ftype.odt, .ftype.xlsx { background: hsl(45 90% 50% / 15%); color: hsl(45 95% 60%); }
[data-theme="light"] .ftype.pdf { color: hsl(22 85% 38%); }
[data-theme="light"] .ftype.eml, [data-theme="light"] .ftype.html, [data-theme="light"] .ftype.htm { color: hsl(280 55% 42%); }
[data-theme="light"] .ftype.txt, [data-theme="light"] .ftype.docx, [data-theme="light"] .ftype.doc, [data-theme="light"] .ftype.odt, [data-theme="light"] .ftype.xlsx { color: hsl(40 90% 30%); }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--input); border-radius: var(--radius); padding: 0 8px; margin: 2px 0 8px; color: var(--muted-fg); }
.search input { border: none; padding: 7px 0; flex: 1; background: transparent; min-width: 0; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--ring); outline-offset: 1px; }
.rail-empty { color: var(--muted-fg); font-size: 12.5px; padding: 18px 8px; text-align: center; }
.scrim { display: none; }

/* Stage. */
.stage { min-width: 0; min-height: 0; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
/* The bench's head: like the other pages' pinned heads (title, then the service strip). */
.benchbar { display: flex; align-items: center; gap: 8px 14px; min-width: 0; flex: none; min-height: 64px; padding: 12px 0; }
.benchbar h1 { font-size: 20px; line-height: 1.3; white-space: nowrap; }
.drawer-btn { display: none; }
.services { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; align-items: center; min-width: 0; }
.svc { display: inline-flex; align-items: center; gap: 4px; padding: 2px 3px 2px 8px; min-height: 28px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; background: var(--card); cursor: default; white-space: nowrap; }
.svc:not(:has(.wake-btn)) { padding-right: 10px; }
.svc-info { display: inline-flex; align-items: center; gap: 7px; }
.svc .wake-note { font-size: 11.5px; }
/* Wake buttons (js/ui/wake.js). */
.wake-btn { flex: none; color: var(--fg-2); }
.wake-btn [data-icon] { width: 13px; height: 13px; }
.wake-btn .spin { width: 12px; height: 12px; border-width: 1.5px; }
.wake-btn.compact { width: 22px; height: 22px; padding: 0; border-radius: 99px; }
.wake-btn:disabled { opacity: .4; }
.wake-note { color: var(--warn-ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wake-note.ok { color: var(--ok-ink); }
.wake-note.bad { color: var(--bad-ink); }
.svc .sw { width: 3px; height: 12px; border-radius: 2px; background: var(--c, var(--faint)); }
.svc.off { opacity: .55; }
.svc small { color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.doc { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.docbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.docbar .title { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: 4px; }
.docbar .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.docbar .pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; align-items: center; }
.docbar .jobs-link { margin-left: auto; }
.pill { display: inline-flex; gap: 5px; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; background: var(--muted); color: var(--fg-2); white-space: nowrap; font-weight: 500; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.info { background: var(--info-soft); color: var(--info-ink); }
.pill.big { font-size: 13px; padding: 6px 12px; white-space: normal; }
.pill .spin { width: 11px; height: 11px; border-width: 1.5px; }

.work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(440px, 1fr); gap: 12px; }
@media (min-width: 2200px) { .work { grid-template-columns: minmax(0, 1fr) minmax(720px, 1.15fr); } }

.viewer, .panel { min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-sm); overflow: hidden; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border-2); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--muted); }
.seg button { border: none; background: none; padding: 3px 10px; cursor: pointer; font-size: 12px; border-radius: 7px; color: var(--muted-fg); font-weight: 500; }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: var(--shadow-sm); }
[data-theme="light"] .seg button.on { background: #fff; }
.toggles { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.toggles .chip span { font-size: 11.5px; padding: 2px 9px; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }
.zoom button { border: 1px solid var(--border); background: transparent; border-radius: 7px; height: 26px; min-width: 26px; padding: 0 7px; cursor: pointer; font-size: 12px; color: var(--fg-2); }
.zoom button:hover { background: var(--muted); }
.zoom button.on { border-color: var(--border-strong); color: var(--fg); background: var(--muted); }
.zoom .lvl { font-size: 11.5px; color: var(--muted-fg); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }

.pages { flex: 1; min-height: 0; overflow: auto; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 18px; container-type: size;
  background: var(--canvas) radial-gradient(circle at 1px 1px, var(--canvas-dot) 1px, transparent 0) 0 0 / 18px 18px; }
.page { position: relative; flex: none; box-shadow: var(--shadow-l); border-radius: 3px; background: #fff; line-height: 0; }
.page img { display: block; border-radius: 3px; }
.pages[data-zoom="page"] .page img { max-width: calc(100cqw - 4px); max-height: calc(100cqh - 36px); width: auto; height: auto; }
.pages[data-zoom="width"] .page { width: 100%; }
.pages[data-zoom="width"] .page img, .pages[data-zoom="custom"] .page img { width: 100%; height: auto; }
.pages[data-zoom="custom"] { align-items: flex-start; }
.pages[data-zoom="custom"] .page { margin: 0 auto; }
.page svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.page .sizer { visibility: hidden; }
.page .crop { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; }
.page .inner { position: absolute; }
.pages[data-zoom] .page .inner img { width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; }
.page .label { position: absolute; top: -9px; left: -9px; background: var(--fg); color: var(--bg); font-size: 10.5px; line-height: 1.4; border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.r { fill: var(--region-fill); stroke: var(--region); stroke-width: 1.1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .1s; }
.r:hover, .r.hl { fill: hsl(38 92% 50% / 28%); stroke: var(--hl); stroke-width: 2.4; }
.w { fill: none; stroke: hsl(199 89% 55% / 55%); stroke-width: .8; stroke-dasharray: 2 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay { fill: hsl(220 70% 60% / 4%); stroke: var(--svc-ocr); stroke-width: 1.5; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.bc { fill: hsl(160 84% 39% / 14%); stroke: var(--ok); stroke-width: 2; vector-effect: non-scaling-stroke; }
.red { fill: #0a0a0a; stroke: var(--brand); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.red.ai { stroke-dasharray: 4 2; }
.paper { fill: none; stroke: var(--svc-convert); stroke-width: 2; stroke-dasharray: 8 4; vector-effect: non-scaling-stroke; }
textarea { width: 100%; resize: vertical; margin-top: 4px; }
.tip { position: fixed; z-index: 50; background: var(--popover); color: var(--fg); border: 1px solid var(--border); padding: 6px 9px; border-radius: var(--radius); font-size: 12px; max-width: 380px; pointer-events: none; box-shadow: var(--shadow-l); line-height: 1.4; }

/* Results panel: underline tabs, the active one in brand red. */
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border-2); overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs { position: relative; }
.tabs button { flex: none; border: none; background: none; color: var(--muted-fg); padding: 8px 9px 9px; cursor: pointer; border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-weight: 500; font-size: 12.5px; }
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--fg); border-bottom-color: var(--brand); }
.tabs .count { font-size: 10.5px; }
.tabbody { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px 24px; }

.section { border: 1px solid var(--border-2); border-radius: var(--radius-l); padding: 12px 14px; margin-bottom: 14px; background: var(--raise); }
.section > h3:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h3 { margin: 0; flex: 1; }
.section-head select { padding: 3px 8px; font-size: 12px; }
table.f { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.f th, table.f td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
table.f tr:last-child td { border-bottom: none; }
table.f th { color: var(--muted-fg); font-weight: 500; font-size: 11.5px; }
table.f tr.link { cursor: pointer; }
table.f tr.link:hover td, table.f tr.hl td, table.f td.link:hover, table.f td.hl { background: var(--hl-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.fname { color: var(--fg-2); font-weight: 500; white-space: nowrap; }
.status { font-size: 11px; padding: 1px 8px; border-radius: 99px; white-space: nowrap; font-weight: 500; }
.status.verified { background: var(--ok-soft); color: var(--ok-ink); }
.status.found_elsewhere { background: var(--warn-soft); color: var(--warn-ink); }
.status.unsupported { background: var(--bad-soft); color: var(--bad-ink); }
.status.missing { color: var(--muted-fg); }
.status.disputed { background: var(--warn-soft); color: var(--warn-ink); box-shadow: inset 0 0 0 1px var(--warn); }
.status.corrected { background: var(--info-soft); color: var(--info-ink); margin-left: 6px; }
.status.rules { background: var(--info-soft); color: var(--info-ink); }
table.f tr.disputed td { background: var(--warn-soft); }
.warn-text { color: var(--warn-ink); }
.alts { font-size: 12px; color: var(--muted-fg); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.alt { padding: 1px 7px; border-radius: 99px; background: var(--muted); color: var(--fg-2); cursor: pointer; }
.alt.hl, .alt:hover { background: var(--hl-soft); }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.checks li { padding: 6px 10px; border-radius: 8px; font-size: 12.5px; }
.checks li.ok { background: var(--ok-soft); }
.checks li.no { background: var(--bad-soft); }
.checks li.info { background: var(--muted); color: var(--fg-2); }
.lines { font-family: var(--mono); font-size: 12px; display: flex; flex-direction: column; }
.line { display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 5px; cursor: pointer; white-space: pre-wrap; }
.line:hover, .line.hl { background: var(--hl-soft); }
.line .id { color: var(--faint); font-size: 10.5px; width: 42px; flex: none; }
.cells { display: flex; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.cell { padding: 1px 7px; border-radius: 5px; border: 1px solid var(--border-2); background: var(--card); }
.cell.amount { margin-left: auto; font-variant-numeric: tabular-nums; }
.cell.split { border-style: dashed; border-color: var(--info); }
.cell.hl, .cell:hover { background: hsl(38 92% 50% / 22%); border-color: var(--hl); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--muted-fg); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.wait { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--info-soft); border-radius: 10px; color: var(--info-ink); }

/* Timings waterfall: one bar per call in its service's colour; amber waited for a wake. */
.wf { display: grid; grid-template-columns: 130px 1fr 64px; gap: 8px 12px; align-items: center; font-size: 12px; }
.wf .lbl { display: flex; align-items: center; gap: 7px; color: var(--fg-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf .lbl i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); flex: none; }
.wf .track { position: relative; }
.bar { height: 10px; border-radius: 5px; background: var(--c, var(--info)); min-width: 3px; }
.bar.woke { background: var(--warn); }
.bar.fail { background: var(--bad); }
.bar.open { background: repeating-linear-gradient(-45deg, var(--c, var(--info)) 0 6px, transparent 6px 10px); box-shadow: inset 0 0 0 1px var(--c, var(--info)); animation: stripes 1s linear infinite; background-size: 28px 28px; }
@keyframes stripes { to { background-position: 28px 0; } }
.wf .ms { color: var(--muted-fg); font-variant-numeric: tabular-nums; text-align: right; }
pre.json { font-family: var(--mono); font-size: 11.5px; background: var(--muted); padding: 12px; border-radius: 10px; overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
details > summary { cursor: pointer; }
.issue { padding: 7px 10px; border-radius: 8px; margin-bottom: 4px; font-size: 12.5px; }
.issue.serious { background: var(--bad-soft); }
.issue.minor { background: var(--warn-soft); }
.gridtable { overflow: auto; }

.edit { border: none; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; font-size: 12px; opacity: 0; }
tr:hover .edit { opacity: 1; }
@media (hover: none) { .edit { opacity: 1; } }
.editor { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.editor .note { flex-basis: 100%; }
.edit-input { border: 1px solid var(--info) !important; padding: 4px 8px !important; min-width: 200px; }

/* Loading skeleton. */
.skel { background: linear-gradient(90deg, var(--muted), var(--border), var(--muted)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-page { width: min(420px, 70%); aspect-ratio: 3 / 4; border-radius: 4px; }
/* The page placeholder: an A4 page at "Fit", where the first page will land. */
.page.ph-page { height: calc(100cqh - 36px); max-width: calc(100cqw - 4px); aspect-ratio: 210 / 297; background: var(--muted); box-shadow: none; opacity: .55; }
.zoom button:disabled, .seg button:disabled, .tabs button:disabled { cursor: default; }
.tabs button:disabled:not(.on) { color: var(--muted-fg); }
.skel-line { height: 12px; margin: 10px 0; }

/* Bench empty state. */
.empty { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; }
.hero { position: relative; max-width: 1040px; width: 100%; padding: 12px; }
@media (min-width: 2200px) { .hero { max-width: 1480px; } }
.hero h2 { font-size: 28px; letter-spacing: -.025em; margin-bottom: 8px; font-weight: 700; }
.hero h2 .accent { color: var(--brand); }
.hero > p { color: var(--muted-fg); font-size: 14.5px; max-width: 680px; margin: 0 0 22px; }
.keycard { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-l); background: var(--warn-soft); color: var(--warn-ink); margin-bottom: 20px; font-weight: 500; border: 1px solid hsl(38 92% 50% / 30%); }
.keycard .btn { margin-left: auto; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 26px; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 14px; box-shadow: var(--shadow-sm); }
.step .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); margin-bottom: 10px; }
.step .ic [data-icon] { width: 17px; height: 17px; }
.step b { display: block; margin-bottom: 3px; font-weight: 600; }
.step p { margin: 0; color: var(--muted-fg); font-size: 12.5px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.quick .item { border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); }
.quick .item:hover { border-color: var(--border-strong); background: var(--raise); }

/* Narrow screens: the bench becomes a scrolling page and the rail a drawer. */
@media (max-width: 1100px) {
  .view-bench { display: block; height: auto; }
  .rail { position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(360px, 88vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-l); border-right: 1px solid var(--border); }
  .view-bench.drawer-open .rail { transform: none; }
  .rail-head { display: flex; align-items: center; gap: 8px; }
  .rail-head b { flex: 1; font-size: 14px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgb(0 0 0 / 50%); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .view-bench.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .drawer-btn { display: inline-flex; }
  .stage { padding: 0 12px 24px; }
  .benchbar { position: sticky; top: var(--top-h); z-index: 20; margin: 0 -12px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .15s; flex-wrap: wrap; }
  .benchbar.stuck { border-bottom-color: var(--border); }
  .benchbar .services { order: 3; flex-basis: 100%; }
  .services { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .services::-webkit-scrollbar { display: none; }
  .work { grid-template-columns: 1fr; }
  .viewer { height: 70vh; }
  .panel { height: 80vh; }
  .empty { overflow: visible; display: block; }
  .docbar .name { max-width: 60vw; }
}
@media (max-width: 560px) {
  .hero h2 { font-size: 23px; }
  .steps { grid-template-columns: 1fr 1fr; gap: 8px; }
  .step { padding: 12px; }
  .step p { font-size: 12px; }
  .wf { grid-template-columns: 92px 1fr 52px; gap: 6px 8px; }
  .tabbody { padding: 14px 12px 20px; }
  .viewer { height: 62vh; }
  .toolbar .toggles { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}
