/* MBR Upload Tool — teal on white; severity palette: red errors, amber placeholders/read-only, green passing. */
:root {
  /* brand */
  --teal: #3557C7; --teal-dark: #23408F; --teal-light: #E9EEFB; --teal-mid: #C3D0F5; --on-brand: #FFFFFF;
  /* surfaces and text */
  --ink: #1B1F23; --ink-2: #4A5561; --muted: #5F6B76; --line: #DCE3E8; --line-strong: #AEB9C4;
  --bg: #F5F7F8; --card: #FFFFFF; --surface-2: #F3F6F8; --surface-3: #E3E8EC;
  /* meaning */
  --err: #C62828; --err-bg: #FDECEC; --warn: #8A5A00; --warn-bg: #FFF4DF; --ok: #2E7D32; --ok-bg: #E8F5E9; --info: #3949AB; --info-bg: #E8EAF6;
  --draft: #5C6BC0; --review: #F9A825; --approved: #2E7D32; --effective: #3557C7; --superseded: #78909C;
  /* scale */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --fs-meta: 12px; --fs-table: 13px; --fs-body: 14px; --fs-section: 16px; --fs-title: 22px;
  --radius: 6px; --radius-lg: 10px; --shadow-1: 0 1px 2px rgba(16, 24, 40, .06); --shadow-2: 0 10px 30px rgba(16, 24, 40, .18);
  --topbar-h: 52px; --nav-w: 232px; --nav-w-collapsed: 60px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; --mono: Consolas, "Cascadia Mono", monospace;
  color-scheme: light;
}
/* dark theme: the same tokens, redefined; chips with their own pastel background keep their own text colour */
:root[data-theme="dark"] {
  --teal-light: #1B2540; --teal-mid: #2A3B66; --teal: #6C8AE8; --teal-dark: #9DB4F4; --on-brand: #0C1327; --err: #FF6B6B; --warn: #E0B25C; --ok: #7BD389; --info: #9FA8DA; --draft: #9FA8DA; --review: #FFD54F; --approved: #7BD389; --effective: #9DB4F4;
  --ink: #E6EBEF; --ink-2: #B8C2CB; --muted: #8C99A4; --line: #2C3942; --line-strong: #3B4A55;
  --bg: #0F1519; --card: #171E24; --surface-2: #1C252C; --surface-3: #243039;
  --err-bg: #3A1B1B; --warn-bg: #3A2E14; --ok-bg: #15301A; --info-bg: #1E2340;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --teal-light: #1B2540; --teal-mid: #2A3B66; --teal: #6C8AE8; --teal-dark: #9DB4F4; --on-brand: #0C1327; --err: #FF6B6B; --warn: #E0B25C; --ok: #7BD389; --info: #9FA8DA; --draft: #9FA8DA; --review: #FFD54F; --approved: #7BD389; --effective: #9DB4F4;
    --ink: #E6EBEF; --ink-2: #B8C2CB; --muted: #8C99A4; --line: #2C3942; --line-strong: #3B4A55;
    --bg: #0F1519; --card: #171E24; --surface-2: #1C252C; --surface-3: #243039;
    --err-bg: #3A1B1B; --warn-bg: #3A2E14; --ok-bg: #15301A; --info-bg: #1E2340;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--teal-dark); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
h4 { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 3px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.error-text { color: var(--err); } .warn-text { color: var(--warn); } .ok-text { color: var(--ok); }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* shell */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px; background: var(--card); border-bottom: 2px solid var(--teal); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: url(logo.svg) center / contain no-repeat; flex: none; }
.brand-release { font-size: 12px; color: var(--teal-dark); background: var(--teal-light); padding: 1px 7px; border-radius: 10px; }
.topnav { display: flex; gap: 2px; }
.topnav a { padding: 6px 12px; border-radius: var(--radius); color: var(--ink-2); font-weight: 500; }
.topnav a:hover { background: var(--bg); text-decoration: none; }
.topnav a.active { color: var(--teal-dark); background: var(--teal-light); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.author { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.author input { width: 130px; }
.db-indicator { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .dot.ok { background: var(--ok); }
.content { flex: 1; padding: 20px 24px; max-width: 1600px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.form-card .grid-3 { margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
label.check, label.radio { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.inline { display: flex; gap: 6px; } .inline input { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-mid); border-color: var(--teal); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--ink-2); }
textarea { width: 100%; resize: vertical; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--teal); color: var(--teal-dark); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--on-brand); } .btn.primary:hover { background: var(--teal-dark); color: var(--on-brand); }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn.small { padding: 4px 9px; font-size: 12px; } .btn.tiny { padding: 1px 6px; font-size: 12px; line-height: 1.4; }
.file-btn { position: relative; overflow: hidden; } .file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.chip.removable { cursor: pointer; background: var(--teal-light); border-color: var(--teal-mid); color: var(--teal-dark); }
.status-draft { background: #EEF0FA; color: var(--draft); border-color: #C9CFF0; }
.status-inreview { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.status-approved { background: var(--ok-bg); color: var(--approved); border-color: #BFE3C1; }
.status-effective { background: var(--teal-light); color: var(--effective); border-color: var(--teal-mid); }
.status-superseded { background: var(--surface-3); color: var(--superseded); border-color: #CFD8DC; }
.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.badge { display: inline-block; min-width: 18px; text-align: center; font-size: 12px; font-weight: 700; padding: 1px 5px; border-radius: 9px; margin-left: 4px; }
.badge.err { background: var(--err); color: var(--on-brand); } .badge.warn { background: var(--warn); color: var(--on-brand); } .badge.ok { background: var(--ok-bg); color: var(--ok); }

/* library */
.filters .search { width: 100%; margin-bottom: 8px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status-filter { display: flex; gap: 10px; padding-right: 8px; border-right: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; color: var(--ink-2); background: var(--bg); font-weight: 600; }
.table tr.selected td { background: var(--teal-light); }
.table.compact td, .table.compact th { padding: 4px 8px; }
.library .row-actions { white-space: nowrap; } .library .row-actions .btn { margin: 1px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 18, 30, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--card); border-radius: 8px; padding: 20px 22px; width: 520px; max-width: 95vw; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 8px; }
.modal .radio input[type=text], .modal .radio input:not([type]) { width: 90px; margin-left: 6px; }

/* editor */
.editor { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.editor-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; align-self: start; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.side-head h2 { margin: 4px 0 0; font-size: 18px; }
.family { list-style: none; margin: 0; padding: 0; }
.family li { display: flex; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 4px; }
.family li.active { background: var(--teal-light); }
.integrity-summary p { margin: 0 0 4px; font-size: 13px; }
.issue-list { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.issue-list li { padding: 5px 6px; border-left: 3px solid var(--line); margin-bottom: 4px; cursor: pointer; display: flex; flex-direction: column; background: var(--bg); border-radius: 0 4px 4px 0; }
.issue-list li.err { border-left-color: var(--err); } .issue-list li.warn { border-left-color: var(--warn); }
.issue-list li:hover { background: var(--teal-light); }
.issue-list .where { color: var(--muted); font-size: 12px; }
.group-bar { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
.group-bar .group { padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.group-bar .group.active { background: var(--teal); border-color: var(--teal); color: var(--on-brand); }
.group-bar .group.active .muted { color: rgba(255,255,255,.75); }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.view-toggle button { padding: 6px 12px; border: 0; background: var(--card); font: inherit; cursor: pointer; color: var(--ink-2); }
.view-toggle button.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.tab-row { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tab { padding: 7px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: inherit; cursor: pointer; color: var(--ink-2); }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 600; }
.table-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }

/* grid */
.grid-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.grid-toolbar .search { width: 260px; }
.grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); max-height: 70vh; }
.grid { border-collapse: collapse; min-width: 100%; }
.grid th { position: sticky; top: 0; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; white-space: nowrap; resize: horizontal; overflow: hidden; min-width: 90px; }
.grid th.keycol { color: var(--teal-dark); }
.grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; vertical-align: top; }
.grid td input { width: 100%; min-width: 90px; border: 0; border-radius: 0; padding: 5px 8px; background: transparent; }
.grid td input:focus { outline: 2px solid var(--teal); outline-offset: -2px; }
.grid .cell-ro { padding: 5px 8px; white-space: pre-wrap; word-break: break-word; min-width: 90px; }
.grid .rownum { width: 34px; min-width: 34px; text-align: right; color: var(--muted); font-size: 12px; padding: 6px; background: var(--bg); }
.grid td.cell-err { background: var(--err-bg); box-shadow: inset 0 -2px 0 var(--err); }
.grid td.cell-warn { background: var(--warn-bg); box-shadow: inset 0 -2px 0 var(--warn); }
.grid tr.row-err .rownum { color: var(--err); font-weight: 700; }
.grid .row-actions { white-space: nowrap; padding: 3px 4px; }

/* form view */
.form-view { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.form-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; max-height: 70vh; overflow: auto; }
.form-list .search { width: 100%; }
.form-list ul { list-style: none; padding: 0; margin: 6px 0 0; }
.form-list li { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.form-list li.active { background: var(--teal-light); }
.form-list li .label { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-list .rownum { color: var(--muted); font-size: 12px; width: 22px; }
.form-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; } .form-head h3, .form-head .h3 { flex: 1; }
.field-card h4, .field-card .h4 { margin-top: 0; }
.field .field-label { display: flex; gap: 6px; align-items: center; }
.tag { font-size: 12px; padding: 0 5px; border-radius: 3px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag.ref { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.field.has-err input, .field.has-err select { border-color: var(--err); background: var(--err-bg); }
.field.has-warn input, .field.has-warn select { border-color: var(--warn); background: var(--warn-bg); }
.cell-ro { padding: 6px 8px; background: var(--bg); border-radius: 4px; min-height: 30px; }

/* flat editor */
.flat-editor { display: grid; grid-template-columns: 250px 1fr; gap: 16px; }
.table-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; align-self: start; }
.table-list h4, .table-list .h4 { margin: 8px 0 4px; }
.table-list ul { list-style: none; margin: 0; padding: 0; }
.table-list li { display: flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.table-list li span:first-child { flex: 1; }
.table-list li.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.drop-card { margin-top: 16px; }

/* compare */
.compare-pick { display: flex; gap: 12px; align-items: flex-end; }
.compare-pick label { min-width: 280px; } .compare-pick .arrow { font-size: 20px; color: var(--muted); padding-bottom: 6px; }
.summary { display: flex; justify-content: space-between; align-items: center; }
.stats { display: flex; gap: 8px; margin: 6px 0; }
.stat { padding: 3px 10px; border-radius: 12px; font-weight: 600; font-size: 12px; background: var(--bg); }
.stat.add { background: var(--ok-bg); color: var(--ok); } .stat.del { background: var(--err-bg); color: var(--err); } .stat.chg { background: var(--warn-bg); color: var(--warn); }
.group-title { margin: 16px 0 8px; color: var(--teal-dark); }
.diff-block { padding: 6px 10px; border-left: 3px solid var(--line); margin-bottom: 6px; background: var(--bg); border-radius: 0 4px 4px 0; }
.diff-block.add { border-left-color: var(--ok); } .diff-block.del { border-left-color: var(--err); } .diff-block.chg { border-left-color: var(--warn); }
.diff-block .lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-right: 8px; }
.diff-block code { margin-right: 6px; }
.mini { margin-top: 4px; border-collapse: collapse; font-size: 12px; }
.mini td { padding: 2px 8px 2px 0; } .mini .col { font-weight: 600; color: var(--ink-2); }
.mini .old { color: var(--err); text-decoration: line-through; } .mini .new { color: var(--ok); font-weight: 600; }

/* wizard */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--muted); cursor: pointer; }
.steps li .num { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.steps li.active { border-color: var(--teal); color: var(--teal-dark); font-weight: 600; } .steps li.active .num { background: var(--teal); color: var(--on-brand); }
.steps li.done { color: var(--ink); } .steps li.done .num { background: var(--ok-bg); color: var(--ok); }
.wizard-body { padding: 20px 22px; }
.wizard-nav { margin-top: 18px; justify-content: flex-end; }
.mini-edit { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.mini-edit th { text-align: left; font-size: 12px; color: var(--ink-2); padding: 4px 6px; }
.mini-edit td { padding: 2px 4px; } .mini-edit input, .mini-edit select { width: 100%; }
.op-card { background: var(--bg); }
.payload-grid { align-items: start; }

@media (max-width: 1100px) {
  .editor, .form-view, .flat-editor { grid-template-columns: 1fr; }
  .editor-side { position: static; max-height: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; } .span-3 { grid-column: span 2; }
}

/* ---- editor enhancements ---- */
.side-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.issue-filter { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 4px 0 8px; }
.issue-filter button { padding: 3px 9px; border: 0; background: var(--card); font: inherit; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.issue-filter button.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.family li a.small { margin-left: auto; }
.btn.active { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-light); }
.find-card { border-color: var(--teal-mid); background: #FAFDFD; }
.find-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.find-row label { min-width: 200px; }
.find-row .check { min-width: 0; padding-bottom: 6px; }
.grid .sticky-1 { position: sticky; left: 0; z-index: 2; }
.grid .sticky-2 { position: sticky; left: 34px; z-index: 2; background: var(--card); box-shadow: 1px 0 0 var(--line); }
.grid th.sticky-1, .grid th.sticky-2 { z-index: 3; background: var(--bg); }
.grid th.sortable { cursor: pointer; user-select: none; } .grid th.sortable:hover { color: var(--teal-dark); }
.grid .sort-ind { color: var(--teal-dark); }
.grid td.has-jump { position: relative; } .grid td.has-jump input { padding-right: 22px; }
.grid .jump { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--teal); cursor: pointer; font-size: 12px; padding: 2px 4px; opacity: .55; }
.grid td:hover .jump { opacity: 1; }
.grid tr.row-hl td { background: var(--teal-light); } .grid tr.row-hl td.sticky-2 { background: var(--teal-light); }
.grid tr.row-hl td.cell-err { background: var(--err-bg); } .grid tr.row-hl td.cell-warn { background: var(--warn-bg); }
.where-used .chips { margin-top: 2px; }
.field .inline select { flex: 1; }
.modal.wide { width: 780px; }
.modal.wide .grid-3 { margin-bottom: 4px; }

/* ---- MBR preview ---- */
.mbr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; max-width: 1200px; margin: 0 auto; }
.mbr-title { display: flex; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--teal); padding-bottom: 12px; margin-bottom: 12px; }
.mbr-title h1 { font-size: 22px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mbr-integrity { text-align: right; white-space: nowrap; }
.mbr-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 16px; font-size: 13px; margin: 10px 0 4px; }
.mbr-kv > div > span:first-child { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.mbr-kv .span-4 { grid-column: span 4; }
.mbr h2 { margin: 24px 0 8px; color: var(--teal-dark); border-bottom: 1px solid var(--line); padding-bottom: 4px; font-size: 16px; }
.mbr h2 .muted { font-weight: 400; margin-left: 8px; }
.mbr h3, .mbr .h3 { margin: 0; font-size: 14px; }
.mbr .id { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.mbr a.id:hover { text-decoration: underline; }
.mbr .num { text-align: right; font-variant-numeric: tabular-nums; }
.mbr .hz { color: var(--err); font-weight: 700; }
.mbr table.doc { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.mbr table.doc th { text-align: left; font-size: 12px; color: var(--ink-2); background: var(--bg); padding: 4px 8px; border-bottom: 1px solid var(--line); }
.mbr table.doc th.num { text-align: right; }
.mbr table.doc td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mbr table.doc.compact td, .mbr table.doc.compact th { padding: 3px 6px; font-size: 12px; }
.mbr table.doc tr.total td { font-weight: 600; border-top: 2px solid var(--line); background: var(--bg); }
.mbr .ph { background: var(--warn-bg); color: var(--warn); border-radius: 3px; padding: 0 3px; font-family: var(--mono); font-size: 12px; }
.mbr .note { padding: 6px 10px; border-left: 3px solid var(--line); background: var(--bg); margin-bottom: 6px; border-radius: 0 4px 4px 0; }
.mbr .sign { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-top: 32px; }
.mbr .sign div { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 12px; color: var(--muted); }

/* process flow strip */
.mbr .flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; margin: 6px 0 10px; }
.mbr .flow-op { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border: 1px solid var(--teal-mid); border-radius: var(--radius); background: var(--teal-light); color: var(--ink); min-width: 120px; max-width: 200px; text-decoration: none; }
.mbr .flow-op:hover { border-color: var(--teal); background: var(--card); text-decoration: none; }
.mbr .flow-num { font-size: 12px; font-weight: 700; color: var(--teal-dark); text-transform: uppercase; letter-spacing: .04em; }
.mbr .flow-num::before { content: "Op "; }
.mbr .flow-id { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--teal-dark); }
.mbr .flow-desc { font-size: 12px; line-height: 1.3; }
.mbr .flow-phase { font-size: 12px; color: var(--ink-2); font-style: italic; }
.mbr .flow-arrow { align-self: center; color: var(--muted); font-size: 18px; }

/* phase and type markers */
.mbr .phase { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: #FFF4DF; color: #8A5A00; border: 1px solid #F3D9A4; margin-right: 4px; }
.mbr .phase.none { background: var(--bg); color: var(--muted); border-color: var(--line); }
.mbr tr.phase-row td { background: #FFFBF2; border-top: 2px solid #F3D9A4; padding: 6px 8px; }
.mbr tr.phase-row .id { margin-left: 4px; }
.mbr .ipc-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 3px; background: var(--teal); color: var(--on-brand); letter-spacing: .03em; }
.mbr .tag.mand { background: var(--ink); color: var(--on-brand); border-color: var(--ink); font-weight: 700; }
.mbr .st, .mbr .at { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; }
.mbr .st-manual       { background: var(--surface-3); color: #455A64; border-color: #CFD8DC; }
.mbr .st-automatic    { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.mbr .st-verification { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; }
.mbr .st-dispense     { background: #FFF4DF; color: #8A5A00; border-color: #F3D9A4; }
.mbr .st-sampling     { background: #E0F2F1; color: #23408F; border-color: #B2DFDB; }
.mbr .at-instruction  { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.mbr .at-dataentry    { background: #E3F2FD; color: #1565C0; border-color: #BBDEFB; }
.mbr .at-sample       { background: #E0F2F1; color: #23408F; border-color: #B2DFDB; }
.mbr .at-signature    { background: #EDE7F6; color: #5E35B1; border-color: #D1C4E9; }
.mbr .at-weigh        { background: #FFF4DF; color: #8A5A00; border-color: #F3D9A4; }
.mbr .at-calculation  { background: #E8F5E9; color: #2E7D32; border-color: #C8E6C9; }
.mbr .at-verification { background: #E8EAF6; color: #3949AB; border-color: #C5CAE9; }
.mbr .legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); margin: 0 0 8px; }
.mbr .legend .sep { margin: 0 4px; }

/* operations */
.mbr .op { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; break-inside: avoid; scroll-margin-top: 12px; }
.mbr .op.warn-border { border-color: var(--warn); }
.mbr .op-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.mbr .op-head .id { font-weight: 700; color: var(--teal-dark); font-size: 13px; }
.mbr .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; }
.mbr .op-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); margin: 4px 0 6px; align-items: center; }
.mbr .op-foot { text-align: right; margin-top: 2px; }
.mbr .phase-mat { margin: 4px 0 8px; border: 1px dashed #F3D9A4; border-radius: var(--radius); padding: 4px 10px; background: #FFFDF7; }
.mbr .phase-mat summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #8A5A00; }
.mbr .phase-mat table { margin-top: 6px; background: var(--card); }

/* steps */
.mbr .steps-doc td:last-child { width: 66%; }
.mbr .steps-doc td:nth-child(3) { min-width: 150px; }
.mbr .steps-doc tr.group-row td { background: var(--bg); padding: 5px 8px; font-size: 12px; border-top: 2px solid var(--line); }
.mbr .steps-doc .grp { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin-right: 6px; }
.mbr .steps-doc tr.step > td:first-child { border-left: 4px solid var(--line); }
.mbr .steps-doc tr.step.st-manual > td:first-child       { border-left-color: #90A4AE; }
.mbr .steps-doc tr.step.st-automatic > td:first-child    { border-left-color: var(--teal); }
.mbr .steps-doc tr.step.st-verification > td:first-child { border-left-color: #3949AB; }
.mbr .steps-doc tr.step.st-dispense > td:first-child     { border-left-color: #F9A825; }
.mbr .steps-doc tr.step.st-sampling > td:first-child     { border-left-color: #23408F; }
.mbr .step-cell { white-space: nowrap; }
.mbr .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; margin-right: 6px; }
.mbr .instruction { font-weight: 500; }
.mbr .extra { margin-top: 3px; }
.mbr table.acts-doc { width: 100%; border-collapse: collapse; margin: 6px 0 2px; font-size: 12px; }
.mbr table.acts-doc th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-bottom: 1px solid var(--line); }
.mbr table.acts-doc td { padding: 3px 6px; border-top: 1px dashed var(--line); vertical-align: top; }
.mbr table.acts-doc tr.act td:first-child { border-left: 2px solid var(--line); }
.mbr table.acts-doc .seq { color: var(--muted); font-family: var(--mono); width: 30px; }
.mbr table.acts-doc tr.ipc-row td { border-top: 0; padding-top: 0; }
.mbr .ipc { margin: 2px 0 4px; padding: 6px 10px; background: var(--teal-light); border-left: 3px solid var(--teal); font-size: 12px; border-radius: 0 4px 4px 0; }
.mbr table.ipc-doc { border-collapse: collapse; margin-top: 2px; }
.mbr table.ipc-doc td { padding: 1px 10px 1px 0; border: 0; vertical-align: baseline; }

@media print {
  .topbar, .no-print { display: none !important; }
  html, body, .content { background: var(--card); padding: 0; }
  .mbr { border: 0; padding: 0; max-width: none; }
  .mbr .op, .mbr table.doc tr { break-inside: avoid; }
  .mbr .flow-op { background: var(--card); }
  a { color: inherit; }
}

/* record type chips */
.chip.rt-commercial { background: #E3F2ED; color: #23408F; }
.chip.rt-validation { background: #E8EAF6; color: #283593; }
.chip.rt-experimental { background: #FFF3E0; color: #A2330A; }

/* ==== UI foundation (UX plan phase 1): focus, motion, touch, density, sticky headers ==== */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-mid); }
.btn:focus-visible, a:focus-visible, .sd-node:focus-visible, .dlp-item:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (pointer: coarse) {
  .btn, input:not([type=checkbox]):not([type=radio]), select { min-height: 40px; }
  .btn.small, .btn.tiny, .btn.icon { min-height: 36px; min-width: 36px; }
  .table td { padding-top: 10px; padding-bottom: 10px; }
}
html.compact .table th, html.compact .table td { padding: 4px 8px; }
html.compact .card { padding: 10px 12px; margin-bottom: 10px; }
html.compact .btn { padding: 4px 10px; }
html.compact .page-head { margin-bottom: 8px; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--surface-2); }

/* ==== shell: slim top bar, global search, sidebar on wide screens (UX plan phase 2) ==== */
.global-search { display: flex; align-items: center; flex: 0 1 320px; min-width: 0; }
.global-search input { width: 100%; padding: 6px 10px; font-size: 13px; border-radius: 16px; background: var(--surface-2); }
.topbar > .nav-author { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.nav-author .ui-btn { padding: 4px 8px; font-size: 13px; line-height: 1; }
.nav-foot { display: none; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.nav-brand { display: none; }
.nav-collapse { width: 100%; justify-content: center; }
.about-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 4px; padding: 0; border: 0; background: none; color: var(--teal-dark); font: inherit; font-size: 12px; cursor: pointer; }
.about-toggle::before { content: "▸"; font-size: 12px; }
.page-head.about-open .about-toggle::before { content: "▾"; }
.page-head p.about { display: none; }
.page-head.about-open p.about { display: block; }
.page-head > div > h1 { margin-bottom: 0; }
@media (max-width: 700px) { .global-search { display: none; } }
@media (max-width: 900px) {
  header.topbar > .nav-author { gap: 6px; }
  header.topbar > .nav-author .nav-label, header.topbar > .nav-author .author .nav-label, header.topbar > .nav-author .lang-pick .nav-label, header.topbar > .nav-author .db-indicator, header.topbar > .nav-author .ui-btn { display: none !important; }
  header.topbar > .nav-author .lang-pick select { max-width: 84px; padding: 4px 4px; }
  header.topbar > .nav-author .author { gap: 0; }
}
@media (max-width: 600px) {
  .brand-name, .brand-release { display: none; }
  header.topbar > .nav-author .lang-pick select { max-width: 70px; }
}
.page-head .about-toggle { color: inherit; opacity: .85; }
.page-head .about-toggle:hover { opacity: 1; text-decoration: underline; }
@media (min-width: 1200px) {
  .shell { --nav-cur: var(--nav-w); }
  html.nav-collapsed .shell { --nav-cur: var(--nav-w-collapsed); }
  .topnav { position: fixed; top: 0; left: 0; bottom: 0; width: var(--nav-cur); display: flex !important; flex-direction: column; align-items: stretch; gap: 0; padding: 8px 8px 12px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; z-index: 30; }
  .topnav .nav-group { flex-direction: column; align-items: stretch; gap: 1px; border-left: 0; padding: 4px 0 6px; border-top: 1px solid var(--line); }
  .topnav .nav-group:first-child { border-top: 0; padding-top: 0; }
  .topnav .nav-group-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 6px 3px; }
  .topnav a { padding: 7px 10px !important; font-weight: 500; }
  .topnav a .nav-label { display: inline !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.nav-collapsed .topnav a .nav-label, html.nav-collapsed .topnav .nav-group-label, html.nav-collapsed .nav-collapse .nav-label { display: none !important; }
  html.nav-collapsed .topnav a { justify-content: center; padding: 9px 0 !important; }
  .nav-foot { display: block; }
  .nav-toggle { display: none !important; }
  .content { margin-left: var(--nav-cur); width: auto; max-width: none; }   /* the sidebar takes its width from the page, not from the content */
  .topbar { margin-left: var(--nav-cur); }
  .topbar > .brand { display: none; }
  .nav-brand { display: flex; align-items: center; gap: 8px; padding: 6px 6px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; }
  .nav-brand:hover { text-decoration: none; }
  html.nav-collapsed .nav-brand { justify-content: center; padding: 6px 0 10px; }
  html.nav-collapsed .nav-brand .brand-name, html.nav-collapsed .nav-brand .brand-release { display: none; }
}

/* ==== record breadcrumb and tab strip ==== */
/* ---- record views as a tabbed notebook: the crumb is the label on the cover, the tabs are index tabs along the top edge of the
   page; the open tab merges into the page, the others sit a little lower behind it, each with its own colour ---- */
.record-tabs { --tab: var(--muted); display: flex; flex-direction: column; margin: -6px 0 14px; padding: 0; border: 0; }
.record-tabs .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; flex-wrap: wrap; padding: 2px 4px 8px; }
.record-tabs .crumbs .sep { color: var(--muted); }
.record-tabs .crumbs .nb-hint { margin-left: auto; }
.record-tabs .tabs { display: flex; gap: 4px; align-items: flex-end; padding: 0 10px; position: relative; }
.record-tabs .tabs .tab-edge { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line-strong, var(--line)); border-radius: 2px; }
.record-tabs .tabs a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 5px; border: 1px solid var(--line); border-bottom: 0; border-top: 3px solid var(--tab); border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 13px; transform: translateY(0); transition: transform .12s ease, background .12s ease; }
.record-tabs .tabs a:hover { background: var(--card); color: var(--ink); text-decoration: none; transform: translateY(-1px); }
.record-tabs .tabs a.active { z-index: 2; background: var(--bg); color: var(--ink); border-color: var(--line-strong, var(--line)); padding-top: 8px; padding-bottom: 7px; margin-bottom: -2px; box-shadow: 0 -3px 8px rgba(0,0,0,.06); }
.record-tabs .tabs a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--bg); }
.record-tabs .tabs a[data-view="editor"] { --tab: #546E7A; } .record-tabs .tabs a[data-view="workflow"] { --tab: var(--teal); } .record-tabs .tabs a[data-view="preview"] { --tab: #1565C0; } .record-tabs .tabs a[data-view="s88"] { --tab: #C79A00; } .record-tabs .tabs a[data-view="exceptions"] { --tab: #C62828; }
.record-tabs .tabs a.active { border-top-width: 4px; }
.record-tabs .tabs a:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 1px; }
@media (max-width: 760px) { .record-tabs .tabs { overflow-x: auto; padding-bottom: 2px; } .record-tabs .tabs a { padding: 6px 10px 5px; white-space: nowrap; } .record-tabs .crumbs .nb-hint { display: none; } }

/* ==== toasts: confirmations float bottom-right and fade; errors stay in place ==== */
.users-notice.ok { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: 420px; box-shadow: var(--shadow-2); animation: toast-in .18s ease-out; }
.users-notice.ok.gone { display: none; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 700px) { .users-notice.ok { left: 12px; right: 12px; bottom: 12px; max-width: none; } }

/* ==== menus (row kebab, page-head More) ==== */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 200px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 2px; }
.row-menu .menu .btn { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; font-weight: 500; }
.row-menu .menu .btn:hover { background: var(--surface-2); }
.row-menu.head-menu .menu { min-width: 220px; }
.more-filters { flex-basis: 100%; }
.more-filters > summary { cursor: pointer; font-size: 12px; color: var(--teal-dark); font-weight: 600; list-style: none; padding: 4px 0; }
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::before { content: "▸ "; } .more-filters[open] > summary::before { content: "▾ "; }
.saved-views { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.saved-views input { width: 150px; }

/* ==== keyboard shortcuts dialog ==== */
dialog.shortcuts { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 22px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-2); max-width: 420px; }
dialog.shortcuts::backdrop { background: rgba(0, 0, 0, .35); }
dialog.shortcuts table { border-collapse: collapse; margin: 8px 0 12px; } dialog.shortcuts td { padding: 4px 10px 4px 0; font-size: 13px; }
dialog.shortcuts kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }

/* ==== builder zoom ==== */
.zoom-ctl { display: inline-flex; align-items: center; gap: 4px; }
.zoom-ctl [data-zoom-label] { min-width: 38px; text-align: center; }

/* ==== deferred UX items: inspector tabs, sortable headers, bulk bars, help popovers, tablet cockpit ==== */
.insp-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 6px 0 10px; border-bottom: 1px solid var(--line); }
.insp-tabs button { border: 0; background: none; padding: 6px 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.insp-tabs button:hover { color: var(--teal-dark); background: var(--surface-2); }
.insp-tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.insp-tabs .cnt { margin-left: 4px; font-size: 12px; background: var(--surface-3); border-radius: 8px; padding: 0 5px; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover, .th-sort.on { color: var(--teal-dark); }
.sel-col { width: 28px; text-align: center; }
.sel-col input { margin: 0; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; background: var(--teal-light); border: 1px solid var(--teal-mid); border-radius: var(--radius); }
.bulk-bar .inline-field { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; }
.help-pop { position: fixed; z-index: 70; max-width: 320px; background: var(--ink); color: var(--card); font-size: 12px; line-height: 1.4; padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow-2); pointer-events: none; }
@media (pointer: coarse) {
  .content:has(.ex-bar) .page-head > .actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px rgba(0, 0, 0, .12); justify-content: center; }
  .content:has(.ex-bar) { padding-bottom: 96px; }
  .content:has(.ex-bar) .ex-entry input, .content:has(.ex-bar) .ex-entry select, .content:has(.ex-bar) .modal input, .content:has(.ex-bar) .modal select, .content:has(.ex-bar) .modal textarea { min-height: 44px; font-size: 16px; }
  .content:has(.ex-bar) .ex-entry-actions .btn { min-height: 44px; padding: 8px 14px; }
  .content:has(.ex-bar) .ex-acts li { padding-top: 10px; padding-bottom: 10px; }
}

/* section headings re-levelled for a clean outline keep their previous size through these classes */
.h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; color: inherit; }
.h4 { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.dialog-title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }

/* ==== batch cockpit operator view (full screen) ==== */
.ex-full { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow: auto; padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.ex-full .page-head { margin-bottom: 2px; }
.ex-full .page-head p.about, .ex-full .about-toggle, .ex-full .record-tabs { display: none; }
.ex-full .wf { flex: 1; min-height: 0; }
.ex-full .ex-bar-row .ex-bar { width: 320px; height: 12px; }
.ex-elapsed { font-family: var(--mono); font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.ex-now { border-left: 6px solid var(--teal); padding: 16px 20px; }
.ex-now-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ex-now-title { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 8px 0; }
.ex-now-limits { font-size: 15px; color: var(--ink-2); margin: 0 0 6px; }
.ex-now-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; }
.ex-now-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-next { margin-top: 10px; }
.btn.big { padding: 12px 20px; font-size: 16px; }
.btn kbd { margin-left: 6px; font-family: var(--mono); font-size: 12px; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; opacity: .7; }
.ex-recent li { margin-bottom: 2px; }
html.ex-large .ex-full { font-size: 16px; }
html.ex-large .ex-full .ex-now-title { font-size: 30px; }
html.ex-large .ex-full .ex-act-desc { font-size: 16px; }
html.ex-large .ex-full .btn.big { font-size: 18px; padding: 14px 24px; }
html.ex-large .ex-full .ex-limits, html.ex-large .ex-full .small { font-size: 14px; }
@media (pointer: coarse) { .ex-full .page-head > .actions { position: static; box-shadow: none; border: 0; padding: 0; } .ex-full .ex-now-actions .btn { min-height: 52px; } }

/* windows, menus and popovers are always opaque, whatever sits behind them */
.modal, .row-menu .menu, dialog.shortcuts, .tsel-pop, .topnav, .topbar, .wf-palette, .wf-inspector, .users-notice, .insp-modal, .dlp-pane, .help-pop, .ex-full { background-color: var(--card); opacity: 1; }
.help-pop { background-color: var(--ink); }
.ex-full { background-color: var(--bg); }
.topbar.fit-menu .topnav, .topnav.open { background-color: var(--card); }
dialog.shortcuts::backdrop { background: rgba(12, 18, 30, .6); backdrop-filter: blur(3px); }
.ex-gate { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 6px 0 10px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.ex-gate.small { font-size: 12px; padding: 5px 8px; margin: 6px 0 0; }

/* ---- AVEVA MES page: object map confidence, upload plan groups */
.conf-documented { background: var(--ok-bg); color: var(--ok); border-color: #BFE3C1; }
.conf-convention { background: var(--warn-bg); color: #8A5A00; border-color: #F3D9A4; }
.conf-notpushed { background: var(--bg); color: var(--muted); }
.mapgrid .chip { margin: 1px 2px 1px 0; font-weight: 500; }
.mapgrid .chip.unknown { background: var(--err-bg); color: var(--err); border-color: #F3B4B4; text-decoration: line-through; }
.plan-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin: 6px 0; background: var(--card); }
.plan-group summary { cursor: pointer; }
pre.body { margin: 0; font: 11px/1.4 var(--mono); white-space: pre-wrap; max-width: 520px; color: var(--ink-2); }
