:root {
  --bg: #f7f8fa; --panel: #ffffff; --ink: #1b1f24; --muted: #57606a; --line: #d0d7de; --accent: #0b5cad; --accent-ink: #ffffff;
  --ok: #1a7f37; --ok-bg: #dafbe1; --warn: #8a5a00; --warn-bg: #fff4d1; --bad: #b42318; --bad-bg: #ffe3e0; --info-bg: #ddf4ff;
  --focus: #b35900; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --panel: #161b22; --ink: #e6edf3; --muted: #9da7b3; --line: #30363d; --accent: #58a6ff; --accent-ink: #0e1116;
    --ok: #56d364; --ok-bg: #12261a; --warn: #e3b341; --warn-bg: #2a2210; --bad: #ff7b72; --bad-bg: #2d1416; --info-bg: #0d2238; --focus: #ffa657; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 8px; }
.skip:focus { left: 8px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
header#banner { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
header#banner h1 { font-size: 16px; margin: 0; }
.banner-item { color: var(--muted); font-size: 13px; }
.banner-item strong { color: var(--ink); }
nav#nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
nav#nav a, nav#nav span { padding: 6px 12px; border-radius: 6px; text-decoration: none; }
nav#nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
nav#nav span.disabled { color: var(--muted); border: 1px dashed var(--line); }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
h2 { font-size: 20px; margin: 4px 0 12px; } h3 { font-size: 16px; margin: 16px 0 8px; }
section.panel, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
label { display: block; font-weight: 600; margin: 8px 0 3px; }
input[type=text], input[type=number], input[type=password], textarea, select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 70px; font-family: inherit; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; } .row > * { flex: 1 1 150px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 10px 0; } legend { font-weight: 600; padding: 0 6px; }
fieldset label { display: inline-block; font-weight: 400; margin-right: 14px; }
button, .btn { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
table { border-collapse: collapse; width: 100%; font-size: 14px; } caption { text-align: left; font-weight: 600; padding: 4px 0; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.mono, pre, code { font-family: var(--mono); font-size: 13px; } pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 6px 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); background: var(--ok-bg); } .badge.warn { color: var(--warn); background: var(--warn-bg); } .badge.bad { color: var(--bad); background: var(--bad-bg); } .badge.info { color: var(--accent); background: var(--info-bg); } .badge.muted { color: var(--muted); }
.notice { border-left: 5px solid var(--accent); background: var(--info-bg); padding: 10px 14px; border-radius: 4px; margin: 10px 0; }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); } .notice.warn { border-color: var(--warn); background: var(--warn-bg); } .notice.bad { border-color: var(--bad); background: var(--bad-bg); }
.notice h3 { margin: 0 0 4px; font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-all; }
ol.timeline { list-style: none; padding: 0; margin: 8px 0; } ol.timeline li { padding: 4px 0 4px 18px; border-left: 3px solid var(--line); margin-left: 6px; } ol.timeline li.done { border-color: var(--ok); }
footer#foot { max-width: 1180px; margin: 0 auto; padding: 8px 16px 24px; color: var(--muted); font-size: 13px; }
.chips span { margin-right: 4px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
#wb-grid td.absent { background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--line) 4px, var(--line) 5px); min-width: 28px; }
#wb-grid td.hidden-cell, tr.hidden-row td { opacity: .65; }
#wb-grid td { vertical-align: top; }
details.panel summary { cursor: pointer; font-weight: 600; }
.sv-box { max-height: 420px; overflow: auto; }
.sv-box table { border-collapse: collapse; } .sv-box td, .sv-box th { border: 1px solid var(--line); padding: 2px 6px; }
#ev-image, #derived-img { max-width: 100%; height: auto; border: 1px solid var(--line); image-rendering: auto; }

/* V2_ALPHA_M8A_S1 composite PDF workspace */
.m8a-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.4fr) minmax(320px, 1.6fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .m8a-grid { grid-template-columns: 1fr; } }
#m8a-tree ul { list-style: none; padding-left: 16px; margin: 0; } #m8a-tree > ul { padding-left: 0; }
#m8a-tree li { margin: 2px 0; } #m8a-tree li.sel > .tree-sel { outline: 2px solid var(--accent); }
#m8a-tree button { padding: 2px 8px; font-size: 13px; text-align: left; } #m8a-tree .tree-tog { min-width: 26px; padding: 2px 4px; margin-right: 2px; } .tree-tog-sp { display: inline-block; min-width: 28px; text-align: center; color: var(--muted); }
.pagewrap { position: relative; width: 100%; max-width: 620px; border: 1px solid var(--line); background: #fff; }
.pagewrap img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pagewrap .ov { position: absolute; padding: 0; margin: 0; background: transparent; border: 1px solid #0b5cad; border-radius: 0; opacity: .85; }
.pagewrap .ov.off { border-color: transparent; } .pagewrap .ov.ov-table { border-color: #1a7f37; } .pagewrap .ov.ov-figure { border-color: #8a5a00; } .pagewrap .ov.ov-caption, .pagewrap .ov.ov-note { border-style: dotted; }
.pagewrap .ov.ov-unclassified, .pagewrap .ov.ov-unassigned { border-color: #b42318; border-style: dashed; } .pagewrap .ov.on { background: rgba(11, 92, 173, .22); border-width: 3px; opacity: 1; }
img.crop { max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
td.blank, td.absent, td.unreadable { background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--line) 4px, var(--line) 5px); color: var(--muted); }
details.attempt summary { cursor: pointer; font-weight: 600; font-size: 13px; }

.wb-grid3 { grid-template-columns: minmax(240px, 1fr) minmax(480px, 3fr); } @media (max-width: 1000px) { .wb-grid3 { grid-template-columns: 1fr; } }
.wb-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; } @media (max-width: 1000px) { .wb-two { grid-template-columns: 1fr; } }
#wb-tree ul { list-style: none; padding-left: 16px; margin: 0; } #wb-tree > ul { padding-left: 0; } #wb-tree li { margin: 2px 0; } #wb-tree li.sel > .tree-sel { outline: 2px solid var(--accent); }
#wb-tree button { padding: 2px 8px; font-size: 13px; text-align: left; } #wb-tree .tree-tog { min-width: 26px; padding: 2px 4px; margin-right: 2px; }
.wbpic { max-width: 100%; overflow: auto; border: 1px solid var(--line); background: #fff; } .wbpic img { display: block; max-width: none; cursor: crosshair; } .wbmedia { max-width: 100%; border: 1px solid var(--line); }
.cellbtn { background: transparent; border: 0; padding: 0 2px; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; } td.absent, em.absent, em.blank, em.nocache { color: #6b7280; } tr.totals th, tr.totals td { font-weight: 600; } tr.hiddenrow { opacity: .6; }

/* M8A_S3 document composite workspace */
.docov { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); }
.docov img { display: block; max-width: 100%; height: auto; }
.docbox { position: absolute; padding: 0; margin: 0; min-height: 0; border: 2px solid #2563eb; background: rgba(37, 99, 235, .08); cursor: pointer; }
.docbox.sel { border-color: #d2410c; background: rgba(210, 65, 12, .15); }
.docbox:focus-visible { outline: 3px solid #111; outline-offset: 1px; }
.doc-text { white-space: pre-wrap; word-break: break-word; max-height: 28em; overflow: auto; }
.rev-seg { margin-right: .25em; } .rev-seg[data-kind="deleted"] > span:first-child { text-decoration: line-through; } .rev-seg[data-kind="inserted"] > span:first-child, .rev-seg[data-kind="moved_to"] > span:first-child { text-decoration: underline; }
#doc-tree { max-height: 70vh; overflow: auto; } #doc-list .table-wrap { max-height: 40vh; overflow: auto; }

/* M8A_S4 image workspace */
.imgov { cursor: crosshair; touch-action: none; } .imgov img { user-select: none; -webkit-user-drag: none; }
.imgbox.un { border-style: dashed; border-color: #6b7280; background: rgba(107, 114, 128, .08); }
.imgdrag { position: absolute; border: 2px dashed #111; background: rgba(17, 17, 17, .08); pointer-events: none; }
#img-tree { max-height: 60vh; overflow: auto; } #img-list .table-wrap { max-height: 40vh; overflow: auto; }
.cropimg { max-width: 100%; height: auto; border: 1px solid var(--line); image-rendering: auto; }

.img-grid { display: grid; grid-template-columns: minmax(200px, .8fr) minmax(320px, 1.5fr) minmax(360px, 1.7fr); gap: 16px; align-items: start; }
.img-grid > section { min-width: 0; overflow-wrap: anywhere; } .img-grid .table-wrap, .img-grid table { max-width: 100%; overflow-x: auto; }
@media (max-width: 1100px) { .img-grid { grid-template-columns: 1fr; } }

/* M8A_S5 */
.s5-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; align-items: start; } .s5-col { min-width: 0; overflow-wrap: anywhere; }
.s5-pic { max-width: 100%; height: auto; image-rendering: auto; border: 1px solid #9ca3af; background: #fff; } .s5-picwrap { margin: 8px 0; }
.s5-perc pre.raw { white-space: pre-wrap; max-height: 280px; overflow: auto; }
.s5-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2.4fr); gap: 16px; align-items: start; } .s5-grid > section { min-width: 0; overflow-wrap: anywhere; }
#s5-tree { max-height: 460px; overflow: auto; } #s5-list { max-height: 360px; overflow: auto; } .s5-grid .table-wrap { max-width: 100%; overflow-x: auto; }
@media (max-width: 1000px) { .s5-grid { grid-template-columns: 1fr; } }

/* Product identity: text wordmark (no logo is finalized); .brand-mark reserves a slot for one. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 100%; }
.brand-mark:empty { display: none; }
.brand-text { min-width: 0; }
.brand-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
header#banner h1 { font-size: 24px; letter-spacing: .08em; line-height: 1.1; }
.badge-preview { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 1px 8px; border: 1px solid var(--muted); border-radius: 999px; color: var(--ink); }
.brand-expansion { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.brand-credit { font-size: 11.5px; color: var(--muted); }
.preview-status.low { color: #8a5a00; font-weight: 600; }
.preview-status.expired { color: #a11a1a; font-weight: 700; }
.welcome { color: var(--ink); max-width: 60ch; }
.brand-foot { margin: 0 0 6px; }
.timing-foot { margin: 0; }
@media (max-width: 560px) { header#banner h1 { font-size: 20px; } .brand-expansion { font-size: 12px; } }
@media (prefers-color-scheme: dark) { .preview-status.low { color: #e3b341; } .preview-status.expired { color: #ff7b72; } }
