/* Evidence workbench (analysis.html). Uses the colour tokens from style.css. */
body.wb { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.mono { font-family: var(--mono); }
.hint { font-size: .8rem; color: var(--muted); margin: 4px 0 0; }
.row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.row.wrap { flex-wrap: wrap; }
.row input[type=text], .row select, .fld input, .fld select {
  font: inherit; font-size: .85rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 7px; min-width: 0;
}
.row input[type=text] { flex: 1; }
.fld { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: 6px; }
.fld.inline { flex-direction: row; align-items: center; gap: 8px; }
.fld input.invalid { border-color: var(--accent); }
.chk { font-size: .8rem; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.btn.sm { padding: 5px 10px; font-size: .8rem; border-radius: 6px; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
label.btn { display: inline-flex; align-items: center; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- top bar & tabs ---------- */
.wb-top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--term-bg); color: #f1f2f4; flex-wrap: wrap; }
.wb-back { color: #f1f2f4; text-decoration: none; font-size: 1.3rem; }
.wb-title { display: flex; flex-direction: column; line-height: 1.2; }
.wb-title .small { color: #a0a5ad; }
.wb-image { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; font-size: .85rem; color: #c5c9cf; }
.wb-image #img-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font: 600 .75rem var(--sans); padding: 3px 8px; border-radius: 99px; background: #33373d; color: #c5c9cf; white-space: nowrap; }
.badge.ok { background: #1e7a3c; color: #fff; }
.badge.bad { background: #b3261e; color: #fff; }
.wb-top .btn-ghost { background: transparent; color: #f1f2f4; border-color: #4a4f57; }

.wb-tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.wb-tabs button { font: 600 .9rem var(--sans); padding: 10px 14px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.wb-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.wb-empty { padding: 40px 16px; max-width: 760px; margin: 0 auto; }
.wb-panel { flex: 1; min-height: 0; }
.wb-panel[hidden] { display: none !important; }
.wb-page { overflow: auto; padding-bottom: 40px; }
.wb-page h2 { margin: 20px 0 8px; }

/* ---------- hex layout ---------- */
.wb-panel[data-wbpanel="hex"] { display: grid; grid-template-columns: 230px minmax(0, 1fr) 380px; }
.hx-side, .hx-right { overflow-y: auto; padding: 10px 14px 24px; background: var(--surface); }
.hx-side { border-right: 1px solid var(--border); }
.hx-right { border-left: 1px solid var(--border); }
.hx-side section, .hx-right section { padding: 8px 0 12px; border-bottom: 1px solid var(--border); }
.hx-side h3, .hx-right h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }

.hx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--term-bg); color: var(--term-fg); overflow-x: auto; }
.hx-head { padding: 6px 12px 4px; color: var(--term-dim); font-size: 13px; white-space: pre; border-bottom: 1px solid #2a2e34; }
.hx-body { flex: 1; min-height: 0; display: flex; }
.hx-view { flex: 1; min-width: 640px; padding: 2px 12px; font-size: 13px; line-height: 20px; white-space: pre; overflow: hidden; outline: none; user-select: none; cursor: text; }
.hx-view:focus-visible { box-shadow: inset 0 0 0 2px var(--term-prompt); }
.hx-row { height: 20px; }
.hx-row.sec { box-shadow: inset 0 1px 0 #2f343b; }
.hx-row .off { color: var(--term-prompt); }
.hx-view span.z { color: #5c626b; }
.hx-view span.s { background: #2f5b8f; color: #fff; }
.hx-view span.c { outline: 1px solid var(--term-warn); outline-offset: -1px; background: #574a12; color: #fff; }
.hx-track { width: 14px; background: #1f2226; position: relative; cursor: pointer; touch-action: none; }
.hx-thumb { position: absolute; left: 2px; right: 2px; top: 0; background: #4a4f57; border-radius: 6px; }
.hx-status { padding: 5px 12px; font-size: 12px; color: var(--term-dim); border-top: 1px solid #2a2e34; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* template colours (hex view + swatches) */
.t0 { background: #5b2e2e; } .t1 { background: #2e4a5b; } .t2 { background: #3f5b2e; }
.t3 { background: #5b4a2e; } .t4 { background: #4a2e5b; } .t5 { background: #2e5b52; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.sw.t-1 { background: transparent; border: 1px dashed var(--border); }

.kvt { width: 100%; border-collapse: collapse; font-size: .8rem; }
.kvt th { text-align: left; font-weight: 500; color: var(--muted); padding: 2px 8px 2px 0; white-space: nowrap; vertical-align: top; }
.kvt td { padding: 2px 0; overflow-wrap: anywhere; }
#interp td { font-family: var(--mono); }

.tpl-out h4 { margin: 10px 0 4px; font-size: .85rem; }
table.tpl { width: 100%; border-collapse: collapse; font-size: .76rem; margin-bottom: 8px; }
table.tpl caption { text-align: left; font-weight: 700; padding: 4px 6px; background: var(--surface-2); border-radius: 4px 4px 0 0; }
table.tpl.del caption { background: var(--accent-soft); color: var(--accent); }
table.tpl.lfn caption { font-style: italic; }
table.tpl.dim { opacity: .6; }
table.tpl td { padding: 2px 6px 2px 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
table.tpl td.off { color: var(--muted); width: 3.2em; }
table.tpl tr { cursor: pointer; }
table.tpl tr:hover td { background: var(--surface-2); }
table.tpl tr.jump td { font-style: italic; color: var(--muted); }
table.tpl tr.jump td:last-child { color: var(--accent); text-decoration: underline; }
table.tpl td.has-desc { cursor: help; }
table.tpl td.has-desc::after { content: " ⓘ"; color: var(--muted); font-size: .85em; }

.bm-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: .85rem; }
.bm-list li { display: flex; gap: 6px; align-items: baseline; }
.bm-list .x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; }

/* ---------- terminal ---------- */
.sh-panel { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.sh-term { display: flex; flex-direction: column; min-height: 0; border-radius: 0; box-shadow: none; }
.sh-term .term-out { flex: 1; height: auto; min-height: 0; }
.sh-files { overflow-y: auto; padding: 12px 14px 24px; background: var(--surface); border-left: 1px solid var(--border); }
.sh-files h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.sh-list { list-style: none; margin: 0; padding: 0; }
.sh-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.sh-thumb { width: 52px; height: 40px; object-fit: cover; border-radius: 4px; cursor: zoom-in; background: var(--surface-2); }
.sh-ico { font-size: 1.5rem; text-align: center; }
.sh-name { font-size: .8rem; overflow-wrap: anywhere; }
.sh-acts { grid-column: 2; display: flex; gap: 4px; }
.sh-view { margin: 0 0 10px; cursor: zoom-out; }
.sh-view img { border-radius: 6px; border: 1px solid var(--border); width: 100%; }
.sh-view figcaption { margin-top: 4px; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--accent); font-weight: 600; }
progress { width: 180px; }

/* ---------- exif ---------- */
.exif-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; margin-top: 16px; align-items: start; }
.exif-table { font-size: .88rem; }
.exif-table th, .exif-table td { padding: 4px 12px; border-bottom: 1px solid var(--border); }
.exif-table tr.grp th { color: var(--accent); font-weight: 700; padding-top: 12px; }
.exif-prev { margin: 0; }
.exif-prev img { border-radius: var(--radius); border: 1px solid var(--border); }

/* ---------- file system view ---------- */
.wb-panel[data-wbpanel="fs"] { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.fs-tree { overflow: auto; padding: 10px 8px; background: var(--surface); border-right: 1px solid var(--border); font-size: .88rem; }
.fs-tree ul { list-style: none; margin: 0; padding-left: 14px; }
.fs-tree > ul { padding-left: 0; }
.fs-node { font: inherit; background: none; border: 0; padding: 3px 6px; border-radius: 4px; color: var(--text); cursor: pointer; text-align: left; white-space: nowrap; }
.fs-node:hover { background: var(--surface-2); }
.fs-node.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.fs-main { overflow: auto; padding: 12px 16px 32px; }
.fs-path { font-size: .9rem; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.fs-note { margin: 8px 0 12px; }
.fs-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 760px; }
.fs-table th, .fs-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.fs-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.fs-table td.sz { text-align: right; }
.fs-table tr.hid td { color: var(--muted); font-style: italic; }
.fs-table .acts { text-align: right; }
.fs-table .linkbtn { color: var(--text); text-decoration: none; font-weight: 600; }

/* ---------- export bars ---------- */
.xbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
.xbar select { font: inherit; font-size: .8rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.xbar .xmsg { color: var(--ok); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .wb-panel[data-wbpanel="hex"] { grid-template-columns: 200px minmax(0, 1fr); }
  .hx-right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); max-height: 40vh; }
}
@media (max-width: 760px) {
  body.wb { height: auto; overflow: auto; }
  .wb-panel[data-wbpanel="hex"] { display: flex; flex-direction: column; }
  .hx-main { height: 70vh; }
  .hx-side, .hx-right { max-height: none; }
  .exif-grid { grid-template-columns: 1fr; }
  .wb-panel[data-wbpanel="fs"] { display: flex; flex-direction: column; }
  .fs-tree { border-right: 0; border-bottom: 1px solid var(--border); }
  .sh-panel { display: flex; flex-direction: column; }
  .sh-term { height: 70vh; }
}
