/* Shared catalog tables and controls for laws and regulations. */
body:is([data-page-kind="home"], [data-page-kind="reglamentos"]) :is(#mley-home-laws, #mley-home-regulations) {
  margin-top: 1.25rem;
  border: 1px solid var(--result-border);
  border-radius: 24px;
  background: var(--bg-surface);
  box-shadow: 0 4px 16px rgba(22, 56, 62, .04);
}

:is(#mley-home-laws, #mley-home-regulations) > .card-body { padding: clamp(1.25rem, 3vw, 2.25rem); }
body:is([data-page-kind="home"], [data-page-kind="reglamentos"]) :is(#mley-home-laws, #mley-home-regulations):focus-visible { outline: 2px solid var(--result-accent); outline-offset: 3px; }
body:is([data-page-kind="home"], [data-page-kind="reglamentos"]) :is(#mley-home-catalog-heading, #mley-home-regulations-heading) { margin: 0 0 1.25rem; font-size: 1.45rem; }

:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-toolbar { gap: 1rem; margin-bottom: 1.25rem; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-title { color: var(--result-ink); font: 600 .85rem/1.5 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-summary { margin-top: .35rem; color: var(--result-muted); font-size: .8rem; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell { min-height: 50px; border-color: var(--result-border); border-radius: 12px; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell i { color: var(--result-muted); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell .form-control { color: var(--result-ink); font: .95rem/1.5 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell .form-control::placeholder { color: var(--result-muted); opacity: 1; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell:focus-within { outline-color: var(--result-accent); }

:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-form .btn,
:is(#mley-home-laws, #mley-home-regulations) .mley-home-pagination .page-link {
  min-height: 44px;
  padding: .6rem .9rem;
  border: 1px solid var(--result-border) !important;
  border-radius: 10px !important;
  background: var(--bg-surface) !important;
  color: var(--result-accent) !important;
  font: 600 .8rem/1.5 var(--result-font);
  box-shadow: none;
}
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-form button[type="submit"],
:is(#mley-home-laws, #mley-home-regulations) .mley-home-pagination .active .page-link {
  border-color: var(--result-accent) !important;
  background: var(--result-accent) !important;
  color: var(--bg-surface) !important;
}
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-form button[type="submit"] { min-height: 50px; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-pagination .disabled .page-link { color: var(--result-muted) !important; opacity: .6; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-pagination-summary { color: var(--result-muted); font: .8rem/1.6 var(--result-font); }

:is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) thead th { padding-bottom: .8rem; color: var(--result-muted); font: 600 .65rem/1.6 var(--result-font); letter-spacing: .07em; }
:is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) tbody td { padding-block: 1rem; border-color: var(--result-border); color: var(--result-ink); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-link { line-height: 1.55; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-title { font: 600 .95rem/1.55 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-link:hover { color: var(--result-accent); text-decoration: underline; text-underline-offset: .2em; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-key { color: var(--result-muted); font: 500 .73rem/1.6 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-metadata { margin-top: .4rem; color: var(--result-muted); font: .75rem/1.6 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) :is(.mley-home-law-rank-chip, .mley-home-law-views-pill) { color: var(--result-muted); font: .75rem/1.6 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-regulation-tag { border: 1px solid var(--result-border); border-radius: 8px; background: var(--result-tint); color: var(--result-accent); font: 500 .75rem/1.5 var(--result-font); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-action { width: 40px; height: 44px; border: 1px solid var(--result-border); border-radius: 10px !important; background: var(--bg-surface); color: var(--result-accent); box-shadow: none; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-action:hover { background: var(--result-tint); border-color: var(--result-accent); }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-graph-action { width: auto; flex-shrink: 0; gap: .5rem; padding: .6rem .75rem !important; background: var(--result-tint); color: var(--result-accent); font: 600 .78rem/1.4 var(--result-font); white-space: nowrap; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-law-graph-action:focus-visible { outline: 2px solid var(--result-accent); outline-offset: 3px; }
:is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-empty { border-color: var(--result-border); background: var(--result-tint); color: var(--result-muted); }
:is(#mley-home-laws, #mley-home-regulations) .mley-inline-brand { color: var(--result-muted) !important; }

.mley-catalog-toggle { display: none; }

@media (max-width: 767.98px) {
  body[data-page-kind] :is(#mley-home-laws, #mley-home-regulations) { border-radius: 16px; }
  :is(#mley-home-laws, #mley-home-regulations) > .card-body { padding: 1rem .75rem; }
  body[data-page-kind] :is(#mley-home-catalog-heading, #mley-home-regulations-heading) { margin-bottom: .75rem; font-size: 1.2rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-toolbar { align-items: stretch; gap: .65rem; margin-bottom: .75rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-form { display: flex; flex-wrap: wrap; width: 100%; gap: .4rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell { flex: 1 1 8rem; min-height: 44px; padding-inline: .6rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-input-shell .form-control { font-size: 1rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-catalog-form .btn { flex: 0 0 auto; min-height: 44px; }

  /* A continuous watchlist; disclosure uses the existing metadata and actions. */
  :is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) tbody tr {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "views" "actions";
    margin: 0;
    padding: .65rem .25rem;
    gap: .25rem .5rem;
    border: 0;
    border-bottom: 1px solid var(--result-border);
    border-radius: 0;
    background: var(--bg-surface);
    box-shadow: none;
  }
  :is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) tbody td { padding: 0; border: 0; border-radius: 0; min-width: 0; }
  :is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) .mley-home-regulation-parent { grid-area: views; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-law-actions-group { justify-content: flex-start; flex-wrap: wrap; }
  :is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table).mley-catalog-enhanced tbody tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 5rem) 44px;
    grid-template-areas: "name views toggle" "metadata metadata metadata" "actions actions actions";
    align-items: center;
    gap: 0 .4rem;
    min-height: 84px;
  }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced :is(.mley-home-law-name, .mley-home-law-actions) { display: contents; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-link { grid-area: name; display: flex; flex-direction: column; justify-content: center; gap: .2rem; min-width: 0; min-height: 56px; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-key { order: -1; margin: 0; color: var(--result-ink); font: 700 .9rem/1.3 var(--result-font); overflow-wrap: anywhere; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--result-muted); font: 400 .78rem/1.4 var(--result-font); }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-row--open .mley-home-law-title { display: block; overflow: visible; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-metadata { grid-area: metadata; padding-top: .55rem; margin: 0; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-actions-group { grid-area: actions; justify-content: flex-start; flex-wrap: wrap; gap: .4rem; padding-top: .55rem; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced tr:not(.mley-catalog-row--open) :is(.mley-home-law-metadata, .mley-home-law-actions-group) { display: none; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-views { justify-self: stretch; width: auto; text-align: right; white-space: normal; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-views-pill { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; color: var(--result-ink); font: 600 .85rem/1.4 var(--result-font); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-views-label { color: var(--result-muted); font-size: .65rem; font-weight: 400; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-regulation-parent { width: auto; justify-self: end; text-align: right; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-regulation-parent .mley-home-law-regulation-tag { display: inline-flex; align-items: center; justify-content: flex-end; min-height: 44px; padding: .25rem 0; border: 0; background: transparent; white-space: normal; overflow-wrap: anywhere; font-size: .73rem; text-align: right; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-regulation-parent .mley-home-law-regulation-tag i { display: none; }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-catalog-toggle { grid-area: toggle; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--result-muted); cursor: pointer; }
  .mley-catalog-toggle__chevron { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); }
  .mley-catalog-toggle[aria-expanded="true"] .mley-catalog-toggle__chevron { transform: rotate(225deg) translate(-1px, -1px); }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-toggle[aria-expanded="true"] { background: var(--result-tint); color: var(--result-accent); }
  :is(#mley-home-laws, #mley-home-regulations) :is(#mley-home-laws-table, #mley-home-regulations-table) .mley-catalog-row--open { background: var(--result-tint); }
  :is(#mley-home-laws, #mley-home-regulations) .mley-home-law-action:not(.mley-home-law-graph-action) { width: 44px; }
  :is(#mley-home-laws, #mley-home-regulations) :is(a, button):focus-visible { outline: 2px solid var(--result-accent); outline-offset: 2px; }
}

@media (max-width: 767.98px) and (hover: hover) {
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-toggle:hover { background: var(--result-tint); color: var(--result-accent); }
  :is(#mley-home-laws, #mley-home-regulations) .mley-catalog-enhanced .mley-home-law-link:hover :is(.mley-home-law-key, .mley-home-law-title) { color: var(--result-accent); }
}
