/* C4 Hub: geometry inherited from C4; light colors adapted for the Hub.
   Final tokens and shared-component styling are in hub-theme.css. */


.ac-workspace {
  --ac-paper: var(--surface);
  --ac-ink: var(--ink);
  --ac-line: var(--line);
  --ac-accent: var(--accent);
}

.ac-workspace,
.ct-page,
.cp-planning,
.cd-workspace,
.services-page,
.ai-page {
  min-width: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
}

/* Uma régua estável de contexto, antes dos dados e das ações. */
.ac-kicker,
.ac-scope label,
.ac-period-label small,
.ac-scope > .ac-period-label small,
.ac-source-label,
.ac-report-foot,
.ac-source-foot,
.ac-table-hint,
.ct-step,
.svc-section-label { color: var(--muted); }

.ac-nav { border-bottom-color: var(--line); }
.ac-nav button { color: var(--muted); }
.ac-nav button:hover,
.ac-nav button[aria-selected="true"],
.ac-nav button[aria-current="page"],
.ac-nav button[aria-pressed="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.ac-scope > .ac-period-label { color: var(--ink); }
.ac-scope,
.ct-period { border-color: var(--line); background: transparent; box-shadow: none; }
.ct-subnav { border-bottom-color: var(--line); }
.ct-subnav a[aria-current="page"] { color: var(--accent-ink); border-bottom-color: var(--accent); }

.svc-context {
  padding: 12px 0;
  background: transparent;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.ac-scope select,
.ac-record-filters :is(input, select),
.ac-explanation textarea,
.ct-period select,
.cp-toolbar select,
.cp-cell-input,
.svc-context select,
.ai-page select,
.cd-workspace :is(input:not([type="checkbox"]), select, textarea),
#ai-review-form :is(input:not([type="checkbox"]), select, textarea) {
  color-scheme: dark;
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
  border-radius: 6px;
  font-family: var(--font-ui);
  box-shadow: none;
}

.ac-scope select:focus-visible,
.ac-record-filters :is(input, select):focus-visible,
.ac-explanation textarea:focus-visible,
.cp-cell-input:focus,
.ct-period select:focus-visible,
.cp-toolbar select:focus-visible,
.svc-context select:focus-visible,
.cd-workspace :is(input, select, textarea):focus-visible,
#ai-review-form :is(input, select, textarea):focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ac-export-actions .button:not(.primary),
.svc-start .button.quiet {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.ac-export-actions .button:not(.primary):hover,
.svc-start .button.quiet:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Valores alinhados; os cabeçalhos fixos pertencem à mesma superfície. */
.ac-report-heading,
.ac-table-shell,
.ac-document,
.ct-kpis,
.ct-work-section,
.ct-services-strip,
.ct-source-strip,
.ct-metric,
.ct-definition-list,
.ct-empty,
.cp-summary,
.cp-version-bar,
.cp-planning > .panel,
.cp-history,
.cd-summary,
.cd-workspace > .panel,
.cd-two-column > .panel,
.cd-table-scroll,
.svc-catalog-list,
.svc-work-list,
.svc-empty {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.ac-report-heading { padding: 18px 20px; }
.ac-summary dt { color: var(--muted); font-size: 12px; }
.ac-summary > div { border-right-color: var(--line); }
.ac-summary dd {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.9px;
  font-variant-numeric: tabular-nums;
}
.ac-toggle { color: var(--muted); border-color: var(--line); }
.ac-method { padding: 3px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; }
.ac-method button { color: var(--muted); background: transparent; border-radius: 4px; }
.ac-method button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); box-shadow: none; }

.ac-table-shell,
.cp-table-scroll,
.cd-table-scroll {
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  scrollbar-color: var(--line) var(--paper);
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.ac-table :is(th, td) { border-color: var(--line); font-size: 13px; }
.ac-table td { color: var(--ink); background: var(--surface); }
.ac-table tr > :first-child { color: var(--ink); background: var(--surface); }
.ac-table thead th,
.ac-table thead th:first-child,
.ac-table thead tr > :first-child {
  background: var(--paper);
  color: var(--muted);
  border-color: var(--line);
  font-size: 12px;
}
.ac-table tbody th,
.ac-table tbody td:first-child { color: var(--ink); background: var(--surface); }
.ac-table tbody tr:hover > :is(th, td) { background: #F5F6F7; }
/* A coluna fixa das linhas comuns tem prioridade explícita sobre a camada B5.
   Totais e seções preservam os fundos próprios definidos abaixo. */
.ac-workspace .ac-table tbody > tr:not(.ac-total):not(.ac-section) > :first-child {
  color: var(--ink);
  background: var(--surface);
}
.ac-workspace .ac-table tbody > tr:not(.ac-total):not(.ac-section):hover > :first-child {
  background: #F5F6F7;
}
.ac-table tbody tr.ac-total > *,
.ac-table tbody tr.ac-total:hover > * {
  color: var(--ink);
  background: #F5F6F7;
  border-color: var(--line);
}
.ac-table tbody .ac-section > *,
.ac-table tbody tr.ac-section:hover > * {
  color: var(--muted);
  background: var(--paper);
  border-color: var(--line);
  letter-spacing: .75px;
}
.ac-table :is(td:not(:first-child), .ac-amount-button),
.ac-detail-amount,
.ac-detail-comparison,
.ac-comparison,
.ac-document-line strong,
.ac-mini-comparison,
.ac-account-code,
.ac-composition .money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.25px;
}
.ac-table .ac-action-cell,
.ac-table .ac-description,
.ac-records td,
.ac-records .ac-nature,
.ac-trial .ac-nature { font-family: var(--font-ui); letter-spacing: normal; }
.ac-records td:has(.money),
.ac-trial td:has(.money) { font-family: var(--font-mono); }
.ac-account-code { color: var(--muted); font-size: 11px; }
.ac-table .ac-row-label:hover,
.ac-amount-button:hover,
.ac-table .ac-action-cell .button,
.ac-origin-list .button,
.ac-account-links .button { color: var(--accent-ink); }
.ac-amount-button { color: inherit; border-bottom-color: var(--muted); }
.ac-mini-comparison i { background: var(--accent); }
.ac-mini-comparison i + i { background: var(--muted); }
.ac-favorable,
.ac-summary dd.ac-favorable,
.ac-table .ac-favorable,
.ac-table tbody tr.ac-total > .ac-favorable,
.ac-table tbody tr.ac-total:hover > .ac-favorable,
.ac-table .ac-favorable small,
.ac-check-state.is-ok { color: var(--green); }
.ac-unfavorable,
.ac-summary dd.ac-unfavorable,
.ac-table .ac-unfavorable,
.ac-table tbody tr.ac-total > .ac-unfavorable,
.ac-table tbody tr.ac-total:hover > .ac-unfavorable,
.ac-table .ac-unfavorable small,
.ac-check-state.is-pending { color: var(--danger); }
.ac-checks,
.ac-checks li,
.ac-document-stamp,
.ac-document-line,
.ac-report-foot,
.ac-observations { border-color: var(--line); }
.ac-checks summary { color: var(--ink); }
.ac-checks summary::before,
.ac-document-stamp { color: var(--accent-ink); }
.ac-document { color: var(--ink); }
.ac-drawer h3,
.ac-explanation h3 { color: var(--ink); }
.ac-drawer .ac-detail-amount { color: var(--ink); font-weight: 500; }
.ac-explanation .ac-explanation-text {
  background: var(--accent-soft);
  color: var(--ink);
  border-color: var(--line);
  border-left-color: var(--accent);
  border-radius: 0 6px 6px 0;
}
.ac-reading-note,
.ac-boundary,
.ac-explanation-text p { color: var(--muted); }

/* Controladoria: medidas, versões e entregas numa superfície contínua. */
.ct-workbench { gap: 20px; }
.ct-work-section,
.ct-services-strip { padding: 22px; }
.ct-work-link:hover strong,
.ct-work-link:hover > .icon { color: var(--accent-ink); }
.ct-cycle-row:hover { background: #F5F6F7; }
.ct-cycle-state { color: var(--muted); }
.ct-kpis,
.cp-summary,
.cd-summary { border-color: var(--line); }
.ct-kpis > div,
.cp-summary > div,
.cd-summary > div { border-color: var(--line); }
.ct-kpis strong,
.cp-summary dd,
.cd-summary strong,
.cd-preview .cd-summary strong,
.ct-metric > strong,
.ct-metric > strong:has(.money),
.ct-detail-value {
  color: var(--ink);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.8px;
  line-height: 1.3;
}
.ct-kpis strong:has(.money),
.cp-summary dd,
.cd-summary strong,
.ct-metric > strong,
.ct-detail-value,
.cp-category-summary dd,
.ct-formula-parts strong:has(.money) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.cp-summary dd small { font-family: var(--font-ui); letter-spacing: normal; }
.cp-summary dd small .money { font-family: var(--font-mono); }
.ct-kpis-work strong:not(:has(.money)) { font-family: var(--font-ui); font-weight: 600; }
.cp-tabs,
.ct-family-tabs .button,
.svc-tracking .segmented { border-color: var(--line); border-radius: 6px; background: var(--paper); }
.cp-tabs .button,
.ct-family-tabs .button { color: var(--muted); background: transparent; border-color: transparent; }
.cp-tabs .button:hover:not([aria-pressed="true"]),
.ct-family-tabs .button:hover:not(.active) { background: var(--surface); color: var(--ink); }
.cp-tabs .button[aria-pressed="true"],
.cp-tabs .button[aria-pressed="true"]:hover,
.cp-tabs .button.active,
.cp-tabs .button.active:hover,
.ct-family-tabs .button.active,
.ct-family-tabs .button.active:hover {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}
.cp-version-bar { min-height: 66px; }
.cp-summary { padding-block: 10px; }
.cp-table :is(th, td),
.cd-table-scroll :is(th, td) { color: var(--ink); background: var(--surface); border-color: var(--line); }
.cp-table thead th,
.cp-budget-grid thead > tr > :first-child,
.cd-table-scroll thead th { background: var(--paper); color: var(--muted); }
.cp-budget-grid tr > :first-child,
.cd-table-scroll tbody th:first-child { background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.cp-table tbody tr:hover > *,
.cd-table-scroll tbody tr:hover > * { background: #F5F6F7; }
.cp-budget-grid .cp-current-month,
.cp-budget-grid tr:hover > .cp-current-month { background: var(--accent-soft); }
.cp-budget-grid thead .cp-current-month,
.cp-budget-grid thead th.cp-current-month {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.cp-table td,
.cp-cell-input,
.cp-table .money,
.cd-table-scroll td,
.cd-table-scroll .money { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.cp-cell-input { background: var(--paper); }
.cp-cell-input:focus { background: var(--paper); }
.cp-cell-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 2px 0 0 var(--danger); }
.cp-table .cp-favorable { color: var(--green); }
.cp-table .cp-unfavorable { color: var(--danger); box-shadow: inset 2px 0 0 var(--danger); }
.cp-category-summary > div { border-color: var(--line); background: var(--surface); border-radius: 6px; }
.ct-metric { min-height: 172px; padding: 20px; }
.ct-metric:hover { border-color: var(--accent); background: #F5F6F7; box-shadow: none; }
.ct-metric > strong { margin-block: 16px 10px; }
.ct-formula-parts,
.cd-accounting-context { background: var(--paper); border-color: var(--line); border-radius: 6px; }
.ct-empty,
.cd-empty,
.cd-workspace > .cd-empty { background: var(--surface); border-color: var(--line); color: var(--muted); border-radius: 8px; }
.cd-workspace > .cd-release-published { border-top-width: 2px; border-top-color: var(--accent); }
.cd-preview,
.cd-narrative,
.cd-accounting-point { color: var(--ink); }
.cd-preview h2 { font-size: 24px; letter-spacing: -.4px; }
.cd-preview h3,
.cd-comments article strong,
.cd-accounting-point h3 { color: var(--ink); }
.cd-meeting-record { color: var(--ink); background: var(--accent-soft); border-left-color: var(--accent); border-radius: 0 6px 6px 0; }
.cd-evidence-link,
.cd-agenda-row > span.cd-agenda-number { color: var(--accent-ink); }
.cd-block-picker input[type="checkbox"],
#ai-review-form input[type="checkbox"],
#cd-publish-form input[type="checkbox"],
#cd-meeting-form input[type="checkbox"] { accent-color: var(--accent); color-scheme: dark; }

/* Serviços mantêm o resultado e a evidência como centro da experiência. */
.svc-catalog-row { min-height: 108px; padding: 20px; }
.svc-catalog-row:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.svc-catalog-row:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.svc-catalog-row.is-contextual {
  margin-left: 0;
  padding: 20px;
  border-left: 0;
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.svc-icon,
.ai-agent-icon { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--line); border-radius: 6px; }
.svc-description h3 { font-size: 15px; font-weight: 600; }
.svc-description p,
.ai-agent-description p { color: var(--muted); font-size: 13px; }
.svc-context-tag { color: var(--accent-ink); border-color: var(--line); background: var(--paper); border-radius: 4px; }
.svc-tracking .segmented button { color: var(--muted); border-radius: 4px; }
.svc-tracking .segmented button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); box-shadow: none; }
.svc-count,
.svc-tracking .segmented button[aria-pressed="true"] .svc-count { font-family: var(--font-mono); color: var(--muted); background: var(--paper); }
.svc-tracking .segmented button[aria-pressed="true"] .svc-count { color: var(--accent-ink); }
.svc-work-row.ai-history-row { min-height: 82px; padding: 18px 20px; }
.svc-work-row.ai-history-row:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.svc-work-row.ai-history-row:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.svc-work-row.ai-history-row:hover,
.ai-history-row:hover { background: #F5F6F7; }
.svc-work-row strong { font-weight: 600; }
.svc-result,
.ai-result,
.ai-policy { color: var(--ink); font-family: var(--font-ui); }
.svc-result > h3,
.ai-result h3 { color: var(--ink); font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.svc-result article strong,
.svc-result article b,
.ai-result article b { color: var(--ink); }
.svc-result article b,
.ai-result article b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.svc-result article p,
.svc-result > p,
.ai-result > p,
.ai-policy p { color: var(--muted); }
.svc-next.ai-next,
.ai-next { color: var(--ink); background: var(--accent-soft); border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0; }
.svc-evidence,
.svc-run-head,
.ai-sources,
.ai-review-comment { border-color: var(--line); }
.svc-evidence summary,
.ai-sources summary { min-height: 36px; color: var(--ink); }
.svc-evidence li,
.svc-evidence > p,
.ai-review-comment { color: var(--muted); }
.ai-agent.recommended { background: var(--accent-soft); border-left-color: var(--accent); }
.ai-steps li { border-top-color: var(--line); color: var(--muted); }
.ai-steps li:last-child { border-top-color: var(--accent); color: var(--ink); }
.ai-warning { color: var(--warning); background: var(--warning-soft); border-color: var(--warning); border-radius: 6px; font-size: 13px; }

@media (max-width: 1380px) {
  .ac-summary dd { font-size: 26px; }
}

/* A comparação é irmã do resumo, não uma quarta métrica comprimida.
   No intervalo com menos espaço útil, ocupa sua própria linha. */
@media (min-width: 601px) and (max-width: 1100px) {
  .ac-report-heading { display: block; }
  .ac-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    width: 100%;
    min-width: 0;
  }
  .ac-summary > div { min-width: 0; padding: 0; border: 0; }
  .ac-summary > div:first-child {
    grid-column: 1 / -1;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
  }
  .ac-summary > div:nth-child(2) { padding-right: 20px; border-right: 1px solid var(--line); }
  .ac-summary dd { font-size: 24px; white-space: normal; }
  .ac-summary > div:first-child dd { font-size: 28px; }
  .ac-report-heading > .ac-toggle {
    width: 100%;
    max-width: none;
    min-height: 44px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
  }
  .ac-report-heading > .ac-method { margin-top: 18px; width: fit-content; }
  .ac-report-heading > .ac-method button { min-height: 44px; }
}

@media (max-width: 640px) {
  .ac-scope select,
  .ac-export-actions .button,
  .ac-nav button,
  .ac-method button,
  .ac-record-filters :is(input, select),
  .ac-table .ac-action-cell .button,
  .ac-origin-list .button,
  .cp-history summary,
  .svc-evidence summary,
  .ai-sources summary { min-height: 44px; }
  .ac-table-shell { max-width: 100%; border-radius: 8px; }
  .ac-table { min-width: 760px; }
  .ac-equity { min-width: 1050px; }
  .ac-summary > div:first-child { border-bottom-color: var(--line); }
  .ac-summary dd { font-size: 20px; letter-spacing: -.6px; }
  .ac-summary > div:first-child dd { font-size: 28px; }
  .ac-toggle { border-top-color: var(--line); }
  .ac-report-heading { padding: 16px; }
  .ac-detail-amount { overflow-wrap: anywhere; }
  .ct-work-section,
  .ct-services-strip { padding: 20px 18px; }
  .ct-kpis.ct-kpis-work > div:not(:first-child) > strong { font-size: 20px; }
  .ct-kpis.ct-kpis-work > div { border-color: var(--line); }
  .ct-kpis.ct-kpis-work > div:first-child { border-bottom-color: var(--line); }
  .ct-kpis.ct-kpis-work > div:nth-child(2) { border-right-color: var(--line); }
  .cp-summary { padding-block: 0; }
  .ct-kpis strong:has(.money),
  .cp-summary dd,
  .cd-summary strong,
  .cd-preview .cd-summary strong,
  .ct-metric > strong,
  .ct-metric > strong:has(.money) { font-size: 27px; letter-spacing: -.8px; }
  .ct-metric { min-height: 0; padding: 20px; }
  .ct-cycle-state { display: block; max-width: 100%; }
  .ct-cycle-row { flex-wrap: wrap; }
  .ct-cycle-state { flex-basis: 100%; padding-left: 29px; }
  .svc-context { padding: 12px 0; border-radius: 0; }
  .svc-catalog-row,
  .svc-catalog-row.is-contextual { padding: 18px 16px; gap: 12px; }
  .svc-icon { border-radius: 6px; }
  .svc-work-row.ai-history-row { padding: 18px 14px; }
  .svc-description p { font-size: 13px; }
  .svc-description small,
  .svc-footnote,
  .svc-section-note { font-size: 12px; }
  .svc-result article b { max-width: 100%; font-size: 17px; overflow-wrap: anywhere; }
  .cd-workspace > .panel,
  .cd-two-column > .panel { border-radius: 8px; }
  .cd-preview h2 { font-size: 22px; }
  .cd-table-scroll { max-width: 100%; }
  .ai-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .ai-steps li { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ac-workspace *,
  .ct-page *,
  .services-page * { scroll-behavior: auto; transition: none; }
}

/* C4 · auditoria da cascata control/accounting/services/design-system.
   Corrige textos de 9–11 px, ações de 26–36 px, resumos sem respiro e
   superfícies claras herdadas. Apenas áreas contábeis/controladoria/serviços;
   geometria do shell e do diálogo permanece na camada orbit-core. */
:is(.ac-workspace, .ct-page, .cp-planning, .cd-workspace, .services-page,
    .ac-drawer, .ac-document, .ac-explanation, .ai-result, .ai-policy) {
  min-width: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
:is(.ac-workspace, .ct-page, .services-page) .page-subtitle,
.ac-heading p:not(.ac-kicker) { font-size: 14px; line-height: 1.6; max-width: 76ch; }
.ac-heading h1 { font-size: 30px; line-height: 1.2; margin: 5px 0 8px; letter-spacing: -.65px; }
.ac-heading { align-items: center; gap: 20px; margin-bottom: 22px; }
.ac-kicker { font-size: 12px; letter-spacing: 1.1px; }
:is(.ac-workspace, .ct-page, .services-page) .button,
:is(.ac-drawer, .ac-explanation, .ai-result, .ai-policy) .button,
.cd-evidence-link {
  min-height: 42px;
  max-width: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 13px;
}
:is(.ac-workspace, .ct-page, .services-page) .badge { font-size: 12px; line-height: 1.5; }
:is(.ac-workspace, .ct-page, .services-page) :is(.row, .section-toolbar) {
  min-width: 0;
  gap: 12px;
  flex-wrap: wrap;
}
:is(.ac-workspace, .ct-page, .services-page) .row > * { min-width: 0; max-width: 100%; }
:is(.ac-workspace, .ct-page, .services-page) .button:disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--paper);
  border-color: var(--line);
  cursor: not-allowed;
}

/* Contexto e navegação interna: rótulos persistentes, controles do mesmo tamanho. */
.ac-nav,
.ct-subnav { gap: 26px; margin: 0 0 20px; max-width: 100%; overscroll-behavior-x: contain; }
.ac-nav button,
.ct-subnav a { min-height: 46px; font-size: 14px; line-height: 1.5; padding: 10px 0 12px; }
.ac-nav button.active,
.ac-nav button[aria-pressed="true"],
.ct-subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
.ac-scope,
.ct-period,
.svc-context { gap: 14px 20px; margin-bottom: 22px; padding: 14px 0; }
.ac-scope { align-items: flex-end; border-bottom: 1px solid var(--line); }
.ac-scope label,
.ac-record-filters label,
.cp-toolbar .field,
.ct-period label,
.svc-context label { font-size: 13px; line-height: 1.5; min-width: 0; }
.ac-scope label { min-width: 150px; gap: 7px; }
.ac-scope > .ac-period-label,
.ac-period-label small,
.ac-scope > .ac-period-label small,
.ct-period,
.svc-context,
.svc-context > span { font-size: 13px; line-height: 1.6; }
.ac-scope > .ac-period-label { max-width: 100%; text-align: left; }
.svc-context > span { min-width: 0; overflow-wrap: anywhere; }
.ac-scope select,
.ac-record-filters :is(input, select),
.cp-toolbar select,
.ct-period select,
.svc-context select {
  min-height: 42px;
  max-width: 100%;
  min-width: 0;
  padding: 9px 32px 9px 12px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.ac-record-filters input { padding-right: 12px; }
.ac-record-filters { gap: 14px; margin-bottom: 20px; }
.ac-record-filters label { flex: 1 1 220px; }
.ac-export-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; align-self: center; }
.ac-export-actions .button { min-height: 42px; font-size: 14px; }
.ac-method button,
.cp-tabs .button,
.ct-family-tabs .button,
.svc-tracking .segmented button { min-height: 42px; padding: 9px 13px; font-size: 14px; line-height: 1.45; }
.ac-method { flex-wrap: wrap; }
.cp-tabs,
.ct-family-tabs,
.svc-tracking .segmented { gap: 5px; min-width: 0; max-width: 100%; }
.cp-tabs .button[aria-pressed="true"],
.ct-family-tabs .button.active,
.ac-method button[aria-pressed="true"],
.svc-tracking .segmented button[aria-pressed="true"] {
  color: var(--ink);
  background: #F5F6F7;
  box-shadow: inset 0 -2px var(--accent);
}

/* Resumos: a informação não encosta na moldura, nem disputa espaço com filtros. */
.ac-report-heading { padding: 20px 22px; gap: 20px; flex-wrap: wrap; }
.ac-summary { flex: 1 1 520px; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ac-summary > div { min-width: 0; padding-inline: 20px; }
.ac-summary dt,
.ct-kpis > div > span,
.cp-summary dt,
.cd-summary > div > span { font-size: 13px; line-height: 1.5; }
.ac-summary dd { font-size: 28px; line-height: 1.3; letter-spacing: -.7px; white-space: normal; overflow-wrap: anywhere; }
.ac-summary dd small { font-size: 12px; line-height: 1.5; font-weight: 400; }
.ac-report-heading > .ac-toggle {
  flex: 0 1 200px;
  max-width: 220px;
  min-height: 42px;
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
}
.ac-toggle input { width: 18px; height: 18px; flex-shrink: 0; }
.ct-kpis,
.cp-summary,
.cd-summary { padding: 22px 0; margin-bottom: 24px; gap: 0; }
.ct-kpis > div,
.cp-summary > div,
.cd-summary > div { padding-inline: 22px; }
.ct-kpis strong,
.cp-summary dd,
.cd-summary strong,
.cd-preview .cd-summary strong { font-size: 28px; line-height: 1.35; overflow-wrap: anywhere; }
.ct-kpis small,
.cp-summary dd small { font-size: 13px; line-height: 1.6; margin-top: 8px; }
.cp-summary dd small .money { font-size: inherit; }
.cp-version-bar { padding: 18px 20px; gap: 18px; margin-bottom: 20px; }
.cp-version-bar > div { min-width: 0; max-width: 100%; }
.cp-version-bar p,
.cp-draft-status p { font-size: 14px; line-height: 1.6; }
.cp-draft-status { padding: 20px 22px; }
.cp-note,
.cp-assumptions,
.cp-planning > p.muted,
.cp-history,
.cp-history li { font-size: 13px; line-height: 1.7; }
.cp-history summary { min-height: 42px; font-size: 14px; }

/* Tabelas: cabeçalhos e coluna fixa opacos; o overflow fica no próprio quadro. */
.ac-table-shell,
.cp-table-scroll,
.cd-table-scroll { width: 100%; max-width: 100%; min-width: 0; isolation: isolate; }
.ac-table-shell { max-height: min(72vh, 760px); }
.ac-table { min-width: 820px; }
.ac-table :is(th, td),
.cp-table :is(th, td),
.cd-table-scroll :is(th, td) { font-size: 14px; line-height: 1.55; padding: 10px 16px; }
.ac-table :is(th, td) { padding-block: 6px; }
.ac-table tbody tr { height: 54px; }
.ac-table thead th,
.ac-table thead th:first-child,
.ac-table thead tr > :first-child,
.cp-table thead th,
.cd-table-scroll thead th { font-size: 12px; line-height: 1.5; padding-block: 14px; background: var(--paper); }
.ac-table tbody .ac-section > *,
.ac-table tbody tr.ac-section:hover > * { font-size: 12px; letter-spacing: .5px; padding-block: 12px; }
.ac-table .ac-row-label { min-height: 42px; font-size: 14px; line-height: 1.5; }
.ac-table .ac-action-cell .button,
.ac-table .ac-amount-button { min-height: 42px; font-size: 14px; padding-block: 8px; }
.ac-table .ac-action-cell { min-width: 92px; }
.ac-table :is(small, .ac-account-code, .ac-nature) { font-size: 12px; line-height: 1.5; }
.ac-table tr > :first-child { min-width: 230px; max-width: 320px; }
.ac-table .ac-description { min-width: 280px; }
.ac-table .ac-section > :first-child { max-width: none; }
.ac-table.ac-equity { min-width: 1150px; }
.ac-table.ac-trial { min-width: 1080px; }
.ac-table.ac-records { min-width: 1040px; }
.ac-table .money,
.cp-table .money,
.cd-table-scroll .money { font-size: inherit; }
.cp-table th :is(small, .button),
.cp-table td small { font-size: 13px; }
.cp-budget-grid { min-width: 100%; }
.cp-budget-grid td { min-width: 145px; padding: 10px 12px; }
.cp-cell-input { width: 120px; max-width: 100%; min-height: 42px; padding: 9px 10px; font-size: 14px; }
.cp-budget-grid tr > :first-child { width: 240px; min-width: 240px; max-width: 240px; }
.cp-budget-grid th .button { min-height: 42px; font-size: 13px; margin-left: 0; white-space: normal; }
.cp-table .cp-unfavorable { box-shadow: inset 2px 0 var(--danger); }
.ac-source-foot,
.ac-report-foot,
.ac-report-foot span,
.ac-source-label,
.ac-table-hint { font-size: 12px; line-height: 1.7; color: var(--muted); }
.ac-report-foot { padding: 15px 2px; flex-wrap: wrap; }
.ac-reading-note { font-size: 13px; line-height: 1.7; }
.ac-checks summary { min-height: 44px; padding-block: 14px; font-size: 14px; }
.ac-checks summary > span:last-child,
.ac-check-state { font-size: 12px; line-height: 1.55; }
.ac-checks li { font-size: 14px; gap: 18px; padding-block: 16px; }
.ac-checks li p,
.ac-eliminations p { font-size: 13px; line-height: 1.65; }
.ac-eliminations h3 { font-size: 16px; }
.ac-eliminations > div { font-size: 14px; flex-wrap: wrap; gap: 12px; }
.ac-observations strong { font-size: 15px; }
.ac-observations p { font-size: 14px; }
.ac-observations small { font-size: 12px; }

/* Controladoria e indicadores: nomes e critérios são tão legíveis quanto números. */
.ct-workbench { gap: 22px; margin-top: 26px; }
.ct-work-section,
.ct-services-strip,
.ct-definition-list { padding: 24px; }
.ct-work-link { gap: 16px; padding-block: 20px; }
.ct-work-link strong,
.ct-cycle-row strong { font-size: 15px; line-height: 1.5; }
.ct-work-link small,
.ct-cycle-row small,
.ct-cycle-state,
.ct-step,
.ct-delivery-status dl > div,
.ct-services-strip p { font-size: 13px; line-height: 1.65; }
.ct-delivery-status { padding-left: 24px; }
.ct-source-strip { padding: 18px 20px; gap: 14px; font-size: 13px; line-height: 1.65; }
.ct-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ct-metric { padding: 22px; min-height: 196px; }
.ct-metric > span:first-child { font-size: 14px; line-height: 1.5; gap: 12px; }
.ct-metric > strong,
.ct-metric > strong:has(.money) { font-size: 30px; margin-block: 18px 14px; overflow-wrap: anywhere; }
.ct-metric > small,
.ct-metric .ct-goal,
.ct-inline-note p,
.ct-definition-list > div { font-size: 13px; line-height: 1.65; }
.ct-metric .icon { width: 18px; height: 18px; flex-shrink: 0; }
.ct-definition-list h2 { font-size: 18px; }
.ct-empty,
.cd-empty { padding: 26px; }
.ct-empty p,
.cd-empty p { font-size: 14px; line-height: 1.7; }

/* Entregas, reunião e observações: superfície de leitura, não campos comprimidos. */
.cd-workspace > .panel,
.cd-two-column > .panel { padding: 26px; border-radius: 8px; }
.cd-toolbar { margin-bottom: 22px; gap: 16px; }
.cd-toolbar h2 { font-size: 20px; line-height: 1.4; }
.cd-toolbar p,
.cd-meta,
.cd-report-boundary,
.cd-status,
.cd-release-published > p { font-size: 13px; line-height: 1.7; }
.cd-preview,
.cd-narrative,
.cd-comments article,
.cd-analysis,
.cd-accounting-point { font-size: 15px; line-height: 1.8; }
.cd-preview h2 { font-size: 26px; }
.cd-preview h3,
.cd-accounting-point h3 { font-size: 18px; }
.cd-preview footer,
.cd-source-list,
.cd-comments article small,
.cd-editor details,
.cd-block-picker legend,
.cd-accounting-context { font-size: 13px; line-height: 1.7; }
.cd-analysis-list,
.cd-agenda-row strong,
.cd-action-row strong,
.cd-block-picker label { font-size: 14px; line-height: 1.65; }
.cd-agenda-row small,
.cd-action-row small { font-size: 13px; line-height: 1.6; }
.cd-agenda-row,
.cd-action-row { min-width: 0; gap: 16px; padding-block: 22px; flex-wrap: wrap; }
.cd-agenda-row > .grow,
.cd-action-row > .grow { min-width: 0; flex: 1 1 200px; overflow-wrap: anywhere; }
.cd-agenda-row > .button,
.cd-action-row > .button { flex-shrink: 0; }
.cd-editor details summary { min-height: 42px; }
.cd-workspace .field,
form[id^="cp-"] .field,
form[id^="cd-"] .field,
#ai-review-form .field { font-size: 14px; line-height: 1.6; gap: 8px; }
.cd-workspace :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
form[id^="cp-"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
form[id^="cd-"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
#ai-review-form :is(input:not([type="checkbox"]), textarea),
.ac-explanation textarea {
  min-height: 42px;
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}
/* Budget cells keep tabular figures and their deliberate fixed width. */
#cp-budget-form .cp-cell-input { width: 120px; font-family: var(--font-mono); font-size: 14px; }
.cd-editor textarea { min-height: 220px; line-height: 1.8; }
:is(#ai-review-form, #cd-publish-form, #cd-meeting-form) label:has(input[type="checkbox"]),
.cp-planning label:has(input[type="checkbox"]) { font-size: 14px; line-height: 1.65; min-height: 44px; }
:is(#ai-review-form, #cd-publish-form, #cd-meeting-form) input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 4px;
}

/* Serviços: leitura em linhas e próxima ação sem microtexto. */
.services-page .section-toolbar h2 { font-size: 20px; line-height: 1.4; }
.svc-catalog-row,
.svc-catalog-row.is-contextual { padding: 24px; gap: 20px; grid-template-columns: 40px minmax(0, 1fr) auto; }
.svc-icon { width: 40px; height: 40px; }
.svc-description h3 { font-size: 17px; line-height: 1.4; }
.svc-description p { font-size: 14px; line-height: 1.65; }
.svc-description small,
.svc-bpo-only,
.svc-section-note { font-size: 13px; line-height: 1.65; }
.svc-context-tag { font-size: 12px; padding: 3px 7px; }
.svc-start { min-width: 130px; padding-left: 12px; }
.svc-start .button { font-size: 14px; min-height: 42px; }
.svc-count { font-size: 12px; line-height: 1.5; min-width: 22px; }
.svc-work-row.ai-history-row { padding: 22px 24px; min-height: 94px; }
.svc-work-row strong { font-size: 15px; line-height: 1.5; }
.svc-work-row small,
.svc-row-cta { font-size: 13px; line-height: 1.6; }
.svc-work-row { color: var(--ink); }
.svc-empty { padding: 26px; }
.svc-empty strong { font-size: 15px; }
.svc-empty p { font-size: 14px; }
.svc-footnote,
.svc-result-note,
.svc-section-label { font-size: 12px; line-height: 1.7; }
.svc-run-head { font-size: 13px; line-height: 1.6; }
.svc-result > p,
.svc-result article > div,
.ai-policy p { font-size: 15px; line-height: 1.7; }
.svc-result article p,
.svc-next.ai-next { font-size: 14px; line-height: 1.75; }
.svc-result article > div { flex-wrap: wrap; }
.svc-result article b { flex-shrink: 1; overflow-wrap: anywhere; }
.svc-evidence,
.svc-evidence li,
.svc-evidence > p,
.ai-review-comment { font-size: 13px; line-height: 1.75; }
.svc-evidence summary { min-height: 44px; font-size: 14px; }
.ai-warning { padding: 18px 20px; font-size: 14px; line-height: 1.7; }
.ai-warning > p { margin: 0 0 12px; }
.ai-warning > p:last-child { margin-bottom: 0; }

/* Conteúdo local dos painéis laterais, sem interferir com seu contêiner. */
.ac-drawer h3,
.ac-explanation h3 { font-size: 17px; line-height: 1.5; }
.ac-drawer > p,
.ac-explanation > p,
.ac-origin-list strong,
.ac-document > p,
.ac-document-line { font-size: 14px; line-height: 1.7; }
.ac-origin-list small,
.ac-origin-list > li > div > span,
.ac-detail-comparison dt,
.ac-document dl,
.ac-explanation form label,
.ac-explanation form p { font-size: 13px; line-height: 1.65; }
.ac-origin-list > li { gap: 16px; flex-wrap: wrap; }
.ac-origin-list > li > div { flex: 1 1 210px; }
.ac-origin-list .button { min-height: 42px; font-size: 14px; }
.ac-document-stamp { font-size: 12px; letter-spacing: .7px; }
.ac-document dl > div { gap: 16px; flex-wrap: wrap; }
.ac-document dd { overflow-wrap: anywhere; }
.ac-detail-comparison { flex-wrap: wrap; gap: 18px 24px; }
.ac-detail-comparison > div { min-width: 0; }
.ac-detail-comparison dd { font-size: 20px; overflow-wrap: anywhere; }
.ac-composition li,
.ac-composition strong { font-size: 14px; }
.ac-composition li { flex-wrap: wrap; gap: 10px 16px; }
.ac-boundary { font-size: 12px !important; } /* Overrides the original 10/11px !important. */
.ac-explanation .ac-explanation-text { font-size: 15px; line-height: 1.8; }
.ct-formula-parts > div { font-size: 14px; line-height: 1.6; flex-wrap: wrap; }
.cp-category-summary,
.cp-origin-list,
.cp-review-list { font-size: 14px; line-height: 1.7; }
.cp-category-summary dt,
.cp-origin-list small { font-size: 13px; }

@media (max-width: 1150px) {
  .ac-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  .ac-export-actions { align-self: flex-start; }
  .ac-summary { flex-basis: 100%; width: 100%; }
  .ac-report-heading { display: flex; }
  .ac-summary > div:first-child { grid-column: auto; border-bottom: 0; padding-bottom: 0; }
  .ac-summary > div { padding: 0 16px; border-right: 1px solid var(--line); }
  .ac-summary > div:first-child { padding-left: 0; }
  .ac-summary > div:last-child { padding-right: 0; border-right: 0; }
  .ac-summary dd { font-size: 24px; }
  .ac-summary > div:first-child dd { font-size: 24px; }
  .ac-report-heading > .ac-toggle { flex: 1 1 100%; max-width: 100%; margin-top: 0; padding-top: 14px; font-size: 13px; }
  .ct-workbench { grid-template-columns: minmax(0, 1fr); }
  .ct-delivery-status { padding-left: 0; border-left: 0; }
  .ct-service-actions { max-width: none; justify-content: flex-start; }
}

/* C4 native QA: a four-column card at 1440px left only ~220px for
   a 30px currency amount. Keep the value intact by changing the grid. */
@media (min-width: 701px) and (max-width: 1599px) {
  .ct-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .ac-heading h1 { font-size: 28px; }
  .ac-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .ac-scope label,
  .ac-scope label:nth-child(3),
  .ac-scope > .ac-period-label { width: 100%; min-width: 0; margin: 0; }
  .ac-scope > .ac-period-label { align-self: end; }
  .ac-scope select { width: 100%; }
  .ac-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .ac-summary > div { padding: 0; border: 0; }
  .ac-summary > div:first-child { grid-column: 1 / -1; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .ac-summary > div:nth-child(2) { padding-right: 12px; border-right: 1px solid var(--line); }
  .ac-summary dd,
  .ac-summary > div:first-child dd { font-size: 26px; }
  .ac-summary dt { font-size: 13px; }
  .ct-kpis,
  .cp-summary,
  .cd-summary,
  .ct-kpis.ct-kpis-work { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .ct-kpis > div,
  .cp-summary > div,
  .cd-summary > div,
  .ct-kpis.ct-kpis-work > div,
  .ct-kpis.ct-kpis-work > div:first-child,
  .ct-kpis.ct-kpis-work > div:last-child { grid-column: auto; padding: 20px; border: 0; border-bottom: 1px solid var(--line); }
  .ct-kpis > div:last-child,
  .cp-summary > div:last-child,
  .cd-summary > div:last-child { border-bottom: 0; }
  .ct-kpis.ct-kpis-work > div:nth-child(2) { border-right: 0; }
  .ct-kpis.ct-kpis-work > div:not(:first-child) > strong { font-size: 24px; }
  .ct-kpis.ct-kpis-work > div:not(:first-child) > span,
  .ct-kpis.ct-kpis-work > div:not(:first-child) > small { font-size: 13px; }
  .ct-period,
  .svc-context { gap: 12px; padding-block: 16px; }
  .ct-period label,
  .svc-context label { flex-wrap: wrap; width: 100%; gap: 10px; }
  .ct-period select,
  .svc-context select { min-width: 0; width: auto; max-width: 100%; flex: 1 1 180px; }
  .ct-family-tabs .button,
  .cp-tabs .button { font-size: 14px; }
  .ct-metric-grid { grid-template-columns: minmax(0, 1fr); }
  .ct-metric { min-height: 0; padding: 22px; }
  .ct-work-section,
  .ct-services-strip,
  .ct-definition-list { padding: 22px 20px; }
  .ct-source-strip { padding: 18px; flex-wrap: wrap; }
  .ct-source-strip > .button { margin-left: 0; }
  .svc-catalog-row,
  .svc-catalog-row.is-contextual { grid-template-columns: 36px minmax(0, 1fr); padding: 22px 18px; gap: 12px; }
  .svc-icon { width: 36px; height: 36px; }
  .svc-start { grid-column: 2; padding: 0; min-width: 0; text-align: left; }
  .svc-description p { font-size: 14px; }
  .svc-tracking .segmented { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
  .svc-tracking .segmented button { flex: 1 1 90px; font-size: 13px; padding: 9px 7px; white-space: normal; }
  .svc-work-row.ai-history-row { grid-template-columns: 24px minmax(0, 1fr); padding: 22px 18px; gap: 12px; }
  .svc-work-row.ai-history-row > div { grid-column: 2; }
  .svc-work-row.ai-history-row > .badge { grid-column: 2; }
  .svc-row-cta { grid-column: 2; grid-row: auto; justify-content: flex-start; }
  .svc-result article > div { gap: 8px; }
  .cd-workspace > .panel,
  .cd-two-column > .panel { padding: 22px 18px; }
  .cd-agenda-row > .button { margin-left: 0; }
  .cd-agenda-row > .grow,
  .cd-action-row > .grow { flex-basis: calc(100% - 42px); }
  .cd-action-row > .button { margin-top: 4px; }
  .ac-report-heading { padding: 20px; }
  .ac-table tr > :first-child { min-width: 180px; max-width: 200px; width: 180px; }
  .ac-table .ac-section > :first-child { max-width: none; }
  .cp-budget-grid tr > :first-child { min-width: 170px; max-width: 170px; width: 170px; }
  .ac-table-hint { display: flex; font-size: 12px; margin-block: 12px; }
  .ac-checks summary { gap: 10px; }
  .ac-checks summary > span:last-child { font-size: 12px; padding-left: 0; }
  .ac-checks li { flex-wrap: wrap; gap: 8px; }
  .ac-check-state { min-width: 0; }
  .ac-origin-list > li > div { flex-basis: 100%; }
  .ac-document { padding: 20px; }
  .ac-document dd { max-width: 100%; text-align: left; }
  .ac-document dl > div { flex-direction: column; gap: 4px; }
  .ac-explanation .ac-explanation-text { font-size: 15px; }
  :is(.ac-workspace, .ct-page, .services-page) .button,
  .ac-nav button,
  .ct-subnav a,
  .ac-method button,
  .ac-table .ac-row-label,
  .ac-table .ac-amount-button,
  .ac-origin-list .button,
  .cd-evidence-link,
  .cp-cell-input { min-height: 44px; }
  .ac-scope select,
  .ac-record-filters :is(input, select),
  .cp-toolbar select,
  .ct-period select,
  .svc-context select,
  .cd-workspace :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
  form[id^="cp-"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
  form[id^="cd-"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
  #ai-review-form :is(input:not([type="checkbox"]), textarea),
  .ac-explanation textarea { min-height: 44px; font-size: 16px; }
  #cp-budget-form .cp-cell-input { min-height: 44px; font-size: 16px; }
}

@media (max-width: 360px) {
  .ac-scope { grid-template-columns: minmax(0, 1fr); }
  .ac-summary { grid-template-columns: minmax(0, 1fr); }
  .ac-summary > div:nth-child(2) { border-right: 0; padding-right: 0; }
  .svc-catalog-row,
  .svc-catalog-row.is-contextual { grid-template-columns: minmax(0, 1fr); }
  .svc-start { grid-column: 1; }
  .svc-description { min-width: 0; }
  .svc-tracking .segmented button { flex-basis: 100%; }
}

/* Explicit local exceptions to inherited global defaults. */
:is(.ac-workspace, .ct-page, .services-page, .svc-run-head) .badge:not(.success):not(.warning):not(.danger):not(.error) {
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
}
:is(.ac-workspace, .ct-page, .services-page, .svc-run-head) .badge.info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
#cp-budget-form .cp-cell-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: inset 2px 0 var(--danger);
}
.dialog-body:has(.ct-detail-value) > .muted { font-size: 14px; line-height: 1.7; }

@media (max-width: 700px) {
  /* Currency remains unbroken; a single measure per row prevents clipped digits. */
  .ac-summary { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ac-summary > div,
  .ac-summary > div:first-child,
  .ac-summary > div:nth-child(2) { grid-column: auto; padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--line); }
  .ac-summary > div:last-child { padding-bottom: 0; border-bottom: 0; }
  .ac-summary dd,
  .ac-summary > div:first-child dd,
  .ct-kpis strong:has(.money),
  .cp-summary dd,
  .cd-summary strong,
  .cd-preview .cd-summary strong,
  .ct-metric > strong,
  .ct-metric > strong:has(.money) { font-size: clamp(23px, 6.8vw, 28px); letter-spacing: -.65px; }
}

/* Native printing keeps the same hierarchy on paper, without dark fills or
   sticky columns crossing page breaks. Exported report HTML is independent. */
@media print {
  :is(.ac-workspace, .ct-page, .cp-planning, .cd-workspace, .services-page,
      .ac-drawer, .ac-document, .ac-explanation, .ai-result, .ai-policy) {
    --paper: #20262C;
    --surface: #20262C;
    --ink: #FFFFFF;
    --muted: #CED2D6;
    --line: #20262C;
    --accent: #CED2D6;
    --accent-ink: #FFFFFF;
    --accent-soft: #20262C;
    --green: #E0FAE3;
    --danger: #ECEDED;
    --warning: #FFF2CC;
    --warning-soft: #20262C;
    color: #FFFFFF;
    background: #20262C;
  }
  .ac-table-shell,
  .cp-table-scroll,
  .cd-table-scroll { overflow: visible; max-height: none; border-radius: 0; }
  .ac-table,
  .ac-table.ac-equity,
  .ac-table.ac-trial,
  .ac-table.ac-records,
  .cp-table,
  .cd-table-scroll table { min-width: 0; width: 100%; table-layout: fixed; }
  .ac-table :is(th, td),
  .ac-table tr > :first-child,
  .cp-table :is(th, td),
  .cp-budget-grid tr > :first-child,
  .cd-table-scroll :is(th, td) {
    position: static;
    min-width: 0;
    max-width: none;
    width: auto;
    padding: 6px;
    font-size: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: none;
  }
  .ac-table .money,
  .cp-table .money,
  .cd-table-scroll .money { white-space: normal; }
  .ac-table tbody tr.ac-total > *,
  .ac-table tbody .ac-section > *,
  .cp-budget-grid .cp-current-month { background: #20262C; color: #FFFFFF; }
  .ac-table .ac-row-label,
  .ac-table .ac-amount-button { min-height: 0; font-size: 10px; padding: 0; border: 0; }
  .ac-table .ac-action-cell .button,
  .ac-export-actions,
  .ac-nav,
  .ct-subnav,
  .svc-start { display: none; }
  .ac-table tbody tr { height: auto; }
  .ac-summary dd,
  .ct-kpis strong,
  .cp-summary dd,
  .cd-summary strong,
  .ct-metric > strong { font-size: 22px; }
  #cp-budget-form .cp-cell-input { width: 100%; min-height: 0; font-size: 9px; padding: 1px; border: 0; }
  .ac-document,
  .ct-metric { break-inside: avoid; }
}

/* C4 mobile QA: every local destination, including the selected one, stays visible. */
.svc-count,
.svc-tracking .segmented button[aria-pressed="true"] .svc-count { font-size: 12px; }
@media (max-width: 600px) {
  .ct-subnav,
  .ac-nav {
    display: grid;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    gap: 6px;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }
  .ct-subnav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ac-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ct-subnav a,
  .ac-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    height: 100%;
    padding: 10px 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
  .ct-subnav a[aria-current="page"],
  .ac-nav button.active,
  .ac-nav button[aria-pressed="true"] {
    background: #F5F6F7;
    border-color: var(--accent);
    color: var(--ink);
    box-shadow: inset 0 -2px var(--accent);
    font-weight: 650;
  }
}
@media (max-width: 350px) {
  .ct-subnav,
  .ac-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .ct-subnav,
  .ac-nav { display: none; }
}
/* Notebook QA: budget figures retain their gutters at intermediate widths. */
@media screen and (min-width:701px) and (max-width:1200px){
  .cp-summary{grid-template-columns:repeat(2,minmax(0,1fr));padding:0}
  .cp-summary>div{min-width:0;padding:20px 22px}
  .cp-summary>div:first-child{grid-column:1/-1;border-right:0;border-bottom:1px solid var(--line)}
  .cp-summary>div:last-child{border-right:0}
}
.ac-nature{font-size:12px}
@media screen and (max-width:420px){.ct-subnav{grid-template-columns:repeat(2,minmax(0,1fr))}.ct-subnav a{overflow-wrap:normal;word-break:normal}}
