﻿.parliamentary-profile {
  background: var(--profile-bg);
  border-color: var(--profile-line);
  color: var(--profile-ink);
  padding: clamp(.7rem, 2vw, 1.25rem);
  overflow-wrap: anywhere;
}
.parliamentary-profile a { color: var(--profile-accent); }
.parliamentary-profile :is(.note, .result-meta, .result-body) { color: var(--profile-muted); }
.parliamentary-profile :is(button, input, select) { color: var(--profile-ink); }
.parliamentary-profile :is(button, input, select):focus-visible,
.parliamentary-profile :is(summary, a):focus-visible { outline-color: var(--profile-accent); }
.profile-breadcrumb { font-size: .8rem; margin-bottom: .65rem; color: var(--profile-muted); }
.profile-breadcrumb a { color: inherit; }
.profile-identity {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(.55rem, 2vw, 1rem);
  align-items: center;
  border-bottom: 1px solid var(--profile-line);
  padding-bottom: .75rem;
  margin-bottom: .7rem;
}
.profile-identity .avatar {
  width: clamp(3.65rem, 12vw, 7rem);
  height: clamp(3.65rem, 12vw, 7rem);
  border-radius: .55rem;
  background: var(--profile-panel);
  object-fit: contain;
  object-position: center;
}
.profile-identity h2 { font-size: clamp(1.13rem, 3.2vw, 2rem); margin-bottom: .2rem; }
.profile-identity p { margin: .12rem 0; font-size: .86rem; }
.profile-context, .profile-links { color: var(--profile-muted); }
.profile-links { font-size: .9rem; }
.profile-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
.parliamentary-profile button.profile-metric {
  background: var(--profile-panel);
  border: 1px solid transparent;
  border-radius: .55rem;
}
.parliamentary-profile button.profile-metric {
  display: grid;
  align-content: center;
  gap: .2rem;
  min-height: 3.15rem;
  height: 100%;
  text-align: left;
  padding: .45rem 1.05rem .45rem .5rem;
  position: relative;
  list-style: none;
}
.profile-metric-copy { display: grid; gap: .14rem; min-width: 0; }
.parliamentary-profile button.profile-frequency { display: flex; align-items: center; gap: .42rem; }
.profile-frequency .pilot-ring { flex: none; width: clamp(2.15rem, 7.3vw, 3.35rem); height: clamp(2.15rem, 7.3vw, 3.35rem); font-size: .76rem; }
.profile-frequency .pilot-ring svg { stroke: var(--bar-track); }
.profile-frequency .pilot-ring-value { stroke: var(--topic-strong); }
.parliamentary-profile button:is(.profile-metric, .profile-distribution-row)::after {
  content: "›";
  position: absolute;
  inset: .8rem .65rem auto auto;
  color: var(--profile-accent);
}
.profile-metric-label { font-weight: 650; font-size: .83rem; }
.profile-value { font-size: clamp(1rem, 2.2vw, 1.55rem); line-height: 1.12; }
.profile-metric:nth-child(2) .profile-value { color: var(--profile-accent); }
.profile-value .pilot-ring { vertical-align: middle; }
.profile-value .pilot-ring-value { stroke: currentColor; }
.profile-metric-note { color: var(--profile-muted); font-size: .79rem; }
.profile-tabs { display: flex; flex-wrap: wrap; gap: .15rem; margin: .55rem 0 .65rem; }
.parliamentary-profile :is(button, select, input) {
  border: 1px solid var(--profile-line);
  border-radius: .45rem;
  background: var(--profile-bg);
  padding: .35rem .65rem;
}
.parliamentary-profile .profile-tabs button { border-color: transparent; padding: .2rem .45rem; font-size: .82rem; color: var(--profile-muted); }
.parliamentary-profile .profile-tabs [aria-selected="true"] { color: var(--profile-ink); font-weight: 700; background: var(--profile-selected); }
.parliamentary-profile [role="tabpanel"], .profile-panel { min-width: 0; }
.profile-panel + .profile-panel { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--profile-line); }
.parliamentary-profile h3 { font-size: clamp(.94rem, 2vw, 1.2rem); margin-bottom: .5rem; }
.profile-panel > p, [data-profile-territory] > p { color: var(--profile-muted); margin-bottom: .6rem; }
.profile-stack { display: flex; min-height: .65rem; overflow: hidden; border-radius: .22rem; }
.parliamentary-profile .profile-stack button { position: relative; border: 0; min-width: .35rem; padding: 0; border-radius: 0; }
.profile-stack button span { position: absolute; inset: 0; border-radius: inherit; }
.profile-stack button:hover span { box-shadow: inset 0 0 0 2px var(--profile-accent); }
.profile-document-topics { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .65rem 0; }
.profile-legend { display: grid; margin-top: .35rem; }
.parliamentary-profile .profile-legend button {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(2ch, auto);
  align-items: center; gap: .32rem; text-align: right; border-color: transparent; padding: .18rem 0;
  font-size: .82rem; font-variant-numeric: tabular-nums;
}
.profile-legend-label { text-align: left; }
.profile-legend-label i { display: inline-block; width: .4rem; height: .4rem; margin-right: .36rem; border-radius: 50%; }
.profile-legend button:hover, .profile-tabs button:hover { text-decoration: underline; }
.parliamentary-profile :is(.profile-stack, .profile-legend) .pilot-type-0 { background: #357fb2; }
.parliamentary-profile :is(.profile-stack, .profile-legend) .pilot-type-1 { background: #d48115; }
.parliamentary-profile :is(.profile-stack, .profile-legend) .pilot-type-2 { background: #9568b5; }
.parliamentary-profile :is(.profile-stack, .profile-legend) .pilot-type-3 { background: #168f86; }
.parliamentary-profile button.profile-distribution-row {
  display: block; width: 100%; border: 0; border-bottom: 1px solid var(--profile-line);
  border-radius: 0; position: relative; padding: .55rem 1.6rem .55rem 0; text-align: left;
}
.parliamentary-profile .profile-themes button.profile-distribution-row { border-bottom: 0; }
.profile-themes > p { margin-top: .45rem; font-size: .82rem; }
.profile-distribution { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .7rem; align-items: center; }
.profile-themes .profile-distribution { grid-template-columns: minmax(0, 1fr); gap: .12rem; font-size: .85rem; }
.profile-themes .profile-distribution > :is(strong, .profile-track) { margin-left: 1.6rem; }
.profile-topic-icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; vertical-align: -.22em; margin-right: .35rem; color: color-mix(in srgb, var(--topic-color), var(--topic-mix) 42%); }
.profile-track { grid-column: 1 / -1; height: .35rem; border-radius: 1rem; background: var(--profile-line); }
.profile-themes .profile-track { background: transparent; }
.profile-track > span { display: block; height: 100%; border-radius: inherit; background: var(--bar); }
.profile-document-topics { color: var(--profile-muted); font-size: .9rem; }
[data-profile-territory] { margin-top: .75rem; }
#vereadores:has(.parliamentary-profile:not([hidden])) > .page-heading { display: none; }

.parliamentary-profile button.profile-counter {
  display: flex; justify-content: space-between; gap: .75rem; width: 100%;
  margin: .35rem 0; text-align: left; background: var(--profile-panel);
}
.profile-counter strong { color: var(--profile-accent); }
html:has(.parliamentary-profile:not([hidden])) { scrollbar-gutter: stable; }
html:has(.profile-dialog[open]) { overflow: hidden; }
.profile-dialog {
  width: min(960px, calc(100% - 2rem));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--profile-line);
  border-radius: .85rem;
  color: var(--profile-ink);
  background: var(--profile-bg);
  box-shadow: 0 1rem 4rem #0008;
}
.profile-dialog::backdrop { background: var(--overlay); }
.profile-dialog-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(88dvh, 850px);
}
.profile-dialog-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: .65rem;
  padding: clamp(.8rem, 2.4vw, 1.25rem);
  border-bottom: 1px solid var(--profile-line);
  background: var(--profile-panel);
}
.profile-dialog-header h3 { margin: 0 0 .2rem; font-size: clamp(1.2rem, 3vw, 1.65rem); }
.profile-dialog-header p { margin: 0; color: var(--profile-muted); font-size: .88rem; }
.profile-dialog-icon {
  display: grid; place-items: center; min-width: 2.4rem; min-height: 2.4rem;
  border: 1px solid var(--dialog-accent); border-radius: .5rem;
}
.profile-dialog-icon .profile-topic-icon { margin: 0; color: color-mix(in srgb, var(--dialog-accent), var(--topic-mix) 40%); }
.profile-dialog-icon .pilot-ring { width: 2.4rem; height: 2.4rem; font-size: .74rem; }
.parliamentary-profile .profile-dialog-close {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  font-size: 1.6rem; line-height: 1;
}
.profile-dialog-scroll {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: .35rem clamp(.65rem, 2.4vw, 1.25rem) .85rem;
}
.profile-dialog-intro:not(:empty) { padding: .55rem 0; }
.profile-dialog-intro p { margin: .15rem 0; }
.profile-dialog-rows { margin: 0; padding: 0; list-style: none; }
.profile-dialog-rows > li { border-bottom: 1px solid var(--profile-line); }
.parliamentary-profile .profile-dialog-record {
  display: grid; gap: .2rem; position: relative; width: 100%;
  padding: .66rem 1.6rem .66rem .25rem; border: 0; text-align: left;
}
.profile-dialog-record::after { content: "▾"; position: absolute; top: .6rem; right: .35rem; color: var(--profile-accent); }
.profile-dialog-record[aria-expanded="true"]::after { content: "▴"; }
.profile-dialog-record:hover strong, .profile-dialog-record[aria-expanded="true"] strong { color: var(--profile-accent); }
.profile-dialog-caption {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-height: 1.35; font-size: .925rem;
}
.profile-dialog-meta {
  display: flex; flex-wrap: wrap; column-gap: .65rem; row-gap: .15rem;
  color: var(--profile-muted); font-size: .8rem;
}
.profile-dialog-meta span:empty { display: none; }
.profile-dialog-meta .profile-topic-icon { width: 1rem; height: 1rem; }
.profile-dialog-details {
  background: var(--profile-panel); border-left: 2px solid var(--dialog-accent);
  padding: .75rem; margin: .2rem 0 .65rem;
}
.profile-dialog-details > :last-child { margin-bottom: 0; }
.profile-modal-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .45rem .8rem; margin: 0 0 .75rem;
}
.profile-modal-fields dt { color: var(--profile-muted); font-size: .85rem; }
.profile-modal-fields dd { margin: 0; }
.profile-dialog-more { display: block; margin: .65rem auto 0; }
@media (max-width: 540px) {
  .profile-dialog { width: calc(100% - .5rem); border-radius: .55rem; }
  .profile-dialog-frame { max-height: calc(100dvh - .5rem); }
}
