:root {
  --spa-primary: #bf2424;
  --spa-primary-dark: #9c1d1d;
  --spa-secondary: #df7700;
  --spa-info: #1e79cf;
  --spa-info-dark: #17629f;
  --spa-bg: #f4f5f7;
  --spa-text: #24272b;
  --spa-muted: #6b7280;
  --spa-border: #e4e6ea;
  --spa-surface: #ffffff;
  --spa-writer: #6d4bd6;
  --spa-writer-bg: #f1ecfc;
  --spa-publisher: #c26a00;
  --spa-publisher-bg: #fdf1e2;
  --radius: 10px;
  --content-max-width: 1500px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--spa-text);
  background: var(--spa-bg);
  line-height: 1.45;
}

.page {
  /* Direct flex child of body (column direction): flex-basis auto sizes
     this on the main (vertical) axis for the sticky-footer effect, but
     because .page also has `margin: 0 auto` for centering, those auto
     side-margins suppress the default cross-axis stretch — without an
     explicit width the box shrinks to fit its content instead of filling
     up to max-width. width:100% makes that unambiguous. */
  flex: 1 0 auto;
  width: 100%;
}

/* Any element marked hidden must always be hidden, regardless of what
   display value its class would otherwise set (e.g. .state-card{display:flex}
   would win over the UA default [hidden]{display:none} at equal specificity
   without this). */
[hidden] {
  display: none !important;
}

.navbar {
  background: linear-gradient(135deg, var(--spa-primary) 0%, var(--spa-primary-dark) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.navbar__logo {
  height: 40px;
}

.page {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.hero {
  position: relative;
  background:
    radial-gradient(circle at 12% 30%, rgba(191, 36, 36, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 88% 70%, rgba(223, 119, 0, 0.06) 0%, transparent 45%),
    var(--spa-bg);
  border-bottom: 1px solid var(--spa-border);
}

.hero__inner {
  position: relative;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2.75rem 1.5rem;
  text-align: center;
}

.hero__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--spa-primary);
  color: #fff;
  margin-bottom: 1.25rem;
  animation: hero-icon-glow 2.4s ease-in-out infinite;
}

@keyframes hero-icon-glow {
  0%, 100% {
    box-shadow:
      0 4px 12px rgba(191, 36, 36, 0.35),
      0 0 10px 2px rgba(191, 36, 36, 0.35),
      0 0 0 0 rgba(191, 36, 36, 0.45);
  }
  50% {
    box-shadow:
      0 4px 22px rgba(191, 36, 36, 0.6),
      0 0 28px 10px rgba(191, 36, 36, 0.55),
      0 0 0 18px rgba(191, 36, 36, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__icon {
    animation: none;
    box-shadow: 0 4px 12px rgba(191, 36, 36, 0.3);
  }

  .hero__icon svg {
    animation: none;
  }
}

.hero__icon svg {
  width: 28px;
  height: 28px;
  animation: note-bounce 1.8s ease-in-out infinite;
  transform-origin: 70% 85%;
}

@keyframes note-bounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-3px) rotate(-8deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(-1px) rotate(5deg);
  }
}

.hero__title {
  margin: 0;
  color: var(--spa-text);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.hero__title-accent {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--spa-primary);
  margin-top: 0.15rem;
}

.hero__subtitle {
  max-width: 620px;
  margin: 1rem auto 0;
  color: var(--spa-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.search-card,
.results-card,
.state-card {
  background: var(--spa-surface);
  border: 1px solid var(--spa-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.06);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  margin-bottom: 1.75rem;
}

.field-section {
  border: none;
  margin: 0 0 0.5rem;
  padding: 0;
}

.field-section + .field-section {
  margin-top: 0.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--spa-border);
}

.field-section__title {
  padding: 0;
  margin-bottom: 1.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--spa-info);
}

.field-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.4rem;
}

.field-group--narrow {
  max-width: 240px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.field-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
  color: var(--spa-text);
}

.field-with-select {
  display: flex;
  gap: 0.6rem;
}

.field-with-select input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.match-mode-select {
  flex: 0 0 auto;
  padding: 0.65rem 0.6rem;
  border: 1px solid var(--spa-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--spa-surface);
  color: var(--spa-text);
  cursor: pointer;
}

.match-mode-select:focus {
  outline: none;
  border-color: var(--spa-info);
  box-shadow: 0 0 0 3px rgba(30, 121, 207, 0.15);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--spa-muted);
  cursor: pointer;
  width: fit-content;
}

.checkbox-field input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--spa-info);
  cursor: pointer;
}

input[type="text"] {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--spa-border);
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
  background: var(--spa-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]::placeholder {
  color: #a8adb5;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--spa-info);
  box-shadow: 0 0 0 3px rgba(30, 121, 207, 0.15);
}

.warning {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--spa-primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin: -0.5rem 0 1rem;
  background: #fbeaea;
  border: 1px solid #f1c6c6;
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
}

.warning .icon {
  flex-shrink: 0;
  color: var(--spa-primary);
}

.notice {
  color: var(--spa-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0 0 1.25rem;
  background: #fff6ea;
  border: 1px solid #f4dfb8;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
}

.notice--info {
  color: var(--spa-info-dark);
  background: #eaf3fc;
  border-color: #c6e0f5;
}

.notice--error {
  color: var(--spa-primary);
  background: #fbeaea;
  border-color: #f1c6c6;
}

.search-card__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 6px;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn--primary {
  background: var(--spa-info);
  box-shadow: 0 2px 6px rgba(30, 121, 207, 0.35);
}

.btn--primary:hover {
  filter: brightness(0.94);
}

.btn--primary:active {
  transform: translateY(1px);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn--ghost {
  background: var(--spa-surface);
  color: var(--spa-text);
  border: 1px solid var(--spa-border);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--spa-bg);
  border-color: #c9ccd2;
}

.btn--ghost:disabled {
  opacity: 0.55;
  cursor: default;
}

/* "Limpar" — a modifier on top of .btn--ghost (keeps its sizing, including
   the mobile touch-target override) with its own colour, so it reads as a
   distinct "reset" action instead of looking like the CSV/PDF export
   buttons that share the ghost style. */
.btn--clear {
  color: var(--spa-primary);
  border-color: rgba(191, 36, 36, 0.35);
  background: #fdf3f3;
}

.btn--clear:hover:not(:disabled) {
  background: #fbe4e4;
  border-color: var(--spa-primary);
}

.icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.icon--large {
  width: 3.5rem;
  height: 3.5rem;
  color: #c3c8d1;
}

.results-card__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.export-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-group__label {
  font-size: 0.8rem;
  color: var(--spa-muted);
  font-weight: 600;
}

.badge {
  display: inline-block;
  background: var(--spa-primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pagination--bottom {
  padding-top: 1.25rem;
}

.page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--spa-muted);
  cursor: pointer;
  white-space: nowrap;
}

.pagination select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--spa-border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--spa-surface);
  cursor: pointer;
}

.pagination button {
  border: 1px solid var(--spa-border);
  background: var(--spa-surface);
  border-radius: 6px;
  min-width: 2rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pagination button:not(:disabled):hover {
  background: var(--spa-bg);
  border-color: #c9ccd2;
}

.pagination__label {
  font-size: 0.85rem;
  color: var(--spa-muted);
  padding: 0 0.4rem;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--spa-border);
  border-radius: 8px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--spa-muted);
  background: #fafafb;
  border-bottom: 1px solid var(--spa-border);
  padding: 0.75rem 0.9rem;
}

.results-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--spa-border);
  font-size: 0.92rem;
  vertical-align: middle;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr.row-alt {
  background: var(--spa-bg);
}

.results-table tbody tr:not(.detail-row):hover {
  background: #f0f6fc;
}

.row-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--spa-info);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.row-toggle:hover {
  background: rgba(30, 121, 207, 0.08);
}

.row-toggle .icon {
  transition: transform 0.15s ease;
}

.row-toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.field-with-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--spa-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  line-height: 0;
}

.copy-btn:hover {
  background: rgba(30, 121, 207, 0.08);
  color: var(--spa-info);
}

.copy-btn .icon {
  width: 15px;
  height: 15px;
}

.copy-btn--copied {
  color: #1e9e5c;
}

.copy-btn--copied:hover {
  background: rgba(30, 158, 92, 0.1);
  color: #1e9e5c;
}

.detail-row td {
  background: linear-gradient(180deg, #f6f8fb 0%, #fafbfc 100%);
  padding: 0;
  border-bottom: 1px solid var(--spa-border);
}

.detail {
  padding: 1.5rem;
}

.detail__loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--spa-muted);
  font-size: 0.88rem;
}

.detail__content {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.detail__card {
  flex: 1 1 260px;
  background: var(--spa-surface);
  border: 1px solid var(--spa-border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem 1.3rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.detail__card--wide {
  flex: 1 1 100%;
}

.detail__heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--spa-text);
  margin: 0 0 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--spa-border);
}

.detail__heading .icon {
  width: 1rem;
  height: 1rem;
  color: var(--spa-info);
}

.detail__count {
  margin-left: auto;
  background: var(--spa-bg);
  color: var(--spa-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.detail-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--spa-muted);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--spa-border);
}

.detail-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--spa-border);
}

.detail-table tbody tr:last-child td {
  border-bottom: none;
}

/* The label half of buildDetailField()'s label+value pair (app.js) — the
   desktop table has its own <thead> naming each column already, so this
   stays hidden there and only switches on inside the mobile media query
   below, where the table collapses to stacked cards with no header row. */
.detail-field__label {
  display: none;
}

.detail-field__value {
  display: block;
}

.detail-table tbody tr:hover {
  background: var(--spa-bg);
}

.role-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.role-badge--writer {
  color: var(--spa-writer);
  background: var(--spa-writer-bg);
}

.role-badge--publisher {
  color: var(--spa-publisher);
  background: var(--spa-publisher-bg);
}

.detail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.detail__list li {
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--spa-border);
}

.detail__list li:last-child {
  border-bottom: none;
}

.detail__empty {
  color: var(--spa-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--spa-muted);
  gap: 0.85rem;
  padding: 3rem 2rem;
}

.state-card--error {
  color: var(--spa-primary);
  background: #fbeaea;
  border-color: #f1c6c6;
}

.state-card--error .icon--large {
  color: var(--spa-primary);
}

.state-card--error p {
  font-weight: 600;
  font-size: 1rem;
}

.spinner {
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--spa-border);
  border-top-color: var(--spa-info);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 1.1rem;
  height: 1.1rem;
  border-width: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.site-footer {
  flex-shrink: 0;
  margin-top: 3rem;
  background: linear-gradient(135deg, var(--spa-primary) 0%, var(--spa-primary-dark) 100%);
  color: rgba(255, 255, 255, 0.92);
}

.site-footer__inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.site-footer__logo img {
  width: 150px;
  height: auto;
  display: block;
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

.site-footer__title {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.site-footer__col a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.88rem;
}

.site-footer__col a:hover {
  text-decoration: underline;
}

@media (min-width: 768px) {
  .site-footer__inner {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
  }

  .site-footer__col {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1.5rem 1rem 3rem;
  }

  .hero__inner {
    padding: 2rem 1.25rem;
  }

  .hero__title {
    font-size: 1.5rem;
  }

  .hero__title-accent {
    font-size: 1.1rem;
  }

  .site-footer__inner {
    padding: 2rem 1.25rem;
    gap: 1.75rem;
  }

  .site-footer__logo img {
    width: 120px;
  }

  .hero__subtitle {
    font-size: 0.88rem;
  }

  .toolbar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .export-group {
    justify-content: center;
  }

  .search-card,
  .results-card,
  .state-card {
    padding: 1.25rem;
  }

  .search-card__actions {
    justify-content: center;
  }

  .detail__heading {
    justify-content: center;
  }

  .detail__count {
    margin-left: 0.5rem;
  }

  .detail-table thead {
    display: none;
  }

  .detail-table,
  .detail-table tbody {
    display: block;
    width: 100%;
  }

  /* flex-direction:column rather than display:block — table elements
     (tr/td) don't reliably drop their internal table-layout algorithm from
     a plain display:block override in every mobile browser engine, which
     is exactly why Nome/IP-Name/IP-Base/Função kept rendering side by side
     instead of stacking despite that override being in place. flex is a
     completely separate layout mode with no such legacy table behaviour to
     fight, so it stacks reliably everywhere. */
  .detail-table tr {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-bottom: 1px solid var(--spa-border);
    padding: 0.6rem 0;
  }

  .detail-table tr:last-child {
    border-bottom: none;
  }

  .detail-table td {
    display: block;
    width: 100%;
    border: none;
    padding: 0.2rem 0;
    text-align: center;
  }

  .detail-field__label {
    display: block;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--spa-muted);
    margin-bottom: 0.15rem;
  }

  .detail__list {
    text-align: center;
  }

  /* 16px prevents iOS Safari from auto-zooming the page on input focus */
  input[type="text"] {
    font-size: 16px;
  }

  .field-with-select {
    flex-direction: column;
  }

  .match-mode-select {
    width: 100%;
  }

  .results-card__toolbar {
    justify-content: center;
    text-align: center;
  }

  .pagination {
    justify-content: center;
    width: 100%;
    gap: 0.5rem;
  }

  /* The page-size control (label + select) and the «‹ page X of Y ›»
     cluster are different kinds of thing fighting for the same line —
     letting them wrap freely among all 6 items mixed together could leave
     a single button stranded alone on its own line. flex-basis:100% forces
     the page-size control onto its own row every time (it's first in DOM
     order), so the nav cluster afterwards always wraps as its own group
     instead of splitting unpredictably alongside it. */
  .page-size-label {
    flex-basis: 100%;
    justify-content: center;
  }

  /* ~44px minimum touch target (Apple HIG / Material guidance) — the
     desktop sizing (min-height 2.25rem ≈ 36px, min-width 2rem ≈ 32px) is
     fine for a mouse pointer but noticeably too small to tap precisely. */
  .pagination button,
  .pagination select {
    min-height: 2.75rem;
  }

  .pagination button {
    min-width: 2.75rem;
  }

  /* Tighter than the desktop 0 0.4rem — large page counts ("Página 1 de
     59345") plus four 44px buttons is already a tight fit on a narrow
     screen; this buys back a bit of margin so the nav cluster stays on one
     line more often instead of wrapping mid-group. */
  .pagination__label {
    padding: 0 0.15rem;
    font-size: 0.8rem;
  }

  .row-toggle {
    padding: 0.65rem 0.5rem;
    min-height: 2.75rem;
  }

  .btn--ghost {
    padding: 0.65rem 1rem;
    min-height: 2.75rem;
  }

  .copy-btn {
    padding: 0.55rem;
  }

  .detail {
    padding: 1rem;
  }

  /* More breathing room between the Titulares / Títulos Alternativos /
     Intérpretes cards once they're stacked in a single column, and between
     each record inside them — the desktop spacing (built for a wide
     multi-column table) reads as cramped stacked vertically on a phone. */
  .detail__content {
    gap: 1.5rem;
  }

  /* flex: 1 1 260px (desktop) lets flex-shrink squeeze two of these cards
     onto the same line on a narrow phone instead of wrapping — each ends
     up cramped rather than reliably stacking one per row. Forcing the full
     width here is what actually guarantees the vertical stack the comment
     above already assumed. */
  .detail__card {
    flex: 1 1 100%;
    padding: 1rem 1.1rem 1.25rem;
  }

  .detail-table tr {
    padding: 0.85rem 0;
  }

  .detail-table td {
    padding: 0.4rem 0;
  }

  .detail-field__label {
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
  }

  .detail__list li {
    padding: 0.55rem 0;
    font-size: 0.92rem;
  }

  .field-section + .field-section {
    padding-top: 1.25rem;
  }

  .results-table thead {
    display: none;
  }

  .table-wrap {
    border: none;
  }

  .results-table,
  .results-table tbody {
    display: block;
    width: 100%;
  }

  /* Each result becomes its own card — a dedicated grid places the title
     prominently across the top, ISWC and Código de Obra side by side
     below it, and "Ver Detalhe" as a full-width action along the bottom —
     rather than a bare table row distinguished only by a bottom border.
     Cell *order* in the markup is untouched (still title/ISWC/code, for
     the desktop table); grid-area placement below is what controls the
     visual arrangement here, independent of DOM order. */
  .results-table tr:not(.detail-row) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title title"
      "iswc code"
      "toggle toggle";
    gap: 0.6rem 0.75rem;
    background: var(--spa-surface);
    border: 1px solid var(--spa-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  }

  .results-table tr:not(.detail-row):last-child {
    margin-bottom: 0;
  }

  /* Zebra striping doesn't add anything once every result is already its
     own bordered, shadowed card with its own spacing — cancel it here
     rather than fight the two patterns against each other. */
  .results-table tr.row-alt {
    background: var(--spa-surface);
  }

  /* "Ver Detalhe" open: the detail panel used to render as a separate,
     unstyled element floating below the card instead of reading as part of
     it. Flattening the shared edge (no bottom radius/border/margin on the
     card, no top border/radius on the detail panel right after it) makes
     the two read as one continuous card instead of two stacked boxes. */
  .results-table tr:not(.detail-row):has(+ .detail-row) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    margin-bottom: 0;
  }

  .results-table tr.detail-row {
    display: block;
    background: var(--spa-surface);
    border: 1px solid var(--spa-border);
    border-top: none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  }

  .results-table tr.detail-row:last-child {
    margin-bottom: 0;
  }

  .results-table tr.detail-row td {
    display: block;
    width: 100%;
    border: none;
    padding: 0;
  }

  .results-table td {
    display: block;
    width: 100%;
    border: none;
    padding: 0;
  }

  .results-table td:nth-child(1) {
    grid-area: toggle;
    padding-top: 0.6rem;
    border-top: 1px solid var(--spa-border);
  }

  .results-table td:nth-child(1) .row-toggle {
    width: 100%;
    justify-content: center;
  }

  .results-table td:nth-child(2) {
    grid-area: title;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--spa-text);
  }

  .results-table td:nth-child(3) {
    grid-area: iswc;
  }

  .results-table td:nth-child(4) {
    grid-area: code;
  }

  .results-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: var(--spa-muted);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
  }

  /* No label on the toggle action or the title itself — a prefixed
     "TÍTULO" would undercut the title reading as the card's own heading. */
  .results-table td:nth-child(1)::before,
  .results-table td:nth-child(2)::before {
    content: none;
  }
}
