.task-view { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; padding-bottom: 24px; }
.task-view [hidden] { display: none !important; }
.tv-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.tv-nav a { color: var(--text-secondary, var(--muted)); font-size: 13px; }
.tv-context h1 { font-size: 20px; line-height: 1.4; margin: 0; }
.tv-eyebrow { color: var(--muted); font-size: 12px; }
.tv-fixed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; }
.task-view h2 { font-size: 16px; margin: 0 0 14px; }
.task-view section, .task-view header, .tv-block { min-width: 0; overflow-wrap: anywhere; }
.tv-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.tv-item .btn { flex-shrink: 0; }
.tv-item p { margin: 6px 0; }
.tv-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.tv-artifact { padding: 12px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.tv-artifact p { margin: 8px 0; }
.task-view summary { cursor: pointer; font-weight: 600; }
.task-view details[open] > summary { margin-bottom: 16px; }
.tv-block { margin-bottom: 16px; }
.tv-annotation-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.tv-annotation-filter label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tv-annotation-filter select { max-width: 100%; }
.tv-scroll { overflow-x: auto; max-width: 100%; }
.tv-timeline { padding-left: 22px; }
.tv-timeline li { padding: 8px 0; }
.tv-timeline time { color: var(--muted); font-size: 12px; }
.task-view progress { width: 100%; height: 5px; accent-color: var(--accent); }
.task-view pre { max-width: 100%; overflow-x: auto; }
.tv-result[data-result="pass"] { color: var(--success, #23845a); }
.tv-result[data-result="fail"] { color: var(--danger, #c44); }
.workspace:has(.task-view) { grid-template-columns: var(--nav-width) minmax(0, 1fr); transition: none; }
.workspace.nav-collapsed:has(.task-view) { grid-template-columns: var(--nav-collapsed) minmax(0, 1fr); }
@media (max-width: 720px) {
  .workspace.nav-collapsed:has(.task-view) { grid-template-columns: var(--nav-collapsed) minmax(0, 1fr); }
  .workspace.nav-collapsed:has(.task-view) .modnav-item span:not(.mi), .workspace.nav-collapsed:has(.task-view) .modnav-group,
  .workspace.nav-collapsed:has(.task-view) .nav-recent, .workspace.nav-collapsed:has(.task-view) .nu-t { display: none; }
  .workspace.nav-collapsed:has(.task-view) .modnav-item { justify-content: center; }
  .tv-item > .md { min-width: 0; }
}
@media (max-width: 720px) { .tv-fixed-grid { grid-template-columns: minmax(0, 1fr); } .tv-item { gap: 8px; } .task-view { gap: 12px; } }
.tv-toolbar, .tv-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-drawer { position: fixed; z-index: 80; right: 0; top: 0; bottom: 0; width: min(460px, 92vw); padding: 24px; display: flex; flex-direction: column; overflow: hidden; background: var(--surface, var(--bg)); color: var(--text); border-left: 1px solid var(--border); box-shadow: -8px 0 32px #0002; }
.tv-drawer > header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tv-drawer form { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.tv-drawer-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.tv-drawer-actions { flex-shrink: 0; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.tv-drawer-actions > :empty { display: none; }
.tv-drawer-actions p { margin: 0; }
.tv-drawer > header h2 { margin: 0; }
.tv-drawer > header { padding-bottom: 16px; }
.tv-drawer [data-close] { flex-shrink: 0; }
.tv-drawer label { display: block; margin: 8px 0; }
.tv-drawer textarea, .tv-drawer select { display: block; width: 100%; margin-top: 6px; box-sizing: border-box; }
.tv-drawer .tv-choice { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.tv-choice > span { min-width: 0; }
.tv-choice p { margin: 4px 0; }
.tv-choice input { flex-shrink: 0; }
.tv-choice small { color: var(--accent); }
.tv-drawer [role="alert"] { color: var(--danger, #c44); overflow-wrap: anywhere; }
.tv-opinion-run { display: block; overflow-wrap: anywhere; }
.tv-drawer ul { padding-left: 20px; overflow-wrap: anywhere; }
.tv-drawer input[type="file"] { max-width: 100%; }
@media (max-width: 720px), (max-width: 1000px) and (max-height: 500px) {
  .tv-drawer { top: auto; left: 0; bottom: 0; width: 100%; height: 72vh; height: 72dvh; box-sizing: border-box; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
}
.tv-upload { position: relative; cursor: pointer; }
.tv-upload .tv-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tv-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.tv-drawer fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tv-drawer [data-queued="true"] { color: var(--text); }
.tv-viewer {border:1px solid var(--line,#d5d8de);border-radius:10px;overflow:hidden;margin:12px 0;min-width:0}
.tv-viewer header {display:flex;align-items:center;gap:12px;padding:10px;flex-wrap:wrap}
.tv-island {overflow:auto;max-height:650px;background:var(--bg,#f4f5f7);position:relative}
.tv-media {position:relative;width:100%;height:480px;min-width:0}
.tv-media iframe,.tv-media video,.tv-media img {display:block;width:100%;height:100%;border:0;object-fit:contain}
.tv-media pre {margin:0;max-height:480px;overflow:auto;padding:14px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px}
.tv-media pre.tv-md {white-space:normal;font-family:inherit;font-size:14px;line-height:1.7}
.tv-media pre span {display:block;min-height:1em}
.tv-pick {position:absolute;inset:0;cursor:crosshair;touch-action:none;background:rgba(74,110,170,.05)}
.tv-pick[hidden] {display:none} .tv-selection {position:absolute;border:2px solid #4677be;background:rgba(70,119,190,.13);pointer-events:none}
.tv-zoom {display:flex;gap:8px;align-items:center;padding:8px} .tv-zoom select {width:auto}
/* UX-093: pan the current design beside its annotation drawer, in place. */
.tv-island[style*="--tv-review-width"] { max-width: var(--tv-review-width); }
.tv-island[style*="--tv-review-width"] .tv-media { min-width: var(--tv-review-media-width); }
.tv-island[style*="--tv-review-width"] .tv-zoom { position: sticky; left: 0; width: max-content; }
.tv-drawer input:not([type=checkbox]):not([type=radio]):not([type=file]) {width:100%;box-sizing:border-box}
.tv-drawer label[hidden],.tv-drawer p[hidden] {display:none}
@media(max-width:700px){.tv-media {height:320px}.tv-viewer header {gap:6px}}
.tv-md table,.md table {border-collapse:collapse;width:100%;margin:10px 0;display:block;overflow-x:auto}
.tv-md td,.md td {border:1px solid var(--border,#d5d8de);padding:6px 10px;vertical-align:top}
.tv-md tr:first-child td,.md tr:first-child td {font-weight:600}
.tv-md h1,.tv-md h2,.tv-md h3 {margin:14px 0 8px}
.tv-md p {margin:6px 0}
.tv-md ul {margin:4px 0;padding-left:20px}

/* Readable detail: bounded defaults, disclosures retain the complete history. */
.tv-fixed-grid.tv-single { grid-template-columns: minmax(0, 1fr); }
.tv-status { font-size: 16px; font-weight: 600; margin: 12px 0; }
.tv-steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0 0 8px; margin: 0 0 14px; max-width: 100%; }
.tv-steps li { flex: 1 1 auto; min-width: 0; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; padding: 7px 12px; border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--t3); background: var(--neutral-bg); border: 1px solid var(--hairline); }
.tv-steps li[aria-current] { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: var(--shadow-sm); font-weight: 700; }
.tv-steps .is-complete { color: var(--success); background: var(--success-bg); border-color: transparent; }
.tv-story summary { list-style: none; }
.tv-story summary h2 { margin: 0 0 6px; }
.tv-story-lines { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; font-weight: 400; }
.tv-story-lines .md, .tv-story-lines .md p { display: inline; margin: 0; font-size: inherit; line-height: inherit; }
.tv-story small { color: var(--muted); font-size: 12px; }
.task-view h3 { font-size: 14px; margin: 10px 0; }
.tv-check { padding: 10px 0; border-top: 1px solid var(--border); }
.tv-check details { margin-top: 6px; font-size: 13px; }
.task-view section > details { margin-top: 12px; }
.tv-item > .md { min-width: 0; }

.tv-check-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.tv-check-line > b { flex: 1; min-width: 0; }
.tv-evidence-open { display: block; margin-top: 6px; max-width: 100%; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.tv-evidence-reader { box-sizing: border-box; width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, var(--bg)); color: var(--text); overflow: auto; }
.tv-evidence-reader::backdrop { background: rgba(0,0,0,.35); }
.tv-evidence-reader header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tv-evidence-reader h2 { margin: 0; font-size: 18px; }
.tv-evidence-reader [data-evidence-context] { overflow-wrap: anywhere; font-size: 13px; }
.tv-evidence-reader pre { box-sizing: border-box; margin: 12px 0 0; max-height: 60dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.tv-check-line > .tv-result { flex: 0 0 auto; white-space: nowrap; }

.tv-run { padding: 12px 0; border-top: 1px solid var(--border); }
.tv-run time { color: var(--muted); font-weight: 400; }
.tv-run-summary { max-height: min(24rem, 55vh); overflow: auto; padding: 0 12px; }
.tv-run-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tv-video-feedback {position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;text-align:center;pointer-events:none;background:var(--bg,#f4f5f7)}
.tv-video-feedback:has([data-video-status][hidden]) {display:none}
.tv-video-feedback [data-video-retry] {pointer-events:auto}

/* Keep task controls outside the scrolling reading pane, without covering text. */
.module:has(> .task-view) { display: flex; overflow: hidden; padding-bottom: 18px; }
.module > .task-view { flex: 1; width: 100%; min-height: 0; padding-bottom: 0; grid-template-rows: minmax(0, 1fr); }
.tv-reading { min-height: 0; min-width: 0; overflow: auto; display: grid; align-content: start; gap: 16px; padding: 0 4px 16px 0; scrollbar-gutter: stable; }
.task-view > .tv-toolbar { grid-column: 1; grid-row: 2; align-items: center; padding: 12px 0 env(safe-area-inset-bottom); border-top: 1px solid var(--border); }
.task-view:has(> .tv-drawer[data-docked="true"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(280px, 40%); }
.tv-drawer[data-docked="true"] { position: static; grid-column: 2; grid-row: 1 / 3; width: auto; min-width: 0; min-height: 0; padding: 16px; box-shadow: none; }
.tv-drawer[data-docked="true"] > header { position: sticky; top: -16px; background: var(--surface); padding: 8px 0; z-index: 1; }
.tv-drawer[data-docked="true"] > header h2 { margin: 0; }
.tv-drawer .tv-file-input { width: 1px; left: 0; top: 0; }
.tv-drawer-task { color: var(--muted); font-size: 12px; margin: 6px 0 0; overflow-wrap: anywhere; }
.tv-instruction-receipt { overflow-wrap: anywhere; }
.tv-instruction-receipt p { margin: 8px 0; }
.tv-instruction-text, [data-instruction-log-body] { white-space: pre-wrap; max-height: min(24rem, 50vh); overflow: auto; padding: 8px 0; }
@media (max-width: 1000px) {
  .task-view:has(> .tv-drawer[data-docked="true"]:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto minmax(0, 45%); }
  .tv-drawer[data-docked="true"] { grid-column: 1; grid-row: 3; height: auto; max-height: none; border-left: 0; border-top: 1px solid var(--border); border-radius: 0; }
}

/* UX-057: use the board's existing status colors, pills and primary buttons. */
.task-view .tv-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 2px 0 16px; }
.task-view .tv-heading h1 { flex: 1 1 420px; }
.task-view [data-header-actions] { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.task-view .tv-toolbar { align-items: center; }
.task-view .tv-state-badge, .task-view .tv-status { --tv-tone: var(--t2); --tv-fill: var(--neutral-bg); color: var(--tv-tone); background: var(--tv-fill); }
.task-view [data-status-kind="paused"], .task-view [data-status-kind="others"] { --tv-tone: var(--warn); --tv-fill: var(--warn-bg); }
.task-view [data-status-kind="error"] { --tv-tone: var(--danger); --tv-fill: var(--danger-bg); }
.task-view [data-status-kind="you"] { --tv-tone: var(--brand-strong); --tv-fill: var(--brand-soft); }
.task-view [data-status-kind="ai"] { --tv-tone: var(--info, #397cce); --tv-fill: color-mix(in srgb, var(--info, #397cce) 12%, var(--surface)); }
.task-view [data-status-kind="done"] { --tv-tone: var(--success); --tv-fill: var(--success-bg); }
.task-view .tv-state-badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.task-view .tv-status { display: flex; align-items: center; gap: 12px; border: 1px solid color-mix(in srgb, var(--tv-tone) 25%, transparent); border-radius: var(--radius); padding: 16px 18px; margin: 0; font-size: 14px; line-height: 1.65; }
.task-view .tv-status strong { flex: 1; min-width: 0; }
.task-view .tv-status-icon { font-size: 20px; font-weight: 700; }
.task-view .tv-status .btn { flex-shrink: 0; }
.task-view .tv-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; min-width: 0; }
.task-view .tv-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.task-view .tv-info { position: sticky; top: 0; max-height: calc(100dvh - 100px); overflow: auto; min-width: 0; }
.task-view .tv-info-tabs { display: flex; gap: 4px; background: var(--neutral-bg); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.task-view .tv-info-tabs .btn { flex: 1; border: 0; background: transparent; color: var(--t2); }
.task-view .tv-info-tabs [aria-selected="true"] { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm); }
.task-view .tv-info .tv-gallery { grid-template-columns: minmax(0, 1fr); }
.task-view .tv-info .tv-block { border: 0; padding: 0; box-shadow: none; background: transparent; }
.task-view .tv-info .tv-run-summary { padding: 0; }
.task-view .tv-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.task-view .tv-metrics > div { padding: 14px; background: var(--neutral-bg); border-radius: 10px; min-width: 0; }
.task-view .tv-metrics dt { color: var(--t2); font-size: 12px; }
.task-view .tv-metrics dd { margin: 6px 0 0; font-size: 23px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.task-view .tv-metrics small { display: block; font-size: 11px; font-weight: 400; color: var(--t3); }
.task-view .tv-metrics p { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--t2); overflow-wrap: anywhere; }
.task-view .tv-wait-status { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-view .tv-wait-current span { display: block; }
.task-view .tv-metric-note { margin-top: 12px; font-size: 12px; line-height: 1.6; color: var(--t2); overflow-wrap: anywhere; }
.task-view .tv-metric-note p { margin: 8px 0; }
.task-view .tv-need { border: 1px solid color-mix(in srgb, var(--brand) 50%, var(--line)); border-top: 3px solid var(--brand); box-shadow: var(--shadow-sm); }
.task-view .tv-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-view .tv-section-head h2 { margin: 0; font-size: 17px; }
.task-view .tv-count { color: var(--brand-strong); }
.task-view .tv-answer-progress { font-size: 12px; margin: 6px 0 14px; }
.task-view .tv-need-row { display: flex; align-items: center; gap: 10px; list-style: none; border-radius: 10px; background: var(--brand-wash); padding: 12px; }
.task-view .tv-need-row::-webkit-details-marker { display: none; }
.task-view .tv-need-row > span:nth-child(2) { flex: 1; min-width: 0; }
.task-view .tv-need-row .badge { flex-shrink: 0; }
.task-view .tv-item .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-view .tv-story-lines { display: grid; gap: 10px; color: var(--t2); font-size: 13px; }
.task-view .tv-story-lines .tv-story-part > .md { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-view .tv-story summary h2 { margin-bottom: 12px; }
.task-view .tv-story-lines b { display: block; color: var(--t1); font-size: 12px; }
.task-view .tv-story small { display: block; margin-top: 10px; color: var(--brand-strong); }
.task-view .tv-artifact-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); font-size: 18px; margin: 0 8px 8px 0; vertical-align: middle; }
.task-view .tv-artifact > .btn { margin-top: 8px; }
.task-view .tv-package-risk { color: var(--warn); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.task-view .tv-instruction label { display: block; font-weight: 600; margin-bottom: 8px; }
.task-view .tv-instruction { padding: 14px 18px; }
.task-view .tv-instruction .row .btn { flex-shrink: 0; }
.task-view:has(> .tv-drawer[data-docked="true"]:not([hidden])) .tv-columns { grid-template-columns: minmax(0, 1fr); }
.task-view:has(> .tv-drawer[data-docked="true"]:not([hidden])) .tv-info { position: static; max-height: none; }
@media (max-width: 1100px) {
  .task-view .tv-columns { grid-template-columns: minmax(0, 1fr); }
  .task-view .tv-info { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .task-view .tv-heading h1 { flex-basis: 100%; order: 2; font-size: 18px; }
  .task-view .tv-heading [data-header-actions] { order: 3; margin-left: 0; }
  .task-view .tv-status { flex-wrap: wrap; align-items: flex-start; padding: 12px; gap: 8px; }
  .task-view .tv-status strong { flex-basis: calc(100% - 36px); }
  .task-view .tv-status .btn { margin-left: 28px; }
  .task-view .tv-need-row { flex-wrap: wrap; padding: 10px; }
  .task-view .tv-need-row .btn { margin-left: auto; }
  .task-view .tv-instruction .row { flex-wrap: wrap; }
  .task-view .tv-instruction .row input { flex-basis: 100%; }
  .task-view .tv-steps { gap: 4px; }
  .task-view .tv-steps li { padding: 5px 8px; font-size: 11px; }
  .task-view .card-pad { padding: 14px; }
}

/* Docked actions share the mobile bottom sheet, including short landscape views. */
@media (max-width: 720px), (max-width: 1000px) and (max-height: 500px) {
  .task-view:has(> .tv-drawer[data-docked="true"]:not([hidden])) { grid-template-rows: minmax(0, 1fr) auto; }
  .tv-drawer[data-docked="true"] { position: fixed; grid-column: auto; grid-row: auto; width: 100%; height: 72vh; height: 72dvh; border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
  .tv-drawer[data-docked="true"] > header { position: static; padding: 0 0 16px; }
}
@media (max-width: 1000px) and (max-height: 500px) {
  .tv-drawer, .tv-drawer[data-docked="true"] { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .tv-drawer > header, .tv-drawer[data-docked="true"] > header { padding-bottom: 8px; }
  .tv-drawer-actions { padding-top: 8px; }
}

/* UX-091: pause the translation extension's floating controls while a mobile
   task drawer is open. Keep its DOM/state so closing the drawer restores it. */
@media (max-width: 720px) {
  html:has(.task-view > .tv-drawer:not([hidden])) > #immersive-translate-popup { display: none !important; }
}

/* UX-032: reserve the open annotation drawer's actual left edge for this video
   only. Mobile/bottom sheets keep their existing sizing and interaction. */
@media (min-width: 721px) and (min-height: 501px), (min-width: 1001px) {
  .tv-media[data-video-annotation] { max-width: var(--tv-video-annotation-width); }
}

/* Keep new video feedback distinct and its final input line clear of actions. */
.tv-drawer[data-new-video-annotation="true"] .tv-annotation-intro { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.tv-drawer[data-new-video-annotation="true"] .tv-annotation-intro h3 { margin: 0 0 8px; }
.tv-drawer[data-new-video-annotation="true"] .tv-annotation-intro p { margin: 8px 0; }
.tv-drawer[data-new-video-annotation="true"] .tv-drawer-body { padding-bottom: 16px; scroll-padding-block: 16px; }
.tv-drawer[data-new-video-annotation="true"] textarea { min-height: 128px; max-height: 40dvh; resize: vertical; line-height: 1.5; scroll-padding-block: 8px; }

/* Outputs: image thumbnails and the in-page viewer */
.task-view .tv-artifact { display: flex; flex-direction: column; gap: 4px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.task-view .tv-artifact:hover { border-color: var(--brand-soft, var(--border)); box-shadow: var(--shadow-sm); }
.task-view .tv-artifact > .btn, .task-view .tv-artifact > a.btn { align-self: flex-start; }
.task-view .tv-artifact p { margin: 0; }
.task-view .tv-artifact-image { padding: 8px; }
.task-view .tv-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--neutral-bg); cursor: zoom-in; }
.task-view .tv-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.task-view .tv-artifact-image b { font-size: 13px; line-height: 1.4; }
.tv-artifact-viewer { box-sizing: border-box; width: min(1000px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, var(--bg)); color: var(--text); overflow: hidden; display: none; flex-direction: column; }
.tv-artifact-viewer[open] { display: flex; }
.tv-artifact-viewer::backdrop { background: rgba(0,0,0,.55); }
.tv-artifact-viewer header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tv-artifact-viewer h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-artifact-viewer .tv-viewer-actions, .tv-artifact-viewer .tv-viewer-nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tv-artifact-viewer [data-viewer-status] { padding: 16px; margin: 0; }
.tv-artifact-viewer .tv-viewer-body { overflow: auto; padding: 16px 24px 24px; }
.tv-artifact-viewer[data-kind="image"] .tv-viewer-body { padding: 12px; display: flex; justify-content: center; background: var(--neutral-bg); }
.tv-artifact-viewer[data-kind="image"] img { max-width: 100%; max-height: calc(100dvh - 140px); object-fit: contain; border-radius: 6px; }
.tv-artifact-viewer .tv-viewer-doc { font-size: 14px; line-height: 1.75; }
.tv-artifact-viewer .tv-viewer-doc table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tv-artifact-viewer .tv-viewer-doc th, .tv-artifact-viewer .tv-viewer-doc td { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
@media (max-width: 640px) { .tv-artifact-viewer .tv-viewer-nav small { display: none; } .tv-artifact-viewer [data-viewer-raw] { display: none; } }

/* stage rail | stage outputs | to-do column */
.task-view .tv-columns.tv-three { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(280px, 340px); }
.task-view .tv-columns.tv-three:not(:has(> .tv-stages:not([hidden]))) { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
.task-view .tv-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; position: sticky; top: 8px; }
.task-view .tv-side .tv-info { position: static; max-height: none; }
.task-view .tv-stages { position: sticky; top: 8px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.task-view .tv-stage-flow { font-size: 12px; color: var(--t2); padding: 4px 8px 8px; }
.task-view .tv-stage-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; border-radius: 8px; padding: 9px 10px; font: inherit; color: var(--text); }
.task-view button.tv-stage-item { cursor: pointer; }
.task-view button.tv-stage-item:hover { background: var(--neutral-bg); }
.task-view .tv-stage-item[aria-current="true"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.task-view .tv-stage-item[data-stage-state="done"] .tv-stage-icon { color: var(--ok, #15803d); }
.task-view .tv-stage-item[data-stage-state="waiting"] { color: var(--warn-strong, #b45309); font-weight: 600; }
.task-view .tv-stage-item[data-stage-state="current"] .tv-stage-icon { color: var(--brand-strong); }
.task-view .tv-stage-item[data-stage-state="error"] .tv-stage-icon { color: var(--err, #b91c1c); }
.task-view .tv-stage-item[data-stage-state="todo"] { color: var(--t2); }
.task-view .tv-stage-name { flex: 1; font-size: 14px; min-width: 0; }
.task-view .tv-stage-meta { font-size: 12px; color: var(--t2); white-space: nowrap; }
.task-view .tv-stage-foot { border-top: 1px solid var(--border); margin: 8px 0 0; padding: 10px 8px 2px; font-size: 12px; color: var(--t2); }
.task-view .tv-stage { display: flex; flex-direction: column; gap: 14px; }
.task-view .tv-stage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.task-view .tv-stage-head h2 { margin: 0; font-size: 18px; }
.task-view .tv-stage-head .muted { font-size: 13px; }
.task-view .tv-stage-summary { margin: 0; background: var(--neutral-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.7; }
.task-view .tv-stage-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.task-view .tv-stage-thumb { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; cursor: zoom-in; font: inherit; text-align: left; }
.task-view .tv-stage-thumb[aria-current="true"] { border-color: var(--brand-strong); box-shadow: 0 0 0 2px var(--brand-soft); }
.task-view .tv-stage-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: var(--neutral-bg); }
.task-view .tv-stage-thumb span { font-size: 12px; padding: 4px 8px 8px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-view .tv-stage-zoom { margin: 0; background: var(--neutral-bg); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.task-view .tv-stage-zoom img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 6px; }
.task-view .tv-stage-zoom figcaption { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--t2); }
.task-view .tv-stage-docwrap { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.task-view .tv-stage-doctitle { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 14px; }
.task-view .tv-stage-doc { font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.task-view .tv-stage-doc[data-collapsed="true"] { max-height: 640px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.task-view .tv-stage-doc table { border-collapse: collapse; width: 100%; font-size: 13px; display: block; overflow-x: auto; }
.task-view .tv-stage-doc th, .task-view .tv-stage-doc td { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
.task-view .tv-doc-toggle { align-self: flex-start; }
.task-view .tv-stage-checks, .task-view .tv-stage-history { border-top: 1px solid var(--border); padding-top: 10px; font-size: 13px; }
.task-view .tv-stage-checks ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.task-view .tv-stage-checks .tv-bad { color: var(--err, #b91c1c); }
.task-view .tv-stage-history article { border-left: 2px solid var(--border); padding: 4px 0 4px 10px; margin-top: 8px; }
.task-view .tv-source h2 { display: inline; font-size: 15px; margin: 0; }
.task-view .tv-source-text { font-size: 13px; line-height: 1.7; margin-top: 8px; }
@media (max-width: 1180px) {
  .task-view .tv-columns.tv-three { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); }
  .task-view .tv-stages { grid-column: 1 / -1; position: static; flex-direction: row; flex-wrap: wrap; }
  .task-view .tv-stages .tv-stage-item { width: auto; }
  .task-view .tv-stage-foot, .task-view .tv-stage-flow { display: none; }
}
@media (max-width: 760px) {
  .task-view .tv-columns.tv-three { grid-template-columns: minmax(0, 1fr); }
  .task-view .tv-side { position: static; }
}

.task-view .tv-progress-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--t2); white-space: nowrap; }
.task-view .tv-progress-bar { display: inline-block; width: 120px; height: 6px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.task-view .tv-progress-bar > span { display: block; height: 100%; background: var(--brand-strong); }

.task-view .tv-gate { border: 2px solid var(--brand-soft); display: flex; flex-direction: column; gap: 8px; }
.task-view .tv-gate h2 { margin: 0; font-size: 15px; }
.task-view .tv-gate-label { font-size: 13px; color: var(--t2); }
.task-view .tv-gate textarea { font: inherit; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; background: var(--surface); color: var(--text); }
.task-view .tv-gate-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-view .tv-gate-msg { margin: 0; font-size: 12px; min-height: 1em; }
