/* Terra V8 — tres temas, uma unica gramatica de cor.
   As chaves `terra`, `aurora` e `night` permanecem por compatibilidade com
   cookies e testes; os nomes apresentados sao Branco, Verde e Escuro. */

:root,
:root[data-site-theme="terra"],
body[data-site-theme="terra"] {
  color-scheme: light;

  --theme-canvas: #f4f7f5;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #f0f4f2;
  --theme-surface-raised: #ffffff;
  --theme-surface-hover: #e8efeb;
  --theme-text: #17211d;
  --theme-text-muted: #56645e;
  --theme-text-subtle: #68766f;
  --theme-border: #d4ddd8;
  --theme-border-strong: #aab8b0;
  --theme-accent: #0b735c;
  --theme-accent-hover: #075b49;
  --theme-accent-soft: #e2f1ec;
  --theme-on-accent: #ffffff;
  --theme-danger: #b42318;
  --theme-danger-soft: #fce8e6;
  --theme-warning: #8a4b08;
  --theme-warning-soft: #fff1dc;
  --theme-success: #087a55;
  --theme-success-soft: #def3e9;
  --theme-focus: #0b735c;
  --theme-shadow-sm: 0 4px 14px rgba(23, 33, 29, 0.08);
  --theme-shadow-md: 0 14px 38px rgba(23, 33, 29, 0.12);
  --theme-shadow-lg: 0 28px 72px rgba(23, 33, 29, 0.22);

  --theme-topbar: #ffffff;
  --theme-topbar-text: #17211d;
  --theme-topbar-muted: #5f6d66;
  --theme-topbar-border: #dce3df;
  --theme-topbar-control: #f2f5f3;
  --theme-topbar-control-hover: #e5ece8;
  --theme-tab-active: #dcece6;
  --theme-tab-active-text: #075b49;

  --theme-map-surface: rgba(255, 255, 255, 0.94);
  --theme-map-surface-strong: rgba(255, 255, 255, 0.98);
  --theme-map-hover: rgba(232, 239, 235, 0.98);
  --theme-map-text: #17211d;
  --theme-map-muted: #56645e;
  --theme-map-border: rgba(71, 91, 81, 0.22);
  --theme-map-border-strong: rgba(71, 91, 81, 0.42);
  --theme-map-accent: #0b735c;
  --theme-map-accent-soft: rgba(11, 115, 92, 0.13);
  --theme-map-on-accent: #ffffff;
  --theme-map-sheen: rgba(255, 255, 255, 0.9);
  --theme-map-shadow: 0 10px 28px rgba(23, 33, 29, 0.16);
  --theme-map-shadow-raised: 0 18px 44px rgba(23, 33, 29, 0.22);
  --theme-filter-card: rgba(255, 255, 255, 0.68);
  --theme-filter-card-current: rgba(255, 255, 255, 0.94);
  --theme-filter-field: rgba(255, 255, 255, 0.84);
}

html[data-site-theme="aurora"],
body[data-site-theme="aurora"] {
  color-scheme: light;

  --theme-canvas: #eaf2ed;
  --theme-surface: #f7fbf8;
  --theme-surface-subtle: #edf5f0;
  --theme-surface-raised: #ffffff;
  --theme-surface-hover: #dfece5;
  --theme-text: #123128;
  --theme-text-muted: #536d63;
  --theme-text-subtle: #607b70;
  --theme-border: #c1d4c9;
  --theme-border-strong: #91ae9f;
  --theme-accent: #176b52;
  --theme-accent-hover: #0e5942;
  --theme-accent-soft: #dcede4;
  --theme-on-accent: #ffffff;
  --theme-danger: #a82b20;
  --theme-danger-soft: #f8e5e2;
  --theme-warning: #80500d;
  --theme-warning-soft: #f7ead4;
  --theme-success: #126744;
  --theme-success-soft: #d9ede2;
  --theme-focus: #176b52;
  --theme-shadow-sm: 0 4px 14px rgba(18, 49, 40, 0.1);
  --theme-shadow-md: 0 14px 38px rgba(18, 49, 40, 0.16);
  --theme-shadow-lg: 0 28px 72px rgba(10, 40, 31, 0.28);

  --theme-topbar: #174436;
  --theme-topbar-text: #f5faf7;
  --theme-topbar-muted: #c1d7cd;
  --theme-topbar-border: #2d5f4f;
  --theme-topbar-control: rgba(255, 255, 255, 0.09);
  --theme-topbar-control-hover: rgba(255, 255, 255, 0.17);
  --theme-tab-active: #f1f7f3;
  --theme-tab-active-text: #174436;

  --theme-map-surface: rgba(23, 68, 54, 0.92);
  --theme-map-surface-strong: rgba(20, 61, 48, 0.98);
  --theme-map-hover: rgba(40, 91, 74, 0.97);
  --theme-map-text: #f5faf7;
  --theme-map-muted: #c1d7cd;
  --theme-map-border: rgba(213, 235, 224, 0.2);
  --theme-map-border-strong: rgba(213, 235, 224, 0.46);
  --theme-map-accent: #a6e3c6;
  --theme-map-accent-soft: rgba(166, 227, 198, 0.17);
  --theme-map-on-accent: #123128;
  --theme-map-sheen: rgba(255, 255, 255, 0.12);
  --theme-map-shadow: 0 12px 30px rgba(10, 40, 31, 0.3);
  --theme-map-shadow-raised: 0 18px 44px rgba(10, 40, 31, 0.4);
  --theme-filter-card: rgba(255, 255, 255, 0.055);
  --theme-filter-card-current: rgba(255, 255, 255, 0.1);
  --theme-filter-field: rgba(255, 255, 255, 0.075);
}

html[data-site-theme="night"],
body[data-site-theme="night"] {
  color-scheme: dark;

  --theme-canvas: #0e1411;
  --theme-surface: #171f1b;
  --theme-surface-subtle: #1d2823;
  --theme-surface-raised: #222d28;
  --theme-surface-hover: #293831;
  --theme-text: #f1f6f3;
  --theme-text-muted: #afbeb6;
  --theme-text-subtle: #96a79f;
  --theme-border: #34443c;
  --theme-border-strong: #52655c;
  --theme-accent: #4fd1a5;
  --theme-accent-hover: #72debc;
  --theme-accent-soft: rgba(79, 209, 165, 0.15);
  --theme-on-accent: #062119;
  --theme-danger: #ff8a82;
  --theme-danger-soft: rgba(255, 110, 101, 0.13);
  --theme-warning: #f1bf6c;
  --theme-warning-soft: rgba(241, 191, 108, 0.14);
  --theme-success: #63d8ad;
  --theme-success-soft: rgba(99, 216, 173, 0.14);
  --theme-focus: #65dcb5;
  --theme-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.28);
  --theme-shadow-md: 0 16px 42px rgba(0, 0, 0, 0.4);
  --theme-shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.58);

  --theme-topbar: #121915;
  --theme-topbar-text: #f1f6f3;
  --theme-topbar-muted: #afbeb6;
  --theme-topbar-border: #34443c;
  --theme-topbar-control: #1d2823;
  --theme-topbar-control-hover: #293831;
  --theme-tab-active: #4fd1a5;
  --theme-tab-active-text: #062119;

  --theme-map-surface: rgba(23, 31, 27, 0.94);
  --theme-map-surface-strong: rgba(23, 31, 27, 0.99);
  --theme-map-hover: rgba(41, 56, 49, 0.98);
  --theme-map-text: #f1f6f3;
  --theme-map-muted: #afbeb6;
  --theme-map-border: rgba(188, 211, 199, 0.18);
  --theme-map-border-strong: rgba(188, 211, 199, 0.4);
  --theme-map-accent: #4fd1a5;
  --theme-map-accent-soft: rgba(79, 209, 165, 0.15);
  --theme-map-on-accent: #062119;
  --theme-map-sheen: rgba(255, 255, 255, 0.08);
  --theme-map-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
  --theme-map-shadow-raised: 0 20px 50px rgba(0, 0, 0, 0.6);
  --theme-filter-card: rgba(255, 255, 255, 0.045);
  --theme-filter-card-current: rgba(255, 255, 255, 0.085);
  --theme-filter-field: rgba(255, 255, 255, 0.065);
}

/* Compatibilidade: componentes antigos passam a consumir a mesma paleta. */
html[data-site-theme],
body[data-site-theme] {
  --brand-night: var(--theme-text);
  --brand-deep: var(--theme-text);
  --brand-forest: var(--theme-accent-hover);
  --brand-forest-soft: var(--theme-accent);
  --brand-gold: var(--theme-accent);
  --brand-gold-strong: var(--theme-accent-hover);
  --brand-gold-soft: var(--theme-accent-soft);
  --brand-cream: var(--theme-surface-subtle);
  --brand-cream-strong: var(--theme-surface);
  --brand-mist: var(--theme-surface-subtle);
  --brand-line: var(--theme-border);
  --shell-ink: var(--theme-text);
  --shell-line: var(--theme-border);
  --shell-gold: var(--theme-accent);
  --shell-mist: var(--theme-surface-subtle);
  --page-bg: var(--theme-canvas);
  --page-bg-authenticated: var(--theme-canvas);
  --app-shell-bg: var(--theme-canvas);
  --analyses-bg: var(--theme-canvas);
  --surface-card-bg: var(--theme-surface);
  --surface-card-glow: var(--theme-accent-soft);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--theme-focus) 30%, transparent);

  --v4-navy: var(--theme-text);
  --v4-navy-2: var(--theme-surface-subtle);
  --v4-petroleo: var(--theme-text);
  --v4-petroleo-2: var(--theme-accent-hover);
  --v4-verde: var(--theme-accent);
  --v4-aqua: var(--theme-accent);
  --v4-areia: var(--theme-border-strong);
  --v4-areia-soft: var(--theme-surface-subtle);
  --v4-neve: var(--theme-surface-subtle);
  --v4-paper: var(--theme-surface);
  --v4-ink: var(--theme-text);
  --v4-ink-soft: var(--theme-text-muted);
  --v4-ink-mute: var(--theme-text-subtle);
  --v4-line: var(--theme-border);
  --v4-line-strong: var(--theme-border-strong);
  --v4-danger: var(--theme-danger);

  --v5-accent: var(--theme-accent);
  --v5-accent-strong: var(--theme-accent-hover);
  --v5-chrome-ink: var(--theme-topbar);
  --v5-chrome-ink-deep: var(--theme-topbar);
  --v5-surface: var(--theme-surface);
  --v5-surface-hover: var(--theme-surface-hover);
  --v5-surface-solid: var(--theme-surface-raised);
  --v5-hairline: var(--theme-border);
  --v5-hairline-strong: var(--theme-border-strong);
  --v5-text: var(--theme-text);
  --v5-text-soft: var(--theme-text-muted);
  --v5-text-faint: var(--theme-text-subtle);
  --v5-accent-on-white: var(--theme-accent);

  --top-bar-bg: var(--theme-topbar);
  --nav-text: var(--theme-topbar-text);
  --nav-text-soft: var(--theme-topbar-muted);
  --nav-active-text: var(--theme-tab-active-text);
  --nav-topbar-gradient: none;
  --nav-topbar-border: var(--theme-topbar-border);
  --nav-topbar-shadow: var(--theme-shadow-sm);
  --nav-tabs-bg: var(--theme-topbar-control);
  --nav-tabs-border: var(--theme-topbar-border);
  --nav-tabs-sheen: rgba(255, 255, 255, 0.08);
  --nav-control-bg: var(--theme-topbar-control);
  --nav-control-border: var(--theme-topbar-border);
  --nav-control-sheen: rgba(255, 255, 255, 0.08);
  --nav-control-hover-bg: var(--theme-topbar-control-hover);
  --nav-control-hover-border: var(--theme-border-strong);
  --nav-control-hover-text: var(--theme-topbar-text);
  --nav-search-panel-bg: var(--theme-topbar-control);
  --nav-search-panel-border: var(--theme-topbar-border);
  --nav-search-field-bg: var(--theme-topbar-control);
  --nav-logo-shadow: var(--theme-shadow-sm);

  --map-glass-bg: var(--theme-map-surface);
  --map-glass-bg-strong: var(--theme-map-surface-strong);
  --map-glass-bg-hover: var(--theme-map-hover);
  --map-glass-border: var(--theme-map-border);
  --map-glass-border-strong: var(--theme-map-border-strong);
  --map-glass-text: var(--theme-map-text);
  --map-glass-muted: var(--theme-map-muted);
  --map-glass-accent: var(--theme-map-accent);
  --map-glass-accent-soft: var(--theme-map-accent-soft);
  --map-glass-on-accent: var(--theme-map-on-accent);
  --map-glass-sheen: var(--theme-map-sheen);
  --map-glass-shadow: var(--theme-map-shadow);
  --map-glass-shadow-raised: var(--theme-map-shadow-raised);
  --filter-card-bg: var(--theme-filter-card);
  --filter-card-bg-current: var(--theme-filter-card-current);
  --filter-field-bg: var(--theme-filter-field);
  accent-color: var(--theme-accent);
}

body,
.app-shell,
.analyses-view,
.administration-view {
  background: var(--theme-canvas) !important;
  color: var(--theme-text) !important;
}

::selection {
  background: var(--theme-accent-soft);
  color: var(--theme-text);
}

/* Topbar: fundo solido e legivel em vez de gradientes cinza/azul. */
.top-bar {
  background: var(--theme-topbar) !important;
  border-bottom: 1px solid var(--theme-topbar-border) !important;
  box-shadow: var(--theme-shadow-sm) !important;
}

.top-bar::after {
  display: none !important;
}

.top-nav-tabs::before {
  background: var(--theme-tab-active) !important;
  box-shadow: none !important;
}

.top-nav-tabs .top-nav-tab {
  color: var(--theme-topbar-muted) !important;
}

.top-nav-tabs .top-nav-tab:hover:not(.is-active) {
  color: var(--theme-topbar-text) !important;
}

.top-nav-tabs .top-nav-tab.is-active,
.top-nav-tabs .top-nav-tab[aria-selected="true"] {
  color: var(--theme-tab-active-text) !important;
}

.top-bar .logo-mark {
  background: #ffffff !important;
  border: 1px solid rgba(23, 33, 29, 0.1) !important;
  box-shadow: var(--theme-shadow-sm) !important;
}

.top-bar .search-container .search-disclosure-btn,
.top-bar .tour-launch-btn,
.top-bar .auth-client-select,
.top-bar .topbar-scope,
.top-bar #authAccountMenuBtn,
.top-bar .map-inspector-eye {
  background: var(--theme-topbar-control) !important;
  border-color: var(--theme-topbar-border) !important;
  color: var(--theme-topbar-text) !important;
  box-shadow: none !important;
}

.top-bar .search-container .search-disclosure-btn:hover,
.top-bar .tour-launch-btn:hover,
.top-bar .auth-client-select:hover,
.top-bar .topbar-scope:hover,
.top-bar #authAccountMenuBtn:hover,
.top-bar #authAccountMenuBtn[aria-expanded="true"] {
  background: var(--theme-topbar-control-hover) !important;
  border-color: var(--theme-border-strong) !important;
  color: var(--theme-topbar-text) !important;
}

#authAccountMenuLabel,
.top-btn-account-initials {
  background: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
}

html[data-site-theme="night"] #authAccountMenuLabel,
html[data-site-theme="night"] .top-btn-account-initials {
  color: var(--theme-on-accent) !important;
}

.top-btn-account-copy strong,
.topbar-search-panel .search-input,
.topbar-search-panel .search-mode-select {
  color: var(--theme-topbar-text) !important;
}

.top-btn-account-copy small,
.topbar-scope-caption,
.topbar-search-panel .search-input::placeholder {
  color: var(--theme-topbar-muted) !important;
}

/* Menus elevados e seletor de tema. */
.account-menu-panel,
.search-results,
.topbar-search-panel .search-results {
  background: var(--theme-surface-raised) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-md) !important;
}

#authAccountMenuPanel .account-menu-identity-text strong,
#authAccountMenuPanel .account-menu-item,
#authAccountMenuPanel .account-menu-theme-label {
  color: var(--theme-text) !important;
}

.account-menu-divider {
  background: var(--theme-border) !important;
}

#authAccountMenuPanel .account-menu-item:hover,
#authAccountMenuPanel .account-menu-item:focus-visible {
  background: var(--theme-surface-hover) !important;
  color: var(--theme-text) !important;
}

#authAccountMenuPanel .account-menu-item-danger,
#authAccountMenuPanel .account-menu-item-danger i {
  color: var(--theme-danger) !important;
}

#authAccountMenuPanel .account-menu-item-danger:hover {
  background: var(--theme-danger-soft) !important;
  color: var(--theme-danger) !important;
}

#authAccountMenuPanel .account-menu-item i {
  color: var(--theme-accent) !important;
}

#authAccountMenuPanel .topbar-scope {
  background: var(--theme-surface-subtle) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

#authAccountMenuPanel .topbar-scope-caption {
  color: var(--theme-text-muted) !important;
}

#authAccountMenuPanel .topbar-scope-icon {
  color: var(--theme-accent) !important;
}

#authAccountMenuPanel .auth-client-select {
  background: var(--theme-surface-raised) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

#authAccountMenuPanel .auth-client-select option {
  background: var(--theme-surface-raised) !important;
  color: var(--theme-text) !important;
}

.account-menu-theme-options {
  gap: 6px !important;
}

#authAccountMenuPanel .account-menu-theme-opt {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 44px !important;
  border: 1px solid var(--theme-border) !important;
  background: var(--theme-surface-subtle) !important;
  color: var(--theme-text-muted) !important;
}

#authAccountMenuPanel .account-menu-theme-opt::before {
  width: 8px;
  height: 8px;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  border-radius: 999px;
  background: #ffffff;
  content: "";
}

#authAccountMenuPanel .account-menu-theme-opt[data-site-theme="aurora"]::before {
  background: #176b52;
}

#authAccountMenuPanel .account-menu-theme-opt[data-site-theme="night"]::before {
  background: #171f1b;
}

#authAccountMenuPanel .account-menu-theme-opt:hover,
#authAccountMenuPanel .account-menu-theme-opt:focus-visible {
  border-color: var(--theme-border-strong) !important;
  background: var(--theme-surface-hover) !important;
  color: var(--theme-text) !important;
}

#authAccountMenuPanel .account-menu-theme-opt.is-active,
#authAccountMenuPanel .account-menu-theme-opt[aria-checked="true"] {
  border-color: var(--theme-accent) !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  box-shadow: inset 0 0 0 1px var(--theme-accent) !important;
}

/* Controles sobre o mapa e filtros seguem a paleta do tema. */
html[data-site-theme] :is(.map-filter-control, .sidebar),
body[data-site-theme] :is(.map-filter-control, .sidebar) {
  --map-glass-bg: var(--theme-map-surface);
  --map-glass-bg-strong: var(--theme-map-surface-strong);
  --map-glass-bg-hover: var(--theme-map-hover);
  --map-glass-border: var(--theme-map-border);
  --map-glass-border-strong: var(--theme-map-border-strong);
  --map-glass-text: var(--theme-map-text);
  --map-glass-muted: var(--theme-map-muted);
  --map-glass-accent: var(--theme-map-accent);
  --map-glass-accent-soft: var(--theme-map-accent-soft);
  --map-glass-on-accent: var(--theme-map-on-accent);
  --map-glass-sheen: var(--theme-map-sheen);
  --map-glass-shadow: var(--theme-map-shadow);
  --map-glass-shadow-raised: var(--theme-map-shadow-raised);
}

.sidebar,
.map-filter-toggle,
#baseMapPicker > summary,
.map-controls,
.map-thumbnails-floating,
.leaflet-upload-actions.leaflet-upload-segmented {
  background: var(--map-glass-bg) !important;
  border-color: var(--map-glass-border) !important;
  color: var(--map-glass-text) !important;
  box-shadow: inset 0 1px 0 var(--map-glass-sheen), var(--map-glass-shadow) !important;
}

.sidebar .estado-filter-search,
.sidebar .fx-select .filter-select,
.sidebar .fx-pill,
.sidebar .estado-active-chip {
  background-color: color-mix(in srgb, var(--map-glass-bg-strong) 86%, transparent) !important;
}

.sidebar .estado-filter-search::placeholder,
.sidebar input::placeholder {
  color: var(--map-glass-muted) !important;
  opacity: 1 !important;
}

/* Vistas internas. */
.analyses-hero,
.analysis-summary-card,
.analysis-card,
.administration-hero,
.administration-card,
.administration-dataset-item,
.administration-assets-metrics article,
.administration-assets-panel,
.administration-assets-recommendation {
  background: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-sm) !important;
}

.analysis-signal-card,
.analysis-public-item,
.analysis-list-item,
.analysis-qa-result,
.analysis-qa-input,
.analysis-lulc-panel,
.analysis-lulc-year,
.analysis-lulc-detail-item {
  background: var(--theme-surface-subtle) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

.analyses-hero h1,
.analysis-card h3,
.analysis-insight-grid h4,
.analysis-summary-card span,
.analysis-signal-card span,
.analysis-public-item span,
.analysis-list-item-head strong,
.analysis-list-item-area,
.administration-hero h1,
.administration-card h2,
.administration-dataset-main strong,
.administration-assets-metrics strong,
.administration-assets-panel h3,
.administration-assets-row b,
.administration-assets-recommendation strong {
  color: var(--theme-text) !important;
}

.analyses-hero p,
.analysis-empty,
.analysis-qa-head p,
.analysis-qa-hint,
.analysis-summary-card small,
.analysis-signal-card small,
.analysis-public-item small,
.analysis-list-item-head span,
.analysis-list-item-meta span,
.analysis-breakdown-row span,
.administration-hero p,
.administration-filter-label,
.administration-dataset-main span,
.administration-assets-metrics span,
.administration-assets-metrics small,
.administration-assets-row span,
.administration-assets-recommendation p {
  color: var(--theme-text-muted) !important;
}

.analyses-kicker,
.analysis-card-kicker,
.analysis-mini-map-head strong,
.administration-dataset-main span.administration-dataset-locality {
  color: var(--theme-accent) !important;
}

.analyses-mode-pill,
.analysis-status-pill,
.analysis-qa-badge,
.analysis-scope-chip,
.administration-count {
  border-color: color-mix(in srgb, var(--theme-accent) 35%, transparent) !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
}

.analysis-primary-btn,
.modal-footer .btn-primary:not(:disabled),
.profile-modal .auth-submit-btn,
.user-settings-modal .auth-submit-btn,
.auth-admin-modal .auth-submit-btn {
  border-color: var(--theme-accent) !important;
  background: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  box-shadow: none !important;
}

.analysis-primary-btn:not(:disabled):hover,
.modal-footer .btn-primary:not(:disabled):hover,
.profile-modal .auth-submit-btn:hover,
.user-settings-modal .auth-submit-btn:hover,
.auth-admin-modal .auth-submit-btn:hover {
  background: var(--theme-accent-hover) !important;
}

.analysis-secondary-btn,
.analysis-ghost-btn,
.analysis-inline-btn,
.administration-filter-select,
.profile-modal #userSettingsManagedClientFarmBaseBtn {
  border-color: var(--theme-border) !important;
  background: var(--theme-surface-raised) !important;
  color: var(--theme-text) !important;
}

.analysis-secondary-btn:not(:disabled):hover,
.analysis-ghost-btn:not(:disabled):hover,
.analysis-inline-btn:not(:disabled):hover {
  border-color: var(--theme-accent) !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
}

.analysis-primary-btn:disabled,
.analysis-secondary-btn:disabled,
.analysis-ghost-btn:disabled,
.analysis-inline-btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  border-color: var(--theme-border) !important;
  background: var(--theme-surface-subtle) !important;
  color: var(--theme-text-subtle) !important;
  opacity: 0.72 !important;
}

/* Modais e formularios: contraste consistente inclusive no tema escuro. */
.modal {
  background-color: color-mix(in srgb, #07100c 58%, transparent) !important;
}

.modal-content,
#userSettingsModal .profile-modal {
  background: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-lg) !important;
}

.modal-header,
.modal-body,
.modal-footer,
#userSettingsModal .profile-modal-header,
.report-modal-header,
.report-modal-body,
.report-modal-footer,
.upload-modal-header,
.upload-modal-body {
  background: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

.modal-header h2,
.modal-header h3,
.modal-body h2,
.modal-body h3,
.report-modal-header h2,
.report-type-option strong,
.profile-modal-heading h2 {
  color: var(--theme-text) !important;
}

.modal-header p,
.modal-body p,
.report-modal-header p,
.report-type-option small,
.profile-modal-eyebrow,
.profile-block-description {
  color: var(--theme-text-muted) !important;
}

.modal-header .close,
.report-modal-header .close {
  color: var(--theme-text-muted) !important;
}

.modal-header .close:hover,
.report-modal-header .close:hover {
  background: var(--theme-surface-hover) !important;
  color: var(--theme-text) !important;
}

#reportModal .report-type-selector,
.report-type-selector,
.report-token-panel,
.profile-identity-card,
.profile-block,
.auth-admin-code-card,
.upload-analysis-preview {
  background: var(--theme-surface-subtle) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

#reportModal .report-type-option,
.report-type-option,
.report-public-card,
.report-kpi,
.report-scope-list,
.report-item,
.report-empty {
  background: var(--theme-surface-raised) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

#reportModal .report-type-option:hover,
.report-type-option:hover,
#reportModal .report-type-option:has(input:checked),
.report-type-option:has(input:checked) {
  border-color: var(--theme-accent) !important;
  background: var(--theme-accent-soft) !important;
  box-shadow: none !important;
}

#reportModal .report-type-option .report-type-icon,
.report-type-option .report-type-icon,
.report-token-icon {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
}

#reportModal .report-type-option .report-type-topline em,
.report-type-option .report-type-topline em,
.report-selection-badge,
.report-public-count,
.report-item-tag {
  background: var(--theme-surface-subtle) !important;
  color: var(--theme-text-muted) !important;
}

.modal-content input:is([type="text"], [type="email"], [type="password"], [type="number"], [type="search"]),
.modal-content select,
.modal-content textarea,
.analysis-qa-input,
.administration-filter-select {
  background: var(--theme-surface-raised) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

.modal-content input::placeholder,
.modal-content textarea::placeholder,
.analysis-qa-input::placeholder {
  color: var(--theme-text-subtle) !important;
  opacity: 1 !important;
}

.auth-feedback[role="status"],
#reportTokenFeedback {
  border: 1px solid color-mix(in srgb, var(--theme-success) 38%, transparent) !important;
  background: var(--theme-success-soft) !important;
  color: var(--theme-success) !important;
}

/* Seleção territorial: uma única linguagem para mapa, detalhes e relatório. */
.leaflet-upload-actions.leaflet-upload-segmented {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  gap: 3px !important;
  width: auto !important;
  padding: 5px !important;
  overflow: visible !important;
  border: 1px solid var(--map-glass-border) !important;
  border-radius: 999px !important;
  background:
    linear-gradient(180deg, var(--map-glass-sheen), transparent 46%),
    var(--map-glass-bg-strong) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow:
    inset 0 1px 0 var(--map-glass-sheen),
    0 10px 28px rgba(5, 20, 15, 0.28) !important;
  transform: none !important;
  transition: border-color 480ms ease, box-shadow 520ms ease !important;
}

.leaflet-upload-actions.leaflet-upload-segmented:hover,
.leaflet-upload-actions.leaflet-upload-segmented:focus-within {
  transform: none !important;
}

.leaflet-upload-actions.leaflet-upload-segmented::before {
  display: none !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch {
  gap: 0 !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 11px !important;
  overflow: hidden !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: transparent !important;
  transition:
    width 720ms cubic-bezier(0.2, 0.75, 0.25, 1),
    min-width 720ms cubic-bezier(0.2, 0.75, 0.25, 1),
    max-width 720ms cubic-bezier(0.2, 0.75, 0.25, 1),
    gap 560ms cubic-bezier(0.2, 0.75, 0.25, 1),
    color 420ms ease,
    background 480ms ease,
    border-color 480ms ease,
    box-shadow 520ms ease,
    transform 420ms ease !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch.is-action-expanded {
  gap: 8px !important;
  width: 112px !important;
  min-width: 112px !important;
  max-width: 112px !important;
  border-color: var(--map-glass-border-strong) !important;
  background:
    linear-gradient(180deg, var(--map-glass-sheen), transparent 58%),
    var(--map-glass-accent-soft) !important;
  color: var(--map-glass-accent) !important;
  box-shadow:
    inset 0 1px 0 var(--map-glass-sheen),
    0 5px 16px rgba(5, 20, 15, 0.2) !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch--upload.is-action-expanded {
  width: 138px !important;
  min-width: 138px !important;
  max-width: 138px !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch:hover:not(:disabled),
.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch:focus-visible {
  border-color: var(--map-glass-border-strong) !important;
  background: var(--map-glass-accent-soft) !important;
  transform: translateY(-1px) !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch__icon {
  flex: 0 0 20px !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch__label {
  flex: 0 0 auto !important;
  width: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transform: translateX(-6px) !important;
  transition:
    width 680ms cubic-bezier(0.2, 0.75, 0.25, 1),
    opacity 420ms ease 90ms,
    transform 560ms cubic-bezier(0.2, 0.75, 0.25, 1) 60ms !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch.is-action-expanded .leaflet-upload-launch__label {
  width: auto !important;
  overflow: visible !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
}

.leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch__title {
  max-width: 96px !important;
  font-size: 11.5px !important;
  text-overflow: ellipsis !important;
}

.leaflet-upload-control {
  display: grid !important;
  gap: 8px !important;
}

.leaflet-draw-guide,
.leaflet-vector-edit-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-surface);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.leaflet-draw-guide[hidden],
.leaflet-vector-edit-guide[hidden] {
  display: none !important;
}

.leaflet-draw-guide__copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leaflet-draw-guide__copy strong {
  font-size: 12px;
  line-height: 1.2;
}

.leaflet-draw-guide__copy small {
  color: var(--theme-text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.leaflet-draw-guide__actions {
  display: inline-flex;
  gap: 4px;
}

.leaflet-draw-guide__actions button,
.selection-action-buttons button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--theme-border);
  border-radius: 9px;
  background: var(--theme-surface-raised);
  color: var(--theme-text);
  cursor: pointer;
}

.leaflet-draw-guide__actions button:hover:not(:disabled),
.leaflet-draw-guide__actions button:focus-visible,
.selection-action-buttons button:hover,
.selection-action-buttons button:focus-visible {
  border-color: var(--theme-accent);
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
}

.leaflet-draw-guide__actions button:disabled {
  opacity: 0.42;
  cursor: default;
}

.leaflet-vector-edit-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: min(330px, calc(100vw - 28px));
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 42%, var(--theme-border));
  border-radius: 12px;
  background: var(--theme-surface);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-lg);
}

.leaflet-vector-edit-guide__actions button:not(:disabled) {
  color: var(--theme-accent-hover);
}

.leaflet-vector-vertex-shell {
  border: 0 !important;
  background: transparent !important;
}

.leaflet-vector-vertex {
  display: block;
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #0c9f83;
  box-shadow: 0 0 0 2px #071b18, 0 3px 10px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.leaflet-vector-vertex-shell:hover .leaflet-vector-vertex,
.leaflet-vector-vertex-shell.leaflet-drag-target .leaflet-vector-vertex {
  transform: scale(1.22);
  box-shadow: 0 0 0 3px #071b18, 0 4px 14px rgba(0, 0, 0, 0.48);
}

.leaflet-vector-vertex-shell.leaflet-drag-target .leaflet-vector-vertex {
  cursor: grabbing;
}

.selection-action-panel {
  display: grid;
  gap: 9px;
  min-width: 0;
  color: var(--theme-text);
}

.selection-action-panel--inspector {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--theme-border);
}

.selection-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selection-action-header > div {
  display: grid;
  gap: 2px;
}

.selection-panel-kicker {
  color: var(--theme-accent-hover);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.selection-action-header strong {
  color: var(--theme-text);
  font-size: 14px;
}

.selection-action-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 11px;
  font-weight: 800;
}

.selection-action-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.selection-action-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--theme-border);
  border-radius: 11px;
  background: var(--theme-surface-raised);
}

.selection-action-item.is-primary {
  border-color: color-mix(in srgb, var(--theme-accent) 48%, var(--theme-border));
  box-shadow: inset 3px 0 0 var(--theme-accent);
}

.selection-action-index {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 10px;
  font-weight: 800;
}

.selection-action-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selection-action-copy strong,
.selection-action-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-action-copy strong {
  color: var(--theme-text);
  font-size: 12px;
}

.selection-action-copy small,
.selection-action-empty {
  color: var(--theme-text-muted);
  font-size: 10px;
}

.selection-action-buttons {
  display: inline-flex;
  gap: 4px;
}

.selection-fit-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: var(--theme-surface-subtle);
  color: var(--theme-text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.selection-fit-all:hover,
.selection-fit-all:focus-visible {
  border-color: var(--theme-accent);
  background: var(--theme-accent-soft);
}

.map-inspector {
  background: var(--theme-map-surface-strong) !important;
  border-color: var(--theme-map-border-strong) !important;
  color: var(--theme-map-text) !important;
  box-shadow: var(--theme-map-shadow-raised) !important;
}

.map-inspector-header {
  background: var(--theme-map-hover) !important;
  border-color: var(--theme-map-border) !important;
}

.map-inspector-heading,
.map-inspector-close {
  color: var(--theme-map-text) !important;
}

.map-inspector-close {
  border-color: var(--theme-map-border) !important;
  background: var(--theme-map-accent-soft) !important;
}

.map-inspector .selection-action-panel,
.map-inspector .selection-action-header strong,
.map-inspector .selection-action-copy strong,
.map-inspector .tooltip-content,
.map-inspector .tooltip-content-faz,
.map-inspector .tooltip-title,
.map-inspector .tooltip-title-name,
.map-inspector .tooltip-label,
.map-inspector .tooltip-subrow > span:last-child {
  color: var(--theme-map-text) !important;
}

.map-inspector .selection-panel-kicker,
.map-inspector .selection-action-count,
.map-inspector .selection-action-index {
  color: var(--theme-map-accent) !important;
}

.map-inspector .selection-action-copy small,
.map-inspector .selection-action-empty,
.map-inspector .tooltip-value,
.map-inspector .tooltip-subrow > span:first-child {
  color: var(--theme-map-muted) !important;
}

.map-inspector .selection-action-panel--inspector,
.map-inspector .tooltip-content-faz .tooltip-title {
  border-color: var(--theme-map-border) !important;
}

.map-inspector .selection-action-item,
.map-inspector .tooltip-breakdown,
.map-inspector .tooltip-registry-card {
  border-color: var(--theme-map-border) !important;
  background: var(--theme-map-hover) !important;
}

.map-inspector .selection-action-count,
.map-inspector .selection-action-index {
  background: var(--theme-map-accent-soft) !important;
}

.map-inspector .selection-action-item.is-primary {
  border-color: var(--theme-map-border-strong) !important;
  box-shadow: inset 3px 0 0 var(--theme-map-accent) !important;
}

.map-inspector .selection-action-buttons button,
.map-inspector .selection-fit-all,
.map-inspector .tooltip-open-analyses,
.map-inspector .tooltip-report-toggle:not(.is-selected):not([aria-pressed="true"]) {
  border-color: var(--theme-map-border) !important;
  background: var(--theme-map-accent-soft) !important;
  color: var(--theme-map-text) !important;
}

.map-inspector .tooltip-report-toggle:not(.is-selected):not([aria-pressed="true"]) small {
  color: var(--theme-map-muted) !important;
}

.map-inspector .selection-action-buttons button:hover,
.map-inspector .selection-action-buttons button:focus-visible,
.map-inspector .selection-fit-all:hover,
.map-inspector .selection-fit-all:focus-visible,
.map-inspector .tooltip-open-analyses:hover,
.map-inspector .tooltip-open-analyses:focus-visible {
  border-color: var(--theme-map-border-strong) !important;
  background: var(--theme-map-hover) !important;
  color: var(--theme-map-accent) !important;
}

.report-selection-popover {
  border: 1px solid var(--theme-map-border-strong);
  background: var(--theme-map-surface-strong);
  color: var(--theme-map-text);
  box-shadow: var(--theme-map-shadow-raised);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.report-selection-popover .selection-action-panel,
.report-selection-popover .selection-action-header strong,
.report-selection-popover .selection-action-copy strong {
  color: var(--theme-map-text);
}

.report-selection-popover .selection-panel-kicker,
.report-selection-popover .selection-action-count,
.report-selection-popover .selection-action-index {
  color: var(--theme-map-accent);
}

.report-selection-popover .selection-action-copy small,
.report-selection-popover .selection-action-empty {
  color: var(--theme-map-muted);
}

.report-selection-popover .selection-action-item {
  border-color: var(--theme-map-border);
  background: var(--theme-map-hover);
}

.report-selection-popover .selection-action-count,
.report-selection-popover .selection-action-index {
  background: var(--theme-map-accent-soft);
}

.report-selection-popover .selection-action-item.is-primary {
  border-color: var(--theme-map-border-strong);
  box-shadow: inset 3px 0 0 var(--theme-map-accent);
}

.report-selection-popover .selection-action-buttons button,
.report-selection-popover .selection-fit-all {
  border-color: var(--theme-map-border);
  background: var(--theme-map-accent-soft);
  color: var(--theme-map-text);
}

.report-selection-popover .selection-action-buttons button:hover,
.report-selection-popover .selection-action-buttons button:focus-visible,
.report-selection-popover .selection-fit-all:hover,
.report-selection-popover .selection-fit-all:focus-visible {
  border-color: var(--theme-map-border-strong);
  background: var(--theme-map-hover);
  color: var(--theme-map-accent);
}

.map-inspector-focus {
  display: grid;
  gap: 7px;
  padding-top: 12px;
}

.report-selected-fazendas {
  margin-bottom: 12px;
}

#reportModal .report-modal-body {
  overflow-y: auto !important;
}

.draw-farm-modal-content {
  width: min(520px, calc(100vw - 32px)) !important;
}

.draw-farm-modal-body,
.draw-farm-modal-body label {
  display: grid;
  gap: 7px;
}

.draw-farm-modal-body label > span {
  color: var(--theme-text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.draw-farm-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .leaflet-upload-actions.leaflet-upload-segmented {
    display: inline-flex !important;
    grid-template-columns: none !important;
    width: auto !important;
  }

  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    padding-inline: 10px !important;
  }

  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch.is-action-expanded {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
  }

  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch--upload.is-action-expanded {
    width: 126px !important;
    min-width: 126px !important;
    max-width: 126px !important;
  }

  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch__title {
    font-size: 10.5px !important;
  }

  .leaflet-draw-guide {
    width: min(312px, calc(100vw - 24px));
  }

  .draw-farm-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch,
  .leaflet-upload-actions.leaflet-upload-segmented .leaflet-upload-launch__label {
    transition: none !important;
  }
}

.status-banner {
  background: var(--theme-surface-raised) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-md) !important;
}

.status-banner[data-tone="error"],
.auth-feedback.is-error {
  border-color: color-mix(in srgb, var(--theme-danger) 42%, transparent) !important;
  background: var(--theme-danger-soft) !important;
  color: var(--theme-danger) !important;
}

.status-banner[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--theme-warning) 42%, transparent) !important;
  background: var(--theme-warning-soft) !important;
  color: var(--theme-warning) !important;
}

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-focus) 34%, transparent) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  .top-nav-tabs::before,
  .account-menu-theme-opt {
    transition: none !important;
  }
}

/* Painel de usuários: hierarquia arejada, sem convites ou workspaces. */
#adminPanelModal .auth-admin-modal {
  width: min(1040px, calc(100vw - 40px)) !important;
  max-width: none !important;
  max-height: min(88vh, 820px) !important;
  border-radius: 20px !important;
}

#adminPanelModal .profile-modal-header {
  padding: 24px 28px 22px !important;
}

#adminPanelModal .profile-modal-heading {
  gap: 4px !important;
}

#adminPanelModal .profile-modal-header h2 {
  font-size: 22px !important;
  font-weight: 750 !important;
  letter-spacing: -0.025em !important;
}

#adminPanelModal .profile-modal-header p {
  font-size: 12px !important;
  line-height: 1.5 !important;
}

#adminPanelModal .admin-panel-eyebrow {
  color: var(--theme-accent) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
}

#adminPanelModal .admin-panel-body {
  gap: 20px !important;
  padding: 22px 28px 28px !important;
  background: var(--theme-surface) !important;
  overflow: auto !important;
}

#adminPanelModal .admin-panel-overview {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

#adminPanelModal .admin-panel-overview.has-administrator-metric {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

#adminPanelModal #adminAdministratorsMetricCard[hidden] {
  display: none !important;
}

#adminPanelModal .admin-panel-stat {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 20px !important;
  min-height: 72px !important;
  padding: 16px 18px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 14px !important;
  background: var(--theme-surface-subtle) !important;
}

#adminPanelModal .admin-panel-stat span {
  color: var(--theme-text-muted) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

#adminPanelModal .admin-panel-stat strong {
  color: var(--theme-text) !important;
  font-size: 28px !important;
  font-weight: 750 !important;
  letter-spacing: -0.04em !important;
}

#adminPanelModal .admin-panel-grid {
  display: grid !important;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.35fr) !important;
  gap: 18px !important;
  min-height: 0 !important;
}

#adminPanelModal .admin-panel-section {
  min-width: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 16px !important;
  background: var(--theme-surface-raised) !important;
}

#adminPanelModal .admin-panel-section-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 18px 20px 16px !important;
  border-bottom: 1px solid var(--theme-border) !important;
}

#adminPanelModal .admin-panel-section-head h3 {
  margin: 0 !important;
  color: var(--theme-text) !important;
  font-size: 16px !important;
  font-weight: 750 !important;
  letter-spacing: -0.01em !important;
}

#adminPanelModal .admin-panel-section-head p {
  margin: 5px 0 0 !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
}

#adminPanelModal .admin-panel-refresh {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  min-height: 34px !important;
  padding: 7px 10px !important;
  border-radius: 10px !important;
  color: var(--theme-accent) !important;
  font-size: 11px !important;
  font-weight: 750 !important;
}

#adminPanelModal .admin-client-compact-list,
#adminPanelModal .admin-activity-list {
  max-height: 440px !important;
  overflow-y: auto !important;
  padding: 8px 10px 10px !important;
  scrollbar-width: thin !important;
}

#adminPanelModal .admin-client-compact-item {
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 14px 10px !important;
  border-bottom: 1px solid var(--theme-border) !important;
}

#adminPanelModal .admin-client-compact-item:last-child {
  border-bottom: 0 !important;
}

#adminPanelModal .admin-client-compact-avatar {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

#adminPanelModal .admin-client-compact-info {
  min-width: 0 !important;
}

#adminPanelModal .admin-client-compact-info strong,
#adminPanelModal .admin-client-compact-info small {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#adminPanelModal .admin-client-compact-info strong {
  color: var(--theme-text) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
}

#adminPanelModal .admin-client-compact-info small,
#adminPanelModal .admin-client-compact-kind {
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
}

#adminPanelModal .admin-client-compact-kind {
  padding: 5px 8px !important;
  border-radius: 999px !important;
  background: var(--theme-surface-subtle) !important;
}

#adminPanelModal .admin-activity-summary {
  margin: 0 !important;
  padding: 10px 20px !important;
  border-bottom: 1px solid var(--theme-border) !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
  font-weight: 650 !important;
}

#adminPanelModal .admin-activity-list {
  display: block !important;
}

#adminPanelModal .admin-activity-item {
  grid-template-columns: 8px minmax(0, 1fr) auto !important;
  gap: 12px !important;
  padding: 13px 10px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--theme-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
}

#adminPanelModal .admin-activity-item:last-child {
  border-bottom: 0 !important;
}

#adminPanelModal .admin-activity-info strong,
#adminPanelModal .admin-activity-access {
  color: var(--theme-text) !important;
  font-size: 12px !important;
}

#adminPanelModal .admin-activity-info small,
#adminPanelModal .admin-activity-metrics small {
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  line-height: 1.45 !important;
}

#adminPanelModal .admin-activity-group + .admin-activity-group {
  margin-top: 16px !important;
}

#adminPanelModal .admin-activity-group h4 {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

#adminPanelModal .admin-activity-group h4 span {
  color: var(--theme-text-subtle) !important;
  font-size: 10px !important;
}

@media (max-width: 760px) {
  #adminPanelModal .auth-admin-modal {
    width: min(94vw, 680px) !important;
    max-height: 90vh !important;
  }

  #adminPanelModal .profile-modal-header {
    padding: 20px !important;
  }

  #adminPanelModal .admin-panel-body {
    gap: 16px !important;
    padding: 18px 20px 22px !important;
  }

  #adminPanelModal .admin-panel-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #adminPanelModal .admin-panel-grid {
    grid-template-columns: 1fr !important;
  }

  #adminPanelModal .admin-client-compact-list,
  #adminPanelModal .admin-activity-list {
    max-height: 280px !important;
  }
}

@media (max-width: 520px) {
  #adminPanelModal .auth-admin-modal {
    width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 16px !important;
  }

  #adminPanelModal .profile-modal-header {
    padding: 18px 16px !important;
  }

  #adminPanelModal .admin-panel-body {
    padding: 16px !important;
  }

  #adminPanelModal .admin-panel-overview,
  #adminPanelModal .admin-panel-overview.has-administrator-metric {
    grid-template-columns: 1fr !important;
  }

  #adminPanelModal .admin-panel-stat {
    min-height: 60px !important;
    padding: 12px 14px !important;
  }

  #adminPanelModal .admin-activity-item {
    grid-template-columns: 8px minmax(0, 1fr) !important;
  }

  #adminPanelModal .admin-activity-metrics {
    grid-column: 2 !important;
    align-items: flex-start !important;
    text-align: left !important;
  }
}

/* Central de relatório: uma única entrada reúne seleção, detalhes e PDF. */
.map-context-actions .report-hub-toggle {
  min-width: 190px !important;
  justify-content: flex-start !important;
}

.report-hub-toggle #reportSelectionToggleLabel {
  flex: 1;
  text-align: left;
}

.report-hub-toggle .report-selection-badge {
  position: static;
  display: none;
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--theme-map-border-strong);
  background: var(--theme-map-accent-soft);
  color: var(--theme-map-text);
  box-shadow: none;
}

.report-hub-popover {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
}

.report-hub-popover #reportSelectionPopoverBody {
  max-height: min(390px, calc(100dvh - 230px));
  padding: 14px;
  overflow: auto;
}

.report-hub-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--theme-map-border);
  background: var(--theme-map-surface);
}

.report-selection-popover .report-hub-actions .map-inspector-eye,
.report-selection-popover .report-hub-actions .top-btn-report {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: none !important;
  padding: 0 12px !important;
  border: 1px solid var(--theme-map-border) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  cursor: pointer !important;
}

.report-selection-popover .report-hub-actions .report-hub-secondary {
  background: var(--theme-map-accent-soft) !important;
  color: var(--theme-map-text) !important;
}

.report-selection-popover .report-hub-actions .report-hub-primary {
  background: var(--theme-map-accent) !important;
  border-color: var(--theme-map-accent) !important;
  color: var(--theme-map-on-accent) !important;
}

.report-selection-popover .report-hub-actions .report-hub-primary .top-btn-label,
.report-selection-popover .report-hub-actions .report-hub-primary i {
  display: inline !important;
  color: inherit !important;
}

.report-selection-popover .report-hub-actions .report-hub-secondary:hover,
.report-selection-popover .report-hub-actions .report-hub-secondary:focus-visible {
  border-color: var(--theme-map-border-strong) !important;
  background: var(--theme-map-hover) !important;
}

.report-selection-popover .report-hub-actions .report-hub-primary:hover,
.report-selection-popover .report-hub-actions .report-hub-primary:focus-visible {
  filter: brightness(1.08);
}

@media (max-width: 760px) {
  .map-context-actions .report-hub-toggle {
    min-width: 44px !important;
  }

  .report-hub-toggle .report-selection-badge:not([hidden]) {
    position: absolute;
    top: -5px;
    right: -5px;
    display: inline-grid !important;
    place-items: center;
  }

  .report-hub-popover {
    right: 0 !important;
    width: min(390px, calc(100vw - 24px));
  }

  .report-hub-actions {
    grid-template-columns: 1fr;
  }
}

/* Perfil: identidade e segurança, sem gestão administrativa embutida. */
#userSettingsModal .profile-modal {
  width: min(880px, calc(100vw - 40px)) !important;
  max-width: none !important;
  max-height: min(86vh, 760px) !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 20px !important;
  overflow: hidden !important;
}

#userSettingsModal .profile-modal-header {
  padding: 24px 28px 22px !important;
  background: var(--theme-surface) !important;
}

#userSettingsModal .profile-modal-header::after {
  display: none !important;
}

#userSettingsModal .profile-modal-heading {
  gap: 4px !important;
}

#userSettingsModal .profile-modal-eyebrow {
  color: var(--theme-accent) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
}

#userSettingsModal .profile-modal-header h2 {
  font-size: 24px !important;
  font-weight: 750 !important;
  letter-spacing: -0.035em !important;
}

#userSettingsModal .profile-modal-header p {
  max-width: 54ch !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

#userSettingsModal .profile-modal-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  padding: 22px 28px 28px !important;
  background: var(--theme-surface) !important;
  overflow: auto !important;
}

#userSettingsModal .user-settings-account {
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  width: 100% !important;
}

#userSettingsModal .profile-identity-section {
  width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#userSettingsModal .profile-identity-card {
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 18px 20px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 16px !important;
  background: var(--theme-surface-subtle) !important;
  box-shadow: none !important;
}

#userSettingsModal .profile-identity-avatar {
  width: 56px !important;
  height: 56px !important;
  border-radius: 16px !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  box-shadow: none !important;
}

#userSettingsModal .profile-identity-text {
  min-width: 0 !important;
}

#userSettingsModal .profile-identity-text strong {
  color: var(--theme-text) !important;
  font-size: 16px !important;
  font-weight: 750 !important;
}

#userSettingsModal .profile-identity-text span {
  color: var(--theme-text-muted) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

#userSettingsModal .profile-identity-meta::before {
  content: "•" !important;
  margin-right: 5px !important;
  color: var(--theme-accent) !important;
}

#userSettingsModal .profile-identity-role {
  grid-column: auto !important;
  justify-self: end !important;
  margin: 0 !important;
  padding: 6px 10px !important;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 25%, transparent) !important;
  border-radius: 999px !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
}

#userSettingsModal .user-settings-form-v2 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

#userSettingsModal .user-settings-form-card {
  min-width: 0 !important;
  padding: 20px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 16px !important;
  background: var(--theme-surface-raised) !important;
}

#userSettingsModal .user-settings-form-card-head {
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 18px !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--theme-border) !important;
}

#userSettingsModal .user-settings-form-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  font-size: 14px !important;
}

#userSettingsModal .user-settings-form-card-head h3 {
  margin: 0 !important;
  color: var(--theme-text) !important;
  font-size: 15px !important;
  font-weight: 750 !important;
}

#userSettingsModal .user-settings-form-card-head p {
  margin: 4px 0 0 !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
}

#userSettingsModal .user-settings-form-fields {
  display: grid !important;
  gap: 14px !important;
}

#userSettingsModal .auth-field {
  gap: 7px !important;
}

#userSettingsModal .auth-field > span {
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

#userSettingsModal .auth-field input {
  min-height: 46px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 11px !important;
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  box-shadow: none !important;
}

#userSettingsModal .auth-field input[readonly] {
  background: var(--theme-surface-subtle) !important;
  color: var(--theme-text-muted) !important;
}

#userSettingsModal .auth-field input:focus {
  border-color: var(--theme-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-focus) 16%, transparent) !important;
}

#userSettingsModal .user-settings-form-feedback,
#userSettingsModal .user-settings-form-actions {
  grid-column: 1 / -1 !important;
}

#userSettingsModal .user-settings-form-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  padding-top: 2px !important;
}

#userSettingsModal .user-settings-form-actions small {
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
}

#userSettingsModal .user-settings-form-actions .auth-submit-btn {
  min-width: 168px !important;
  min-height: 44px !important;
  padding: 0 18px !important;
  border-radius: 11px !important;
}

@media (max-width: 800px) {
  #userSettingsModal .profile-modal {
    width: min(94vw, 680px) !important;
    max-height: 90vh !important;
  }

  #userSettingsModal .profile-modal-body {
    padding: 18px 20px 22px !important;
  }

  #userSettingsModal .user-settings-form-v2 {
    grid-template-columns: 1fr !important;
  }

  #userSettingsModal .profile-identity-card {
    grid-template-columns: 48px minmax(0, 1fr) !important;
  }

  #userSettingsModal .profile-identity-avatar {
    width: 48px !important;
    height: 48px !important;
  }

  #userSettingsModal .profile-identity-role {
    grid-column: 1 / -1 !important;
    justify-self: start !important;
  }

  #userSettingsModal .user-settings-form-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #userSettingsModal .user-settings-form-actions .auth-submit-btn {
    width: 100% !important;
  }
}

@media (max-width: 520px) {
  #userSettingsModal .profile-modal {
    width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 16px !important;
  }

  #userSettingsModal .profile-modal-header {
    padding: 18px 16px !important;
  }

  #userSettingsModal .profile-modal-body {
    padding: 16px !important;
  }

  #userSettingsModal .profile-identity-card,
  #userSettingsModal .user-settings-form-card {
    padding: 16px !important;
  }
}

/* Análises v2: seleção primeiro, leitura progressiva e menos ruído visual. */
#analysesView {
  padding: 20px 24px 36px !important;
  background: var(--theme-canvas) !important;
}

#analysesView .analyses-shell {
  width: min(100%, 1240px) !important;
  max-width: 1240px !important;
  gap: 10px !important;
}

#analysesView .analyses-hero {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 0 !important;
  min-height: 0 !important;
  padding: 10px 14px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 14px !important;
  background: var(--theme-surface) !important;
  box-shadow: var(--theme-shadow-sm) !important;
  backdrop-filter: none !important;
}

#analysesView .analyses-hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}

#analysesView .analyses-hero::after,
#analysesView .executive-card::after,
#analysesView .analysis-summary-card::after {
  display: none !important;
}

#analysesView .analyses-hero-copy {
  gap: 2px !important;
  max-width: 680px !important;
}

#analysesView .analyses-heading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

#analysesView .analyses-kicker {
  font-size: 10.5px !important;
  letter-spacing: 0.14em !important;
}

#analysesView .analyses-mode-pill {
  min-height: 24px !important;
  padding: 3px 8px !important;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 28%, transparent) !important;
  font-size: 10px !important;
  letter-spacing: 0.08em !important;
}

#analysesView .analyses-hero h1 {
  margin: 0 !important;
  color: var(--theme-text) !important;
  font-size: clamp(19px, 1.7vw, 23px) !important;
  font-weight: 760 !important;
  line-height: 1.12 !important;
  letter-spacing: -0.025em !important;
}

#analysesView .analyses-hero p {
  max-width: 620px !important;
  color: var(--theme-text-muted) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

#analysesView .analyses-hero-actions {
  min-width: 0 !important;
  gap: 7px !important;
  flex-wrap: nowrap !important;
}

#analysesView .analysis-source-filter {
  min-width: 0;
  margin: 0;
  padding: 6px 9px 7px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-surface);
  box-shadow: var(--theme-shadow-sm);
}

#analysesView .analysis-source-filter[hidden] {
  display: none !important;
}

#analysesView .analysis-source-filter legend {
  float: left;
  margin: 0 10px 0 0;
  padding: 4px 0;
  color: var(--theme-text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 20px;
  text-transform: uppercase;
}

#analysesView .analysis-source-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

#analysesView .analysis-source-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 7px;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: var(--theme-surface-subtle);
  color: var(--theme-text-muted);
  font-size: 10.5px;
  font-weight: 720;
  cursor: pointer;
  user-select: none;
}

#analysesView .analysis-source-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#analysesView .analysis-source-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--analysis-source-color) 48%, var(--theme-border));
  background: color-mix(in srgb, var(--analysis-source-color) 10%, var(--theme-surface));
  color: var(--theme-text);
}

#analysesView .analysis-source-option:has(input:focus-visible) {
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}

#analysesView .analysis-source-option[data-empty="true"] {
  opacity: 0.62;
}

#analysesView .analysis-source-dot {
  width: 8px;
  height: 8px;
  border: 2px solid var(--analysis-source-color);
  border-radius: 50%;
  background: transparent;
}

#analysesView .analysis-source-option:has(input:checked) .analysis-source-dot {
  background: var(--analysis-source-color);
}

#analysesView .analysis-source-option strong {
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--theme-surface);
  color: var(--theme-text-muted);
  font-size: 10px;
  text-align: center;
}

#analysesView [data-analysis-source-option="fazendas"] { --analysis-source-color: #f28c28; }
#analysesView [data-analysis-source-option="car"] { --analysis-source-color: #8ee600; }
#analysesView [data-analysis-source-option="sigef"] { --analysis-source-color: #38bdf8; }
#analysesView [data-analysis-source-option="snci"] { --analysis-source-color: #ff2d9a; }

#analysesView .analysis-source-filter > small {
  display: block;
  clear: both;
  margin-top: 5px;
  color: var(--theme-text-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

#analysesView .analyses-hero > .analyses-selection-column {
  width: 100%;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--theme-border);
}

#analysesView .analyses-hero > .analyses-selection-column[hidden] {
  display: none !important;
}

#analysesView :is(.analysis-primary-btn, .analysis-secondary-btn, .analysis-ghost-btn) {
  min-height: 36px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transform: none !important;
}

#analysesView .analyses-chip-row {
  gap: 6px !important;
  padding: 0 2px !important;
}

#analysesView .analysis-scope-chip {
  padding: 4px 8px !important;
  border: 1px solid var(--theme-border) !important;
  background: var(--theme-surface-raised) !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
}

#analysesView .analyses-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

#analysesView :is(.analyses-onboarding-card, .analyses-selection-column, .analyses-results-column)[hidden] {
  display: none !important;
}

#analysesView .analyses-onboarding-card {
  grid-column: 1 / -1;
  min-height: 300px;
  padding: 0 !important;
  overflow: hidden;
}

#analysesView .analysis-onboarding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  min-height: 298px;
}

#analysesView .analysis-onboarding-copy {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: 32px;
}

#analysesView .analysis-onboarding-copy h2 {
  max-width: 520px;
  margin: 6px 0 0;
  color: var(--theme-text);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

#analysesView .analysis-onboarding-copy p {
  max-width: 540px;
  margin: 10px 0 0;
  color: var(--theme-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

#analysesView .analysis-onboarding-copy .analysis-empty-state-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

#analysesView .analysis-onboarding-steps {
  display: grid;
  align-content: center;
  gap: 0;
  margin: 0;
  padding: 36px;
  border-left: 1px solid var(--theme-border);
  background: var(--theme-surface-subtle);
  list-style: none;
}

#analysesView .analysis-onboarding-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  min-height: 76px;
  color: var(--theme-text-muted);
}

#analysesView .analysis-onboarding-steps li:not(:last-child)::after {
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 15px;
  width: 1px;
  background: var(--theme-border-strong);
  content: "";
}

#analysesView .analysis-onboarding-steps li > span {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--theme-border-strong);
  border-radius: 9px;
  background: var(--theme-surface);
  font-size: 10px;
  font-weight: 800;
}

#analysesView .analysis-onboarding-steps li.is-current > span {
  border-color: var(--theme-accent);
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}

#analysesView .analysis-onboarding-steps strong,
#analysesView .analysis-onboarding-steps small {
  display: block;
}

#analysesView .analysis-onboarding-steps strong {
  margin-top: 2px;
  color: var(--theme-text);
  font-size: 12px;
}

#analysesView .analysis-onboarding-steps small {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.4;
}

#analysesView .analysis-onboarding-skeleton {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 36px;
  border-left: 1px solid var(--theme-border);
  background: var(--theme-surface-subtle);
}

#analysesView .analysis-onboarding-skeleton span {
  display: block;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--theme-surface), var(--theme-surface-hover), var(--theme-surface));
  background-size: 220% 100%;
  animation: analysis-v2-loading 1.35s ease-in-out infinite;
}

#analysesView .analyses-selection-column,
#analysesView .analyses-results-column {
  min-width: 0;
}

#analysesView .analyses-results-column {
  display: grid;
  gap: 10px;
}

#analysesView .analyses-reading-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.42fr);
  align-items: start;
  gap: 10px;
}

#analysesView .analysis-card,
#analysesView .analysis-summary-card {
  border: 1px solid var(--theme-border) !important;
  border-radius: 14px !important;
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-sm) !important;
  backdrop-filter: none !important;
}

#analysesView .analysis-card {
  padding: 16px !important;
}

#analysesView .analysis-selection-card {
  min-height: 0;
  padding: 12px 14px !important;
}

#analysesView .analyses-hero .analysis-selection-card {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#analysesView .analyses-hero .analysis-list-toolbar {
  align-items: center;
  margin-bottom: 5px;
}

#analysesView .analyses-hero .analysis-list-item {
  padding: 5px !important;
}

#analysesView .analyses-hero .analysis-list-item-meta {
  margin-top: 4px !important;
}

#analysesView .analyses-hero .analysis-list-item-actions {
  margin-top: 5px !important;
}

#analysesView .analyses-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--theme-border);
  border-radius: 14px;
  background: var(--theme-surface);
  box-shadow: var(--theme-shadow-sm);
}

#analysesView .analysis-summary-card {
  min-width: 0;
  padding: 10px 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#analysesView .analysis-summary-card + .analysis-summary-card {
  border-left: 1px solid var(--theme-border) !important;
}

#analysesView .analysis-summary-card strong {
  color: var(--theme-text-muted) !important;
  font-size: 10.5px !important;
  letter-spacing: 0.1em !important;
}

#analysesView .analysis-summary-card span {
  margin-top: 3px !important;
  color: var(--theme-text) !important;
  font-size: clamp(17px, 1.3vw, 20px) !important;
  font-weight: 760 !important;
  line-height: 1.15 !important;
  overflow-wrap: anywhere;
}

#analysesView .analysis-summary-card small {
  margin-top: 2px !important;
  color: var(--theme-text-muted) !important;
  font-size: 10.5px !important;
  line-height: 1.35 !important;
}

#analysesView .analysis-list-toolbar,
#analysesView .analysis-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

#analysesView .analysis-list-toolbar h2,
#analysesView .analysis-focus-head h2,
#analysesView .analysis-empty-state h2 {
  margin: 3px 0 0 !important;
  color: var(--theme-text) !important;
  font-size: 15px !important;
  font-weight: 760 !important;
  line-height: 1.25 !important;
  letter-spacing: -0.015em !important;
}

#analysesView .analysis-list-toolbar p,
#analysesView .analysis-focus-head p,
#analysesView .analysis-empty-state p {
  margin: 4px 0 0 !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
}

#analysesView .analysis-card-kicker {
  font-size: 10.5px !important;
  letter-spacing: 0.12em !important;
}

#analysesView .analysis-list-count {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 10.5px;
  font-weight: 750;
}

#analysesView .analysis-list-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 6px !important;
  max-height: 230px;
  overflow: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border-strong) transparent;
}

#analysesView .analysis-list-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 10px !important;
  background: var(--theme-surface-subtle) !important;
  box-shadow: none !important;
  transform: none !important;
}

#analysesView .analysis-list-item.is-primary {
  border-color: color-mix(in srgb, var(--theme-accent) 45%, var(--theme-border)) !important;
  background: color-mix(in srgb, var(--theme-accent-soft) 52%, var(--theme-surface)) !important;
  box-shadow: inset 3px 0 0 var(--theme-accent) !important;
}

#analysesView .analysis-list-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: var(--theme-surface);
  color: var(--theme-text-muted);
  font-size: 9px;
  font-weight: 800;
}

#analysesView .analysis-list-item.is-primary .analysis-list-index {
  border-color: var(--theme-accent);
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}

#analysesView .analysis-list-content {
  min-width: 0;
}

#analysesView .analysis-list-item-head {
  align-items: center !important;
}

#analysesView .analysis-list-item-head strong {
  color: var(--theme-text) !important;
  font-size: 12.5px !important;
  font-weight: 750 !important;
  line-height: 1.3;
}

#analysesView .analysis-list-item-head span,
#analysesView .analysis-list-item-area {
  margin-top: 2px !important;
  color: var(--theme-text-muted) !important;
  font-size: 10.5px !important;
}

#analysesView .analysis-list-item-area {
  color: var(--theme-text) !important;
  font-weight: 750 !important;
}

#analysesView .analysis-list-item-meta {
  gap: 4px !important;
  margin-top: 6px !important;
}

#analysesView .analysis-list-item-meta span {
  max-width: 100%;
  padding: 2px 5px;
  border: 1px solid var(--theme-border);
  border-radius: 5px;
  background: var(--theme-surface);
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#analysesView .analysis-list-item-actions {
  gap: 5px !important;
  margin-top: 7px !important;
}

#analysesView .analysis-inline-btn {
  min-height: 32px !important;
  padding: 0 10px !important;
  border-radius: 7px !important;
  font-size: 10.5px !important;
}

#analysesView .analysis-inline-btn.is-active {
  border-color: color-mix(in srgb, var(--theme-accent) 34%, transparent) !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
}

#analysesView .analysis-inline-btn-danger {
  color: var(--theme-danger, #a43b47) !important;
}

#analysesView .analysis-list-footnote {
  margin: 9px 0 0;
  color: var(--theme-text-muted);
  font-size: 10.5px;
  text-align: center;
}

#analysesView .analysis-focus-card {
  min-height: 230px;
}

#analysesView .analysis-focus-head .analysis-status-pill {
  min-height: 24px !important;
  padding: 4px 8px !important;
  font-size: 8px !important;
}

#analysesView .analysis-mini-map-block {
  margin: 0 0 12px !important;
  padding: 0 !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 11px !important;
  background: var(--theme-surface-subtle) !important;
  overflow: hidden;
}

#analysesView .analysis-mini-map-head {
  padding: 8px 10px !important;
  border-bottom: 1px solid var(--theme-border);
}

#analysesView .analysis-mini-map-head strong,
#analysesView .analysis-mini-map-head span {
  font-size: 9px !important;
}

#analysesView .analysis-mini-map {
  height: 150px !important;
  border: 0 !important;
  border-radius: 0 !important;
}

#analysesView .analysis-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px !important;
}

#analysesView .analysis-detail-item {
  gap: 3px !important;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--theme-border);
  border-radius: 9px;
  background: var(--theme-surface-subtle);
}

#analysesView .analysis-detail-item strong {
  color: var(--theme-text-muted) !important;
  font-size: 10px !important;
  letter-spacing: 0.08em !important;
}

#analysesView .analysis-detail-item span {
  color: var(--theme-text) !important;
  font-size: 11.5px !important;
  font-weight: 650;
  line-height: 1.4 !important;
  overflow-wrap: anywhere;
}

#analysesView .analysis-empty-state {
  display: flex;
  min-height: 290px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 20px;
  text-align: center;
}

#analysesView .analysis-empty-state-compact {
  min-height: 198px;
}

#analysesView .analysis-empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 25%, var(--theme-border));
  border-radius: 12px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 14px;
}

#analysesView .analysis-empty-state p {
  max-width: 310px;
}

#analysesView .analysis-empty-state-actions {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}

#analysesView .analysis-empty-state > .analysis-primary-btn {
  margin-top: 14px;
}

#analysesView .analysis-disclosure {
  border: 1px solid var(--theme-border);
  border-radius: 14px;
  background: var(--theme-surface);
  box-shadow: var(--theme-shadow-sm);
  overflow: hidden;
}

#analysesView .analysis-disclosure > summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  color: var(--theme-text);
  cursor: pointer;
  list-style: none;
}

#analysesView .analysis-disclosure > summary::-webkit-details-marker {
  display: none;
}

#analysesView .analysis-disclosure > summary:hover {
  background: var(--theme-surface-hover);
}

#analysesView .analysis-disclosure-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

#analysesView .analysis-disclosure summary strong,
#analysesView .analysis-disclosure summary small {
  display: block;
}

#analysesView .analysis-disclosure summary strong {
  font-size: 12px;
}

#analysesView .analysis-disclosure summary small {
  margin-top: 2px;
  color: var(--theme-text-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

#analysesView .analysis-disclosure-chevron {
  color: var(--theme-text-muted);
  font-size: 16px;
  transition: transform 0.18s ease;
}

#analysesView .analysis-disclosure[open] .analysis-disclosure-chevron {
  transform: rotate(180deg);
}

#analysesView .analysis-disclosure > .analysis-card {
  border: 0 !important;
  border-top: 1px solid var(--theme-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#analysesView .analysis-report-section[open] {
  border-color: color-mix(in srgb, var(--theme-accent) 26%, var(--theme-border));
}

#analysesView .analysis-report-section[open] > summary {
  background: var(--theme-surface-subtle);
}

#analysesView .analysis-report-message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

#analysesView .analysis-report-message strong {
  color: var(--theme-text);
  font-size: 13px;
}

#analysesView .analysis-report-message p {
  margin: 5px 0 0;
  font-size: 11px;
}

#analysesView .analysis-report-message .analysis-status-pill {
  flex: 0 0 auto;
}

#analysesView .analysis-qa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#analysesView .analysis-qa-suggestions button {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: var(--theme-surface-raised);
  color: var(--theme-text-muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

#analysesView .analysis-qa-suggestions button:not(:disabled):hover,
#analysesView .analysis-qa-suggestions button:not(:disabled):focus-visible {
  border-color: var(--theme-accent);
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
}

#analysesView .analysis-qa-suggestions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#analysesView .analysis-focus-skeleton,
#analysesView .analysis-list-skeleton {
  display: grid;
  gap: 8px;
}

#analysesView :is(.analysis-focus-skeleton, .analysis-list-skeleton) span {
  display: block;
  height: 50px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--theme-surface-subtle), var(--theme-surface-hover), var(--theme-surface-subtle));
  background-size: 220% 100%;
  animation: analysis-v2-loading 1.35s ease-in-out infinite;
}

@keyframes analysis-v2-loading {
  to { background-position: -220% 0; }
}

@media (max-width: 980px) {
  #analysesView .analyses-reading-grid {
    grid-template-columns: 1fr;
  }

  #analysesView .analysis-selection-card {
    min-height: 0;
  }

  #analysesView .analysis-list-stack {
    grid-template-columns: 1fr;
    max-height: 420px;
  }

  #analysesView .analysis-onboarding-layout {
    grid-template-columns: 1fr;
  }

  #analysesView .analysis-onboarding-steps,
  #analysesView .analysis-onboarding-skeleton {
    border-top: 1px solid var(--theme-border);
    border-left: 0;
  }

  #analysesView .analysis-onboarding-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  #analysesView .analysis-onboarding-steps li {
    min-height: 0;
  }

  #analysesView .analysis-onboarding-steps li::after {
    display: none;
  }
}

@media (max-width: 720px) {
  #analysesView {
    padding: 12px 12px 24px !important;
  }

  #analysesView .analyses-hero {
    align-items: stretch !important;
    padding: 12px !important;
  }

  #analysesView .analyses-hero-main {
    display: grid;
    gap: 10px;
  }

  #analysesView .analyses-hero-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100% !important;
  }

  #analysesView .analyses-hero-actions > button:first-child {
    grid-column: 1 / -1;
  }

  #analysesView .analysis-source-filter legend {
    float: none;
    display: block;
    margin: 0 0 5px;
  }

  #analysesView .analysis-source-filter-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #analysesView .analysis-source-option {
    justify-content: flex-start;
  }

  #analysesView .analysis-source-option strong {
    margin-left: auto;
  }

  #analysesView .analyses-summary-grid,
  #analysesView .analysis-detail-grid {
    grid-template-columns: 1fr !important;
  }

  #analysesView .analysis-summary-card + .analysis-summary-card {
    border-top: 1px solid var(--theme-border) !important;
    border-left: 0 !important;
  }

  #analysesView .analysis-list-item-head {
    align-items: flex-start !important;
  }

  #analysesView .analysis-empty-state-actions {
    width: 100%;
    flex-direction: column;
  }

  #analysesView .analysis-onboarding-copy {
    padding: 28px 20px;
  }

  #analysesView .analysis-onboarding-steps {
    grid-template-columns: 1fr;
    padding: 22px 20px;
  }

  #analysesView .analysis-onboarding-steps li {
    min-height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #analysesView :is(.analysis-focus-skeleton, .analysis-list-skeleton, .analysis-onboarding-skeleton) span {
    animation: none;
  }
}

/* Acervo v2: biblioteca operacional com área técnica exclusiva do master. */
.top-nav-tabs .top-nav-tab[hidden] {
  display: none !important;
}

#administrationView {
  padding: 20px 24px 36px !important;
  background: var(--theme-canvas) !important;
}

#administrationView .administration-shell {
  width: min(100%, 1240px) !important;
  max-width: 1240px !important;
  gap: 14px !important;
}

#administrationView .administration-hero {
  min-height: 0 !important;
  padding: 16px 18px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 14px !important;
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-sm) !important;
}

#administrationView .administration-hero-copy {
  display: grid;
  gap: 4px;
  max-width: 720px;
}

#administrationView .administration-heading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

#administrationView .analyses-kicker {
  color: var(--theme-accent) !important;
  font-size: 9px !important;
  letter-spacing: 0.14em !important;
}

#administrationView .administration-access-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 28%, transparent);
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#administrationView .administration-hero h1 {
  margin: 0 !important;
  color: var(--theme-text) !important;
  font-size: clamp(22px, 2vw, 28px) !important;
  font-weight: 760 !important;
  line-height: 1.12 !important;
  letter-spacing: -0.025em !important;
}

#administrationView .administration-hero p {
  margin: 0 !important;
  color: var(--theme-text-muted) !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
}

#administrationView .administration-actions {
  flex-wrap: nowrap !important;
  gap: 7px !important;
}

#administrationView :is(.analysis-primary-btn, .analysis-secondary-btn, .analysis-ghost-btn) {
  min-height: 36px !important;
  padding: 0 12px !important;
  border-radius: 9px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transform: none !important;
}

#administrationView :is(.analysis-primary-btn, .analysis-secondary-btn, .analysis-ghost-btn) i {
  font-size: 9px;
}

#administrationView .administration-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#administrationView .administration-summary-grid article {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-surface);
  box-shadow: var(--theme-shadow-sm);
}

#administrationView .administration-summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 11px;
}

#administrationView .administration-summary-grid div {
  min-width: 0;
}

#administrationView .administration-summary-grid small,
#administrationView .administration-summary-grid strong {
  display: block;
}

#administrationView .administration-summary-grid small {
  color: var(--theme-text-muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#administrationView .administration-summary-grid strong {
  margin-top: 3px;
  color: var(--theme-text);
  font-size: 17px;
  font-weight: 780;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#administrationView .administration-card {
  padding: 16px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 14px !important;
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow-sm) !important;
}

#administrationView .administration-card-head {
  align-items: flex-end !important;
  margin-bottom: 13px !important;
}

#administrationView .administration-card-head h2 {
  margin: 3px 0 0 !important;
  color: var(--theme-text) !important;
  font-size: 15px !important;
  font-weight: 760 !important;
  letter-spacing: -0.015em !important;
}

#administrationView .administration-card-head p {
  margin: 4px 0 0;
  color: var(--theme-text-muted);
  font-size: 9px;
  line-height: 1.4;
}

#administrationView .analysis-card-kicker {
  color: var(--theme-accent) !important;
  font-size: 8px !important;
  letter-spacing: 0.12em !important;
}

#administrationView .administration-card-controls {
  gap: 7px !important;
}

#administrationView .administration-filter-label {
  color: var(--theme-text-muted) !important;
  font-size: 8px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#administrationView .administration-filter-select {
  width: min(220px, 30vw) !important;
  min-height: 34px !important;
  padding: 0 30px 0 10px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 9px !important;
  background: var(--theme-surface-raised) !important;
  color: var(--theme-text) !important;
  font-size: 9px !important;
  box-shadow: none !important;
}

#administrationView .administration-count {
  min-width: 30px !important;
  padding: 5px 8px !important;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, transparent) !important;
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent-hover) !important;
  font-size: 8px !important;
}

#administrationView .administration-dataset-list {
  gap: 6px !important;
}

#administrationView .administration-dataset-item {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 10px !important;
  background: var(--theme-surface-subtle) !important;
  color: var(--theme-text) !important;
  box-shadow: none !important;
}

#administrationView .administration-dataset-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: var(--theme-surface);
  color: var(--theme-text-muted);
  font-size: 9px;
  font-weight: 800;
}

#administrationView .administration-dataset-main {
  gap: 3px !important;
}

#administrationView .administration-dataset-main strong {
  color: var(--theme-text) !important;
  font-size: 10px !important;
  font-weight: 760 !important;
  line-height: 1.3;
}

#administrationView .administration-dataset-main span.administration-dataset-locality {
  color: var(--theme-accent-hover) !important;
  font-size: 8px !important;
  font-weight: 650 !important;
}

#administrationView .administration-dataset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

#administrationView .administration-dataset-meta span {
  max-width: 100%;
  padding: 2px 5px;
  border: 1px solid var(--theme-border);
  border-radius: 5px;
  background: var(--theme-surface);
  color: var(--theme-text-muted) !important;
  font-size: 7px !important;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#administrationView .administration-dataset-actions {
  flex-wrap: nowrap !important;
  gap: 5px !important;
}

#administrationView .administration-dataset-actions :is(.analysis-secondary-btn, .analysis-ghost-btn) {
  min-height: 28px !important;
  padding: 0 8px !important;
  border-radius: 7px !important;
  font-size: 8px !important;
}

#administrationView .analysis-danger-btn {
  color: var(--theme-danger, #a43b47) !important;
}

#administrationView .administration-bulk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--theme-border);
}

#administrationView .administration-bulk-footer[hidden] {
  display: none !important;
}

#administrationView .administration-bulk-footer > span {
  color: var(--theme-text-muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#administrationView .administration-empty-state {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

#administrationView .administration-empty-state > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 13px;
}

#administrationView .administration-empty-state h3 {
  margin: 0;
  color: var(--theme-text);
  font-size: 13px;
}

#administrationView .administration-empty-state p {
  max-width: 360px;
  margin: 5px 0 0;
  color: var(--theme-text-muted);
  font-size: 9px;
  line-height: 1.45;
}

#administrationView .administration-empty-state.is-error > span {
  background: color-mix(in srgb, var(--theme-danger, #a43b47) 12%, transparent);
  color: var(--theme-danger, #a43b47);
}

#administrationView .administration-list-skeleton {
  display: grid;
  gap: 7px;
}

#administrationView .administration-list-skeleton span {
  display: block;
  height: 54px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--theme-surface-subtle), var(--theme-surface-hover), var(--theme-surface-subtle));
  background-size: 220% 100%;
  animation: administration-v2-loading 1.35s ease-in-out infinite;
}

@keyframes administration-v2-loading {
  to { background-position: -220% 0; }
}

#administrationView .administration-master-disclosure {
  border: 1px solid var(--theme-border);
  border-radius: 14px;
  background: var(--theme-surface);
  box-shadow: var(--theme-shadow-sm);
  overflow: hidden;
}

#administrationView .administration-master-disclosure[hidden],
#administrationView .administration-assets-card[hidden] {
  display: none !important;
}

#administrationView .administration-master-disclosure > summary {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

#administrationView .administration-master-disclosure > summary::-webkit-details-marker {
  display: none;
}

#administrationView .administration-master-disclosure > summary:hover {
  background: var(--theme-surface-hover);
}

#administrationView .administration-master-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 11px;
}

#administrationView .administration-master-disclosure summary strong,
#administrationView .administration-master-disclosure summary small {
  display: block;
}

#administrationView .administration-master-disclosure summary strong {
  color: var(--theme-text);
  font-size: 10px;
}

#administrationView .administration-master-disclosure summary small {
  margin-top: 2px;
  color: var(--theme-text-muted);
  font-size: 8px;
}

#administrationView .administration-master-badge {
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 26%, transparent);
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

#administrationView .administration-master-chevron {
  color: var(--theme-text-muted);
  font-size: 9px;
  transition: transform 0.18s ease;
}

#administrationView .administration-master-disclosure[open] .administration-master-chevron {
  transform: rotate(180deg);
}

#administrationView .administration-master-disclosure > .administration-assets-card {
  border: 0 !important;
  border-top: 1px solid var(--theme-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

@media (max-width: 900px) {
  #administrationView .administration-dataset-item {
    grid-template-columns: 28px minmax(0, 1fr) !important;
  }

  #administrationView .administration-dataset-actions {
    grid-column: 2;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}

@media (max-width: 720px) {
  #administrationView {
    padding: 12px 12px 24px !important;
  }

  #administrationView .administration-hero {
    display: grid !important;
    align-items: stretch !important;
    padding: 14px !important;
  }

  #administrationView .administration-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  #administrationView .administration-actions > button:first-child {
    grid-column: 1 / -1;
  }

  #administrationView .administration-summary-grid {
    grid-template-columns: 1fr;
  }

  #administrationView .administration-card-head,
  #administrationView .administration-card-controls {
    align-items: stretch !important;
  }

  #administrationView .administration-card-controls {
    display: grid !important;
    grid-template-columns: 1fr auto;
  }

  #administrationView .administration-filter-label {
    grid-column: 1 / -1;
  }

  #administrationView .administration-filter-select {
    width: 100% !important;
  }

  #administrationView .administration-bulk-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #administrationView .administration-master-disclosure > summary {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  #administrationView .administration-master-badge {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #administrationView .administration-list-skeleton span {
    animation: none;
  }
}

/* Popups vetoriais compartilham a mesma hierarquia e um alvo de fechamento
   acessível. O seletor por conteúdo também alcança popups legados de upload. */
.leaflet-popup:has(.vector-popup-content),
.leaflet-popup:has(.tooltip-content) {
  --vector-popup-accent: var(--theme-map-accent);
}

.leaflet-popup:has([data-public-layer="car"]) {
  --vector-popup-accent: #8ee600;
}

.leaflet-popup:has([data-public-layer="sigef"]) {
  --vector-popup-accent: #38bdf8;
}

.leaflet-popup:has([data-public-layer="snci"]) {
  --vector-popup-accent: #ff2d9a;
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-content-wrapper,
.leaflet-popup:has(.vector-popup-content) .leaflet-popup-content-wrapper {
  position: relative;
  overflow: hidden;
  background: var(--theme-map-surface-strong) !important;
  border: 1px solid var(--theme-map-border-strong) !important;
  border-radius: 17px !important;
  color: var(--theme-map-text) !important;
  box-shadow: var(--theme-map-shadow-raised) !important;
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-content-wrapper::before,
.leaflet-popup:has(.vector-popup-content) .leaflet-popup-content-wrapper::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--vector-popup-accent);
  content: "";
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-tip,
.leaflet-popup:has(.vector-popup-content) .leaflet-popup-tip {
  background: var(--theme-map-surface-strong) !important;
  border-color: var(--theme-map-border) !important;
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-content,
.leaflet-popup:has(.vector-popup-content) .leaflet-popup-content {
  width: min(372px, calc(100vw - 72px)) !important;
  max-height: min(560px, calc(100vh - 150px));
  margin: 0 !important;
  padding: 20px 20px 18px 23px;
  overflow: auto;
  color: var(--theme-map-text) !important;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-map-border-strong) transparent;
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-close-button,
.leaflet-popup:has(.tooltip-content) .leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0 0 3px !important;
  place-items: center;
  border: 1px solid var(--theme-map-border) !important;
  border-radius: 12px;
  background: var(--theme-map-surface-strong) !important;
  color: var(--theme-map-text) !important;
  font-size: 25px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  cursor: pointer;
  opacity: 1;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-close-button:hover,
.leaflet-popup:has(.tooltip-content) .leaflet-popup-close-button:hover {
  border-color: var(--theme-map-border-strong) !important;
  background: var(--theme-map-hover) !important;
  transform: translateY(-1px);
}

.leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-close-button:focus-visible,
.leaflet-popup:has(.tooltip-content) .leaflet-popup-close-button:focus-visible {
  outline: 3px solid var(--theme-focus);
  outline-offset: 2px;
}

.vector-popup-content {
  min-width: 0;
  color: var(--theme-map-text) !important;
  font-size: 12px;
}

.vector-popup-header {
  margin: 0 46px 14px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--theme-map-border);
}

.vector-popup-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
}

.vector-popup-layer-mark,
.vector-popup-content .tooltip-source {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--theme-map-border);
  border-radius: 999px;
  background: var(--theme-map-accent-soft);
  color: var(--theme-map-text) !important;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.vector-popup-layer-mark {
  border-color: var(--vector-popup-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--vector-popup-accent) 22%, transparent);
}

.vector-popup-content .tooltip-source {
  background: transparent;
  color: var(--theme-map-muted) !important;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: none;
}

.vector-popup-primary {
  margin: 0 !important;
  color: var(--theme-map-text) !important;
  font-size: 17px !important;
  font-weight: 820;
  letter-spacing: -0.015em;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.tooltip-content-public .vector-popup-primary {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px !important;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.tooltip-content-public .vector-popup-header {
  margin-bottom: 9px;
  padding-bottom: 9px;
}

.tooltip-content-public .vector-popup-kicker {
  margin-bottom: 5px;
}

.vector-popup-id-label {
  display: block;
  margin-bottom: 2px;
  color: var(--theme-map-muted) !important;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.045em;
  line-height: 1.2;
  text-transform: uppercase;
}

.vector-popup-subtitle {
  margin: 5px 0 0;
  color: var(--theme-map-muted) !important;
  font-size: 11px;
  font-weight: 550;
  line-height: 1.4;
}

.vector-popup-content .tooltip-status-row {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}

.tooltip-status-caption {
  color: var(--theme-map-muted) !important;
  font-size: 9.5px;
  font-weight: 680;
  line-height: 1.2;
}

.vector-popup-fields {
  overflow: hidden;
  border: 1px solid var(--theme-map-border);
  border-radius: 12px;
  background: var(--theme-map-hover);
}

.vector-popup-content .tooltip-field {
  display: grid;
  grid-template-columns: minmax(84px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 10px 11px;
  border-bottom: 1px solid var(--theme-map-border);
  font-size: 12px;
  line-height: 1.4;
}

.vector-popup-content .tooltip-field:last-child {
  border-bottom: 0;
}

.vector-popup-content .tooltip-label {
  color: var(--theme-map-muted) !important;
  font-weight: 650;
}

.vector-popup-content .tooltip-value,
.vector-popup-content .tooltip-value-mono {
  min-width: 0;
  margin: 0;
  color: var(--theme-map-text) !important;
  font-size: 12px;
  font-weight: 680;
  overflow-wrap: anywhere;
  text-align: right;
}

.vector-popup-content .tooltip-value-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.tooltip-content-public .vector-popup-fields {
  border-radius: 10px;
}

.tooltip-content-public .tooltip-field {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 9px;
  font-size: 10.5px;
  line-height: 1.3;
}

.tooltip-content-public .tooltip-label,
.tooltip-content-public .tooltip-value {
  font-size: 10.5px;
}

.tooltip-content-public .tooltip-value-mono {
  font-size: 9.75px;
}

.public-layer-popup .car-analysis-state,
.public-layer-popup .car-analysis-notice,
.public-layer-popup .car-analysis-block,
.public-layer-popup .car-analysis-heading,
.public-layer-popup .car-analysis-subtitle,
.public-layer-popup .car-analysis-grid strong,
.public-layer-popup .car-analysis-row strong,
.public-layer-popup .car-analysis-block p {
  color: var(--theme-map-text) !important;
}

.public-layer-popup .car-analysis-state,
.public-layer-popup .car-analysis-notice,
.public-layer-popup .car-analysis-grid > div {
  border: 1px solid var(--theme-map-border);
  background: var(--theme-map-hover);
}

.public-layer-popup .car-analysis-grid span,
.public-layer-popup .car-analysis-row {
  color: var(--theme-map-muted) !important;
}

.public-selection-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

/* O popup já possui padding no contêiner Leaflet. A largura fixa e o segundo
   padding herdados do tema antigo somavam mais de 450 px dentro de uma janela
   de 372 px, cortando sobreposições e a terceira ação. */
.leaflet-popup.fazenda-popup .leaflet-popup-content {
  box-sizing: border-box;
  width: min(372px, calc(100vw - 72px)) !important;
}

.leaflet-popup.fazenda-popup .tooltip-content-faz {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
}

.leaflet-popup.fazenda-popup .tooltip-subrow > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.public-selection-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  padding: 5px 4px;
  border: 1px solid var(--theme-map-border);
  border-radius: 9px;
  background: var(--theme-map-surface-strong);
  color: var(--theme-map-text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.public-selection-action i {
  color: var(--theme-map-accent);
  font-size: 10.5px;
}

.public-selection-action span {
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.map-vector-keyboard-nav {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 1200;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--theme-map-border-strong);
  border-radius: 12px;
  background: var(--theme-map-surface-strong);
  box-shadow: var(--theme-map-shadow-raised);
  transform: translate(-50%, -180%);
  transition: transform 120ms ease;
}

.map-vector-keyboard-nav:focus-within,
.map-vector-keyboard-nav.is-keyboard-visible {
  transform: translate(-50%, 0);
}

.map-vector-keyboard-nav button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--theme-map-border);
  border-radius: 9px;
  background: var(--theme-map-surface-strong);
  color: var(--theme-map-text);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.map-vector-keyboard-nav button:focus-visible {
  outline: 3px solid var(--theme-focus);
  outline-offset: 2px;
}

.public-selection-action-analyses {
  border-color: var(--theme-map-accent);
  background: var(--theme-map-accent);
  color: var(--theme-map-on-accent);
}

.public-selection-action-analyses i {
  color: currentColor;
}

.public-selection-action-report.is-selected {
  background: var(--theme-map-accent-soft);
  color: var(--theme-map-text);
  box-shadow: inset 3px 0 0 var(--theme-map-accent);
}

.public-selection-action-deselect:not(:disabled) {
  color: var(--theme-danger, #b42318);
}

.public-selection-action-deselect:not(:disabled) i {
  color: currentColor;
}

.public-selection-action:disabled {
  cursor: default;
  opacity: 0.45;
}

.public-selection-action-report.is-selected:disabled {
  opacity: 1;
}

.public-selection-action:not(:disabled):hover,
.public-selection-action:not(:disabled):focus-visible {
  filter: brightness(1.08);
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .public-selection-actions {
    gap: 5px;
  }

  .public-selection-action {
    min-height: 44px;
    padding-inline: 3px;
  }

  .public-selection-action span {
    font-size: 10px;
  }

  .leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-content,
  .leaflet-popup:has(.vector-popup-content) .leaflet-popup-content {
    width: min(348px, calc(100vw - 42px)) !important;
    padding: 18px 16px 16px 19px;
  }

  .vector-popup-header {
    margin-right: 44px;
  }

  .vector-popup-content .tooltip-field {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 360px) {
  .vector-popup-content .tooltip-field {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .vector-popup-content .tooltip-value,
  .vector-popup-content .tooltip-value-mono {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .leaflet-popup:is(.terra-vector-popup, .public-layer-popup) .leaflet-popup-close-button,
  .leaflet-popup:has(.tooltip-content) .leaflet-popup-close-button {
    transition: none;
  }
}

/* Contratos finais de usabilidade: alvos de toque e movimento reduzido ficam
   centralizados na ultima camada de tema, sem criar outra folha de overrides. */
.modal .modal-content :is(.btn, .upload-report-type-select),
#reportModal .report-token-details > summary,
#authAccountMenuPanel :is(button, select),
.sidebar #publicViewportFilterToggle {
  min-height: 44px !important;
}

@media (max-width: 760px) {
  :is(#sidebarToggle, .map-filter-toggle, #baseMapPicker > summary, #zoomIn, #zoomOut, .map-controls .control-btn) {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  #analysesView :is(
    .analysis-primary-btn,
    .analysis-secondary-btn,
    .analysis-ghost-btn,
    .analysis-inline-btn,
    .analysis-source-option,
    .analysis-qa-suggestions button
  ) {
    min-height: 44px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto !important;
  }

  #authScreen#authScreen *,
  #authScreen#authScreen *::before,
  #authScreen#authScreen *::after,
  #appShell#appShell *,
  #appShell#appShell *::before,
  #appShell#appShell *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
