/* Shared masthead and distinct workspaces for intake, register and detail. */
.app-body .shell { width: min(1280px, calc(100% - 72px)); }
.app-body .topbar,
.app-body.cloud-mode .topbar,
.app-body:not(.cloud-mode) .topbar {
  position: relative;
  z-index: 4;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 92px;
  padding: 13px 0;
  border: 0;
  background: var(--brand-dark);
  color: var(--brand-light);
}
.app-body .topbar::before {
  position: absolute;
  z-index: -1;
  inset: 0 calc((100vw - 100%) / -2);
  background: var(--brand-dark);
  border-bottom: 1px solid #674725;
  content: '';
}
.app-body .topbar .identity { min-width: 0; gap: 15px; }
.app-body .topbar .brand-logo-header { width: 62px; height: 62px; border-color: #a78045; border-radius: 8px; }
.app-body .topbar .identity > div { min-width: 0; }
.app-body .topbar .identity .app-name { color: var(--brand-light); font-size: 31px; }
.app-body .topbar .identity p { margin: 3px 0 0; color: var(--brand-muted); }
.app-body .topbar .account-office span { display: none; }
.app-body .topbar .account-office strong { max-width: 28ch; color: var(--brand-gold); font-size: 11px; font-weight: 500; }
.app-body .topbar .app-tabs { position: static; display: flex; gap: 4px; margin: 0; padding: 4px; border: 1px solid var(--dm-line-strong); border-radius: 11px; background: var(--dm-surface); box-shadow: none; }
.app-body .topbar .app-tab { min-height: 44px; padding: 9px 15px; border-radius: 7px; color: var(--dm-ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.app-body .topbar .app-tab::after { display: none; }
.app-body .topbar .app-tab:hover { background: var(--dm-gold-soft); }
.app-body .topbar .app-tab.active { background: var(--brand-gold); color: var(--dm-ink); }
.app-body .topbar .app-tab svg { color: var(--dm-gold-dark); }
.app-body .topbar .app-tab.active svg { color: currentColor; }
.app-body .topbar :focus-visible { outline-color: var(--brand-gold); }
.app-body .topbar .app-tab:focus-visible { outline-color: var(--dm-gold-dark); outline-offset: 1px; }
.app-body .topbar #mobile-account-toggle { display: inline-flex; justify-self: end; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border: 1px solid #80643f; border-radius: 7px; background: transparent; color: var(--brand-light); font-size: 12px; font-weight: 500; cursor: pointer; }
.app-body .topbar #mobile-account-toggle svg { width: 16px; height: 16px; color: var(--brand-gold); }
.app-body .topbar #mobile-account-toggle:hover { background: #482e1e; }
.app-body.cloud-mode .topbar #top-actions { position: absolute; top: calc(100% - 7px); right: 0; z-index: 6; display: none; width: min(356px, 100%); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 13px; border: 1px solid var(--dm-line); border-radius: 10px; background: var(--dm-surface); box-shadow: 0 12px 30px rgb(41 24 15 / 14%); }
.app-body.cloud-mode .topbar #top-actions.mobile-open { display: grid; animation: workspace-enter 160ms var(--ease-out) both; }
.app-body.cloud-mode .topbar #top-actions > * { max-width: none; min-height: 42px; justify-content: center; }
.app-body.cloud-mode .topbar #top-actions .user-email { grid-column: 1 / -1; min-height: 0; padding: 4px 2px; overflow-wrap: anywhere; }
.app-body.cloud-mode .topbar #top-actions .privacy { margin: 0; color: var(--dm-text); }
.app-body:not(.cloud-mode) .topbar #top-actions { position: static; margin: 0; justify-content: flex-end; }
.app-body:not(.cloud-mode) .topbar .privacy { max-width: none; color: var(--brand-muted); white-space: nowrap; }
.app-body .topbar .privacy::before { flex: 0 0 6px; }
.local-mode-short { display: none; }
.app-body .app-view, .app-body.cloud-mode #analysis-view, .app-body.cloud-mode #history-view { margin-top: 35px; }
@keyframes workspace-enter { from { opacity: .72; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.app-body .auth-startup {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--dm-text);
  text-align: center;
}
.app-body .auth-startup p { margin: 0; }
.app-body .auth-startup .action { width: auto; margin: 0; }

/* Intake: file tray + one shared configuration column, with a single action row. */
.app-body .workspace { display: block; }
.analysis-page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.app-body #upload-title, .app-body .history-header h1 { margin: 0; font-family: var(--brand-type); font-size: 41px; font-weight: 500; line-height: 1.09; letter-spacing: -.025em; }
.analysis-page-heading .lead { margin: 9px 0 0; }
.page-secondary-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 40px; color: var(--dm-gold-dark); text-decoration: none; font-size: 13px; font-weight: 500; }
.page-secondary-link:hover { text-decoration: underline; }
.page-secondary-link svg, .history-new svg { width: 17px; height: 17px; }
.app-body .analysis-office-context { margin: -13px 0 17px; }
.app-body #upload-form { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); grid-template-areas: 'files config' 'submit submit'; padding: 0; }
.upload-files-pane { grid-area: files; min-width: 0; padding: 30px; }
.upload-config-pane { grid-area: config; min-width: 0; padding: 30px; border-left: 1px solid var(--dm-line); border-radius: 0 11px 0 0; background: var(--dm-surface-soft); }
.app-body .upload-section-heading { margin-bottom: 17px; }
.app-body .upload-section-heading h2, .app-body .config-title { margin: 0; max-width: none; color: var(--dm-ink); font-size: 17px; font-weight: 600; line-height: 1.4; }
.config-intro { margin: 5px 0 0; color: var(--dm-muted); font-size: 12px; line-height: 1.55; }
.app-body .dropzone { position: relative; min-height: 275px; padding: 29px 18px; border-style: solid; border-color: #80643f; border-radius: 9px; }
.app-body .dropzone:focus-within { outline-offset: 4px; }
.app-body .dropzone .file-picker-affordance { margin-top: 12px; padding: 8px 14px; border: 1px solid #80643f; border-radius: 6px; color: var(--brand-light); text-decoration: none; font-weight: 500; }
.app-body .dropzone:hover .file-picker-affordance { border-color: var(--brand-gold); }
.app-body .dropzone .dropzone-locked-copy { display: none; }
.app-body .dropzone.is-locked { background: var(--dm-surface-muted); opacity: 1; }
.app-body .dropzone.is-locked .dropzone-picker-copy { display: none; }
.app-body .dropzone.is-locked .dropzone-locked-copy { display: block; color: var(--dm-text); }
.app-body .dropzone.is-locked .dropzone-locked-copy strong { color: var(--dm-ink); }
.app-body .dropzone.is-locked .dropzone-locked-copy span { color: inherit; }
.upload-files-note { margin: 16px 0 0; color: var(--dm-muted); font-size: 12px; line-height: 1.6; }
.app-body .case-identification { margin: 22px 0 0; padding: 0 0 19px; }
.app-body .case-identification-heading { display: none; }
.app-body .case-fields { max-width: none; }
.app-body .case-fields input { background: var(--dm-surface); }
.app-body .portal-options { margin-top: 17px; }
.app-body .portal-grid { grid-template-columns: 1fr; gap: 8px; }
.app-body .portal-choice { min-height: 57px; }
.config-delivery { display: flex; align-items: start; gap: 9px; margin-top: 17px; color: var(--dm-muted); font-size: 12px; line-height: 1.5; }
.config-delivery svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--dm-gold-dark); }
.config-delivery p { margin: 0; }
.upload-submit-row { grid-area: submit; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 30px; border-top: 1px solid var(--dm-line); }
.submission-readiness strong { font-size: 13px; font-weight: 600; }
.submission-readiness .submit-hint { margin: 3px 0 0; text-align: left; }
.app-body #upload-form #submit-button { width: auto; min-width: 206px; margin: 0; }
.app-body .side { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 24px; margin-top: 23px; padding: 18px 23px; background: var(--dm-surface-soft); }
.app-body .side > h2 { grid-column: 1; padding: 0; background: transparent; color: var(--dm-ink); font-size: 14px; font-weight: 600; }
.app-body .side .steps-intro { grid-column: 1; grid-row: 2; margin: 0; padding: 0; background: transparent; color: var(--dm-muted); }
.app-body .side .steps-mobile-toggle { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 9px; width: auto; min-height: 44px; margin: 0; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--dm-gold-dark); font-size: 12px; font-weight: 500; cursor: pointer; }
.app-body .side .steps-mobile-toggle svg { width: 16px; height: 16px; transition: transform 150ms var(--ease-out); }
.app-body .side .steps-mobile-toggle[aria-expanded=true] svg { transform: rotate(180deg); }
.app-body .side .steps { display: none; grid-column: 1 / -1; margin: 15px 0 0; padding: 18px 0 0; border-top: 1px solid var(--dm-line); }
.app-body .side.mobile-open .steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.app-body .side .steps li { display: flex; flex-direction: column; gap: 8px; padding: 0; }
.app-body .side .steps li:not(:last-child)::before { left: 34px; right: 0; top: 11px; bottom: auto; width: auto; height: 1px; }
.app-body .side .report-delivery { display: none; }

/* Process register: quick status, compound filters, one continuous ledger. */
.app-body .history-header { display: flex; flex-flow: row wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 23px; padding: 0; border: 0; }
.app-body .history-header p { margin-top: 8px; color: var(--dm-text); }
.app-body .history-header .retention-policy { margin-top: 5px; color: var(--dm-muted); font-size: 12px; }
.app-body .history-new { display: inline-flex; gap: 8px; align-items: center; justify-content: center; width: auto; min-height: 44px; padding: 0 15px; text-decoration: none; }
.app-body .history-office-scope { margin: 0 0 18px; background: var(--dm-surface-soft); }
.app-body .history-office-scope:has(#history-office-filter-label[hidden]) { display: none; }
.process-status-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; padding: 5px; border: 1px solid var(--dm-line); border-radius: 9px; background: var(--dm-surface-soft); }
.process-status-nav button { display: inline-flex; align-items: center; justify-content: space-between; gap: 11px; min-height: 43px; padding: 7px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--dm-text); font-size: 13px; font-weight: 500; cursor: pointer; }
.process-status-nav button span { color: var(--dm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.process-status-nav button:hover { background: var(--dm-bg); }
.process-status-nav button.selected { border-color: var(--dm-line-strong); background: var(--dm-surface); color: var(--dm-ink); }
.process-status-nav button.selected span { color: var(--dm-gold-dark); }
.app-body .history-filters { display: grid; grid-template-columns: minmax(200px, .9fr) minmax(0, 1.65fr); align-items: end; gap: 12px; margin: 0 0 12px; padding: 16px; border: 1px solid var(--dm-line); border-radius: 9px; background: var(--dm-surface); }
.app-body .history-filters label { min-width: 0; font-size: 12px; font-weight: 500; }
.app-body .history-filter-extras { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.search-input-wrap { position: relative; display: block; }
.search-input-wrap svg { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; transform: translateY(-50%); color: var(--dm-muted); pointer-events: none; }
.app-body .history-filters #history-search { width: 100%; padding-left: 35px; }
.app-body .history-filters input, .app-body .history-filters select { min-width: 0; background: var(--dm-surface); color: var(--dm-ink); font-size: 13px; font-weight: 400; }
.history-list-toolbar { display: flex; align-items: center; gap: 12px; min-height: 47px; padding: 0 1px 7px; color: var(--dm-text); font-size: 12px; }
#history-result-count { font-weight: 600; }
#history-clear-filters, .register-empty-action { min-height: 36px; padding: 3px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--dm-gold-dark); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.history-list-controls { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.history-sort-label { display: inline-flex; align-items: center; gap: 8px; }
.history-sort-label select { min-height: 37px; max-width: 180px; padding: 3px 7px; border: 1px solid var(--dm-line-strong); border-radius: 6px; background: var(--dm-surface); color: var(--dm-ink); font-size: 12px; }
#history-refresh { display: grid; flex: 0 0 37px; width: 37px; height: 37px; place-items: center; padding: 0; border: 1px solid var(--dm-line-strong); border-radius: 6px; background: var(--dm-surface); color: var(--dm-gold-dark); cursor: pointer; }
#history-refresh svg { width: 17px; height: 17px; }
#history-refresh:hover { background: var(--dm-gold-soft); }
#history-refresh:disabled { opacity: .65; cursor: wait; }
.process-register { --register-columns: minmax(0, 2fr) minmax(156px, .95fr) minmax(125px, .85fr) 100px 130px; border: 1px solid var(--dm-line); border-radius: 12px; background: var(--dm-surface); }
.history-columns, .app-body .history-item { display: grid; grid-template-columns: var(--register-columns); align-items: center; gap: 16px; padding: 14px 20px; }
.history-columns { border-bottom: 1px solid var(--dm-line); background: var(--dm-surface-soft); border-radius: 11px 11px 0 0; color: var(--dm-muted); font-size: 12px; font-weight: 500; }
.app-body .history-list { display: block; }
.app-body .history-item { min-height: 82px; border: 0; border-bottom: 1px solid var(--dm-line); border-radius: 0; background: transparent; }
.app-body .history-item:hover { background: var(--dm-surface-soft); }
.app-body .history-item:last-child { border-bottom: 0; border-radius: 0 0 11px 11px; }
.history-title-link { color: var(--dm-ink); text-decoration: none; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.history-title-link:hover { color: var(--dm-gold-dark); text-decoration: underline; }
.app-body .history-meta { gap: 4px 10px; line-height: 1.5; }
.app-body .history-meta > span { font-size: 11px; overflow-wrap: anywhere; }
.app-body .history-summary { display: grid; min-width: 0; gap: 6px; }
.app-body .history-item .history-status { display: inline-flex; gap: 7px; align-items: baseline; color: var(--dm-text); font-size: 12px; font-weight: 500; }
.app-body .history-status::before { width: 6px; height: 6px; flex: 0 0 6px; align-self: flex-start; margin-top: 7px; border-radius: 50%; background: currentColor; content: ''; }
.app-body .history-item .tone-active { color: var(--dm-gold-dark); }
.app-body .history-item .tone-done { color: var(--dm-success); }
.app-body .history-item .tone-warning { color: var(--dm-danger); }
.triagem-sinal, .diagnostico-veredito, .diagnostico-contagem-item {
  --triagem-texto: var(--dm-text);
  --triagem-fundo: var(--dm-surface-muted);
}
[data-triagem="verde"] { --triagem-texto: var(--dm-success); --triagem-fundo: var(--dm-success-soft); }
[data-triagem="vermelho"] { --triagem-texto: var(--dm-danger); --triagem-fundo: var(--dm-danger-soft); }
[data-triagem="atencao"] { --triagem-texto: var(--dm-gold-dark); --triagem-fundo: var(--dm-gold-soft); }
.triagem-sinal {
  display: inline-flex; align-items: center; gap: 6px;
  justify-self: start; width: fit-content; max-width: 100%; min-height: 24px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--triagem-fundo); color: var(--triagem-texto);
  font-size: 12px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere;
}
.triagem-sinal::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; content: ''; }
.app-body .history-item .triagem-sinal { color: var(--triagem-texto); }
.app-body .history-item .history-triagem-nota { color: var(--dm-muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.history-progress { width: min(100%, 98px); height: 4px; accent-color: var(--dm-gold-dark); }
.app-body .history-item .history-portal-tag { border: 1px solid var(--dm-line); border-radius: 4px; background: var(--dm-surface-soft); color: var(--dm-text); font-size: 11px; }
.history-date { color: var(--dm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.app-body .history-actions { justify-content: flex-start; gap: 6px; }
.app-body .history-open, .app-body .history-stop, .app-body .history-delete { display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; text-decoration: none; font-size: 12px; }
.app-body .history-open:hover, .app-body .history-stop:hover, .app-body .history-delete:hover { border-color: var(--dm-line-strong); background: var(--dm-surface-soft); }
.app-body .history-empty { min-height: 220px; padding: 35px 20px; border: 0; border-radius: 0 0 11px 11px; background: transparent; align-content: center; gap: 6px; }
.app-body .history-empty h2 { margin: 0; max-width: none; font-family: var(--brand-type); font-size: 24px; font-weight: 500; line-height: 1.2; }
.app-body .history-empty p { margin: 0; }
.app-body .process-detail-card { display: flex; flex-direction: column; max-width: 1040px; margin-inline: auto; }
.app-body .process-detail-card .process-detail-header { order: 0; }
.app-body .process-detail-card .error { order: 1; }
.app-body .process-detail-card .diagnostico-resultado { order: 1; }
.app-body .process-detail-card .result { order: 2; }
.app-body .process-detail-card .status-panel { order: 3; }
.app-body .process-detail-card .result h3 { font-family: var(--brand-type); font-size: 25px; font-weight: 500; }
.diagnostico-resultado {
  min-width: 0; margin: 16px 0 12px; padding: 20px;
  border: 1px solid var(--dm-line); border-radius: 12px;
  background: var(--dm-surface); color: var(--dm-ink);
}
.diagnostico-heading, .diagnostico-tese-heading {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px;
}
.diagnostico-heading { margin-bottom: 12px; }
.app-body .diagnostico-resultado .diagnostico-heading h2 {
  max-width: none; margin: 0; font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.4;
}
.diagnostico-veredito {
  padding: 16px 18px; border-radius: 8px; background: var(--triagem-fundo);
}
.app-body .diagnostico-resultado .diagnostico-conclusao {
  margin: 0; max-width: 48ch; color: var(--triagem-texto); font-family: var(--brand-type);
  font-size: clamp(23px, 2.3vw, 30px); font-weight: 500; line-height: 1.15; overflow-wrap: anywhere;
}
.diagnostico-mensagem { margin: 7px 0 0; max-width: 65ch; color: var(--dm-text); line-height: 1.5; }
.diagnostico-mensagem:empty { display: none; }
.diagnostico-contagem, .diagnostico-teses { margin: 0; padding: 0; list-style: none; }
.diagnostico-contagem {
  display: flex; flex-wrap: wrap; column-gap: 18px; row-gap: 5px;
  margin-top: 12px; padding-top: 9px; border-top: 1px solid color-mix(in srgb, var(--triagem-texto) 23%, transparent);
}
.diagnostico-contagem-item { color: var(--triagem-texto); font-size: 13px; font-variant-numeric: tabular-nums; }
.diagnostico-lista { margin-top: 20px; }
.app-body .diagnostico-resultado .diagnostico-lista h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.diagnostico-tese { padding: 12px 0; border-top: 1px solid var(--dm-line); }
.diagnostico-empresa { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.diagnostico-motivo, .diagnostico-observacao { margin: 6px 0 0; max-width: 68ch; line-height: 1.5; overflow-wrap: anywhere; }
.diagnostico-observacao { color: var(--dm-muted); }
.diagnostico-arquivos { margin-top: 14px; }
.diagnostico-arquivos:not(:has(a:not([hidden]))) { display: none; }
@media (max-width: 540px) {
  .diagnostico-resultado { padding: 14px; }
  .diagnostico-veredito { padding: 13px 14px; }
  .diagnostico-arquivos a { min-height: 44px; }
}
.result-summary { margin: 0 0 16px; border: 1px solid var(--dm-line-strong); border-radius: 9px; background: var(--dm-surface); color: var(--dm-ink); }
.result-summary h4 { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--dm-line); border-radius: 8px 8px 0 0; background: var(--dm-surface-muted); font-size: 14px; font-weight: 650; }
.result-summary-groups { display: flex; }
.result-summary-group { flex: 1 1 0; min-width: 0; padding: 14px 16px; }
.result-summary-base { flex-grow: .85; }
.result-summary-group + .result-summary-group { border-inline-start: 1px solid var(--dm-line); }
.result-summary-group h5 { margin: 0 0 6px; color: var(--dm-ink); font-size: 13px; font-weight: 650; }
.result-summary-group dl { margin: 0; }
.result-summary-group dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; }
.result-summary-group dl > div + div { border-top: 1px solid var(--dm-line); }
.result-summary-group dt { color: var(--dm-text); font-size: 13px; line-height: 1.35; }
.result-summary-group dd { margin: 0; color: var(--dm-ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-summary-group #metric-total { font-size: 22px; line-height: 1; }
.app-body .process-detail-card .status-panel { padding-top: 22px; border-top: 1px solid var(--dm-line); }
.app-body .status-actions:not(:has(button:not([hidden]))) { display: none; }
.app-body .process-detail-heading h1 { font-family: var(--brand-type); font-weight: 500; overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .app-body .shell { width: calc(100% - 40px); }
  .app-body .topbar, .app-body.cloud-mode .topbar, .app-body:not(.cloud-mode) .topbar { gap: 13px; grid-template-columns: minmax(0, 1fr) auto auto; }
  .app-body .topbar .brand-logo-header { width: 53px; height: 53px; }
  .app-body .topbar .identity .app-name { font-size: 26px; }
  .app-body .topbar .app-tab { padding-inline: 9px; }
  .upload-files-pane, .upload-config-pane { padding: 22px; }
  .app-body .side.mobile-open .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-body .side .steps li:nth-child(3)::before { display: none; }
  .app-body .history-filters { grid-template-columns: minmax(0, 1fr) auto; }
  .app-body .history-filter-toggle { display: block; min-height: 42px; padding: 0 13px; border: 1px solid var(--dm-line-strong); border-radius: 7px; background: var(--dm-surface-soft); color: var(--dm-ink); cursor: pointer; }
  .app-body .history-filters .history-filter-extras { display: none; grid-column: 1 / -1; }
  .app-body .history-filters.filters-open .history-filter-extras { display: grid; }
  .history-columns { display: none; }
  .app-body .history-item { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 9px 16px; }
  .app-body .history-item .history-main { grid-column: 1 / 3; }
  .app-body .history-item .history-date { grid-column: 3; grid-row: 1; text-align: right; }
  .app-body .history-item .history-actions { grid-column: 3; justify-content: flex-end; }
}
@media (max-width: 780px) {
  .result-summary-groups { flex-direction: column; }
  .result-summary-group { padding-block: 11px; }
  .result-summary-group + .result-summary-group { border-inline-start: 0; border-top: 1px solid var(--dm-line); }
}
@media (max-width: 720px) {
  .app-body .shell, .app-body.cloud-mode .shell { width: calc(100% - 32px); padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
  .app-body .topbar, .app-body.cloud-mode .topbar, .app-body:not(.cloud-mode) .topbar { grid-template-columns: minmax(0, 1fr) auto; min-height: 77px; padding: 10px 0; gap: 10px; }
  .app-body .topbar .identity { gap: 10px; }
  .app-body .topbar .brand-logo-header { width: 48px; height: 48px; }
  .app-body .topbar .identity .app-name { font-size: 25px; }
  .app-body .topbar .identity p { font-size: 11px; }
  .app-body .topbar .account-office strong { max-width: 24ch; }
  .app-body .topbar #mobile-account-toggle { min-height: 44px; gap: 5px; padding-inline: 8px; font-size: 11px; }
  .app-body:not(.cloud-mode) .topbar .privacy { gap: 6px; padding: 0; font-size: 11px; white-space: nowrap; }
  .local-mode-long { display: none; }
  .local-mode-short { display: inline; }
  .app-body .topbar .app-tabs, .app-body:not(.cloud-mode) .topbar .app-tabs { position: fixed; inset: auto 16px max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 5px; border: 1px solid var(--dm-line-strong); border-radius: 11px; background: var(--dm-surface); box-shadow: 0 5px 20px rgb(41 24 15 / 13%); }
  .app-body .topbar .app-tab, .app-body:not(.cloud-mode) .topbar .app-tab { justify-content: center; gap: 7px; min-height: 46px; padding: 6px; font-size: 13px; }
  .app-body .app-view, .app-body.cloud-mode #analysis-view, .app-body.cloud-mode #history-view { margin-top: 25px; }
  .analysis-page-heading { gap: 8px; margin-bottom: 20px; }
  .analysis-page-heading .page-secondary-link { display: none; }
  .app-body #upload-title, .app-body .history-header h1 { font-size: 35px; }
  .app-body #upload-form { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'files' 'config' 'submit'; padding: 0; }
  .upload-files-pane, .upload-config-pane { padding: 19px 16px; }
  .upload-config-pane { border-left: 0; border-top: 1px solid var(--dm-line); border-radius: 0; }
  .app-body .upload-section-heading h2, .app-body .config-title { font-size: 16px; }
  .app-body .dropzone { min-height: 184px; }
  .app-body .dropzone .file-picker-affordance { display: none; }
  .upload-submit-row { flex-direction: column; align-items: stretch; gap: 12px; padding: 15px 16px; }
  .app-body #upload-form #submit-button { width: 100%; }
  .app-body .side { grid-template-columns: minmax(0, 1fr); gap: 5px; margin-top: 17px; padding: 16px; }
  .app-body .side .steps-mobile-toggle { grid-column: 1; grid-row: 3; justify-self: start; padding: 0; }
  .app-body .side.mobile-open .steps { grid-template-columns: 1fr; margin-top: 6px; }
  .app-body .side .steps li { flex-direction: row; }
  .app-body .side .steps li::before { display: none; }
  .app-body .side .step-number { flex: 0 0 24px; }
  .app-body .history-header { gap: 10px; margin-bottom: 17px; }
  .process-status-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-status-nav button { min-height: 44px; gap: 6px; padding: 7px 8px; font-size: 11px; text-align: left; }
  .app-body .history-filters { padding: 12px; gap: 9px; }
  .app-body .history-filter-extras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-body .history-filters input, .app-body .history-filters select { min-height: 44px; font-size: 16px; }
  .history-list-toolbar { flex-wrap: wrap; gap: 7px; }
  .history-sort-label { gap: 5px; }
  .history-sort-label select { max-width: 137px; min-height: 44px; }
  #history-refresh { flex-basis: 44px; width: 44px; height: 44px; }
  .app-body .history-item { grid-template-columns: minmax(0, 1fr) auto; padding: 14px; gap: 10px; }
  .app-body .history-item .history-main { grid-column: 1 / -1; }
  .app-body .history-item .history-summary { grid-column: 1; }
  .app-body .history-item .history-portals { justify-content: flex-end; }
  .app-body .history-item .history-date { grid-column: 1; grid-row: auto; text-align: left; }
  .app-body .history-item .history-actions { grid-column: 2; display: flex; }
  .app-body .history-open, .app-body .history-stop, .app-body .history-delete { width: auto; min-height: 44px; padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-body.cloud-mode .topbar #top-actions.mobile-open { animation: none; }
}
