.matcher { width: 100%; }
.matcher .matcher-content.page-width { width: 100%; max-width: var(--page-width); padding: 8px var(--space-7) var(--space-9); display: flex; flex-direction: column; gap: var(--space-5); }
.matcher-back { margin-left: -14px; }
.matcher-heading { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-5); }
.matcher .matcher-tool-icon { width: 64px; height: 64px; border-radius: 20px; }
.matcher-tool-icon .icon { width: 32px; height: 32px; }
.matcher-heading-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.matcher-heading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.matcher-heading .lead { max-width: 64ch; }
.matcher-privacy { background: var(--panel); }
.matcher-steps .step { padding-block: 8px; }
.matcher-steps-compact { align-items: center; gap: 10px; flex-wrap: wrap; }
.matcher-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-5); min-width: 0; }
.matcher-workspace { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.matcher-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.matcher .panel { padding: var(--space-7); }
.matcher .panel-tight { padding: var(--space-5); }
.matcher-empty, .matcher-rules, .matcher-results { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.matcher-section-copy { display: flex; flex-direction: column; gap: 6px; }
.matcher-section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; }
.matcher-section-heading > div { display: flex; flex-direction: column; gap: 6px; }
.matcher-file-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.matcher-sources { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.matcher-file-card.file-card { align-items: flex-start; flex-wrap: wrap; background: var(--panel); }
.matcher-file-card.file-slot { min-width: 0; }
.matcher-file-card > .list-row-body { gap: 6px; }
.matcher-file-card .status { align-self: flex-start; }
.matcher-file-name { overflow-wrap: anywhere; font-weight: 600; }
.matcher-file-card.is-invalid { box-shadow: inset 0 0 0 2px var(--danger-line); }
.matcher-file-card .button { max-width: 100%; white-space: normal; text-align: center; line-height: 1.35; padding-block: 8px; }
.matcher-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.matcher-or > span { flex: 1; border-top: 1px solid var(--line); }
.matcher-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.matcher-result-types { background: var(--canvas); border-radius: var(--radius-inner); }
.matcher-result-types .list-row { min-height: 56px; flex-wrap: wrap; padding: 12px 16px; gap: 8px 12px; }
.matcher-preview { background: var(--panel); border-radius: var(--radius-inner); padding: 0 16px; min-width: 0; }
.matcher-preview summary { min-height: 48px; padding-block: 12px; cursor: pointer; font-size: 14px; font-weight: 650; }
.matcher-preview summary > span { color: var(--muted); font-weight: 400; margin-left: 8px; }
.matcher-preview summary:focus-visible { outline-offset: -3px; }
.matcher .matcher-table-scroll { max-width: 100%; margin-bottom: 12px; border-radius: var(--radius-control); }
.matcher-table { min-width: 560px; font-size: 14px; }
.matcher-table th, .matcher-table td { vertical-align: top; }
.matcher-table .source { white-space: nowrap; }
.matcher-original { white-space: pre-wrap; min-width: 85px; overflow-wrap: anywhere; }
.matcher-table-note, .matcher-results-copy { font-size: 14px; line-height: 1.5; color: var(--muted); }
.matcher-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.matcher-normalization { border: 0; margin: 0; padding: 0; min-width: 0; }
.matcher-normalization legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.matcher-normalization .list-group { background: var(--canvas); border-radius: var(--radius-inner); }
.matcher-normalization .list-row { cursor: pointer; }
.matcher-normalization:disabled .list-row { cursor: default; }
.matcher-normalization:disabled .list-row-body { opacity: .65; }
.matcher-error ul { margin: 8px 0 12px; padding-left: 20px; }
.matcher-error li + li { margin-top: 4px; }
.matcher-error .button { white-space: normal; text-align: center; padding-block: 10px; line-height: 1.35; }
.matcher-progress { display: flex; flex-direction: column; gap: 8px; }
.matcher-presets-host { display: flex; flex-direction: column; gap: 12px; }
.matcher-presets-host > .button { align-self: flex-start; white-space: normal; text-align: center; padding-block: 10px; line-height: 1.35; }
.matcher-presets-host .matcher-section-heading { align-items: center; }
.matcher-saved-list { background: var(--canvas); border-radius: var(--radius-inner); }
.matcher-saved-list .list-row { padding: 12px 14px; gap: 6px; }
.matcher-saved-list .list-row-title, .matcher-saved-list .list-row-sub { overflow-wrap: anywhere; }
.matcher-preset-message { color: var(--success-fg); overflow-wrap: anywhere; }
.matcher-preset-message:empty { display: none; }
.matcher-help a { color: inherit; text-decoration: none; }
.matcher-help .tool-icon { width: 40px; height: 40px; border-radius: 12px; }
.matcher-help .tool-icon .icon { width: 20px; height: 20px; }
.matcher-help > a > .icon { color: var(--muted); }
.matcher-help a:focus-visible { outline-offset: -3px; }
.matcher-side > .ad-slot { align-self: center; width: 300px; }
.matcher-side .ad-placement { margin: 0; }
.matcher-filter-area { display: flex; flex-direction: column; gap: 6px; }
.matcher-filters { align-self: flex-start; flex-wrap: wrap; max-width: 100%; }
.matcher-filters button { display: flex; justify-content: center; align-items: center; gap: 8px; white-space: normal; }
.matcher-result-content { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.matcher-result-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.matcher-group-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.matcher-group-heading h3 { font-size: 16px; font-weight: 700; min-width: 0; }
.matcher-group-heading h3 > span { color: var(--muted); overflow-wrap: anywhere; }
.matcher-result-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 24px 12px; }
.matcher-result-empty > .icon { color: var(--teal); }
.matcher-result-empty h3 { font-size: 19px; }
.matcher-result-empty p { color: var(--muted); font-size: 14px; }
.matcher-export { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; border-top: 1px solid var(--line); padding-top: 20px; }
.matcher-export > div { display: flex; flex-direction: column; gap: 4px; }
/* Keep the floating action in normal flow so the last task content stays reachable. */
.matcher-dock-host { position: sticky; bottom: 16px; z-index: 30; min-width: 0; }
.matcher .matcher-task-dock { position: relative; bottom: auto; width: min(560px, 100%); }
.matcher-dock-host:empty { display: none; }
.matcher :focus-visible, .matcher #matcher-results-title { scroll-margin-block: 24px 140px; }

@container page (max-width: 760px) {
  .matcher .matcher-content.page-width { padding-inline: var(--space-4); }
  .matcher .panel { padding: var(--space-5); }
  .matcher-heading { gap: 14px; }
  .matcher .matcher-tool-icon { width: 56px; height: 56px; border-radius: 18px; }
  .matcher-heading-copy { flex-basis: 240px; }
  .matcher-actions { align-items: stretch; }
  .matcher-actions > .button, .matcher-export > .button { width: 100%; }
  .matcher-actions > .small { text-align: center; }
  .matcher-filters { width: 100%; }
  .matcher-filters button { flex: 1 1 auto; font-size: 14px; padding-inline: 12px; }
  .matcher-dock-host { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .matcher .matcher-task-dock { gap: 10px; padding: 12px 10px 16px; }
  .matcher-task-dock .task-dock-icon { width: 36px; height: 36px; }
  .matcher-task-dock .task-dock-title { font-size: 14px; }
  .matcher-task-dock .button { padding-inline: 12px; }
  .matcher :focus-visible, .matcher #matcher-results-title { scroll-margin-bottom: 200px; }
}
