/* ---------- documents dashboard ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.doc-grid > .empty { grid-column: 1 / -1; }
.doc-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); overflow: hidden; }
.doc-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.doc-thumb { height: 110px; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 14px 22px; display: flex; flex-direction: column; gap: 6px; }
.doc-thumb-title { height: 8px; width: 55%; background: var(--text-3); opacity: .55; border-radius: 2px; margin-bottom: 4px; }
.doc-thumb-line { height: 5px; background: var(--border-strong); border-radius: 2px; }
.doc-thumb-line.lvl-1 { margin-left: 8px; } .doc-thumb-line.lvl-2 { margin-left: 16px; } .doc-thumb-line.lvl-3 { margin-left: 24px; } .doc-thumb-line.lvl-4 { margin-left: 32px; }
.doc-card-body { padding: 10px 12px; display: grid; gap: 4px; }
.doc-card-name { font-weight: 600; word-break: break-word; }
.doc-card-del { position: absolute; top: 4px; right: 4px; font-size: 16px; opacity: 0; }
.doc-card:hover .doc-card-del { opacity: 1; }

/* quality score widgets */
.q-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: var(--r-pill); color: var(--text-2); background: var(--surface-3); }
.q-pill.good { background: var(--ok-bg); color: var(--ok); } .q-pill.fair { background: var(--warn-bg); color: var(--warn); } .q-pill.poor { background: var(--danger-bg); color: var(--danger); }
.doc-card-body .q-pill { margin-left: var(--sp-1); }
.q-bar { position: relative; height: 18px; min-width: 80px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.q-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--border-strong); }
.q-bar.good > span { background: color-mix(in srgb, var(--ok) 45%, var(--surface)); } .q-bar.fair > span { background: color-mix(in srgb, var(--amber) 70%, var(--surface)); } .q-bar.poor > span { background: color-mix(in srgb, var(--danger) 45%, var(--surface)); }
.q-bar > b { position: relative; display: block; text-align: center; font-size: 11.5px; line-height: 18px; }

/* ---------- document view ---------- */
.doc-view .content { background: var(--bg); }
.split > .sidebar.doc-left { width: 260px; }
.doc-tabs { display: flex; align-items: center; border-bottom: 1px solid var(--line); padding: 0 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.doc-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.doc-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.doc-tabs .icon-btn { margin-left: auto; font-size: 16px; }
.doc-filter { display: flex; align-items: center; gap: 6px; padding: 3px 14px; font-size: 12.5px; cursor: pointer; }
.doc-filter.dim { color: var(--muted); }
.count-l { min-width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.doc-bl { align-items: flex-start; }
.doc-toolbar { position: sticky; top: 0; z-index: 3; }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-btn .caret { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid color-mix(in srgb, var(--primary-ink) 35%, transparent); padding: 3px 6px; }
.doc-scroll { flex: 1; overflow: auto; padding: 20px; }
.doc-paper { background: var(--surface); max-width: 1180px; margin: 0 auto; padding: var(--sp-6) var(--sp-6) 60px; border: 1px solid var(--border); border-radius: var(--r-card); min-height: 100%; }
.doc-banner { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-ctl); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-meta { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.doc-title { font-size: var(--fs-xl); line-height: 28px; margin: 4px 0 6px; }
.doc-intro { color: var(--text-2); margin-bottom: 18px; }
div.doc-intro:not(.rt-field) { white-space: pre-wrap; }
.doc-edit { border-radius: 3px; outline: none; cursor: text; }
.doc-edit:hover { background: var(--hover-bg); box-shadow: 0 0 0 1px var(--border); }
.doc-edit[contenteditable="true"] { background: var(--input-bg); box-shadow: 0 0 0 2px var(--focus-halo); }
.doc-edit.is-empty::before { content: attr(data-ph); color: var(--text-3); font-style: italic; font-weight: 400; }
.doc-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.doc-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 6px 10px; white-space: nowrap; }
.doc-table td { vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.doc-col-entity { width: 58%; }
.doc-col-labels { width: 170px; }
.doc-row { cursor: default; border-left: 4px solid transparent; }
.doc-row > td:first-child { border-left: 4px solid transparent; }
.doc-row.bl-same > td:first-child { border-left-color: var(--info); }
.doc-row.bl-changed > td:first-child, .doc-row.bl-new > td:first-child { border-left-color: var(--amber); }
.doc-row:hover > td { background: var(--hover-bg); }
.doc-row.selected > td { background: var(--sel-bg); }
.doc-row.found > td { background: var(--warn-bg); }
.doc-row.found-current > td { background: color-mix(in srgb, var(--amber) 35%, var(--surface)) !important; box-shadow: inset 0 0 0 1px var(--amber); }
.doc-row.found.selected > td { background: color-mix(in srgb, var(--amber) 25%, var(--sel-bg)); }
.doc-spacer td { height: 14px; border: 0; padding: 0; }
.doc-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.doc-num { font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-name { font-weight: 700; padding: 0 2px; }
.doc-row.depth-0 .doc-head { font-size: var(--fs-lg); }
.doc-row.depth-1 .doc-head { font-size: var(--fs-md); }
.doc-badges { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; font-size: 12px; font-weight: 400; }
.stv { display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: var(--r-sm); background: var(--ok-bg); color: var(--ok); font-size: 10px; font-weight: 700; }
.doc-desc { margin: 3px 0 0 0; color: var(--text); padding: 1px 2px; }
div.doc-desc:not(.rt-field) { white-space: pre-wrap; }
.doc-cell { min-height: 1.4em; white-space: pre-wrap; font-size: var(--fs-sm); padding: 1px 3px; }
.doc-labels .label-chip { margin-bottom: 3px; }
.add-label { padding: 0 6px !important; margin-left: 2px; opacity: 0; }
.doc-row:hover .add-label, .doc-row.selected .add-label { opacity: 1; }
.doc-qs { width: 110px; }
.outline-tog { display: inline-block; width: 14px; flex: none; color: var(--muted); cursor: pointer; font-size: 11px; user-select: none; }
.doc-view.paper .doc-table thead { display: none; }
.doc-view.paper .doc-table td { border-bottom: 0; }

/* outline tree (left pane, Outline tab) */
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; border-top: 2px solid transparent; border-bottom: 2px solid transparent; }
.tree-row:hover { background: var(--hover-bg); }
.tree-row.active { background: var(--sel-bg); color: var(--link); font-weight: 600; }
.tree-row[draggable="true"] { cursor: grab; }
.tree-root { font-weight: 600; padding-top: 8px; }
.tree-row.drop-before { border-top-color: var(--accent); }
.tree-row.drop-after { border-bottom-color: var(--accent); }
.tree-row.drop-child { background: var(--sel-bg); box-shadow: inset 0 0 0 1px var(--sel-edge); }
.outline-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- import analyzer ---------- */
.import-page { max-width: 1100px; }
.imp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.imp-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--muted); font-weight: 600; font-size: 13px; }
.imp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.imp-tab.unsupported { opacity: .6; }
.imp-steps { display: flex; gap: 0; margin-bottom: 14px; }
.imp-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.imp-step + .imp-step { border-left: 0; }
.imp-step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--border-strong); color: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.imp-step.active { color: var(--accent); background: var(--accent-2); }
.imp-step.active .n { background: var(--accent); }
.imp-step.done .n { background: var(--ok); }
.imp-card { margin-bottom: 12px; }
.imp-form .field > span { font-weight: 500; color: var(--text); font-size: 13px; }
.imp-form .field select { min-width: 260px; }
.imp-form .checkbox { margin: 6px 0; }
.imp-phrases .row { margin: 6px 0 6px 24px; max-width: 560px; }
.imp-note { margin-top: 14px; border-left: 3px solid var(--accent); padding-left: 8px; }
.imp-foot { display: flex; align-items: center; gap: 8px; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px; border: 2px dashed var(--border-strong); border-radius: var(--r-card); background: var(--surface-2); cursor: pointer; text-align: center; }
.imp-drop.over { border-color: var(--accent); background: var(--accent-2); }
.imp-drop input[type=file] { font-size: 12px; margin-top: 6px; }
.imp-drop-icon { font-size: 28px; color: var(--accent); }
.imp-or { text-align: center; color: var(--muted); margin: 10px 0; font-size: 12px; text-transform: uppercase; }
.imp-paste { font-family: var(--mono); font-size: 12px; }
.imp-progress { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.imp-progress span { display: block; height: 100%; background: var(--ok); transition: width .4s; }
.imp-warn { margin-top: 12px; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); border-radius: var(--r-ctl); padding: 8px 12px; }
.imp-warn ul { margin: 6px 0 0; padding-left: 20px; }
.imp-ok { margin-top: 12px; background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); border-radius: var(--r-ctl); padding: 8px 12px; }
.imp-map td { vertical-align: middle; }
.imp-map tr.excluded td { opacity: .5; }
.imp-sample { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-stats { border-collapse: collapse; margin-bottom: 10px; min-width: 240px; }
.imp-stats td { padding: 3px 10px; border-bottom: 1px solid var(--line-2); }
.imp-stats tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.imp-preview { max-height: 420px; overflow: auto; margin-top: 12px; border: 1px solid var(--line); }
.imp-new { color: var(--ok); font-weight: 600; font-size: 12px; }
.imp-upd { color: var(--warn); font-weight: 600; font-size: 12px; }

/* ---------- quality checker ---------- */
.q-summary { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin-bottom: 14px; }
.q-summary .stat { min-width: 140px; }
.q-legend { flex-basis: 100%; }
.q-good { color: var(--ok); } .q-fair { color: var(--warn); } .q-poor { color: var(--danger); } .q-none { color: var(--muted); }
.q-table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); }
.q-table th.q-crit { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; padding: 8px 4px; font-size: 11px; height: 100px; }
.q-table td.q-cell { text-align: center; cursor: pointer; font-weight: 700; width: 30px; user-select: none; }
.q-cell.yes { color: var(--ok); } .q-cell.no { color: var(--danger); } .q-cell.na { color: var(--muted); }
.q-cell.manual { background: var(--warn-bg) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 35%, transparent); }
.q-cell:hover { background: var(--sel-bg) !important; }
.q-desc { max-width: 380px; }
.q-issues { font-size: var(--fs-xs); color: var(--text-2); min-width: 260px; max-width: 460px; }
.q-issues b { color: var(--text); }
.q-table td:nth-child(3) { min-width: 100px; }

/* ---------- print: document view as paper ---------- */
@media print {
  .doc-view, .doc-view .content { display: block !important; height: auto !important; overflow: visible !important; background: #fff !important; }
  .doc-left, .doc-toolbar, .doc-quick, .no-print, .doc-banner { display: none !important; }
  .doc-scroll { overflow: visible !important; padding: 0 !important; }
  .doc-paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .doc-row > td { background: #fff !important; }
  .doc-row > td:first-child { border-left: 0 !important; }
  .doc-table tr { page-break-inside: avoid; }
  .doc-edit.is-empty::before { content: ""; }
  .main, #app { height: auto !important; overflow: visible !important; }
}

/* Selected-entity sidebar (EntityPanel) */
.entity-panel { display: flex; flex-direction: column; min-height: 0; }
.ep-body { padding: 10px 14px 14px; }
.ep-body .field { margin-bottom: 10px; }
.ep-image { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; margin-bottom: 10px; }
.ep-image img { max-width: 100%; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); }
button.ep-image.empty { border: 1px dashed var(--border); background: var(--surface-2); border-radius: 6px; padding: 14px; color: var(--text); }
button.ep-image.empty:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-2); }
.ep-meta { display: grid; grid-template-columns: 76px 1fr; gap: 4px 8px; margin: 0 0 6px; font-size: 12.5px; }
.ep-meta dt { color: var(--muted); }
.ep-meta dd { margin: 0; word-break: break-all; }
.ep-meta code { font-size: 10.5px; padding: 0 3px; }
.entity-panel h4 { margin: 12px 0 6px; }
.ep-labels { list-style: none; margin: 0; padding: 0; }
.ep-label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.ep-label:hover { background: var(--line-2); }
.ep-label.on { font-weight: 600; color: var(--accent); }
.ep-labels.ro .ep-label { pointer-events: none; }
.ep-check { width: 15px; height: 15px; border: 1px solid var(--border-strong); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: none; }
.ep-label.on .ep-check { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.ep-sep { height: 1px; background: var(--line); margin: 5px 0; }
.ep-relmode { width: 100%; margin-bottom: 8px; }
.ep-rel { border: 1px solid var(--border); border-radius: var(--r-ctl); margin-bottom: 6px; background: var(--surface); }
.ep-rel-head { display: flex; align-items: center; gap: 4px; padding: 4px 6px; }
.ep-rel-name { flex: 1; display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 2px 0; text-align: left; font-size: 13px; color: var(--text); min-width: 0; }
.ep-rel-name strong { font-weight: 600; white-space: nowrap; }
.ep-rel-name .muted { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-caret { color: var(--muted); width: 10px; }
.ep-count { background: var(--sel-bg); color: var(--link); border-radius: 9px; font-size: 11px; padding: 0 6px; }
.ep-pin { font-size: 12px; opacity: .3; filter: grayscale(1); }
.ep-pin.on { opacity: 1; filter: none; }
.ep-lock { font-size: 12px; opacity: .6; padding: 0 4px; }
.ep-rel-list { border-top: 1px solid var(--line-2); padding: 4px 8px 6px 22px; font-size: 13px; }
.ep-rel-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.ep-rel-row .ent-link { flex: 1; min-width: 0; }
.ep-attr { padding: 0 6px; font-size: 11px; }
.ep-cmt-title { font-weight: 600; margin-bottom: 6px; }
.ep-foot { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-top: 1px solid var(--line); margin-top: auto; position: sticky; bottom: 0; background: var(--surface); }
.doc-left { scroll-padding-bottom: 56px; }
.split > .sidebar.doc-left.has-entity { width: 330px; overflow-x: hidden; }
.ep-tabs { display: flex; }
.ep-tabs .doc-tab { flex: 1; padding-left: 4px; padding-right: 4px; font-size: 12.5px; text-align: center; white-space: nowrap; }

/* ---------- document view: parity additions ---------- */
.doc-grip { width: 5px; flex: none; cursor: col-resize; background: transparent; position: relative; z-index: 4; margin: 0 -2px; }
.doc-grip:hover { background: var(--border-strong); }
.doc-findbox { display: inline-flex; align-items: center; gap: 2px; }
.doc-find { width: 170px; }
.doc-find-count { font-size: 11.5px; color: var(--muted); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.doc-findbox .icon-btn { font-size: 10px; padding: 2px 4px; }
.doc-badge-warn { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; padding: 2px 10px; cursor: pointer; }
.doc-filter-classes { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.doc-pill { display: flex; align-items: center; gap: 6px; text-align: left; border: 1px solid transparent; background: none; border-radius: 12px; padding: 3px 8px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.doc-pill:hover { background: var(--line-2); }
.doc-pill.active { background: var(--sel-bg); border-color: var(--sel-edge); color: var(--link); font-weight: 600; }
.doc-labels-head { display: flex; align-items: baseline; gap: 6px; }
.doc-op { font-size: 11.5px; font-weight: 600; }
.doc-filter-labels { max-height: 46vh; overflow: auto; }
.doc-sig { margin-top: 4px; }
.doc-sig img { max-width: 200px; max-height: 44px; display: block; background: var(--canvas-bg); border: 1px solid var(--border); border-radius: var(--r-sm); }
.doc-cmt-group { margin-bottom: 10px; }
.doc-cmt-ent { font-weight: 600; font-size: 12.5px; display: block; margin-bottom: 3px; }
.comment.resolved { opacity: .55; }
.comment .muted.small { display: flex; align-items: center; gap: 4px; }
.doc-cmt-badge { border: 0; background: var(--sel-bg); color: var(--link); border-radius: 9px; font-size: 11px; padding: 0 6px; cursor: pointer; }
.doc-guide { color: var(--warn); cursor: help; }
.tree-row.in-view .outline-text { font-weight: 600; }
.tree-row.flash { background: var(--warn-bg) !important; transition: background .6s; }
.tree-row.no-drop { cursor: no-drop; background: var(--danger-bg); }
.doc-lvl { font-size: 10px; background: var(--line-2); border-radius: 6px; padding: 0 4px; color: var(--muted); }
.doc-titlebar { display: flex; align-items: baseline; gap: 10px; }
.doc-docnum { font-size: 15px; color: var(--muted); font-weight: 600; min-width: 1em; }
.doc-table { table-layout: fixed; }
.doc-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; user-select: none; overflow: hidden; text-overflow: ellipsis; }
.doc-table th[data-col]:not([data-col="__entity"]) { cursor: pointer; }
.doc-table th:hover:not(.doc-col-entity) { color: var(--accent); }
.doc-table td { overflow-wrap: anywhere; }
.doc-sizer { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.doc-table th { position: sticky; }
.doc-sizer:hover { background: var(--border-strong); }
.doc-col-entity { width: auto; }
.doc-row.locked .doc-name, .doc-row.locked .doc-num { color: var(--text-3); }
.doc-num.doc-edit { min-width: 1.2em; }
.doc-view.paper .doc-paper { max-width: 900px; }
.doc-view.paper .doc-table { table-layout: auto; }
.doc-view.paper .doc-entity > div { padding-left: 0 !important; }
.doc-desc.rt-field, .doc-intro.rt-field { margin-top: 3px; }
.doc-wizard .doc-tpl-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 5px; padding: 4px 0; margin-bottom: 8px; }
.doc-tpl-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px 2px; font-weight: 700; }
.doc-tpl { display: flex; align-items: center; gap: 8px; padding: 5px 12px; cursor: pointer; }
.doc-tpl:hover { background: var(--line-2); }
.doc-tpl.active { background: var(--accent-2); }
.doc-tpl .muted { margin-left: auto; }
.doc-wizard .modal-foot { padding: 10px 0 0; border: 0; }
.doc-wizard .err { color: var(--danger); }
.doc-dispopts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.doc-colsel { border: 1px solid var(--line); border-radius: 5px; padding: 4px; max-height: 220px; overflow: auto; }
.doc-colrow { display: flex; align-items: center; gap: 2px; padding: 2px 4px; font-size: 13px; }
.doc-colrow:hover { background: var(--line-2); }
.doc-colavail-wrap { max-height: 220px; overflow: auto; margin-top: 8px; }
.doc-colgroup { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 6px 0 2px; }
.doc-colchips { display: flex; flex-wrap: wrap; gap: 4px; }
.doc-colchips .label-chip { cursor: pointer; border: 0; }
.doc-split td { vertical-align: top; }
.doc-split .input.small { width: 100%; }
.doc-split td:nth-child(2) { width: 90px; } .doc-split td:nth-child(3) { width: 200px; }
.doc-hist-list { max-height: 65vh; overflow: auto; }
.doc-hist { border-bottom: 1px solid var(--line-2); padding: 8px 0; }
.doc-hist .row { gap: 8px; align-items: center; }
.doc-hist-ch { display: flex; gap: 8px; font-size: 12.5px; margin: 3px 0 0 12px; }
.doc-hist-f { min-width: 90px; color: var(--muted); font-weight: 600; }
.doc-sigpad { border: 1px dashed var(--border-strong); border-radius: var(--r-sm); background: var(--canvas-bg); width: 420px; max-width: 100%; height: 80px; cursor: crosshair; display: block; margin: 4px 0; }
.doc-chg { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 8px; white-space: nowrap; }
.doc-chg.added, .doc-chg.relationship { background: var(--ok-bg); color: var(--ok); }
.doc-chg.removed { background: var(--danger-bg); color: var(--danger); }
.doc-chg.modified { background: var(--warn-bg); color: var(--warn); }
.doc-changes del { background: var(--danger-bg); color: var(--danger); } .doc-changes ins { background: var(--ok-bg); color: var(--ok); text-decoration: none; }
.doc-acr { max-height: 64vh; overflow: auto; }
.doc-acr-card { margin-bottom: 10px; }
.doc-acr-occ { margin-top: 4px; max-width: 420px; }
.doc-multi { display: flex; flex-direction: column; gap: 4px; }
.doc-multi-on { display: flex; flex-wrap: wrap; gap: 4px; }
.doc-multi-on button { border: 0; background: none; cursor: pointer; }
.doc-multi .input.small { width: 220px; }
.doc-rep-opts { margin: 8px 0; }
.doc-rep-prev th, .doc-rep-prev td { font-size: 12px; max-width: 260px; }
@media (max-width: 1000px) { .doc-toolbar .btn.small { padding-left: 6px; padding-right: 6px; } .doc-find { width: 110px; } }
@media print { .doc-grip, .doc-findbox, .doc-badge-warn, .doc-sizer { display: none !important; } .doc-table th { position: static; } }
.doc-toolbar { gap: 4px; }
.doc-toolbar .sep { margin: 0 2px; }
.doc-find { width: 130px; }
/* dark theme */
[data-theme=dark] .doc-edit:hover, [data-theme=dark] .rt-field:hover > .rt-view { background: var(--hover); }
.doc-labels .label-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* Requirement workflow: stale quality, suspect links, approvals, TBD/TBR register */
.q-stale { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); color: var(--warn); background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); white-space: nowrap; }
.req-suspect-badge { border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-bg); color: var(--warn); border-radius: var(--r-pill); font-size: 11px; font-weight: 600; padding: 0 6px; cursor: pointer; white-space: nowrap; }
.req-suspect-mark { color: var(--warn); font-weight: 700; margin: 0 4px; cursor: help; }
.req-suspect { display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin: 6px 0; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-bg); color: var(--warn); border-radius: var(--r-ctl); font-size: var(--fs-xs); }
.req-appr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; margin: 4px 0; border-top: 1px solid var(--line); }
.req-status { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 9px; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.req-status.st-approved { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.req-status.st-in-review { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.req-status.st-rejected { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.req-suspect-table td { vertical-align: top; } .nowrap { white-space: nowrap; }
.req-suspect-wrap > .row { margin-bottom: 8px; gap: 6px; }
.q-opts { gap: 8px; margin: 4px 0 10px; align-items: center; }
.doc-appr-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.doc-appr-row { display: grid; grid-template-columns: 1fr 1fr 1.6fr auto; gap: 6px; align-items: center; }
.doc-appr-list { margin: 4px 0; padding-left: 18px; } .doc-appr-list li { margin-bottom: 4px; }
.req-tbd-kind { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; margin-right: 4px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); }
.req-tbd-table tr.overdue td { background: var(--danger-bg); }
.req-doccounts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 520px; }
.req-burn { width: 100%; max-width: 720px; height: auto; display: block; }
.req-burn .grid { stroke: var(--line); stroke-width: 1; }
.req-burn .ax { fill: var(--muted); font-size: 11px; }
.req-burn .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.req-burn .dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.req-burn .hit { fill: transparent; } .req-burn .pt:hover .dot { r: 5; }
.ep-cmt-by { color: var(--text-2); }
.doc-qs .q-stale { white-space: normal; line-height: 1.3; }

/* ---------- Direction A consistency pass (page anatomy) ---------- */
.hpage.full { max-width: none; }
.hp-purpose { margin: 0; max-width: 900px; }
.doc-list-filter { width: 240px; }
.doc-list-sort { width: 180px; }
/* Document editor: one toolbar row, left pane with Outline · Filter · Baselines · Comments */
.doc-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.doc-toolbar::-webkit-scrollbar { display: none; }
.doc-toolbar > * { flex: none; }
.doc-tabs .doc-tab { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 9px 6px; }
.doc-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); display: inline-block; }
.doc-tabs .ep-count { font-weight: 600; }
.doc-fgroup { border-bottom: 1px solid var(--border); padding-bottom: var(--sp-2); }
.doc-fgroup > summary { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-1); cursor: pointer; list-style: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); font-weight: 600; }
.doc-fgroup > summary::-webkit-details-marker { display: none; }
.doc-fgroup > summary::before { content: '▸'; font-size: 10px; width: 10px; }
.doc-fgroup[open] > summary::before { content: '▾'; }
.doc-fgroup .doc-labels-head { padding: 0 var(--sp-4) var(--sp-1); gap: var(--sp-3); }
.doc-pane-foot { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.doc-pane-foot .btn { justify-self: start; }
.doc-cmt-list { padding: 0 var(--sp-4) var(--sp-4); }
.doc-cmt-post { margin-top: var(--sp-2); }
.w-num { width: 100px; }
.doc-tree { padding-top: var(--sp-1); }
/* Quick entry bar under the document */
.doc-quick { display: flex; align-items: center; gap: var(--sp-2); flex: none; padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); background: var(--surface); }
.doc-quick-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); white-space: nowrap; }
.doc-quick-sec { width: 220px; flex: none; }
.doc-quick-text { flex: 1; min-width: 160px; }
/* Requirements health pages: Quality, Suspect Links, TBD/TBR */
.req-health { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.q-page .q-summary, .req-page .q-summary { margin-bottom: 0; }
.q-table th.q-name, .q-table td.q-name { min-width: 300px; }
.q-table .q-link { font-weight: 600; }
.q-table .q-desc { max-width: 520px; }
.q-table tbody tr[data-id], .req-tbd-table tbody tr[data-id] { cursor: pointer; }
.q-table tbody tr.selected td, .req-tbd-table tbody tr.selected td { background: var(--sel-bg); }
.q-table tbody tr.selected td:first-child, .req-tbd-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--sel-edge); }
.req-page .req-burn { max-height: 160px; }
.req-page .card-body .req-burn { max-width: 640px; }
.split > .sidebar.doc-left { width: 280px; overflow-x: hidden; }
.doc-left .doc-tabs { padding: 0 2px; }
.doc-left .doc-tabs .doc-tab { padding: 9px 5px; font-size: var(--fs-xs); }
.doc-table { min-width: 640px; }
@media (max-width: 1500px) { .doc-scroll { padding: var(--sp-3); } .doc-paper { padding: var(--sp-5) var(--sp-5) 48px; } }
/* Narrow document view: the left pane opens as an overlay; + Child folds into the + After menu; Find is icon-only */
.doc-view { position: relative; }
.doc-view.narrow .doc-left.peek { position: absolute; left: 0; top: 0; bottom: 0; z-index: 6; box-shadow: var(--shadow-pop); }
.doc-view.narrow .doc-add-child, .doc-view.narrow .doc-find-lbl { display: none; }
.doc-table td.doc-labels { overflow-wrap: normal; }
.doc-labels .label-chip { overflow-wrap: normal; word-break: normal; hyphens: auto; }
