@charset "UTF-8";

:root {
  color-scheme: light;
  --green-950: #004d49;
  --green-900: #005854;
  --green-800: #09695e;
  --green-700: #11775d;
  --green-600: #16866c;
  --green-400: #4fc9b0;
  --green-300: #8be4d2;
  --green-200: #cceee6;
  --green-100: #eaf6f3;
  --green-050: #f4faf8;
  --ink: #162640;
  --ink-strong: #003f3c;
  --muted: #65707c;
  --line: #dce3e5;
  --line-soft: #e9edef;
  --canvas: #f7f9f9;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --danger: #e23e3b;
  --danger-soft: #fff0ef;
  --warning: #e28a10;
  --warning-soft: #fff6e7;
  --info: #2385c7;
  --metric-green: #0f6e56;
  --shadow: 0 2px 7px rgba(22, 38, 64, 0.07);
  --shadow-soft: 0 1px 3px rgba(22, 38, 64, 0.06);
  --header-h: 56px;
  --filters-h: 0px;
  --footer-h: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #060E0D;
  --surface: #1D3532;
  --surface-soft: #284340;
  --line: #528079;
  --line-soft: #456F68;
  --ink: #E8F2EF;
  --ink-strong: #F4FCFA;
  --muted: #A6BCB7;
  --green-050: #123631;
  --green-100: #174A43;
  --green-200: #28675D;
  --green-300: #7CE0CC;
  --green-400: #62D8BF;
  --green-700: #70DFC7;
  --green-800: #9CEBDC;
  --green-900: #D8F7F0;
  --danger: #FF8A80;
  --warning: #F5BE55;
  --info: #7FC1F0;
  --danger-soft: #4A2320;
  --warning-soft: #4A3A1B;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 2px 6px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Open Sans", "Open Sans Fallback", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-size: 0.875rem;
  line-height: 1.35;
  transition: color 160ms ease, background 160ms ease;
}

button,
select { font: inherit; }

button { color: inherit; }

.progress-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: 4px;
  background: rgba(79, 201, 176, 0.1);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green-400);
  transition: width 100ms linear;
}

.app-header {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  min-height: var(--header-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 100;
}

.header-title-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  min-width: fit-content;
}

.screen-code {
  display: block;
  color: var(--green-700);
  font-size: 0.4688rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.header-title-box h1 {
  margin-top: 1px;
  color: var(--ink-strong);
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.header-title-box p {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.carousel-pause-toggle,
.theme-toggle,
.update-block {
  min-height: 35px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  box-shadow: var(--shadow-soft);
  border-radius: 7px;
}

.carousel-pause-toggle {
  gap: 6px;
  padding: 0 11px;
  color: var(--green-900);
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 180ms ease;
  user-select: none;
  white-space: nowrap;
}

.carousel-pause-toggle:hover { border-color: var(--green-400); background: var(--green-100); }
.carousel-pause-toggle.paused {
  border-color: #f59e0b;
  background: var(--warning-soft);
  color: #b45309;
}

:root[data-theme="dark"] .carousel-pause-toggle.paused {
  border-color: #d97706;
  background: rgba(245, 158, 11, 0.22);
  color: #fef08a;
}

.pause-icon { font-size: 0.75rem; line-height: 1; }

.theme-toggle {
  width: 35px;
  min-width: 35px;
  padding: 0;
  justify-content: center;
  color: var(--green-900);
  cursor: pointer;
  transition: all 180ms ease;
}

.theme-toggle:hover { border-color: var(--green-400); background: var(--green-100); }
.theme-toggle:focus-visible,
.carousel-pause-toggle:focus-visible,
.carousel-arrow:focus-visible,
.page-dot:focus-visible,
.segmented-control button:focus-visible { outline: 3px solid rgba(79, 201, 176, 0.28); outline-offset: 2px; }

.theme-icon { font-size: 1.1875rem; line-height: 1; }

.update-block {
  min-width: 102px;
  padding: 2px 8px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  cursor: pointer;
  transition: all 180ms ease;
}

.update-block:hover { border-color: var(--green-400); background: var(--green-100); }
.update-block-header {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--green-700);
  font-size: 0.5rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.icon-provenance { font-size: 0.7188rem; line-height: 1; }
.update-block strong { margin-top: 1px; color: var(--ink); font-size: 0.625rem; font-weight: 650; line-height: 1.1; white-space: nowrap; }

.filter-shell {
  position: relative;
  z-index: 100;
  overflow: visible;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
  max-width: 1220px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.filter-control {
  position: relative;
  height: 35px;
  min-width: 105px;
  max-width: 160px;
  flex: 1.2 1 0;
  padding: 3px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.filter-control.filter-control--medium,
.filter-control:has(#filterMonth) {
  min-width: 135px;
  max-width: 185px;
  flex: 1.4 1 0;
}

.filter-control.filter-control--medium .custom-select-popup,
.filter-control:has(#filterMonth) .custom-select-popup {
  min-width: max(100%, 220px);
}

.filter-control.filter-control--wide,
.filter-control:has(#filterConsultant),
.filter-control:has(#filterProducer) {
  min-width: 160px;
  max-width: 250px;
  flex: 1.8 1 0;
}

.filter-control.filter-control--wide .custom-select-popup,
.filter-control:has(#filterConsultant) .custom-select-popup,
.filter-control:has(#filterProducer) .custom-select-popup {
  min-width: max(100%, 320px);
  max-width: 520px;
}

.filter-control:hover {
  border-color: var(--green-400);
  background: var(--surface);
}

.filter-control.active-popup,
.filter-control:focus-within {
  z-index: 1001;
  border-color: #0F6E56;
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(15, 110, 86, 0.14);
}

.filter-control span {
  color: var(--green-700);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-control select {
  display: none;
}

.select-display-value {
  margin-top: 0;
  color: var(--ink-strong);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 15px;
  line-height: 1.15;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%230F6E56' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 11px;
}

:root[data-theme="dark"] .select-display-value {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237ce0cc' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.custom-select-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: max(100%, 270px);
  max-width: 450px;
  max-height: 300px;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 77, 73, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.custom-select-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* visibility sem atraso: o campo de pesquisa precisa estar visível para receber o foco ao abrir */
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s;
}

.filter-control:nth-child(n+4) .custom-select-popup {
  left: auto;
  right: 0;
}

.custom-select-search-wrap {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
  padding: 2px 2px 6px 2px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}

.custom-select-search-input {
  width: 100%;
  height: 30px;
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-family: inherit;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink-strong);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.custom-select-search-input:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 2px rgba(15, 110, 86, 0.15);
}

.custom-select-options-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-300) transparent;
}

.custom-select-no-results {
  padding: 12px 10px;
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

.custom-select-option {
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--ink-strong);
  font-size: 0.7188rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  white-space: nowrap;
}

.custom-select-option span:first-child {
  white-space: nowrap;
}

.custom-select-option:hover,
.custom-select-option.highlighted {
  background: var(--green-100) !important;
  color: var(--green-950) !important;
  outline: 2px solid #0F6E56 !important;
  outline-offset: -2px !important;
}

.custom-select-option.selected {
  background: #0F6E56 !important;
  color: #ffffff !important;
  font-weight: 750;
}

.custom-select-option.selected.highlighted {
  background: #0B5341 !important;
  color: #ffffff !important;
  outline: 2px solid var(--green-400) !important;
  outline-offset: -2px !important;
  box-shadow: inset 0 0 0 2px var(--green-400) !important;
}

:root[data-theme="dark"] .custom-select-option:hover,
:root[data-theme="dark"] .custom-select-option.highlighted {
  background: rgba(15, 110, 86, 0.45) !important;
  color: #ffffff !important;
  outline: 2px solid #7ce0cc !important;
  outline-offset: -2px !important;
}

:root[data-theme="dark"] .custom-select-option.selected.highlighted {
  background: #0F6E56 !important;
  color: #ffffff !important;
  outline: 2px solid #7ce0cc !important;
  outline-offset: -2px !important;
  box-shadow: inset 0 0 0 2px #7ce0cc !important;
}

.custom-select-option.selected span {
  color: #ffffff !important;
}

.loading-overlay {
  position: fixed;
  inset: var(--header-h) 0 var(--footer-h) 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

:root[data-theme="dark"] .loading-overlay {
  background: #0f172a;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid rgba(15, 110, 86, 0.18);
  border-top-color: #0F6E56;
  border-radius: 50%;
  animation: spinner-rotate 650ms linear infinite;
}

:root[data-theme="dark"] .loading-spinner {
  border-color: rgba(124, 224, 204, 0.18);
  border-top-color: #7ce0cc;
}

@keyframes spinner-rotate {
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: var(--green-900);
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.carousel-viewport {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.carousel-track {
  width: calc(var(--slides, 6) * 100vw);
  height: 100%;
  min-height: 100%;
  display: flex;
  transition: transform 560ms cubic-bezier(0.25, 1, 0.5, 1);
}

.slide {
  width: 100vw;
  min-width: 100vw;
  height: 100%;
  padding: 8px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.kpi-grid {
  height: 84px;
  min-height: 84px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.metric-card,
.panel-card,
.criteria-strip {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-content: center;
  color: rgba(255, 255, 255, 0.82);
  border: none;
  border-radius: 17px;
  background: #0f6e56;
  box-shadow: 0 4px 12px rgba(15, 110, 86, 0.15);
}

.metric-icon {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  grid-row: 1 / 4;
  align-self: center;
  color: rgb(255, 255, 255);
  border: none;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.12);
  font-family: "Material Symbols Rounded";
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  font-style: normal;
  letter-spacing: normal;
  font-feature-settings: "liga";
  white-space: nowrap;
}

.metric-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: -16px;
  bottom: -11px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #1d7760;
  pointer-events: none;
}

.metric-label {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.82);
  font-family: "Open Sans", "Open Sans Fallback", Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 13px;
  height: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  vertical-align: middle;
  border-radius: 50%;
  transition: all 160ms ease;
  user-select: none;
}

.kpi-info-btn:hover,
.kpi-info-btn:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.15);
}

.kpi-info-btn span {
  font-size: 0.8125rem;
  line-height: 1;
  pointer-events: none;
}

/* Estilo específico para botões de informação nos cabeçalhos de tabelas */
.data-table th .kpi-info-btn {
  color: #64748b;
  margin-left: 2px;
  width: 15px;
  height: 15px;
}
.data-table th .kpi-info-btn:hover {
  color: var(--lr-primary-dark, #0f766e);
  background: rgba(16, 185, 129, 0.15);
}
:root[data-theme="dark"] .data-table th .kpi-info-btn {
  color: #94a3b8;
}
:root[data-theme="dark"] .data-table th .kpi-info-btn:hover {
  color: #6ee7b7;
  background: rgba(110, 231, 183, 0.18);
}

/* Cores específicas para botões info em cards Warning e Alert */
.metric-card--warning .kpi-info-btn,
.metric-card--pending .kpi-info-btn {
  color: #7c5a18;
}

.metric-card--warning .kpi-info-btn:hover,
.metric-card--pending .kpi-info-btn:hover {
  background: rgba(214, 169, 47, 0.25);
  color: #4a3306;
}

.metric-card--alert .kpi-info-btn,
.metric-card--grave .kpi-info-btn,
.metric-card--danger .kpi-info-btn {
  color: #874642;
}

.metric-card--alert .kpi-info-btn:hover,
.metric-card--grave .kpi-info-btn:hover,
.metric-card--danger .kpi-info-btn:hover {
  background: rgba(216, 116, 110, 0.25);
  color: #572927;
}

/* Popover Flutuante Elegante dos KPIs */
.kpi-info-popover {
  position: absolute;
  z-index: 9999;
  width: 270px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #162640;
  background: #ffffff;
  border: 1px solid var(--green-300);
  box-shadow: 0 10px 28px rgba(0, 48, 40, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  pointer-events: none;
}

:root[data-theme="dark"] .kpi-info-popover {
  color: #f1fbf8;
  background: #0c332e;
  border-color: #24544b;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.kpi-info-popover.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.kpi-info-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.kpi-info-header .kpi-info-icon {
  font-size: 1rem;
  color: var(--green-600);
}

.kpi-info-header strong {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--ink-strong);
}

.kpi-info-popover p {
  font-size: 0.7188rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}

.kpi-info-ref-box {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft, #e2e8f0);
  font-size: 0.6875rem;
  color: var(--ink-light, #64748b);
  line-height: 1.3;
}

.kpi-info-ref-box .material-symbols-rounded {
  font-size: 0.875rem;
  color: var(--green-600, #00875a);
  flex-shrink: 0;
}

.kpi-info-ref-box strong {
  color: var(--green-700, #006644);
  font-weight: 700;
}

:root[data-theme="dark"] .kpi-info-ref-box {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

:root[data-theme="dark"] .kpi-info-ref-box strong {
  color: #34d399;
}

:root[data-theme="dark"] .kpi-info-ref-box .material-symbols-rounded {
  color: #34d399;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  color: rgb(255, 255, 255);
  font-family: "Open Sans", "Open Sans Fallback", Arial, sans-serif;
  font-size: 1.0312rem;
  font-weight: 500;
  line-height: 20px;
  height: 20px;
  letter-spacing: normal;
}

.metric-card small {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-family: "Open Sans", "Open Sans Fallback", Arial, sans-serif;
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 12px;
  height: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-card--primary,
.metric-card--soft {
  color: rgba(255, 255, 255, 0.82);
  border: none;
  background: #0f6e56;
}

/* Card Modelo Amarelo (Informações Pendentes / Atenção) - Restaurado do Histórico */
.metric-card--warning,
.metric-card--pending {
  position: relative;
  overflow: hidden;
  border: 1px solid #ecd48c;
  border-top: 4px solid #d6a92f;
  background: linear-gradient(145deg, #fffdf8 8%, #fff1c9 100%);
  box-shadow: 0 4px 14px rgba(185, 139, 29, 0.12);
  color: #7c5a18;
}

.metric-card--warning::after,
.metric-card--pending::after {
  display: none;
}

.metric-card--warning .metric-icon,
.metric-card--pending .metric-icon {
  background: rgba(214, 169, 47, 0.22);
  color: #7c5a18;
}

.metric-card--warning .metric-label,
.metric-card--warning strong,
.metric-card--warning small,
.metric-card--pending .metric-label,
.metric-card--pending strong,
.metric-card--pending small {
  color: #7c5a18 !important;
  text-shadow: none !important;
}

/* Card Modelo Vermelho (Informações Graves / Alertas) - Restaurado do Histórico */
.metric-card--alert,
.metric-card--grave,
.metric-card--danger {
  position: relative;
  overflow: hidden;
  border: 1px solid #edb9b5;
  border-top: 4px solid #d8746e;
  background: linear-gradient(145deg, #fffafa 8%, #f8dfdd 100%);
  box-shadow: 0 4px 14px rgba(185, 79, 72, 0.11);
  color: #874642;
}

.metric-card--alert::after,
.metric-card--grave::after,
.metric-card--danger::after {
  display: none;
}

.metric-card--alert .metric-icon,
.metric-card--grave .metric-icon,
.metric-card--danger .metric-icon {
  background: rgba(216, 116, 110, 0.22);
  color: #874642;
}

.metric-card--alert .metric-label,
.metric-card--alert strong,
.metric-card--alert small,
.metric-card--grave .metric-label,
.metric-card--grave strong,
.metric-card--grave small,
.metric-card--danger .metric-label,
.metric-card--danger strong,
.metric-card--danger small {
  color: #874642 !important;
  text-shadow: none !important;
}

/* Modo Escuro (Dark Mode) para Cards Warning e Alert */
:root[data-theme="dark"] .metric-card--warning,
:root[data-theme="dark"] .metric-card--pending {
  border: 1px solid #74623b;
  border-top: 4px solid #b39342;
  background: linear-gradient(145deg, #3d3522 0%, #4c4021 100%);
  color: #f1dfb2;
}

:root[data-theme="dark"] .metric-card--warning .metric-icon,
:root[data-theme="dark"] .metric-card--pending .metric-icon {
  background: rgba(179, 147, 66, 0.25);
  color: #f1dfb2;
}

:root[data-theme="dark"] .metric-card--warning .metric-label,
:root[data-theme="dark"] .metric-card--warning strong,
:root[data-theme="dark"] .metric-card--warning small,
:root[data-theme="dark"] .metric-card--pending .metric-label,
:root[data-theme="dark"] .metric-card--pending strong,
:root[data-theme="dark"] .metric-card--pending small {
  color: #f1dfb2 !important;
}

:root[data-theme="dark"] .metric-card--alert,
:root[data-theme="dark"] .metric-card--grave,
:root[data-theme="dark"] .metric-card--danger {
  border: 1px solid #77504c;
  border-top: 4px solid #bd6d66;
  background: linear-gradient(145deg, #3f2d2b 0%, #523735 100%);
  color: #f0cfcc;
}

:root[data-theme="dark"] .metric-card--alert .metric-icon,
:root[data-theme="dark"] .metric-card--grave .metric-icon,
:root[data-theme="dark"] .metric-card--danger .metric-icon {
  background: rgba(189, 109, 102, 0.25);
  color: #f0cfcc;
}

:root[data-theme="dark"] .metric-card--alert .metric-label,
:root[data-theme="dark"] .metric-card--alert strong,
:root[data-theme="dark"] .metric-card--alert small,
:root[data-theme="dark"] .metric-card--grave .metric-label,
:root[data-theme="dark"] .metric-card--grave strong,
:root[data-theme="dark"] .metric-card--grave small,
:root[data-theme="dark"] .metric-card--danger .metric-label,
:root[data-theme="dark"] .metric-card--danger strong,
:root[data-theme="dark"] .metric-card--danger small {
  color: #f0cfcc !important;
}

.metric-card--primary .metric-label,
.metric-card--primary small,
.metric-card--soft .metric-label,
.metric-card--soft small,
.metric-card--warning .metric-label,
.metric-card--warning small,
.metric-card--pending .metric-label,
.metric-card--pending small,
.metric-card--alert .metric-label,
.metric-card--alert small,
.metric-card--grave .metric-label,
.metric-card--grave small {
  color: inherit;
}

:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .metric-card--primary,
:root[data-theme="dark"] .metric-card--soft {
  border: none;
  background: #0f6e56;
}

:root[data-theme="dark"] .metric-card--warning,
:root[data-theme="dark"] .metric-card--pending {
  background: #916209;
}

:root[data-theme="dark"] .metric-card--alert,
:root[data-theme="dark"] .metric-card--grave {
  background: #892321;
}

.grid-two,
.grid-three { min-height: 0; display: grid; gap: 10px; }
.grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-three { grid-template-columns: 1.02fr 1.03fr 0.7fr; }
.grid-two--main { flex: 1.25; }
.grid-three--summary { flex: 0.92; }
.grid-two--visits,
.grid-two--turnover { flex: 1.3; min-height: 190px; }
.grid-two--data { flex: 1.3; min-height: 190px; }
.grid-two--tables { flex: 1; min-height: 160px; }

.panel-card {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
}

.panel-heading {
  min-height: 32px;
  margin-bottom: 5px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading--compact { min-height: 38px; }
.panel-heading--with-legend { align-items: center; justify-content: flex-start; gap: 18px; }
.panel-heading h2 { color: var(--ink-strong); font-size: 0.875rem; font-weight: 750; line-height: 1.2; }
.panel-heading p { margin-top: 2px; color: var(--muted); font-size: 0.7rem; font-style: italic; }

.legend-inline { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.legend-inline span { display: inline-flex; align-items: center; gap: 4px; }
.legend-swatch { width: 8px; height: 8px; display: inline-block; border-radius: 2px; }
.swatch-dark { background: var(--green-800); }
.swatch-light { background: #a9d1c5; }
.swatch-medium { background: var(--green-400); }
.swatch-danger { background: var(--danger); }
.legend-line { width: 14px; height: 2px; display: inline-block; background: var(--green-950); }

.chart-box { position: relative; flex: 1; min-width: 0; min-height: 0; }
.chart-box--ranking { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--green-300) transparent; padding-bottom: 10px; }
.ranking-chart-inner { position: relative; min-height: 100%; padding-bottom: 8px; }
.chart-box--ranking::-webkit-scrollbar { width: 8px; }
.chart-box--ranking::-webkit-scrollbar-track { background: var(--surface-soft); }
.chart-box--ranking::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--green-300); }

.executive-summary { padding-bottom: 10px; }
.insight-list { flex: 1; display: grid; grid-template-rows: repeat(3, 1fr); }
.insight { min-height: 0; padding: 7px 0; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); }
.insight:first-child { border-top: 0; }
.insight-icon { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; border-radius: 50%; background: var(--green-800); font-weight: 800; }
.insight-icon--warning { background: var(--danger); }
.insight strong { color: var(--green-900); font-size: 0.625rem; }
.insight p { margin-top: 2px; color: var(--muted); font-size: 0.5625rem; }

.segmented-control { display: flex; gap: 5px; }
.segmented-control button { min-width: 92px; padding: 5px 10px; border: 0; border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 0.7rem; font-weight: 700; }
.segmented-control button.active { color: #fff; background: var(--green-800); }
.segmented-control button:not(.active):hover { color: var(--green-900); background: var(--green-100); cursor: pointer; }

.panel-heading--with-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chart-horizon-control { gap: 3px; }
.chart-horizon-control button {
  min-width: 38px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.6562rem;
  font-weight: 700;
  transition: background 120ms ease, color 120ms ease;
}
.chart-horizon-control button.active {
  background: var(--green-800);
  color: #fff;
}

.table-card {
  padding-bottom: 9px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.record-count { color: var(--muted); font-size: 0.7rem; font-weight: 650; }
.table-scroll {
  flex: 1 1 0;
  min-width: 0;
  min-height: 80px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--green-300) transparent;
}
.table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: var(--surface-soft); }
.table-scroll::-webkit-scrollbar-thumb { border-radius: 6px; background: var(--green-300); }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--green-600); }

.data-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.6875rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  position: relative;
  padding: 4px 5px;
  color: #334155;
  background: #f4f5f7;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.6562rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-align: center;
  text-transform: none;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  transition: background 150ms ease, color 150ms ease;
}

/* Alça de Redimensionamento Manual de Coluna */
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-resizer::after {
  content: "";
  display: block;
  width: 2px;
  height: 55%;
  background-color: rgba(0, 0, 0, 0.08);
  border-radius: 1px;
  transition: background-color 150ms ease, width 150ms ease, height 150ms ease, box-shadow 150ms ease;
}

.data-table th:hover .col-resizer::after {
  background-color: rgba(17, 119, 93, 0.4);
  height: 75%;
}

:root[data-theme="dark"] .col-resizer::after {
  background-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .data-table th:hover .col-resizer::after {
  background-color: rgba(124, 224, 204, 0.45);
}

.col-resizer:hover::after,
.col-resizer.is-active::after {
  background-color: var(--lr-primary-light, #10b981) !important;
  width: 3px;
  height: 90%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

body.table-resizing,
body.table-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

:root[data-theme="dark"] .data-table th {
  background: #143530;
  color: #e2e8f0;
  border-bottom-color: #244741;
}

.data-table th:hover {
  background: #e2e8f0;
  color: #0F6E56;
}

:root[data-theme="dark"] .data-table th:hover {
  background: #1e4a42;
  color: #7ce0cc;
}

.data-table th.sortable::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 0.5312rem;
  display: inline-block;
  margin-left: 2px;
}

.data-table th.sort-asc::after {
  content: " ▲";
  opacity: 1;
  color: #0F6E56;
  font-size: 0.5312rem;
  display: inline-block;
  margin-left: 2px;
}

.data-table th.sort-desc::after {
  content: " ▼";
  opacity: 1;
  color: #0F6E56;
  font-size: 0.5312rem;
  display: inline-block;
  margin-left: 2px;
}

:root[data-theme="dark"] .data-table th.sort-asc::after,
:root[data-theme="dark"] .data-table th.sort-desc::after {
  color: #7ce0cc;
}

.data-table td {
  padding: 3.5px 6px;
  font-size: 0.6562rem;
  line-height: 1.15;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.data-table tbody tr td {
  background: var(--surface);
}

.data-table tbody tr:nth-child(even) td {
  background: var(--surface);
}

.data-table tbody tr:hover td {
  background: var(--green-100);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table strong {
  color: var(--ink-strong);
  font-weight: 700;
}

/* Linha de Mini-Filtros por Coluna (Estilo Excel) */
.data-table thead tr.table-filter-row th {
  padding: 3px 4px !important;
  background: var(--surface-subtle, #f3f8f5) !important;
  border-bottom: 1.5px solid var(--line-soft, #dde7e3) !important;
  font-weight: normal !important;
  cursor: default !important;
}

:root[data-theme="dark"] .data-table thead tr.table-filter-row th {
  background: #15221f !important;
  border-bottom-color: #243b35 !important;
}

.table-col-filter {
  width: 100%;
  height: 22px;
  padding: 2px 6px;
  font-size: 0.625rem;
  font-family: inherit;
  color: var(--ink, #1e293b);
  background: var(--surface, #ffffff);
  border: 1px solid var(--line-soft, #d1d5db);
  border-radius: 4px;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.table-col-filter::placeholder {
  color: var(--muted, #94a3b8);
  font-size: 0.5938rem;
}

.table-col-filter:focus {
  border-color: var(--green-400, #0F6E56);
  background: var(--surface, #ffffff);
  box-shadow: 0 0 0 1.5px rgba(15, 110, 86, 0.18);
}

:root[data-theme="dark"] .table-col-filter {
  background: #0f1715;
  color: #f1f5f9;
  border-color: #2d453e;
}

:root[data-theme="dark"] .table-col-filter:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 1.5px rgba(16, 185, 129, 0.25);
}

/* Helpers de Alinhamento */
.col-left { text-align: left !important; }
.col-center { text-align: center !important; }
.col-right { text-align: right !important; }
.col-center .table-col-filter,
th.col-center .table-col-filter { text-align: center !important; }
.font-tabular { font-variant-numeric: tabular-nums; }

/* Larguras de Colunas Otimizadas por Tabela */
/* Tabela 1: Produtores sem visita */
#tableSemVisita th:nth-child(1) { width: 8%; }
#tableSemVisita th:nth-child(2) { width: 16%; }
#tableSemVisita th:nth-child(3) { width: 17%; }
#tableSemVisita th:nth-child(4) { width: 11%; }
#tableSemVisita th:nth-child(5) { width: 12%; }
#tableSemVisita th:nth-child(6) { width: 11%; }
#tableSemVisita th:nth-child(7) { width: 9%; }
#tableSemVisita th:nth-child(8) { width: 6%; }
#tableSemVisita th:nth-child(9) { width: 9%; }
#tableSemVisita th:nth-child(10) { width: 14%; }

/* Tabela 2: Produtores visitados */
#tableVisitados th:nth-child(1) { width: 8%; }
#tableVisitados th:nth-child(2) { width: 20%; }
#tableVisitados th:nth-child(3) { width: 26%; }
#tableVisitados th:nth-child(4) { width: 8%; }
#tableVisitados th:nth-child(5) { width: 12%; text-align: center !important; }
#tableVisitados th:nth-child(6) { width: 13%; text-align: center !important; }
#tableVisitados th:nth-child(7) { width: 13%; text-align: center !important; }

#tableVisitados td:nth-child(5),
#tableVisitados td:nth-child(6),
#tableVisitados td:nth-child(7) {
  text-align: center !important;
}

.btn-elabore-detail,
.link-button {
  background: transparent !important;
  color: #0F6E56 !important;
  border: none !important;
  padding: 0 !important;
  font-size: 0.6875rem !important;
  font-weight: 750 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  transition: color 140ms ease, opacity 140ms ease !important;
}

.btn-elabore-detail:hover,
.link-button:hover {
  color: var(--green-800, #005854) !important;
  text-decoration: underline !important;
}

:root[data-theme="dark"] .btn-elabore-detail,
:root[data-theme="dark"] .link-button {
  color: #7ce0cc !important;
}

:root[data-theme="dark"] .btn-elabore-detail:hover,
:root[data-theme="dark"] .link-button:hover {
  color: #a3f0e0 !important;
  text-decoration: underline !important;
}

.badge-neutral {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

:root[data-theme="dark"] .badge-neutral {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

.badge-transparent {
  background: transparent;
  color: var(--text-muted, #64748b);
  border: 1px dashed rgba(100, 116, 139, 0.35);
  font-weight: 500;
  opacity: 0.8;
}

:root[data-theme="dark"] .badge-transparent {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.badge-transparent-danger {
  background: rgba(239, 68, 68, 0.05);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-weight: 500;
}

:root[data-theme="dark"] .badge-transparent-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

/* Tabela 3: Movimentação dos produtores */
#tableTurnover th:nth-child(1) { width: 10%; min-width: 95px; }
#tableTurnover th:nth-child(2) { width: 25%; }
#tableTurnover th:nth-child(3) { width: 12%; }
#tableTurnover th:nth-child(4) { width: 13%; }
#tableTurnover th:nth-child(5) { width: 20%; }
#tableTurnover th:nth-child(6) { width: 20%; }

/* Tabela 4: Consultores ativos */
#tableConsultants th:nth-child(1) { width: 34%; }
#tableConsultants th:nth-child(2) { width: 13%; }
#tableConsultants th:nth-child(3) { width: 13%; }
#tableConsultants th:nth-child(4) { width: 13%; }
#tableConsultants th:nth-child(5) { width: 14%; }
#tableConsultants th:nth-child(6) { width: 13%; }

/* Tabela 5: Produtores com dados */
#tableDataProducers th:nth-child(1) { width: 8%; }
#tableDataProducers th:nth-child(2) { width: 24%; }
#tableDataProducers th:nth-child(3) { width: 18%; }
#tableDataProducers th:nth-child(4) { width: 10%; text-align: center !important; }
#tableDataProducers th:nth-child(5) { width: 13%; text-align: center !important; }
#tableDataProducers th:nth-child(6) { width: 13%; text-align: center !important; }
#tableDataProducers th:nth-child(7) { width: 14%; }

#tableDataProducers td:nth-child(4),
#tableDataProducers td:nth-child(5),
#tableDataProducers td:nth-child(6) {
  text-align: center !important;
}

/* Tabela 6: Consistência Mensal e Anual das Fazendas */
#tableInconsistencies {
  min-width: 640px;
}
#tableInconsistencies th:nth-child(1) { width: 10%; }
#tableInconsistencies th:nth-child(2) { width: 20%; }
#tableInconsistencies th:nth-child(3) { width: 14%; }
#tableInconsistencies th:nth-child(4) { width: 28%; }
#tableInconsistencies th:nth-child(5) { width: 8%; }
#tableInconsistencies th:nth-child(6) { width: 11%; }
#tableInconsistencies th:nth-child(7) { width: 11%; }
#tableInconsistencies th:nth-child(8) { width: 9%; }

.empty-cell {
  padding: 16px !important;
  color: var(--muted) !important;
  text-align: center;
}

.badge {
  min-width: 0;
  max-width: 100%;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.5938rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.badge-positive { color: var(--green-900); background: #dff3e9; border: 1px solid #bcead8; }
.badge-danger, .badge-grave { color: #991b1b; background: #feebe9; border: 1px solid #fecaca; }
.badge-warning, .badge-pending { color: #8c5304; background: #fff8e6; border: 1px solid #fde68a; }
.badge-info { color: #176695; background: #e7f3fb; border: 1px solid #bae6fd; }

:root[data-theme="dark"] .badge-positive { color: #9cf0d8; background: #174c40; border-color: #27695a; }
:root[data-theme="dark"] .badge-danger, :root[data-theme="dark"] .badge-grave { color: #fca5a5; background: #3c1919; border-color: #582424; }
:root[data-theme="dark"] .badge-warning, :root[data-theme="dark"] .badge-pending { color: #fde047; background: #3a2d0b; border-color: #544111; }
:root[data-theme="dark"] .badge-info { color: #a9d8f5; background: #1d4053; border-color: #2e5971; }

.table-row-pending {
  background-color: rgba(245, 158, 11, 0.07) !important;
}

.table-row-grave {
  background-color: rgba(239, 68, 68, 0.08) !important;
}

:root[data-theme="dark"] .table-row-pending {
  background-color: rgba(245, 158, 11, 0.12) !important;
}

/* Paginação de Tabelas */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 4px 0 4px;
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  font-size: 0.6875rem;
  color: var(--muted);
  user-select: none;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pagination-info strong {
  color: var(--ink-strong);
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-size-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
}

.pagination-size-wrap label {
  color: var(--muted);
  font-weight: 600;
}

.pagination-size-select {
  padding: 2px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: border-color 150ms ease;
}

.pagination-size-select:hover,
.pagination-size-select:focus {
  border-color: var(--lr-primary-light, #10b981);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--green-100);
  color: var(--green-950);
  border-color: var(--green-300);
}

.pagination-btn.active {
  background: var(--green-800);
  color: #ffffff;
  border-color: var(--green-800);
  font-weight: 700;
}

.pagination-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  border-color: var(--line-soft);
  background: transparent;
}

.pagination-ellipsis {
  padding: 0 3px;
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 24px;
}

:root[data-theme="dark"] .pagination-size-select {
  background: #13332d;
  color: #e2e8f0;
  border-color: #244741;
}

:root[data-theme="dark"] .pagination-btn {
  background: #143530;
  color: #e2e8f0;
  border-color: #244741;
}

:root[data-theme="dark"] .pagination-btn:hover:not(:disabled) {
  background: #1e4a42;
  color: #7ce0cc;
  border-color: #3b7367;
}

:root[data-theme="dark"] .pagination-btn.active {
  background: #10b981;
  color: #072824;
  border-color: #10b981;
}

:root[data-theme="dark"] .pagination-btn:disabled {
  background: transparent;
  color: #64748b;
  border-color: #1f3b35;
}

:root[data-theme="dark"] .table-row-grave {
  background-color: rgba(239, 68, 68, 0.14) !important;
}

.link-button {
  color: var(--green-700);
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: color 140ms ease;
}

.link-button:hover {
  color: var(--green-900);
  text-decoration: underline;
}

:root[data-theme="dark"] .link-button {
  color: #7ce0cc;
  border: 0;
  background: transparent;
}

:root[data-theme="dark"] .link-button:hover {
  color: #a3f7e6;
  text-decoration: underline;
}

.criteria-strip {
  min-height: 50px;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 7px;
}

.criteria-icon { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: var(--green-800); font-weight: 800; flex-shrink: 0; }
.criteria-strip strong { color: var(--ink-strong); font-size: 0.625rem; }
.criteria-strip p { margin-top: 1px; color: var(--muted); font-size: 0.5625rem; line-height: 1.2; }

.panel-card--quality {
  display: flex;
  flex-direction: column;
  padding: 10px 14px 10px;
}

.panel-card--quality .panel-heading {
  min-height: 28px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.quality-content {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: calc(100% - 32px);
  overflow: hidden;
}

.quality-donuts-wrapper {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.quality-donut-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
  overflow: hidden;
}

.quality-donut-col .chart-box--quality {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  flex: 1 1 0;
}

.quality-donut-col .chart-box--quality canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  display: block;
}

.quality-legend-sidebar {
  flex: 0 0 135px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 0 4px;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

.quality-legend-sidebar .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-strong);
  font-size: 0.6875rem;
  font-weight: 650;
  white-space: nowrap;
}

.quality-legend-sidebar .legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2.5px;
  flex-shrink: 0;
}

.quality-legend-sidebar .dot-aptos {
  background: var(--green-950);
}

.quality-legend-sidebar .dot-incompletos {
  background: var(--warning);
}

.quality-legend-sidebar .dot-divergentes {
  background: var(--danger);
}

:root[data-theme="dark"] .quality-legend-sidebar .dot-aptos {
  background: var(--green-300);
}

.app-footer {
  flex: 0 0 var(--footer-h);
  position: relative;
  z-index: 50;
  isolation: isolate;
  height: var(--footer-h);
  min-height: var(--footer-h);
  margin-top: auto;
  padding: 4px 24px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  color: #fff;
  background: var(--green-950);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo { display: flex; align-items: center; }
.footer-logo img { width: 114px; height: 38px; object-fit: contain; object-position: left center; }

.carousel-navigation { position: relative; z-index: 51; min-width: 280px; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; }
.current-slide-title { min-height: 14px; margin-bottom: 3px; color: #fff; font-size: 0.6875rem; font-weight: 700; text-align: center; }
.carousel-controls { position: relative; z-index: 52; display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: auto; }

.carousel-arrow,
.page-dot { border: 0; color: #fff; background: transparent; cursor: pointer; pointer-events: auto; touch-action: manipulation; user-select: none; }
.carousel-arrow { width: 30px; height: 30px; display: grid; place-items: center; font-size: 1.625rem; font-weight: 300; line-height: 1; opacity: 0.85; border-radius: 50%; transition: background 150ms ease, opacity 150ms ease; }
.page-dot { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1.5px solid rgba(255, 255, 255, 0.6); border-radius: 50%; font-size: 0.6875rem; font-weight: 700; color: #fff; background: transparent; transition: all 180ms ease; flex-shrink: 0; }
.page-dot.active { width: 28px; height: 28px; color: var(--green-950); border-color: var(--green-300); border-radius: 50%; background: var(--green-300); font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.page-dot:hover { color: var(--green-950); background: var(--green-300); border-color: var(--green-300); }
.carousel-arrow:hover { color: #ffffff; background: transparent; opacity: 1; }

.footer-brand { color: rgba(255, 255, 255, 0.92); font-size: 0.7rem; font-weight: 650; text-align: right; }

.pulse-update { animation: value-pulse 600ms ease-out; }
@keyframes value-pulse { 0% { color: var(--green-400); transform: scale(1.03); } 100% { color: inherit; transform: scale(1); } }

@media (max-width: 1380px) {
  :root { --header-h: 52px; --filters-h: 0px; --footer-h: 68px; }
  .app-header { padding: 0 12px; gap: 8px; }
  .header-title-box h1 { font-size: 0.9375rem; }
  .filter-control { min-width: 66px; padding: 2px 5px; }
  .select-display-value { font-size: 0.625rem; }
  .carousel-pause-toggle { padding: 0 7px; font-size: 0.625rem; }
  .update-block { min-width: 88px; }
  .slide { padding: 8px 20px 10px; gap: 8px; }
  .kpi-grid { height: 84px; min-height: 84px; gap: 8px; }
  .panel-card { padding: 8px 10px; }
  .panel-heading { min-height: 25px; }
  .data-table { font-size: 0.6562rem; }
  .data-table th,
  .data-table td { padding: 4px 5px; }
  .badge { font-size: 0.5625rem; padding: 1.5px 4.5px; }
  .link-button { font-size: 0.625rem; }
  .criteria-strip { min-height: 40px; padding-block: 4px; }
  .footer-logo img { width: 105px; height: 36px; }
  .current-slide-title { margin-bottom: 3px; font-size: 0.6562rem; }
  .page-dot { width: 24px; height: 24px; }
  .page-dot.active { width: 24px; height: 24px; }
}

@media (max-width: 1120px) {
  .mobile-filter-toggle { display: inline-flex !important; }
  .header-title-box { min-width: fit-content; }
  .filter-shell {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }
  .filter-shell.is-expanded {
    display: flex !important;
  }
  .filter-control {
    min-width: 120px;
    max-width: none;
    flex: 1 1 22%;
  }
}

@media (max-height: 760px) {
  :root { --header-h: 46px; --filters-h: 0px; --footer-h: 62px; }
  .app-header { padding-inline: 10px; }
  .header-title-box h1 { font-size: 0.875rem; }
  .screen-code { font-size: 0.4375rem; }
  .theme-toggle,
  .carousel-pause-toggle { min-height: 28px; height: 28px; }
  .theme-toggle { width: 28px; min-width: 28px; }
  .filter-control { height: 28px; padding-block: 1px; }
  .slide { padding: 6px 16px 8px; gap: 6px; }
  .kpi-grid { height: 78px; min-height: 78px; gap: 6px; }
  .panel-heading { margin-bottom: 2px; }
  .panel-heading h2 { font-size: 0.75rem; }
  .panel-heading p,
  .legend-inline { font-size: 0.7rem; }
  .data-table,
  .data-table th { font-size: 0.6375rem; }
  .data-table th,
  .data-table td { padding: 3.5px 5px; }
  .badge { font-size: 0.55rem; padding: 1px 4px; }
  .link-button { font-size: 0.5938rem; }
  .criteria-strip { min-height: 36px; }
  .criteria-icon { width: 25px; height: 25px; }
  .footer-logo img { height: 36px; }
  .current-slide-title { min-height: 15px; margin-bottom: 3px; font-size: 0.625rem; }
  .page-dot { width: 23px; height: 23px; aspect-ratio: 1 / 1; border-radius: 50%; }
  .page-dot.active { width: 23px; height: 23px; aspect-ratio: 1 / 1; border-radius: 50%; }
}

/* Modal de Detalhes da Inconsistência (Estilo Elabore) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  width: 92%;
  max-width: 820px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 18px;
  border: 1px solid rgba(0, 77, 73, 0.12);
  box-shadow: 0 24px 60px rgba(0, 50, 40, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(12px) scale(0.97);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

:root[data-theme="dark"] .modal-card {
  background: #0f3833;
  color: #f1fbf8;
  border-color: #1c4a43;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

:root[data-theme="dark"] .modal-header {
  background: #0f3833;
  border-bottom-color: #1c4a43;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header-left .modal-icon {
  font-size: 1.375rem;
  color: var(--green-800);
}

.modal-header-left h3 {
  font-size: 1.0625rem;
  font-weight: 750;
  color: var(--green-950);
  margin: 0;
  letter-spacing: -0.01em;
}

:root[data-theme="dark"] .modal-header-left h3 {
  color: #8be4d2;
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-ref-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 16px;
  background: #eaf6f3;
  border: 1px solid #cceee6;
  border-radius: 12px;
  color: #005854;
  line-height: 1.2;
}

:root[data-theme="dark"] .modal-ref-badge {
  background: #15423c;
  border-color: #24544b;
  color: #8be4d2;
}

.modal-ref-badge span {
  font-size: 0.5312rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.modal-ref-badge strong {
  font-size: 0.8125rem;
  font-weight: 800;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.375rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: all 140ms ease;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

:root[data-theme="dark"] .modal-close-btn:hover {
  background: #1c4a43;
  color: #ffffff;
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 72vh;
  overflow-y: auto;
  background: #fafcfb;
}

:root[data-theme="dark"] .modal-body {
  background: #092c28;
}

.modal-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px 18px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

:root[data-theme="dark"] .modal-fieldset {
  border-color: #1c4a43;
  background: #0f3833;
}

.modal-legend {
  padding: 0 8px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-800);
}

:root[data-theme="dark"] .modal-legend {
  color: #8be4d2;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 18px;
  margin-top: 4px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-field.field-full {
  grid-column: span 2;
}

.field-label {
  font-size: 0.625rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

:root[data-theme="dark"] .field-label {
  color: #a9bbb6;
}

.field-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  min-height: 38px;
  display: flex;
  align-items: center;
}

:root[data-theme="dark"] .field-box {
  background: #143e38;
  border-color: #24544b;
  color: #f1fbf8;
}

.field-box--bold {
  font-weight: 750;
  color: var(--green-950);
}

:root[data-theme="dark"] .field-box--bold {
  color: #8be4d2;
}

.field-box--highlight,
.field-box--warning {
  background: #fff8e6;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning);
  color: #7c5a18;
  font-weight: 550;
  line-height: 1.45;
}

:root[data-theme="dark"] .field-box--highlight,
:root[data-theme="dark"] .field-box--warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-left: 4px solid #f59e0b;
  color: #fef08a;
}

.field-box--danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  color: #991b1b;
  font-weight: 550;
  line-height: 1.45;
}

:root[data-theme="dark"] .field-box--danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-left: 4px solid #ef4444;
  color: #fca5a5;
}

.modal-footer {
  padding: 14px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

:root[data-theme="dark"] .modal-footer {
  background: #0f3833;
  border-top-color: #1c4a43;
}

.modal-btn-secondary {
  border: 1.5px solid var(--green-800);
  color: var(--green-800);
  background: #ffffff;
  border-radius: 20px;
  padding: 7px 22px;
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 160ms ease;
}

.modal-btn-secondary:hover {
  background: var(--green-100);
  border-color: var(--green-900);
}

:root[data-theme="dark"] .modal-btn-secondary {
  border-color: #4fc9b0;
  color: #4fc9b0;
  background: transparent;
}

:root[data-theme="dark"] .modal-btn-secondary:hover {
  background: rgba(79, 201, 176, 0.15);
}

.modal-btn-primary {
  background: var(--green-800);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 8px 24px;
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 77, 73, 0.18);
  transition: all 160ms ease;
}

.modal-btn-primary:hover {
  background: var(--green-950);
  box-shadow: 0 4px 14px rgba(0, 77, 73, 0.3);
}

/* ==========================================================================
   ESTILOS DE RASTREABILIDADE E PROVENIÊNCIA DE DADOS (DATA LINEAGE)
   ========================================================================== */
.update-block--interactive {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  border-radius: 12px;
  padding: 4px 8px;
  transition: all 180ms ease;
}

.update-block--interactive:hover {
  background: rgba(0, 88, 84, 0.08);
  border-color: rgba(0, 88, 84, 0.2);
  transform: translateY(-1px);
}

:root[data-theme="dark"] .update-block--interactive:hover {
  background: rgba(139, 228, 210, 0.12);
  border-color: rgba(139, 228, 210, 0.3);
}

.update-block-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-provenance {
  font-size: 0.875rem;
  color: var(--green-800);
}

:root[data-theme="dark"] .icon-provenance {
  color: #8be4d2;
}

.modal-card--provenance {
  max-width: 980px;
  width: 95%;
}

.provenance-header-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #64748b;
}

:root[data-theme="dark"] .provenance-header-sub {
  color: #a9bbb6;
}

.provenance-modal-body {
  padding: 20px 24px;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.provenance-summary-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] .provenance-summary-card {
  background: #0f3833;
  border-color: #1c4a43;
}

.prov-summary-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prov-summary-label {
  font-size: 0.5938rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

:root[data-theme="dark"] .prov-summary-label {
  color: #a9bbb6;
}

.prov-summary-value {
  font-size: 0.7812rem;
  font-weight: 700;
  color: var(--green-950);
  word-break: break-word;
}

:root[data-theme="dark"] .prov-summary-value {
  color: #f1fbf8;
}

.prov-summary-value--ok {
  color: #059669;
}

:root[data-theme="dark"] .prov-summary-value--ok {
  color: #34d399;
}

/* Seção de Sincronização de Tabelas de Consistência */
.provenance-sync-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provenance-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.prov-sec-icon {
  font-size: 1.125rem;
  color: var(--green-700);
}

:root[data-theme="dark"] .prov-sec-icon {
  color: #5eead4;
}

.provenance-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-900);
}

:root[data-theme="dark"] .provenance-section-title {
  color: #ccfbf1;
}

.provenance-sync-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.prov-sync-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

:root[data-theme="dark"] .prov-sync-card {
  background: #0f3833;
  border-color: #1c4a43;
}

.prov-sync-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

:root[data-theme="dark"] .prov-sync-card-header {
  border-bottom-color: #1a453f;
}

.prov-sync-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prov-sync-icon {
  font-size: 1.25rem;
  color: var(--green-800);
}

:root[data-theme="dark"] .prov-sync-icon {
  color: #5eead4;
}

.prov-sync-title {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--green-950);
  display: block;
}

:root[data-theme="dark"] .prov-sync-title {
  color: #f1fbf8;
}

.prov-sync-subtitle {
  font-size: 0.6562rem;
  color: #64748b;
  display: block;
}

:root[data-theme="dark"] .prov-sync-subtitle {
  color: #94a3b8;
}

.prov-sync-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 3px 10px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  white-space: nowrap;
}

:root[data-theme="dark"] .prov-sync-badge {
  background: #064e3b;
  color: #6ee7b7;
  border-color: #047857;
}

.prov-sync-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prov-sync-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
}

.prov-sync-label {
  font-weight: 600;
  color: #64748b;
}

:root[data-theme="dark"] .prov-sync-label {
  color: #a9bbb6;
}

.prov-sync-val {
  font-weight: 750;
  color: var(--green-950);
}

:root[data-theme="dark"] .prov-sync-val {
  color: #f1fbf8;
}

.provenance-groups-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prov-category-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

:root[data-theme="dark"] .prov-category-card {
  background: #0f3833;
  border-color: #1c4a43;
}

.prov-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

:root[data-theme="dark"] .prov-category-header {
  background: #143e38;
  border-bottom-color: #1c4a43;
}

.prov-category-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prov-cat-icon {
  font-size: 1.125rem;
  color: var(--green-800);
}

:root[data-theme="dark"] .prov-cat-icon {
  color: #8be4d2;
}

.prov-category-title {
  font-size: 0.7812rem;
  font-weight: 750;
  color: var(--green-950);
}

:root[data-theme="dark"] .prov-category-title {
  color: #8be4d2;
}

.prov-category-count {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 10px;
  background: #eaf6f3;
  color: #005854;
  border-radius: 12px;
}

:root[data-theme="dark"] .prov-category-count {
  background: #15423c;
  color: #8be4d2;
}

.prov-file-list {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid #f1f5f9;
}

:root[data-theme="dark"] .prov-file-list {
  divide-color: #1c4a43;
}

.prov-file-item {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr 1fr;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  font-size: 0.7188rem;
  transition: background 140ms ease;
}

.prov-file-item:hover {
  background: #fafcfb;
}

:root[data-theme="dark"] .prov-file-item:hover {
  background: rgba(139, 228, 210, 0.05);
}

.prov-file-name-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prov-file-name {
  font-weight: 700;
  color: #0f172a;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.7188rem;
}

:root[data-theme="dark"] .prov-file-name {
  color: #f1fbf8;
}

.prov-file-desc {
  font-size: 0.625rem;
  color: #64748b;
}

:root[data-theme="dark"] .prov-file-desc {
  color: #a9bbb6;
}

.prov-file-date {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.prov-date-label {
  font-size: 0.5312rem;
  font-weight: 750;
  text-transform: uppercase;
  color: #94a3b8;
}

.prov-date-val {
  font-weight: 600;
  color: #334155;
}

:root[data-theme="dark"] .prov-date-val {
  color: #e2e8f0;
}

.prov-badge-size {
  display: inline-block;
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.6562rem;
  color: #475569;
  text-align: center;
}

:root[data-theme="dark"] .prov-badge-size {
  background: #1c4a43;
  color: #cbd5e1;
}

.prov-badge-records {
  display: inline-block;
  padding: 2px 8px;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.6562rem;
  color: #065f46;
  text-align: center;
}

:root[data-theme="dark"] .prov-badge-records {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.provenance-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: #64748b;
}

/* ─── Ações do Cabeçalho e Botões de Exportação CSV ──────────────────────── */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-table-export {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-050);
  border: 1px solid var(--green-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
  line-height: 1.2;
}

.btn-table-export:hover {
  background: var(--green-100);
  color: var(--green-800);
  border-color: var(--green-300);
  transform: translateY(-1px);
}

.btn-table-export:active {
  transform: translateY(0);
}

.btn-table-export .material-symbols-rounded {
  font-size: 0.875rem;
}

:root[data-theme="dark"] .btn-table-export {
  background: var(--green-100);
  border-color: var(--green-200);
  color: var(--green-300);
}

:root[data-theme="dark"] .btn-table-export:hover {
  background: var(--green-200);
  color: var(--ink-strong);
}

/* -------------------------------------------------------------------------- */
/* Botão e Modo Tela Cheia por Painel (S-01)                                 */
/* -------------------------------------------------------------------------- */
.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-panel-fs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  opacity: 0.7;
  transition: all 160ms ease;
  line-height: 1;
  flex-shrink: 0;
}

.btn-panel-fs:hover,
.btn-panel-fs:focus-visible {
  opacity: 1;
  color: var(--ink-strong);
  background: var(--green-100);
  border-color: var(--green-300);
  transform: scale(1.06);
}

.btn-panel-fs .material-symbols-rounded {
  font-size: 1rem;
}

:root[data-theme="dark"] .btn-panel-fs {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
}

:root[data-theme="dark"] .btn-panel-fs:hover {
  background: var(--green-200);
  border-color: var(--green-300);
  color: #ffffff;
}

/* Backdrop para Tela Cheia de Painéis */
.panel-fullscreen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(6, 14, 13, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 200ms ease;
}

.panel-fullscreen-backdrop[hidden] {
  display: none;
}

/* Painel Expandido em Tela Cheia (Centralizado: 80% largura, 80% altura) */
.panel-card.is-fullscreen {
  position: fixed !important;
  top: 10vh !important;
  left: 10vw !important;
  width: 80vw !important;
  height: 80vh !important;
  max-width: 1600px !important;
  max-height: 80vh !important;
  margin: 0 !important;
  border-radius: 16px !important;
  border: 1.5px solid var(--green-400) !important;
  background: var(--surface) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(110, 231, 183, 0.3) !important;
  display: flex !important;
  flex-direction: column !important;
  z-index: 9995 !important;
  animation: panelFsEnter 200ms cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px 20px !important;
}

@media (max-width: 1024px) {
  .panel-card.is-fullscreen {
    top: 3vh !important;
    left: 4vw !important;
    width: 92vw !important;
    height: 94vh !important;
  }
}

.panel-card.is-fullscreen .panel-heading {
  padding-right: 120px !important;
  margin-bottom: 8px !important;
}

/* Botão Dedicado de Fechar na Parte Superior */
.panel-fullscreen-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-strong);
  font-size: 0.7188rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 160ms ease;
  user-select: none;
}

.panel-fullscreen-close-btn .material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
}

.panel-fullscreen-close-btn:hover {
  background: #e23e3b;
  border-color: #e23e3b;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(226, 62, 59, 0.4);
}

:root[data-theme="dark"] .panel-fullscreen-close-btn {
  background: #284340;
  border-color: #528079;
  color: #F4FCFA;
}

:root[data-theme="dark"] .panel-fullscreen-close-btn:hover {
  background: #e23e3b;
  border-color: #e23e3b;
  color: #ffffff;
}

.panel-card.is-fullscreen .btn-panel-fs {
  opacity: 1;
  background: var(--green-200);
  border-color: var(--green-400);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.panel-card.is-fullscreen .btn-panel-fs:hover {
  background: #e23e3b;
  border-color: #e23e3b;
  color: #ffffff;
  transform: scale(1.1);
}

@keyframes panelFsEnter {
  from {
    opacity: 0.4;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.panel-card.is-fullscreen .chart-box {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

.panel-card.is-fullscreen .chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.panel-card.is-fullscreen .table-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
}

/* Tabela detalhada exibida somente quando o painel (Cadastro / Top 10 Margem Bruta) está em
   tela cheia — no modo compacto do carrossel só o gráfico aparece. Em tela cheia o gráfico
   é ocultado por completo e a tabela ocupa todo o painel, no mesmo padrão das tabelas das
   páginas 1–3 (contagem de registros, exportar CSV, filtro por coluna e paginação). */
.panel-table-view {
  display: none;
}

.panel-card.is-fullscreen .chart-box--with-table {
  display: none;
}

.panel-card.is-fullscreen .panel-table-view {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.panel-table-view-heading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-card.is-fullscreen .panel-table-view .table-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.panel-table-view-title {
  margin-right: auto;
  color: var(--ink-strong);
  font-size: 0.8125rem;
  font-weight: 750;
}

/* Controles que só fazem sentido para o gráfico (ex.: horizonte 1M/6M/12M) somem
   quando o painel expandido passa a mostrar a tabela. */
.panel-card.is-fullscreen .chart-only-control {
  display: none;
}

/* Painel "Quantidade de visitas" em tela cheia: uma tabela por dimensão do ranking
   (Produtor/Consultor), alternada pelo mesmo seletor do gráfico. */
.ranking-table-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.ranking-table-pane[hidden] {
  display: none;
}

.data-table strong.text-positive { color: var(--green-700, #11775d); }
.data-table strong.text-negative { color: var(--danger, #e23e3b); }

.panel-card.is-fullscreen .quality-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.panel-card.is-fullscreen .quality-donuts-wrapper {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.panel-card.is-fullscreen .quality-donut-col {
  height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.panel-card.is-fullscreen .chart-box--quality {
  width: 340px;
  height: 340px;
}

/* ─── 📱 DESIGN RESPONSIVO - ADAPTAÇÃO PARA AGROINDÚSTRIAS & TELAS MENORES ─── */

.mobile-filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-strong);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.mobile-filter-toggle:hover {
  background: var(--green-100);
  border-color: var(--green-400);
  color: var(--green-400);
}

:root[data-theme="dark"] .mobile-filter-toggle {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink-strong);
}

@media (max-width: 1280px) {
  :root {
    --header-h: 74px;
    --filters-h: 68px;
    --footer-h: 64px;
  }
  .app-header { padding: 8px 18px; }
  .header-title-box h1 { font-size: 1.25rem; }
  .filter-shell { padding: 6px 18px; gap: 8px; }
  .filter-control { height: 48px; padding-inline: 8px; }
  .filter-control span { font-size: 0.625rem; }
  .filter-control select { font-size: 0.75rem; }
  .kpi-grid { height: auto; min-height: 84px; gap: 8px; }
  .metric-card strong { font-size: 1.25rem; }
}

@media (max-width: 1024px) {
  :root {
    --header-h: 68px;
    --filters-h: auto;
    --footer-h: auto;
  }

  body {
    overflow-y: auto !important;
  }

  .carousel-viewport {
    height: auto !important;
    min-height: calc(100vh - var(--header-h) - 60px);
    overflow-y: visible !important;
  }

  .carousel-track {
    height: auto !important;
  }

  .slide {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 14px 16px 28px;
    gap: 22px !important;
  }

  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 12px !important;
  }

  .metric-card {
    height: auto !important;
    padding: 10px 12px !important;
  }

  .grid-two,
  .grid-two--visits,
  .grid-two--turnover,
  .grid-two--data,
  .grid-two--tables,
  .grid-two--main,
  .grid-three,
  .grid-three--summary {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    gap: 22px !important;
  }

  .grid-two--tables {
    margin-top: 6px !important;
  }

  .panel-card {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
  }

  .panel-heading {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    margin-bottom: 10px !important;
    flex-shrink: 0 !important;
  }

  .panel-heading h2 {
    font-size: 0.875rem !important;
    line-height: 1.3 !important;
  }

  .chart-box {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    height: 300px !important;
    min-height: 260px !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .chart-box--ranking {
    height: 360px !important;
  }

  .table-card {
    height: auto !important;
    min-height: 360px !important;
  }

  .table-scroll {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    max-height: 380px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
  }

  .data-table {
    min-width: 640px;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .header-title-box {
    min-width: 0;
    flex: 1 1 auto;
  }

  .header-title-box h1 { font-size: 1.125rem; }
  .screen-code { font-size: 0.5rem; }
  .header-title-box p { display: none; }

  .header-actions {
    gap: 6px;
  }

  .update-block {
    display: none !important;
  }

  .mobile-filter-toggle {
    display: inline-flex !important;
  }

  .filter-shell {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    background: var(--surface-soft) !important;
    border-bottom: 1px solid var(--line) !important;
    z-index: 1000;
  }

  .filter-shell.is-expanded {
    display: grid !important;
    animation: filterExpand 200ms ease-out;
  }

  @keyframes filterExpand {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .metric-card strong {
    font-size: 1.125rem !important;
  }

  .metric-label {
    font-size: 0.6875rem !important;
  }

  .panel-heading {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .panel-heading-actions,
  .panel-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .app-footer {
    position: relative !important;
    height: auto !important;
    padding: 10px 14px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-align: center !important;
  }

  .carousel-navigation {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .current-slide-title {
    font-size: 0.7188rem !important;
    margin-bottom: 6px !important;
    text-align: center !important;
    width: 100% !important;
  }

  .carousel-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .page-dot,
  .page-dot.active {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .footer-logo,
  .footer-brand {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .slide {
    padding: 8px 10px 20px;
    gap: 12px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .filter-shell {
    grid-template-columns: 1fr !important;
  }

  .metric-card {
    padding: 8px !important;
  }

  .metric-card strong {
    font-size: 1rem !important;
  }

  .chart-box {
    height: 240px !important;
    min-height: 220px !important;
  }
}

/* Otimização para Telas de Notebook 1920x1080 (15") e Monitores Padrão */
@media (min-width: 1360px) and (max-height: 1080px) {
  :root {
    --header-h: 66px;
    --filters-h: 58px;
    --footer-h: 72px;
  }
  .app-header { padding: 6px 24px; }
  .header-title-box h1 { font-size: 1.25rem; }
  .filter-shell { padding: 5px 24px; gap: 8px; }
  .filter-control { height: 44px; padding-inline: 8px; }
  .carousel-viewport { overflow-y: auto; scrollbar-width: thin; }
  .slide { padding: 10px 24px 28px; gap: 8px; overflow-y: auto; scrollbar-width: thin; }
  .kpi-grid { height: 74px; min-height: 74px; gap: 10px; }
  .metric-card { padding: 8px 12px; }
  .metric-card strong { font-size: 1.125rem; line-height: 20px; }
  .metric-label { font-size: 0.6562rem; }

  .grid-two--visits,
  .grid-two--turnover { flex: 0.82; max-height: 230px; }
  .grid-two--data { flex: 1.05; min-height: 160px; }
  .grid-two--tables { flex: 1.35; min-height: 220px; }

  .table-card { padding: 7px 10px; display: flex; flex-direction: column; }
  .table-scroll { flex: 1 1 0; min-height: 80px; }
  .table-pagination { flex-shrink: 0; margin-top: auto; padding-top: 4px; }
  .panel-heading { margin-bottom: 4px; }
  .panel-heading h2 { font-size: 0.8125rem; }
}


/* ===== Estilos da Tabela Matriz Elabore em Tela Cheia ===== */
.btn-open-elabore { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; font-size:0.6875rem; font-weight:700; color:#fff; background:var(--green-800); border:1px solid var(--green-800); border-radius:6px; cursor:pointer; }
.btn-open-elabore .material-symbols-rounded, .btn-table-export .material-symbols-rounded { font-size:0.9375rem; }
:root[data-theme="dark"] .btn-open-elabore { background:#1c4a43; border-color:#528079; }

#panelElabore:not(.is-fullscreen) { display:none; }
#panelElabore .panel-heading p { font-style:normal; }
.el-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:6px 14px; margin-bottom:8px; }
.el-chips { display:flex; flex-wrap:wrap; gap:4px; }
.el-chip { display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 10px; border-radius:6px; border:1px solid var(--line); background:var(--surface-soft); color:var(--ink); font-size:0.6875rem; font-weight:650; cursor:pointer; }
.el-chip b { font-weight:800; color:var(--ink-strong); }
.el-chip.on { background:var(--green-800); border-color:var(--green-800); color:#fff; }
.el-chip.on b { color:#fff; }
:root[data-theme="dark"] .el-chip.on { background:#1c4a43; border-color:var(--green-400); }
.el-legend { margin-left:auto; display:flex; gap:12px; font-size:0.6562rem; color:var(--muted); align-items:center; }
.el-legend span { display:inline-flex; align-items:center; gap:3px; }
#panelElabore .table-scroll { overflow:auto; }
#tableElabore { min-width:1000px; }
#tableElabore thead { position:sticky; top:0; z-index:3; }
#tableElabore tfoot { position:sticky; bottom:0; z-index:3; }
#tableElabore th.grp { text-align:center; font-size:0.625rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); border-bottom:1px solid var(--line); }
#tableElabore th.grp-blocos { background:var(--green-100); color:var(--green-900); }
:root[data-theme="dark"] #tableElabore th.grp-blocos { background:var(--green-050); color:var(--green-400); }
#tableElabore th.blk, #tableElabore td.blk { text-align:center; }
#tableElabore th.blk { white-space:normal !important; overflow:visible !important; text-overflow:clip !important; line-height:1.15; padding-left:2px; padding-right:2px; }
#tableElabore th.blk select.table-col-filter { padding-left:2px; text-align:center; }
#tableElabore td.blk { border-left:1px solid var(--line-soft); }
#tableElabore th.first-blk, #tableElabore td.first-blk { border-left:2px solid var(--green-300); }
#tableElabore th[data-key] { cursor:pointer; user-select:none; }
#tableElabore th[data-key]::after { content:" ↕"; opacity:.35; font-size:0.5625rem; }
#tableElabore th.sort-asc::after { content:" ▲"; opacity:.9; }
#tableElabore th.sort-desc::after { content:" ▼"; opacity:.9; }
#tableElabore select.table-col-filter { padding-right:2px; }
.ic { font-size:1.0625rem; line-height:1; vertical-align:middle; font-variation-settings:'FILL' 1; }
.ic-ok { color:#10b981; }
.ic-no { color:#e23e3b; }
.ic-na { color:var(--line); font-variation-settings:'FILL' 0; }
.pct { display:flex; align-items:center; gap:6px; justify-content:center; }
.pct-bar { width:44px; height:6px; border-radius:3px; background:var(--line-soft); overflow:hidden; flex:none; }
.pct-bar i { display:block; height:100%; background:var(--green-600); }
#tableElabore tfoot td { background:var(--green-050); border-top:2px solid var(--green-300); font-weight:750; color:var(--ink-strong); padding:5px 6px; }
#tableElabore tfoot .pct { flex-direction:column; gap:2px; }
#tableElabore tfoot .pct-bar { width:80%; }
#tableElabore tr.row-nocad td:not(.blk) { color:var(--muted); }
.el-empty { text-align:center; padding:24px; color:var(--muted); }
#tableElabore td.det-col { padding:2px 4px; text-align:center; }
#tableElabore th.det-col { white-space:normal !important; text-overflow:clip !important; line-height:1.15; text-align:center; }
#tableElabore tbody tr[data-cod] td.cell-trigger-detail { cursor:pointer; }
#tableElabore tbody tr[data-cod] td.cell-trigger-detail:hover { background:var(--green-100); }
:root[data-theme="dark"] #tableElabore tbody tr[data-cod] td.cell-trigger-detail:hover { background:#1c4a43; }
.btn-det { display:inline-flex; align-items:center; gap:2px; height:22px; padding:0 6px; border-radius:6px; border:1px solid var(--green-300); background:var(--green-100); color:var(--green-900); font-size:0.6562rem; font-weight:750; cursor:pointer; white-space:nowrap; transition:background 120ms ease, color 120ms ease; }
.btn-det .material-symbols-rounded { font-size:0.875rem; }
#tableElabore tbody tr:hover .btn-det, .btn-det:focus-visible { background:var(--green-800); border-color:var(--green-800); color:#fff; }
:root[data-theme="dark"] .btn-det { background:#1c4a43; border-color:#528079; color:#E8F2EF; }
:root[data-theme="dark"] #tableElabore tbody tr:hover .btn-det { background:#2f7a6e; border-color:#62D8BF; color:#fff; }

/* Modal de detalhes da fazenda */
.det-card { max-width:760px; }
.det-card .modal-body { gap:8px; }
.det-sec { margin:6px 0 0; font-size:0.6562rem; font-weight:750; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); }
.det-card .data-table { border:1px solid var(--line-soft); border-radius:7px; overflow:hidden; }
.det-card .data-table th, .det-card .data-table td { position:static; padding:5px 10px; font-size:0.75rem; line-height:1.35; white-space:normal; }
.det-ficha th { width:19%; background:var(--surface-soft); color:var(--muted); font-weight:650; }
.det-ficha td { width:31%; }
.det-blocos th:nth-child(1) { width:7%; } .det-blocos th:nth-child(2) { width:26%; } .det-blocos th:nth-child(4) { width:22%; }
.det-blocos td:last-child { font-weight:700; }
.det-blocos tr.det-ok td:last-child { color:var(--metric-green); }
.det-blocos tr.det-no td:last-child { color:var(--danger); }
.det-blocos tr.det-na td:last-child { color:var(--muted); }
.det-blocos tfoot td { font-weight:750; color:var(--ink-strong); background:var(--green-050); border-top:2px solid var(--green-300); }
.el-src { margin-top:6px; font-size:0.6562rem; color:var(--muted); }

/* Backdrop de Tela Cheia e Posicionamento */
.panel-fullscreen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
:root[data-theme="dark"] .panel-fullscreen-backdrop {
  background: rgba(0, 0, 0, 0.75);
}
.panel-fullscreen-backdrop[hidden] {
  display: none !important;
}

.panel-card.is-fullscreen {
  position: fixed !important;
  top: 10vh !important;
  left: 10vw !important;
  width: 80vw !important;
  height: 80vh !important;
  max-width: 1600px !important;
  max-height: 80vh !important;
  z-index: 9995 !important;
  margin: 0 !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(110, 231, 183, 0.3) !important;
}

/* Colunas secundárias (visíveis apenas ao expandir painel em tela cheia) */
#tableSemVisita .col-fazenda,
#tableSemVisita .col-data-associacao,
#tableSemVisita .col-visita-mes-anterior,
#tableVisitados .col-fazenda,
#tableInconsistencies .col-fazenda {
  display: none !important;
}

.panel-card.is-fullscreen #tableSemVisita .col-fazenda,
.panel-card.is-fullscreen #tableSemVisita .col-data-associacao,
.panel-card.is-fullscreen #tableSemVisita .col-visita-mes-anterior,
.panel-card.is-fullscreen #tableVisitados .col-fazenda,
.panel-card.is-fullscreen #tableInconsistencies .col-fazenda {
  display: table-cell !important;
}

/* Os <col> do <colgroup> usam as mesmas classes: em tela cheia precisam voltar a ser
   colunas (table-column), senão viram células fantasmas e zeram a última coluna. */
.panel-card.is-fullscreen #tableSemVisita col.col-fazenda,
.panel-card.is-fullscreen #tableSemVisita col.col-data-associacao,
.panel-card.is-fullscreen #tableSemVisita col.col-visita-mes-anterior,
.panel-card.is-fullscreen #tableVisitados col.col-fazenda,
.panel-card.is-fullscreen #tableInconsistencies col.col-fazenda {
  display: table-column !important;
}

/* Ajuste Compacto e Alinhamento do Cabeçalho das Tabelas */
.data-table {
  height: auto !important;
}

.data-table thead tr:first-child th {
  height: 28px !important;
  padding: 5px 6px !important;
  vertical-align: middle !important;
  line-height: 1.15 !important;
}

.data-table thead tr.table-filter-row th {
  height: 26px !important;
  padding: 2px 4px !important;
  vertical-align: middle !important;
}

.data-table th.col-center {
  text-align: center !important;
}

.data-table th.col-center .th-title-text {
  display: inline-block;
  vertical-align: middle;
}

.data-table th .kpi-info-btn {
  display: inline-flex !important;
  vertical-align: middle !important;
  margin-left: 3px !important;
}




.legend-toggle { cursor: pointer; user-select: none; transition: opacity .15s; }
.legend-toggle.is-off { opacity: .4; text-decoration: line-through; }

/* Filtros multi-seleção: linha com caixa de marcação à esquerda */
.custom-select-option.is-multi {
  justify-content: flex-start;
  gap: 8px;
}

.custom-select-option .multi-check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  line-height: 1;
  opacity: 0.85;
  cursor: pointer;
}

.custom-select-option.is-all {
  border-bottom: 1px solid var(--line, rgba(15, 110, 86, 0.18));
  border-radius: 7px 7px 0 0;
  margin-bottom: 2px;
}

/* Rodapé do popup multi-seleção com o botão Aplicar */
.custom-select-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px 4px;
  border-top: 1px solid var(--line, rgba(15, 110, 86, 0.18));
}

.custom-select-apply {
  border: 0;
  border-radius: 6px;
  background: #0F6E56;
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 750;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 120ms ease;
}

.custom-select-apply:hover {
  background: #0B5341;
}

/* Página 1 (Visitas e cobertura): proporção fixa de 40% (gráficos) / 60% (tabela e ranking)
   da área útil, em qualquer altura de tela. Sem isto, acima de 1080px de altura valia a regra
   base (1,3 : 1) e a linha de baixo ficava menor que a de cima. Só desktop: no mobile os
   painéis empilham com altura própria. */
@media (min-width: 1025px) {
  #slide1 .grid-two--visits { flex: 4 1 0; max-height: none; min-height: 170px; }
  #slide1 .grid-two--tables { flex: 6 1 0; min-height: 220px; }
}

.custom-select-footer {
  align-items: center;
}

/* Dados Elabore: cabeçalho compacto (a linha de títulos não deve esticar) */
#tableElabore { height: auto !important; }
#tableElabore thead tr#elHead th {
  height: 34px !important;
  padding: 3px 5px !important;
  vertical-align: middle !important;
  line-height: 1.15 !important;
}
#tableElabore thead tr#elHead th.blk { font-size: 0.5938rem; overflow-wrap: normal; word-break: normal; hyphens: none; }
#tableElabore thead tr#elHead th.blk::after { display: none; }

/* Tela 4: gráficos sem dado consistente no mês ficam esmaecidos, com o aviso por cima */
.chart-box--sem-dados > canvas { opacity: 0.22; filter: grayscale(0.6); transition: opacity 200ms ease; }
.chart-box--sem-dados::after {
  content: attr(data-aviso);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  padding: 10px 16px;
  border: 1px solid var(--warning);
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--text, inherit);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
}

/* Usuário logado */
.user-box { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 6px; color: var(--ink); }
.user-box[hidden] { display: none; }
.user-avatar { width: 32px; height: 32px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--green-700); color: #fff; }
.user-avatar .material-symbols-rounded { font-size: 1.25rem; font-variation-settings: 'FILL' 1; }
.user-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-box .user-text { display: flex; flex-direction: column; line-height: 1.1; max-width: 170px; }
.user-box .user-text strong { color: var(--green-900); font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.01em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .user-text small { font-size: 0.625rem; color: var(--muted); }
.user-box .update-block { min-height: 0; height: auto; min-width: 0; padding: 0; flex-direction: row; align-items: center; gap: 4px; border: 0; background: transparent; box-shadow: none; border-radius: 4px; }
.user-box .update-block:hover { transform: none; background: transparent; }
.user-box .update-block-header { font-size: 0.5625rem; font-weight: 600; color: var(--muted); }
.user-box .update-block strong { margin: 0; font-size: 0.5625rem; font-weight: 700; }
.user-menu-btn { align-self: flex-start; width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--green-900); cursor: pointer; transition: background 180ms ease; }
.user-menu-btn:hover { background: var(--green-100); }
.user-menu-btn .material-symbols-rounded { font-size: 1.25rem; transition: transform 180ms ease; }
.user-menu-btn[aria-expanded="true"] .material-symbols-rounded { transform: rotate(180deg); }
.user-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 1200; min-width: 120px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); }
.user-menu[hidden] { display: none; }
.user-menu button, .user-menu a { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.user-menu button:hover, .user-menu a:hover { background: var(--green-100); }
.user-menu .material-symbols-rounded { font-size: 1.125rem; }
.user-menu a { text-decoration: none; }
.user-menu a[hidden] { display: none; }
@media (max-width: 900px) { .user-box .user-text { display: none; } }


/* ===== Telas menores (notebooks, tablets e celulares) ===== */
.filter-count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--green-700);
  color: #fff;
  font-size: 0.6562rem;
  font-weight: 800;
  line-height: 1;
}
.filter-count-badge[hidden] { display: none; }

/* Até 1600px (inclui o notebook FHD com escala 125% = 1536×864) os 7 filtros não cabem no cabeçalho (ficavam com ~70px
   e o nome cortado): viram uma gaveta aberta pelo botão "Filtros", que mostra quantos filtros estão ativos. */
@media (max-width: 1600px) {
  .mobile-filter-toggle { display: inline-flex !important; }
  .header-title-box { min-width: fit-content; }
  .filter-shell {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }
  .filter-shell.is-expanded { display: flex !important; }
  .filter-shell { justify-content: flex-start; max-width: none; }
  .filter-shell > .filter-control {
    height: 44px;
    min-width: 150px;
    max-width: none !important;
    flex: 1 1 calc(25% - 8px) !important;
  }
  .filter-control span { font-size: 0.625rem; }
  .metric-label { letter-spacing: 0.2px; }
}

/* Notebooks com pouca altura (ex.: 1366×768, 1280×720): em vez de espremer os gráficos em ~120–150px para caber
   tudo na tela, cada linha de painéis ganha altura legível e o slide rola na vertical. */
@media (min-width: 1025px) and (max-height: 860px) {
  .slide { overflow-y: auto !important; scrollbar-width: thin; padding-bottom: 16px; }
  .slide > .grid-two,
  .slide > .grid-territory,
  .slide > .grid-safra { flex: 0 0 auto !important; max-height: none !important; }
  .slide > .grid-two--visits,
  .slide > .grid-two--turnover,
  .slide > .grid-two--data,
  .slide > .grid-two--prod-main { height: 280px; min-height: 280px !important; }
  .slide > .grid-two--tables,
  .slide > .grid-two--prod-attn { height: 380px; min-height: 380px !important; }
  .slide > .grid-territory { height: 560px; }
  .slide > .grid-safra { height: 640px; }
}

/* Celulares e tablets em pé */
@media (max-width: 768px) {
  .header-title-box h1 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .filter-shell > .filter-control { flex-basis: calc(50% - 8px) !important; min-width: 0; }

  /* Rótulos dos KPIs quebram em até 2 linhas em vez de cortar com reticências */
  .metric-card { column-gap: 8px; grid-template-columns: 28px minmax(0, 1fr); }
  .metric-icon { width: 28px; height: 28px; }
  .metric-label {
    height: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.2;
    letter-spacing: 0.2px;
  }
  .metric-card small { white-space: normal; line-height: 1.25; }
}

@media (max-width: 560px) {
  .screen-code { display: none; }
  .mobile-filter-toggle { padding: 0 10px; }
  .mobile-filter-toggle > span:not(.material-symbols-rounded):not(.filter-count-badge) { display: none; }
  .filter-shell > .filter-control { flex-basis: 100% !important; }
}

/* Qualidade dos dados (tela 3) com painéis empilhados: as roscas ganham altura própria e a legenda vai para baixo
   (a altura em % do layout de TV zerava a área dos gráficos quando o painel tem altura automática). */
@media (max-width: 1024px) {
  .quality-content { flex: none; height: auto; flex-direction: column; overflow: visible; }
  .quality-donuts-wrapper { flex: none; width: 100%; height: auto; }
  .quality-donut-col { height: auto; }
  .quality-legend-sidebar { flex: none; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
}

/* Layout empilhado (≤1024px): cada slide tem a altura do próprio conteúdo. Antes os 7 slides lado a lado esticavam
   até a altura do maior e os painéis cresciam para preencher, abrindo vãos entre eles; o slide fora de tela também
   aumentava a rolagem da página. */
@media (max-width: 1024px) {
  .carousel-track { align-items: flex-start; }
  /* A área dos slides ocupa só o que sobra entre cabeçalho e rodapé (o min-height com rodapé de 60px estourava a tela) */
  .carousel-viewport { min-height: 0 !important; }
  .slide > * { flex: 0 0 auto !important; }
  .slide[aria-hidden="true"] { height: 0 !important; min-height: 0 !important; padding-block: 0 !important; overflow: hidden !important; }
  /* A regra ".panel-card { display:flex !important }" acima reexibia a matriz Elabore (só existe em tela cheia) depois do rodapé */
  #panelElabore:not(.is-fullscreen) { display: none !important; }
}

/* Botão "Limpar filtros": mesmo estilo do "Aplicar" dos popups (fim da barra; dentro da gaveta nas telas menores) */
.filter-clear-btn {
  height: 35px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 6px;
  background: #0F6E56;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 750;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 120ms ease;
}
.filter-clear-btn[hidden] { display: none; }
.filter-clear-btn .material-symbols-rounded { font-size: 1rem; }
.filter-clear-btn:hover { background: #0B5341; }
.filter-clear-btn:focus-visible { outline: 2px solid #0F6E56; outline-offset: 2px; }
@media (max-width: 1600px) {
  .filter-shell > .filter-clear-btn { height: 44px; flex: 0 0 auto; }
}

/* Célula extra da linha "Nenhum registro": só existe para cobrir as colunas que aparecem em tela cheia */
.col-extra-fullscreen { display: none !important; }
.panel-card.is-fullscreen .col-extra-fullscreen { display: table-cell !important; }

/* Filtro travado pelo perfil (agroindústria/projeto únicos no escopo do usuário): mostra o valor, não abre */
.filter-control.is-locked { cursor: not-allowed !important; opacity: .6 !important; }
.filter-control.is-locked * { pointer-events: none !important; cursor: not-allowed !important; }
.filter-control.is-locked .custom-select-popup { display: none !important; }
/* Travado: sem seta, valor em verde */
.filter-control.is-locked .select-display-value { background-image: none; padding-right: 0; color: var(--green-700); font-weight: 800; }

/* ===== Perfil notebook (1025–1600px de largura; FHD com escala 125% = 1536×864) =====
   Fica por último de propósito: o bloco "1360px × 1080px de altura" (acima) também alcançava notebooks e deixava
   cabeçalho de 66px + rodapé de 72px (~18% de uma tela de 768px). Aqui a moldura encolhe para devolver altura aos gráficos.
   TV/monitor acima de 1600px de largura não é afetado. */
@media (min-width: 1025px) and (max-width: 1600px) {
  :root { --header-h: 52px; --footer-h: 44px; }

  .app-header { padding: 4px 16px; gap: 10px; }
  .header-title-box h1 { font-size: 1.0625rem; }
  .header-title-box p { font-size: 0.6875rem; }
  .mobile-filter-toggle { height: 34px; }

  /* Rodapé de uma linha: logo | título do slide + setas + bolinhas | (marca oculta) */
  .app-footer { padding: 3px 16px; grid-template-columns: 1fr auto 1fr; }
  .footer-logo img { width: 84px; height: 26px; }
  .footer-brand { display: none; }
  .carousel-navigation { min-width: 0; flex-direction: row; gap: 14px; }
  .current-slide-title { min-height: 0; margin: 0; font-size: 0.7188rem; white-space: nowrap; }
  .carousel-controls { gap: 6px; }
  .carousel-arrow { width: 26px; height: 26px; font-size: 1.375rem; }
  .page-dot,
  .page-dot.active { width: 24px; height: 24px; font-size: 0.6875rem; }

  /* Menos respiro vertical nos slides: o espaço vira altura de gráfico */
  .slide { padding: 8px 16px 12px; gap: 8px; }
}

/* Notebook com altura suficiente para caber tudo sem rolar (ex.: 1536×864): a linha de gráficos de cima não passa de
   260px de piso nem fica presa em 230px (slide 2); mesma proporção 40/60 da página 1. Abaixo de 861px de altura vale o
   modo com rolagem e altura fixa por painel (bloco "pouca altura" acima). */
@media (min-width: 1025px) and (max-width: 1600px) and (min-height: 861px) {
  #slide2 .grid-two--turnover { flex: 4 1 0; max-height: none; min-height: 260px; }
  #slide2 .grid-two--tables { flex: 6 1 0; min-height: 220px; }
  .slide > .grid-two--visits,
  .slide > .grid-two--turnover,
  .slide > .grid-two--data,
  .slide > .grid-two--prod-main { min-height: 260px; }
}

/* Notebook: piso de fonte de 10–11px (antes havia texto de 7,5 a 10,5px, ilegível a ~50cm da tela). A etiqueta
   "TELA GERENCIAL BI LABOR" some para o título respirar na moldura de 52px. */
@media (min-width: 1025px) and (max-width: 1600px) {
  .screen-code { display: none; }
  .update-block-header { font-size: 0.5938rem; }
  .filter-control span { font-size: 0.625rem; }
  .metric-card small,
  .insight strong,
  .criteria-strip strong,
  .table-col-filter { font-size: 0.6562rem; }
  .insight p,
  .criteria-strip p,
  .table-col-filter::placeholder { font-size: 0.625rem; }
  .data-table,
  .data-table th,
  .data-table td { font-size: 0.6875rem; }
  .badge { font-size: 0.625rem; }
  .link-button,
  .chart-horizon-control button { font-size: 0.6875rem; }
}
