/* Regulators and PV bodies: filter row and the read-only agency profile drawer. UI scale tokens (ui-scale.css). */
/* Page header, region tabs, toolbar */
body.ui-scale .page > .intro { margin: 4px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 20px; color: var(--muted); }
.agency-tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.agency-tabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; }
.agency-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.agency-tabs button:hover { color: var(--ink, #17212b); }
.agency-count { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg, #f6f7f8); color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 600; }
.agency-tabs [aria-selected="true"] .agency-count { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.agency-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.agency-search { position: relative; width: min(100%, 320px); }
.agency-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#agency-filter #agency-filter-input {
  background-image: none; box-sizing: border-box; width: 100%; height: 32px; min-height: 32px; margin: 0; padding: 4px 10px 4px 32px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: inherit; font: inherit; font-size: 14px; line-height: 20px; }
.agency-chips { display: flex; gap: 8px; }
.agency-fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: inherit; font: inherit; font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.agency-fchip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.agency-fchip[aria-pressed="true"]::before { content: "\2713"; font-weight: 700; }
.agency-chip-n { font-size: 12px; color: var(--muted); }
.agency-fchip[aria-pressed="true"] .agency-chip-n { color: var(--brand); }
.agency-result-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agency-filter-count { margin: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
#agency-sort { height: 32px; min-height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background-color: var(--panel); color: inherit; font: inherit; font-size: 13px; line-height: 18px; font-weight: 600; }
.agency-offline { margin: 4px 0 0; font-size: 12px; line-height: 16px; color: var(--muted); }

/* Regions and cards (keeps .region, .agency-grid, .agency) */
body.ui-scale #regions .region { margin-top: 16px; }
body.ui-scale #regions .region h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 20px; line-height: 28px; }
body.ui-scale #regions .agency-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
body.ui-scale #regions .agency { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: none; }
body.ui-scale #regions .agency:hover { border-color: #c9d3db; }
.agency-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.ui-scale #regions .agency h3 { margin: 0; font-size: 16px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ui-scale #regions .agency p { margin: 0; }
body.ui-scale #regions .agency .agency-name { font-size: 13px; line-height: 18px; color: var(--ink, #17212b);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.ui-scale #regions .agency .agency-place { margin-bottom: 4px; font-size: 12px; line-height: 16px; color: var(--muted); }
body.ui-scale #regions .agency .agency-fact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: 12px; line-height: 16px; }
body.ui-scale #regions .agency .agency-fact span { font-size: 12px; line-height: 16px; color: var(--muted); }
body.ui-scale #regions .agency .agency-fact strong { font-size: 13px; line-height: 18px; font-weight: 700; }
body.ui-scale #regions .agency .links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; }
body.ui-scale #regions .agency .links a { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; font-weight: 600; text-decoration: none; color: var(--brand); }
body.ui-scale #regions .agency .links a:hover { text-decoration: underline; }
body.ui-scale #regions .agency .links a.agency-profile-link { height: 28px; min-height: 28px; padding: 0 10px; border-radius: 6px; background: var(--brand); color: #fff; }
body.ui-scale #regions .agency .links a.quiet { color: var(--muted); font-weight: 400; }
.links .agency-count { height: 18px; }
@media (pointer: coarse) { body.ui-scale #regions .agency .links a { min-height: 44px; } }
.agency-empty-state { margin-top: 16px; padding: 32px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel); }
body.ui-scale .agency-empty-state h2 { margin: 0 0 4px; font-size: 16px; line-height: 24px; }
.agency-empty-state p { margin: 0 0 12px; color: var(--muted); }
.agency-skeleton { height: 132px; border: 1px solid var(--line); border-radius: 8px; background: var(--brand-soft); opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .agency-skeleton { animation: agency-pulse 1.2s ease-in-out infinite alternate; }
  @keyframes agency-pulse { to { opacity: .2; } }
}
@media (max-width: 640px) {
  .agency-tabs button, .agency-fchip { height: 44px; }
  .agency-search { width: 100%; }
  #agency-filter #agency-filter-input, #agency-sort { height: 44px; min-height: 44px; font-size: 16px; }
  .agency-sort { flex: none; }
  #agency-sort { width: auto; }
  .agency-chips { width: calc(100% + 24px); margin: 0 -12px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  body.ui-scale #regions .agency .links a { min-height: 44px; }
  body.ui-scale #regions .agency .links a.agency-profile-link { height: 36px; min-height: 36px; }
}

.agency-drawer { box-sizing: border-box; width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--panel); color: inherit;
  display: none; flex-direction: column; }
.agency-drawer[open] { display: flex; }
.agency-drawer::backdrop { background: rgb(10 30 40 / 35%); }
@media (prefers-reduced-motion: no-preference) {
  .agency-drawer[open] { animation: agency-drawer-in 160ms ease-out; }
  @keyframes agency-drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.agency-drawer-head { position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.agency-drawer-head h2 { margin: 0; font-size: 20px; line-height: 28px; }
.agency-drawer-sub { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.agency-drawer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 0; font-size: 13px; }
.agency-drawer-links a { color: var(--brand); }
.agency-drawer-close { flex: none; height: 32px; padding: 0 12px; cursor: pointer; }
.agency-drawer-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.agency-drawer-section { border-bottom: 1px solid var(--line); }
.agency-drawer-section summary { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; font-size: 14px; font-weight: 600; }
.agency-drawer-section dl { margin: 0 0 12px; }
.agency-drawer-section dl > div { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 4px 12px; padding: 4px 0; }
.agency-drawer-section dt { font-size: 12px; line-height: 20px; font-weight: 600; color: var(--muted); }
.agency-drawer-section dd { margin: 0; font-size: 14px; line-height: 20px; white-space: pre-line; overflow-wrap: anywhere; }
.agency-drawer-section dd a { color: var(--brand); }
.agency-drawer-section dd.is-candidate { color: var(--muted); }
.agency-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.agency-chip-verified { background: var(--brand); color: #fff; }
.agency-chip-muted { height: 20px; background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.agency-chip-count { height: 20px; padding: 0 6px; font-weight: 600; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.agency-drawer-muted { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.agency-drawer-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--muted); }
.agency-drawer-foot a { color: var(--brand); }
@media (max-width: 640px) {
  .agency-drawer { inset: 0; width: auto; max-width: none; border-left: 0; }
  .agency-drawer-section dl > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .agency-drawer-close, .agency-drawer-section summary { min-height: 44px; }
  .agency-drawer-links a { display: inline-flex; align-items: center; min-height: 44px; }
}
