/* Ad Breakdown page — every rule under .bd / .bd- ; colours only through tokens.css variables.
   Layout ≥ 1100 px: LIST 260 px · TABLE (fluid, scrolls inside its own box) · SUMMARY drawer 340 px; the Ask dock sits under the table. */
.bd { --bd-list: 260px; --bd-drawer: 340px;
  /* 8 cast hues, checked on both themes (text sits on a soft tint of the same hue) */
  --bd-h1: 205 90% 40%; --bd-h2: 340 70% 45%; --bd-h3: 150 55% 32%; --bd-h4: 30 85% 40%;
  --bd-h5: 270 60% 48%; --bd-h6: 190 70% 32%; --bd-h7: 0 65% 45%; --bd-h8: 95 50% 32%;
  display: grid; grid-template-columns: var(--bd-list) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
:root[data-theme="dark"] .bd { --bd-h1: 205 90% 68%; --bd-h2: 340 80% 72%; --bd-h3: 150 60% 60%; --bd-h4: 30 90% 65%;
  --bd-h5: 270 75% 75%; --bd-h6: 190 75% 62%; --bd-h7: 0 80% 72%; --bd-h8: 95 55% 60%; }
.bd.bd-drawer-on { grid-template-columns: var(--bd-list) minmax(0, 1fr) var(--bd-drawer); }
.bd.bd-list-off { grid-template-columns: minmax(0, 1fr); }
.bd.bd-list-off.bd-drawer-on { grid-template-columns: minmax(0, 1fr) var(--bd-drawer); }
.bd.bd-list-off .bd-list { display: none; }
.bd-page.wide { max-width: 1800px; }
.bd .help { font-size: 12px; color: var(--text-muted); }
.bd-mute { color: var(--text-muted); }
.bd-quiet { opacity: .45; }
.bd-ok { color: var(--success); font-weight: 600; }
.bd-warn { color: var(--warn); font-weight: 600; }
.bd-bad { color: var(--danger); font-weight: 600; }
.bd button, .bd input, .bd textarea { font: inherit; }
.bd .more { min-width: 32px; min-height: 32px; }

/* ---------- list column (like the chats list) ---------- */
.bd-list { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 120px); min-height: 0; }
.bd-list-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; padding: 2px 4px; }
.bd-list-new { display: flex; gap: 6px; }
.bd-list-new .btn { flex: 1; min-height: 36px; white-space: normal; }
.bd-items { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.bd-item { display: flex; align-items: stretch; gap: 2px; border-radius: var(--radius-control); }
.bd-item.active { background: rgba(105, 214, 255, .10); }
.bd-item:hover { background: var(--surface-subtle); }
.bd-item-main { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; text-align: left; border: 0; background: none; color: inherit; padding: 8px 10px; border-radius: var(--radius-control); cursor: pointer; min-height: 44px; }
.bd-item-main:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.bd-item-t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bd-item-meta { grid-column: 1 / -1; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-item .bd-status { font-size: 10px; padding: 1px 6px; }
.bd-item .badge { font-size: 10px; }
.bd-item-more { opacity: 0; align-self: center; }
.bd-item:hover .bd-item-more, .bd-item-more:focus, .bd-item.active .bd-item-more { opacity: 1; }
.bd-kind { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-muted); flex: none; }
.bd-kind-video { background: rgba(59, 142, 255, .14); color: var(--accent-text); }
.bd-kind-copy { background: var(--success-soft); color: var(--success); }
.bd-search { min-height: 36px; }

/* ---------- main column ---------- */
.bd-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bd-title { flex: 1 1 240px; min-width: 0; font-size: 18px; font-weight: 600; border: 1px solid transparent; background: transparent; color: inherit; padding: 4px 8px; border-radius: var(--radius-control); min-height: 40px; }
.bd-title:hover { border-color: var(--border); }
.bd-title:focus { outline: none; border-color: var(--brand-cyan); box-shadow: var(--glow-focus); background: var(--surface); }
.bd-head-meta { font-size: 12px; color: var(--text-muted); }
.bd-ver { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.bd-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); position: sticky; top: 0; z-index: 4; }
.bd-toolbar .seg button { min-height: 32px; padding: 0 12px; }
.bd-tsearch { flex: 1 1 160px; max-width: 280px; min-height: 36px; }
.bd-tb-right { margin-left: auto; display: inline-flex; gap: 6px; }
.bd-toolbar .btn.active { background: rgba(105, 214, 255, .12); border-color: rgba(105, 214, 255, .5); color: var(--accent-text); }
.bd-player { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }   /* not sticky: it would slide under a wrapped toolbar; ▶ scrolls it into view */
.bd-player video { height: 240px; max-width: 100%; border-radius: 8px; background: #000; }
.bd-body { min-width: 0; }

/* ---------- empty / setup ---------- */
.bd-empty { padding: 24px; }
.bd-empty h3 { margin: 0 0 14px; }
.bd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.bd-tile { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-subtle); color: inherit; cursor: pointer; min-height: 96px; }
.bd-tile:hover { border-color: var(--brand-cyan); }
.bd-tile:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.bd-tile b { font-size: 16px; }
.bd-tile span { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.bd-setup { padding: 20px; display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.bd-setup h3 { margin: 0; }
.bd-setup-asset { display: flex; gap: 12px; align-items: center; }
.bd-setup-asset img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #0003; }
.bd-setup-row { display: flex; flex-direction: column; gap: 6px; }
.bd-setup-row > label { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bd-setup-row.bd-two { flex-direction: row; gap: 12px; }
.bd-setup-row.bd-two > span { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bd-narrow { width: 96px; }
.bd-paste { min-height: 220px; font-family: inherit; }
.bd-drop { border: 1px dashed var(--border); border-radius: var(--radius-control); padding: 10px; font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bd-drop.over { border-color: var(--brand-cyan); background: rgba(105, 214, 255, .08); }
.bd-check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; min-height: 44px; }
.bd-check input { width: 18px; height: 18px; }
.bd-est { padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-subtle); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bd-setup-acts { display: flex; gap: 8px; justify-content: flex-end; }
.bd-setup-acts .btn { min-height: 44px; }
/* copy setup: the paste box is the main thing — one big Start under it, everything else folded under "More (optional)" */
.bd-setup .bd-start-big { flex: 1 1 260px; min-height: 52px; font-size: 16px; font-weight: 600; }
.bd-more-opt { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-subtle); }
.bd-more-opt > summary { cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bd-more-opt > summary::-webkit-details-marker { display: none; }
.bd-more-opt > summary::before { content: "▸"; font-size: 12px; color: var(--text-muted); transition: transform .15s; }
.bd-more-opt[open] > summary::before { transform: rotate(90deg); }
.bd-more-opt[open] > summary { border-bottom: 1px solid var(--border); }
.bd-more-opt > .bd-setup-row { padding: 0 14px; margin-top: 12px; }
.bd-more-opt > .bd-setup-row:last-child { padding-bottom: 14px; }
/* video chooser: three ways side by side; the whole card takes a dropped file */
.bd-chooser { max-width: 900px; }
.bd-chooser.over { border-color: var(--brand-cyan); box-shadow: var(--glow-focus); }
.bd-ways { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.bd-way { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 18px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: inherit; text-align: left; cursor: pointer; min-height: 120px; font: inherit; }
.bd-way b { font-size: 16px; }
.bd-way span { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.bd-way:hover, .bd-way:focus-visible { border-color: var(--brand-cyan); outline: none; }
.bd-dropzone { border-style: dashed; border-width: 2px; background: var(--surface-subtle); align-items: center; text-align: center; min-height: 160px; }
.bd-chooser.over .bd-dropzone { background: rgba(105, 214, 255, .10); border-color: var(--brand-cyan); }
.bd-vstatus:empty { display: none; }
@media (max-width: 700px) { .bd-ways { grid-template-columns: 1fr; } .bd-dropzone { min-height: 120px; } }
.bd-way-many { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; text-align: left; border: 1px dashed var(--border); border-radius: var(--radius-control); background: none; color: var(--text-muted); font: inherit; font-size: 13px; padding: 10px 14px; cursor: pointer; min-height: 44px; }
.bd-way-many b { color: var(--text); }
.bd-way-many:hover, .bd-way-many:focus-visible { border-color: var(--brand-cyan); outline: none; }

/* ---------- Many videos (a batch): the list column's Batches block, the one-screen setup, the running view ---------- */
.bd-bb-side { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.bd-bb-side-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; padding: 2px 4px; }
.bd-bb-side-head .btn { min-height: 32px; }
.bd-bb-srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 6px 10px; border-radius: var(--radius-control); cursor: pointer; min-height: 40px; width: 100%; }
.bd-bb-srow:hover { background: var(--surface-subtle); }
.bd-bb-srow.active { background: rgba(105, 214, 255, .10); }
.bd-bb-srow:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.bd-bb-st { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bd-bb-sm { grid-column: 1 / -1; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-bb-srow .badge { font-size: 10px; padding: 1px 6px; }
.bd-bb-seeall { border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 12px; text-align: left; padding: 4px 10px; cursor: pointer; min-height: 32px; }
.bd-bb-alllist { display: flex; flex-direction: column; gap: 2px; }
.bd-bb { padding: 20px; display: flex; flex-direction: column; gap: 14px; max-width: 900px; min-width: 0; }
.bd-bb h3 { margin: 0; }
.bd-bb.over { border-color: var(--brand-cyan); box-shadow: var(--glow-focus); }
.bd-bb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.bd-bb-head .bd-title { flex: 1 1 220px; }
.bd-bb-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 22px 16px; min-height: 150px; border: 2px dashed var(--border); border-radius: var(--radius-card); background: var(--surface-subtle); cursor: pointer; }
.bd-bb-drop b { font-size: 16px; }
.bd-bb-drop > span { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.bd-bb-drop:hover, .bd-bb-drop:focus-visible { border-color: var(--brand-cyan); outline: none; }
.bd-bb.over .bd-bb-drop { border-color: var(--brand-cyan); background: rgba(105, 214, 255, .10); }
.bd-bb-ways { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.bd-bb-ways .btn { min-height: 36px; }
.bd-bb-drop.bd-bb-more { min-height: 0; padding: 12px 14px; gap: 6px; border-width: 1px; }   /* after Start: the compact "Add more videos" */
.bd-bb-drop[hidden] { display: none; }
.bd-bb-link { border: 0; background: none; color: var(--accent-text); font: inherit; text-decoration: underline; cursor: pointer; padding: 0 4px; min-height: 32px; }
.bd-bb-link:focus-visible { outline: none; box-shadow: var(--glow-focus); border-radius: 4px; }
.bd-bb-ups:empty, .bd-bb-count:empty, .bd-bb-items:empty, .bd-bb-why:empty { display: none; }
.bd-bb-ups { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.bd-bb-uphead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bd-bb-up { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; font-size: 13px; }
.bd-bb-upw { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bd-bb-upw .jp-bar { margin-top: 0; }
.bd-bb-up-failed .bd-bb-upt { white-space: normal; }
.bd-bb-count { font-size: 14px; font-weight: 600; }
.bd-bb-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); max-height: 480px; overflow-y: auto; }
.bd-bb-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto minmax(0, .9fr) auto; gap: 4px 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.bd-bb-row:last-child { border-bottom: 0; }
.bd-bb-skip { color: var(--text-muted); background: var(--surface-subtle); }
.bd-bb-skip .bd-bb-name b { font-weight: 500; }
.bd-bb-n { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.bd-bb-name { display: flex; flex-direction: column; min-width: 0; }
.bd-bb-name b, .bd-bb-name .help { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-bb-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-bb-state { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.bd-bb-state .badge { font-size: 11px; }
.bd-bb-reason { font-size: 12px; overflow-wrap: anywhere; }
.bd-bb-failed .bd-bb-reason { color: var(--danger); }
.bd-bb-acts1 { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.bd-bb-set { display: flex; flex-direction: column; gap: 14px; }
.bd-bb-fmts { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px 14px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 0 16px; min-width: 0; }
.bd-bb-fmts legend { font-size: 13px; font-weight: 600; padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.bd-bb-fmts .help { flex-basis: 100%; margin: 0; }
.bd-bb-fmts .bd-check { min-height: 40px; }
.bd-bb .bd-setup-acts { align-items: center; flex-wrap: wrap; }
.bd-bb-why { margin-right: auto; }
.bd-bb-run { display: flex; flex-direction: column; gap: 6px; }
.bd-bb-over { font-size: 14px; }
.bd-bb-money { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bd-bb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.bd-bb-acts .btn { min-height: 36px; }
.bd-bb-xs { padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-subtle); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bd-bb-xs-ok { background: var(--success-soft); }
.bd-bb-xs-bad { background: var(--danger-soft); color: var(--danger); }
.bd-bb-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; margin-top: 10px; }
.bd-bb-pick { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 6px; border: 2px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: inherit; font: inherit; font-size: 12px; cursor: pointer; min-width: 0; }
.bd-bb-pick img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--surface-subtle); }
.bd-bb-pick .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-bb-pick.on { border-color: var(--brand-cyan); background: rgba(105, 214, 255, .10); }
.bd-bb-pick:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.bd-bb-pick[disabled] { opacity: .5; cursor: default; }
.bd-bb-dlg-acts { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.bd-bb-dlg-acts .help { margin-right: auto; }
@media (max-width: 700px) {
  .bd-bb { padding: 14px; }
  .bd-bb-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .bd-bb-meta { grid-column: 2; }
  .bd-bb-state { grid-column: 2 / -1; }
  .bd-bb-acts1 { grid-column: 3; grid-row: 1; }
  .bd-bb-up { grid-template-columns: minmax(0, 1fr) auto; }
  .bd-bb-upw { grid-column: 1 / -1; grid-row: 2; }
  .bd-bb-items { max-height: none; }
}
@media (pointer: coarse) { .bd-bb-row .btn, .bd-bb-up .btn, .bd-bb-acts .btn, .bd-bb-ways .btn, .bd-bb-side-head .btn, .bd-bb-srow, .bd-bb-seeall { min-height: 44px; } }

/* ---------- job card / banners ---------- */
.bd-job { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bd-job-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bd-job-top b { font-size: 16px; }
.bd-bar { height: 8px; border-radius: 4px; }
.bd-bar i { background: var(--gradient-primary); }
.bd-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-muted); }
.bd-steps li.done { color: var(--success); }
.bd-steps li.now { color: var(--accent-text); font-weight: 600; }
.bd-tick { display: inline-block; width: 16px; }
.bd-job-money { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.bd-job-acts { display: flex; align-items: center; gap: 8px; }
.bd-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--radius-card); border: 1px solid var(--border); margin-bottom: 10px; font-size: 13px; flex-wrap: wrap; }
.bd-banner-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.bd-banner-bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.bd-banner .help { color: inherit; opacity: .8; }
.bd-shimmer { color: var(--text-muted); font-style: italic; background: linear-gradient(90deg, transparent, rgba(127, 127, 127, .18), transparent); background-size: 200% 100%; animation: bd-shimmer 1.6s infinite linear; border-radius: 4px; padding: 0 4px; }
@keyframes bd-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- the table ---------- */
/* the wrapper is the table's own scroll box in BOTH directions, so the column header row, the section header rows and
   the Time column all stick to its edges while the writer scrolls the table — a non-visible overflow-x makes it a scroll
   container anyway, and a scroll container that never scrolls vertically can hold nothing sticky */
.bd-tablewrap { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 210px); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); max-width: 100%; }
.bd-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 960px; font-size: 13px; line-height: 1.45; table-layout: fixed; }
.bd-table th, .bd-table td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--border); text-align: left; min-width: 0; overflow-wrap: anywhere; }
.bd-table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-subtle); font-size: 12px; color: var(--text-muted); }
.bd-table .bd-th-time, .bd-table .bd-td-time { width: 84px; position: sticky; left: 0; z-index: 2; background: var(--surface); }
.bd-table thead .bd-th-time { z-index: 4; background: var(--surface-subtle); }
.bd-table .bd-th-frames, .bd-table .bd-td-frames { width: 312px; }
.bd-table.bd-full .bd-th-frames, .bd-table.bd-full .bd-td-frames { width: 616px; }
.bd-video .bd-td-brk, .bd-video th:nth-child(5) { width: 28%; }
.bd-copy .bd-th-n, .bd-copy .bd-td-n { width: 56px; position: sticky; left: 0; z-index: 2; background: var(--surface); }
.bd-copy thead .bd-th-n { z-index: 4; background: var(--surface-subtle); }
.bd-copy .bd-td-copy { width: 34%; }
.bd-copy .bd-td-job { width: 28%; }
.bd-th-extra { white-space: normal; }
.bd-fromchat { font-size: 10px; text-transform: none; letter-spacing: 0; opacity: .7; margin-left: 4px; }
.bd-row { cursor: pointer; }
.bd-row:hover td { background: var(--surface-subtle); }
.bd-row:focus-visible { outline: none; }
.bd-row:focus-visible td { box-shadow: inset 0 0 0 2px var(--brand-cyan); }
.bd-row.bd-open td { background: rgba(105, 214, 255, .04); }
.bd-td-time b { display: block; font-size: 12px; }
.bd-td-time span, .bd-td-n span { display: block; font-size: 11px; color: var(--text-muted); }
.bd-rid { font-family: Menlo, Consolas, monospace; }
.bd-play { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 32px; height: 32px; margin-top: 4px; cursor: pointer; color: var(--accent-text); }
.bd-play:hover { border-color: var(--brand-cyan); }
.bd-rowmenu { display: block; margin-top: 2px; }
.bd-strip { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bd-thumb { position: relative; border: 0; padding: 0; background: #0003; border-radius: 8px; overflow: hidden; cursor: zoom-in; width: 96px; aspect-ratio: 16 / 9; flex: none; }
.bd-full .bd-thumb { width: 192px; }
.bd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-thumb i { position: absolute; right: 3px; bottom: 3px; font-style: normal; font-size: 10px; font-weight: 600; background: rgba(0, 0, 0, .7); color: #fff; padding: 1px 5px; border-radius: 4px; font-family: Menlo, Consolas, monospace; }
.bd-thumb:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.bd-thumb em { display: none; }
.bd-thumb-missing img { display: none; }
.bd-thumb-missing em { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-style: normal; font-size: 11px; color: var(--text-muted); background: var(--surface-subtle); border: 1px dashed var(--border); border-radius: 8px; box-sizing: border-box; }
.bd-plus { font-size: 11px; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.bd-line { display: flex; gap: 6px; align-items: baseline; margin-bottom: 4px; }
.bd-said { flex: 1; min-width: 0; }
.bd-likely { font-size: 11px; color: var(--text-muted); }
.bd-edited { color: var(--warn); font-size: 10px; }
.bd-cast { display: inline-block; flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; font-family: Menlo, Consolas, monospace; line-height: 1.5; background: hsl(var(--bd-hue) / .16); color: hsl(var(--bd-hue)); border: 1px solid hsl(var(--bd-hue) / .35); cursor: help; }
.bd-hue-1 { --bd-hue: var(--bd-h1); } .bd-hue-2 { --bd-hue: var(--bd-h2); } .bd-hue-3 { --bd-hue: var(--bd-h3); } .bd-hue-4 { --bd-hue: var(--bd-h4); }
.bd-hue-5 { --bd-hue: var(--bd-h5); } .bd-hue-6 { --bd-hue: var(--bd-h6); } .bd-hue-7 { --bd-hue: var(--bd-h7); } .bd-hue-8 { --bd-hue: var(--bd-h8); }
.bd-cast.bd-hue-vo { background: var(--surface-subtle); color: var(--text-muted); border-color: var(--border); }
.bd-cast.bd-hue-unk, .bd-cast.hollow { background: transparent; color: var(--text-muted); border-style: dashed; border-color: var(--text-muted); }
.bd-cast-name { font-size: 11px; color: var(--text-muted); }
.bd-edit-say { opacity: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; margin-top: 2px; color: var(--text-muted); }
.bd-row:hover .bd-edit-say, .bd-edit-say:focus { opacity: 1; }
.bd-editsay { display: flex; flex-direction: column; gap: 6px; }
.bd-editsay label { display: flex; gap: 6px; align-items: flex-start; }
.bd-editsay textarea { flex: 1; min-height: 44px; }
.bd-editsay-acts { display: flex; gap: 6px; justify-content: flex-end; }
.bd-kv { display: grid; grid-template-columns: 84px 1fr; gap: 2px 8px; margin-bottom: 3px; }
.bd-kv b { font-size: 12px; color: var(--text-muted); padding-top: 2px; }
.bd-quote { display: inline-block; background: var(--surface-subtle); border-radius: 8px; padding: 1px 6px; font-style: italic; }
.bd-obj { font-weight: 600; margin-bottom: 4px; }
.bd-td-brk > div, .bd-td-brk .bd-clamp > div { margin-bottom: 4px; }
.bd-td-brk b, .bd-improve b { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.bd-steal { background: rgba(105, 214, 255, .10); border-left: 3px solid var(--brand-cyan); padding: 4px 8px; border-radius: 0 6px 6px 0; }
.bd-pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.bd-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-subtle); color: var(--foreground); cursor: help; line-height: 1.6; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bd-pill:focus-visible { outline: none; box-shadow: var(--glow-focus); }
/* "Tier 2 — high leverage…": the meaning written out after the pill, in Full density (hover / tap gives it in Compact) */
.bd-gloss-inline { display: none; font-size: 12px; color: var(--text-muted); }
.bd-table.bd-full .bd-gloss-inline { display: inline; }
.bd-tech { border-color: rgba(59, 142, 255, .35); background: rgba(59, 142, 255, .10); color: var(--accent-text); }
.bd-gate { border-color: rgba(224, 164, 88, .5); background: var(--warn-soft); color: var(--warn); }
.bd-enemy { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.bd-phase { background: var(--info-soft); color: var(--accent-text); border-color: transparent; }
.bd-meta { background: var(--surface-subtle); font-family: Menlo, Consolas, monospace; }
.bd-aw, .bd-open-mode, .bd-tp { background: var(--info-soft); color: var(--accent-text); border-color: transparent; }
.bd-tier { color: #fff; border-color: transparent; }
.bd-tier-1 { background: var(--danger); }
.bd-tier-2 { background: var(--warn); }
.bd-tier-3 { background: var(--brand-blue-solid); }
.bd-tier-4 { background: var(--text-muted); }
:root[data-theme="dark"] .bd-tier { color: var(--brand-navy); }   /* the dark --warn / --danger / --text-muted fills are too light for white text */
.bd-verdict { border-color: transparent; }
.bd-v-approve { background: var(--success-soft); color: var(--success); }
.bd-v-approveadd { background: var(--info-soft); color: var(--accent-text); }
.bd-v-pushdeeper { background: var(--warn-soft); color: var(--warn); }
.bd-v-disagree { background: var(--danger-soft); color: var(--danger); }
.bd-loops { display: flex; flex-wrap: wrap; gap: 4px; }
.bd-loop { font-size: 11px; padding: 1px 7px; border-radius: 8px; border: 1px dashed var(--border); color: var(--text-muted); }
.bd-loop-opens { border-color: var(--brand-cyan); color: var(--accent-text); }
.bd-loop-closes { border-color: var(--success); color: var(--success); border-style: solid; }
.bd-improve { background: var(--warn-soft); border-radius: 8px; padding: 6px 8px; }
.bd-nr { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.bd-notemark { color: var(--accent-text); font-weight: 700; cursor: help; margin-left: 2px; }
.bd-notes { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.bd-note { font-size: 12px; background: var(--warn-soft); border-radius: 8px; padding: 3px 8px; }
.bd-hit { background: rgba(224, 164, 88, .35); border-radius: 4px; }
.bd-flash td, td.bd-flash { animation: bd-flash 2s ease-out; }
@keyframes bd-flash { 0% { box-shadow: inset 0 0 0 2px var(--brand-cyan); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
/* 3-line clamp + more (compact); the row's open state or Full density unclamps */
.bd-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bd-more { border: 0; background: none; color: var(--accent-text); font-size: 12px; padding: 2px 0; cursor: pointer; min-height: 24px; }
.bd-cell-open .bd-clamp, .bd-open .bd-clamp, .bd-full .bd-clamp { display: block; -webkit-line-clamp: unset; overflow: visible; }
.bd-cell-open .bd-more, .bd-open .bd-more, .bd-full .bd-more { display: none; }
/* section header rows */
.bd-sec td { background: var(--surface-subtle); position: sticky; top: 37px; z-index: 2; border-bottom: 1px solid var(--border); padding: 6px 10px; }
.bd-sec-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bd-sec-name { font-size: 13px; letter-spacing: .02em; }
.bd-sec-meta { color: var(--text-muted); font-size: 12px; }
.bd-sec-purpose { flex: 1 1 240px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bd-table.bd-full .bd-sec-purpose, .bd-sec:not(.bd-collapsed) .bd-sec-purpose { white-space: normal; }
.bd-copysec { opacity: 0; }
.bd-sec:hover .bd-copysec, .bd-copysec:focus { opacity: 1; }
.bd-seccard-btn { min-height: 28px; font-size: 12px; }
.bd-chev { border: 0; background: none; color: var(--text-muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.bd-chev:hover { background: var(--surface); color: var(--foreground); }
.bd-seccard { display: grid; gap: 8px; padding: 8px 4px 4px 40px; font-size: 13px; white-space: normal; }
.bd-seccard b { display: block; font-size: 12px; color: var(--text-muted); }
.bd-seccard ul { margin: 2px 0 0; padding-left: 18px; }

/* ---------- summary drawer ---------- */
.bd-drawer { display: none; position: sticky; top: 0; max-height: calc(100vh - 120px); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.bd-drawer-on .bd-drawer { display: block; }
.bd-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.bd-drawer-in { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.bd-card { border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px 12px; font-size: 13px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.bd-card h4 { margin: 0 0 6px; font-size: 12px; color: var(--text-muted); }
.bd-card p { margin: 0; }
.bd-big { font-size: 16px; font-weight: 600; line-height: 1.35; }
.bd-dl { display: grid; grid-template-columns: 92px 1fr; gap: 4px 8px; margin: 0; }
.bd-dl dt { color: var(--text-muted); font-size: 12px; }
.bd-dl dd { margin: 0; min-width: 0; }
.bd-ul, .bd-ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.bd-mech { display: flex; gap: 8px; align-items: center; }
.bd-mech i { color: var(--accent-text); font-style: normal; font-weight: 700; }
.bd-bars { display: flex; gap: 2px; margin-bottom: 8px; height: 22px; }
.bd-bar.bd-bar, .bd-bars .bd-bar { border: 0; border-radius: 4px; background: rgba(59, 142, 255, .25); color: var(--accent-text); font-size: 11px; font-weight: 700; cursor: pointer; min-width: 14px; }
.bd-bars .bd-bar:hover { background: var(--brand-cyan); color: var(--brand-navy); }
.bd-jump { border: 0; background: none; color: var(--accent-text); font-family: Menlo, Consolas, monospace; font-size: 12px; padding: 0 2px; cursor: pointer; text-decoration: underline dotted; }
.bd-mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.bd-mini .bd-pill, .bd-mini .bd-jump { white-space: normal; text-align: left; display: inline; overflow: visible; }
.bd-mini .bd-tier { white-space: nowrap; }
.bd-mini td, .bd-mini th { overflow-wrap: break-word; word-break: normal; }
.bd-mini th, .bd-mini td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bd-mini th { font-size: 12px; color: var(--text-muted); }
.bd-elements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bd-elements .bd-check { display: inline-block; width: 18px; min-height: 0; font-weight: 700; }
.bd-elements li.on .bd-check { color: var(--success); }
.bd-elements li.off .bd-check { color: var(--danger); }
.bd-chain { font-family: Menlo, Consolas, monospace; font-size: 12px; }
.bd-castlist { display: flex; flex-direction: column; gap: 6px; }
.bd-castrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bd-castname { flex: 1 1 140px; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.bd-tpcard { border-color: var(--brand-cyan); }

/* ---------- Ask dock ---------- */
/* The Ask dock (Sep 8, Mit's screenshot): the dock is a column — head pinned, ONLY the messages scroll, the
   composer pinned at the foot. Before, the whole dock scrolled and long replies slid under the Quick/Normal switch. */
.bd-dock { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); margin-top: 12px; resize: vertical; overflow: hidden; min-height: 44px; }
.bd-dock:not(.bd-dock-closed) { height: 360px; display: flex; flex-direction: column; }
.bd-dock-closed .bd-dock-body { display: none; }
.bd-dock-closed { resize: none; position: sticky; bottom: 0; z-index: 3; box-shadow: var(--shadow-card); }   /* the closed dock stays in view at the foot of the page */
.bd-dock-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); min-height: 44px; background: var(--surface); position: relative; z-index: 2; }
.bd-dock-toggle { border: 0; background: none; color: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 4px; min-height: 32px; }
.bd-ask-tier { margin-left: auto; }
.bd-dock-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.bd-chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; }
.bd-chip { border: 1px solid var(--border); background: var(--surface-subtle); color: inherit; border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; min-height: 32px; }
.bd-chip:hover { border-color: var(--brand-cyan); }
.bd-msgs { flex: 1; min-height: 60px; overflow-y: auto; display: grid; gap: 8px; align-content: start; padding-right: 4px; }
.bd-msgs .bubble { max-width: 92%; }
.bd-msgs .bubble.user { justify-self: end; }
.bd-msgs .bubble.assistant .bd-md { line-height: 1.55; }
.bd-msgs .bubble.assistant .bd-md abbr { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
.bd-turn-acts { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.bd-turn-copy { min-height: 28px; padding: 2px 10px; font-size: 12px; }
.bd-ask-row { flex: none; display: flex; gap: 8px; align-items: flex-end; }
.bd-ask-row textarea { flex: 1; min-height: 44px; }
.bd-ask-row .btn { min-height: 44px; }
.bd-ask-cost { flex: none; margin: 0; }

/* ---------- menus / viewer / history ---------- */
.bd-menu { position: fixed; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); box-shadow: var(--shadow-floating); padding: 4px; display: flex; flex-direction: column; }
.bd-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none; color: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; min-height: 40px; }
.bd-menu button:hover, .bd-menu button:focus-visible { background: var(--surface-subtle); outline: none; }
.bd-menu button.danger { color: var(--danger); }
.bd-menu button:disabled { opacity: .45; cursor: default; }
.bd-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.dialog.bd-viewer-dlg { width: min(calc(100vw - 32px), 1100px); }
.bd-viewer img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 8px; background: #000; display: block; }
.bd-viewer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bd-viewer-bar .btn { min-height: 36px; }
.bd-hist { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.bd-hist-row { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ---------- responsive ---------- */
/* under 1500 px there is no room for list + a 960-px table + drawer: the drawer floats over the right edge instead */
@media (max-width: 1500px) {
  .bd.bd-drawer-on { grid-template-columns: var(--bd-list) minmax(0, 1fr); }
  .bd.bd-list-off.bd-drawer-on { grid-template-columns: minmax(0, 1fr); }
  .bd-drawer-on .bd-drawer { position: fixed; inset: 8vh 12px auto auto; width: min(420px, calc(100vw - 24px)); max-height: 84vh; z-index: 50; box-shadow: var(--shadow-floating); }
}
@media (max-width: 1100px) {
  .bd, .bd.bd-drawer-on, .bd.bd-list-off, .bd.bd-list-off.bd-drawer-on { grid-template-columns: minmax(0, 1fr); }
  .bd-list { position: static; max-height: none; border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px; background: var(--surface); }
  .bd-list .bd-items { flex: none; max-height: 34vh; }   /* Oct 18: the column grows to fit and only the breakdowns scroll — a 40vh cap let the batches push them out of sight */
  .bd-drawer-on .bd-drawer { inset: 8vh 12px auto 12px; width: auto; }
}
@media (max-width: 700px) {
  .bd-toolbar { position: static; }                       /* five wrapped rows must not pin a third of the screen */
  .bd-tablewrap { max-height: none; overflow: visible; }  /* the page scrolls; the stacked cards need no sticky header */
  .bd-table { min-width: 0; table-layout: auto; display: block; }
  .bd-table thead { display: none; }
  .bd-table tbody, .bd-table tr, .bd-table td { display: block; width: auto !important; position: static !important; }
  .bd-row { border-bottom: 2px solid var(--border); padding: 6px 0; }
  .bd-row td { border-bottom: 0; padding: 4px 10px; }
  .bd-td-vis::before, .bd-td-brk::before, .bd-td-say::before, .bd-td-job::before, .bd-td-imp::before, .bd-td-note::before { content: attr(data-label); display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
  .bd-td-say::before { content: "Transcript"; } .bd-td-vis::before { content: "Visuals"; } .bd-td-brk::before { content: "Breakdown"; }
  .bd-td-job::before { content: "What it's doing"; } .bd-td-imp::before { content: "Improve"; } .bd-td-note::before { content: "Note review"; }
  .bd-td-time { display: flex !important; gap: 8px; align-items: center; }
  .bd-td-time b, .bd-td-time span { display: inline; }
  .bd-strip { overflow-x: auto; flex-wrap: nowrap; }
  .bd-thumb, .bd-full .bd-thumb { width: 128px; }
  .bd-edit-say, .bd-item-more, .bd-copysec { opacity: 1; }
  .bd-dock:not(.bd-dock-closed) { height: auto; }
  .bd-player video { height: 160px; }
}
@media (pointer: coarse) {
  .bd-play, .bd-chev, .bd-edit-say, .bd .more, .bd-more, .bd-chip, .bd-toolbar .seg button, .bd-setup .seg button { min-width: 44px; min-height: 44px; }
  .bd-edit-say, .bd-item-more, .bd-copysec { opacity: 1; }
  .bd-thumb { min-height: 44px; }
}

/* ---------- print: a clean degrade — the Download ▸ PDF button uses the server PDF ---------- */
@media print {
  .bd-list, .bd-drawer, .bd-dock, .bd-toolbar, .bd-player, .bd-play, .bd-rowmenu, .bd-edit-say, .bd-more, .bd-copysec, .bd-ver, .bd-chev, .bd-list-show, .bd .tip { display: none !important; }
  .bd, .bd.bd-drawer-on { display: block; }
  .bd-tablewrap { overflow: visible; max-height: none; border: 0; }
  .bd-table { min-width: 0; width: 100%; table-layout: auto; font-size: 10pt; }
  .bd-gloss-inline { display: inline; }
  .bd-table thead { display: table-header-group; }
  .bd-table thead th, .bd-sec td, .bd-td-time, .bd-td-n { position: static; }
  .bd-clamp { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .bd-sec.bd-collapsed + tr, .bd-seccard[hidden] { display: table-row; }
  .bd-table tr { page-break-inside: avoid; break-inside: avoid; }
  .bd-thumb, .bd-full .bd-thumb { width: 26mm; }
  .bd-pill, .bd-cast { border: 1px solid #999; color: #000 !important; background: none !important; }
}

/* Sep 7 (Mit): frame thumbnails SMALL but at their real shape — never cropped, so the picture is readable.
   Height fixed, width follows the video's aspect (a 9:16 clip gives tall narrow thumbs, a 16:9 clip wide ones). */
.bd-thumb { width: auto; height: 56px; aspect-ratio: auto; max-width: 132px; }
.bd-full .bd-thumb { height: 100px; max-width: 220px; }
.bd-thumb img { width: auto; height: 100%; max-width: 100%; object-fit: contain; background: #000; }
.bd-way-off { opacity: .6; }   /* no active project yet: the drop zone says to pick one first */

/* Sep 8 (Mit): the time stamp on a thumbnail hid the picture — tiny now, and only on hover / keyboard focus. */
.bd-thumb i { display: none; font-size: 10px; line-height: 1.2; padding: 0 3px; border-radius: 4px; right: 2px; bottom: 2px; }
.bd-thumb:hover i, .bd-thumb:focus-visible i { display: block; }
@media (pointer: coarse) { .bd-thumb i { display: block; font-size: 10px; opacity: .85; } }   /* no hover on touch: keep it, but small */
