/* Workspace layout fixes: the right card follows its content, tool settings sit under the tool, quieter options, tidier small parts */

/* 1. Right card: steps, Run and the result stay together near the top and follow the page while the tool list is long */
@media (min-width: 951px) {
  .pipeline-side { align-self: start; top: 96px; grid-column: 1; grid-row: 1; }
}
.pipeline-editor .pipeline-run { margin-top: 20px; }
.pipeline-editor .pipeline-shortage { margin-top: 16px; }

/* 2. Tools: no second row of the same tool buttons above the list; the settings of the chosen tool open right under it */
#quick-actions:has(+ .op-picker:not([hidden])) { display: none; }
#parameters.in-picker { margin: 2px 0 10px 12px; padding: 10px 12px; border-left: 3px solid var(--brand-accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--bg-subtle); }
#parameters.in-picker:empty { display: none; }

/* 4. "Process simple images in this browser": one compact line, only when it applies */
.browser-image-option p { margin: 0; font-size: 11.5px; line-height: 1.4; }
.browser-image-option p[hidden] { display: none; }

/* 5. Tabs: no box stuck to the letters on click; a keyboard focus ring with room around the text */

/* 5. File type letters fit inside the small icons of the results list */
body #history .job-recent .job-symbol { width: 38px; height: 40px; min-width: 38px; }
body #history .job-recent .job-symbol svg { width: 20px; height: 20px; margin-bottom: 9px; }
#history .job-recent .job-symbol .file-format { bottom: 3px; font-size: 7px; line-height: 9px; letter-spacing: .04em; }
body #history .job-batch .batch-symbol svg { margin-bottom: 0; }

/* Files to process: a clear tick when the step is done */
body .files-section.step-complete .step { background: var(--brand-primary); color: var(--fg-inverse); font-size: 0; line-height: 0; place-content: center; }
.files-section.step-complete .step::after { content: ""; display: block; width: 14px; height: 14px; border: 0; background: currentColor; transform: none; font-size: 0; clip-path: polygon(14% 52%, 26% 40%, 42% 56%, 74% 22%, 86% 34%, 42% 80%); }

/* One box for the type filters, the search and the list; the button that opens it stays above it */
/* "Show list ▾ / Hide list ▴" sits as a small link beside "Remove all" */
.file-toolbar-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
body .file-toolbar .file-list-expander { display: inline-flex; width: auto; margin: 0; padding: 6px 0; border: 0; border-radius: 0; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 500; white-space: nowrap; }
body .file-toolbar .file-list-expander:hover:not(:disabled) { background: transparent; color: var(--text-primary); text-decoration: underline; }
body .file-toolbar .file-list-expander[hidden] { display: none; }
.file-box.summary { margin: 0; padding: 10px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.file-box.summary .batch-inspector { margin: 0 0 8px; padding: 0; border: 0; background: none; }
.file-box.summary .file-list.boxed { margin: 8px 0 0; }
.file-box .file-search-wrap { margin: 0; }
.batch-type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.batch-type-chip.batch-all, .batch-type-chip.interactive .batch-ext-keep { cursor: pointer; }
.batch-type-chip.batch-all { padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); font-size: 12px; font-weight: 500; color: var(--text-primary); }
.batch-type-chip.active .batch-ext-keep, .batch-type-chip.active .batch-ext-remove { color: var(--fg-inverse); }
.file-empty { padding: 14px; text-align: center; color: var(--text-secondary); font-size: 13px; list-style: none; }

/* Apply to: which file types take part in the operation */
.apply-to { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.apply-to strong { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-primary); }
.apply-to-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.apply-chip { min-height: 30px; padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-secondary); font-size: 12.5px; font-weight: 500; cursor: pointer; text-decoration: line-through; }
.apply-chip.on { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--fg-inverse); text-decoration: none; }

/* Search + sorting share one row inside the file box */
.file-search-wrap .batch-sort-bar { flex: 0 1 auto; margin: 0; }
.file-search-wrap .batch-tool-btn { min-height: 36px; padding-inline: 11px; font-size: 12px; }

/* Hovering a selected type keeps its text readable (the plain hover colour is light, the selected text is white) */
.batch-type-chip.active .batch-ext-remove:hover:not(:disabled) { background: var(--bg-muted); color: var(--danger); }
.batch-type-chip.batch-all:hover:not(.active) { background: var(--bg-page); color: var(--text-primary); }

/* ---- AI chat: icon and text share the first line, a thin scrollbar sits at the edge ---- */
body #ai-messages { scrollbar-width: thin; scrollbar-color: var(--text-muted) transparent; scrollbar-gutter: auto; padding-right: 4px; }
body #ai-messages::-webkit-scrollbar { width: 8px; }
body #ai-messages::-webkit-scrollbar-track { background: transparent; }
body #ai-messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-md); border: 2px solid transparent; background-clip: padding-box; }
body #ai-messages::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
/* The copy button floats in the corner, so it no longer takes a line of its own above the text. */
#ai-messages .ai-message.assistant .copy-msg-btn { position: absolute; top: 6px; right: 8px; z-index: 1; }
#ai-messages .message-head:has(.copy-msg-btn) { margin-bottom: 0; }
#ai-messages .ai-message.assistant .message-head { min-height: 0; height: 0; margin: 0; }
#ai-messages .ai-message.assistant .assistant-icon { top: 17px; line-height: 19px; font-size: 14px; }

/* ---- Running plan: the step keeps its place, the number becomes a spinner / tick ---- */
@keyframes pipeline-number-spin { to { transform: rotate(360deg); } }

/* Merging depends on file order: the move buttons stay visible in the boxed list while "Change file order" is on */
.file-list.order-mode .file-row .file-controls [data-move] { display: grid !important; }
.chat-plan-order, .pipeline-order { align-self: flex-start; width: fit-content; padding: 5px 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font-size: 12px; font-weight: 600; cursor: pointer; }
.chat-plan-order { margin: 8px 0 0; }
.chat-plan-order:hover, .pipeline-order:hover { background: var(--bg-page); color: var(--text-primary); }

/* No empty frames: a batch of a single type has no chip row, and the file box shrinks to what it holds */
#batch-inspector:empty { display: none; }
.file-box.summary:has(> #batch-inspector:empty):has(> #file-search-wrap[hidden]):has(> #file-list[hidden]) { padding: 0; border: 0; background: transparent; }
#file-list.boxed .file-row .file-controls { position: static; top: auto; right: auto; transform: none; opacity: 1; }
#file-list.boxed .file-row .file-controls button { min-height: 36px; }

/* ---------- Landing: first screen says what PipeID is and why it is safe to try ---------- */
#workspace-intro h1 span { color: var(--brand-tint-fg); }
.hero-points { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 12px 0 0; padding: 0; list-style: none; }
.hero-points li { position: relative; padding-left: 22px; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }
.hero-points li:empty { display: none; }
.hero-points li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--brand-tint);
}
.hero-points li::after {
  content: ""; position: absolute; left: 5px; top: 5.5px; width: 6px; height: 3.5px;
  border-left: 1.8px solid var(--brand-accent); border-bottom: 1.8px solid var(--brand-accent); transform: rotate(-45deg);
}
body.ai-conversation .hero-points { display: none; }

/* The retention note already sits under the workspace: no second copy at the page bottom of the workspace. */
#workspace-view:not([hidden]) ~ .storage-policy { display: none; }
/* In-app pages (/account, /pricing, /api) carry their own retention note, or have no files at all. */
body.page-route #storage-policy { display: none !important; }

/* Theme toggle: an SVG icon centred in the round button. */
.theme-toggle { display: inline-grid; place-items: center; }
.theme-toggle svg { display: block; }

/* Right panel: an empty "Add files" line reads as a hint, not as an input field. */

/* Landing cards: one radius and one quiet border for every card. */
.landing .landing-card,
.landing .compact-plan { border-radius: var(--radius-lg); }

@media (max-width: 700px) {
  /* On phones the offline banner explains the problem; the header pill only pushed the controls off the row. */
  body .topbar #connection { display: none; }
  .hero-points { flex-direction: column; gap: 6px; margin-top: 10px; }
  .hero-points li { font-size: 13px; }
}

/* The open list scrolls in its box with the same thin dark scrollbar as the step library, and fades out at the bottom */
#file-list.boxed { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; padding-right: 6px; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); }
#file-list.boxed.at-end { -webkit-mask-image: none; mask-image: none; }
#file-list.boxed::-webkit-scrollbar { width: 6px; }
#file-list.boxed::-webkit-scrollbar-track { background: transparent; }
#file-list.boxed::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--border-strong); }
#file-list.boxed::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
