/* Converters (Converter notas fiscais, Converter SPED). The page structure (file bar, entry,
   heading block, callout, footer, dialog) and the buttons, pills, tabs and tables are shared with
   Revisar CBS in app-shell.css (.task-page, .task-app, .data-table). This file holds only the
   work view's tables and the result and failure details. Every rule is scoped to .conversion so
   it cannot restyle the shared sidebar. Spec: docs/design/DESIGN_SYSTEM.md#file-conversion. */

/* Work view: the heading block, then one inset table sized to its rows. */
.conversion .work { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.conversion .task-heading progress { max-width: 480px; }
.conversion .alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); font-size: var(--text-13); }
.conversion #work-lead { max-width: 760px; }
.conversion .result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.conversion #result-total { color: var(--ink-muted); font-size: var(--text-12); font-variant-numeric: tabular-nums; }
.conversion #failure-details summary { cursor: pointer; font-size: var(--text-13); }
.conversion #failure-explanation { max-height: 200px; overflow: auto; margin-top: var(--space-2); color: var(--ink-muted); font-size: var(--text-13); white-space: pre-wrap; }

/* Workbooks: one row per checked workbook. Identifiers stay on one line; only names wrap. */
.conversion .workbooks .unit { display: block; color: var(--ink-muted); font-size: var(--text-12); font-weight: var(--weight-regular); }
.conversion .workbooks :is(th[scope="row"], .cnpj, .num, .keep) { white-space: nowrap; }
.conversion :is(.workbooks, .omissions) :is(.file-name, .cnpj) { font-size: var(--text-13); font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.conversion .workbooks .facts { display: none; }
.conversion .workbooks .download { width: 1%; white-space: nowrap; }

/* File list: ruled rows inside the shared frame; the header stays above its scroll area. Only visible rows are rendered (file-list.ts). */
.conversion .file-table { display: flex; flex-direction: column; overflow: hidden; }
.conversion :is(.file-head, .source) { display: grid; grid-template-columns: 72px minmax(0, 1fr) 64px; }
.conversion :is(.file-head, .source) > * { display: flex; align-items: center; min-width: 0; padding: 0 var(--space-3); }
.conversion :is(.file-head, .source) > * + * { border-left: 1px solid var(--line); }
.conversion .file-head { flex-shrink: 0; height: 34px; border-bottom: 1px solid var(--line); background: var(--surface-sunken); color: var(--ink-muted); font-size: var(--text-13); font-weight: var(--weight-medium); }
.conversion #choices { flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-anchor: none; }
.conversion .source { height: 35px; border-bottom: 1px solid var(--line); font-size: var(--text-13); }
.conversion .source-number { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.conversion .source h3 { margin: 0; overflow: hidden; font: var(--weight-regular) var(--text-13)/1.5 var(--font-sans); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.conversion .source > :last-child { justify-content: center; }
.conversion .source .remove-source { width: 24px; min-height: 24px; padding: 0; font-size: var(--text-16); line-height: 1; }

@media (max-width: 600px) {
  .conversion :is(.file-head, .source) { grid-template-columns: 52px minmax(0, 1fr) 52px; }
  .conversion .source { height: 45px; }
  .conversion .source .remove-source { width: 40px; min-height: 40px; }
  /* The workbook table becomes a list: type, facts and file name beside the download. */
  .conversion .workbooks thead { display: none; }
  .conversion :is(.workbooks, .workbooks tbody) { display: block; }
  .conversion .workbooks tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); padding: var(--space-3); border-bottom: 1px solid var(--line); }
  .conversion .workbooks tr:last-child { border-bottom: 0; }
  /* .data-table raises this above the shared ruled-table rule, whose :is() counts .answer .content table. */
  .conversion .workbooks.data-table :is(th, td) { display: block; padding: 0; border: 0; }
  .conversion .workbooks :is(td.num, td.cnpj) { display: none; }
  .conversion .workbooks .facts { display: block; grid-column: 1; color: var(--ink-muted); font-size: var(--text-12); }
  .conversion .workbooks .download { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
