/* Workflow builder, home page, documentation reader and executed-batch overlay. Loaded after app.css. */

.topnav a { padding: 6px 9px; }

/* ---- home ---- */
.home-hero { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; margin-bottom: 8px; }
.home-hero h1 { font-size: 26px; margin: 4px 0 8px; }
.home-hero .actions { margin-top: 12px; }
.home-stats h4, .home-stats .h4 { margin-top: 0; }
.home-stat { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.home-stat strong { font-size: 20px; color: var(--teal-dark); min-width: 42px; text-align: right; }
.home-stat span { color: var(--muted); font-size: 12px; }
.home-h2 { margin: 22px 0 10px; color: var(--teal-dark); font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.home-grid.docs { grid-template-columns: repeat(3, 1fr); }
.home-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; min-height: 120px; }
a.home-card:hover { border-color: var(--teal); text-decoration: none; box-shadow: 0 2px 10px rgba(53, 87, 199,.12); }
.home-card strong { font-size: 14px; }
.home-ico { font-size: 20px; color: var(--teal); line-height: 1; }
.home-link { margin-top: auto; color: var(--teal-dark); font-size: 12px; font-weight: 600; }
.home-card .tag { align-self: flex-start; }
.home-card.static .actions { margin-top: auto; }
@media (max-width: 1100px) { .home-hero { grid-template-columns: 1fr; } .home-grid, .home-grid.docs { grid-template-columns: 1fr 1fr; } }

/* ---- documentation reader ---- */
.doc-page { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.doc-toc { position: sticky; top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; max-height: calc(100vh - 32px); overflow: auto; }
.doc-toc h4, .doc-toc .h4 { margin: 8px 0 6px; font-size: 13px; color: var(--ink); }
.doc-toc ul { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.doc-toc li { padding: 2px 0; } .doc-toc li.lvl-3 { padding-left: 14px; font-size: 12px; }
.doc-toc a { color: var(--ink-2); } .doc-toc a:hover { color: var(--teal-dark); }
.doc-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 36px; max-width: 980px; line-height: 1.55; }
.doc-body h1 { font-size: 26px; margin: 0 0 14px; border-bottom: 2px solid var(--teal); padding-bottom: 8px; }
.doc-body h2 { font-size: 18px; margin: 28px 0 8px; color: var(--teal-dark); scroll-margin-top: 16px; }
.doc-body h3, .doc-body .h3 { font-size: 16px; margin: 18px 0 6px; scroll-margin-top: 16px; }
.doc-body h4, .doc-body .h4 { font-size: 13px; margin: 14px 0 4px; color: var(--ink); }
.doc-body p { margin: 0 0 10px; }
.doc-body ul, .doc-body ol { margin: 0 0 10px; padding-left: 24px; } .doc-body li { margin: 2px 0; }
.doc-body blockquote { margin: 0 0 10px; padding: 8px 14px; border-left: 3px solid var(--teal); background: var(--teal-light); border-radius: 0 4px 4px 0; }
.doc-body blockquote p { margin: 0; }
.doc-body pre { background: var(--ink); color: #E6EDF3; padding: 12px 14px; border-radius: var(--radius); overflow: auto; font-size: 12px; line-height: 1.45; }
.doc-body pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
.doc-table { overflow-x: auto; margin: 0 0 12px; }
.doc-body table { border-collapse: collapse; width: 100%; font-size: 12px; }
.doc-body th, .doc-body td { text-align: left; padding: 6px 10px; border: 1px solid var(--line); vertical-align: top; }
.doc-body th { background: var(--bg); font-size: 12px; color: var(--ink-2); }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
@media (max-width: 1100px) { .doc-page { grid-template-columns: 1fr; } .doc-toc { position: static; max-height: none; } }

/* ---- workflow builder ---- */
.wf-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
.wf { display: grid; grid-template-columns: 230px 1fr 320px; gap: 12px; align-items: start; }
.wf-palette, .wf-inspector { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.wf-palette h4, .wf-palette .h4 { margin: 10px 0 6px; } .wf-palette h4:first-child, .wf-palette .h4:first-child { margin-top: 0; }
.wf-pal { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); cursor: grab; font-size: 12px; }
.wf-pal:hover { border-color: var(--teal); background: var(--card); }
.wf-pal[draggable="false"] { cursor: default; opacity: .6; }
.wf-pal .wf-pal-ico { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: var(--on-brand); }
.wf-pal.kind-op .wf-pal-ico { background: var(--teal); }
.wf-pal.kind-phase .wf-pal-ico { background: #8A5A00; }
.wf-pal .muted { margin-left: auto; text-align: right; max-width: 110px; line-height: 1.2; }
.wf-pal.kind-tpl { flex-wrap: wrap; border-style: dashed; background: #FAFBFF; }
.wf-pal.kind-tpl .wf-pal-ico { background: #5E35B1; }
.wf-pal.kind-tpl .tpl-name { font-weight: 600; flex: 1; min-width: 0; }
.wf-pal.kind-tpl .muted { margin-left: 0; max-width: none; text-align: left; flex-basis: 100%; }
.wf-pal.kind-tpl .btn.tiny { opacity: .5; } .wf-pal.kind-tpl:hover .btn.tiny { opacity: 1; }
.wf-tpl-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 3px; }
.wf-pal .builtin { font-size: 12px; color: #5E35B1; background: #EDE7F6; border-radius: 3px; padding: 0 4px; }

.wf-canvas { min-height: 60vh; padding: 4px 2px 40px; }
.wf-empty { padding: 28px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 6px; }

.wf-op { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: var(--radius); margin: 2px 0; cursor: grab; }
.wf-op.sel { box-shadow: 0 0 0 2px var(--teal); }
.wf-op.orphan { border-left-color: var(--warn); }
.wf-op-head { display: flex; gap: 8px; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
.wf-op-head .desc { font-size: 14px; }
.wf-op-body { padding: 0 12px 8px 22px; }
.wf-op .op-num { font-size: 12px; font-weight: 700; color: var(--on-brand); background: var(--teal); padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }

.wf-phase { border: 1px solid #F3D9A4; border-left: 4px solid #F9A825; border-radius: var(--radius); background: #FFFDF7; margin: 2px 0; cursor: grab; }
.wf-phase.sel { box-shadow: 0 0 0 2px #F9A825; }
.wf-phase.loose { border-color: var(--line); border-left-color: #B0BEC5; background: var(--bg); }
.wf-phase-head { display: flex; gap: 8px; align-items: center; padding: 6px 10px; flex-wrap: wrap; font-size: 13px; }
.wf-phase .ph-num { font-size: 12px; font-weight: 700; color: #8A5A00; background: #FFF4DF; border: 1px solid #F3D9A4; padding: 1px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.wf-phase .ph-num.none { color: var(--muted); background: var(--card); border-color: var(--line); }
.wf-phase > .wf-step, .wf-phase > .wf-zone { margin-left: 10px; margin-right: 8px; }

.wf-step { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 2px 0; cursor: grab; }
.wf-step.sel { box-shadow: 0 0 0 2px var(--teal-dark); }
.wf-step.st-manual { border-left-color: #90A4AE; } .wf-step.st-automatic { border-left-color: var(--teal); } .wf-step.st-verification { border-left-color: #3949AB; }
.wf-step.st-dispense { border-left-color: #F9A825; } .wf-step.st-sampling { border-left-color: #23408F; }
.wf-step-head { display: flex; gap: 8px; align-items: center; padding: 5px 10px; flex-wrap: wrap; font-size: 12px; }
.wf-step-head .desc { font-weight: 500; }
.wf-acts { padding: 0 8px 4px 32px; }
.wf-act { display: flex; gap: 8px; align-items: center; padding: 3px 8px; margin: 1px 0; border: 1px solid transparent; border-radius: 4px; font-size: 12px; cursor: grab; background: var(--bg); }
.wf-act:hover { border-color: var(--teal-mid); }
.wf-act.sel { border-color: var(--teal); background: var(--teal-light); }
.wf-act .seq { font-family: var(--mono); color: var(--muted); width: 22px; font-size: 12px; }
.wf-act .desc { flex: 0 1 auto; }
.wf-op .id, .wf-phase .id, .wf-step .id { font-family: var(--mono); font-size: 12px; color: var(--teal-dark); white-space: nowrap; }
.wf-op .btn.tiny, .wf-phase .btn.tiny, .wf-step .btn.tiny, .wf-act .btn.tiny { opacity: .55; }
.wf-op:hover > .wf-op-head .btn.tiny, .wf-phase:hover > .wf-phase-head .btn.tiny, .wf-step:hover > .wf-step-head .btn.tiny, .wf-act:hover .btn.tiny { opacity: 1; }
.wf .step-no { display: inline-block; min-width: 22px; text-align: center; font-weight: 700; font-size: 12px; color: var(--teal-dark); background: var(--teal-light); border-radius: 4px; padding: 0 4px; }
.wf .st, .wf .at { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; }
.wf .st-manual { background: var(--surface-3); color: #455A64; border-color: #CFD8DC; } .wf .st-automatic { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.wf .st-verification { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; } .wf .st-dispense { background: #FFF4DF; color: #8A5A00; border-color: #F3D9A4; } .wf .st-sampling { background: #E0F2F1; color: #23408F; border-color: #B2DFDB; }
.wf .at-instruction { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); } .wf .at-dataentry { background: #E3F2FD; color: #1565C0; border-color: #BBDEFB; }
.wf .at-sample { background: #E0F2F1; color: #23408F; border-color: #B2DFDB; } .wf .at-signature { background: #EDE7F6; color: #5E35B1; border-color: #D1C4E9; }
.wf .at-weigh { background: #FFF4DF; color: #8A5A00; border-color: #F3D9A4; } .wf .at-calculation { background: #E8F5E9; color: #2E7D32; border-color: #C8E6C9; } .wf .at-verification { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; }
.wf .ipc-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 3px; background: var(--teal); color: var(--on-brand); }
.wf .tag.mand { background: var(--ink); color: var(--on-brand); border-color: var(--ink); font-weight: 700; }
.wf .hz { color: var(--err); font-weight: 700; font-size: 12px; }

/* drop slots: thin by default; app.js adds .live to the slots that accept the block being dragged (no render while dragging) */
.wf-zone { height: 4px; margin: 0; border-radius: 3px; transition: height .12s, background .12s; }
.wf-zone-hint { display: none; }
.wf-zone.live .wf-zone-hint { display: inline; }
.wf-zone.live { height: 36px; margin: 4px 0; border: 2px dashed var(--teal-mid); background: #F2FAF9; color: var(--teal-dark); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.wf-zone.live.over { background: var(--teal-light); border-color: var(--teal); border-style: solid; height: 44px; font-weight: 600; }
.wf-zone-operation.live { height: 48px; } .wf-zone-phase.live { height: 40px; }

.wf-inspector .insp-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.wf-inspector .insp-head h4, .wf-inspector .insp-head .h4 { margin: 0; }
.wf-inspector .field { margin-bottom: 8px; }
.wf-inspector .field input, .wf-inspector .field select, .wf-inspector .field textarea { width: 100%; }
.wf-inspector .mini td { padding: 2px 8px 2px 0; }

@media (max-width: 1300px) { .wf { grid-template-columns: 200px 1fr 280px; } }
@media (max-width: 1000px) { .wf { grid-template-columns: 1fr; } .wf-palette, .wf-inspector { position: static; max-height: none; } }

/* ---- executed batch record overlay (MBR preview) ---- */
.ebr-status { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid transparent; text-transform: uppercase; letter-spacing: .03em; }
.ebr-status.s-completed, .ebr-status.s-closed, .ebr-status.s-pass { background: var(--ok-bg); color: var(--ok); border-color: #BFE3C1; }
.ebr-status.s-inprogress, .ebr-status.s-open { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.ebr-status.s-aborted, .ebr-status.s-fail { background: var(--err-bg); color: var(--err); border-color: #F5C2C2; }
.ebr-status.s-skipped, .ebr-status.s-notstarted, .ebr-status.s-na { background: var(--bg); color: var(--muted); border-color: var(--line); }
.mbr .ebr-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 8px 12px; margin: 8px 0 4px; background: #F2FAF9; border: 1px solid var(--teal-mid); border-radius: var(--radius); font-size: 12px; }
.mbr .ebr-bar strong { color: var(--teal-dark); }
.mbr tr.ebr-fail td { background: #FFF5F5; }
.mbr tr.ebr-fail td:first-child { border-left: 3px solid var(--err); }
.mbr .rec { font-family: var(--mono); font-size: 12px; }
.mbr .rec strong { font-size: 13px; }
.mbr .who { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.mbr .dev { padding: 6px 10px; border-left: 3px solid var(--err); background: #FFF5F5; margin: 4px 0; border-radius: 0 4px 4px 0; font-size: 12px; }
.mbr .sign.filled div { border-top-color: var(--teal); }
.mbr .sign .name { font-size: 13px; color: var(--ink); font-weight: 600; display: block; }
.no-print .file-btn { display: inline-flex; }

/* ==== high-contrast theme (overrides app.css tokens and the rules that matter for legibility) ==== */
/* the design tokens live in app.css (single source: light and dark theme); the earlier override block was removed in R1.3 */
html, body { font-size: 14px; }
a { color: var(--teal-dark); text-decoration-thickness: 1px; }
.muted { color: var(--muted); }
label { color: var(--ink-2); font-weight: 500; }
input, select, textarea { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal-dark); }
input::placeholder, textarea::placeholder { color: #6B7680; opacity: 1; }
.btn { border-color: var(--muted); color: var(--ink); font-weight: 600; }
.btn:hover { border-color: var(--teal-dark); color: var(--teal-dark); background: var(--teal-light); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
.btn.primary { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.primary:hover { background: #003A35; }
.btn.danger { color: var(--err); } .btn.danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn:disabled { opacity: .45; }
.chip { border-color: var(--muted); color: var(--ink-2); }
.tag { border-color: var(--muted); color: var(--ink-2); background: var(--card); }
.tag.ref { color: var(--teal-dark); border-color: var(--teal); background: var(--teal-light); }
.badge.ok { background: var(--ok); color: var(--on-brand); }
.status-draft { background: #E3E7F7; color: #283593; border-color: #8C97D8; }
.status-inreview { background: #FFF0CC; color: #6B4400; border-color: #D9A648; }
.status-approved { background: #DCEFDD; color: #1B5E20; border-color: #7FBF84; }
.status-effective { background: #D9EDEA; color: #004A44; border-color: #5FA9A1; }
.status-superseded { background: #E1E6EA; color: var(--ink); border-color: #90A4AE; }
.table th { color: var(--ink); background: var(--surface-3); border-bottom: 2px solid var(--line); }
.table th, .table td { border-bottom-color: var(--line); }
.grid th { color: var(--ink); background: var(--surface-3); border-color: var(--line-strong); }
.grid td { border-color: var(--line); }
.grid .rownum { color: var(--ink-2); background: var(--surface-3); }
.topbar { border-bottom: 3px solid var(--teal-dark); }
.topnav a { color: var(--ink-2); font-weight: 600; }
.topnav a.active { color: var(--on-brand); background: var(--teal-dark); }
.brand-release { color: var(--on-brand); background: var(--teal-dark); }
.group-bar .group { border-color: var(--muted); color: var(--ink-2); }
.tab { color: var(--ink-2); } .tab.active { color: var(--teal-dark); border-bottom-width: 3px; }
.issue-list li { border-left-width: 4px; }
.mbr .ph { color: #7A4E00; background: #FFF0CC; border: 1px solid #D9A648; }
.mbr h2 { color: var(--teal-dark); border-bottom-color: var(--line-strong); }
.mbr table.doc th { color: var(--ink); background: var(--surface-3); }
.mbr table.doc td, .mbr table.doc th { border-color: var(--line); }
.mbr .op { border-color: var(--line-strong); }
.mbr .acts li { border-top-color: var(--line); }
.doc-body pre { background: #0F1419; color: #F1F5F8; }
.home-card { border-color: var(--line-strong); }
.wf-op { border-color: var(--line-strong); border-left-color: var(--teal-dark); }
.wf-step { border-color: var(--line-strong); }
.wf-act { background: var(--surface-2); border-color: var(--line); }
.wf-palette, .wf-inspector, .wf-status, .wf-filter { border-color: var(--line-strong); }
.wf-pal { border-color: var(--line-strong); background: var(--surface-2); }

/* ==== navigation (rebuilt): grouped links with icons, labels drop at medium width, menu button on small screens ==== */
.topbar { position: relative; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 52px; min-height: 52px; }
.brand { flex: none; gap: 8px; }
.brand-name { white-space: nowrap; font-size: 14px; }
.brand-release { white-space: nowrap; }
.nav-toggle { display: none; margin-left: auto; width: 34px; height: 34px; }
.topnav { display: flex; align-items: center; gap: 0; flex: 1; min-width: 0; }
.nav-group { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-left: 1px solid var(--line); }
.nav-group:first-child { border-left: 0; padding-left: 0; }
.nav-group-label { display: none; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: var(--radius); color: var(--ink-2); font-weight: 600; white-space: nowrap; line-height: 1.2; }
.topnav a .ico { flex: none; }
.topnav a:hover { background: var(--bg); color: var(--teal-dark); text-decoration: none; }
.topnav a.active { color: var(--on-brand); background: var(--teal-dark); }
.nav-author { margin-left: auto; border-left: 0; padding-right: 0; gap: 10px; }
.nav-author .author { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }
.nav-author .author input { width: 120px; padding: 4px 8px; }
.nav-author .db-indicator { gap: 6px; white-space: nowrap; }
@media (max-width: 1350px) {
  .topnav a .nav-label { display: none; }
  .topnav a { padding: 7px 8px; }
  .nav-author .author .nav-label, .nav-author .db-indicator .nav-label { display: none; }
  .nav-author .author input { width: 110px; }
}
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .nav-toggle { display: inline-flex; }
  .topnav { display: none; position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--card); border-bottom: 3px solid var(--teal-dark); padding: 6px 12px 12px; box-shadow: 0 10px 24px rgba(15,20,25,.18); max-height: calc(100vh - 52px); overflow: auto; }
  .topnav.open { display: flex; }
  .nav-group { flex-direction: column; align-items: stretch; border-left: 0; padding: 4px 0; border-top: 1px solid var(--line); }
  .nav-group:first-child { border-top: 0; }
  .nav-group-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 2px; }
  .topnav a { padding: 9px 10px; }
  .topnav a .nav-label { display: inline; }
  .nav-author { margin-left: 0; flex-direction: row; flex-wrap: wrap; gap: 12px; padding-top: 10px; }
  .nav-author .author .nav-label, .nav-author .db-indicator .nav-label { display: inline; }
  .nav-author .author input { width: 160px; }
}

/* ==== navigation fit: app.js measures the bar and steps down when the labels (longer in some languages) do not fit ====
   fit-1: page links show icons only · fit-2: Author / Language / File DB labels hidden too · fit-menu: the small-screen menu */
.topbar.fit-1 .topnav a .nav-label, .topbar.fit-2 .topnav a .nav-label { display: none; }
.topbar.fit-1 .topnav a, .topbar.fit-2 .topnav a { padding: 7px 8px; }
.topbar.fit-2 .nav-author .author .nav-label, .topbar.fit-2 .nav-author .db-indicator .nav-label, .topbar.fit-2 .nav-author .lang-pick .nav-label { display: none; }
.topbar.fit-2 .nav-author .author input { width: 100px; }
.topbar.fit-2 .nav-author .lang-pick select { max-width: 110px; }
.topbar.fit-menu { gap: 8px; padding: 0 12px; }
.topbar.fit-menu .nav-toggle { display: inline-flex; }
.topbar.fit-menu .topnav { display: none; position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--card); border-bottom: 3px solid var(--teal-dark); padding: 6px 12px 12px; box-shadow: 0 10px 24px rgba(15,20,25,.18); max-height: calc(100vh - 52px); overflow: auto; }
.topbar.fit-menu .topnav.open { display: flex; }
.topbar.fit-menu .nav-group { flex-direction: column; align-items: stretch; border-left: 0; padding: 4px 0; border-top: 1px solid var(--line); }
.topbar.fit-menu .nav-group:first-child { border-top: 0; }
.topbar.fit-menu .nav-group-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 2px; }
.topbar.fit-menu .topnav a { padding: 9px 10px; }
.topbar.fit-menu .topnav a .nav-label { display: inline; }
.topbar.fit-menu .nav-author { margin-left: 0; flex-direction: row; flex-wrap: wrap; gap: 12px; padding-top: 10px; }
.topbar.fit-menu .nav-author .author .nav-label, .topbar.fit-menu .nav-author .db-indicator .nav-label, .topbar.fit-menu .nav-author .lang-pick .nav-label { display: inline; }
.topbar.fit-menu .nav-author .author input { width: 160px; }
.topbar.fit-menu .nav-author .lang-pick select { max-width: 200px; }

/* ==== layout clean-up and responsive rules ==== */
/* clip, not hidden: overflow-x:hidden turns <body> into its own scroll container, which makes the browser print only the visible window */
html, body { overflow-x: clip; }
.content { padding: 18px 22px 40px; max-width: none; }   /* full screen width; individual documents keep their own reading width */
.mbr { max-width: none; }
.doc-body { max-width: 1100px; }

/* ==== S88 procedural view ==== */
.s88-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.s88-head .card { margin: 0; }
.s88-head h4, .s88-head .h4 { margin: 0 0 6px; }
.s88-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.s88-legend b { color: var(--teal-dark); }
.s88-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.s88 { position: relative; padding: 10px 260px 24px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.s88-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.s88-proc { display: inline-block; padding: 8px 14px; border: 2px solid var(--teal-dark); border-radius: var(--radius); background: var(--teal-light); font-weight: 700; margin-bottom: 6px; }
.s88-proc .lvl, .s88-up .lvl, .s88-op .lvl, .s88-ph .lvl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; }
.s88-arrow { width: 2px; height: 18px; background: var(--ink-2); margin: 0 0 0 40px; position: relative; }
.s88-arrow::after { content: ""; position: absolute; left: -4px; bottom: -2px; border: 5px solid transparent; border-top: 7px solid var(--ink-2); }
.s88-up { border: 2px solid var(--teal); border-radius: var(--radius); background: var(--card); padding: 8px 12px 10px; max-width: 1000px; }
.s88-up-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.s88-up-head .id { font-family: var(--mono); font-weight: 700; color: var(--teal-dark); }
.s88-up-head .unit { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.s88-op { border: 1px solid #F3D9A4; border-left: 4px solid #F9A825; background: #FFFDF7; border-radius: var(--radius); padding: 6px 10px 8px; margin: 8px 0 0 18px; }
.s88-op-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.s88-op-head .id { font-family: var(--mono); font-weight: 700; color: #8A5A00; }
.s88-ph { border: 1px solid var(--line); border-left: 4px solid #90A4AE; background: var(--card); border-radius: var(--radius); padding: 5px 10px; margin: 6px 0 0 18px; }
.s88-ph.st-automatic { border-left-color: var(--teal); } .s88-ph.st-verification { border-left-color: #3949AB; } .s88-ph.st-dispense { border-left-color: #F9A825; }
.s88-ph.st-sampling { border-left-color: #23408F; } .s88-ph.st-setup { border-left-color: #C79A00; } .s88-ph.st-cleaning { border-left-color: #0288D1; }
.s88-ph.st-inspection { border-left-color: #8E24AA; } .s88-ph.st-hold { border-left-color: #D84315; } .s88-ph.st-transfer { border-left-color: #2E7D32; } .s88-ph.st-review { border-left-color: #546E7A; }
.s88-ph-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.s88-ph-head .id { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.s88-actions { margin: 4px 0 0 4px; padding-left: 18px; font-size: 12px; }
.s88-actions li { margin: 2px 0; }
.s88-actions .id { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.s88 .chips-inline { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.s88 .st, .s88 .at { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; }
.s88 .st-manual { background: var(--surface-3); color: #455A64; border-color: #CFD8DC; } .s88 .st-automatic { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.s88 .st-verification { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; } .s88 .st-dispense { background: #FFF4DF; color: #8A5A00; border-color: #F3D9A4; } .s88 .st-sampling { background: #E0F2F1; color: #23408F; border-color: #B2DFDB; }
.s88 .st-setup { background: #FFF8E1; color: #6D4C00; } .s88 .st-cleaning { background: #E1F5FE; color: #01579B; } .s88 .st-inspection { background: #F3E5F5; color: #6A1B9A; } .s88 .st-hold { background: #FBE9E7; color: #A2330A; } .s88 .st-transfer { background: #E8F5E9; color: #1B5E20; } .s88 .st-review { background: #E1E6EA; color: var(--ink); }
.s88 .at { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.s88 .tr-note { font-size: 12px; color: #4527A0; margin-left: 6px; }
.s88 .ipc-tag, .s88-legend .ipc-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 3px; background: var(--teal); color: var(--on-brand); }
.s88-row { display: flex; align-items: flex-start; gap: 12px; }
.s88-row .s88-line { flex: 1 1 auto; min-width: 0; }
.s88-row .s88-marks { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px; margin-left: auto; padding-left: 8px; white-space: nowrap; }
/* step badges shared by the process view, the preview and their legends: CPP / CQA from the exceptions report, Verify from the execution rules */
.mark { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 3px; border: 1px solid transparent; letter-spacing: .04em; line-height: 16px; white-space: nowrap; }
.mark-cpp { background: #4527A0; color: var(--on-brand); }
.mark-cqa { background: var(--teal-dark); color: var(--on-brand); }
.mark-verify { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; }
.mbr .instr-row { display: flex; align-items: flex-start; gap: 12px; }
.mbr .instr-row .instruction { flex: 1 1 auto; min-width: 0; }
.mbr .step-marks { flex: 0 1 auto; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-left: auto; max-width: 55%; }
.mbr .step-marks:empty { display: none; }
.mbr .legend .mark { vertical-align: middle; }
@media print { .mark { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* ---- Designer: selection bar, multi-selection, compare colours, badges, outline, quality palette, coverage, touch ---- */
.wf-selbar, .wf-compare-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--teal-light); border: 1px solid var(--teal-mid); font-size: 12px; }
.wf-compare-bar { background: var(--bg); border-color: var(--line-strong, var(--line)); }
.wf .wf-op.multi, .wf .wf-phase.multi, .wf .wf-step.multi { outline: 2px dashed var(--teal-dark); outline-offset: 1px; }
.wf .diff-added { box-shadow: inset 4px 0 0 #2E7D32; } .wf .wf-step.diff-added { border-left-color: #2E7D32; background: #F1F8E9; }
.wf .diff-changed { box-shadow: inset 4px 0 0 #F9A825; } .wf .wf-step.diff-changed { border-left-color: #F9A825; background: #FFFDE7; }
.chip.diff-added { background: #E8F5E9; color: #1B5E20; border-color: #A5D6A7; } .chip.diff-changed { background: #FFF8E1; color: #7A4F00; border-color: #FFE082; } .chip.diff-removed { background: var(--err-bg); color: var(--err); border-color: #F0A28E; }
.wf .wf-marks { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding-left: 6px; }
.wf .wf-step-head .spacer { flex: 0 0 0; }
.wf .tag.opt { color: var(--muted); border-style: dashed; font-weight: 500; }
.wf .badge.design, .wf .badge.gaps, .wf .badge.note { cursor: pointer; border: 1px solid transparent; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px; }
.wf .badge.design.sev-critical { background: var(--err-bg); color: var(--err); border-color: #F0A28E; }
.wf .badge.design.sev-major { background: #FFF3E0; color: #A2330A; border-color: #FFCC80; }
.wf .badge.design.sev-minor { background: #FFF8E1; color: #7A4F00; border-color: #FFE082; }
.wf .badge.design.sev-info { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.wf .badge.gaps { background: #EDE7F6; color: #4527A0; border-color: #B39DDB; }
.wf .badge.note { background: #FFFDE7; color: #5D4037; border-color: #FFE082; }
.wf .inherited { opacity: .45; filter: grayscale(.6); }
.wf .wf-step.live { outline: 2px dashed var(--teal); outline-offset: 2px; } .wf .wf-step.over { background: var(--teal-light); }
.wf .mat-row[draggable="true"] { cursor: grab; }
.wf-pal.kind-spec { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; } .wf-pal.kind-spec > .muted, .wf-pal.kind-spec > .ol-links { grid-column: 2; }
.wf-pal.kind-spec.unused { border-left: 3px solid #F9A825; }
.ol-links { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-outline, .wf-outline ul { list-style: none; margin: 0; padding: 0; }
.wf-outline ul { padding-left: 12px; border-left: 1px solid var(--line); margin-left: 6px; }
.wf-outline li { margin: 1px 0; }
.wf-outline .ol-btn { display: flex; gap: 6px; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; padding: 3px 6px; border-radius: 6px; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
.wf-outline .ol-btn:hover { background: var(--bg); } .wf-outline li.sel > .ol-btn { background: var(--teal-light); box-shadow: inset 0 0 0 1px var(--teal-mid); }
.wf-outline .ol-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
.wf-outline .ol-btn > span:not(.ol-text) { white-space: nowrap; flex: none; }
.wf-outline .ol-btn .at { font-size: 11px; padding: 0 5px; }
.wf-outline .ol-op > .ol-btn { font-weight: 600; } .wf-outline .ol-step .seq { font-family: var(--mono); color: var(--muted); }
.wf-outline li[draggable="true"] > .ol-btn { cursor: grab; }
.coverage { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.coverage li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; }
.coverage li.ok { border-color: #A5D6A7; } .coverage li.gap { border-color: #FFCC80; background: #FFF8F0; }
.coverage .cov-mark { font-weight: 700; } .coverage li.ok .cov-mark { color: #2E7D32; } .coverage li.gap .cov-mark { color: #A2330A; }
.insp-review-list.notes li { display: flex; gap: 8px; align-items: baseline; }
.paste-preview { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.site-ents summary { cursor: pointer; margin: 6px 0; }
.wf .touch-dragging { opacity: .6; transform: scale(.98); }
@media (max-width: 900px) {
  .wf { grid-template-columns: 1fr; }
  .wf-palette { order: 1; } .wf-canvas { order: 2; }
  .wf-inspector { order: 3; position: fixed; left: 0; right: 0; bottom: 0; max-height: 55vh; overflow: auto; background: var(--card); border-top: 2px solid var(--teal); border-radius: 12px 12px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,.18); padding: 8px 12px 16px; z-index: 30; }
  .wf-inspector::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong, var(--line)); margin: 0 auto 8px; }
  .wf-gutter { display: none; }
  .wf-canvas { padding-bottom: 50vh; }
  .wf .wf-zone.live { min-height: 28px; }
  .wf .drag-handle { font-size: 18px; padding: 4px; }
}
@media print { .wf-palette, .wf-inspector, .wf-gutter, .wf-selbar, .wf-compare-bar, .wf-filter, .wf-zone { display: none !important; } .wf { display: block; } .wf-canvas { padding: 0; } }

/* ================================================================ execution cockpit (focus layout, Docs/execution-ui-plan.md) */
.ex2 { display: flex; flex-direction: column; gap: 10px; }
.ex2-status { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ex2-id { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ex2-id strong { font-size: 16px; }
.ex2-back { display: inline-flex; padding: 4px; border-radius: 6px; color: var(--ink-2); } .ex2-back:hover { background: var(--bg); }
.ex2-mid { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; }
.ex2-mid .ex-bar { width: 140px; }
.ex2-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip.gate { background: var(--warn-bg); color: var(--warn); border-color: #F0C36D; cursor: pointer; font-weight: 700; }
.ex2-presence { display: inline-flex; gap: 2px; align-items: center; margin-left: 4px; }
.ex2-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--teal-light); color: var(--teal-dark); border: 2px solid var(--card); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: -6px; }
.ex2-avatar.busy { background: #FFF3E0; color: #A2330A; } .ex2-avatar.me { background: var(--teal-dark); color: var(--on-brand); }
/* a confirmation is a corner toast (app.css); only an error stays pinned under the status bar */
.ex2-toast.err { position: sticky; top: 58px; z-index: 19; }
.ex2-hold { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: #FFF3E0; border: 1px solid #FFCC80; color: #7A3E00; }
.ex2-handover { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: start; padding: 10px 14px; border-radius: var(--radius); background: #FFFDE7; border: 1px solid #FFE082; }
.ex2-handover > div { grid-column: 1 / -1; white-space: pre-wrap; }
.ex2-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.ex2-grid.rail-closed { grid-template-columns: 64px minmax(0, 1fr) 330px; }
.ex2-rail { position: sticky; top: 66px; max-height: calc(100vh - 80px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.ex2-rail-toggle { float: right; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px; }
.ex2-op { display: flex; gap: 8px; align-items: center; padding: 6px 4px; margin-top: 6px; }
.ex2-op-text { min-width: 0; font-size: 12px; } .ex2-op-text strong { display: block; }
.ex2-op-flags { display: flex; gap: 4px; margin-top: 2px; }
.ex2-ring { --pct: 0; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: conic-gradient(var(--teal) calc(var(--pct) * 1%), var(--line) 0); display: grid; place-items: center; padding: 0; }
.ex2-ring span { width: 32px; height: 32px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-2); }
.ex2-op.done .ex2-ring { background: var(--ok); } .ex2-op.current .ex2-ring span { color: var(--teal-dark); box-shadow: inset 0 0 0 2px var(--teal-light); }
.rail-closed .ex2-op-text, .rail-closed .ex2-grp { display: none; }
.ex2-grp { display: grid; grid-template-columns: 1fr auto; gap: 1px 6px; width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 4px 6px 4px 10px; margin-left: 20px; width: calc(100% - 20px); border-radius: 0 6px 6px 0; cursor: pointer; font: inherit; font-size: 12px; color: var(--ink); }
.ex2-grp:hover { background: var(--bg); } .ex2-grp.current { border-left-color: var(--teal); font-weight: 600; } .ex2-grp.focus { background: var(--teal-light); } .ex2-grp.done { color: var(--ink-2); }
.ex2-grp-name { font-family: var(--mono); font-size: 11px; }
.ex2-grp-desc { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex2-grp-bar { grid-column: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 2px; } .ex2-grp-bar > span { display: block; height: 100%; background: var(--teal); }
.ex2-grp .ex-count { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.ex2-focus { display: flex; flex-direction: column; gap: 10px; outline: none; min-width: 0; }
.ex2-peek { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; text-align: left; width: 100%; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; font: inherit; color: var(--ink-2); }
.ex2-peek:hover { background: var(--card); } .ex2-peek-text { flex: 1 1 200px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex2-peek.next { opacity: .8; } .ex2-peek-val { margin-left: auto; }
.ex2-card { border-left: 6px solid var(--line); padding: 16px 20px; }
.ex2-card.current { border-left-color: var(--teal); box-shadow: 0 4px 18px rgba(53, 87, 199, .14); }
.ex2-card.closed { border-left-color: var(--ok); } .ex2-card.locked { opacity: .85; }
.ex2-card.judge-tol.current { border-left-color: #FB8C00; } .ex2-card.judge-oos.current { border-left-color: var(--err); }
.ex2-card-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ex2-signs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.ex2-instr { font-size: 20px; font-weight: 600; line-height: 1.35; margin: 8px 0 6px; }
/* cockpit: short title above the wording, results per characteristic, choices, certification */
.ex2-title { font-size: 22px; font-weight: 700; line-height: 1.25; margin: 8px 0 2px; }
.ex2-instr.with-title { font-size: 16px; font-weight: 500; margin-top: 2px; }
html.ex-large .ex2 .ex2-title { font-size: 28px; } html.ex-large .ex2 .ex2-instr.with-title { font-size: 20px; }
.ex2-results { display: grid; gap: 8px; margin: 8px 0; }
.ex2-result { border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--card); }
.ex2-result.ok { border-left-color: var(--ok); } .ex2-result.oos { border-left-color: var(--err); background: color-mix(in srgb, var(--err) 6%, var(--card)); }
.ex2-result-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ex2-result-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 2px; }
.ex2-result-in .ex2-num { max-width: 220px; }
.ex2-restable { margin: 6px 0; } .ex2-restable tr.fail td { color: var(--err); font-weight: 600; }
.ex2-choices { display: grid; gap: 8px; margin: 10px 0; }
.ex2-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
.ex2-choice.note { border-style: solid; background: color-mix(in srgb, var(--accent, #2f5fb3) 6%, var(--card)); margin: 0; }
.ex2-choice-label { font-weight: 600; flex: 1 1 220px; }
.ex2-choice input { flex: 1 1 180px; min-height: 40px; }
.ex2-choice.sign label { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; font-size: 13px; }
.ex2-answers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag.cert.held { border-color: var(--ok); color: var(--ok); }
.ex2-cert-missing { font-weight: 600; }
.ex2-limits { font-size: 14px; color: var(--ink-2); margin: 0 0 8px; }
.ex2-docs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; } .ex2-thumb img { max-height: 120px; max-width: 200px; border-radius: 6px; border: 1px solid var(--line); }
.ex2-entry { margin: 8px 0; padding: 8px 12px; background: var(--bg); border-radius: 8px; border-left: 4px solid var(--ok); }
.ex2-entry.tol { border-left-color: #FB8C00; } .ex2-entry.fail { border-left-color: var(--err); }
.ex2-value { font-size: 18px; }
.ex2-gate { margin: 10px 0; padding: 10px 14px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); border: 1px solid #F0C36D; display: grid; gap: 8px; }
.ex2-gate-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ex2-control { margin-top: 10px; display: grid; gap: 10px; }
.ex2-numeric { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex2-num { font-size: 28px; font-weight: 600; width: 200px; padding: 8px 12px; text-align: right; font-variant-numeric: tabular-nums; }
.ex2-uom { font-size: 18px; color: var(--ink-2); }
.ex2-judge { font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 10px; }
.ex2-judge.ok { background: #E8F5E9; color: #1B5E20; } .ex2-judge.tol { background: #FFF3E0; color: #A2330A; } .ex2-judge.oos { background: var(--err-bg); color: var(--err); }
.ex2-gauge { max-width: 560px; margin: 2px 0 6px; }
.ex2-gauge-track { position: relative; height: 18px; border-radius: 9px; background: var(--line); overflow: visible; }
.ex2-gauge-track .band { position: absolute; top: 0; bottom: 0; } .ex2-gauge-track .band.spec { background: #C8E6C9; border-radius: 9px; } .ex2-gauge-track .band.tol { background: #81C784; }
.ex2-gauge-track .mark-target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.ex2-gauge-track .needle { position: absolute; top: -6px; width: 6px; height: 30px; border-radius: 3px; transform: translateX(-3px); background: var(--teal-dark); box-shadow: 0 0 0 2px var(--card); transition: left .15s ease; }
.ex2-gauge-track .needle.tol { background: #FB8C00; } .ex2-gauge-track .needle.oos { background: var(--err); }
.ex2-gauge-labels { position: relative; height: 16px; font-size: 11px; color: var(--ink-2); } .ex2-gauge-labels span { position: absolute; transform: translateX(-50%); } .ex2-gauge-labels span.t { font-weight: 700; color: var(--ink); }
.ex2-timer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ex2-clock { font-family: var(--mono); font-size: 32px; font-weight: 700; min-width: 120px; } .ex2-clock.running { color: var(--teal-dark); }
.ex2-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .ex2-checklist li label { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; }
.ex2-checklist input { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.ex2-scan { display: flex; align-items: center; gap: 8px; } .ex2-scan-input { font-family: var(--mono); font-size: 20px; flex: 1 1 auto; padding: 8px 12px; }
.ex2-attach { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ex2-equipment { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ex2-eq { border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px; padding: 8px 10px; } .ex2-eq.ready { border-left-color: var(--ok); } .ex2-eq.blocked { border-left-color: var(--err); background: #FFF8F8; }
.ex2-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.ex2-meaning { font-size: 13px; color: var(--ink-2); margin: 0; }
.ex2-extra { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ex2-extra label { font-size: 12px; font-weight: 600; display: grid; gap: 3px; }
.ex2-reason.tol input { border-color: #FB8C00; } .ex2-reason.oos input { border-color: var(--err); }
.ex2-inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ex2-hint { margin: 0; }
.ex2-drawer { position: sticky; top: 66px; max-height: calc(100vh - 80px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.ex2-drawer-tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.ex2-drawer-tabs button { flex: 1 1 auto; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.ex2-drawer-tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); } .ex2-drawer-tabs .cnt { margin-left: 4px; font-size: 11px; background: var(--bg); border-radius: 8px; padding: 0 5px; }
.ex2-drawer-body { padding: 10px 12px 14px; } .ex2-drawer-body h4, .ex2-drawer-body .h4 { margin: 10px 0 4px; font-size: 12px; }
.ex2-eqlist li { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ex2-dev { border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 12px; }
.ex2-dev.sev-critical { border-left-color: var(--err); } .ex2-dev.sev-major { border-left-color: #FB8C00; } .ex2-dev.sev-minor { border-left-color: #90A4AE; } .ex2-dev.st-closed { opacity: .8; }
.ex2-dev-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ex2-timeline { list-style: none; margin: 6px 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); display: grid; gap: 6px; } .ex2-timeline li { position: relative; padding-left: 8px; } .ex2-timeline li::before { content: ""; position: absolute; left: -15px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.ex2-timeline .when { display: block; font-size: 11px; color: var(--muted); }
.ex2-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .ex2-notes li { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; } .ex2-notes li.handover { background: #FFFDE7; border-color: #FFE082; }
.ex2-rules li { margin-bottom: 3px; }
.ex2-actions { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--card); border-top: 2px solid var(--teal); box-shadow: 0 -4px 14px rgba(0,0,0,.08); margin-top: 4px; border-radius: var(--radius) var(--radius) 0 0; }
.ex2 .btn.link, .ex2 button.link { background: none; border: 0; padding: 0; color: var(--teal-dark); cursor: pointer; font: inherit; text-decoration: underline; }
.ex2 .center { text-align: center; }
.ex-full.ex2 .ex2-status { top: 0; }
html.ex-large .ex2 .ex2-instr { font-size: 26px; } html.ex-large .ex2 .ex2-num { font-size: 34px; } html.ex-large .ex2 .btn.big { font-size: 18px; padding: 14px 24px; } html.ex-large .ex2 .ex2-checklist li label { font-size: 17px; }
@media (max-width: 1100px) { .ex2-grid { grid-template-columns: 64px minmax(0, 1fr); } .ex2-grid .ex2-op-text, .ex2-grid .ex2-grp { display: none; } .ex2-drawer { position: fixed; right: 0; left: auto; top: auto; bottom: 0; width: min(420px, 100%); max-height: 60vh; border-radius: 12px 0 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.18); z-index: 30; transform: translateY(calc(100% - 38px)); transition: transform .2s ease; } .ex2-drawer.open { transform: none; } .ex2-focus { padding-bottom: 60px; } }
@media (max-width: 700px) { .ex2-grid { grid-template-columns: minmax(0, 1fr); } .ex2-rail { display: none; } .ex2-num { width: 150px; font-size: 24px; } .ex2-drawer { width: 100%; } .ex2-status .ex2-rec { display: none; } }
@media (pointer: coarse) { .ex2 .btn { min-height: 44px; } .ex2 input, .ex2 select { min-height: 44px; } .ex2-checklist li label { min-height: 48px; } }
@media print { .ex2-status, .ex2-rail, .ex2-drawer, .ex2-actions, .ex2-control, .ex2-peek { display: none !important; } .ex2-grid { display: block; } }

/* ---- verification queue, supervisor board, batch story ---- */
.vq-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid #FB8C00; border-radius: var(--radius); background: var(--card); margin-bottom: 8px; }
.vq-row.old { border-left-color: var(--err); } .vq-row.refused { border-left-color: #90A4AE; }
.vq-value { font-size: 18px; font-weight: 600; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.board-card { border-left: 6px solid var(--teal); display: grid; gap: 6px; }
.board-card.held { border-left-color: #FB8C00; } .board-card.gated { border-left-color: var(--warn); } .board-card.planned { border-left-color: var(--line); }
.board-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .board-head strong { font-size: 16px; }
.board-now { font-size: 13px; } .board-now .muted { display: block; font-size: 11px; }
.board-stats { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.board-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.story { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.story-ops { display: grid; gap: 10px; }
.story-op { border-left: 5px solid var(--teal-mid); padding-left: 12px; }
.story-op h3 { margin: 0 0 4px; font-size: 15px; }
.story-line { display: grid; grid-template-columns: 56px 110px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px dashed var(--line); font-size: 12px; }
.story-line .t { font-family: var(--mono); color: var(--muted); font-size: 11px; } .story-line .k { font-family: var(--mono); font-size: 11px; }
.story-line.fail { background: #FFF5F5; } .story-line.tol { background: #FFF8F0; } .story-line.dev { background: #FFF3E0; } .story-line.hold { background: #FFFDE7; } .story-line.sig { background: #EDE7F6; } .story-line.corr { background: var(--bg); }
.story-flag { font-weight: 700; margin-right: 4px; }
@media (max-width: 900px) { .story { grid-template-columns: 1fr; } .vq-row { grid-template-columns: 1fr; } }

/* ---- Page layout: the document shown on screen at the printed page width (A4 portrait, 12 mm margins = 186 mm), as Print / PDF renders it.
   app.js adds html.print-layout and mirrors the @media print rules for the document; this block holds the screen-only part. ---- */
html.print-layout .pl-doc { width: 186mm; max-width: 186mm; margin-left: 0; margin-right: auto; box-sizing: border-box; }
html.print-layout .pl-doc::before { content: "Page layout — A4 portrait, printable width 186 mm, as Print / PDF renders it"; display: block; font-size: 11px; color: var(--ink-2); background: var(--bg); border: 1px dashed var(--line-strong, var(--line)); border-radius: 6px; padding: 4px 10px; margin: 0 0 10px; }
html.print-layout .pl-doc .no-print { display: none !important; }
html.print-layout .s88 { padding-right: 10px; }
html.print-layout .btn[data-ui-action=printlayout] { background: var(--teal-dark); color: var(--on-brand); border-color: var(--teal-dark); }
@media print { html.print-layout .pl-doc::before { display: none; } html.print-layout .pl-doc { width: auto; max-width: none; } }
.s88-legend .mark, .s88-legend .ipc-tag, .s88-legend .sig-chip { margin-right: 4px; vertical-align: middle; }
@media (max-width: 760px) { .s88-row { flex-wrap: wrap; } .s88-row .s88-marks { margin-left: 0; padding-left: 0; } }
@media (max-width: 1100px) { .s88-head { grid-template-columns: 1fr 1fr; } .s88 { padding-right: 160px; } }
@media (max-width: 760px) { .s88-head { grid-template-columns: 1fr; } .s88 { padding-right: 90px; } .s88-op, .s88-ph { margin-left: 8px; } }
@media print { .s88 { border: 0; overflow: visible; } }
/* grid and flex children must be allowed to shrink below their content width, otherwise a long id or a wide control
   forces the whole column (and the page) wider than the viewport */
.wf > *, .editor > *, .form-view > *, .flat-editor > *, .doc-page > *, .home-hero > *, .page-head > *, .payload-grid > *, .wf-pal > *, .wf-tpl-tools > * { min-width: 0; }
.wf-palette, .wf-inspector, .wf-canvas, .editor-side, .editor-main, .doc-body { min-width: 0; overflow-wrap: anywhere; }
.wf-pal .muted { flex: 0 1 auto; }
.page-head { flex-wrap: wrap; align-items: flex-start; gap: 10px 20px; margin-bottom: 14px; }
.page-head > div:first-child { flex: 1 1 360px; min-width: 0; }
.page-head > div:first-child p { max-width: 900px; }
.page-head .actions { flex: 0 1 auto; justify-content: flex-end; }
.actions > select { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
.table-wrap > .table { min-width: 720px; }
.grid-toolbar .search, .filters .search, .wf-filter .search { max-width: 100%; }
.card { min-width: 0; }
.chips { row-gap: 6px; }
@media (max-width: 1100px) {
  .content { padding: 14px 16px 32px; }
  .mbr-kv { grid-template-columns: 1fr 1fr; }
  .mbr-kv .span-4 { grid-column: span 2; }
  .grid-3 { grid-template-columns: 1fr 1fr; } .span-3 { grid-column: span 2; }
  .home-grid, .home-grid.docs { grid-template-columns: 1fr 1fr; }
  .flat-editor, .editor, .form-view, .doc { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .content { padding: 10px 10px 28px; }
  h1 { font-size: 18px; }
  .page-head { flex-direction: column; gap: 8px; }
  .page-head > div:first-child { flex: 0 0 auto; }
  .page-head .actions { width: 100%; justify-content: flex-start; }
  .actions .btn { flex: 0 1 auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; } .span-2, .span-3 { grid-column: auto; }
  .home-hero { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 20px; }
  .home-grid, .home-grid.docs { grid-template-columns: 1fr; }
  .home-card { min-height: 0; }
  .filter-row { gap: 6px; }
  .status-filter { border-right: 0; padding-right: 0; flex-wrap: wrap; width: 100%; }
  .filter-row select { flex: 1 1 45%; min-width: 0; }
  .table-wrap > .table { min-width: 640px; }
  .library .row-actions { white-space: normal; }
  .modal { padding: 14px 14px; width: 100%; max-width: 100%; border-radius: 0; max-height: 100vh; overflow: auto; }
  .modal.wide { width: 100%; }
  .modal .radio input:not([type]) { width: 70px; }
  .compare-pick { flex-direction: column; align-items: stretch; } .compare-pick label { min-width: 0; } .compare-pick .arrow { display: none; }
  .steps { flex-wrap: wrap; } .steps li { flex: 1 1 45%; }
  .mbr { padding: 12px 10px; overflow-x: auto; }
  .mbr-title { flex-direction: column; } .mbr-integrity { text-align: left; white-space: normal; }
  .mbr-kv { grid-template-columns: 1fr; } .mbr-kv .span-2, .mbr-kv .span-4 { grid-column: auto; }
  .mbr .flow-op { min-width: 0; flex: 1 1 45%; max-width: none; }
  .mbr .sign { grid-template-columns: 1fr; gap: 20px; }
  .mbr .steps-doc td:last-child { width: auto; }
  .mbr .steps-doc td:nth-child(3) { min-width: 0; }
  .doc-body { padding: 16px 14px; }
  .wf { grid-template-columns: 1fr; }
  .wf-palette, .wf-inspector { position: static; max-height: none; }
  .wf-filter .search { width: 100%; }
  .wf-op-body { padding: 0 6px 6px 8px; }
  .wf-acts { padding-left: 12px; }
  .wf-op-head, .wf-phase-head, .wf-step-head { gap: 5px; }
  .wf-status { font-size: 12px; }
  .grid-toolbar { flex-wrap: wrap; } .grid-toolbar .search { width: 100%; }
  .table-meta { flex-wrap: wrap; }
  .group-bar { flex-wrap: wrap; } .group-bar .group { padding: 6px 10px; }
  .find-row label { min-width: 0; flex: 1 1 45%; }
  .payload-grid { grid-template-columns: 1fr; } .payload-grid .span-2 { grid-column: auto; }
}
@media (max-width: 480px) {
  .brand-release { display: none; }
  .mbr .flow-op { flex-basis: 100%; }
  .steps li { flex-basis: 100%; }
  .filter-row select { flex-basis: 100%; }
}

/* ---- hazards / PPE / equipment chips (builder cards, preview) and inspector checklists ---- */
.hz-chip, .ppe-chip, .eq-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.hz-chip { background: #FBE9E7; color: #A2330A; border-color: #F0A28E; }
.ppe-chip { background: #E3F2FD; color: #0D47A1; border-color: #90CAF9; }
.eq-chip { background: #E0F7FA; color: #005662; border-color: #7FD4DD; }
.mbr .tag-line { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.mbr .ppe { color: #0D47A1; font-weight: 700; }
.mbr .eq-req { color: #005662; font-weight: 600; }
.mbr td.id.ppe { color: #0D47A1; }
.insp-checks { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.chip-check { font-size: 12px; font-weight: 600; padding: 2px 8px 2px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); gap: 4px; cursor: pointer; }
.chip-check input { margin: 0; }
.chip-check.on.hz { background: #FBE9E7; color: #A2330A; border-color: #F0A28E; }
.chip-check.on.ppe { background: #E3F2FD; color: #0D47A1; border-color: #90CAF9; }
.chip-check.on.eq { background: #E0F7FA; color: #005662; border-color: #7FD4DD; }
.insp-add { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 4px; margin: 2px 0 8px; }
.insp-add input, .insp-add select { min-width: 0; font-size: 12px; padding: 4px 6px; }
.insp-add.cat-add { grid-template-columns: 1fr; }
.insp-add.cls-add { grid-template-columns: 1fr 1fr auto auto; }
.wiz-h3 { margin: 18px 0 4px; font-size: 16px; }
.wiz-cat { display: grid; grid-template-columns: 90px 1fr; gap: 6px; align-items: start; margin: 4px 0; }
.wiz-cat .tag { margin-top: 3px; }
.chip-check .btn.tiny { padding: 0 4px; line-height: 1; margin-left: 2px; }
.insp-details summary { cursor: pointer; margin: 2px 0; }
.insp-links { display: flex; flex-direction: column; gap: 3px; margin: 2px 0 6px; }
.tr-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 3px 0; border-top: 1px dashed var(--line); }
.tr-row select { font-size: 12px; padding: 3px 6px; }
.tr-row input.note { flex: 1; min-width: 90px; font-size: 12px; padding: 3px 6px; }
.tr-add { grid-template-columns: 1fr 1fr; }
.tr-add input.short { width: 70px; }
.tr-add .btn.icon { grid-column: span 2; justify-self: start; }
.tr-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid #B39DDB; background: #EDE7F6; color: #4527A0; white-space: nowrap; line-height: 1.5; }
.tr-chip.tr-loop { background: #FFF3E0; color: #B3400A; border-color: #F5B27A; }
.tr-chip.tr-skip { background: #E1E6EA; color: var(--ink); border-color: #A3B1BB; }
.tr-chip.tr-jump { background: #E8EAF6; color: #283593; border-color: #9FA8DA; }
.eq-chip.mode-allocate { background: #E8F5E9; color: #1B5E20; border-color: #9BCF9F; }
.eq-chip.mode-release { background: #FBE9E7; color: #A2330A; border-color: #F0A28E; }
.mbr .flow-line { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.mbr .flow-line .tr-chip { white-space: normal; font-weight: 600; }
.mbr .flow-line .id { font-weight: 700; }

/* ---- icon buttons ---- */
.btn.icon { padding: 3px; width: 26px; height: 26px; justify-content: center; border-radius: 5px; }
.btn.icon .ico { width: 15px; height: 15px; }
.btn.icon.ghost { border-color: transparent; background: transparent; width: 22px; height: 22px; }
.btn.icon.ghost:hover { border-color: var(--line); background: var(--bg); }
.btn .ico { flex: none; }
.btn.small .ico { width: 13px; height: 13px; }
.library .row-actions .btn.icon { margin: 1px; }
.wf .btn.icon { opacity: .75; } .wf .btn.icon:hover { opacity: 1; }
.wf-move { display: inline-flex; gap: 2px; margin-right: 4px; }
.wf-move .btn.icon:disabled { opacity: .2; }
.mini .col .ico { vertical-align: -3px; margin-right: 2px; }

/* ---- builder: filter bar and collapsing ---- */
.wf-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 10px; }
.wf-filter .search { width: 300px; }
.wf-filter-ico { color: var(--teal-dark); display: inline-flex; }
.wf-filter .check { font-size: 12px; }
.wf-op.collapsed > .wf-op-head { border-bottom: 0; }
.wf-phase.collapsed { padding-bottom: 0; }
.wf-tpl-tools { display: flex; gap: 6px; margin: 4px 0 6px; }
.wf-tpl-tools .search { flex: 1; min-width: 0; }
.wf-tpl-tools select { font-size: 12px; padding: 3px 6px; }
.wf-tpl-group .muted { font-weight: 400; margin-left: 4px; }

/* ---- additional step and activity types (preview and builder) ---- */
.mbr .st-setup, .wf .st-setup                 { background: #FFF8E1; color: #6D4C00; border-color: #E0C068; }
.mbr .st-cleaning, .wf .st-cleaning           { background: #E1F5FE; color: #01579B; border-color: #81C7EE; }
.mbr .st-inspection, .wf .st-inspection       { background: #F3E5F5; color: #6A1B9A; border-color: #CE93D8; }
.mbr .st-hold, .wf .st-hold                   { background: #FBE9E7; color: #A2330A; border-color: #F0A28E; }
.mbr .st-transfer, .wf .st-transfer           { background: #E8F5E9; color: #1B5E20; border-color: #9BCF9F; }
.mbr .st-review, .wf .st-review               { background: #E1E6EA; color: var(--ink); border-color: #A3B1BB; }
.mbr .at-checklist, .wf .at-checklist         { background: #E8F5E9; color: #1B5E20; border-color: #9BCF9F; }
.mbr .at-scan, .wf .at-scan                   { background: #E1F5FE; color: #01579B; border-color: #81C7EE; }
.mbr .at-timer, .wf .at-timer                 { background: #FFF8E1; color: #6D4C00; border-color: #E0C068; }
.mbr .at-attachment, .wf .at-attachment       { background: #F3E5F5; color: #6A1B9A; border-color: #CE93D8; }
.mbr .at-comment, .wf .at-comment             { background: #EEF0F2; color: var(--ink); border-color: #A3B1BB; }
.mbr .at-materialid, .wf .at-materialid       { background: #FFF3E0; color: #B3400A; border-color: #F5B27A; }
.mbr .at-equipmentcheck, .wf .at-equipmentcheck { background: #E0F7FA; color: #006064; border-color: #7FD4DD; }
.mbr .at-approval, .wf .at-approval           { background: #EDE7F6; color: #4527A0; border-color: #B39DDB; }
.mbr .at-label, .wf .at-label                 { background: #FBE9E7; color: #A2330A; border-color: #F0A28E; }
.mbr .at-yield, .wf .at-yield                 { background: #E8F5E9; color: #2E7D32; border-color: #9BCF9F; }
.mbr .steps-doc tr.step.st-setup > td:first-child { border-left-color: #C79A00; }
.mbr .steps-doc tr.step.st-cleaning > td:first-child { border-left-color: #0288D1; }
.mbr .steps-doc tr.step.st-inspection > td:first-child { border-left-color: #8E24AA; }
.mbr .steps-doc tr.step.st-hold > td:first-child { border-left-color: #D84315; }
.mbr .steps-doc tr.step.st-transfer > td:first-child { border-left-color: #2E7D32; }
.mbr .steps-doc tr.step.st-review > td:first-child { border-left-color: #546E7A; }
.wf-step.st-setup { border-left-color: #C79A00; } .wf-step.st-cleaning { border-left-color: #0288D1; } .wf-step.st-inspection { border-left-color: #8E24AA; }
.wf-step.st-hold { border-left-color: #D84315; } .wf-step.st-transfer { border-left-color: #2E7D32; } .wf-step.st-review { border-left-color: #546E7A; }

/* ---- Preview: phase header band and fixed step-table layout (the table must never be wider than its operation card) ---- */
.mbr .steps-doc { table-layout: fixed; width: 100%; }
.mbr .steps-doc col.c-step { width: 72px; } .mbr .steps-doc col.c-type { width: 92px; } .mbr .steps-doc col.c-hz { width: 124px; } .mbr .steps-doc col.c-instr { width: auto; }
.mbr .steps-doc col.c-a-ebr { width: 12%; }   /* executed batch: recorded / performed / verified share 36 %, the instruction keeps the rest */
.mbr .steps-doc td, .mbr .steps-doc th { overflow-wrap: anywhere; }
.mbr .steps-doc td:last-child { width: auto; }
.mbr .steps-doc td:nth-child(3) { min-width: 0; }
.mbr .acts-doc { table-layout: auto; width: 100%; }   /* auto: the nested table shares the instruction column and must adapt to it */
.mbr .acts-doc col.c-a-no { width: 34px; } .mbr .acts-doc col.c-a-type { width: 96px; } .mbr .acts-doc col.c-a-ctl { width: 56px; } .mbr .acts-doc col.c-a-tag { width: 36px; }
.mbr .acts-doc td { overflow-wrap: normal; word-break: normal; } .mbr .acts-doc col.c-a-ebr { width: 14%; }
.mbr .op .table-wrap { overflow-x: auto; margin: 0; }
.mbr .steps-doc tr.phase-head td { background: #E6F4F6; border-top: 2px solid var(--teal); border-bottom: 1px solid #9ED2D8; border-left: 4px solid var(--teal); padding: 7px 10px; }
.mbr .steps-doc tr.phase-head.none td { background: var(--bg); border-top-color: var(--line); border-left-color: var(--line); }
.mbr .steps-doc .phase-head-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-size: 13px; }
.mbr .steps-doc .phase-head-line strong { color: var(--ink); }
.mbr .steps-doc tr.phase-head .grp { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-brand); background: var(--teal); border-radius: 3px; padding: 2px 7px; margin: 0; }
.mbr .steps-doc tr.phase-head.none .grp { background: var(--ink-2); }
.mbr .steps-doc tr.phase-head .tag-line, .mbr .steps-doc tr.phase-head .flow-line { margin: 4px 0 0; }
@media (max-width: 700px) {
  .mbr .steps-doc col.c-step { width: 56px; } .mbr .steps-doc col.c-type { width: 72px; } .mbr .steps-doc col.c-hz { width: 88px; } .mbr .steps-doc col.c-a-ebr { width: 14%; }
}
@media print { .mbr .steps-doc tr.phase-head .grp { color: #000; background: none; border: 1px solid #000; } .mbr .steps-doc tr.phase-head td { background: #EEF6F7 !important; } }
/* Table sections inside the MBR document keep their table display roles (a thead laid out as a block loses its columns). */
.mbr table.doc thead, .mbr table.acts-doc thead { display: table-header-group; }
.mbr table.doc tbody, .mbr table.acts-doc tbody { display: table-row-group; }
.mbr table.doc tr, .mbr table.acts-doc tr { display: table-row; }
.mbr table.doc th, .mbr table.doc td, .mbr table.acts-doc th, .mbr table.acts-doc td { display: table-cell; }

/* ---- Exceptions report ---- */
.mbr.exc .sev { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid transparent; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.sev-critical, .chip-check.on.sev-critical { background: var(--err-bg); color: var(--err); border-color: #F5C2C2; }
.sev-major, .chip-check.on.sev-major { background: #FFF1E0; color: #B4530A; border-color: #F5C89A; }
.sev-minor, .chip-check.on.sev-minor { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.sev-info, .chip-check.on.sev-info { background: #E8EEF9; color: #2F4B8F; border-color: #B9C8EA; }
.rec-banner { border: 2px solid var(--line); border-left-width: 8px; border-radius: var(--radius); padding: 14px 18px; margin: 6px 0 18px; background: var(--bg); }
.rec-banner.ok { border-color: var(--ok); background: var(--ok-bg); }
.rec-banner.warn { border-color: var(--warn); background: var(--warn-bg); }
.rec-banner.err { border-color: var(--err); background: var(--err-bg); }
.rec-banner .rec-level { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.rec-banner h2 { margin: 2px 0 4px; font-size: 20px; border: 0; padding: 0; }
.rec-banner .rec-verdict { font-size: 16px; margin-bottom: 6px; }
.rec-banner.ok .rec-verdict strong { color: var(--ok); } .rec-banner.warn .rec-verdict strong { color: #8A5A00; } .rec-banner.err .rec-verdict strong { color: var(--err); }
.rec-banner p { margin: 0 0 8px; max-width: 900px; }
.rec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.rec-cols h4, .rec-cols .h4 { margin: 4px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.rec-cols ul, .rec-cols ol { margin: 0; padding-left: 18px; font-size: 13px; }
.rec-cols li { margin: 2px 0; }
.exc-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.exc-cards .card h4, .exc-cards .card .h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.exc-cards .card > div { margin: 2px 0; }
.exc-cards .sev-table { margin: 0; }
.exc-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.exc-filter .search { flex: 1 1 240px; min-width: 160px; }
.mbr .exc-table { table-layout: fixed; width: 100%; }
.mbr .exc-table col.c-sev { width: 90px; } .mbr .exc-table col.c-cat { width: 90px; } .mbr .exc-table col.c-loc { width: 18%; } .mbr .exc-table col.c-el { width: 12%; } .mbr .exc-table col.c-msg { width: auto; } .mbr .exc-table col.c-act { width: 24%; }
.mbr .exc-table td { overflow-wrap: anywhere; }
.mbr .exc-table tr.sev-row-critical td:first-child { border-left: 4px solid var(--err); }
.mbr .exc-table tr.sev-row-major td:first-child { border-left: 4px solid #E07B2A; }
.mbr .exc-table tr.sev-row-minor td:first-child { border-left: 4px solid var(--warn); }
.mbr .exc-table tr.sev-row-info td:first-child { border-left: 4px solid #6C8BD6; }
@media (max-width: 1100px) { .exc-cards { grid-template-columns: 1fr 1fr; } .rec-cols { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .exc-cards { grid-template-columns: 1fr; } }
@media print { .rec-banner { break-inside: avoid; } .exc-cards { grid-template-columns: 1fr 1fr; } }

/* ---- Home page (task-oriented layout) ---- */
.home-top { display: grid; grid-template-columns: 1fr 420px; gap: 20px; align-items: start; margin-bottom: 14px; }
.home-top h1 { font-size: 22px; margin: 4px 0 6px; }
.home-top p { margin: 0; }
.home-search { position: relative; }
.home-search .search { width: 100%; font-size: 14px; padding: 9px 12px; border: 2px solid var(--teal-mid); border-radius: var(--radius); }
.home-search .search:focus { border-color: var(--teal); outline: none; }
.home-hits { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; }
.home-hit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.home-hit:last-child { border-bottom: 0; }
.home-hit .row-actions { margin-left: auto; display: flex; gap: 4px; }
.home-training { margin: 0 0 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid #E8A33D; border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.ht-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ht-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: #FFF3DF; color: #A2650B; flex: none; }
.ht-title { flex: 1 1 260px; min-width: 0; }
.ht-title h3, .ht-title .h3 { margin: 0; font-size: 16px; }
.ht-title p { margin: 2px 0 0; }
.ht-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ht-modules { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 6px; }
.ht-modules a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; text-decoration: none; height: 100%; box-sizing: border-box; }
.ht-modules a:hover { border-color: #E8A33D; background: #FFF9EF; }
.ht-no { flex: none; min-width: 24px; height: 24px; padding: 0 4px; box-sizing: border-box; border-radius: 12px; background: #23408F; color: var(--on-brand); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.ht-name { flex: 1 1 auto; font-size: 13px; font-weight: 600; line-height: 1.3; min-width: 0; }
.ht-min { flex: none; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.ht-paths { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ht-path { font-size: 12px; padding: 2px 9px; border-radius: 12px; background: #FFF3DF; border: 1px solid #F2CF96; }
.home-start { margin-bottom: 14px; border-left: 6px solid var(--teal); }
.home-start h3, .home-start .h3 { margin: 0 0 6px; }
.home-steps { margin: 0; padding-left: 20px; }
.home-steps li { margin: 4px 0; }
.home-tasks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.task-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line-strong); border-top: 4px solid var(--teal); border-radius: var(--radius); }
.task-tile .task-head { display: flex; align-items: center; gap: 8px; color: var(--teal-dark); }
.task-tile h3, .task-tile .h3 { margin: 0; font-size: 16px; }
.task-tile p { margin: 0 0 4px; }
.task-tile .btn { justify-content: flex-start; }
.task-tile > .muted.small { margin-top: 4px; }
.home-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.home-main, .home-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.panel-head h4, .panel-head .h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--teal-dark); }
.home-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.home-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.home-list .row-actions { margin-left: auto; display: flex; gap: 4px; }
.home-list .why { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .03em; }
.home-list .why.err { background: var(--err-bg); color: var(--err); }
.home-list .why.review { background: var(--warn-bg); color: #8A5A00; }
.home-recent td, .home-samples td { vertical-align: top; }
.home-recent .row-actions, .home-samples .row-actions { white-space: nowrap; }
.home-samples .num, .home-recent .num { text-align: right; }
.home-stats .home-stat strong { min-width: 36px; }
.home-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.home-activity li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.home-activity li:last-child { border-bottom: 0; }
.home-activity li > .muted.small:first-child { min-width: 64px; }
.home-docgroup { display: grid; grid-template-columns: 96px 1fr; gap: 6px; align-items: start; margin: 4px 0; }
.home-docgroup ul { list-style: none; margin: 0; padding: 0; }
.home-docgroup li { margin: 1px 0; font-size: 13px; }
.home-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.home-pages a { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; background: var(--bg); color: var(--ink); }
.home-pages a:hover { border-color: var(--teal); text-decoration: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
@media (max-width: 1100px) { .home-top { grid-template-columns: 1fr; } .home-cols { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .home-tasks { grid-template-columns: 1fr; } .home-docgroup { grid-template-columns: 1fr; } }
@media (max-width: 1100px) {
  .mbr .steps-doc col.c-step { width: 64px; } .mbr .steps-doc col.c-type { width: 80px; } .mbr .steps-doc col.c-hz { width: 104px; }
  .mbr .acts-doc col.c-a-type { width: 80px; }
}

/* ---- Builder palette: tabs (Blocks / Steps / Activities / Templates) and the template browser ---- */
.wf-palette { padding-top: 0; }
.pal-tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 2px; margin: 0 -12px 8px; padding: 8px 8px 0; background: var(--card); border-bottom: 2px solid var(--line); }
.pal-tab { flex: 1 1 auto; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 4px 7px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.pal-tab:hover { color: var(--teal-dark); }
.pal-tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.pal-tab .cnt, .tpl-kinds .cnt, .tpl-cats .cnt { font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 0 5px; margin-left: 2px; }
.pal-tab.active .cnt { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.pal-tips { margin: 0; padding-left: 16px; } .pal-tips li { margin: 3px 0; }
.tpl-search { display: flex; gap: 4px; margin-bottom: 6px; } .tpl-search .search { flex: 1; min-width: 0; }
.tpl-kinds { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
.tpl-kinds button { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius); font: inherit; font-size: 12px; padding: 3px 7px; cursor: pointer; color: var(--ink-2); }
.tpl-kinds button:hover { border-color: var(--teal); color: var(--teal-dark); }
.tpl-kinds button.active { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }
.tpl-kinds .wf-pal-ico { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 1px 4px; border-radius: 3px; color: var(--on-brand); background: #5E35B1; }
.tpl-cats { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; font: inherit; font-size: 12px; padding: 2px 8px; cursor: pointer; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--teal); } .chip-btn.active { background: #EDE7F6; border-color: #5E35B1; color: #4527A0; font-weight: 600; }
.tpl-hint { margin: 0 0 6px; }
.wf-pal.kind-tpl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ico name actions" "meta meta meta"; column-gap: 8px; row-gap: 2px; padding: 5px 8px; }
.wf-pal.kind-tpl .wf-pal-ico { grid-area: ico; }
.wf-pal.kind-tpl .tpl-name { grid-area: name; font-weight: 600; font-size: 12px; line-height: 1.25; }
.wf-pal.kind-tpl .tpl-actions { grid-area: actions; display: inline-flex; gap: 2px; opacity: .35; }
.wf-pal.kind-tpl:hover .tpl-actions, .wf-pal.kind-tpl:focus-within .tpl-actions { opacity: 1; }
.wf-pal.kind-tpl .tpl-meta { grid-area: meta; margin: 0; max-width: none; text-align: left; line-height: 1.25; }
.wf-pal.kind-tpl .builtin { margin-left: 4px; }
.wf-pal.kind-tpl.k-workflow .wf-pal-ico, .tpl-kinds .wf-pal-ico.k-workflow { background: #4527A0; }
.wf-pal.kind-tpl.k-operation .wf-pal-ico, .tpl-kinds .wf-pal-ico.k-operation { background: var(--teal); }
.wf-pal.kind-tpl.k-phase .wf-pal-ico, .tpl-kinds .wf-pal-ico.k-phase { background: #8A5A00; }
.wf-pal.kind-tpl.k-step .wf-pal-ico, .tpl-kinds .wf-pal-ico.k-step { background: var(--ink); }

/* ---- Review by exception: GMP scorecard, CPP / CQA registers ---- */
.gmp-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 8px; }
.gmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 16px; }
.gmp-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line-strong); border-left: 6px solid var(--line); border-radius: var(--radius); break-inside: avoid; }
.gmp-card.st-pass { border-left-color: var(--ok); } .gmp-card.st-attention { border-left-color: var(--warn); } .gmp-card.st-fail { border-left-color: var(--err); background: #FFFAFA; } .gmp-card.st-notapplicable { border-left-color: #B0BEC5; background: var(--surface-2); }
.gmp-head { display: flex; align-items: center; gap: 8px; }
.gmp-head strong { font-size: 13px; line-height: 1.2; }
.gmp-status { display: inline-block; min-width: 56px; text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 10px; border: 1px solid transparent; }
.gmp-status.st-pass { background: var(--ok-bg); color: var(--ok); border-color: #BFE3C1; }
.gmp-status.st-attention { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.gmp-status.st-fail { background: var(--err-bg); color: var(--err); border-color: #F5C2C2; }
.gmp-status.st-notapplicable { background: var(--bg); color: var(--muted); border-color: var(--line); }
.gmp-scope { line-height: 1.25; }
.gmp-metrics { margin: 2px 0 4px; padding-left: 16px; font-size: 12px; }
.gmp-metrics li { margin: 1px 0; }
.gmp-card .btn.small { align-self: flex-start; margin-top: auto; }
.crit { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid transparent; text-transform: uppercase; letter-spacing: .03em; cursor: help; white-space: nowrap; }
.crit.crit-critical { background: #4527A0; color: var(--on-brand); }
.crit.crit-key { background: #EDE7F6; color: #4527A0; border-color: #B39DDB; }
.crit.crit-monitored { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.mbr .reg-table { width: 100%; }
.mbr .reg-table td { overflow-wrap: anywhere; }
.mbr .reg-table td.num { text-align: right; white-space: nowrap; }
.mbr .reg-table tr.tone-err td { background: #FFF5F5; }
.mbr .reg-table tr.tone-err td:first-child { border-left: 4px solid var(--err); }
.mbr .reg-table tr.tone-warn td:first-child { border-left: 4px solid var(--warn); }
.reg-status { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.reg-status.tone-ok { background: var(--ok-bg); color: var(--ok); border-color: #BFE3C1; }
.reg-status.tone-err { background: var(--err-bg); color: var(--err); border-color: #F5C2C2; }
.reg-status.tone-warn { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.reg-status.tone-na { background: var(--bg); color: var(--muted); border-color: var(--line); }
.reg-basis { margin: 2px 0 16px; max-width: 1100px; }
.mbr .exc-table col.c-area { width: 13%; }
@media print { .gmp-grid { grid-template-columns: repeat(3, 1fr); } .reg-table tr { break-inside: avoid; } }

/* ---- Template browser: collapsible sidebar sections by ISA-88 level ---- */
.tb-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.tb-tools select { flex: 1; min-width: 0; font-size: 12px; padding: 3px 6px; }
.tb-count { margin-bottom: 6px; }
.tb-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; background: var(--card); overflow: hidden; }
.tb-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: var(--bg); padding: 7px 8px; font: inherit; cursor: pointer; text-align: left; border-left: 4px solid var(--line); }
.tb-head:hover { background: #EAF1F4; }
.tb-group.open .tb-head { background: #EEF3F6; border-bottom: 1px solid var(--line); }
.tb-head .tb-title { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.tb-head .tb-title strong { font-size: 13px; }
.tb-head .cnt { font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; }
.tb-head .wf-pal-ico, .wiz-outline .wf-pal-ico { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 5px; border-radius: 4px; color: var(--on-brand); }
.tb-group.k-workflow .tb-head { border-left-color: #4527A0; } .tb-group.k-workflow .wf-pal-ico { background: #4527A0; }
.tb-group.k-operation .tb-head { border-left-color: var(--teal); } .tb-group.k-operation .wf-pal-ico { background: var(--teal); }
.tb-group.k-phase .tb-head { border-left-color: #8A5A00; } .tb-group.k-phase .wf-pal-ico { background: #8A5A00; }
.tb-group.k-step .tb-head { border-left-color: var(--ink); } .tb-group.k-step .wf-pal-ico { background: var(--ink); }
.tb-body { padding: 6px 8px 4px; }
.tb-hint { margin: 0 0 4px; line-height: 1.3; }
.tb-hint em { display: block; color: var(--teal-dark); font-style: normal; font-weight: 600; margin-top: 2px; }
.wf-pal.kind-tpl.pickable { cursor: default; border-style: solid; }
.wf-pal.kind-tpl.pickable .tpl-actions { opacity: 1; }
.tb-pick { padding: 2px 8px; font-size: 12px; }

/* ---- Wizard: workflow step ---- */
.wiz-wf { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 8px; }
.wiz-tpl { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding-right: 2px; }
.wiz-outline { min-width: 0; }
.wiz-outline-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.wiz-outline-head span { margin-left: 6px; }
.wiz-msg { background: var(--teal-light); border: 1px solid var(--teal-mid); border-radius: var(--radius); padding: 4px 8px; margin: 4px 0; }
.wiz-add-op { grid-template-columns: 1fr auto; margin-bottom: 8px; }
.wiz-empty ol { margin: 4px 0 0; padding-left: 20px; text-align: left; }
.wiz-op { border: 1px solid var(--line-strong); border-left: 5px solid var(--teal); border-radius: var(--radius); background: var(--card); margin-bottom: 6px; }
.wiz-op-head { display: flex; align-items: center; gap: 6px; padding: 5px 8px; flex-wrap: wrap; }
.wiz-op .k-up { background: var(--teal); } .wiz-op .k-op { background: #8A5A00; } .wiz-op .k-ph { background: var(--ink); }
.wiz-op-head .wiz-name { flex: 1 1 200px; min-width: 120px; font-weight: 600; }
.wiz-op-head .wiz-wc { flex: 0 1 170px; min-width: 100px; }
.wiz-op-btns { display: inline-flex; gap: 2px; margin-left: auto; }
.wiz-op-body { padding: 4px 10px 8px 34px; border-top: 1px solid var(--line); background: var(--surface-2); }
.wiz-phase { border-left: 3px solid #F3D9A4; padding: 4px 0 4px 8px; margin: 6px 0; }
.wiz-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; flex-wrap: wrap; }
.wiz-row .wiz-name { flex: 1 1 200px; min-width: 120px; }
.wiz-row input, .wiz-row select, .wiz-op-head input { font-size: 12px; padding: 3px 6px; }
.wiz-step { padding-left: 16px; }
.wiz-addrow { opacity: .85; }
.wiz-from-wf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 6px 10px; margin: 6px 0 10px; }
.wiz-links { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background: var(--card); }
@media (max-width: 1000px) { .wiz-wf { grid-template-columns: 1fr; } .wiz-tpl { position: static; max-height: none; } }
.wf.tpl-wide { grid-template-columns: 340px minmax(0, 1fr) 300px; }
@media (max-width: 1300px) { .wf.tpl-wide { grid-template-columns: 300px minmax(0, 1fr) 260px; } }
@media (max-width: 1000px) { .wf.tpl-wide { grid-template-columns: 1fr; } }


/* ---- Review by exception: report look ---- */
.mbr.exc { padding: 0; overflow: hidden; border-color: var(--line-strong); }
.mbr.exc > *:not(.exc-mast):not(.exc-kpis):not(.exc-sections) { margin-left: 24px; margin-right: 24px; }
.exc-mast { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px 28px; padding: 18px 24px 14px; background: linear-gradient(180deg, #F2F8F8 0%, var(--card) 100%); border-bottom: 3px solid var(--teal); }
.exc-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-dark); margin-bottom: 4px; }
.exc-mast h1 { font-size: 22px; margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.exc-batch { font-size: 13px; font-weight: 700; color: var(--on-brand); background: var(--ink-2); border-radius: 4px; padding: 2px 8px; }
.exc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0; align-content: start; }
.exc-facts div { border-left: 2px solid var(--teal-mid); padding-left: 8px; min-width: 0; }
.exc-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.exc-facts dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.exc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0; border-bottom: 1px solid var(--line); background: var(--card); }
.kpi { padding: 10px 14px 9px; border-right: 1px solid var(--line); position: relative; }
.kpi:last-child { border-right: 0; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--line); }
.kpi.tone-ok::before { background: var(--ok); } .kpi.tone-warn::before { background: var(--warn); } .kpi.tone-err::before { background: var(--err); }
.kpi-value { font-size: 22px; font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi.tone-err .kpi-value { color: var(--err); } .kpi.tone-warn .kpi-value { color: #8A5A00; }
.kpi-label { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-bar { height: 4px; background: #E6EBEF; border-radius: 2px; margin-top: 5px; overflow: hidden; }
.kpi-bar span { display: block; height: 100%; background: var(--ok); }
.kpi.tone-warn .kpi-bar span { background: var(--warn); } .kpi.tone-err .kpi-bar span { background: var(--err); }
.pv-sections { margin: -24px -28px 14px; border-radius: var(--radius) var(--radius) 0 0; align-items: center; }
.pv-sections .pv-ops { margin-left: auto; font-size: 12px; padding: 3px 6px; max-width: 320px; }
.mbr h2[id^="pv-"], .mbr .op[id^="op-"] { scroll-margin-top: 48px; }
html.print-layout .pv-sections { display: none !important; }
.exc-sections { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 20px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(2px); }
.exc-sec { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 4px 10px; border-radius: 14px; cursor: pointer; }
.exc-sec:hover { background: var(--teal-light); color: var(--teal-dark); }
.mbr.exc .rec-banner { position: relative; padding-left: 86px; margin-top: 16px; scroll-margin-top: 48px; }
.rec-icon { position: absolute; left: 18px; top: 16px; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--on-brand); background: var(--muted); }
.rec-banner.ok .rec-icon { background: var(--ok); } .rec-banner.warn .rec-icon { background: var(--warn); } .rec-banner.err .rec-icon { background: var(--err); }
.mbr .exc-h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-top: 26px; padding-bottom: 6px; border-bottom: 2px solid #D5DEE4; scroll-margin-top: 48px; }
.mbr .exc-h2 .sec-no { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--teal); color: var(--on-brand); font-size: 13px; font-weight: 700; align-self: center; }
.mbr .exc-h2 .muted { font-weight: 400; }
.gmp-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 4px; margin: 4px 0 10px; }
.gmp-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid transparent; border-radius: 5px; padding: 5px 7px; font: inherit; text-align: left; cursor: pointer; min-height: 52px; }
.gmp-cell .gmp-cell-name { font-size: 12px; line-height: 1.15; font-weight: 600; }
.gmp-cell .gmp-glyph { font-size: 14px; font-weight: 800; line-height: 1; }
.gmp-cell.st-pass { background: var(--ok-bg); color: var(--ok); border-color: #BFE3C1; }
.gmp-cell.st-attention { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.gmp-cell.st-fail { background: var(--err); color: var(--on-brand); }
.gmp-cell.st-notapplicable { background: var(--bg); color: var(--muted); border-color: var(--line); }
.gmp-cell:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.gmp-status .gmp-glyph { font-weight: 800; }
.gmp-card { box-shadow: 0 1px 2px rgba(20,40,60,.06); }
.gmp-card .gmp-scope { border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.rbar { position: relative; height: 10px; min-width: 110px; margin-top: 5px; background: #EEF1F4; border-radius: 5px; }
.rbar-band { position: absolute; top: 0; bottom: 0; background: #C5E6C7; border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.rbar-target { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--ink-2); }
.rbar-dot { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--teal-dark); border: 1.5px solid var(--card); box-shadow: 0 0 0 1px var(--teal-dark); }
.rbar-dot.bad { background: var(--err); box-shadow: 0 0 0 1px var(--err); }
.mbr .reg-table thead th, .mbr .exc-table thead th { background: #E6ECF0; }
.mbr .reg-table { min-width: 1060px; }
.mbr .reg-table td .id, .mbr .reg-table td.id { white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.mbr .reg-table td.num { white-space: normal; min-width: 130px; }
.mbr .reg-table td.small.muted { max-width: 220px; }
.mbr .reg-table td:first-child { white-space: nowrap; }
.mbr .reg-table tbody tr:nth-child(even) td, .mbr .exc-table:not(.reg-table) tbody tr:nth-child(even) td { background: var(--surface-2); }
.mbr .reg-table tbody tr.tone-err td { background: #FFF3F3; }
.mbr .reg-table tbody tr:hover td, .mbr .exc-table tbody tr:hover td { background: #F0F7F7; }
.mbr .reg-table td strong { font-weight: 600; }
.mbr.exc .sign { margin: 10px 24px 24px; }
@media (max-width: 900px) { .exc-mast { grid-template-columns: 1fr; } .mbr.exc > *:not(.exc-mast):not(.exc-kpis):not(.exc-sections) { margin-left: 12px; margin-right: 12px; } .mbr.exc .rec-banner { padding-left: 18px; } .rec-icon { display: none; } }
@media print {
  .mbr.exc { border: 0; }
  .exc-mast { background: none; }
  .exc-kpis { break-inside: avoid; }
  .mbr .exc-h2 { break-after: avoid; }
  .mbr .reg-table { min-width: 0; }
  .gmp-cell.st-fail { color: var(--err); background: var(--card); border-color: var(--err); }
  #cpp, #cqa, #exc-list { break-before: page; }
}


/* ---- Signatures: one per block, each with its own timestamp ---- */
.sig-name { display: block; font-weight: 600; color: var(--ink); white-space: nowrap; }
.sig-at { display: block; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sig-inline .sig-name, .sig-inline .sig-at { display: inline; }
.sig-inline .sig-at::before { content: " · "; color: var(--muted); }
.res-line { margin-bottom: 3px; }
.mbr .sign.sig-blocks, .mbr .sign.filled { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.mbr .sign .sig-block { border-top: 2px solid var(--teal); padding-top: 6px; font-size: 12px; color: var(--ink-2); }
.mbr .sign .sig-role { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--teal-dark); margin-bottom: 4px; }
.mbr .sign .sig-block .sig-at { font-size: 12px; margin-top: 2px; }
.mbr .sign .sig-field { border-top: 0; border-bottom: 1px solid #9AA7B2; height: 30px; display: flex; align-items: flex-end; padding: 0 0 2px; margin-top: 4px; }
.mbr .sign .sig-field span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mbr .sig-h { margin: 14px 0 6px; }
.mbr .sig-table td.sig-time { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.mbr .sig-table tr.tone-err td { background: #FFF3F3; }
.mbr .step-who { display: flex; flex-wrap: wrap; gap: 2px 12px; white-space: normal; }
.mbr .reg-table td.sig-cell { min-width: 120px; }

/* ---- e-signature manifestation: name · date and time · meaning · reason ---- */
.sig-meaning { display: block; font-size: 12px; color: var(--teal-dark); font-weight: 600; white-space: normal; }
.sig-meaning.defaulted { color: var(--ink-2); font-weight: 400; font-style: italic; }
.sig-reason { display: block; font-size: 12px; color: var(--muted); white-space: normal; max-width: 260px; }
.sig-sub { display: block; margin-top: 2px; padding-left: 8px; border-left: 2px solid #D5DEE4; }
.sig-sub .sig-name, .sig-sub .sig-at { display: inline; }
.sig-sub .sig-at::before { content: " · "; color: var(--muted); }
.mbr .who { white-space: normal; min-width: 130px; }
.mbr .sign .sig-meaning-line { font-size: 12px; color: var(--ink); margin-top: 6px; }
.mbr .sign .sig-meaning-line span, .mbr .sign .sig-field.tall span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.mbr .sign .sig-field.tall { height: 38px; }
.mbr .sign .sig-block .sig-meaning { font-size: 12px; margin-top: 4px; }
.mbr .sign .sig-block .sig-reason { font-size: 12px; max-width: none; }
.mbr .sig-table td.sig-meaning { font-size: 12px; }
.mbr .sig-table td.sig-reason { font-size: 12px; color: var(--ink-2); max-width: none; }


/* ================================================================ page headers: a distinct band at the top of every page */
.page-head, .home-top {
  position: relative; background: linear-gradient(118deg, #10204A 0%, #23408F 55%, #3557C7 100%); color: #F3F6FF;
  padding: 16px 22px; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 6px 18px rgba(0, 60, 55, .18); overflow: hidden;
}
.page-head::after, .home-top::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.10), rgba(255,255,255,0) 70%); pointer-events: none; }
.page-head > *, .home-top > * { position: relative; z-index: 1; }
.page-head h1, .home-top h1 { color: #F3F6FF; font-size: 22px; letter-spacing: -.01em; }
.page-head p, .page-head .muted, .home-top p, .home-top .muted { color: rgba(242, 251, 250, .86) !important; }
.page-head strong, .home-top strong { color: var(--on-brand); }
.page-head a:not(.btn), .home-top a:not(.btn) { color: #FFE7A3; text-decoration: underline; text-underline-offset: 2px; }
.page-head .btn, .home-top .btn { background: rgba(255,255,255,.96); border-color: transparent; color: #10204A; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.page-head .btn:hover, .home-top .btn:hover { background: var(--card); color: var(--teal-dark); box-shadow: 0 2px 8px rgba(0,0,0,.22); }
.page-head .btn.primary, .home-top .btn.primary { background: #F6C453; color: var(--ink); border-color: #F6C453; }
.page-head .btn.primary:hover, .home-top .btn.primary:hover { background: #FFD36E; }
.page-head select, .page-head input:not([type=checkbox]), .home-top input:not([type=checkbox]) { background: var(--card); border-color: transparent; color: var(--ink); }
.page-head label.check, .page-head label { color: #F3F6FF; }
.page-head .chip, .page-head .tag { background: rgba(255,255,255,.14); color: var(--on-brand); border-color: rgba(255,255,255,.3); }
.home-top .home-hits { color: var(--ink); }
.home-top .home-hits .muted { color: var(--muted) !important; }
.home-top .home-hits a:not(.btn) { color: var(--teal-dark); text-decoration: none; }
.home-top .home-search .search { border-color: transparent; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
@media print { .page-head, .home-top { background: none !important; color: var(--ink); box-shadow: none; padding: 0; } .page-head h1, .home-top h1 { color: var(--ink); } }

/* ================================================================ workflow canvas elements */
.wf-canvas { padding: 6px 4px 40px; }
.drag-handle { color: #9AA7B2; font-size: 14px; line-height: 1; cursor: grab; user-select: none; opacity: .55; margin-right: -2px; }
.wf-op:hover > .wf-op-head > .drag-handle, .wf-phase:hover > .wf-phase-head > .drag-handle, .wf-step:hover > .wf-step-head > .drag-handle, .wf-act:hover > .drag-handle { opacity: 1; color: var(--teal-dark); }
.card-title { display: inline-flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.card-sub { display: inline-flex; gap: 8px; align-items: baseline; font-size: 12px; }
.card-sub .unit { color: var(--ink-2); }
.card-sub .unit::before { content: "⚙ "; color: var(--muted); }
.meta-chips { display: inline-flex; gap: 3px; }
.meta-chip { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--card); border: 1px solid #D5DEE4; border-radius: 9px; padding: 0 6px; white-space: nowrap; }
.card-tools { display: inline-flex; align-items: center; gap: 1px; padding: 1px 3px; background: rgba(255,255,255,.92); border: 1px solid #D5DEE4; border-radius: 16px; opacity: .45; transition: opacity .12s, box-shadow .12s; }
.card-tools .wf-move { display: inline-flex; gap: 1px; padding-right: 3px; margin-right: 2px; border-right: 1px solid var(--line); }
.card-tools .btn.icon { border-color: transparent; background: transparent; box-shadow: none; width: 24px; height: 24px; }
.card-tools .btn.icon:hover { background: var(--teal-light); }
.wf-op:hover > .wf-op-head .card-tools, .wf-phase:hover > .wf-phase-head .card-tools, .wf-step:hover > .wf-step-head .card-tools, .wf-act:hover > .card-tools,
.wf-op.sel > .wf-op-head .card-tools, .wf-phase.sel > .wf-phase-head .card-tools, .wf-step.sel > .wf-step-head .card-tools, .wf-act.sel > .card-tools,
.card-tools:focus-within { opacity: 1; box-shadow: 0 2px 6px rgba(20,40,60,.12); }

.wf-op { border: 1px solid #B9C6D0; border-left: 6px solid var(--teal); border-radius: 12px; background: var(--card); margin: 4px 0; box-shadow: 0 1px 3px rgba(20,40,60,.07); transition: box-shadow .15s; overflow: visible; }
.wf-op:hover { box-shadow: 0 4px 14px rgba(20,40,60,.10); }
.wf-op > .wf-op-head { background: linear-gradient(90deg, #E9EEFB 0%, #F5F7FD 55%, var(--card) 100%); border-bottom: 1px solid #D3DCF2; border-radius: 11px 11px 0 0; padding: 9px 12px; gap: 8px; }
.wf-op.collapsed > .wf-op-head { border-radius: 11px; }
.wf-op > .wf-op-head .desc { font-size: 16px; font-weight: 700; color: var(--ink); }
.wf-op .op-num { font-size: 12px; padding: 3px 9px; background: var(--teal-dark); box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); }
.wf-op.sel { box-shadow: 0 0 0 2px var(--teal), 0 6px 18px rgba(53, 87, 199,.20); }
.wf-op-body { padding: 8px 12px 10px 18px; }

.wf-phase { border: 1px solid #EBD6A8; border-left: 5px solid #E0A526; border-radius: 10px; background: #FFFDF8; margin: 4px 0; box-shadow: 0 1px 2px rgba(120,80,0,.06); }
.wf-phase > .wf-phase-head { background: linear-gradient(90deg, #FFF3D9 0%, #FFFAF0 60%, #FFFDF8 100%); border-bottom: 1px solid #F1E2BE; border-radius: 9px 9px 0 0; padding: 7px 10px; }
.wf-phase.collapsed > .wf-phase-head { border-radius: 9px; border-bottom: 0; }
.wf-phase > .wf-phase-head .desc { font-weight: 600; font-size: 13px; }
.wf-phase .ph-num { background: var(--card); }
.wf-phase.sel { box-shadow: 0 0 0 2px #E0A526, 0 4px 14px rgba(160,110,0,.18); }
.wf-phase.loose > .wf-phase-head { background: var(--bg); }
.wf-phase > .wf-step, .wf-phase > .wf-zone { margin-left: 12px; margin-right: 10px; }
.wf-phase > .wf-step:last-of-type { margin-bottom: 8px; }

.wf-step { border: 1px solid #C9D3DB; border-left-width: 5px; border-radius: 8px; background: var(--card); margin: 4px 0; box-shadow: 0 1px 2px rgba(20,40,60,.05); transition: box-shadow .12s, transform .12s; }
.wf-step:hover { box-shadow: 0 3px 10px rgba(20,40,60,.10); }
.wf-step.sel { box-shadow: 0 0 0 2px var(--teal-dark), 0 4px 14px rgba(0,95,89,.18); }
.wf-step > .wf-step-head { padding: 6px 10px; gap: 7px; border-bottom: 1px solid #EEF2F5; }
.wf-step > .wf-step-head .desc { font-weight: 600; font-size: 13px; color: var(--ink); }
.wf .step-no { min-width: 22px; height: 22px; line-height: 20px; border-radius: 50%; background: var(--teal-light); border: 1px solid var(--teal-mid); padding: 0; }
.wf-acts { padding: 4px 8px 6px 14px; }

.wf-act { border: 1px solid transparent; border-radius: 6px; background: #F6F8FA; padding: 4px 8px; margin: 2px 0; transition: background .1s, border-color .1s; }
.wf-act:hover { background: var(--card); border-color: #C9D3DB; box-shadow: 0 1px 4px rgba(20,40,60,.08); }
.wf-act.sel { background: var(--teal-light); border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.wf-act .desc { color: var(--ink); }
.wf-act .drag-handle { font-size: 12px; }

.wf-zone.live { border-radius: 8px; border: 2px dashed #7FC6BF; background: repeating-linear-gradient(45deg, #F2FAF9, #F2FAF9 8px, #E8F5F3 8px, #E8F5F3 16px); font-weight: 600; }
.wf-zone.live.over { background: var(--teal-light); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.wf-empty { border-radius: 12px; padding: 36px; background: linear-gradient(180deg, #F7FBFB, var(--card)); }

/* ================================================================ template cards */
.tpl-search { position: relative; }
.tpl-search .tpl-search-ico { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: inline-flex; }
.tpl-search .search { padding-left: 28px; }
.tb-group { border-radius: 10px; box-shadow: 0 1px 2px rgba(20,40,60,.05); }
.tb-head { padding: 8px 10px; }
.tb-head .tb-title strong { font-size: 13px; }
.tb-head .cnt { font-size: 12px; padding: 1px 8px; }
.tb-body .wf-tpl-group { margin: 10px 0 4px; padding-bottom: 2px; border-bottom: 1px solid #EEF2F5; color: var(--ink-2); }
.wf-pal.kind-tpl { position: relative; border: 1px solid #D5DEE4; border-left: 4px solid #8C9BA8; border-radius: 8px; background: var(--card); padding: 7px 8px 6px 9px; margin-bottom: 5px; row-gap: 4px;
  grid-template-areas: "ico name actions" "chips chips chips" "peek peek peek"; box-shadow: 0 1px 2px rgba(20,40,60,.05); transition: box-shadow .12s, transform .12s, border-color .12s; }
.wf-pal.kind-tpl:hover { box-shadow: 0 4px 12px rgba(20,40,60,.12); transform: translateY(-1px); border-color: var(--line-strong); }
.wf-pal.kind-tpl[draggable="true"] { cursor: grab; }
.wf-pal.kind-tpl[draggable="true"]:active { cursor: grabbing; }
.wf-pal.kind-tpl.k-workflow { border-left-color: #4527A0; } .wf-pal.kind-tpl.k-operation { border-left-color: var(--teal); }
.wf-pal.kind-tpl.k-phase { border-left-color: #C8860A; } .wf-pal.kind-tpl.k-step { border-left-color: var(--ink); }
.wf-pal.kind-tpl .tpl-name { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wf-pal.kind-tpl .tpl-actions { opacity: .4; align-self: start; }
.wf-pal.kind-tpl:hover .tpl-actions, .wf-pal.kind-tpl .tpl-actions:focus-within { opacity: 1; }
.wf-pal.kind-tpl .tpl-actions .btn.icon { width: 22px; height: 22px; border-color: transparent; background: transparent; }
.wf-pal.kind-tpl .tpl-actions .btn.icon:hover { background: var(--teal-light); }
.tpl-chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.tpl-chip { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; white-space: nowrap; }
.tpl-chip strong { color: var(--ink); }
.tpl-fam { font-size: 12px; color: var(--teal-dark); background: var(--teal-light); border: 1px solid var(--teal-mid); border-radius: 9px; padding: 0 6px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-pal.kind-tpl .builtin, .wf-pal.kind-tpl .mine { font-size: 12px; border-radius: 9px; padding: 0 6px; margin-left: auto; }
.wf-pal.kind-tpl .mine { color: #8A5A00; background: var(--warn-bg); border: 1px solid #F3D9A4; }
.tpl-peek { grid-area: peek; margin: 2px 0 0; padding: 5px 8px 5px 26px; background: #F8FAFB; border: 1px solid #E6EBEF; border-radius: 6px; font-size: 12px; cursor: default; }
.tpl-peek li { margin: 1px 0; line-height: 1.3; }
.wf-pal.kind-tpl.pickable .tpl-actions { opacity: 1; }
.tb-pick { background: var(--teal-dark) !important; color: var(--on-brand) !important; border-color: var(--teal-dark) !important; }
.tb-pick:hover { background: #003A35 !important; }
.tb-pick:disabled { background: #B0BEC5 !important; border-color: #B0BEC5 !important; }
.wf-act .tag, .wf-act .ipc-tag, .wf-act .at, .wf-act .seq { white-space: nowrap; flex-shrink: 0; }
.wf-act .desc { flex: 1 1 160px; min-width: 0; }
.wf-act { flex-wrap: wrap; }
.home-top { overflow: visible; z-index: 10; }
.home-top::after { display: none; }


/* ================================================================ print / PDF: the whole document, nothing but the document */
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: var(--card) !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .shell { display: block !important; min-height: 0 !important; }
  .content { padding: 0 !important; margin: 0 !important; max-width: none !important; width: auto !important; }
  .topbar, .topnav, .nav-toggle, .no-print, .page-head, .home-top, .exc-sections, .exc-filter, .doc-toc, #blazor-error-ui { display: none !important; }
  .table-wrap, .grid-wrap, .s88, .mbr, .mbr.exc, .doc-body, .wf-canvas { overflow: visible !important; max-height: none !important; }
  .exc-sections, .wf-palette, .wf-inspector, .editor-side, .tb-head, .pal-tabs { position: static !important; }
  .doc-page { display: block !important; }
  .doc-body { max-width: none !important; border: 0 !important; padding: 0 !important; }
  .mbr { border: 0 !important; box-shadow: none !important; }
  .mbr .reg-table, .mbr table.doc { min-width: 0 !important; width: 100% !important; }
  .mbr .rec-banner, .exc-kpis, .gmp-card, .sig-block, .mbr .op-head { break-inside: avoid; }
  .mbr h2, .mbr h3, .mbr .h3, .mbr .exc-h2 { break-after: avoid; }
  .mbr thead { display: table-header-group; }
  a { color: inherit !important; text-decoration: none !important; }
}


/* ================================================================ printed header, footer and page numbers (CSS page margin boxes) */
@page {
  size: A4;
  margin: 27mm 12mm 18mm 12mm;
  @top-left { width: 34%; content: "MBR Upload Tool"; font: 600 8.5pt/1.35 "Segoe UI", Arial, sans-serif; color: #23408F; white-space: pre-wrap; vertical-align: bottom; padding-bottom: 3mm; border-bottom: 0.6pt solid #3557C7; }
  @top-center { width: 36%; content: ""; font: 7.5pt/1.35 "Segoe UI", Arial, sans-serif; color: var(--ink); white-space: pre-wrap; text-align: center; vertical-align: bottom; padding-bottom: 3mm; border-bottom: 0.6pt solid #3557C7; }
  @top-right { width: 30%; content: "Master batch record authoring"; font: 7.5pt/1.35 "Segoe UI", Arial, sans-serif; color: var(--ink-2); white-space: pre-wrap; text-align: right; vertical-align: bottom; padding-bottom: 3mm; border-bottom: 0.6pt solid #3557C7; }
  @bottom-left { content: ""; font: 7.5pt "Segoe UI", Arial, sans-serif; color: var(--ink-2); vertical-align: top; padding-top: 3mm; border-top: 0.6pt solid var(--line); }
  @bottom-center { content: "Uncontrolled copy when printed"; font: italic 7.5pt "Segoe UI", Arial, sans-serif; color: #6B7680; text-align: center; vertical-align: top; padding-top: 3mm; border-top: 0.6pt solid var(--line); }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 600 8pt "Segoe UI", Arial, sans-serif; color: var(--ink); text-align: right; vertical-align: top; padding-top: 3mm; border-top: 0.6pt solid var(--line); }
}


/* ================================================================ safety signs (ISO 7010 / GHS) */
.sign-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 2px; vertical-align: middle; }
.sign-chip .sign-img, .sign-inline .sign-img, .sign-plain .sign-img { flex: none; display: block; }
.sign-inline, .sign-plain { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.sign-inline { font-weight: 700; font-size: 12px; }
.sign-inline.hz { color: #A2330A; }
.sign-inline.ppe { color: #0D47A1; }
.sign-plain .sign-id { font-weight: 600; }
.sign-row + .sign-row { margin-top: 3px; }
.chip-check .sign-plain { gap: 4px; }
.insp-add .sign-plain { align-self: center; }
.mbr td.id .sign-inline { font-size: 12px; }

.sign-how { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 20px; padding: 16px 18px; margin: 14px 0; }
.sign-how h2 { margin: 0 0 6px; font-size: 16px; }
.sign-how ol { margin: 0 0 8px; padding-left: 20px; line-height: 1.6; }
.sign-try { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.sign-try h3, .sign-try .h3 { margin: 0; font-size: 14px; }
.sign-try label { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.sign-try-result { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.sign-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 4px; }
.sign-kinds .chip { cursor: pointer; font-size: 12px; padding: 4px 10px; }
.sign-kinds .chip.on { background: var(--teal-dark, #23408F); border-color: var(--teal-dark, #23408F); color: var(--on-brand); }
.sign-kinds .chip.on .muted { color: rgba(255,255,255,.8); }
.sign-kinds .check { margin-left: auto; font-size: 12px; }
.sign-kind-h { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; padding-left: 10px; border-left: 5px solid var(--muted); font-size: 16px; }
.sign-kind-h.kind-warning { border-color: #F9A800; }
.sign-kind-h.kind-mandatory { border-color: #005387; }
.sign-kind-h.kind-prohibition { border-color: #C1121C; }
.sign-kind-h.kind-safe-condition { border-color: #237F52; }
.sign-kind-h.kind-fire-equipment { border-color: #9B2423; }
.sign-kind-h.kind-ghs { border-color: #E30613; }
.sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.sign-card { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; break-inside: avoid; }
.sign-card img { flex: none; }
.sign-card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sign-code { font-weight: 800; font-size: 14px; }
.sign-title { font-size: 12px; line-height: 1.35; }
.sign-ids { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.sign-ids code { font-size: 12px; padding: 0 4px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }
@media (max-width: 760px) { .sign-how { grid-template-columns: 1fr; } }
@media print {
  .sign-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sign-card { border-color: var(--line); }
}

/* ================================================================ interface language */
/* same row layout as the Author field: icon, label, control on one line (overrides the column layout of app.css label) */
.nav-author .lang-pick { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.nav-author .lang-pick select { width: auto; min-width: 0; max-width: 150px; padding: 4px 6px; font-size: 12px; }
@media (max-width: 1350px) {
  .nav-author .lang-pick .nav-label { display: none; }
  .nav-author .lang-pick select { max-width: 120px; }
}
@media (max-width: 900px) {
  .nav-author .lang-pick .nav-label { display: inline; }
  .nav-author .lang-pick select { max-width: 200px; }
}
:lang(zh-CN) body, :lang(zh-CN) input, :lang(zh-CN) select, :lang(zh-CN) button { font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif; }
:lang(zh-TW) body, :lang(zh-TW) input, :lang(zh-TW) select, :lang(zh-TW) button { font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; }
:lang(ko) body, :lang(ko) input, :lang(ko) select, :lang(ko) button { font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
:lang(el) body { font-family: "Segoe UI", "Noto Sans", Arial, sans-serif; }
:lang(zh-CN) .nav-label, :lang(zh-TW) .nav-label, :lang(ko) .nav-label { letter-spacing: 0; }

/* ================================================================ translated documents */
.doc-lang-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 6px 12px; border-radius: 8px; background: #EEF6F5; border: 1px solid #B9DAD6; font-size: 12px; }

/* ================================================================ example badge */
.example-badge { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; line-height: 1.5;
  padding: 1px 8px; border-radius: 10px; color: #5B2C83; background: #F1E8FA; border: 1px solid #C9A9E6; white-space: nowrap; }
h1 .example-badge { font-size: 12px; padding: 2px 10px; }
.page-head .example-badge, .home-top .example-badge { color: var(--on-brand); background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.55); }
@media print { .example-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* ================================================================ example update notice */
.example-update { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: #F1E8FA; border: 1px solid #C9A9E6; }

/* ================================================================ executed batch picker */
.batch-bar { align-items: center; }
.batch-picker { min-width: 260px; max-width: 100%; font-size: 12px; }
.batch-bar .file-btn { white-space: nowrap; }

/* ================================================================ structured instruction builder (activity inspector) */
.ib { margin: 2px 0 12px; border: 1px solid var(--line); border-left: 4px solid var(--teal-mid, #4FB3AC); border-radius: 8px; background: #F7FBFB; }
.ib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; }
.ib-toggle { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink, var(--ink)); font-size: 12px; margin-right: auto; }
.ib-status { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.ib-status.ok { background: #E6F4EA; color: #1E6B35; border-color: #A8D5B5; }
.ib-status.free { background: #FFF4E0; color: #8A5300; border-color: #F2C87A; }
.ib-status.empty { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.ib-status.cpp { background: #E8EEF9; color: #1D3F8A; border-color: #A9BCE6; }
.ib-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.ib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 8px; }
.ib label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.ib label.wide { grid-column: 1 / -1; }
.ib input, .ib select { font-size: 12px; min-width: 0; width: 100%; box-sizing: border-box; }
.ib-pair { display: flex; gap: 4px; }
.ib-pair select { flex: 0 0 64px; width: 64px; }
.ib-pair input { flex: 1 1 auto; }
.ib-sub { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 3px; }
.ib-params { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ib-param { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.ib-param-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ib-param-top .ib-name { flex: 1 1 100%; }
.ib-param-top select { flex: 1 1 120px; width: auto; }
.ib-param-top .btn.icon { flex: none; padding: 3px; }
.ib-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 4px 6px; }
.ib-values label.wide { grid-column: span 2; }
.ib-note { margin-top: 0; }
.ib-preview { background: var(--card); border: 1px dashed #9FC9C5; border-radius: 6px; padding: 6px 8px; }
.ib-text { font-size: 12px; line-height: 1.45; color: var(--ink, var(--ink)); }
.ib-text.changed { background: #FFFBEA; box-shadow: inset 3px 0 0 #F2C87A; padding-left: 6px; }
.ib-detected { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; }
.ib-cpp { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #E8EEF9; color: #1D3F8A; border: 1px solid #A9BCE6; white-space: nowrap; }
.ib-cpp.first { background: #1D3F8A; color: var(--on-brand); border-color: #1D3F8A; }
.ib-findings { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.ib-findings li { font-size: 12px; line-height: 1.35; padding: 3px 7px; border-radius: 5px; border-left: 3px solid; }
.ib-findings li.lvl-error { background: #FDECEA; border-color: #C62828; color: #8E1C1C; }
.ib-findings li.lvl-warning { background: #FFF6E5; border-color: #E69A00; color: #7A4B00; }
.ib-findings li.lvl-info { background: #EEF3F8; border-color: #7D92A8; color: #37475A; }
.ib-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ib-body > p { margin: 0; }


/* ================================================================ builder palette: vertical tab rail on the left, rotated labels */
/* three resizable columns: palette | gutter | canvas | gutter | details. app.js sets --wf-left / --wf-right on the .wf element
   while a gutter is dragged and remembers them per browser; the defaults depend on the palette tab and the panel modes. */
.wf { --wf-left-default: 262px; --wf-right-default: 320px; grid-template-columns: var(--wf-left, var(--wf-left-default)) 8px minmax(0, 1fr) 8px var(--wf-right, var(--wf-right-default)); gap: 8px; }
.wf.tpl-wide { --wf-left-default: 372px; --wf-right-default: 300px; }
.wf.insp-wide { --wf-right-default: 560px; }
.wf.view { grid-template-columns: minmax(0, 1fr) 8px var(--wf-right, var(--wf-right-default)); }
.wf.pal-collapsed { --wf-left-default: 36px; }
.wf.pal-collapsed { grid-template-columns: 36px 8px minmax(0, 1fr) 8px var(--wf-right, var(--wf-right-default)); }
.wf.pal-collapsed .wf-palette { grid-template-columns: 34px; }
.wf.pal-collapsed .wf-gutter-left { pointer-events: none; opacity: 0; }
.wf-gutter { align-self: stretch; min-height: 60vh; width: 8px; border-radius: 4px; cursor: col-resize; background: transparent; position: sticky; top: 12px; max-height: calc(100vh - 24px); }
.wf-gutter:hover, .wf-gutter.dragging { background: var(--teal-mid); }
.wf.resizing { user-select: none; cursor: col-resize; }
.pal-collapse { border: 0; background: transparent; color: var(--ink-2); padding: 6px 0; margin: 0 0 4px; cursor: pointer; display: flex; justify-content: center; width: 100%; border-bottom: 1px solid var(--line); }
.pal-collapse:hover { background: var(--surface-3); color: var(--teal-dark); }
.insp-tools { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.insp-tools .spacer, .wf-filter .spacer { flex: 1; }
.modal.insp-modal { width: min(1100px, 96vw); max-height: 92vh; overflow: auto; }
.insp-in-modal { position: static; max-height: none; border: 0; padding: 4px 2px; overflow: visible; }
.insp-in-modal .field input, .insp-in-modal .field select, .insp-in-modal .field textarea { width: 100%; }
@media (max-width: 1300px) { .wf { --wf-left-default: 232px; --wf-right-default: 280px; } .wf.tpl-wide { --wf-left-default: 332px; --wf-right-default: 260px; } .wf.insp-wide { --wf-right-default: 480px; } }
@media (max-width: 1000px) { .wf, .wf.tpl-wide, .wf.pal-collapsed, .wf.insp-wide { grid-template-columns: 1fr; } .wf-gutter { display: none; } .wf.pal-collapsed .wf-palette { grid-template-columns: 34px minmax(0, 1fr); } }

.wf-palette { display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 0; overflow: hidden; }
.wf-palette .pal-tabs { position: static; flex-direction: column; justify-content: flex-start; gap: 4px; margin: 0; padding: 8px 0; background: var(--surface-2); border-bottom: 0; border-right: 1px solid var(--line); min-height: 100%; }
.wf-palette .pal-tab { flex: none; writing-mode: vertical-rl; transform: rotate(180deg); display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  width: 100%; padding: 12px 0; margin: 0; border: 0; border-bottom: 0; line-height: 1; letter-spacing: .02em; white-space: nowrap; }
.wf-palette .pal-tab:hover { background: var(--surface-3); }
/* rotated 180°: an inset on the left of the button shows on its right, next to the content */
.wf-palette .pal-tab.active { color: var(--teal-dark); background: var(--card); box-shadow: inset 3px 0 0 var(--teal); }
.wf-palette .pal-tab .cnt { margin: 0; padding: 5px 0; min-width: 16px; border-radius: 9px; text-align: center; line-height: 1; }
.wf-palette .pal-body { min-width: 0; padding: 10px 12px; max-height: calc(100vh - 24px); overflow: auto; }
.wf-palette .pal-body > h4:first-child { margin-top: 0; }
@media (max-width: 1000px) { .wf-palette .pal-body { max-height: none; } }
@media print { .wf-palette { display: block; } .wf-palette .pal-tabs { display: none; } }
/* blocks next to the rail: name on the first line, hint below (no mid-word breaks in the narrower column) */
.wf-palette .wf-pal.kind-op, .wf-palette .wf-pal.kind-phase { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 1px; align-items: center; }
.wf-palette .wf-pal.kind-op > span:nth-child(2), .wf-palette .wf-pal.kind-phase > span:nth-child(2) { font-weight: 600; overflow-wrap: normal; word-break: normal; }
.wf-palette .wf-pal.kind-op .muted, .wf-palette .wf-pal.kind-phase .muted { grid-column: 2; margin: 0; max-width: none; text-align: left; overflow-wrap: normal; }
.wf-palette .wf-pal.kind-step .muted, .wf-palette .wf-pal.kind-act .muted { overflow-wrap: normal; word-break: normal; }

/* ---------------------------------------------------------------- sign-in and accounts */
.nav-author .signed-in { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.nav-author .author-name { color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.nav-author .author-name:hover { color: var(--teal-dark); }
.signout-form { margin: 0; display: inline-flex; }
.topbar.fit-2 .nav-author .author-name { max-width: 100px; }
.account-shell { min-height: 100%; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--teal-light) 0, var(--bg) 320px); }
.account-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--card); border-bottom: 2px solid var(--teal); }
.account-top .lang-pick { flex-direction: row; align-items: center; gap: 6px; }
.account-top .lang-pick select { max-width: 200px; padding: 4px 6px; font-size: 12px; }
.account-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px 24px; }
.account-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: 10px; padding: 24px 26px; box-shadow: 0 8px 28px rgba(16, 24, 40, .08); }
.account-card h1 { margin-bottom: 10px; }
.account-form { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.account-form label { font-size: 13px; font-weight: 600; }
.account-form input { font-size: 14px; padding: 8px 10px; }
.account-form .btn.primary { justify-content: center; padding: 9px 14px; font-size: 14px; }
.account-row { display: flex; gap: 8px; flex-wrap: wrap; }
.account-row .btn.primary { flex: 1; }
.account-msg { padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.account-msg.err { background: var(--err-bg); color: var(--err); border: 1px solid #F3C1C1; }
.account-msg.info { background: var(--teal-light); color: var(--teal-dark); border: 1px solid var(--teal-mid); }
.account-cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }
.account-signout { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.account-foot { text-align: center; padding: 14px 16px 20px; }
.users-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.users-add input { width: 200px; }
.users-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.users-notice.ok { border-left: 5px solid var(--ok); }
.users-notice.err { border-left: 5px solid var(--err); color: var(--err); }
.users-temp code { font-size: 14px; padding: 2px 8px; background: var(--warn-bg); border: 1px solid #F3D9A4; user-select: all; }
.users-notice .btn { margin-left: auto; }
.users-table td { vertical-align: middle; }
.users-table select { padding: 3px 6px; }
.users-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* site filter in the top bar; materials page */
.site-pick select { max-width: 120px; }
.mat-filters .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.mat-table td { vertical-align: middle; } .mat-table .nowrap { white-space: nowrap; }
.mat-detail td { background: var(--bg); }
.mat-components { width: 100%; font-size: 12px; } .mat-components td, .mat-components th { padding: 3px 6px; }

/* inspector: CPP / CQA mark, materials and quality sections */
.insp-mark { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; margin: 0 0 8px; padding: 6px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.insp-mark label { font-size: 12px; } .insp-mark select { padding: 3px 6px; }
.insp-details > summary { list-style: none; cursor: pointer; } .insp-details > summary::-webkit-details-marker { display: none; }
.insp-details > summary h4 { display: inline; }
.insp-details > summary h4::before { content: "▸ "; color: var(--ink-2); } .insp-details[open] > summary h4::before { content: "▾ "; }
.mat-row, .qm-links td { align-items: center; }
.mat-add input, .qm-add input { width: 110px; } .mat-add input:first-child, .qm-add input:first-child { width: 150px; }
.qm-links { font-size: 12px; } .qm-links select { padding: 2px 4px; }
.tag.crit-critical, .crit.crit-critical { background: var(--err-bg); color: var(--err); border-color: #F0A28E; }

/* inspector review: the exceptions report for the selected element */
.insp-review { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 6px 8px; margin: 0 0 10px; background: var(--surface-2); }
.insp-review.has-major { border-left-color: var(--warn); }
.insp-review.has-critical { border-left-color: var(--err); }
.insp-review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.insp-review-list { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 6px; }
.insp-review-list li { font-size: 12px; line-height: 1.35; padding: 4px 6px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); }
.insp-review-list li.sev-critical { border-color: #F0A28E; } .insp-review-list li.sev-major { border-color: #F3D9A4; }
.chip.sev-critical { background: var(--err-bg); color: var(--err); border-color: #F0A28E; }
.chip.sev-major { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.chip.sev-minor { background: #EEF0FA; color: var(--draft); border-color: #C9CFF0; }

/* documents linked to an element (Element Documents): inline images and links in the MBR, rows in the inspector */
.doc-links { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; margin: 4px 0; }
.doc-fig { margin: 0; max-width: 320px; }
.doc-fig img { max-width: 100%; max-height: 240px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }
.doc-fig figcaption { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.doc-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--teal-dark); text-decoration: none; }
.doc-link:hover { border-color: var(--teal); }
.doc-link .muted { font-size: 12px; }
.doc-row { align-items: center; }
.doc-add { flex-wrap: wrap; }
.doc-add input:first-child { width: 140px; }
@media print { .doc-link::after { content: " (" attr(href) ")"; font-size: 12px; color: #555; } .doc-fig img { max-height: 160px; } }

/* editing a template's contents in the builder (working record) */
.wf-template-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; margin: 0 0 8px; border: 1px solid #D9A648; border-left-width: 5px; border-radius: var(--radius); background: #FFF6E0; }
.wf-template-banner .spacer { flex: 1; }

/* templates page and generated batches page */
.tpl-filters .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tpl-table td { vertical-align: middle; }
.tpl-table .nowrap, .batches-table .nowrap { white-space: nowrap; }
.tpl-table .wf-pal-ico { display: inline-flex; margin-right: 4px; }
.tpl-actions-cell { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.ib-tol input { border-style: dashed; }
.ib-cpp-tol { font-weight: 400; opacity: .85; }
.rbar-band.tol { background: #8FD094; border-color: #1B5E20; top: 20%; bottom: 20%; }
.rbar-dot.warn { background: #B26A00; box-shadow: 0 0 0 1px #B26A00; }
.tpl-modal { width: 640px; max-height: 92vh; overflow-y: auto; }
.tpl-form { display: grid; gap: 2px; }
.tpl-form label { margin-top: 6px; }
.field-help { margin: 2px 0 6px; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.field-help em { font-style: italic; }
.tpl-modal-sub { margin: 8px 0 2px; font-size: 13px; color: var(--ink-2); }
.tpl-facts { margin: 0 0 4px; } .tpl-facts td { vertical-align: top; }
.tpl-peek-row td { background: var(--bg); }
.tpl-peek-row .tpl-peek { margin: 4px 0 0; }
.tpl-table .builtin, .tpl-table .mine { font-size: 12px; }
.batches-table td { vertical-align: middle; }
.batches-table .users-actions { justify-content: flex-start; }
:lang(th) body, :lang(th) input, :lang(th) select, :lang(th) button { font-family: "Segoe UI", "Leelawadee UI", "Leelawadee", "Tahoma", "Noto Sans Thai", sans-serif; }
:lang(th) body { line-height: 1.55; }
:lang(th) .nav-label { letter-spacing: 0; }

/* ---------------------------------------------------------------- e-signature and N/A rules */
.sig-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: #F3E8FF; color: #5B21B6; border: 1px solid #D8B4FE; white-space: nowrap; line-height: 1.5; }
.sig-chip.on { margin-left: 6px; vertical-align: middle; }
.sig-chip.na { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin: 2px 0 6px; }
.sig-grid label { font-size: 12px; min-width: 0; }
.sig-grid label.wide { grid-column: 1 / -1; }
.sig-grid label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; }
.sig-grid select, .sig-grid input:not([type=checkbox]) { min-width: 0; font-size: 12px; padding: 4px 6px; }
.sig-effect { margin: 0 0 8px; color: #5B21B6; }
.sig-block { margin: 6px 0 2px; padding: 6px 10px; border: 1px dashed #C4B5FD; border-radius: 6px; background: #FAF5FF; font-size: 12px; }
.sig-block .sig-title { font-weight: 700; color: #5B21B6; margin-right: 6px; }
.sig-block .sig-lines { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.sig-block .sig-line { white-space: nowrap; }
.sig-block .sig-line .blank { display: inline-block; min-width: 120px; border-bottom: 1px solid var(--ink-2); margin-left: 4px; }
.sig-block.na-block { border-color: #CBD5E1; background: #F8FAFC; }
.sig-block.na-block .sig-title { color: #334155; }
.sig-block.missing { border-style: solid; border-color: var(--err); background: var(--err-bg); }
.na-banner { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; background: #E2E8F0; color: #1E293B; font-size: 12px; font-weight: 700; }
.ebr-status.s-notapplicable { background: #E2E8F0; color: #1E293B; }
tr.act-na td { color: var(--muted); }
@media print { .sig-block { break-inside: avoid; } }

/* ---------------------------------------------------------------- payload part files */
.payload-format { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.payload-parts { margin: 0 0 10px; padding-left: 18px; }
.payload-parts li { margin: 2px 0; }
.payload-parts code { margin-right: 4px; }

/* ---------------------------------------------------------------- simulated batch generator */
.batch-gen { flex-basis: 100%; margin: 6px 0 0; padding: 10px 12px; }
.batch-gen-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; margin-bottom: 6px; }
.batch-gen-grid input:not([type=checkbox]) { width: 160px; }
.batch-bar { flex-wrap: wrap; }
.data-paths code { word-break: break-all; font-size: 12px; }

/* the page head and the filter bars scroll with the page (they were sticky until R1.3); the builder's side panels and the
   editor's side column still keep to the viewport below the top bar */
@media (min-width: 1001px) {
  .batch-bar { background: var(--bg); padding-top: 4px; padding-bottom: 4px; }
  .wf-palette, .wf-inspector, .wf-gutter { top: 12px; max-height: calc(100vh - 24px); }
  .wf-palette .pal-body { max-height: calc(100vh - 24px); }
  .editor-side { top: 16px; max-height: calc(100vh - 32px); }
}
@media print { .page-head, .filters.card, .wf-filter, .batch-bar { position: static; } }

/* ---- equipment register, state models and logbooks ---- */
.sk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.sk::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.sk-available { background: #E8F5E9; color: #1B5E20; border-color: #BFE3C1; }
.sk-inuse { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.sk-dirty { background: #FFF3E0; color: #8A4B00; border-color: #F3D9A4; }
.sk-cleaning { background: #E3F2FD; color: #0D47A1; border-color: #BBDEFB; }
.sk-clean { background: #E8F5E9; color: #2E7D32; border-color: #A5D6A7; }
.sk-maintenance { background: #EDE7F6; color: #4527A0; border-color: #D1C4E9; }
.sk-calibration { background: #E8EAF6; color: #283593; border-color: #C5CAE9; }
.sk-outofservice { background: var(--err-bg); color: var(--err); border-color: #F5C6C6; }
.sk-retired { background: var(--surface-3); color: #546E7A; border-color: #CFD8DC; }
.sk-custom { background: var(--bg); color: var(--ink-2); }
.eq-table td { vertical-align: middle; }
.eq-since { display: block; font-size: 12px; color: var(--muted); }
.eq-hold { display: inline-block; font-size: 12px; color: #8A4B00; }
.eq-hold.over, .eq-cal.over { color: var(--err); font-weight: 600; }
.eq-cal { font-size: 12px; white-space: nowrap; }
.eq-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.eq-actions select { max-width: 200px; }
.eq-detail td { background: var(--bg); padding: 10px 14px; }
.eq-detail h4, .eq-detail .h4 { margin: 4px 0 6px; font-size: 12px; }
.eq-detail .table { background: var(--card); font-size: 12px; }
.eq-modal .tpl-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.eq-modal .tpl-form label.check { flex-direction: row; align-items: center; gap: 6px; }
.eq-modal .grid-2 { margin-top: 4px; }
.eq-summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.eq-summary .sk { cursor: pointer; }
.eq-summary .sk.active { outline: 2px solid var(--teal); }
.log-table td { font-size: 12px; }
.log-table .comment { max-width: 420px; white-space: pre-wrap; }
.log-table tr.system td { color: var(--ink-2); background: var(--surface-2); }
.log-corrected { font-size: 12px; color: var(--err); }
.log-signed { color: var(--approved); font-size: 12px; font-weight: 600; }

/* state diagram editor: the builder's three-column grid (.wf) with the SVG canvas in the middle */
.sd-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; min-height: 60vh; position: relative;
  background-image: linear-gradient(var(--bg) 1px, transparent 1px), linear-gradient(90deg, var(--bg) 1px, transparent 1px); background-size: 20px 20px; }
.sd-canvas { display: block; min-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.sd-canvas.over { outline: 2px dashed var(--teal); outline-offset: -2px; }
.sd-node { cursor: grab; }
.sd-node.dragging { cursor: grabbing; opacity: .85; }
.sd-node rect.box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.sd-node.sel rect.box { stroke: var(--teal); stroke-width: 2.5; }
.sd-node.target rect.box { stroke: var(--teal); stroke-dasharray: 4 3; stroke-width: 2.5; }
.sd-node rect.band { stroke: none; }
.sd-node text { font-family: "Segoe UI", system-ui, sans-serif; pointer-events: none; }
.sd-node text.name { font-size: 13px; font-weight: 600; fill: var(--ink); }
.sd-node text.kind { font-size: 12px; fill: var(--muted); }
.sd-node .initial { fill: var(--teal); }
.sd-node .port { fill: var(--card); stroke: var(--teal); stroke-width: 2; cursor: crosshair; }
.sd-node .port:hover { fill: var(--teal); }
.sd-node text.hold { font-size: 12px; fill: #8A4B00; }
.sd-band-available { fill: #43A047; } .sd-band-inuse { fill: var(--teal); } .sd-band-dirty { fill: #FB8C00; } .sd-band-cleaning { fill: #1E88E5; }
.sd-band-clean { fill: #66BB6A; } .sd-band-maintenance { fill: #5E35B1; } .sd-band-calibration { fill: #3949AB; } .sd-band-outofservice { fill: #C62828; }
.sd-band-retired { fill: #78909C; } .sd-band-custom { fill: #90A4AE; }
.sd-edge path { fill: none; stroke: #607D8B; stroke-width: 1.8; cursor: pointer; }
.sd-edge path.hit { stroke: transparent; stroke-width: 12; }
.sd-edge.sel path.line { stroke: var(--teal); stroke-width: 2.6; }
.sd-edge.expiry path.line { stroke-dasharray: 5 3; stroke: #8A4B00; }
.sd-edge.auto path.line { stroke-dasharray: 8 3; stroke: #3949AB; }
.sd-edge.auto.sel path.line { stroke: var(--teal); }
.sd-card .chip.auto { background: #E8EAF6; color: #283593; }
.wf-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.sd-edge text { font-size: 12px; fill: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; cursor: pointer; }
.sd-edge.sel text { fill: var(--teal-dark); font-weight: 600; }
.sd-edge rect { fill: var(--card); fill-opacity: .92; }
.sd-edge .badge circle { fill: var(--card); stroke: #607D8B; stroke-width: 1.6; }
.sd-edge .badge text { font-weight: 700; font-size: 12px; }
.sd-edge.sel .badge circle { stroke: var(--teal); fill: var(--teal-light); }
.sd-siblings { display: flex; align-items: center; gap: 4px; margin: -4px 0 8px; padding: 4px 8px; background: var(--bg); border-radius: 4px; }
.sd-rubber { stroke: var(--teal); stroke-width: 2; stroke-dasharray: 5 3; pointer-events: none; }
.sd-pal { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: grab; font-size: 12px; }
.sd-pal:hover { border-color: var(--teal); }
.sd-pal .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sd-state-pick { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 6px; }
.sd-state-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sd-state-pick select { width: 100%; font-size: 14px; font-weight: 600; padding: 9px 10px; }
.sd-list { list-style: none; margin: 0; padding: 0; }
.sd-list li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.sd-list li:hover { background: var(--bg); } .sd-list li.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.sd-insp label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin-bottom: 8px; }
.sd-insp label.check { flex-direction: row; align-items: center; gap: 6px; }
.sd-insp .field-help { margin: -4px 0 8px; }
.sd-problems { background: var(--err-bg); border: 1px solid #F5C6C6; border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; font-size: 12px; }
.sd-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
@media print { .sd-wrap { overflow: visible; min-height: 0; } }

/* ---- batch execution (launcher and cockpit) ---- */
.ex-bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.ex-bar-fill { height: 100%; background: var(--teal); }
.ex-bar-row .ex-bar { width: 180px; }
.ex-cockpit .wf-palette h4, .ex-cockpit .wf-palette .h4 { margin-top: 0; }
.ex-tree-op { display: flex; align-items: center; gap: 6px; padding: 5px 6px; margin-top: 6px; border-radius: 4px; font-size: 12px; }
.ex-tree-ph { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 18px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.ex-tree-ph:hover { background: var(--bg); } .ex-tree-ph.focus { background: var(--teal-light); }
.ex-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.ex-tree-op.done .ex-dot, .ex-tree-ph.done .ex-dot { background: var(--ok); }
.ex-tree-op.current .ex-dot, .ex-tree-ph.current .ex-dot { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-light); }
.ex-tree-op.current, .ex-tree-ph.current { font-weight: 600; }
.ex-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.ex-group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.ex-group-head h3, .ex-group-head .h3 { margin: 2px 0 0; font-size: 16px; }
.ex-group-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ex-acts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ex-act { border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius); padding: 8px 12px; background: var(--card); }
.ex-act.locked { opacity: .6; border-left-color: var(--line); }
.ex-act.current { border-left-color: var(--teal); box-shadow: 0 2px 10px rgba(53, 87, 199,.15); }
.ex-act.done { border-left-color: var(--ok); } .ex-act.tol { border-left-color: #FB8C00; } .ex-act.fail { border-left-color: var(--err); } .ex-act.skipped { border-left-color: #90A4AE; }
.ex-act-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ex-act-no { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ex-act-id { margin-left: auto; }
.ex-act-desc { font-size: 13px; }
.ex-limits { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.ex-entry { margin-top: 6px; padding: 6px 10px; background: var(--bg); border-radius: 4px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ex-entry .small { flex-basis: auto; }
.ex-entry-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; width: 100%; }
.ex-old { width: 100%; }
.ex-lists h4, .ex-lists .h4 { margin: 12px 0 6px; }
.ex-context h4, .ex-context .h4 { margin: 12px 0 4px; font-size: 12px; }
@media print { .ex-act.locked { opacity: 1; } .ex-entry-actions, .ex-bar-row .check { display: none; } }

/* ---- administration ---- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-grid .card { margin-bottom: 14px; }
.table.kv th { width: 180px; white-space: nowrap; font-weight: 600; color: var(--ink-2); background: transparent; }
.admin-stores code.small { font-size: 12px; }
.admin-backups { columns: 2; }
.admin-danger { border-color: var(--err); }
.admin-danger h2 { color: var(--err); }
.reset-confirm { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 8px; }
.reset-confirm label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.reset-confirm input { min-width: 180px; }
.admin-result { margin-top: 10px; padding: 8px 12px; background: var(--bg); border-radius: var(--radius); font-size: 12px; }
.admin-result p { margin: 0 0 6px; }
.admin-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.admin-links .home-card { min-height: 0; }
@media (max-width: 1100px) { .admin-grid, .admin-links { grid-template-columns: 1fr; } .admin-backups { columns: 1; } }

/* ---- home dashboard ---- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 14px; }
.kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 10px; align-items: center; padding: 10px 14px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.kpi:hover { border-color: var(--teal); text-decoration: none; box-shadow: 0 2px 10px rgba(53, 87, 199,.12); }
.kpi.warn { border-left: 5px solid #E8A33D; }
.kpi-ico { grid-row: 1 / span 2; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--teal-light); color: var(--teal-dark); }
.kpi-num { font-size: 22px; font-weight: 700; color: var(--teal-dark); line-height: 1.1; }
.kpi-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.kpi-sub { grid-column: 1 / span 2; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.dash-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line-strong); border-top: 4px solid var(--teal); border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); min-width: 0; }
.dash-head { display: flex; align-items: center; gap: 8px; }
.dash-head h3, .dash-head .h3 { margin: 0; font-size: 16px; color: var(--teal-dark); }
.dash-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--teal-light); color: var(--teal-dark); flex: none; }
.dash-figure { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.dash-card p { margin: 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; align-items: center; }
.dash-card .eq-summary { margin: 0; }
.dash-card .eq-summary .sk { text-decoration: none; }
.dash-panel { margin-bottom: 14px; }
.home-cols .dash-panel { margin-bottom: 0; }
.panel-head .btn.tiny { vertical-align: middle; }
.home-activity .tag { flex: none; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } }

/* a plain palette (state diagram editor, execution cockpit): the builder's tab column does not apply */
.wf-palette.plain { display: block; grid-template-columns: none; padding: 10px 12px; overflow: auto; }
.wf-palette.plain h4, .plain .h4 { margin: 12px 0 6px; } .wf-palette.plain > h4:first-child { margin-top: 0; }
.wf-palette.plain > p { margin: 0 0 8px; }
.sd-pal { margin-bottom: 4px; padding: 5px 8px; }
.sd-list li { padding: 3px 8px; }
.wf.pal-collapsed .wf-palette.plain { display: none; }

/* dialogs built on .tpl-form: controls fit the dialog width (a long option text must not widen a select beyond it) */
.eq-modal .tpl-form { min-width: 0; }
.eq-modal .tpl-form > * { min-width: 0; }
.eq-modal .tpl-form label > input, .eq-modal .tpl-form label > select, .eq-modal .tpl-form label > textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.eq-modal .tpl-form label > input[type=checkbox] { width: auto; }
.eq-modal .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.eq-modal .grid-2 > label { min-width: 0; }
.eq-modal .actions { flex-wrap: wrap; }

/* ---- guided wizard: stages, groups, rail ---- */
.wiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.wiz-rail { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
.wiz-rail .panel-head h4, .wiz-rail .panel-head .h4 { font-size: 12px; }
.wiz-sum > div { display: grid; grid-template-columns: 96px 1fr; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 12px; align-items: baseline; }
.wiz-sum > div:last-child { border-bottom: 0; }
.wiz-intro { margin: 0 0 12px; padding: 8px 12px; background: var(--teal-light); border-left: 4px solid var(--teal); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }
.wiz-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wiz-groups.two { grid-template-columns: 1fr 1fr; }
.wiz-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; min-width: 0; background: var(--card); }
.wiz-group.wide { grid-column: 1 / -1; }
.wiz-group legend { font-weight: 700; color: var(--teal-dark); padding: 0 6px; font-size: 13px; }
.wiz-group > label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin-top: 8px; }
.wiz-group .grid-2 > label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin-top: 8px; }
.wiz-group .grid-2 { gap: 6px 12px; }
.wiz-group input, .wiz-group select, .wiz-group textarea { width: 100%; box-sizing: border-box; min-width: 0; }
.wiz-group .field-help { margin: 3px 0 2px; }
.wiz-group .mini-edit { margin-top: 8px; }
.wiz-issues { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wiz-issues li { display: flex; gap: 6px; align-items: baseline; padding: 3px 6px; border-radius: 4px; background: var(--bg); }
.wiz-issues li.err { background: var(--err-bg); } .wiz-issues li.warn { background: var(--warn-bg); }
.wiz-marks { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.wiz-marks label { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.wiz-marks select { width: 110px; }
.wiz-help p { margin: 0 0 8px; }
.wiz-created h3, .wiz-created .h3 { margin: 0 0 6px; }
.wiz-next { padding-left: 20px; } .wiz-next li { margin: 6px 0; }
.steps li .badge { margin-left: auto; }
@media (max-width: 1100px) { .wiz-layout { grid-template-columns: 1fr; } .wiz-rail { position: static; } .wiz-groups, .wiz-groups.two { grid-template-columns: 1fr; } }

/* ---- tree dropdown (TreeSelect) ---- */
.tsel { position: relative; display: inline-block; min-width: 220px; max-width: 100%; }
.tsel-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.tsel-btn:hover, .tsel.open .tsel-btn { border-color: var(--teal); }
.tsel-btn.has { border-color: var(--teal-mid); background: var(--teal-light); }
.tsel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.tsel-clear { color: var(--muted); font-size: 12px; padding: 0 3px; border-radius: 3px; } .tsel-clear:hover { background: var(--err-bg); color: var(--err); }
.tsel-backdrop { position: fixed; inset: 0; z-index: 40; }
.tsel-pop { position: absolute; z-index: 41; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(520px, 90vw); background: var(--card); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; }
.tsel-search { width: 100%; box-sizing: border-box; margin-bottom: 4px; font-size: 12px; padding: 5px 8px; }
.tsel-list { max-height: 360px; overflow: auto; }
.tsel-row { display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tsel-row:hover { background: var(--bg); }
.tsel-row.sel { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.tsel-row.all { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 2px; border-radius: 4px 4px 0 0; }
.tsel-row.site .tsel-text { font-weight: 700; } .tsel-row.class .tsel-text { font-weight: 600; } .tsel-row.line .tsel-text { color: var(--ink-2); } .tsel-row.item .tsel-text { font-family: var(--mono); font-size: 12px; }
.tsel-row.category .tsel-text { font-weight: 700; }
.tsel-tog { width: 14px; text-align: center; color: var(--muted); flex: none; font-size: 12px; } .tsel-tog.leaf { visibility: hidden; }
.tsel-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; } .tsel-text .muted { font-family: var(--font, inherit); }
.tsel-count { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; }
.tsel-empty { padding: 6px 8px; }
.filter-row .tsel { min-width: 260px; }
.eq-modal .tpl-form label > .tsel { width: 100%; }

/* ---- two-list picker (DualListPicker) ---- */
.dlp { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); gap: 6px; margin: 6px 0 8px; }
.dlp-side { min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); display: flex; flex-direction: column; }
.dlp-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--bg); border-radius: var(--radius) var(--radius) 0 0; font-size: 12px; }
.dlp-head .dlp-filter { flex: 1; min-width: 60px; font-size: 12px; padding: 3px 6px; }
.dlp-pane { height: var(--dlp-h, 280px); overflow: auto; padding: 4px 4px 12px; }
.dlp-pane.target { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--teal-light); }
.dlp-pane.over { background: var(--teal-light); box-shadow: inset 0 0 0 2px var(--teal); }
.dlp-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 16px; }
.dlp-group { display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin-top: 2px; border-radius: 4px; font-size: 12px; font-weight: 700; color: var(--teal-dark); background: var(--surface-2); cursor: grab; }
.dlp-group:hover { background: var(--surface-3); }
.dlp-tog { width: 12px; text-align: center; color: var(--muted); cursor: pointer; }
.dlp-glabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlp-count { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; }
.dlp-item { display: flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 4px; font-size: 12px; cursor: grab; border: 1px solid transparent; }
.dlp-item:hover { background: var(--bg); border-color: var(--line); }
.dlp-item.locked { cursor: default; color: var(--ink-2); }
.dlp-item .dlp-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlp-item .dlp-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dlp-item.hazard .dlp-label { color: #A2330A; } .dlp-item.ppe .dlp-label { color: #0D47A1; } .dlp-item.class .dlp-label, .dlp-item.item .dlp-label { color: #005662; font-weight: 600; }
.dlp-item.activity .dlp-label { font-family: var(--mono); font-size: 12px; }
.dlp-move { margin-left: auto; padding: 0 6px; line-height: 1.3; flex: none; opacity: .5; } .dlp-item:hover .dlp-move, .dlp-group:hover .dlp-move { opacity: 1; }
.dlp-lock { margin-left: auto; font-size: 12px; }
.dlp-empty { padding: 10px 8px; }
.wf-inspector .dlp { grid-template-columns: 1fr; } .wf-inspector .dlp-mid { flex-direction: row; height: 18px; } .wf-inspector .dlp-pane { height: 170px; }
@media (max-width: 900px) { .dlp { grid-template-columns: 1fr; } .dlp-mid { flex-direction: row; } }
.tsel-pick { border: 1px solid var(--line); background: var(--card); color: var(--teal-dark); border-radius: 4px; font-size: 12px; padding: 0 5px; cursor: pointer; line-height: 1.4; } .tsel-pick:hover { border-color: var(--teal); background: var(--teal-light); }
.tsel-hint { padding: 4px 6px 0; border-top: 1px solid var(--line); margin-top: 4px; }

/* ---- state model focus view: transition cards along the top, the selected state and its neighbours below ---- */
.sd-strip { display: flex; gap: 8px; align-items: stretch; overflow-x: auto; padding: 8px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.sd-strip-head { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 10px 4px 4px; border-right: 1px solid var(--line); min-width: 90px; }
.sd-card { flex: none; width: 200px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.sd-card:hover { border-color: var(--teal); }
.sd-card.active { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: var(--teal-light); }
.sd-card.expiry { border-style: dashed; border-color: #C58B3C; }
.sd-card.add { cursor: default; border-style: dashed; background: var(--card); justify-content: center; }
.sd-card.add select { font-size: 12px; }
.sd-card .act { font-weight: 700; font-size: 13px; color: var(--ink); }
.sd-card .to { font-size: 12px; }
.sd-card .chips { display: flex; flex-wrap: wrap; gap: 3px; }
.sd-card .chip { font-size: 12px; padding: 1px 6px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); }
.sd-card .chip.faint { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.sd-wrap.focus { min-height: 0; }
.sd-node.pick { cursor: pointer; }
.sd-node.focus rect.box { stroke: var(--teal); stroke-width: 2.5; }
.sd-node.source rect.box { stroke-dasharray: 4 3; }
.sd-node.source text { fill: var(--muted); }
.sd-edge.dim path.line { stroke: #B0BEC5; }

/* ---- change-status dialog with the focus view ---- */
.tpl-modal.eq-modal.wide { width: 1000px; }
.eq-modal .sd-focus-view .sd-wrap.focus { max-height: 440px; }
.sd-wrap.focus .sd-canvas { margin: 0 auto; min-width: 0; }
.eq-modal .sd-focus-view .sd-strip { margin-bottom: 6px; }
.eq-change-head { font-size: 16px; margin: 8px 0 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sd-node.pick.static, .sd-node.static { cursor: default; }
fieldset.sd-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.sd-fields:disabled input, fieldset.sd-fields:disabled select, fieldset.sd-fields:disabled textarea { background: var(--bg); color: var(--ink); opacity: 1; }
.sd-card.static { cursor: default; }

/* ---- state model view page ---- */
.smv-head .smv-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .smv-head h2 { margin: 0; }
.smv-pick { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; } .smv-pick select { width: 100%; max-width: none; font-size: 14px; font-weight: 600; padding: 8px 10px; }
.smv-diagram .sd-wrap { min-height: 0; } .sd-wrap.sd-static { min-height: 0; }
.smv-table tr { cursor: pointer; } .smv-table tr.sel td { background: var(--teal-light); }
@media print { .smv-diagram .sd-strip { overflow: visible; flex-wrap: wrap; } .smv-diagram .sd-wrap { overflow: visible; } .smv-table tr { cursor: default; } }

/* ---- reviews landing page ---- */
.rv-kpis { margin-bottom: 14px; }
.rv-kpis .kpi { text-decoration: none; }

/* ============================================================ reports as nested rows
   A report table shows one short main row per item (td.nr-m) and its remaining columns as indented label / value rows
   beneath it (td.nr-d: label .nr-l, value .nr-v). The header row stays in the markup for assistive technology. */
.mbr table.doc.nested, table.nested { display: block; width: 100% !important; min-width: 0 !important; border: 0; table-layout: auto; }
.mbr table.doc.nested > colgroup, table.nested > colgroup { display: none; }
.mbr table.doc.nested > thead, table.nested > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; display: block; }
.mbr table.doc.nested > tbody, table.nested > tbody { display: block; }
.mbr table.doc.nested > tbody > tr, table.nested > tbody > tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 14px; padding: 8px 10px; border-bottom: 1px solid var(--line); break-inside: avoid; }
.mbr table.doc.nested > tbody > tr > td, table.nested > tbody > tr > td { display: block; border: 0; padding: 0; text-align: left; width: auto; min-width: 0; background: transparent; }
.mbr table.doc.nested > tbody > tr > td.nr-m, table.nested > tbody > tr > td.nr-m { order: 1; font-size: 13px; }
.mbr table.doc.nested > tbody > tr > td.nr-wide, table.nested > tbody > tr > td.nr-wide { flex: 1 1 320px; }
.mbr table.doc.nested > tbody > tr > td.nr-d, table.nested > tbody > tr > td.nr-d { order: 2; flex: 0 0 100%; display: grid; grid-template-columns: minmax(110px, 190px) minmax(0, 1fr); column-gap: 14px; padding: 1px 0 1px 30px; box-sizing: border-box; }
.mbr table.doc.nested > tbody > tr > td.nr-e, table.nested > tbody > tr > td.nr-e { display: none; }
.mbr table.doc.nested > tbody > tr > td[colspan], table.nested > tbody > tr > td[colspan] { flex: 0 0 100%; }
/* a detail without a value takes no line */
.mbr table.doc.nested > tbody > tr > td.nr-d:has(> .nr-v:empty), table.nested > tbody > tr > td.nr-d:has(> .nr-v:empty) { display: none; }
table.nested .nr-l { color: var(--ink-2, #55627a); font-size: 12px; }
table.nested .nr-l::after { content: ":"; }
table.nested .nr-v { min-width: 0; overflow-wrap: anywhere; }
/* values span the full width of the row: no cell or signature keeps its old column limit, and a signature reads on one line */
.mbr table.doc.nested > tbody > tr > td, table.nested > tbody > tr > td { max-width: none !important; }
table.nested .nr-v, table.nested .nr-v > * { max-width: none; }
table.nested .nr-v { width: 100%; }
table.nested .nr-v .sig-name, table.nested .nr-v .sig-at, table.nested .nr-v .sig-meaning, table.nested .nr-v .sig-reason,
table.nested .nr-m .sig-name, table.nested .nr-m .sig-at, table.nested .nr-m .sig-meaning, table.nested .nr-m .sig-reason { display: inline; max-width: none; white-space: normal; }
table.nested .nr-v .sig-at::before, table.nested .nr-v .sig-meaning::before, table.nested .nr-v .sig-reason::before { content: " · "; color: var(--muted); }
table.nested .nr-v .who, table.nested td.who { white-space: normal; min-width: 0; }
table.nested .step-marks { max-width: none; }
.mbr table.doc.nested > tbody > tr.total, table.nested > tbody > tr.total { border-top: 2px solid var(--line); background: var(--bg); font-weight: 600; }
.mbr table.doc.nested > tbody > tr.phase-head, table.nested > tbody > tr.phase-head { padding: 6px 10px; }
/* the step number and the type keep a steady width so instructions line up */
table.nested.steps-doc > tbody > tr > td.step-cell { flex: 0 0 46px; }
table.nested.steps-doc > tbody > tr > td.nr-m:nth-child(2) { flex: 0 0 118px; }
@media (max-width: 720px) {
  .mbr table.doc.nested > tbody > tr > td.nr-d, table.nested > tbody > tr > td.nr-d { grid-template-columns: 1fr; padding-left: 16px; }
}
@media print {
  .mbr table.doc.nested > tbody > tr, table.nested > tbody > tr { padding: 5px 4px; }
  .mbr table.doc.nested > tbody > tr > td.nr-d, table.nested > tbody > tr > td.nr-d { padding-left: 22px; grid-template-columns: 42mm minmax(0, 1fr); }
}

/* administration: demo set-up */
.admin-demo { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; }
.admin-demo .actions { margin: 10px 0 6px; }
.admin-demo code { font-size: 13px; user-select: all; }

/* administration: section bar, groups, feature switches */
.admin-nav { position: sticky; top: 52px; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 8px 10px; margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.admin-nav a { padding: 5px 10px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 13px; }
.admin-nav a:hover { background: var(--bg); }
.admin-nav .cnt { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg, #FEF3C7); font-size: 11px; }
.admin-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 22px 0 10px; scroll-margin-top: 110px; }
.admin-group-title { margin: 0; font-size: 18px; }
.feat-group { margin: 14px 0 6px; }
.feat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.feat { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.feat.off { background: var(--bg); }
.feat-text { min-width: 0; }
.feat-dep { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.feat-switch { flex: 0 0 44px; width: 44px; height: 24px; margin-top: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--line); position: relative; cursor: pointer; padding: 0; }
.feat-switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .12s; }
.feat-switch.on { background: var(--ok); border-color: var(--ok); }
.feat-switch.on .knob { left: 22px; }
.feat-switch:focus-visible { outline: 2px solid var(--accent, #2f5fb3); outline-offset: 2px; }
.feat-switch:disabled { opacity: .5; cursor: default; }
.feat-confirm { margin: 10px 0; padding: 10px 14px; border: 1px solid var(--warn, #B45309); border-left-width: 5px; border-radius: 8px; background: var(--warn-bg, #FFFBEB); }
.feature-off { max-width: 640px; margin: 40px auto; text-align: center; }
/* key and value tables keep inside their card on a phone */
.table.kv { table-layout: fixed; width: 100%; } .table.kv th { width: 34%; } .table.kv td, .table.kv th { overflow-wrap: anywhere; }

/* ============================================================ list tables as nested rows on a narrow screen
   table.nested-sm is an ordinary table on a wide screen (labels hidden, value wrappers transparent) and becomes
   one main row with labelled detail rows per item below 820 px, so nothing has to be scrolled sideways. */
table.nested-sm .nr-l { display: none; }
table.nested-sm .nr-v { display: contents; }
.table-wrap > .table.smv-table { min-width: 0; }
@media (max-width: 820px) {
  .table-wrap > table.nested-sm, table.nested-sm { display: block; width: 100% !important; min-width: 0 !important; border: 0; }
  table.nested-sm > colgroup { display: none; }
  table.nested-sm > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; display: block; }
  table.nested-sm > tbody { display: block; }
  table.nested-sm > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
  table.nested-sm > tbody > tr > td { display: block; border: 0; padding: 0; text-align: left; width: auto; min-width: 0; max-width: none !important; background: transparent; white-space: normal; }
  table.nested-sm > tbody > tr > td.nr-m { order: 1; }
  table.nested-sm > tbody > tr > td.nr-wide { flex: 1 1 180px; }
  table.nested-sm > tbody > tr > td.nr-d { order: 2; flex: 0 0 100%; display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr); column-gap: 10px; padding: 1px 0 1px 14px; box-sizing: border-box; }
  table.nested-sm > tbody > tr > td.nr-d:has(> .nr-v:empty) { display: none; }
  table.nested-sm > tbody > tr > td[colspan] { flex: 0 0 100%; }
  table.nested-sm .nr-l { display: inline; color: var(--ink-2, #55627a); font-size: 12px; }
  table.nested-sm .nr-l::after { content: ":"; }
  table.nested-sm .nr-v { display: block; min-width: 0; overflow-wrap: anywhere; }
}

/* ============================================================ target, limits and result as one element (LimitView) */
.lv { display: grid; grid-template-columns: minmax(90px, auto) minmax(180px, 1fr) minmax(110px, auto); gap: 4px 18px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; background: var(--card); max-width: 760px; }
.lv.lv-ok { border-left-color: var(--ok); } .lv.lv-warn { border-left-color: #B26A00; } .lv.lv-bad { border-left-color: var(--err); }
.lv-part { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2, #55627a); }
.lv-val { font-size: 15px; font-weight: 700; }
.lv-val.warn { color: #B26A00; } .lv-val.bad { color: var(--err); } .lv-val.none { font-weight: 400; color: var(--muted); }
.lv-result { align-items: flex-end; text-align: right; }
.lv-bar { margin: 4px 0 2px; }
.lv-scale { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 12px; }
.lv-tol { display: inline-flex; gap: 6px; align-items: baseline; }
.lv-extra { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 4px; }
.lv.compact { padding: 5px 10px; gap: 2px 14px; margin: 4px 0; max-width: 620px; } .lv.compact .lv-val { font-size: 13px; }
.lv-step { margin: 4px 0; }
table.nested td.lv-cell .nr-v { max-width: none; }
@media (max-width: 720px) { .lv { grid-template-columns: 1fr 1fr; } .lv-limits { grid-column: 1 / -1; order: 3; } .lv-result { align-items: flex-start; text-align: left; } }
@media print { .lv { break-inside: avoid; border-color: #999; } }
