/* Todas as regras ficam no escopo do plugin; o JS acrescenta Shadow DOM. */
.tse-plugin-host {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 24px 0;
    isolation: isolate;
}
.tse-plugin-host.tse-auto-host { margin: 0 0 20px; }
body.tse-consulta-page {
    margin: 0 !important; padding: 24px !important; min-height: 100vh;
    background: #eef4f2 !important; color: #182e2a;
    font-family: system-ui, -apple-system, sans-serif;
}
.tse-consulta-page .tse-consulta-main { display: block; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0; }
.tse-plugin-card,
.tse-plugin-card *,
.tse-plugin-card *::before,
.tse-plugin-card *::after { box-sizing: border-box; }
.tse-plugin-card {
    all: initial;
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: 1120px;
    min-width: 0;
    margin: 0 auto;
    padding: clamp(18px, 3.5vw, 36px);
    border: 1px solid #dae5e2;
    border-radius: 24px;
    background: #f6f9f8;
    color: #182e2a;
    font: 400 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: left;
    direction: ltr;
    color-scheme: light;
    box-shadow: 0 12px 40px #123e2910;
    overflow-wrap: anywhere;
    container-type: inline-size;
}
.tse-plugin-card :where(h2,h3,h4,p,ol,li,header,footer,section,div,label) {
    margin: 0;
    padding: 0;
    font-family: inherit;
    line-height: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
}
.tse-plugin-card [hidden] { display: none !important; }
.tse-plugin-card .tse-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.tse-plugin-card .tse-eyebrow { font-size: 11px; font-weight: 750; letter-spacing: 1.5px; color: #17644f; }
.tse-plugin-card h2 { font-size: clamp(25px, 4vw, 36px); font-weight: 750; letter-spacing: -1px; line-height: 1.2; margin: 7px 0 9px; }
.tse-plugin-card .tse-subtitle { color: #50675f; font-size: 14px; }
.tse-plugin-card .tse-badge { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 13px; border: 1px solid #b7d8cc; border-radius: 30px; background: #e4f2ec; font-size: 12px; font-weight: 700; color: #14533e; }
.tse-plugin-card .tse-location-note { color: #536b62; font-size: 12px; margin-top: 18px; }
.tse-plugin-card .tse-toolbar { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin: 16px 0; }
.tse-plugin-card .tse-toolbar p { font-size: 12px; color: #425d52; }
.tse-plugin-card .tse-button {
    appearance: none; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #b4c9bf; border-radius: 10px; padding: 10px 16px;
    min-height: 44px; margin: 0; background: #fff; color: #19583f;
    font: 650 13px/1.3 system-ui, sans-serif; text-transform: none; letter-spacing: normal;
    cursor: pointer; box-shadow: none; text-decoration: none; transition: background .15s ease;
}
.tse-plugin-card .tse-button:hover { background: #e7f2ec; border-color: #7eac96; }
.tse-plugin-card .tse-button:disabled { opacity: .55; cursor: wait; }
.tse-plugin-card :is(button,input,select,summary,a):focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.tse-plugin-card .tse-leaders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tse-plugin-card .tse-leader { display: flex; flex-direction: column; min-width: 0; padding: 23px 20px; border-radius: 17px; border: 1px solid #dce6e0; background: #fff; }
.tse-plugin-card .tse-featured { border-top: 4px solid #168258; padding-top: 20px; background: linear-gradient(150deg, #edf8f0, #fff 65%); }
.tse-plugin-card .tse-office { font-size: 14px; font-weight: 750; padding-bottom: 17px; border-bottom: 1px solid #e6ede8; margin-bottom: 18px; }
.tse-plugin-card .tse-kicker { font-size: 11px; color: #4c695a; margin-bottom: 8px; }
.tse-plugin-card .tse-candidate-info { min-width: 0; }
.tse-plugin-card .tse-candidate-name { display: block; font-size: 16px; font-weight: 750; line-height: 1.35; }
.tse-plugin-card h4.tse-candidate-name { font-size: 20px; }
.tse-plugin-card .tse-party { font-size: 12px; margin-top: 6px; color: #536859; }
.tse-plugin-card .tse-candidate-status { font-size: 11px; color: #5a655f; margin-top: 6px; }
.tse-plugin-card .tse-votes { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 18px 0; }
.tse-plugin-card .tse-percent { display: inline-block; font-variant-numeric: tabular-nums; padding: 5px 10px; color: #135d3c; background: #e6f4e9; border: 1px solid #cbe5d0; border-radius: 9px; font-size: 17px; font-weight: 750; white-space: nowrap; }
.tse-plugin-card .tse-vote-count { font-size: 12px; color: #4e6558; font-variant-numeric: tabular-nums; }
.tse-plugin-card .tse-progress { margin-top: auto; padding-top: 14px; }
.tse-plugin-card .tse-progress-label { font-size: 11px; color: #3e5a4a; margin-bottom: 7px; }
.tse-plugin-card progress { appearance: none; display: block; width: 100%; height: 7px; border: 0; overflow: hidden; border-radius: 10px; background: #e3ece5; accent-color: #198255; }
.tse-plugin-card progress::-webkit-progress-bar { background: #e3ece5; border-radius: 10px; }
.tse-plugin-card progress::-webkit-progress-value { background: #198255; border-radius: 10px; }
.tse-plugin-card progress::-moz-progress-bar { background: #198255; border-radius: 10px; }
.tse-plugin-card .tse-timestamp { margin-top: 8px; color: #59685e; font-size: 10px; }
.tse-plugin-card .tse-warning { padding: 11px 12px; margin-top: 12px; border: 1px solid #e3cb91; background: #fffae9; color: #78521a; border-radius: 9px; font-size: 12px; }
.tse-plugin-card .tse-empty { font-size: 14px; padding: 12px 0 20px; color: #52695a; }
.tse-plugin-card .tse-details { display: block; margin-top: 22px; border: 1px solid #d7e3db; border-radius: 13px; background: #fff; }
.tse-plugin-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 19px; cursor: pointer; font-size: 14px; font-weight: 700; color: #1a543c; list-style: none; }
.tse-plugin-card summary::-webkit-details-marker { display: none; }
.tse-plugin-card summary span { font-size: 20px; }
.tse-plugin-card details[open] > summary { border-bottom: 1px solid #e2eae5; }
.tse-plugin-card details[open] > summary span { transform: rotate(45deg); }
.tse-plugin-card .tse-explorer { padding: 20px; }
.tse-plugin-card .tse-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.tse-plugin-card label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 650; min-width: 0; }
.tse-plugin-card .tse-search { grid-column: 1 / -1; }
.tse-plugin-card :is(input,select) { display: block; width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; margin: 0; border: 1px solid #b7cbbc; border-radius: 9px; background: #fff; color: #233d2c; font: 400 16px/1.5 system-ui, sans-serif; box-shadow: none; }
.tse-plugin-card input::placeholder { color: #687c6d; opacity: 1; }
.tse-plugin-card .tse-count { font-size: 12px; color: #536b5b; margin: 19px 0 8px; }
.tse-plugin-card .tse-results { list-style: none; margin: 0; padding: 0; }
.tse-plugin-card .tse-result { display: flex; justify-content: space-between; gap: 20px; padding: 17px 0; border-top: 1px solid #e7ede9; list-style: none; }
.tse-plugin-card .tse-result-votes { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.tse-plugin-card .tse-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 22px; font-size: 11px; color: #566b5e; }
.tse-plugin-card .tse-footer p { max-width: 640px; }
.tse-plugin-card a { color: #175e40; text-decoration: underline; text-underline-offset: 3px; }
.tse-plugin-card .tse-footer a { flex-shrink: 0; }
@container (max-width: 700px) {
    .tse-plugin-card .tse-leaders { grid-template-columns: 1fr; }
    .tse-plugin-card .tse-footer { flex-direction: column; }
}
@container (max-width: 420px) {
    .tse-plugin-card .tse-filters { grid-template-columns: 1fr; }
    .tse-plugin-card .tse-explorer { padding: 15px; }
    .tse-plugin-card .tse-result { flex-direction: column; gap: 10px; }
    .tse-plugin-card .tse-result-votes { flex-direction: row; align-items: center; gap: 12px; }
}
@media (max-width: 760px) {
    .tse-plugin-card .tse-leaders { grid-template-columns: 1fr; }
    .tse-plugin-card .tse-footer { flex-direction: column; }
}
@media (max-width: 480px) {
    .tse-plugin-card .tse-filters { grid-template-columns: 1fr; }
    .tse-plugin-card .tse-explorer { padding: 15px; }
    .tse-plugin-card .tse-result { flex-direction: column; gap: 10px; }
    .tse-plugin-card .tse-result-votes { flex-direction: row; align-items: center; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .tse-plugin-card * { transition: none !important; scroll-behavior: auto !important; }
}
.tse-plugin-card .tse-back { display: inline-block; margin-bottom: 18px; font-size: 13px; }
.tse-plugin-card .tse-uf-quick { margin: 15px 0 0; }
.tse-plugin-card.tse-full .tse-uf-quick { display: none; }
.tse-plugin-card.tse-full .tse-leaders { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.tse-plugin-card .tse-leader-body { min-width: 0; }
.tse-plugin-card .tse-primary { background: #096ab0; color: #fff; border-color: #096ab0; }
.tse-plugin-card .tse-primary:hover { background: #07558e; color: #fff; border-color: #07558e; }
.tse-plugin-card .tse-view-more { display: flex; width: 100%; text-decoration: none; margin-top: 12px; }
.tse-plugin-card .tse-mini-progress { font-size: 10px; color: #586c60; margin-top: 7px; }
.tse-plugin-card .tse-explorer { margin-top: 24px; padding: 22px; background: #fff; border: 1px solid #d7e3db; border-radius: 15px; }
.tse-plugin-card .tse-explorer-title { font-size: 21px; font-weight: 750; margin-bottom: 8px; }
.tse-plugin-card .tse-scope-note { font-size: 12px; color: #536b5b; margin-bottom: 20px; }
.tse-plugin-card .tse-locality-title { font-size: 16px; font-weight: 700; margin-top: 20px; }
.tse-plugin-card .tse-municipality-note { font-size: 12px; color: #536b5b; margin-top: 12px; }
.tse-plugin-card select:disabled, .tse-plugin-card input:disabled { opacity: .6; background: #f0f4f1; }
.tse-plugin-card.tse-compact { padding: 19px; border-radius: 14px; background: #fff; box-shadow: 0 5px 20px #14352609; }
.tse-plugin-card.tse-compact h2 { font-size: 23px; margin: 5px 0; letter-spacing: -.6px; }
.tse-plugin-card.tse-compact .tse-header { gap: 8px; flex-wrap: nowrap; }
.tse-plugin-card.tse-compact .tse-eyebrow { font-size: 9px; letter-spacing: 1px; }
.tse-plugin-card.tse-compact .tse-subtitle { font-size: 11px; }
.tse-plugin-card.tse-compact .tse-badge { padding: 4px 9px; min-height: 30px; font-size: 11px; }
.tse-plugin-card.tse-compact .tse-uf-quick { font-size: 10px; gap: 4px; margin-top: 12px; }
.tse-plugin-card.tse-compact select { min-height: 38px; padding: 6px 9px; font-size: 14px; }
.tse-plugin-card.tse-compact .tse-location-note { font-size: 10px; margin: 7px 0 9px; }
.tse-plugin-card.tse-compact .tse-leaders { display: flex; flex-direction: column; gap: 0; }
.tse-plugin-card.tse-compact .tse-leader { display: block; padding: 11px 0; border: 0; border-top: 1px solid #e1e9e5; border-radius: 0; background: #fff; }
.tse-plugin-card.tse-compact .tse-office { font-size: 10px; color: #3d6558; border: 0; padding: 0; margin-bottom: 4px; }
.tse-plugin-card.tse-compact .tse-leader-body { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tse-plugin-card.tse-compact h4.tse-candidate-name { font-size: 14px; }
.tse-plugin-card.tse-compact .tse-party { font-size: 10px; margin-top: 3px; }
.tse-plugin-card.tse-compact .tse-candidate-status { font-size: 10px; margin-top: 3px; color: #805014; }
.tse-plugin-card.tse-compact .tse-votes { flex-direction: column; align-items: flex-end; gap: 4px; margin: 0; flex-shrink: 0; }
.tse-plugin-card.tse-compact .tse-percent { font-size: 14px; padding: 3px 7px; border-radius: 7px; }
.tse-plugin-card.tse-compact .tse-vote-count { font-size: 10px; }
.tse-plugin-card.tse-compact .tse-mini-progress { font-size: 9px; margin-top: 5px; }
.tse-plugin-card.tse-compact .tse-mini-bar { height: 3px; margin-top: 4px; }
.tse-plugin-card.tse-compact .tse-toolbar { margin: 9px 0 0; gap: 8px; }
.tse-plugin-card.tse-compact .tse-toolbar p { font-size: 10px; }
.tse-plugin-card.tse-compact .tse-toolbar .tse-button { min-height: 32px; padding: 7px 10px; font-size: 10px; }
.tse-plugin-card.tse-compact .tse-footer { flex-direction: column; gap: 7px; margin-top: 12px; font-size: 10px; }
.tse-plugin-card.tse-compact .tse-kicker { font-size: 10px; }
.tse-plugin-card.tse-compact .tse-empty { padding: 3px 0; font-size: 12px; }
/* O resumo lateral usa uma linha por cargo; filtros e datas ficam na tela completa. */
.tse-plugin-card.tse-compact .tse-uf-quick { display: none; }
.tse-plugin-card.tse-compact .tse-leader { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 9px; row-gap: 1px; padding: 9px 0; }
.tse-plugin-card.tse-compact .tse-office { grid-column: 1; margin: 0; line-height: 1.3; }
.tse-plugin-card.tse-compact .tse-leader-body,
.tse-plugin-card.tse-compact .tse-candidate-info { display: contents; }
.tse-plugin-card.tse-compact .tse-candidate-name { grid-column: 1; }
.tse-plugin-card.tse-compact .tse-party { grid-column: 1; margin: 0; line-height: 1.3; }
.tse-plugin-card.tse-compact .tse-candidate-status { grid-column: 1 / -1; }
.tse-plugin-card.tse-compact .tse-votes { grid-column: 2; grid-row: 1 / span 3; justify-content: center; }
.tse-plugin-card.tse-compact .tse-mini-progress { display: none; }
.tse-plugin-card.tse-compact .tse-mini-bar { grid-column: 1 / -1; }
.tse-plugin-card.tse-compact .tse-kicker,
.tse-plugin-card.tse-compact .tse-warning,
.tse-plugin-card.tse-compact .tse-timestamp,
.tse-plugin-card.tse-compact .tse-empty { grid-column: 1 / -1; }
.tse-plugin-card.tse-compact .tse-toolbar .tse-button { display: none; }
.tse-plugin-card.tse-compact .tse-view-more { min-height: 38px; margin-top: 9px; }
.tse-plugin-card.tse-compact .tse-footer { font-size: 9px; gap: 5px; margin-top: 10px; }
.tse-plugin-card .tse-candidate-info { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.tse-plugin-card .tse-candidate-text { min-width: 0; }
.tse-plugin-card .tse-candidate-photo {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; flex: 0 0 48px; overflow: hidden;
    border: 1px solid #c9dbd2; border-radius: 10px; background: #e7f1eb; color: #236348;
}
.tse-plugin-card .tse-photo-fallback { font-size: 15px; font-weight: 700; line-height: 1; }
.tse-plugin-card .tse-photo-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center top; border: 0; margin: 0; opacity: 0; }
.tse-plugin-card .tse-photo-image.tse-photo-loaded { opacity: 1; }
.tse-plugin-card.tse-full .tse-leader .tse-candidate-photo { width: 56px; height: 64px; flex-basis: 56px; }
.tse-plugin-card.tse-compact .tse-leader { grid-template-columns: 42px minmax(0, 1fr) auto; }
.tse-plugin-card.tse-compact .tse-candidate-info,
.tse-plugin-card.tse-compact .tse-candidate-text { display: contents; }
.tse-plugin-card.tse-compact .tse-candidate-photo { grid-column: 1; grid-row: 1 / span 3; width: 42px; height: 48px; flex-basis: 42px; align-self: center; border-radius: 8px; }
.tse-plugin-card.tse-compact .tse-office,
.tse-plugin-card.tse-compact .tse-candidate-name,
.tse-plugin-card.tse-compact .tse-party { grid-column: 2; }
.tse-plugin-card.tse-compact .tse-votes { grid-column: 3; }
@media (max-width: 480px) {
    body.tse-consulta-page { padding: 10px !important; }
    .tse-plugin-card.tse-full .tse-explorer { padding: 15px; }
}
