/* Shared layouts: phone, tablet and desktop use the same data and controls. */
:root { --workspace-width:1280px; --admin-rail-width:232px; }
body[data-route] .app-shell { min-width:0; }
body .admin-sidebar { overflow-y:auto; }
body .admin-sidebar strong { padding-bottom:8px; }
body .admin-workspace-context { font-size:.78rem; color:#d5dfec; padding:0 12px 14px; margin:0; }
#divergenceMessage[data-state="error"] { color:var(--danger); background:var(--danger-bg); border:1px solid var(--danger); border-radius:var(--radius-md); margin:16px; }
#divergenceMessage[data-state="loading"] { color:var(--gray-600); }
#divergenceMessage[data-state="empty"] { background:var(--gray-100); border-radius:var(--radius-md); margin:16px; }
body .div-sends[hidden] { display:none; }
body .div-vote-row { min-width:0; }
body .div-vote-row > span { min-width:0; overflow-wrap:anywhere; }
body .div-send-comparison { padding:12px; border-radius:var(--radius-md); background:var(--primary-50); color:var(--primary-700); margin-bottom:12px; }
body[data-route] :focus-visible { outline:3px solid var(--primary-400); outline-offset:3px; }
@media (min-width:768px) {
  :root { --app-max-width:var(--workspace-width); }
  body .app-shell { width:calc(100% - 48px); max-width:var(--workspace-width); margin:24px auto; border:1px solid var(--gray-200); border-radius:18px; box-shadow:var(--shadow-sm); overflow:clip; }
  body .app-shell > .topbar, body .app-shell > .admin-topbar { min-height:72px; padding-left:24px; padding-right:24px; }
  body .topbar-title, body .admin-topbar .topbar-title { font-size:1.15rem; }
  body .admin-nav { flex-wrap:wrap; overflow:visible; padding:0 12px; gap:0; }
  body .admin-nav a { font-size:.84rem; padding:14px 12px; }
  body .bottomnav, body .save-bar { width:calc(100% - 48px); max-width:var(--workspace-width); border-radius:14px 14px 0 0; }
  body .bottomnav-item { flex-direction:row; gap:10px; font-size:.9rem; }
  body .bottomnav-item i { font-size:1.2rem; }
  body .fab { right:32px; }
  body .modal-overlay { align-items:center; padding:24px; }
  body .modal-sheet { max-width:720px; max-height:calc(100dvh - 48px); border-radius:18px; }
  body .filter-bar, body .filter-strip, body .review-filters { flex-wrap:wrap; gap:12px; }
  body .filter-bar input, body .filter-bar select, body .filter-strip select { min-height:44px; font-size:.9rem; }
  body .app-content { padding-bottom:100px; }
  body .page-padding, body .review-main { padding:24px; }
  body[data-route="dashboard"] .grid-2 { grid-template-columns:repeat(4,minmax(0,1fr)); }
  body .quick-actions { grid-template-columns:repeat(4,minmax(0,1fr)); }
  body .stat-card .stat-value { font-size:1.8rem; }
  body .stat-card .stat-label { font-size:.8rem; }
  body #territoryFilters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 20px; align-items:end; }
  body #territoryFilters label { margin:0; }
  body #territoryRows { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  body #territoryRows .card { margin:0; }
  body[data-route="admin-eleicao"] .app-content { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; padding:24px 24px 110px; }
  body[data-route="admin-eleicao"] .app-content > * { margin:0; min-width:0; }
  body[data-route="admin-eleicao"] .mode-switch, body[data-route="admin-eleicao"] .simulado-banner { grid-column:1 / -1; }
  body[data-route="admin-eleicao"] .cargo-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 20px; }
  body[data-route="admin-importacao"] .page-padding { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
  body[data-route="admin-importacao"] #importContext, body[data-route="admin-importacao"] .import-tabs { grid-column:1 / -1; margin:0; }
  body[data-route="admin-importacao"] #importInventory { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  body[data-route="admin-importacao"] #importHistory { max-height:520px; overflow:auto; }
  body[data-route="admin-importacao"] .log-section { grid-column:1 / -1; margin:0; }
  body .result-hero { padding:24px; }
  body .result-hero > .flex { gap:16px; flex-wrap:wrap; }
  body #hero-live-badge { white-space:normal; max-width:100%; }
  body .result-hero-stats { max-width:760px; margin:24px auto 0; }
  body .result-hero-stat .val { font-size:1.8rem; }
  body .result-hero-stat .lbl { font-size:.8rem; }
  body .candidate-result { padding:18px 24px; gap:16px; }
  body .cand-name { font-size:1rem; }
  body .cand-party { font-size:.8rem; }
  body .map-full { min-height:540px; height:calc(100dvh - 190px - var(--data-mode-notice-height,0px)); }
  body .map-legend { max-width:700px; margin-left:auto; margin-right:auto; }
  body[data-route="login"] .app-shell,body[data-route="cadastro"] .app-shell,body[data-route="recuperar-senha"] .app-shell { max-width:680px; }
  body .scanner-container { max-width:760px; margin:0 auto; }
}
@media (min-width:1024px) {
  body.has-admin-sidebar { padding-left:var(--admin-rail-width); }
  body .admin-sidebar { width:var(--admin-rail-width); padding-top:28px; }
  body .admin-sidebar a { font-size:.95rem; padding:16px 14px; }
  body .app-shell { width:calc(100% - 64px); }
  body .bottomnav,body .save-bar { width:calc(100% - 64px); }
  body.has-admin-sidebar .bottomnav,body.has-admin-sidebar .save-bar { left:calc(var(--admin-rail-width) + 32px); right:32px; width:calc(100% - var(--admin-rail-width) - 64px); }
  body #territoryFilters { grid-template-columns:repeat(4,minmax(0,1fr)) auto; }
  body .div-sends { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
  body .div-sends > p { grid-column:1 / -1; }
  body .div-send { min-width:0; }
  body .div-vote-list { max-height:380px; }
  body .list-pagination { justify-content:flex-end; padding:20px 24px; }
  body .list-pagination label,body .list-pagination span { flex:0 1 auto; order:0; }
  body .list-pagination button { order:0; }
  body .pwa-install-banner { right:24px; left:auto; top:auto; bottom:90px; max-width:250px; }
}
@media (prefers-reduced-motion:reduce) { body .app-shell { scroll-behavior:auto; } }

.data-mode-notice { margin:0; padding:12px 16px; font-size:.82rem; font-weight:600; line-height:1.5; color:var(--primary-800); background:var(--primary-50); border-bottom:1px solid var(--gray-200); }
.data-mode-notice[data-mode="simulado"] { color:#704b00; background:#fff4d6; border-bottom-color:#e7ca83; }
body[data-route="admin-eleicao"] .data-mode-notice { grid-column:1 / -1; }

@media (max-width:767px) {
  body[data-route="mapa"] .map-full { height:calc(100dvh - var(--topbar-safe-height) - var(--bottomnav-height) - var(--safe-bottom) - var(--data-mode-notice-height,0px)); }
  body.has-admin-sidebar[data-route="mapa"] .map-full { height:calc(100dvh - var(--topbar-safe-height) - var(--bottomnav-height) - var(--safe-bottom) - var(--data-mode-notice-height,0px) - 48px); }
}
body[data-route="mapa"] .bottomnav { z-index:1500; }
@media (min-width:768px) and (max-width:1023px) {
  body.has-admin-sidebar[data-route="mapa"] .map-full { height:calc(100dvh - 238px - var(--data-mode-notice-height,0px)); }
}

/* Shared safe area: public studies do not load the application's design system. */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
@supports (-webkit-touch-callout: none) {
  @media (max-width:1023px) {
    :root { --safe-top:max(env(safe-area-inset-top, 0px), 52px); }
  }
  @media (max-width:1023px) and (orientation:landscape) {
    :root { --safe-top:max(env(safe-area-inset-top, 0px), 20px); }
  }
}
body > header:not([class]), body > .topbar { padding-top:calc(20px + var(--safe-top)); }
body .la-top, body .tt-top { padding-top:calc(18px + var(--safe-top)); }
body .align-header { padding-top:calc(14px + var(--safe-top)); }
body .urn-topbar { height:calc(62px + var(--safe-top)); padding-top:var(--safe-top); }
body .users-header { padding-top:calc(24px + var(--safe-top)); }
body .vc-shell, body .reference-page, body .public-bu-page,
body .vp-shell, body .proto-header { padding-top:calc(24px + var(--safe-top)); }
body .la-mode-nav, body .align-mobile-tools { top:var(--safe-top); }
body .skip:focus { top:calc(12px + var(--safe-top)); }
.app-version { display:block; text-align:center; font-size:.78rem; line-height:1.6; margin:16px 0 0; opacity:.85; overflow-wrap:anywhere; }

@media (max-width:1023px) {
  body.has-admin-sidebar { padding-top:calc(48px + var(--safe-top)); }
  body.has-admin-sidebar .admin-sidebar-toggle {
    height:calc(48px + var(--safe-top)); padding-top:var(--safe-top);
    padding-left:max(16px, var(--safe-left)); padding-right:max(16px, var(--safe-right));
  }
  body.has-admin-sidebar .admin-sidebar { top:calc(48px + var(--safe-top)); }
  body.has-admin-sidebar .app-shell > .topbar,
  body.has-admin-sidebar .app-shell > .admin-topbar,
  body.has-admin-sidebar .app-shell > .sim-topbar {
    top:calc(48px + var(--safe-top)); height:var(--topbar-height); padding-top:0;
  }
}
@media (display-mode:standalone) and (max-width:1023px) {
  :root { --safe-top:max(env(safe-area-inset-top, 0px), 52px); }
}
@media (max-width:1023px) {
  html.ios-pwa { --safe-top:max(env(safe-area-inset-top, 0px), 52px); }
}
@media (max-width:1023px) and (orientation:landscape) {
  html.ios-pwa { --safe-top:max(env(safe-area-inset-top, 0px), 20px); }
}
.pwa-update-banner {
  position:fixed; z-index:3000; left:max(12px, env(safe-area-inset-left,0px));
  right:max(12px, env(safe-area-inset-right,0px));
  bottom:calc(var(--bottomnav-height,0px) + env(safe-area-inset-bottom,0px) + 12px);
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px; border-radius:12px; background:#0a1e3d; color:#fff;
  font:14px/1.5 system-ui,sans-serif; box-shadow:0 6px 24px #0004;
}
.pwa-update-banner p { margin:0; color:#fff; }
.pwa-update-banner button {
  flex-shrink:0; min-height:44px; padding:10px 14px; border:0; border-radius:8px;
  font:600 14px/1.4 system-ui,sans-serif; background:#f5c518; color:#0a1e3d; cursor:pointer;
}
.pwa-update-banner button:disabled { opacity:.7; cursor:wait; }
@media(max-width:500px) { .pwa-update-banner { flex-direction:column; align-items:stretch; } }
body #mainNav.navbar { padding-top:var(--safe-top); transition-property:background-color,box-shadow; }
body .app-shell > .data-mode-notice:first-child { padding-top:calc(12px + var(--safe-top)); }
body .app-shell > .volunteer-reminder:first-child { margin-top:calc(16px + var(--safe-top)); }
/* The on-screen keyboard owns the lower viewport during text entry. */
html.keyboard-open .bottomnav, html.keyboard-open .vp-nav,
html.keyboard-open .pwa-update-banner, html.keyboard-open .fab,
html.keyboard-open #pwaInstallButton { display:none !important; }

/* Padrão mobile: compact presentation with readable inputs and full touch targets.
   Keep the application's routes, actions and viewport/safe-area behavior intact. */
@media (max-width:767px) {
  :root { --bottomnav-height:max(64px, 4rem); }
  body[data-route] .app-shell {
    --space-lg:16px;
    --space-xl:24px;
    --space-2xl:32px;
    --radius-xl:14px;
  }

  body[data-route] .app-shell .btn {
    min-height:44px;
    padding:10px 14px;
    font-size:.875rem;
    line-height:1.4;
    white-space:normal;
  }
  body[data-route] .app-shell .btn-lg { padding:10px 16px; border-radius:10px; }
  body[data-route] .app-shell .btn-sm { padding:8px 12px; }
  body[data-route] .topbar-title { font-size:1rem; }
  body[data-route] .topbar-subtitle { font-size:.75rem; opacity:.85; }
  body[data-route] .topbar .btn-icon {
    width:44px; height:44px; min-width:44px; min-height:44px;
    background:transparent; border-radius:10px; font-size:1.125rem;
  }
  body[data-route] .bottomnav-item {
    min-width:0; min-height:44px;
    font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size:.6875rem; font-weight:400; line-height:1.1; color:var(--gray-600);
  }
  body[data-route] .bottomnav-item span { max-width:100%; text-align:center; overflow-wrap:anywhere; }
  body[data-route] .bottomnav-item.active { color:var(--primary-600); font-weight:500; }
  body[data-route] .bottomnav-item i { font-size:1.25rem; }
  body[data-route] .app-shell .form-label { font-size:.875rem; margin-bottom:6px; }
  body[data-route] .app-shell .form-control {
    min-height:44px; font-size:1rem; padding-block:10px; line-height:1.4;
  }
  body[data-route] .app-shell .form-error { font-size:.875rem; }
  body[data-route] .app-shell .form-hint { font-size:.8125rem; color:var(--gray-600); }

  body[data-route] .auth-page { min-height:100dvh; }
  body[data-route] .auth-header {
    padding:calc(20px + var(--safe-top)) max(16px, var(--safe-right)) 24px max(16px, var(--safe-left));
  }
  body[data-route] .auth-header-logo { margin-bottom:8px; }
  body[data-route] .auth-header-logo img { width:24px; height:24px; }
  body[data-route] .auth-header-logo span { font-size:.875rem; }
  body[data-route] .auth-header h1 { font-size:1.375rem; line-height:1.3; }
  body[data-route] .auth-header p { font-size:.875rem; opacity:.85; }
  body[data-route] .auth-header-back { min-height:44px; margin-bottom:8px; font-size:.875rem; }
  body[data-route] .auth-form { flex:0 0 auto; padding:12px 16px 16px; margin-top:0; }
  body[data-route] .auth-card {
    padding:16px; border:1px solid var(--gray-200); border-radius:14px; box-shadow:var(--shadow-xs);
  }
  body[data-route] .input-group .password-toggle {
    width:44px !important; height:44px !important; right:2px; padding:10px !important;
    color:var(--gray-600);
  }
  body[data-route] .input-group input[type="password"],
  body[data-route] .input-group:has(.password-toggle) .form-control { padding-right:48px; }
  body[data-route] .remember-row { flex-wrap:wrap; gap:4px 12px; margin-bottom:12px; }
  body[data-route] .remember-row .form-check { min-height:44px; align-items:center; }
  body[data-route] .remember-row .form-check input { margin-top:0; }
  body[data-route] .remember-row .form-check-label { min-height:44px; display:flex; align-items:center; }
  body[data-route] .forgot-link { display:inline-flex; align-items:center; min-height:44px; font-size:.8125rem; }
  body[data-route] .auth-public-access { padding:0 16px; margin-bottom:0; gap:8px; }
  body[data-route] .btn-public {
    min-height:44px; padding:10px 8px; font-size:.8125rem; line-height:1.4; text-align:center;
    border-width:1px;
  }
  body[data-route] .auth-footer { padding:16px 16px calc(16px + var(--safe-bottom)); font-size:.875rem; }
  body[data-route] .auth-footer a { display:inline-flex; align-items:center; min-height:44px; }
  body[data-route] .auth-footer .app-version { margin-top:8px; }

  body[data-route="index"] .landing {
    padding:calc(16px + var(--safe-top)) max(16px, var(--safe-right)) calc(20px + var(--safe-bottom)) max(16px, var(--safe-left));
  }
  body[data-route="index"] .landing > a:first-child { min-height:44px; margin-bottom:8px !important; }
  body[data-route="index"] .shield-badge { margin-bottom:16px; font-size:.75rem; }
  body[data-route="index"] .landing-logo { width:72px; height:72px; margin-bottom:12px; }
  body[data-route="index"] .landing h1 { font-size:1.5rem; line-height:1.2; }
  body[data-route="index"] .landing-subtitle { font-size:.9375rem; margin-bottom:20px; }
  body[data-route="index"] .landing-video { margin-bottom:20px; }
  body[data-route="index"] .landing-video-link { min-height:44px; margin-top:0; font-size:.8125rem; }
  body[data-route="index"] .landing-features { gap:12px; margin-bottom:20px; }
  body[data-route="index"] .landing-feature { gap:10px; }
  body[data-route="index"] .landing-feature-icon { width:36px; height:36px; font-size:1.125rem; }
  body[data-route="index"] .landing-feature p { font-size:.8125rem; opacity:.85; }
  body[data-route="index"] .landing-footer { margin-top:20px; font-size:.75rem; opacity:.8; }

  body[data-route="resultados"] .result-hero { padding:12px 16px; }
  body[data-route="resultados"] .result-hero-stat .lbl {
    font-size:.75rem; line-height:1.4; letter-spacing:0; text-transform:none; opacity:.85;
  }
  body[data-route="resultados"] .filter-strip {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px;
    overflow:visible; padding:12px 16px;
  }
  body[data-route="resultados"] .filter-strip > * { min-width:0; max-width:100%; }
  body[data-route="resultados"] .filter-strip select { width:100%; font-size:1rem; }
  body[data-route="resultados"] .tab-item { min-height:44px; font-size:.8125rem; padding:10px 8px; }
  body[data-route] .pwa-install-card { margin-bottom:12px; border-radius:12px; box-shadow:none; }
  body[data-route] .app-shell .pwa-install-dismiss { min-width:44px; }
}

/* Shared mobile pattern for application pages and independent public tools.
   Presentation only: preserve all actions, labels, native controls and print layouts. */
@media screen and (max-width:767px) {
  body .btn, body .oa-action, body .align-button, body .tt-button,
  body .urn-button, body .urn-export, body .urn-link-button {
    min-height:44px; padding:10px 14px; font-size:.875rem; line-height:1.4;
    white-space:normal;
  }
  body button, body [role="button"], body summary { min-height:44px; }
  body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="color"]),
  body select, body textarea {
    font-size:1rem; min-height:44px;
  }
  body select:not([multiple]) { font-size:1rem; min-height:44px; height:44px; }
  body .users-page-jump button, body .urn-mobile-tools button,
  body #urn-exterior, body #urn-fit, body #align-fit {
    min-height:44px; min-width:44px;
  }
  body .leaflet-control-zoom.leaflet-bar a { width:44px; height:44px; line-height:44px; }
  body input[type="range"] { min-height:44px; }
  body .form-group, body .form-row > *, body .filter-bar > *, body .filter-strip > *,
  body .search-bar > *, body .reference-input > *, body .oa-filters > * { min-width:0; }
  body .form-control, body .searchable-picker .searchable-input { line-height:1.4; }
  body .admin-nav a, body .sub-nav a, body .legal-tab,
  body .turn-nav a, body .vp-nav a, body .oa-bottom a {
    min-height:44px; display:inline-flex; align-items:center; font-size:.875rem;
  }
  body .admin-nav, body .sub-nav { scroll-padding-inline:12px; }
  body .admin-nav a, body .sub-nav a { padding:10px 12px; }
  body .app-shell .card, body .app-shell .stat-card { border-radius:12px; box-shadow:var(--shadow-xs); }
  body .app-shell .section-title, body .app-shell .list-item-title { font-size:.9375rem; }
  body .app-shell .stat-label, body .app-shell .list-item-subtitle,
  body .app-shell .recent-bu-meta, body .app-shell .quick-action p {
    font-size:.75rem; line-height:1.4; color:var(--gray-600);
  }
  body .app-shell .stat-value { font-size:1.375rem; }
  body .app-shell .quick-action h4 { font-size:.875rem; }
  body .app-shell .empty-state { padding:24px 16px; }
  body .app-shell .empty-state-icon { font-size:2rem; margin-bottom:12px; }
  body .app-shell .modal-sheet { max-height:calc(100dvh - var(--safe-top) - 24px); }
  body .app-shell .modal-sheet .form-label { font-size:.875rem; }
  body .app-shell .profile-header { padding:16px; }
  body .app-shell .profile-header h2 { font-size:1.375rem; }
  body .app-shell .users-header { padding:calc(16px + var(--safe-top)) 16px 16px; gap:12px; }
  body .app-shell .users-header h1 { font-size:1.375rem; }
  body .app-shell .users-main { padding:16px; }
  body .app-shell .users-summary { gap:8px; }
  body .app-shell .user-card { padding:14px; border-radius:12px; }
  body .app-shell .data-mode-notice { font-size:.8125rem; padding:10px 12px; }
  body .volunteer-reminder { margin:12px; padding:12px; gap:10px; }
  body .volunteer-reminder p { font-size:.875rem; }

  /* Pages outside .app-shell share the same compact hierarchy. */
  body .vp-shell, body .vc-shell, body .oa-shell, body .reference-page,
  body .public-bu-page, body .la-shell, body .tt-wrap, body .align-shell,
  body .shell, body .urn-shell {
    padding-left:max(16px,var(--safe-left,env(safe-area-inset-left,0px)));
    padding-right:max(16px,var(--safe-right,env(safe-area-inset-right,0px)));
  }
  body .vp-shell h1, body .vc-shell h1, body .oa-shell h1,
  body .reference-page h1, body .public-bu-header h1, body .la-hero h1,
  body .tt-hero h1, body .align-intro h1, body .shell h1,
  body .urn-heading h1 { font-size:1.5rem; line-height:1.25; letter-spacing:-.02em; }
  body .vp-shell h2, body .vc-shell h2, body .oa-shell h2,
  body .reference-page h2, body .la-shell h2, body .tt-wrap h2,
  body .align-shell h2, body .shell h2 { font-size:1.125rem; line-height:1.35; }
  body .vp-shell h1, body .reference-page header { margin:12px 0; }
  body .vc-header { margin-bottom:16px; gap:12px; }
  body .vc-intro, body .oa-intro, body .shell .intro,
  body .la-lead, body .tt-intro { font-size:.9375rem; line-height:1.6; }
  body .vp-card, body .vp-location, body .vc-map-panel, body .vc-list-panel,
  body .vc-detail, body .vc-callout, body .oa-card, body .reference-page section,
  body .reference-card, body .align-panel, body .la-panel, body .tt-panel,
  body .shell .tool, body .shell .pending {
    padding:14px; border-radius:12px;
  }
  body .vp-card, body .vp-location, body .oa-card, body .reference-page section { margin-block:12px; }
  body .public-bu-header { padding:16px; gap:12px; border-radius:14px; box-shadow:none; }
  body .public-bu-header h1 { margin:8px 0; }
  body .public-bu-brand { gap:10px; margin-bottom:16px; flex-wrap:wrap; }
  body .public-bu-page .public-bu-filters { padding:12px; gap:8px; }
  body .public-bu-filters label { font-size:.875rem; }
  body .public-bu-card { padding:14px; }
  body .oa-shell { padding-top:16px; }
  body .oa-tabs { margin:12px 0; gap:6px; }
  body .oa-tabs button { font-size:.875rem; }
  body .oa-metric { padding:12px; border-radius:10px; }
  body .oa-metric strong, body .vc-stats strong { font-size:1.5rem; }
  body .oa-metric span, body .oa-note, body .vp-note { font-size:.8125rem; }
  body .vc-controls { margin-top:16px; }
  body .reference-input { gap:8px; margin-bottom:12px; }
  body .reference-page .reference-note { padding:12px; font-size:.875rem; }
  body .shell { padding-top:24px; }
  body .shell .turn-nav { margin:20px 0 24px; flex-wrap:wrap; gap:6px; }
  body .shell .tools { gap:12px; }
  body .shell .tool h3 { font-size:1.125rem; margin:12px 0 8px; }
  body .shell .tool p { font-size:.9375rem; margin-bottom:16px; }
  body .shell .scope { margin-top:24px; padding-top:16px; }
  body .urn-filters, body .urn-candidates, body .urn-model-breakdown { padding:12px; }
  body .urn-label, body .urn-model-options label, body .urn-model-label small,
  body .urn-state-picker summary, body .urn-state-options label { font-size:.8125rem; }
  body .urn-model-options label, body .urn-state-options label { min-height:44px; }
  body .urn-heading { padding-top:16px; }
  body .urn-heading p, body .urn-status, body .urn-inline-note,
  body .urn-evidence-note p, body .urn-footer { font-size:.8125rem; }
  body .urn-back { min-height:44px; font-size:.875rem; }
  body .la-top, body .tt-top, body .align-header { gap:10px; }
  body .la-hero, body .align-intro { padding-top:20px; padding-bottom:16px; }
  body .tt-hero { padding-block:24px; }
  body .la-hero h1, body .tt-hero h1 { margin-bottom:12px; }
  body .proto-header h1 { font-size:1.5rem; }
  body .proto-header { padding:calc(16px + var(--safe-top)) 16px 16px; }
  body .proto-body { padding:16px; }
  body .hero-section h1 { font-size:1.875rem; line-height:1.2; }
  body #mainNav .navbar-brand { font-size:.875rem; }
  body #mainNav .navbar-toggler { min-width:44px; min-height:44px; }
}

/* Compact secondary actions and page headers, preserving native touch targets. */
@media screen and (max-width:767px) {
  body .app-shell .btn { gap:6px; padding:8px 12px; font-weight:500; border-radius:10px; }
  body .app-shell .btn-lg { padding:8px 12px; }
  body .app-shell .btn-outline {
    background:#fff; color:var(--primary-700); border:1px solid var(--gray-200);
  }
  body .app-shell .btn-outline:hover { background:var(--gray-50); }
  body .app-shell .btn:focus-visible { outline:2px solid var(--primary-500); outline-offset:2px; }
  body .volunteer-reminder {
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px;
    margin:8px 12px; padding:10px 12px; align-items:center;
  }
  body .volunteer-reminder > div { min-width:0; }
  body .volunteer-reminder strong { font-size:.8125rem; font-weight:600; }
  body .volunteer-reminder p { font-size:.75rem; line-height:1.45; margin:4px 0 0; }
  body .volunteer-reminder .btn { width:auto; max-width:112px; min-height:44px; font-size:.8125rem; padding:8px 10px; }

  body[data-route="perfil"] .profile-header {
    display:grid; grid-template-columns:56px minmax(0,1fr); column-gap:12px;
    padding:16px; text-align:left; align-items:center;
  }
  body[data-route="perfil"] .profile-avatar {
    grid-row:1 / 3; width:56px; height:56px; margin:0; border-width:2px;
    font-size:1.25rem; font-weight:600;
  }
  body[data-route="perfil"] .profile-name { font-size:1rem; line-height:1.35; font-weight:600; overflow-wrap:anywhere; }
  body[data-route="perfil"] .profile-role { justify-content:flex-start; flex-wrap:wrap; opacity:1; font-size:.75rem; overflow-wrap:anywhere; }
  body[data-route="perfil"] .profile-role .badge { font-size:.6875rem; font-weight:500; }
  body[data-route="perfil"] .profile-stats { grid-column:1 / -1; margin-top:12px; }
  body[data-route="perfil"] .profile-stat { padding:10px 6px; }
  body[data-route="perfil"] .profile-stat .val { font-size:1.125rem; font-weight:600; }
  body[data-route="perfil"] .profile-stat .lbl { font-size:.6875rem; line-height:1.4; text-transform:none; letter-spacing:0; opacity:.9; }
  body[data-route="perfil"] .menu-section { padding:12px 16px; }
  body[data-route="perfil"] .menu-item { padding:10px 0; min-height:44px; gap:10px; }
  body[data-route="perfil"] .menu-item-content { min-width:0; overflow-wrap:anywhere; }
  body[data-route="perfil"] .menu-item-title { font-weight:500; }
  body[data-route="perfil"] .menu-section-title { font-size:.75rem; letter-spacing:.02em; font-weight:600; }
  body[data-route="perfil"] .version-info { padding:12px 16px; }

  body .app-shell .import-hero, body .app-shell .sim-hero { padding:14px 12px; text-align:left; }
  body .app-shell .import-hero > i, body .app-shell .sim-hero > i { font-size:1.75rem; margin-bottom:6px; }
  body .app-shell .sim-hero h1, body .app-shell .import-hero h2 { font-size:1rem; font-weight:600; }
  body .vc-controls { gap:8px; }
  body .vc-controls > .btn { width:auto; flex:0 1 auto; padding:8px 12px; font-size:.875rem; min-height:44px; }
  body .tt-stages { margin-top:14px; }
  body .tt-stages button { padding:10px 12px; gap:2px; }
  body .tt-stages strong { font-size:.875rem; font-weight:600; }
  body .tt-stages small { font-size:.75rem; line-height:1.4; }
  body .align-state-card { padding:12px; gap:4px 8px; }
  body .align-state-card strong { font-size:.875rem; font-weight:600; }
  body .align-panel .align-section-heading { margin-bottom:12px; }
  body .hero-section h1 { font-size:1.625rem; line-height:1.25; }
  body .study-heading h2, body .participation-heading h2, body .display-5 { font-size:1.375rem; line-height:1.3; }
}

/* Navegação cidadã única: reserva espaço também nas páginas independentes. */
body.has-bottomnav { padding-bottom:calc(var(--bottomnav-height) + env(safe-area-inset-bottom,0px) + 24px); }
.bottomnav-item { position:relative; min-width:0; min-height:44px; }
.bottomnav-capture { color:var(--primary-700); background:var(--primary-50); border-radius:12px 12px 0 0; }
.bottomnav-queue { position:absolute; top:2px; right:12%; border-radius:12px; background:#a32929; color:#fff; padding:2px 6px; font-size:12px; }
.bottomnav-queue[hidden] { display:none; }

.result-filters { background:#fff; }
.result-filters summary { padding:8px 12px; min-height:44px; cursor:pointer; color:var(--primary-800); font-size:.875rem; }
.result-filters .filter-strip { display:flex; overflow:visible; flex-wrap:wrap; gap:8px; }
.result-filter-field { flex:1 1 160px; min-width:0; }
.result-filter-field label { display:block; margin-bottom:4px; font-size:.8125rem; color:var(--gray-700); }
.result-filter-field select { width:100%; max-width:none; min-height:44px; }
.result-tabs button { background:#fff; border:0; border-bottom:2px solid transparent; font:inherit; font-size:.8125rem; min-height:44px; }
.result-tabs button.active { border-bottom-color:var(--primary-700); }
@media(min-width:601px) { .result-filters summary { display:none; } }
@media(max-width:600px) { .result-filter-field { flex:1 1 100%; } }

.counting-choice { display:flex; gap:8px; align-items:start; padding:8px 12px; background:#fff; }
.counting-segments { display:flex; flex:1; gap:4px; }
.counting-segments button { flex:1; min-height:44px; padding:6px 8px; border:1px solid var(--gray-300); border-radius:8px; background:#fff; font:inherit; font-size:.8125rem; color:var(--primary-800); }
.counting-segments button[aria-pressed="true"] { background:var(--primary-800); color:#fff; }
.counting-help { flex:0 0 44px; }
.counting-help summary { min-height:44px; display:flex; justify-content:center; align-items:center; cursor:pointer; font-size:1.25rem; }
.counting-help[open] { flex:1 1 100%; }
.counting-choice:has(.counting-help[open]) { flex-wrap:wrap; }
.counting-help p { font-size:.875rem; line-height:1.5; }
.sample-warning { margin:0; padding:6px 12px; background:#fff4d6; color:#704b00; font-size:.8125rem; }
.sample-warning[hidden] { display:none; }
@media(max-width:600px) {
 body[data-route="resultados"] .result-hero { padding:10px 12px; }
 body[data-route="resultados"] .result-hero-stats { margin-top:8px; gap:8px; }
 body[data-route="resultados"] .result-hero-stat .val { font-size:1.125rem; }
 body[data-route="resultados"] .result-hero-stat .lbl { font-size:.75rem; }
 body[data-route="resultados"] #hero-live-badge { display:none; }
 body[data-route="resultados"] .topbar { min-height:52px; height:calc(52px + var(--safe-top)); }
}

.data-mode-notice[hidden] { display:none!important; }
body .data-mode-notice[data-mode="oficial"] { width:fit-content; padding:3px 12px; margin:4px 12px; border:0; border-radius:16px; font-size:.75rem; }
body .data-mode-notice[data-mode="simulado"] { display:block!important; margin:0; padding:10px 12px; color:#704b00; background:#fff0c2; font-weight:600; }

.ui-loading { min-height:96px; border-radius:12px; padding:12px; background:linear-gradient(90deg,#eef1f5,#fff,#eef1f5); background-size:200% 100%; animation:ui-shimmer 1.5s linear infinite; }
@keyframes ui-shimmer { to { background-position:-200% 0; } }
@media(prefers-reduced-motion:reduce) { .ui-loading { animation:none; } }
.ui-offline { margin:8px 12px; padding:8px 12px; background:#fff4d6; color:#704b00; font-size:.875rem; }
.ui-offline[hidden] { display:none; }
[data-state="empty"] .btn,[data-state="error"] .btn { margin:4px 8px 4px 0; }

body[data-route="envio-bu"] .stepper { display:flex; position:sticky; top:var(--topbar-safe-height); z-index:90; padding:8px 12px; margin:0; background:#fff; }
body[data-route="envio-bu"] .stepper-circle { width:24px; height:24px; font-size:.75rem; }
body[data-route="envio-bu"] .stepper-step { flex-direction:row; gap:6px; }
body[data-route="envio-bu"] .stepper-label { font-size:.75rem; }
body[data-route="envio-bu"] .stepper-line { margin:0 8px; }
.capture-heading { font-size:1rem; font-weight:600; margin-bottom:4px; color:var(--gray-800); }
.capture-success-heading { font-size:1.3rem; font-weight:600; margin-bottom:4px; color:var(--gray-900); }
#qrReadFeedback { font-size:.875rem; color:var(--primary-800); margin:8px 0; }
@media(max-width:600px) {
 body[data-route="envio-bu"] #step3.active { padding-bottom:80px; }
 body[data-route="envio-bu"] #step3.active #btnSave { position:fixed; bottom:calc(var(--bottomnav-height) + env(safe-area-inset-bottom,0px) + 8px); left:12px; width:calc(100% - 24px); min-height:48px; z-index:101; }
 html.keyboard-open body[data-route="envio-bu"] #step3.active #btnSave { position:static; width:100%; }
}

.field-error { color:#a32929; font-size:.875rem; margin:4px 0; }
[aria-invalid="true"] { border-color:#a32929; }
.auth-card .auth-public-access { padding:8px 0 0; margin:0; display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.auth-card .auth-public-access p { width:100%; margin:0; font-size:.875rem; color:var(--gray-700); }
.auth-card .auth-public-access .btn { min-height:44px; font-size:.875rem; }

body[data-route="observatorio"] button,body[data-route="observatorio"] .oa-action { min-height:44px; padding:8px 12px; border-radius:10px; background:var(--primary-700); color:#fff; font-weight:500; }
body[data-route="observatorio"] .oa-tabs button { background:#fff; color:var(--primary-700); border-color:var(--gray-300); }
body[data-route="observatorio"] .oa-tabs button[aria-selected="true"] { background:var(--primary-700); color:#fff; }
body[data-route="observatorio"] h1 { font-size:1.5rem; font-weight:600; }
body[data-route="observatorio"] .oa-actions { display:flex; flex-wrap:wrap; gap:8px; }
body[data-route="observatorio"] .oa-actions a { min-height:44px; display:inline-flex; align-items:center; }

body .topbar-title .data-mode-notice[data-mode="oficial"] { display:inline-block; font-size:.6875rem; font-weight:400; line-height:1.3; padding:1px 5px; margin:0 0 0 6px; vertical-align:middle; }
@media(max-width:600px) {
 body[data-route="resultados"] .result-hero { padding:8px 12px; }
 body[data-route="resultados"] .result-hero #hero-title { margin-top:0!important; font-size:1rem!important; line-height:1.3; }
 body[data-route="resultados"] .result-hero-stats { margin-top:6px; }
 body[data-route="resultados"] .result-hero-stat .val { line-height:1.3; }
 body[data-route="resultados"] .result-hero-stat .lbl { line-height:1.3; margin-top:2px; }
 body[data-route="resultados"] .counting-segments button { line-height:1.25; min-height:44px; }
 body[data-route="resultados"] .apuracao-bar { padding:4px 12px; }
 body[data-route="resultados"] .sample-warning { padding:4px 12px; line-height:1.3; }
}

body[data-route="envio-bu"] .stepper-label { display:inline!important; }
body[data-route="envio-bu"] #step1 .page-padding>#qrReadFeedback { display:block!important; }
body[data-route="envio-bu"] .data-mode-notice[data-mode="simulado"] { display:block!important; position:relative; }

body[data-route^="estudos-2026-"] header.topbar { height:auto; min-height:64px; align-items:center; flex-wrap:wrap; gap:8px 12px; padding:12px; }
body[data-route^="estudos-2026-"] header.topbar .brand { min-width:0; flex:1 1 220px; }
body[data-route^="estudos-2026-"] header.topbar>a:not(.brand) { min-height:44px; display:flex; align-items:center; }

@media(min-width:601px) { .result-filter-field { flex:1 1 200px; min-width:200px; } .counting-segments { max-width:720px; } }

body .landing-simulation-notice[data-mode="simulado"] { margin-top:calc(72px + env(safe-area-inset-top,0px)); }

@media(max-width:360px) { body[data-route] .bottomnav-item { padding:6px 2px; } }

.capture-inline-action { display:flex; margin:12px; min-height:44px; position:static; }
