:root {
  --primary: #0F4F55;
  --primary-dark: #083B40;
  --primary-light: #168F72;
  --secondary: #007F78;
  --accent: #57C9A5;
  --background: #F1F7F4;
  --background-muted: #E1EFE9;
  --surface: #FFFFFF;
  --surface-alt: #F4F9F6;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #C6DCD3;
  --success: #078A3D;
  --warning: #D97706;
  --error: #D51F35;
  --info: #145FD1;
  --accent-blue: #2774E6;
  --accent-amber: #F09A18;
  --accent-coral: #E8583E;
  --accent-violet: #7157D9;
  --accent-lime: #72A62A;
  --shadow: 0 18px 50px rgba(23, 78, 83, 0.12);
  --shadow-card: 0 6px 20px rgba(23, 78, 83, 0.07);
  --radius: 8px;
  --radius-lg: 18px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --topbar-height: 72px;
  --mobile-tabbar-height: 64px;
  /* Pilha de fonte de sistema única, compartilhada com styles/auth/login.css.
     "Inter" foi removida daqui: não há @font-face nem carregamento de webfont
     no projeto, então a fonte nunca era de fato aplicada. */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  background:
    radial-gradient(circle at 80% 18%, rgba(72, 95, 12, 0.14), transparent 26%),
    linear-gradient(135deg, var(--background) 0%, #eef5f1 100%);
}

.login-panel {
  min-height: 100vh;
  padding: 44px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background:
    linear-gradient(145deg, transparent 41%, rgba(255, 255, 255, 0.2) 42%),
    linear-gradient(145deg, var(--primary) 0%, var(--secondary) 100%);
  position: relative;
  flex: 0 0 auto;
  box-shadow: 0 14px 28px rgba(13, 87, 94, 0.2);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: #FBF8F4;
  border-radius: 99px;
}

.brand-mark::before {
  width: 8px;
  height: 26px;
  left: 13px;
  top: 8px;
  transform: rotate(28deg);
}

.brand-mark::after {
  width: 8px;
  height: 20px;
  right: 12px;
  bottom: 8px;
  transform: rotate(28deg);
}

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

.brand-name {
  color: var(--accent);
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
}

.brand-system {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  object-position: center;
  border-radius: 7px;
  flex: 0 0 auto;
  display: block;
}

.login-card {
  display: grid;
  gap: 18px;
}

.login-title {
  display: grid;
  gap: 8px;
}

.login-title h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 34px;
  line-height: 1.05;
}

.login-title p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.field-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field[hidden] {
  display: none;
}

.field label {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  padding: 9px 11px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field select[multiple] {
  min-height: 112px;
  padding-block: 8px;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0, 143, 129, 0.14);
}

.login-actions {
  display: grid;
  gap: 10px;
}

.login-visual {
  position: relative;
  min-height: 100vh;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(13, 87, 94, 0.12);
  background:
    linear-gradient(90deg, rgba(13, 87, 94, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 87, 94, 0.12) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: rotate(-4deg);
  border-radius: 8px;
}

.login-visual-panel {
  position: relative;
  width: min(680px, 92%);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 22px;
}

.pasture-map {
  min-height: 300px;
  border-radius: 8px;
  background:
    linear-gradient(22deg, transparent 0 40%, rgba(72, 95, 12, 0.18) 40% 41%, transparent 41% 100%),
    linear-gradient(160deg, rgba(0, 143, 129, 0.18) 0 28%, transparent 28% 100%),
    linear-gradient(28deg, transparent 0 54%, rgba(245, 158, 11, 0.22) 54% 55%, transparent 55% 100%),
    #F7FAF8;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.pasture-map span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(13, 87, 94, 0.08);
}

.pasture-map span:nth-child(1) { left: 14%; top: 30%; }
.pasture-map span:nth-child(2) { left: 36%; top: 52%; background: var(--secondary); }
.pasture-map span:nth-child(3) { left: 58%; top: 36%; background: var(--accent); }
.pasture-map span:nth-child(4) { left: 74%; top: 62%; }
.pasture-map span:nth-child(5) { left: 46%; top: 72%; background: var(--secondary); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--background);
}

.app-shell.collapsed {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--primary);
  color: #F8FFFD;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  min-height: var(--topbar-height);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .brand-name {
  color: #FBF8F4;
  font-size: 20px;
}

.sidebar .brand-system {
  color: rgba(255, 255, 255, 0.68);
}

.sidebar .brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #0D575E 0%, #00A696 100%);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.sidebar .brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  object-position: center;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  flex: 0 0 auto;
}

/* ============================================
   NAVEGAÇÃO MOBILE — barra de abas fixa + gaveta "Mais"
   Escondidas por padrão (desktop); reveladas só dentro do
   @media (max-width: 900px) já usado pelo resto do shell mobile.
   A gaveta reaproveita <nav class="nav"> + .nav-section/.nav-button
   (renderNav(), mesmas classes da sidebar) — zero CSS novo pros itens.
   ============================================ */
.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  grid-template-columns: repeat(5, 1fr);
  height: var(--mobile-tabbar-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(23, 78, 83, 0.10);
}

.mobile-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.mobile-tab svg {
  width: 21px;
  height: 21px;
}

.mobile-tab.active {
  color: var(--primary);
}

.mobile-tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--error);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 32, 30, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 61;
  width: min(300px, 84vw);
  display: flex;
  flex-direction: column;
  background: var(--primary);
  color: #F8FFFD;
  box-shadow: 18px 0 50px rgba(23, 78, 83, 0.25);
  transform: translateX(-100%);
  transition: transform 220ms ease;
}

.mobile-drawer-header {
  min-height: var(--topbar-height);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.mobile-drawer-header .brand-name {
  color: #FBF8F4;
  font-size: 18px;
}

.mobile-drawer-header .brand-system {
  color: rgba(255, 255, 255, 0.68);
}

.mobile-drawer-header .brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.mobile-drawer-header .button.icon-only {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

.mobile-drawer .nav {
  flex: 1 1 auto;
}

.mobile-drawer-logout {
  margin: 8px 12px 16px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-weight: 800;
  flex: 0 0 auto;
}

.nav {
  padding: 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section summary {
  list-style: none;
  user-select: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 10px 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section-chevron {
  display: inline-flex;
  color: rgba(255, 255, 255, 0.56);
  transition: transform 160ms ease;
  transform: rotate(-90deg);
}

.nav-section-chevron svg {
  width: 14px;
  height: 14px;
}

.nav-section[open] > summary .nav-section-chevron {
  transform: rotate(0deg);
}

.nav-items {
  display: grid;
  gap: 4px;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell.collapsed .brand-copy,
.app-shell.collapsed .nav-label,
.app-shell.collapsed .nav-section summary span,
.app-shell.collapsed .nav-section-chevron {
  display: none;
}

.app-shell.collapsed .sidebar-header {
  justify-content: center;
  padding-inline: 12px;
}

.app-shell.collapsed .sidebar-header .brand {
  display: none;
}

.app-shell.collapsed .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 5px;
}

.main-area {
  min-width: 0;
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  background: rgba(251, 248, 244, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar-title p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-select {
  min-width: 184px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  padding: 7px 10px;
}

.notification-button,
.profile-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  position: relative;
  transition: background-color var(--transition-fast, 0.15s ease), border-color var(--transition-fast, 0.15s ease);
}

.notification-button:hover,
.profile-button:hover {
  background: var(--background-muted);
  border-color: var(--border);
}

/* Destaque só quando há alertas abertos para o filtro atual — não é
   permanente, ver renderShell() em appService.js. */
.notification-button.has-alerts {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.06);
  color: var(--error);
}

.notification-button .badge {
  position: absolute;
  right: -5px;
  top: -6px;
}

.content {
  min-width: 0;
  padding: 24px;
}

.view {
  display: grid;
  gap: 18px;
}

.view-toolbar,
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  width: min(360px, 72vw);
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  padding: 9px 12px;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--surface);
  white-space: nowrap;
}

.button.primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: rgba(0, 143, 129, 0.1);
  color: var(--primary);
  border-color: rgba(0, 143, 129, 0.24);
}

.button.accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.button.danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--error);
  border-color: rgba(220, 38, 38, 0.18);
}

.button.icon-only {
  width: 38px;
  padding-inline: 0;
}

.button.icon-only svg {
  width: 17px;
  height: 17px;
}

.kbd-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
}

.kbd-icon svg {
  width: 14px;
  height: 14px;
}

.primary .kbd-icon,
.accent .kbd-icon {
  background: rgba(255, 255, 255, 0.18);
}

.secondary .kbd-icon {
  background: rgba(13, 87, 94, 0.1);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-grid.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card,
.chart-panel,
.table-panel,
.settings-panel,
.report-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(45, 38, 43, 0.04);
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  /* item de grid (.dashboard-grid) — sem isso o min-width:auto padrão ignora
     overflow-wrap/break-word e deixa o card crescer pelo conteúdo. */
  min-width: 0;
}

.metric-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.metric-value {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
  overflow-wrap: break-word;
  /* item do grid interno de .metric-card — mesma razão do min-width acima,
     um nível abaixo (ex.: "Administrador" em Usuários estourando o cartão). */
  min-width: 0;
}

.metric-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.metric-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--secondary);
  box-shadow: 0 0 0 6px rgba(0, 143, 129, 0.12);
  flex: 0 0 auto;
  margin-top: 5px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.chart-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
  min-height: 360px;
  /* Sem isso, o `min-width` padrão de item de grid (`auto`, baseado no
     conteúdo) usa a largura intrínseca do SVG do gráfico (que pode passar de
     1000px com muitas pesagens) como piso — isso força a COLUNA do grid
     pai (e o cartão/modal inteiro) a alargar junto, em vez de deixar só o
     contêiner interno de rolagem (`.smooth-line-chart-scroll`) tratar o
     excesso. `min-width: 0` permite o cartão encolher normalmente e a
     rolagem ficar mesmo contida no gráfico. */
  min-width: 0;
}

.panel-title {
  display: grid;
  gap: 3px;
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 17px;
}

.panel-title p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kpi-row.kpi-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}

.kpi strong {
  display: block;
  color: var(--primary);
  font-size: 25px;
  line-height: 1.1;
  overflow-wrap: break-word;
  word-break: break-word;
}

.kpi span {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.bar-chart {
  min-height: 230px;
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 12px;
  align-items: end;
  padding-top: 14px;
}

.bar-group {
  display: grid;
  grid-template-rows: minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.bars {
  height: 170px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--border);
}

.bar {
  width: 15px;
  min-height: 8px;
  border-radius: 6px 6px 0 0;
}

.bar.birth {
  background: var(--secondary);
}

.bar.death {
  background: var(--error);
}

.bar-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.chart-legend,
.donut-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 13px;
}

/* FRONTEND-VISUAL-C1 — série mensal unificada do rebanho. */
.herd-analytics-grid .herd-events-card {
  min-height: 430px;
}

.herd-events-header,
.herd-events-summary,
.herd-events-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.herd-events-header {
  justify-content: space-between;
  align-items: flex-start;
}

.herd-events-period {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.herd-events-period select {
  min-width: 112px;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
}

.herd-events-summary span,
.herd-events-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
}

.herd-events-summary strong {
  color: var(--text-primary);
  font-size: 18px;
}

.herd-events-key {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.herd-events-key.birth,
.herd-events-line-key.birth { background: #008F81; }
.herd-events-key.death,
.herd-events-line-key.death { background: #C2415D; }

.herd-events-plot {
  width: 100%;
  min-width: 0;
  height: 286px;
}

.herd-events-plot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.herd-events-gridline { stroke: rgba(93, 109, 115, 0.16); stroke-width: 1; }
.herd-events-axis-line { stroke: rgba(93, 109, 115, 0.42); stroke-width: 1; }
.herd-events-axis-value,
.herd-events-month-label { fill: var(--text-secondary); font-size: 11px; font-weight: 700; }
.herd-events-line { vector-effect: non-scaling-stroke; }
.herd-events-point { vector-effect: non-scaling-stroke; stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.herd-events-point:focus { outline: none; stroke: var(--text-primary); stroke-width: 3; }

.herd-events-line-key {
  width: 24px;
  height: 3px;
  border-radius: 999px;
  position: relative;
}

.herd-events-line-key::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: inherit;
  left: 9px;
  top: -2px;
}

.herd-events-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.herd-events-card .empty-state.compact {
  min-height: 220px;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
}

.herd-events-card .chart-footnote { margin: 0; }

@media (min-width: 981px) {
  .herd-analytics-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}

@media (max-width: 640px) {
  .herd-events-card { padding: 16px; min-height: 400px; }
  .herd-events-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .herd-events-summary { gap: 10px 16px; }
  .herd-events-plot { height: 250px; }
  .herd-events-month-label { font-size: 10px; }
  .herd-events-legend { justify-content: center; }
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
}

.donut-wrap {
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 260px;
}

.donut {
  width: 178px;
  height: 178px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(13, 87, 94, 0.08);
}

.donut::after {
  content: "";
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--surface);
  position: absolute;
}

.donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-center strong {
  display: block;
  font-size: 28px;
  color: var(--primary);
}

.donut-center span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--text-secondary);
  background: var(--surface-alt);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
}

td {
  color: var(--text-primary);
}

tr:hover td {
  background: #FAFCFB;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.table-checkbox {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  cursor: pointer;
}

.table-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--secondary);
  cursor: pointer;
}

.table-checkbox input[type="checkbox"]:disabled {
  cursor: default;
}

.status-chip,
.badge {
  min-height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  color: var(--primary);
  background: rgba(13, 87, 94, 0.1);
}

.status-chip.success {
  color: #0E6F35;
  background: rgba(22, 163, 74, 0.12);
}

.status-chip.warning {
  color: #9A5F00;
  background: rgba(245, 158, 11, 0.18);
}

.status-chip.error {
  color: #A01818;
  background: rgba(220, 38, 38, 0.12);
}

.status-chip.info {
  color: #164EA4;
  background: rgba(37, 99, 235, 0.12);
}

.pagination {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-state {
  padding: 38px 18px;
  text-align: center;
  color: var(--text-secondary);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  min-width: 260px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.kanban-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--primary);
}

.kanban-stack {
  display: grid;
  gap: 10px;
}

.lot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 11px;
  box-shadow: 0 10px 24px rgba(45, 38, 43, 0.04);
}

.lot-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.lot-card-head strong,
.lot-card-head span {
  display: block;
}

.lot-card-head span {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 3px;
}

.lot-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--background-muted);
  overflow: hidden;
}

.lot-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.lot-meter span.warning {
  background: var(--warning);
}

.lot-meter span.error {
  background: var(--error);
}

.lot-stats,
.lot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lot-stats span,
.empty-mini {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.timeline-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.timeline-item {
  border-left: 3px solid var(--secondary);
  background: var(--surface-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}

.timeline-item span,
.timeline-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Seletor visual de ECC (Escore de Condição Corporal), escala 1-5 */
.ecc-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ecc-category-card {
  display: grid;
  gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  font-family: inherit;
}

.ecc-category-card:hover {
  border-color: var(--secondary);
}

.ecc-category-card.selected {
  border-color: var(--secondary);
  background: var(--surface-alt);
  box-shadow: 0 0 0 2px rgba(8, 111, 107, 0.18);
}

.ecc-category-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--secondary);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
}

.ecc-category-card strong {
  font-size: 14px;
  color: var(--text-primary);
}

.ecc-category-card p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(45, 38, 43, 0.36);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal.modal-lg {
  width: min(1280px, 90vw);
  max-height: 90vh;
}

.modal.modal-lg.has-tabs {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.animal-file-body {
  /* Era display:grid (auto rows). Trocado para flex-column: esta lista
     nunca usou nenhum recurso 2D do grid (sem colunas, sem item ocupando
     várias linhas) — é sempre uma pilha vertical simples de altura
     variável. CSS Grid tem uma ambiguidade documentada de 2 passes ao
     auto-dimensionar a ALTURA de uma linha cujo item é, ele mesmo, outro
     grid com texto que quebra linha (a legenda do gráfico, .chart-legend,
     quebra em 3 linhas no mobile) — o navegador podia medir essa altura
     ANTES de saber que o texto ia quebrar, subdimensionando a linha; com
     align-items:start (correção anterior desta sessão) o conteúdo deixava
     de ser cortado, mas passava a vazar por cima da PRÓXIMA linha (que
     começava na altura subdimensionada) — achado do usuário via captura de
     tela mobile: "Insights do módulo" sobrepondo o fim do gráfico. Flexbox
     em coluna não tem essa ambiguidade: cada item empilha exatamente onde o
     anterior termina de verdade. */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sem isso, os itens (flex-shrink:1 é o padrão) podiam ser encolhidos
   abaixo do tamanho do próprio conteúdo quando a soma das alturas passava
   do espaço disponível no modal — o cartão do gráfico, por ter min-height
   em vez de min-height:auto, tinha um piso de encolhimento (360px) menor
   que seu conteúdo real, vazando visualmente por cima do próximo cartão.
   A modal já rola (`.modal-body { overflow-y: auto }`) quando o conteúdo
   não cabe — encolher os cartões nunca foi o comportamento pretendido. */
.animal-file-body > * {
  flex-shrink: 0;
}

.animal-profile-modal {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(94vh, 980px);
  border: 1px solid rgba(14, 116, 110, 0.2);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.animal-profile-modal-header {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.09), rgba(37, 99, 235, 0.05));
}

.animal-profile-modal-header > div {
  display: grid;
  gap: 2px;
}

.animal-profile-modal-header .eyebrow,
.animal-profile-title > span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.animal-profile {
  display: grid;
  gap: 18px;
}

.animal-profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, auto);
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(13, 148, 136, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 10%, rgba(59, 130, 246, 0.13), transparent 36%),
    linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(255, 255, 255, 0.96));
}

.animal-profile-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, #0f766e, #0284c7);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.24);
}

.animal-profile-icon svg {
  width: 30px;
  height: 30px;
}

.animal-profile-title h2 {
  margin: 4px 0 8px;
  color: var(--text-primary);
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.15;
}

.animal-profile-identities {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.animal-profile-identities span {
  padding: 5px 9px;
  border: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.animal-profile-current-state {
  display: grid;
  gap: 4px;
  align-self: stretch;
  min-width: 220px;
  padding: 15px 17px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  background: rgba(236, 253, 245, 0.9);
}

.animal-profile-current-state span,
.animal-profile-current-state small {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.animal-profile-current-state strong {
  color: #065f46;
  font-size: 17px;
}

.animal-profile-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.animal-profile-metric {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 108px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.animal-profile-metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #94a3b8;
  content: "";
}

.animal-profile-metric.green::before { background: #10b981; }
.animal-profile-metric.blue::before { background: #3b82f6; }
.animal-profile-metric.purple::before { background: #8b5cf6; }
.animal-profile-metric.orange::before { background: #f59e0b; }
.animal-profile-metric.teal::before { background: #14b8a6; }

.animal-profile-metric span,
.animal-profile-metric small {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.animal-profile-metric strong {
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.2;
}

.animal-profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.68);
}

.animal-profile-actions > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 210px;
}

.animal-profile-actions span {
  color: var(--text-secondary);
  font-size: 12px;
}

.animal-profile-support-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(380px, 1.2fr);
  gap: 14px;
}

.animal-profile-data dl,
.animal-profile-event-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.animal-profile-data dl > div,
.animal-profile-event-details > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-alt);
}

.animal-profile-data dt,
.animal-profile-event-details dt {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.animal-profile-data dd,
.animal-profile-event-details dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.animal-profile-history > .button {
  margin-bottom: 16px;
}

.animal-profile-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.animal-profile-event {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
}

.animal-profile-event-marker {
  position: relative;
  margin-top: 17px;
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #0d9488;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
}

.animal-profile-event:not(:last-child) .animal-profile-event-marker::after {
  position: absolute;
  top: 13px;
  left: 2px;
  width: 2px;
  height: calc(100% + 96px);
  background: rgba(148, 163, 184, 0.26);
  content: "";
}

.animal-profile-event[data-source-type="mastitis"] .animal-profile-event-marker,
.animal-profile-event[data-source-type="health"] .animal-profile-event-marker { background: #ef4444; }
.animal-profile-event[data-source-type="reproduction"] .animal-profile-event-marker { background: #8b5cf6; }
.animal-profile-event[data-source-type="weight"] .animal-profile-event-marker { background: #f59e0b; }
.animal-profile-event[data-source-type="cmt"] .animal-profile-event-marker,
.animal-profile-event[data-source-type="milk_control"] .animal-profile-event-marker { background: #3b82f6; }

.animal-profile-event-content {
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.animal-profile-event-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.animal-profile-event-heading h4,
.animal-profile-event-content p {
  margin: 3px 0 0;
}

.animal-profile-event-heading small,
.animal-profile-event-heading time {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.animal-profile-event-content p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.animal-profile-event-details {
  margin: 11px 0;
}

.animal-profile-pagination {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.animal-profile-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  padding: 28px;
  text-align: center;
}

.animal-profile-state p { margin: 0; color: var(--text-secondary); }
.animal-profile-state.error {
  min-height: 0;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.9);
}

.animal-profile-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(13, 148, 136, 0.18);
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: animal-profile-spin 0.8s linear infinite;
}

@keyframes animal-profile-spin { to { transform: rotate(360deg); } }

.dashboard-operations {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: 17px;
  background:
    radial-gradient(circle at 8% 0, rgba(20, 184, 166, 0.12), transparent 32%),
    radial-gradient(circle at 95% 100%, rgba(139, 92, 246, 0.1), transparent 30%),
    var(--surface);
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.07);
}

.dashboard-operations-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-operations-heading span {
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dashboard-operations-heading h2,
.dashboard-operations-heading p {
  margin: 3px 0 0;
}

.dashboard-operations-heading h2 {
  color: var(--text-primary);
  font-size: 18px;
}

.dashboard-operations-heading p {
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.dashboard-operations-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 9px;
}

.dashboard-operation-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 13px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.88);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.dashboard-operation-card:hover:not(:disabled),
.dashboard-operation-card:focus-visible {
  border-color: rgba(13, 148, 136, 0.55);
  outline: none;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.14);
  transform: translateY(-2px);
}

.dashboard-operation-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.dashboard-operation-card > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-operation-card strong,
.dashboard-operation-card small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-operation-card strong { font-size: 12px; white-space: nowrap; }
.dashboard-operation-card small { color: var(--text-secondary); font-size: 10px; line-height: 1.3; }

.dashboard-operation-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #0d9488, #0284c7);
}

.dashboard-operation-card:nth-child(2) .dashboard-operation-icon { background: linear-gradient(145deg, #ec4899, #8b5cf6); }
.dashboard-operation-card:nth-child(3) .dashboard-operation-icon { background: linear-gradient(145deg, #6366f1, #2563eb); }
.dashboard-operation-card:nth-child(4) .dashboard-operation-icon { background: linear-gradient(145deg, #f59e0b, #ea580c); }
.dashboard-operation-card:nth-child(5) .dashboard-operation-icon { background: linear-gradient(145deg, #10b981, #0f766e); }
.dashboard-operation-card:nth-child(6) .dashboard-operation-icon { background: linear-gradient(145deg, #64748b, #334155); }
.dashboard-operation-card:nth-child(7) .dashboard-operation-icon { background: linear-gradient(145deg, #38bdf8, #2563eb); }

.dashboard-operation-icon svg { width: 18px; height: 18px; }

@media (max-width: 1180px) {
  .dashboard-operations-grid { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
}

@media (max-width: 720px) {
  .dashboard-operations-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .dashboard-operations-heading p { text-align: left; }
  .dashboard-operations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .dashboard-operations-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .animal-profile-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .animal-profile-support-grid { grid-template-columns: 1fr; }
  .animal-profile-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  .animal-profile-modal { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .animal-profile-hero { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .animal-profile-current-state { grid-column: 1 / -1; min-width: 0; }
  .animal-profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .animal-profile-actions .table-actions { width: 100%; }
  .animal-profile-actions .button { flex: 1 1 140px; }
  .animal-profile-data dl,
  .animal-profile-event-details { grid-template-columns: 1fr; }
  .animal-profile-event-heading { flex-direction: column; gap: 4px; }
}

.kpi-row.kpi-row-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .kpi-row.kpi-row-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.modal-header,
.modal-footer {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--warning);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field.full {
  grid-column: 1 / -1;
}

.field-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.field-tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.field-tab:hover {
  background: var(--surface-alt);
}

.field-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.field-tab:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.field-tab-add {
  border-style: dashed;
  color: var(--primary);
}

.field-tab-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
}

.field-tab-add-row input {
  flex: 1 1 auto;
  min-width: 160px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}

.field-tab-add-row .button.compact {
  min-height: 34px;
  padding: 0 10px;
}

.photo-field-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.photo-field-preview {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  background: var(--background-muted);
  overflow: hidden;
  flex: none;
}

.photo-field-preview:not(.empty) {
  border: 1px solid var(--border);
}

.photo-field-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-field-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toast-root,
#toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 36px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  display: grid;
  gap: 3px;
}

.toast strong {
  color: var(--text-primary);
}

.toast span {
  color: var(--text-secondary);
  font-size: 13px;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--error); }

.dashboard-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 24px 0 10px;
}

.dashboard-section-title:first-child {
  margin-top: 0;
}

.agenda-calendar {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow-y: auto;
  padding: 2px 4px 2px 0;
}

.agenda-calendar-event {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 9px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 12px;
  background: var(--surface);
}

.agenda-calendar-event.alta { border-left-color: var(--error); }
.agenda-calendar-event.baixa { border-left-color: var(--info); }

.agenda-calendar-date {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 64px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--primary);
  line-height: 1;
  text-transform: uppercase;
}

.agenda-calendar-date span,
.agenda-calendar-date small {
  font-size: 10px;
  font-weight: 800;
}

.agenda-calendar-date strong { font-size: 24px; margin: 4px 0; }

.agenda-calendar-content { min-width: 0; display: grid; gap: 5px; }
.agenda-calendar-content strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
}

.agenda-calendar-content small {
  color: var(--text-secondary);
}

.dashboard-agenda-panel,
.dashboard-alerts-panel { align-self: start; }

@media (max-width: 640px) {
  .agenda-calendar-event { grid-template-columns: 52px minmax(0, 1fr); }
  .agenda-calendar-event > .status-chip { grid-column: 2; justify-self: start; }
  .agenda-calendar-date { min-height: 58px; }
}

/* Diálogo de sistema (erro de inicialização / confirmação de sucesso).
   Usado por frontend/app-new.js no lugar de estilo inline. */
@keyframes systemDialogFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes systemDialogSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.system-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(23, 78, 83, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: systemDialogFadeIn 0.3s ease-out;
}

.system-dialog {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: systemDialogSlideUp 0.3s ease-out;
}

.system-dialog-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  background: var(--success);
}

.system-dialog h2 {
  margin-bottom: 1rem;
}

.system-dialog h2.tone-error { color: var(--error); }
.system-dialog h2.tone-success { color: var(--success); }

.system-dialog p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.system-dialog button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: white;
}

.system-dialog button.tone-error { background: var(--info); }
.system-dialog button.tone-success { background: var(--success); }

/* Modal de Termos de Uso e Serviço (login/cadastro) — mais largo e com
   corpo rolável, diferente do .system-dialog (curto, centralizado). */
.terms-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(23, 78, 83, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.terms-modal {
  width: 100%;
  max-width: 720px;
  max-height: min(80vh, 760px);
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(23, 78, 83, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terms-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(23, 78, 83, 0.12);
}

.terms-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.terms-modal-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

.terms-modal-close:hover {
  color: var(--text-primary);
}

.terms-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.65;
}

.terms-modal-body .terms-meta {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-bottom: 12px;
}

.terms-modal-body h4 {
  margin: 20px 0 8px;
  color: var(--text-primary);
  font-size: 14.5px;
}

.terms-modal-body h4:first-of-type {
  margin-top: 0;
}

.terms-modal-body p {
  margin: 0 0 10px;
}

.terms-modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(23, 78, 83, 0.12);
}

.terms-modal-footer .btn-primary {
  width: auto;
  min-width: 140px;
  margin: 0 0 0 auto;
  display: block;
}

@media (max-width: 640px) {
  .terms-modal-backdrop {
    padding: 0;
  }

  .terms-modal {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
}

.settings-grid,
.reports-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-panel,
.report-panel,
.detail-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.report-panel .button,
.settings-panel .button {
  justify-self: start;
}

.document-preview {
  min-height: 360px;
  background:
    linear-gradient(#FFFFFF 0 0) padding-box,
    repeating-linear-gradient(0deg, rgba(13, 87, 94, 0.12) 0 1px, transparent 1px 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.document-preview h3 {
  margin: 0;
  color: var(--primary);
}

.document-preview p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .dashboard-grid.cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid,
  .settings-grid,
  .reports-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: auto;
  }

  .login-visual {
    min-height: auto;
    padding: 24px;
  }

  .app-shell,
  .app-shell.collapsed {
    grid-template-columns: 1fr;
  }

  /* Abaixo de 900px a navegação real passa a ser a barra de abas fixa +
     gaveta "Mais" (mobile-tabbar/mobile-drawer, mais abaixo neste mesmo
     bloco) — a sidebar empilhada deixa de fazer sentido e some. */
  .sidebar {
    display: none;
  }

  .mobile-tabbar {
    display: grid;
  }

  /* .open é que decide visibilidade (opacity/transform) — sem isso a gaveta
     ficaria clicável fora da tela mesmo fechada. Ver estilos-base logo
     depois de .sidebar-toggle para o restante (backdrop, largura, cores). */
  .mobile-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-drawer.open {
    transform: translateX(0);
  }

  /* .main-area fixa a altura da 1ª linha do grid em --topbar-height (72px) —
     sem isso, quando a topbar quebra em duas linhas abaixo (título em cima,
     filtros embaixo), ela ultrapassa essa linha fixa e cobre o card seguinte
     do dashboard, já que grid tracks de tamanho fixo não crescem para caber
     o conteúdo. */
  .main-area {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    position: relative;
    grid-template-columns: 1fr;
    height: auto;
    padding: 16px;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* padding-bottom extra: sem isso, o conteúdo da última tela fica escondido
     atrás da barra de abas fixa (mobile-tabbar), já que ela é position:fixed
     e não reserva espaço no fluxo normal do documento. */
  .content {
    padding: 16px;
    padding-bottom: calc(var(--mobile-tabbar-height) + 20px);
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 28px 20px;
  }

  .login-title h1 {
    font-size: 29px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Grade de indicadores em 2 colunas (não 1) no mobile — pedido do usuário
     com base numa referência de app nativo (cards de indicador lado a lado).
     Quando sobra um card ímpar no fim, ele ocupa a linha inteira em vez de
     ficar com um buraco do lado. */
  .dashboard-grid,
  .dashboard-grid.cols-5,
  .kpi-row,
  .kpi-row.kpi-row-4,
  .kpi-row.kpi-row-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid > :last-child:nth-child(odd),
  .kpi-row > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .dashboard-grid.primary .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 24px;
  }

  .dashboard-grid.primary .metric-value {
    font-size: 26px;
  }

  .bar-chart {
    grid-template-columns: repeat(3, minmax(42px, 1fr));
  }

  .topbar-select,
  .search-input {
    width: 100%;
    min-width: 0;
  }

  /* Listas viram cards no mobile (Animais, Lotes, Pesagens, Nutrição,
     Estoque, Medicamentos, Sanidade, Reprodução, Ultrassom, Documentos,
     Financeiro, Usuários, Fazendas — tudo que passa por renderTable()).
     Técnica clássica de tabela responsiva: thead some, cada <tr> vira um
     cartão e cada <td> usa data-label (adicionado em renderTable()) como
     rótulo à esquerda do valor. Um único bloco de CSS cobre todos os
     módulos porque todos compartilham a mesma função de renderização. */
  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    padding: 4px 14px;
  }

  tr:hover td {
    background: transparent;
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--background-muted);
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
  }

  .table-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    width: 100%;
  }
}

/* AcomGest 2026 visual refresh */
body {
  background:
    radial-gradient(circle at 86% -10%, rgba(138, 196, 174, 0.28), transparent 28%),
    linear-gradient(180deg, #FFFFFF 0%, var(--background) 100%);
}

.app-shell {
  background:
    radial-gradient(circle at 92% 8%, rgba(138, 196, 174, 0.24), transparent 28%),
    linear-gradient(180deg, #FFFFFF 0%, var(--background) 100%);
}

.sidebar {
  background:
    linear-gradient(180deg, #174E53 0%, #086F6B 68%, #174E53 100%);
  box-shadow: 18px 0 50px rgba(23, 78, 83, 0.14);
}

.sidebar-header {
  border-bottom-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar .brand-logo {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.22));
}

.sidebar .brand-name {
  color: #FFFFFF;
  letter-spacing: 0;
}

.sidebar .brand-system {
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-toggle,
.nav-icon {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-section summary {
  color: rgba(255, 255, 255, 0.68);
}

.nav-button {
  min-height: 44px;
  border: 1px solid transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.10);
}

.nav-button.active {
  background: linear-gradient(135deg, rgba(138, 196, 174, 0.28), rgba(50, 156, 124, 0.18));
  border-color: rgba(138, 196, 174, 0.36);
  box-shadow: inset 3px 0 0 #8AC4AE;
}

.main-area {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 248, 246, 0.95));
}

.topbar {
  background: rgba(255, 255, 255, 0.86);
  border-bottom-color: rgba(23, 78, 83, 0.10);
  box-shadow: 0 12px 32px rgba(23, 78, 83, 0.07);
}

.topbar-title h1 {
  color: var(--text-primary);
  font-weight: 850;
  letter-spacing: 0;
}

.topbar-title p {
  color: var(--text-secondary);
}

.topbar-select,
.search-input,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  border-color: rgba(93, 109, 115, 0.22);
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: 0 1px 0 rgba(23, 78, 83, 0.04);
}

.topbar-select:focus,
.search-input:focus,
.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: #086F6B;
  box-shadow: 0 0 0 4px rgba(138, 196, 174, 0.28);
}

.notification-button,
.profile-button {
  border-radius: 8px;
  color: var(--text-primary);
}

.content {
  padding: 28px;
}

.view {
  gap: 20px;
}

.button {
  border-radius: 8px;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  background: #174E53;
  border-color: #174E53;
  box-shadow: 0 10px 22px rgba(8, 111, 107, 0.22);
}

.button.primary:hover {
  background: #0E6461;
  border-color: #0E6461;
}

.button.secondary {
  background: rgba(138, 196, 174, 0.18);
  border-color: rgba(8, 111, 107, 0.20);
  color: var(--text-primary);
}

.button.accent {
  background: #329C7C;
  border-color: #329C7C;
}

.button.danger {
  background: rgba(220, 38, 38, 0.08);
}

.table-panel,
.settings-panel,
.report-panel,
.chart-card,
.timeline-panel,
.detail-panel,
.rfid-panel,
.ai-panel,
.sync-panel,
.stat-card,
.lot-card {
  border: 1px solid rgba(23, 78, 83, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(23, 78, 83, 0.10);
}

.dashboard-grid {
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before,
.table-panel::before,
.settings-panel::before,
.report-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #329C7C, #086F6B, #174E53);
}

.stat-card,
.table-panel,
.settings-panel,
.report-panel {
  position: relative;
}

.metric-value,
.kpi strong,
.stat-card strong {
  color: var(--text-primary);
}

.metric-label,
.kpi span,
.panel-title p,
.table-panel p,
.settings-panel p {
  color: var(--text-secondary);
}

.kpi {
  border-color: rgba(23, 78, 83, 0.10);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FBF8 100%);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: #EEF6F2;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(23, 78, 83, 0.10);
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(138, 196, 174, 0.14);
}

.status-chip,
.badge {
  border-radius: 999px;
  font-weight: 800;
}

.status-chip.success {
  background: rgba(50, 156, 124, 0.16);
  color: #086F6B;
}

.status-chip.info {
  background: rgba(138, 196, 174, 0.20);
  color: var(--text-primary);
}

.lot-card {
  background:
    linear-gradient(180deg, #FFFFFF 0%, #F6FBF8 100%);
}

.lot-card-head strong {
  color: var(--text-primary);
}

.progress-fill {
  background: linear-gradient(90deg, #329C7C, #086F6B);
}

.modal-backdrop {
  background: rgba(23, 78, 83, 0.44);
  backdrop-filter: blur(8px);
}

.modal {
  border-radius: 8px;
  border: 1px solid rgba(23, 78, 83, 0.12);
  box-shadow: 0 32px 90px rgba(23, 78, 83, 0.28);
}

.modal-header {
  background: linear-gradient(90deg, rgba(138, 196, 174, 0.18), rgba(255, 255, 255, 0));
}

.toast {
  border: 1px solid rgba(23, 78, 83, 0.12);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 78, 83, 0.16);
}

.toast.success {
  border-left-color: #329C7C;
}

.login-page {
  background:
    radial-gradient(circle at 80% 18%, rgba(138, 196, 174, 0.24), transparent 26%),
    linear-gradient(135deg, #FFFFFF 0%, #F4F8F6 100%);
}

.login-visual-panel {
  background: linear-gradient(150deg, #174E53 0%, #086F6B 58%, #329C7C 100%);
}

.pasture-map {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at 28% 28%, rgba(138, 196, 174, 0.30), transparent 28%);
}

.login-visual-logo {
  position: absolute;
  right: 8%;
  top: 8%;
  width: min(260px, 34vw);
  opacity: 0.16;
  filter: brightness(0) invert(1);
  pointer-events: none;
}

.visual-copy {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 32px;
  color: #FFFFFF;
  display: grid;
  gap: 8px;
  max-width: 460px;
}

.visual-copy strong {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.05;
}

.visual-copy span {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

.profile-menu-wrap {
  position: relative;
}

.profile-copy {
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.1;
}

.profile-copy strong {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.profile-copy small {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: 210px;
  padding: 6px;
  background: #FFFFFF;
  border: 1px solid rgba(23, 78, 83, 0.12);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 78, 83, 0.16);
}

.profile-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  border-radius: 7px;
  padding: 10px 11px;
  text-align: left;
  font-weight: 800;
}

.profile-menu button:hover {
  background: rgba(138, 196, 174, 0.18);
}

.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-wrap .search-input {
  padding-right: 40px;
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: rgba(138, 196, 174, 0.22);
  color: var(--text-primary);
  font-weight: 900;
}

.dashboard-empty,
.data-empty {
  display: grid;
  gap: 12px;
  justify-items: center;
  border: 1px dashed rgba(23, 78, 83, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FBF8 100%);
}

.dashboard-empty strong,
.data-empty strong {
  color: var(--text-primary);
  font-size: 20px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.metric-card {
  border-color: rgba(23, 78, 83, 0.10);
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FCFA 100%);
}

.metric-head {
  align-items: center;
  justify-content: flex-start;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text-primary);
  background: rgba(138, 196, 174, 0.22);
  font-size: 12px;
  font-weight: 900;
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-icon.success {
  background: rgba(50, 156, 124, 0.18);
  color: #086F6B;
}

.metric-icon.warning {
  background: rgba(245, 158, 11, 0.16);
  color: #8A5A00;
}

.metric-icon.error {
  background: rgba(220, 38, 38, 0.12);
  color: #B91C1C;
}

.metric-icon.info {
  background: rgba(138, 196, 174, 0.26);
}

/* Ícone do indicador como "tile" de cor sólida (não só um tint suave) no
   mobile — mais perto da referência de app nativo mandada pelo usuário.
   Precisa vir depois das regras .metric-icon.* acima (mesma especificidade,
   quem vem depois no arquivo vence) para não ser silenciosamente anulado. */
@media (max-width: 640px) {
  .metric-icon.success {
    background: var(--success);
    color: #FFFFFF;
  }

  .metric-icon.warning {
    background: var(--warning);
    color: #FFFFFF;
  }

  .metric-icon.error {
    background: var(--error);
    color: #FFFFFF;
  }

  .metric-icon.info,
  .metric-icon.secondary {
    background: var(--primary-light);
    color: #FFFFFF;
  }
}

.metric-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-variation {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.metric-action {
  border: 0;
  background: transparent;
  color: #086F6B;
  font-size: 12px;
  font-weight: 900;
  padding: 0;
}

.metric-action:not(:disabled)::after {
  content: " →";
}

.metric-action:hover:not(:disabled) {
  text-decoration: underline;
}

/* ============================================
   DASHBOARD — reescrita controlada (ver docs/frontend.md)
   Escopado em .dashboard-view para não afetar .metric-card/.chart-panel/
   .table-panel/.empty-state usados por outras telas (ex.: Pesagens).
   ============================================ */

.dashboard-view .metric-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.dashboard-view .chart-panel,
.dashboard-view .table-panel {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.dashboard-view .empty-state {
  border-radius: var(--radius-lg);
}

.dashboard-grid.primary .metric-card {
  padding: 22px;
}

.dashboard-grid.primary .metric-value {
  font-size: 38px;
}

/* cols-5 (Financeiro) tem 5 cartões na mesma largura onde .primary normalmente
   cabe 4 — 38px estourava a largura do cartão com valores de moeda maiores
   (ex.: "-R$ 3.740,00"), sobrepondo o cartão vizinho (bug relatado em 12/07). */
.dashboard-grid.primary.cols-5 .metric-value {
  font-size: 26px;
}

.dashboard-grid.primary .metric-icon {
  width: 44px;
  height: 44px;
}

.dashboard-grid.primary .metric-icon svg {
  width: 23px;
  height: 23px;
}

.dashboard-grid.secondary {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.dashboard-grid.secondary .metric-card {
  padding: 16px;
  gap: 9px;
}

.dashboard-grid.secondary .metric-value {
  font-size: 26px;
}

.dashboard-grid.secondary .metric-icon {
  width: 32px;
  height: 32px;
}

.dashboard-grid.secondary .metric-icon svg {
  width: 17px;
  height: 17px;
}

/* Bloco 2 — Resumo do dia */
.daily-summary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  color: #FFFFFF;
  box-shadow: 0 16px 40px rgba(23, 78, 83, 0.22);
}

.daily-summary-greeting {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.daily-summary-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.daily-summary-farm {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}

.daily-summary-list {
  display: grid;
  gap: 9px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.daily-summary-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.daily-summary-list .dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.65);
}

.daily-summary-list .dot.warning { background: #FCD34D; }
.daily-summary-list .dot.error { background: #FCA5A5; }

.daily-summary-empty {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

/* Bloco de insights por módulo (docs/smart-blocks-standard.md) — cartão
   branco com ícone de severidade, reaproveitando os tons de .metric-icon */
.module-insight-section {
  margin-bottom: 18px;
}

.module-insight-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.module-insight-list {
  display: grid;
  gap: 10px;
}

.module-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(45, 38, 43, 0.04);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.module-insight-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.module-insight-heading {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.module-insight-message {
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* Alertas de relato pendente no Dashboard (renderPendingReportAlerts) — bloco
   destacado (mesmo espírito do .daily-summary logo acima, só que em tom de
   alerta) com os relatos em cards lado a lado dentro dele, não empilhados
   como linhas separadas (layout pedido pelo usuário, 13/07/2026). */
.report-alert-block {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.24), transparent 26%),
    linear-gradient(135deg, #064e4d 0%, #087f73 48%, #1687c7 100%);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 16px 34px rgba(6, 78, 77, 0.18);
}

.report-alert-block-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: #fff;
  margin-bottom: 16px;
}

.report-alert-icon,
.conversation-inbox-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  flex: none;
}

.report-alert-icon svg,
.conversation-inbox-icon svg {
  width: 21px;
  height: 21px;
}

.report-alert-eyebrow,
.conversation-kicker {
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.report-alert-eyebrow {
  color: #bffbf2;
  margin-bottom: 3px;
}

.report-alert-block-title {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 850;
  margin: 0;
}

.report-alert-block-heading p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  margin: 4px 0 0;
}

.report-alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.report-alert-card {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 11px;
  flex: 1 1 270px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(4, 42, 48, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.report-alert-card:hover {
  border-color: #7dd3c7;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(4, 42, 48, 0.18);
}

.report-alert-card-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #daf8f2;
  color: #087f73;
}

.report-alert-card-icon svg {
  width: 18px;
  height: 18px;
}

.report-alert-card-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.report-alert-card-copy strong {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-alert-card-copy small {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.report-alert-card-action {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #087f73;
  font-size: 12px;
  font-weight: 800;
}

.report-alert-card-action svg {
  width: 14px;
  height: 14px;
}

/* Conversas operacionais */
.conversation-inbox-panel {
  overflow: hidden;
  border: 1px solid #bce5df;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #f3fffc 0%, #f7fbff 100%);
  margin-bottom: 24px;
  box-shadow: 0 12px 30px rgba(15, 92, 88, 0.08);
}

.conversation-inbox-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid #cdece7;
  background: linear-gradient(120deg, rgba(12, 143, 126, 0.09), rgba(45, 132, 194, 0.08));
}

.conversation-inbox-heading-copy {
  display: flex;
  align-items: center;
  gap: 13px;
}

.conversation-inbox-icon {
  background: linear-gradient(145deg, #078878, #1687c7);
  border: 0;
  box-shadow: 0 8px 18px rgba(7, 136, 120, 0.22);
}

.conversation-inbox-heading h2,
.conversation-section-heading h2 {
  margin: 2px 0 3px;
  color: var(--text-primary);
}

.conversation-inbox-heading p,
.conversation-section-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.conversation-inbox-heading .conversation-kicker,
.conversation-section-heading > span {
  color: #087f73;
}

.conversation-inbox-count {
  display: grid;
  min-width: 112px;
  padding: 10px 14px;
  border: 1px solid #f4c565;
  border-radius: 14px;
  background: #fff8e8;
  color: #805311;
  text-align: center;
}

.conversation-inbox-count strong { font-size: 22px; line-height: 1; }
.conversation-inbox-count span { font-size: 11px; font-weight: 750; margin-top: 4px; }

.conversation-inbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 12px;
  padding: 16px;
}

.conversation-inbox-card {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--border);
  border-left: 4px solid #f0a724;
  border-radius: 14px;
  background: #fff;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.conversation-inbox-card.is-resolved { border-left-color: #19a974; }
.conversation-inbox-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(12, 82, 87, 0.12); }
.conversation-inbox-card-top,
.conversation-inbox-progress,
.conversation-inbox-open,
.conversation-inbox-author { display: flex; align-items: center; }
.conversation-inbox-card-top { justify-content: space-between; gap: 8px; }
.conversation-inbox-card-top time { color: var(--text-secondary); font-size: 11px; }
.conversation-inbox-card > strong { font-size: 14px; }
.conversation-inbox-author { gap: 6px; color: var(--text-secondary); font-size: 12px; }
.conversation-inbox-author svg { width: 15px; height: 15px; }
.conversation-inbox-progress { gap: 6px; flex-wrap: wrap; }
.conversation-inbox-progress span { padding: 4px 7px; border-radius: 999px; background: var(--surface-alt); color: var(--text-secondary); font-size: 10.5px; font-weight: 700; }
.conversation-inbox-open { justify-content: flex-end; gap: 5px; color: #087f73; font-size: 12px; font-weight: 800; }
.conversation-inbox-open svg { width: 14px; height: 14px; }

.conversation-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px;
  color: #16815e;
}
.conversation-empty-state > .kbd-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #dff8ed; }
.conversation-empty-state strong,
.conversation-empty-state span { display: block; }
.conversation-empty-state span { color: var(--text-secondary); font-size: 12px; margin-top: 3px; }

.conversation-section-heading { margin: 4px 0 14px; }
.conversation-section-heading > span { font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }

#report-view-modal { width: min(760px, calc(100vw - 28px)); }
.conversation-modal-title { display: flex; align-items: center; gap: 11px; }
.conversation-modal-title > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #078878, #1687c7); }
.conversation-modal-title svg { width: 19px; height: 19px; }
.conversation-modal-title small { color: var(--text-secondary); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.conversation-modal-title h2 { margin: 1px 0 0; }
.conversation-modal-body { display: grid; gap: 16px; }
.conversation-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 16px; border: 1px solid #cdece7; border-radius: 15px; background: linear-gradient(125deg, #edfcf8, #eff7ff); }
.conversation-summary .conversation-kicker { color: #087f73; }
.conversation-summary h3 { margin: 4px 0 0; font-size: 18px; }
.conversation-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.conversation-meta > span { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--text-secondary); font-size: 11.5px; }
.conversation-meta svg { width: 14px; height: 14px; color: #087f73; }
.conversation-thread { display: grid; gap: 14px; max-height: 340px; overflow-y: auto; padding: 2px 5px 2px 0; }
.conversation-message { display: flex; align-items: flex-start; gap: 10px; max-width: 88%; }
.conversation-message-reply { margin-left: auto; flex-direction: row-reverse; }
.conversation-message-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none; background: #d8f4ef; color: #087f73; font-size: 13px; font-weight: 850; }
.conversation-message-reply .conversation-message-avatar { background: #deedfb; color: #1670ad; }
.conversation-message-bubble { padding: 12px 14px; border-radius: 4px 15px 15px; background: #f1f7f6; border: 1px solid #d9e9e6; }
.conversation-message-reply .conversation-message-bubble { border-radius: 15px 4px 15px 15px; background: #edf6fd; border-color: #d5e8f6; }
.conversation-message-author { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.conversation-message-author strong { font-size: 12.5px; }
.conversation-message-author span { color: var(--text-secondary); font-size: 10.5px; }
.conversation-message-bubble p { margin: 0; color: var(--text-primary); line-height: 1.55; white-space: pre-wrap; }
.conversation-empty-reply,
.conversation-resolved-note { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; border-radius: 12px; font-size: 12px; }
.conversation-empty-reply { color: var(--text-secondary); background: var(--surface-alt); border: 1px dashed var(--border); }
.conversation-resolved-note { color: #13734f; background: #e5f8ef; border: 1px solid #b9e8d2; font-weight: 750; }
.conversation-empty-reply svg,
.conversation-resolved-note svg { width: 15px; height: 15px; }
.conversation-composer { display: grid; gap: 7px; color: var(--text-primary); font-size: 12.5px; font-weight: 800; }
.conversation-composer textarea { min-height: 94px; resize: vertical; }

@media (max-width: 680px) {
  .report-alert-block { padding: 17px; }
  .report-alert-card { flex-basis: 100%; }
  .conversation-inbox-heading { align-items: flex-start; padding: 16px; }
  .conversation-inbox-count { min-width: 84px; padding: 8px; }
  .conversation-inbox-heading-copy { align-items: flex-start; }
  .conversation-inbox-grid { grid-template-columns: 1fr; padding: 12px; }
  .conversation-summary { flex-direction: column; }
  .conversation-message { max-width: 96%; }
}

/* Painel de OCR/cadastro manual de Medicamentos (renderMedicines) */
.ocr-source-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ocr-review {
  display: grid;
  gap: 10px;
}

.ocr-review textarea {
  min-height: 120px;
}

.ocr-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 1em;
}

/* Análises cruzadas entre módulos (computeReproductionCorrelations) */
.cross-module-card .module-insight-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cross-module-card .button {
  margin-top: 6px;
}

/* Painel de solicitações/convites em Usuários (renderUsuarios) */
.user-management-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.user-management-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.pending-user-card,
.invite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}

.pending-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pending-user-card strong,
.invite-card strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}

.pending-user-card span,
.invite-card span {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.invite-token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ACG-034 (auditoria de segurança 20/08/2026): o token do convite deixou de
   ser recuperável depois de criado (só o hash é persistido), então a linha
   deixou de mostrar/copiar o valor — só um aviso curto de que já foi
   enviado. */
.invite-token-sent-note {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.invite-token-row .button {
  flex: none;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12.5px;
}

.invite-token-row .button svg {
  width: 15px;
  height: 15px;
}

/* Painel de Protocolos IATF embutido em Reprodução (renderProtocolsPanel) */
.protocols-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.local-only-inline-note {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  cursor: help;
}

.protocols-panel-actions {
  display: flex;
  gap: 8px;
}

.protocols-panel-list {
  display: grid;
  gap: 10px;
}

.protocol-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(45, 38, 43, 0.04);
  padding: 12px 14px;
  cursor: pointer;
}

.protocol-card-main {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.protocol-card-main strong {
  font-size: 14px;
  color: var(--text-primary);
}

.protocol-card-main span {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.lot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--border);
}

.lot-tab-button {
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.lot-tab-button.active {
  background: var(--surface-alt);
  color: var(--primary);
}

.lot-tab-panel {
  display: grid;
  gap: 14px;
}

.protocols-panel-pending {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.protocols-panel-pending h4 {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.protocol-application-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.protocol-steps-field {
  display: grid;
  gap: 8px;
}

.protocol-steps-list {
  display: grid;
  gap: 8px;
}

.protocol-step-row {
  display: grid;
  grid-template-columns: 110px 1fr 120px auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 720px) {
  .protocol-step-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Bloco 5 — rebanho por categoria (taxonomia fixa) e alertas por criticidade */
.category-legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.alert-groups {
  display: grid;
  gap: 12px;
  max-height: 390px;
  overflow-y: auto;
  padding: 2px 14px 14px;
}

.alert-group {
  display: grid;
  gap: 7px;
}

.alert-card-list { display: grid; gap: 8px; }

/* ALERTAS-C1 — card único de insight/alerta: cabeçalho (ícone + brinco/raça
   + título + dispensar), contexto operacional, detalhes expansíveis (via
   .operational-alert-details, reaproveitado sem mudança), barra de ação. */
.insight-kpi-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 14px 10px;
}

.insight-kpi-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.insight-kpi-chip strong { font-size: 17px; font-weight: 800; text-transform: none; letter-spacing: 0; }

.insight-kpi-chip.error { color: #8F1D1D; background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.28); }
.insight-kpi-chip.warning { color: #805400; background: rgba(245, 158, 11, 0.11); border-color: rgba(245, 158, 11, 0.34); }
.insight-kpi-chip.info { color: #164EA4; background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.25); }

.insight-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-left-width: 5px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.insight-card.error { border-color: rgba(220, 38, 38, 0.28); background: rgba(220, 38, 38, 0.06); }
.insight-card.warning { border-color: rgba(245, 158, 11, 0.34); background: rgba(245, 158, 11, 0.08); }
.insight-card.info { border-color: rgba(37, 99, 235, 0.25); background: rgba(37, 99, 235, 0.06); }
.insight-card.dismissed { opacity: 0.72; }

.insight-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.insight-card-heading { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
.insight-card-heading strong { font-size: 13.5px; }
.insight-card-title { font-size: 12px; color: var(--text-secondary); }
.insight-card-metric { font-size: 12px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }

.insight-card-dismiss {
  flex: 0 0 auto;
  opacity: 0.55;
}
.insight-card-dismiss:hover { opacity: 1; }

.insight-card-context { margin: 0; color: var(--text-primary); font-size: 12.5px; line-height: 1.4; }

.insight-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.insight-card-group-list summary {
  width: fit-content;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.insight-card-group-list .alert-card-list { margin-top: 8px; }

.insight-dismissed-section {
  margin: 8px 14px 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.insight-dismissed-section summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
}
.insight-dismissed-section .alert-card-list { margin-top: 8px; }

.operational-alert-details summary {
  width: fit-content;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.operational-alert-details .alert-structure {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.alert-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 2px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0;
}

.alert-group-title .count {
  background: var(--background-muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
}

.field-hint {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.field-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--error-soft, rgba(220, 38, 38, 0.08));
  color: var(--error);
  font-size: 13px;
  font-weight: 700;
}

/* Peso (kg) em destaque no formulário de Pesagem (field.emphasize) — pedido
   do usuário, 13/07/2026: "o campo maior e mais destacado da tela". */
.field-emphasize input {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  padding: 12px 14px;
}

/* Opções avançadas recolhidas (field.advanced) — Origem/Método/Responsável/
   Observação raramente mudam a cada pesagem, ficam escondidas por padrão. */
.advanced-options {
  margin-top: 4px;
}

.advanced-options summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  padding: 8px 0;
  list-style: none;
}

.advanced-options summary::-webkit-details-marker {
  display: none;
}

.advanced-options summary::before {
  content: "▸ ";
}

.advanced-options[open] summary::before {
  content: "▾ ";
}

.advanced-options .form-grid {
  margin-top: 10px;
}

/* Busca rápida de animal (renderQuickAnimalSearchField) — Pesagem é sempre
   de um único animal, sem grid de filtros/cards (pedido do usuário,
   13/07/2026). */
.quick-animal-summary[hidden] {
  display: none;
}

.quick-animal-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
}

.quick-animal-search-wrap[hidden] {
  display: none;
}

.quick-animal-search-wrap {
  display: grid;
  gap: 6px;
}

.quick-animal-results {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.quick-animal-result {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
}

.quick-animal-result:hover {
  border-color: var(--primary-light);
}

.quick-animal-empty {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* LOT-UX-C1 (complemento) — busca+lista de "Adicionar animais a um lote":
   mesmo espírito minimalista do quick-animal-search acima (sem grade de
   filtros), mas com seleção múltipla e 3 estados por linha. flex-wrap em
   vez de larguras fixas garante leitura confortável no celular sem precisar
   de uma media query própria. */
.lot-animal-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 10px;
}

.lot-animal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}

.lot-animal-row[hidden] {
  display: none;
}

.lot-animal-row.already-in-lot {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--success);
}

.lot-animal-row.in-other-lot {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--warning);
}

.lot-animal-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--secondary);
  flex: 0 0 auto;
}

.lot-animal-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 160px;
}

.lot-animal-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.lot-animal-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--success);
  flex: 0 0 auto;
}

.lot-animal-row.in-other-lot .lot-animal-status {
  color: var(--warning-dark, var(--warning));
}

.lot-animal-transfer-note {
  flex: 1 1 100%;
  font-size: 12.5px;
  color: var(--warning-dark, var(--warning));
  background: rgba(245, 158, 11, 0.12);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.lot-animal-transfer-note[hidden] {
  display: none;
}

.ai-disclaimer {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--warning);
  color: var(--text-primary);
  font-size: 13px;
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
  cursor: pointer;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--secondary);
  flex: 0 0 auto;
}

/* Componentes de inteligência reprodutiva (silhueta ECC, termômetro THI, radar) */
.cow-silhouette {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.cow-silhouette svg {
  width: 96px;
  height: 64px;
}

.cow-silhouette .cow-body {
  color: var(--border);
  fill: var(--background-muted);
}

.cow-silhouette .cow-hip,
.cow-silhouette .cow-leg,
.cow-silhouette .cow-eye {
  color: var(--text-secondary);
}

.cow-silhouette.tone-good .cow-body { color: var(--success); fill: rgba(50, 156, 124, 0.16); }
.cow-silhouette.tone-good .cow-hip { color: var(--success); }
.cow-silhouette.tone-watch .cow-body { color: var(--warning); fill: rgba(245, 158, 11, 0.12); }
.cow-silhouette.tone-watch .cow-hip { color: var(--warning); }
.cow-silhouette.tone-low .cow-body { color: var(--error); fill: rgba(220, 38, 38, 0.10); }
.cow-silhouette.tone-low .cow-hip { color: var(--error); stroke-width: 3.2; }

.cow-silhouette-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.thi-thermometer {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.thi-thermometer svg {
  width: 32px;
  height: 80px;
  overflow: visible;
}

.thermo-track {
  fill: var(--background-muted);
  stroke: var(--border);
}

.thermo-fill {
  fill: var(--info);
  transition: height 0.2s ease, y 0.2s ease;
}

.thi-thermometer.tone-success .thermo-fill { fill: var(--success); }
.thi-thermometer.tone-warning .thermo-fill { fill: var(--warning); }
.thi-thermometer.tone-error .thermo-fill { fill: var(--error); }
.thi-thermometer.tone-neutral .thermo-fill { fill: var(--text-secondary); opacity: 0.4; }

.thi-thermometer-copy {
  display: grid;
  gap: 2px;
}

.thi-thermometer-copy strong {
  font-size: 22px;
  color: var(--text-primary);
}

.thi-thermometer-copy span {
  font-size: 12px;
  color: var(--text-secondary);
}

.performance-radar {
  display: flex;
  justify-content: center;
}

.performance-radar svg {
  width: 100%;
  max-width: 240px;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.radar-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.radar-label {
  font-size: 6.5px;
  font-weight: 700;
  fill: var(--text-secondary);
}

.radar-shape {
  fill: rgba(8, 111, 107, 0.22);
  stroke: var(--secondary);
  stroke-width: 1.6;
}

.weight-analysis {
  display: grid;
  gap: 14px;
}

.weight-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.analytics-grid.compact {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.75fr);
}

.weight-curve-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.smooth-line-chart {
  min-height: 240px;
  max-width: 100%;
  /* Mesmo motivo do min-width:0 em .chart-panel: sem isso, o SVG largo (que
     só deveria rolar dentro de .smooth-line-chart-scroll) ainda "vaza" sua
     largura intrínseca pro cálculo da coluna do grid interno do cartão,
     alargando também a legenda (grid item irmão, justify-self:stretch)
     junto com ele. */
  min-width: 0;
}

/* Rolagem horizontal contida SÓ neste contêiner interno — o SVG mantém sua
   largura real em pixels (igual ao viewBox, definida no atributo width do
   próprio elemento) em vez do antigo `width: 100%` forçado, que encolhia o
   gráfico inteiro (texto incluso) até caber no cartão quando havia muitas
   pesagens, ficando ilegível. Com muitos pontos o gráfico agora rola em vez
   de encolher — e a rolagem nunca "vaza" pro cartão/página, porque só este
   div tem overflow-x (achado do usuário: gráfico não pode alargar a página
   inteira). */
.smooth-line-chart-scroll {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

.smooth-line-chart svg {
  display: block;
  height: 230px;
}

/* Rótulos de data desenhados dentro do próprio SVG, na mesma coordenada X
   dos pontos/marcadores — antes eram uma <div> HTML separada posicionada por
   flexbox (justify-content: space-between), que não seguia a mesma
   matemática das coordenadas do SVG e ficava desalinhada dos marcadores
   (achado do usuário, 13/07/2026). */
.smooth-line-chart-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--text-secondary);
}

/* Grade/eixos/legenda do gráfico (renderChartAxes/renderChartLegend) —
   achado do usuário, 13/07/2026: sem grade/eixo não dá pra saber a escala
   real do peso, e sem legenda não dá pra saber o que cada traço representa. */
.chart-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis-line {
  stroke: #B7C7C1;
  stroke-width: 1.2;
}

.chart-axis-value {
  font-size: 10.5px;
  fill: var(--text-secondary);
}

.chart-axis-title {
  font-size: 11px;
  font-weight: 800;
  fill: var(--text-secondary);
}

.chart-reference-line {
  stroke: #5D6D73;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

/* `.chart-panel` cresce em altura automática (min-height, nunca height
   fixo) e a legenda nunca tem altura própria fixa — com `flex-wrap` ela
   quebra em mais linhas conforme o cartão fica mais estreito, sempre
   inteiramente contida dentro do `.chart-panel` (nunca cortada nem
   vazando), com espaço reservado abaixo dela antes da borda do cartão. */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  padding-bottom: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  /* Mesmo motivo do min-width:0 em .chart-panel/.smooth-line-chart: sem
     isso, em telas estreitas (legenda quebra em 3 linhas por flex-wrap), a
     largura "preferida" (sem quebra) da legenda podia ser usada como base
     para o auto-sizing da linha do grid pai — resultando numa altura de
     linha menor do que o conteúdo já quebrado realmente ocupa, e a seção
     seguinte (Insights do módulo) sobrepondo o fim do cartão do gráfico
     (achado do usuário via captura de tela mobile). */
  min-width: 0;
}

.chart-warning,
.chart-value-warning {
  color: var(--warning, #9A6700);
  font-weight: 700;
}

.chart-caption {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0;
}

/* Tooltip customizado dos gráficos de pesagem (mouse/foco/toque) —
   posição fixa (as coordenadas vêm de getBoundingClientRect, relativas ao
   viewport) para nunca ser cortado pelo overflow-x do contêiner de
   rolagem do gráfico. */
.chart-tooltip {
  position: fixed;
  transform: translate(-50%, -100%);
  background: var(--text-primary, #1A2E2B);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.chart-legend-swatch.thin {
  height: 1.5px;
  opacity: 0.5;
}

.chart-legend-swatch.dashed {
  height: 0;
  border-top: 2px dashed #5D6D73;
  background: none !important;
}

.chart-legend-swatch.area {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  opacity: 0.3;
}

.animal-weight-curve .panel-title p {
  color: var(--text-secondary);
  font-size: 14px;
}

.animal-weight-curve .panel-title strong {
  color: #086F6B;
  font-size: 18px;
}

.ranking-list {
  display: grid;
  gap: 9px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(23, 78, 83, 0.10);
  border-radius: 8px;
  background: #FFFFFF;
}

.ranking-row span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(138, 196, 174, 0.22);
  font-weight: 900;
}

.ranking-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-row em {
  color: #086F6B;
  font-style: normal;
  font-weight: 900;
}

.weight-insights .panel-toolbar {
  padding: 16px 16px 0;
}

.animal-picker {
  display: grid;
  gap: 10px;
}

.animal-picker-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.animal-picker-search {
  min-width: min(320px, 100%);
  flex: 1 1 240px;
  min-height: 38px;
  border: 1px solid rgba(93, 109, 115, 0.22);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--text-primary);
}

.topbar-select.compact {
  min-width: 136px;
}

.animal-picker-select {
  min-height: 38px;
}

.animal-picker-searchbar {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.animal-picker-searchbar .animal-picker-search {
  flex: 1 1 auto;
  min-width: 0;
}

.animal-picker-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 10px 12px;
  border: 1px solid rgba(93, 109, 115, 0.18);
  border-radius: 8px;
  background: rgba(23, 78, 83, 0.03);
}

.animal-picker-filters[hidden],
.animal-picker-batch-row[hidden],
.animal-picker-counter[hidden] {
  display: none;
}

.animal-picker-filter-field {
  display: grid;
  gap: 3px;
}

.animal-picker-filter-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.animal-picker-mode {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(23, 78, 83, 0.06);
  width: fit-content;
}

.picker-mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.picker-mode-btn.active {
  background: #FFFFFF;
  color: #086F6B;
  box-shadow: 0 1px 4px rgba(23, 78, 83, 0.14);
}

.animal-picker-batch-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.animal-picker-counter {
  font-size: 13px;
  font-weight: 600;
  color: #086F6B;
}

.animal-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow: auto;
  padding-right: 2px;
}

.animal-picker-card {
  border: 1px solid rgba(23, 78, 83, 0.12);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--text-primary);
  padding: 12px;
  display: grid;
  gap: 9px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 78, 83, 0.06);
}

.animal-picker-card.selected {
  border-color: #086F6B;
  box-shadow: 0 0 0 3px rgba(138, 196, 174, 0.24);
}

.animal-picker-card.has-alert {
  border-color: rgba(245, 158, 11, 0.42);
}

.animal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.animal-card-name,
.animal-card-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.animal-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.animal-card-grid span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.animal-card-grid small {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
}

.animal-card-grid strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.animal-card-alert {
  color: #8A5A00;
  background: rgba(245, 158, 11, 0.14);
  border-radius: 999px;
  padding: 5px 8px;
  width: fit-content;
  font-size: 12px;
  font-weight: 900;
}

.empty-state.compact {
  padding: 18px;
}

/* Premium sidebar + flat buttons */
.sidebar {
  background: linear-gradient(180deg, #174E53 0%, #0E6461 100%);
  color: #FFFFFF;
  overflow: visible;
  box-shadow: 14px 0 38px rgba(23, 78, 83, 0.16);
}

.sidebar-header {
  min-height: 92px;
  padding: 14px 18px 12px;
  border-bottom-color: rgba(255, 255, 255, 0.10);
  background: transparent;
}

.sidebar .brand {
  gap: 11px;
}

.sidebar .brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.22));
}

.sidebar .brand-name {
  color: #FFFFFF;
  font-size: 21px;
  font-weight: 900;
}

.sidebar .brand-system {
  color: rgba(255, 255, 255, 0.64);
  font-size: 10px;
  letter-spacing: .06em;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.nav {
  padding: 14px 12px 20px;
  overflow-y: auto;
  overflow-x: visible;
}

.nav-section {
  margin-bottom: 16px;
}

.nav-section summary {
  min-height: 28px;
  padding: 8px 12px 6px;
  /* 0.52 media ~3.8:1 contra o fundo escuro da sidebar (abaixo do 4.5:1 do
     WCAG AA para texto normal) — títulos de seção ficavam quase invisíveis. */
  color: rgba(255, 255, 255, 0.8);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-section-chevron {
  color: rgba(255, 255, 255, 0.6);
}

.nav-section[open] .nav-items {
  animation: navGroupIn 160ms ease both;
}

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

.nav-items {
  gap: 5px;
}

.nav-button {
  position: relative;
  min-height: 42px;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 12px 7px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.80);
  transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease, border-color 200ms ease, transform 120ms ease;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: rgba(255, 255, 255, 0.96);
}

.nav-button:active {
  transform: scale(0.985);
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: inset 4px 0 0 #8AC4AE, 0 10px 22px rgba(0, 0, 0, 0.12);
}

.nav-button.active .nav-label {
  color: #FFFFFF;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.80);
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.nav-button.active .nav-icon {
  color: #FFFFFF;
}

.nav-label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 800;
}

.app-shell.collapsed .sidebar {
  overflow: visible;
}

.app-shell.collapsed .sidebar-header {
  padding-inline: 14px;
}

.app-shell.collapsed .nav {
  padding-inline: 12px;
  overflow: visible;
}

.app-shell.collapsed .nav-section {
  margin-bottom: 18px;
}

.app-shell.collapsed .nav-section summary {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.collapsed .nav-section summary::before {
  content: "";
  width: 22px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}

.app-shell.collapsed .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 8px;
}

.app-shell.collapsed .nav-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  background: #174E53;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(23, 78, 83, 0.20);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-shell.collapsed .nav-button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.button.primary,
.btn-primary {
  background: #174E53;
  border-color: #174E53;
  color: #FFFFFF;
  box-shadow: 0 10px 22px rgba(8, 111, 107, 0.18);
}

.button.primary:hover,
.btn-primary:hover:not(:disabled) {
  background: #0E6461;
  border-color: #0E6461;
  box-shadow: 0 12px 24px rgba(8, 111, 107, 0.20);
}

.profile-button,
.metric-card,
.dashboard-empty,
.data-empty,
.kpi,
.lot-card {
  background-image: none;
}

/* Product polish: richer accents and less spreadsheet feel */
.profile-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--primary);
  background: var(--background-muted);
  border: none;
  font-size: 11.5px;
  font-weight: 700;
  flex: 0 0 auto;
}

.profile-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar.large {
  width: 96px;
  height: 96px;
  font-size: 28px;
  border-width: 3px;
  box-shadow: 0 16px 36px rgba(23, 78, 83, 0.18);
}

.profile-editor {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-photo-preview {
  display: grid;
  justify-items: center;
  padding-top: 4px;
}

.profile-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-editor-fields .full {
  grid-column: 1 / -1;
}

/* Cor do card vem do significado (tone success/warning/error/info em
   .metric-icon), não da posição — ver reescrita do Dashboard (docs/frontend.md). */

.table-panel {
  background: #FFFFFF;
  border: 1px solid rgba(23, 78, 83, 0.10);
}

.table-scroll {
  padding: 10px;
}

table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

thead th {
  background: transparent;
  border-bottom: 0;
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 12px;
}

tbody tr {
  background: #FFFFFF;
  box-shadow: 0 8px 22px rgba(23, 78, 83, 0.07);
}

tbody tr:hover {
  background: #F7FBF9;
  box-shadow: 0 12px 26px rgba(23, 78, 83, 0.10);
}

tbody td {
  border-top: 1px solid rgba(23, 78, 83, 0.08);
  border-bottom: 1px solid rgba(23, 78, 83, 0.08);
  padding: 13px 12px;
}

tbody td:first-child {
  border-left: 1px solid rgba(23, 78, 83, 0.08);
  border-radius: 8px 0 0 8px;
}

tbody td:last-child {
  border-right: 1px solid rgba(23, 78, 83, 0.08);
  border-radius: 0 8px 8px 0;
}

.status-chip.warning {
  background: rgba(242, 161, 84, 0.18);
  color: #8A5A00;
}

.status-chip.error {
  background: rgba(231, 111, 81, 0.13);
  color: #B84025;
}

.status-chip.info {
  background: rgba(47, 128, 237, 0.12);
  color: #1D5FB8;
}

.chart-panel,
.settings-panel,
.report-panel,
.detail-panel {
  box-shadow: 0 16px 38px rgba(23, 78, 83, 0.09);
}

@media (max-width: 980px) {
  .content {
    padding: 18px;
  }

  .topbar {
    box-shadow: none;
  }

  .weight-kpis,
  .analytics-grid.compact {
    grid-template-columns: 1fr;
  }

  .profile-copy {
    display: none;
  }

  .profile-editor,
  .profile-editor-fields {
    grid-template-columns: 1fr;
  }

  .profile-photo-preview {
    justify-items: start;
  }
}

/* ==========================================================================
   Módulo Leite (Dairy) — DAIRY-F1
   Escopo próprio, isolado sob `.dairy-*`; reaproveita tokens/`.field`/
   `.button`/`.modal`/`.status-chip`/`.empty-state` já existentes, nunca
   redefine estilo global. Responsivo 360px→desktop; tabelas herdam a
   conversão para cards de `@media (max-width: 640px) table` já global.
   ========================================================================== */

.dairy-module {
  display: grid;
  gap: 16px;
}

.dairy-module-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dairy-module-farm {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.dairy-module-body {
  display: grid;
  gap: 16px;
}

.dairy-section-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.dairy-section-tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dairy-section-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dairy-section-tab:hover:not(.active) {
  border-color: var(--primary-light);
  color: var(--primary);
}

.dairy-subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.dairy-subtab {
  flex: 0 0 auto;
  padding: 8px 14px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.dairy-subtab.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

.dairy-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.dairy-toolbar > * {
  min-width: 0;
}

.dairy-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.dairy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dairy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dairy-card-body {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.dairy-card-body div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.dairy-card-body dt {
  color: var(--text-secondary);
}

.dairy-card-body dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.dairy-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dairy-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dairy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dairy-table th,
.dairy-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dairy-table tbody tr:last-child td {
  border-bottom: none;
}

.dairy-quarter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dairy-quarter-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--background);
}

.dairy-quarter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.dairy-quarter-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 8px;
}

/* Variante seleção (mastite: marcar quartos afetados, sem sub-campos de
   amostra/escore do CMT) — mesma grade AD/AE/PD/PE, cada célula é um botão
   de alternância inteiro clicável, nunca só a caixa minúscula do checkbox. */
.dairy-quarter-selector-cell {
  grid-template-columns: auto auto 1fr;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dairy-quarter-selector-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.dairy-quarter-selector-cell:has(input:checked) {
  background: var(--accent);
  border-color: var(--secondary);
}

.dairy-quarter-selector-cell .dairy-quarter-label {
  margin-left: 0;
}

.dairy-animal-picker {
  position: relative;
}

.dairy-animal-picker-search {
  margin-bottom: 6px;
}

.dairy-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-height: 36px;
  cursor: pointer;
}

.dairy-checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.dairy-blocker-list {
  margin: 0;
  padding-left: 20px;
  color: var(--error);
  font-size: 13px;
  display: grid;
  gap: 4px;
}

.dairy-note {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0;
}

/* Estado vazio com tom de erro — mesma base de `.empty-state`, usado por
   `dairyErrorState()`. Texto sempre explica o problema; nunca só cor. */
.empty-state.error {
  color: var(--error);
}

.empty-state.error p {
  font-weight: 600;
}

/* Foco visível — reforça acessibilidade de teclado dentro do módulo Dairy
   sem alterar o comportamento global de foco do resto do app. */
.dairy-module :focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .dairy-card-grid {
    grid-template-columns: 1fr;
  }

  .dairy-quarter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .dairy-module-context {
    flex-direction: column;
    align-items: flex-start;
  }

  .dairy-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dairy-toolbar > * {
    width: 100%;
  }

  .dairy-quarter-grid {
    grid-template-columns: 1fr;
  }

  .dairy-card-body div {
    flex-direction: column;
    gap: 2px;
  }

  .dairy-card-body dd {
    text-align: left;
  }
}

/* CONTRAST-VISUAL-C2 — leitura mais nítida e cores mais vivas, preservando
   a identidade verde da AcomGest. Este bloco fica após os estilos premium
   para ser a fonte final dos estados da navegação. */
.sidebar,
.mobile-drawer {
  background: linear-gradient(180deg, #083F45 0%, #006F68 100%);
  box-shadow: 16px 0 42px rgba(4, 45, 48, 0.24);
}

.sidebar .brand-system,
.mobile-drawer-header .brand-system {
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

.nav-section summary {
  color: rgba(255, 255, 255, 0.92);
  font-size: 10.5px;
  letter-spacing: .09em;
}

.nav-section-chevron { color: rgba(255, 255, 255, 0.84); }

.nav-button,
.nav-label { color: #F4FFFB; }

.nav-label {
  font-weight: 750;
  letter-spacing: .005em;
  text-shadow: 0 1px 1px rgba(0, 24, 25, 0.18);
}

.nav-icon { color: #E9FFF8; }

.nav-button:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

.nav-button:hover .nav-icon,
.nav-button:hover .nav-label { color: #FFFFFF; }

.nav-button.active {
  background: #F5FFFB;
  color: #07545A;
  border-color: #FFFFFF;
  box-shadow: inset 4px 0 0 #19B88E, 0 9px 24px rgba(0, 31, 33, 0.25);
}

.nav-button.active .nav-label,
.nav-button.active .nav-icon {
  color: #07545A;
  text-shadow: none;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.30);
  color: #FFFFFF;
}

.sidebar-toggle:hover {
  background: #FFFFFF;
  color: #07545A;
}

.topbar {
  background: rgba(255, 255, 255, 0.97);
  border-bottom-color: #BDD5CB;
}

.panel-title h2,
.panel-title h3,
.topbar-title h1,
.metric-value,
th,
label { color: var(--text-primary); }

.panel-title p,
.metric-meta,
.field-hint,
.topbar-title p,
.empty-state { color: var(--text-secondary); }

.button.primary {
  background: #087A72;
  border-color: #087A72;
  color: #FFFFFF;
}

.button.primary:hover:not(:disabled) {
  background: #05635E;
  border-color: #05635E;
}

.button.secondary {
  border-color: #8DB8AA;
  color: #075A5D;
  background: #F7FFFC;
}

.button.secondary:hover:not(:disabled) {
  border-color: #087A72;
  background: #E5F6F0;
}

.status-chip.success { color: #056B30; background: #D9F7E4; }
.status-chip.warning { color: #784400; background: #FFE8B8; }
.status-chip.error { color: #A30E25; background: #FFDDE3; }
.status-chip.info { color: #104EA8; background: #DCEAFF; }

:where(button, input, select, textarea, summary, [tabindex="0"]):focus-visible {
  outline: 3px solid #F0A51A;
  outline-offset: 2px;
}

.mobile-tab {
  color: var(--text-secondary);
  font-weight: 800;
}

.mobile-tab.active { color: #006F68; }

/* COLOR-SYSTEM-C3 — acentos distribuídos pelo produto. O verde-petróleo
   continua dominante; azul, violeta, âmbar, coral e lima entram como apoio
   visual em componentes, sem alterar o significado dos estados. */
.dashboard-view .metric-card {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--accent);
}

.dashboard-view .metric-card::after {
  content: "";
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  right: -48px;
  bottom: -54px;
  background: rgba(87, 201, 165, 0.10);
  pointer-events: none;
}

.dashboard-view .metric-card:has(.metric-icon.success) {
  border-top-color: var(--success);
  background: linear-gradient(145deg, #FFFFFF 55%, #EAF9EF 100%);
}

.dashboard-view .metric-card:has(.metric-icon.warning) {
  border-top-color: var(--accent-amber);
  background: linear-gradient(145deg, #FFFFFF 55%, #FFF6E4 100%);
}

.dashboard-view .metric-card:has(.metric-icon.error) {
  border-top-color: var(--accent-coral);
  background: linear-gradient(145deg, #FFFFFF 55%, #FFF0ED 100%);
}

.dashboard-view .metric-card:has(.metric-icon.info) {
  border-top-color: var(--accent-blue);
  background: linear-gradient(145deg, #FFFFFF 55%, #EDF4FF 100%);
}

.dashboard-view .metric-card:has(.metric-icon.secondary) {
  border-top-color: var(--accent-violet);
  background: linear-gradient(145deg, #FFFFFF 55%, #F3F0FF 100%);
}

.metric-icon.success { background: #DDF7E7; color: #08743A; }
.metric-icon.warning { background: #FFE9BE; color: #8A5000; }
.metric-icon.error { background: #FFE0E2; color: #B5162E; }
.metric-icon.info { background: #DDEBFF; color: #1458B8; }
.metric-icon.secondary { background: #EAE4FF; color: #6044B7; }

.dashboard-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-secondary);
}

.dashboard-section-title::before {
  content: "";
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-violet));
}

.dashboard-section-title:nth-of-type(even)::before {
  background: linear-gradient(180deg, var(--accent-amber), var(--accent-coral));
}

.dashboard-view .chart-panel {
  border-top: 3px solid var(--accent-blue);
}

.dashboard-view .chart-panel:nth-child(even) {
  border-top-color: var(--accent-violet);
}

.dashboard-view .table-panel {
  border-top: 3px solid var(--accent-lime);
}

.dashboard-view .table-panel:nth-child(even) {
  border-top-color: var(--accent-coral);
}

.dashboard-view .panel-toolbar {
  background: linear-gradient(90deg, rgba(39, 116, 230, 0.055), transparent 62%);
  border-radius: calc(var(--radius-lg) - 2px) calc(var(--radius-lg) - 2px) 0 0;
}

.dashboard-alerts-panel .panel-toolbar {
  background: linear-gradient(90deg, rgba(232, 88, 62, 0.07), transparent 62%);
}

.daily-summary {
  background:
    radial-gradient(circle at 92% 12%, rgba(240, 154, 24, 0.34), transparent 25%),
    radial-gradient(circle at 76% 115%, rgba(113, 87, 217, 0.30), transparent 34%),
    linear-gradient(135deg, #0F4F55 0%, #007F78 62%, #168F72 100%);
}

.daily-summary-list .dot { background: #83E4C0; }
.daily-summary-list .dot.warning { background: #FFD166; }
.daily-summary-list .dot.error { background: #FF8C82; }

.kpi {
  border-left: 4px solid var(--accent-blue);
  background: linear-gradient(120deg, #FFFFFF, #F2F7FF);
}

.kpi:nth-child(4n + 2) {
  border-left-color: var(--accent-violet);
  background: linear-gradient(120deg, #FFFFFF, #F5F2FF);
}

.kpi:nth-child(4n + 3) {
  border-left-color: var(--accent-amber);
  background: linear-gradient(120deg, #FFFFFF, #FFF7E8);
}

.kpi:nth-child(4n) {
  border-left-color: var(--accent-lime);
  background: linear-gradient(120deg, #FFFFFF, #F3F9E9);
}

thead th {
  color: var(--text-secondary);
  background: #EAF3FA;
}

thead th:first-child { border-radius: 8px 0 0 8px; }
thead th:last-child { border-radius: 0 8px 8px 0; }

tbody tr:nth-child(even) { background: #F9FBFF; }
tbody tr:hover { background: #EEF7FF; }

.module-insight-list > :nth-child(4n + 1) { border-left: 4px solid var(--accent-blue); }
.module-insight-list > :nth-child(4n + 2) { border-left: 4px solid var(--accent-violet); }
.module-insight-list > :nth-child(4n + 3) { border-left: 4px solid var(--accent-amber); }
.module-insight-list > :nth-child(4n) { border-left: 4px solid var(--accent-lime); }

.lot-card,
.protocol-card,
.pending-user-card,
.invite-card,
.dairy-card,
.animal-picker-card {
  border-top: 3px solid var(--accent);
}

.lot-card:nth-child(4n + 2),
.protocol-card:nth-child(4n + 2),
.dairy-card:nth-child(4n + 2),
.animal-picker-card:nth-child(4n + 2) { border-top-color: var(--accent-blue); }

.lot-card:nth-child(4n + 3),
.protocol-card:nth-child(4n + 3),
.dairy-card:nth-child(4n + 3),
.animal-picker-card:nth-child(4n + 3) { border-top-color: var(--accent-violet); }

.lot-card:nth-child(4n),
.protocol-card:nth-child(4n),
.dairy-card:nth-child(4n),
.animal-picker-card:nth-child(4n) { border-top-color: var(--accent-amber); }

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(39, 116, 230, 0.14);
}

.pagination {
  border-top: 1px solid #DCE8F2;
  background: linear-gradient(90deg, #F5FAFF, #FAF7FF);
}

@media (max-width: 640px) {
  .dashboard-view .metric-card::after { width: 68px; height: 68px; }
  .dashboard-view .panel-toolbar { background: transparent; }
}

/* DAIRY-VISUAL-C2 — camada visual do módulo Leite. Somente apresentação:
   nenhuma regra, permissão, dado ou fluxo operacional é alterado. */
.dairy-module {
  gap: 18px;
  --dairy-blue: #2878C8;
  --dairy-sky: #EAF5FF;
  --dairy-violet: #7359C6;
  --dairy-coral: #DC654C;
  --dairy-gold: #D88A12;
}

.dairy-module-hero {
  position: relative;
  min-height: 154px;
  padding: 25px 28px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 204, 102, 0.36), transparent 27%),
    radial-gradient(circle at 70% 130%, rgba(115, 89, 198, 0.35), transparent 42%),
    linear-gradient(125deg, #083F45 0%, #087A72 60%, #1A9C7D 100%);
  box-shadow: 0 18px 42px rgba(8, 79, 85, 0.22);
}

.dairy-module-hero::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -50px;
  top: -72px;
  border: 28px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.dairy-module-hero-copy { position: relative; z-index: 1; max-width: 680px; }
.dairy-module-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #BAF5DF;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.dairy-module-hero h2 {
  margin: 0;
  color: #FFFFFF;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.1;
}

.dairy-module-hero p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
}

.dairy-module-context { position: relative; z-index: 1; flex: 0 0 auto; }
.dairy-module-farm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 13px;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  font-weight: 800;
}

.dairy-module-farm::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFD166;
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.18);
}

.dairy-section-nav {
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 8px 24px rgba(16, 47, 51, 0.06);
}

.dairy-section-tab {
  position: relative;
  min-height: 44px;
  padding: 10px 17px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 800;
}

.dairy-section-tab::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.dairy-section-tab[data-dairy-section="production"]::before { background: var(--dairy-blue); }
.dairy-section-tab[data-dairy-section="clinical"]::before { background: var(--dairy-coral); }
.dairy-section-tab[data-dairy-section="treatment"]::before { background: var(--dairy-violet); }
.dairy-section-tab[data-dairy-section="withdrawal"]::before { background: var(--dairy-gold); }
.dairy-section-tab[data-dairy-section="commercial"]::before { background: var(--success); }

.dairy-section-tab.active {
  color: #FFFFFF;
  border-color: #087A72;
  background: linear-gradient(135deg, #0F4F55, #087A72);
  box-shadow: 0 7px 17px rgba(8, 122, 114, 0.22);
}

.dairy-section-tab.active::before {
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14);
}

.dairy-section-tab:hover:not(.active) {
  color: #075A5D;
  border-color: #B8D9CE;
  background: #F0F9F6;
}

.dairy-module-body {
  gap: 18px;
  min-width: 0;
}

.dairy-operational-overview {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #c7ded7;
  border-radius: 16px;
  background:
    radial-gradient(circle at 96% 0%, rgba(42, 132, 198, .12), transparent 28%),
    linear-gradient(140deg, #ffffff, #f1faf7);
  box-shadow: 0 12px 30px rgba(16, 78, 78, .08);
}

.dairy-overview-heading span {
  color: #087a72;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.dairy-overview-heading h3 {
  margin: 3px 0 4px;
  color: var(--text-primary);
  font-size: 18px;
}

.dairy-overview-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.dairy-overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dairy-overview-metric {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 3px;
  min-height: 82px;
  align-content: center;
  padding: 13px 15px;
  border: 1px solid #d4e5e0;
  border-left: 4px solid #2878c8;
  border-radius: 13px;
  background: #fff;
}

.dairy-overview-metric::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 58px;
  right: -24px;
  top: -24px;
  border-radius: 50%;
  background: currentColor;
  opacity: .08;
}

.dairy-overview-metric strong { color: var(--text-primary); font-size: 24px; line-height: 1; }
.dairy-overview-metric span { color: var(--text-secondary); font-size: 11.5px; font-weight: 750; }
.dairy-overview-metric.blue { color: #2878c8; border-left-color: #2878c8; }
.dairy-overview-metric.violet { color: #7359c6; border-left-color: #7359c6; }
.dairy-overview-metric.warning { color: #d38a13; border-left-color: #e6a129; }
.dairy-overview-metric.error { color: #d85a4a; border-left-color: #df6452; }
.dairy-overview-metric.success { color: #159276; border-left-color: #159276; }

.dairy-overview-insights { display: grid; gap: 9px; }
.dairy-overview-insight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid #d9e6e2;
  border-radius: 12px;
  background: #fff;
}
.dairy-overview-insight-marker { width: 9px; height: 34px; border-radius: 999px; background: #2878c8; }
.dairy-overview-insight.warning .dairy-overview-insight-marker { background: #e6a129; }
.dairy-overview-insight.error .dairy-overview-insight-marker { background: #df6452; }
.dairy-overview-insight.success .dairy-overview-insight-marker { background: #159276; }
.dairy-overview-insight strong { color: var(--text-primary); font-size: 13px; }
.dairy-overview-insight p { margin: 3px 0 0; color: var(--text-secondary); font-size: 11.5px; line-height: 1.45; }
.dairy-overview-insight .button { white-space: nowrap; }

.dairy-overview-clear {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #bde5d6;
  border-radius: 12px;
  color: #176f57;
  background: #eaf9f2;
}
.dairy-overview-clear strong { font-size: 12.5px; }
.dairy-overview-clear span { color: var(--text-secondary); font-size: 11.5px; }

.dairy-toolbar {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(100deg, #F5FAFF 0%, #F8F6FF 48%, #F3FAF6 100%);
  box-shadow: 0 7px 20px rgba(16, 47, 51, 0.05);
}

.dairy-toolbar select,
.dairy-toolbar input {
  min-height: 42px;
  border-color: #BBD2C9;
  background: #FFFFFF;
}

.dairy-subtabs {
  padding: 4px;
  border-radius: 999px;
  background: #E8F1F6;
}

.dairy-subtab {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 800;
}

.dairy-subtab.active {
  color: #FFFFFF;
  background: var(--dairy-blue);
  border-color: var(--dairy-blue);
  box-shadow: 0 5px 14px rgba(40, 120, 200, 0.22);
}

.dairy-card-grid { gap: 16px; }
.dairy-card {
  position: relative;
  padding: 17px 18px;
  gap: 13px;
  border: 1px solid #D6E5DF;
  border-top: 4px solid var(--accent);
  box-shadow: 0 10px 28px rgba(16, 47, 51, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dairy-card:hover {
  transform: translateY(-2px);
  border-color: #AFD1C5;
  box-shadow: 0 15px 34px rgba(16, 47, 51, 0.12);
}

.dairy-card:nth-child(5n + 1) { border-top-color: var(--dairy-blue); }
.dairy-card:nth-child(5n + 2) { border-top-color: var(--dairy-violet); }
.dairy-card:nth-child(5n + 3) { border-top-color: var(--dairy-coral); }
.dairy-card:nth-child(5n + 4) { border-top-color: var(--dairy-gold); }
.dairy-card:nth-child(5n) { border-top-color: var(--success); }

.dairy-card-header {
  min-height: 32px;
  padding-bottom: 10px;
  border-bottom: 1px solid #E1EBE7;
}

.dairy-card-header strong {
  color: var(--text-primary);
  font-size: 15px;
}

.dairy-card-body { gap: 0; }
.dairy-card-body div {
  min-height: 34px;
  padding: 7px 0;
  align-items: center;
  border-bottom: 1px dashed #DFE9E5;
}

.dairy-card-body div:last-child { border-bottom: 0; }
.dairy-card-body dt { color: var(--text-secondary); font-weight: 650; }
.dairy-card-body dd { color: var(--text-primary); font-weight: 800; }

.dairy-card-actions {
  margin: 2px -2px -2px;
  padding-top: 11px;
  border-top: 1px solid #E5EDEA;
}

.dairy-card-actions .button { min-height: 36px; }

.dairy-table-wrap {
  border-color: #C9DDD5;
  border-radius: 13px;
  background: #FFFFFF;
  box-shadow: 0 10px 28px rgba(16, 47, 51, 0.07);
}

.dairy-table { border-collapse: separate; border-spacing: 0; }
.dairy-table th {
  padding: 12px 14px;
  color: var(--text-primary);
  background: linear-gradient(90deg, #E8F4FA, #F1EEFF);
  border-bottom: 2px solid #BFD8D8;
  font-size: 11px;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.dairy-table td { padding: 12px 14px; }
.dairy-table tbody tr:nth-child(even) td { background: #F8FBFD; }
.dairy-table tbody tr:hover td { background: #EDF8F5; }

.dairy-quarter-grid {
  gap: 14px;
  padding: 15px;
  border-radius: 15px;
  background: linear-gradient(145deg, #F1F8F5, #F3F6FC);
}

.dairy-quarter-cell {
  min-height: 88px;
  border-color: #C5DAD2;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 5px 15px rgba(16, 47, 51, 0.05);
}

.dairy-quarter-cell:nth-child(2) .dairy-quarter-badge { background: var(--dairy-blue); }
.dairy-quarter-cell:nth-child(3) .dairy-quarter-badge { background: var(--dairy-violet); }
.dairy-quarter-cell:nth-child(4) .dairy-quarter-badge { background: var(--dairy-coral); }

.dairy-quarter-selector-cell:hover { border-color: var(--secondary); background: #F0FAF6; }
.dairy-quarter-selector-cell:has(input:checked) {
  border-color: #087A72;
  background: #DDF6ED;
  box-shadow: 0 0 0 3px rgba(8, 122, 114, 0.13);
}

.dairy-note {
  position: relative;
  padding: 12px 14px 12px 17px;
  color: var(--text-secondary);
  border-color: #BDD9EA;
  border-left: 4px solid var(--dairy-blue);
  background: #EFF8FF;
  line-height: 1.45;
}

.dairy-blocker-list {
  padding: 13px 15px 13px 34px;
  border: 1px solid #F0B9B3;
  border-left: 4px solid var(--dairy-coral);
  border-radius: 10px;
  background: #FFF1EF;
}

.dairy-module .empty-state {
  min-height: 190px;
  display: grid;
  place-content: center;
  gap: 12px;
  border: 1px dashed #B9D2C9;
  border-radius: 15px;
  background: linear-gradient(145deg, #FFFFFF, #F2F8F5);
}

.dairy-module :focus-visible {
  outline: 3px solid #F0A51A;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .dairy-module-hero { min-height: 140px; padding: 22px; }
  .dairy-section-nav { border-radius: 12px; }
}

@media (max-width: 640px) {
  .dairy-module { gap: 14px; }
  .dairy-module-hero {
    min-height: 0;
    padding: 20px;
    align-items: flex-start;
    flex-direction: column;
  }
  .dairy-module-hero p { font-size: 13px; }
  .dairy-module-context { width: 100%; }
  .dairy-module-farm { max-width: 100%; }
  .dairy-section-nav { margin-inline: -2px; padding: 5px; }
  .dairy-section-tab { min-height: 42px; padding: 9px 13px; }
  .dairy-toolbar { padding: 12px; }
  .dairy-card { padding: 15px; }
  .dairy-card:hover { transform: none; }
  .dairy-card-actions .button { flex: 1 1 calc(50% - 8px); }
  .dairy-table-wrap { box-shadow: none; }
  .dairy-operational-overview { padding: 14px; }
  .dairy-overview-metrics { grid-template-columns: 1fr; }
  .dairy-overview-metric { min-height: 66px; }
  .dairy-overview-insight { grid-template-columns: auto minmax(0, 1fr); }
  .dairy-overview-insight .button { grid-column: 2; justify-self: start; white-space: normal; }
}

/* DAIRY-FILTERS-C3 — filtros de Animal/Situação como controles reconhecíveis,
   com rótulo persistente e sem depender apenas do texto da opção selecionada. */
.dairy-filter-group {
  flex: 1 1 440px;
  display: grid;
  grid-template-columns: minmax(210px, 1.3fr) minmax(190px, .9fr);
  gap: 10px;
  min-width: 0;
}

.dairy-filter-group-single {
  flex: 1 1 260px;
  grid-template-columns: minmax(220px, 360px);
}

.dairy-filter-control {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 38px 8px 10px;
  color: var(--text-secondary);
  border: 1px solid #B9D1C8;
  border-radius: 11px;
  background: #FFFFFF;
  box-shadow: 0 4px 13px rgba(16, 47, 51, 0.055);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.dairy-filter-control::before {
  content: "";
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background-color: #E5F2FF;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

.dairy-filter-animal::before {
  background-color: #E5F2FF;
  background-image: url("../assets/cow-silhouette.svg");
  background-size: 22px 22px;
}

.dairy-filter-status::before {
  background-color: #EEE9FF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237359C6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 2.5 2.5L16 9'/%3E%3C/svg%3E");
}

.dairy-filter-case::before {
  background-color: #FFF0ED;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23DC654C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3h8v4H8zM6 7h12v14H6z'/%3E%3Cpath d='M9 12h6M12 9v6M9 18h6'/%3E%3C/svg%3E");
}

.dairy-filter-control > span {
  grid-column: 2;
  align-self: end;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .065em;
  line-height: 1.1;
  text-transform: uppercase;
}

.dairy-filter-control select,
.dairy-toolbar .dairy-filter-control select {
  grid-column: 2;
  min-width: 0;
  width: 100%;
  min-height: 24px;
  padding: 1px 0;
  appearance: none;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.dairy-filter-control::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid #537078;
  border-bottom: 2px solid #537078;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.dairy-filter-control:hover {
  border-color: #7EB5A4;
  background: #FBFFFD;
}

.dairy-filter-control:focus-within {
  border-color: var(--dairy-blue);
  box-shadow: 0 0 0 3px rgba(40, 120, 200, 0.14);
}

@media (max-width: 640px) {
  .dairy-filter-group,
  .dairy-filter-group-single {
    flex-basis: auto;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .dairy-filter-control { width: 100%; }
}

/* MODULES-VISUAL-C4 — linguagem visual compartilhada dos módulos operacionais.
   Mantém o verde da marca, mas distribui azul, violeta, âmbar e coral por
   função para melhorar leitura, hierarquia e reconhecimento das áreas. */
.view > .view-toolbar {
  position: relative;
  padding: 14px;
  border: 1px solid #C8DDD6;
  border-radius: 14px;
  background:
    radial-gradient(circle at 8% 0%, rgba(44, 134, 205, .10), transparent 32%),
    linear-gradient(135deg, #FFFFFF 0%, #F3FAF7 100%);
  box-shadow: 0 10px 28px rgba(16, 47, 51, .07);
}

.view > .view-toolbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, #2584C5, #159276);
}

.view > .view-toolbar .toolbar-left { flex: 1 1 520px; }

.view > .view-toolbar .search-input {
  flex: 1 1 280px;
  width: auto;
  min-height: 44px;
  padding-left: 42px;
  border-color: #B8D1CA;
  border-radius: 11px;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E6E78' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
  background-position: 14px center;
  background-repeat: no-repeat;
  background-size: 18px;
  box-shadow: 0 4px 14px rgba(16, 47, 51, .05);
}

.view > .view-toolbar .button { min-height: 44px; border-radius: 10px; }

.view > .table-panel,
.view > .detail-grid > .table-panel {
  border-color: #C8DDD6;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(16, 47, 51, .08);
}

.view > .table-panel::before,
.view > .detail-grid > .table-panel::before {
  height: 4px;
  background: linear-gradient(90deg, #159276 0 34%, #2584C5 34% 67%, #7859C7 67%);
}

.view .table-scroll { padding: 12px; }
.view tbody tr { box-shadow: 0 6px 18px rgba(16, 47, 51, .065); }
.view tbody tr:hover { background: #F0FAF6; transform: translateY(-1px); }
.view tbody td { border-color: #D9E7E2; }

.view .pagination {
  min-height: 58px;
  padding: 12px 16px;
  border-top: 1px solid #DDE9E5;
  color: var(--text-secondary);
  background: linear-gradient(90deg, #F2FAF7, #F2F7FC);
  font-weight: 750;
}

.view .empty-state {
  margin: 12px;
  min-height: 150px;
  display: grid;
  place-content: center;
  border: 1px dashed #9FC8BA;
  border-radius: 12px;
  color: var(--text-secondary);
  background: linear-gradient(145deg, #FFFFFF, #EFF8F5);
}

.settings-grid,
.reports-grid { gap: 18px; }

.settings-panel,
.report-panel,
.detail-panel {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-color: #CBDDD7;
  border-radius: 14px;
  background: linear-gradient(145deg, #FFFFFF, #F6FAF8);
}

.settings-panel::before,
.report-panel::before,
.detail-panel::before {
  height: 5px;
  background: #159276;
}

.settings-panel:nth-child(2n)::before,
.report-panel:nth-child(2n)::before { background: #2584C5; }
.settings-panel:nth-child(3n)::before,
.report-panel:nth-child(3n)::before { background: #7859C7; }
.settings-panel:nth-child(4n)::before,
.report-panel:nth-child(4n)::before { background: #E38A28; }

.panel-title h2 { color: var(--text-primary); letter-spacing: -.015em; }
.panel-title p { color: var(--text-secondary); line-height: 1.45; }

.modal {
  border: 1px solid #BFD7CF;
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(10, 43, 48, .24);
}

.modal-header {
  background:
    radial-gradient(circle at 92% 0%, rgba(37, 132, 197, .14), transparent 38%),
    linear-gradient(135deg, #EFF9F5, #F4F2FF);
  border-bottom-color: #CFE0DA;
}

.modal-footer {
  background: #F7FAF9;
  border-top-color: #D6E4DF;
}

.modal .field input:not([type="checkbox"]):not([type="radio"]),
.modal .field select,
.modal .field textarea,
.settings-panel .field input:not([type="checkbox"]):not([type="radio"]),
.settings-panel .field select,
.settings-panel .field textarea {
  border-color: #B9D0C8;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: inset 0 1px 2px rgba(16, 47, 51, .035);
}

.modal .field label,
.settings-panel .field label { color: var(--text-primary); font-weight: 850; }

.view :focus-visible,
.modal :focus-visible {
  outline: 3px solid rgba(240, 165, 26, .72);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .view > .view-toolbar { padding: 12px; }
  .view > .view-toolbar .toolbar-left,
  .view > .view-toolbar .toolbar-right,
  .view > .view-toolbar .search-input { width: 100%; }
  .view > .view-toolbar .toolbar-right .button { flex: 1 1 calc(50% - 8px); }
  .settings-panel,
  .report-panel,
  .detail-panel { padding: 17px; }
  .view .pagination { align-items: stretch; flex-direction: column; }
  .view .pagination .toolbar-right { width: 100%; }
  .view .pagination .button { flex: 1; }
}

/* DAIRY-MODAL-SCROLL-C5 — os formulários do Leite ficam dentro do modal.
   O form precisa receber a linha flexível da grade para que apenas o corpo
   role, preservando título e ações sempre acessíveis. */
.dairy-modal {
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  min-height: 0;
}

.dairy-modal > form {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.dairy-modal > form > .modal-body,
.dairy-modal > .modal-body {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.dairy-modal > form > .modal-footer { position: relative; z-index: 1; }

@media (max-width: 640px) {
  .modal-backdrop:has(.dairy-modal) {
    padding: 8px;
    align-items: center;
  }

  .dairy-modal,
  .dairy-modal.modal-lg {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .dairy-modal .modal-header,
  .dairy-modal .modal-footer { padding: 13px 14px; }
  .dairy-modal .modal-body { padding: 14px; }
  .dairy-modal .modal-footer { flex-wrap: wrap; }
  .dairy-modal .modal-footer .button { flex: 1 1 auto; }
}

/* TOPBAR-VISUAL-C6 — controles operacionais agrupados e perfil legível. */
.topbar {
  min-height: var(--topbar-height);
  height: auto;
  padding-inline: 22px;
  background:
    radial-gradient(circle at 72% -80%, rgba(40, 120, 200, .14), transparent 34%),
    rgba(255, 255, 255, .97);
  box-shadow: 0 8px 26px rgba(16, 47, 51, .09);
}

.topbar-actions {
  gap: 8px;
  padding: 6px;
  border: 1px solid #C9DCD5;
  border-radius: 14px;
  background: rgba(244, 249, 247, .92);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 5px 16px rgba(16, 47, 51, .055);
}

.topbar-select {
  min-width: 158px;
  min-height: 44px;
  padding: 8px 34px 8px 40px;
  appearance: none;
  border-color: transparent;
  border-radius: 10px;
  background-color: #FFFFFF;
  background-position: 13px center, calc(100% - 13px) center;
  background-repeat: no-repeat;
  background-size: 18px, 10px;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 3px 10px rgba(16, 47, 51, .06);
}

#farm-filter {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23159276' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 21h18M5 21V9l7-5 7 5v12M9 21v-6h6v6'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23536F75' stroke-width='2'/%3E%3C/svg%3E");
}

#period-filter {
  min-width: 126px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237359C6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23536F75' stroke-width='2'/%3E%3C/svg%3E");
}

.notification-button {
  min-height: 44px;
  padding-inline: 13px;
  border: 1px solid #E8C68C;
  border-radius: 10px;
  color: #8B5A08;
  background: #FFF8E8;
  font-size: 12px;
  font-weight: 850;
}

.notification-button .kbd-icon { background: #FFE6B6; color: #B16A00; }
.notification-button.has-alerts { border-color: #E59D93; background: #FFF0ED; color: #B83E2B; }
.notification-button .badge { right: -4px; top: -7px; min-width: 23px; box-shadow: 0 0 0 3px #FFFFFF; }

.profile-button {
  min-height: 48px;
  padding: 5px 10px 5px 6px;
  border: 1px solid #BFD8CF;
  border-radius: 11px;
  background: #FFFFFF;
  box-shadow: 0 4px 13px rgba(16, 47, 51, .07);
}

.profile-button::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 3px 3px 6px;
  border-right: 2px solid #577078;
  border-bottom: 2px solid #577078;
  transform: rotate(45deg);
}

.profile-button .profile-avatar {
  width: 36px;
  height: 36px;
  color: #FFFFFF;
  background: linear-gradient(135deg, #159276, #2878C8);
  box-shadow: 0 4px 10px rgba(21, 146, 118, .22);
  font-size: 12px;
  font-weight: 900;
}

.profile-copy { gap: 3px; }
.profile-copy strong { max-width: 175px; color: var(--text-primary); font-size: 12.5px; }
.profile-copy small { color: var(--text-secondary); font-size: 10px; letter-spacing: .025em; text-transform: uppercase; }

.dairy-button-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.dairy-button-icon svg { width: 18px; height: 18px; display: block; }
.dairy-modal .icon-only .dairy-button-icon { width: 20px; height: 20px; }
.dairy-modal .icon-only .dairy-button-icon svg { width: 20px; height: 20px; }

@media (max-width: 1180px) {
  .topbar-select { min-width: 128px; }
  #period-filter { min-width: 116px; }
  .notification-button span:not(.kbd-icon):not(.badge) { display: none; }
}

/* TOPBAR-LAYOUT-C7 — correção estrutural comum a todos os módulos.
   O avatar usa `topbar` como nome de variante; neutralizamos explicitamente
   a colisão com `.topbar` (cabeçalho) para ele nunca herdar a grade da faixa. */
:root { --topbar-height: 80px; }

.profile-avatar.topbar {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  backdrop-filter: none;
}

.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 22px;
  gap: 22px;
  overflow: visible;
}

.topbar-title h1 { font-size: 21px; line-height: 1.15; }
.topbar-title p { margin-top: 4px; font-size: 12px; }

.topbar-actions {
  min-width: 0;
  height: 56px;
  padding: 5px;
  gap: 7px;
  flex-wrap: nowrap;
  border-radius: 13px;
}

.topbar-select,
.notification-button,
.profile-button {
  height: 44px;
  min-height: 44px;
  margin: 0;
  flex: 0 0 auto;
}

#farm-filter { width: 218px; min-width: 218px; }
#period-filter { width: 154px; min-width: 154px; }

.notification-button {
  min-width: 108px;
  justify-content: center;
}

.profile-menu-wrap { height: 44px; flex: 0 0 auto; }

.profile-button {
  width: auto;
  max-width: 245px;
  padding: 4px 9px 4px 5px;
  gap: 9px;
}

.profile-copy { min-width: 0; }
.profile-copy strong { max-width: 145px; }
.profile-copy small { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ícones SVG para ações ainda textuais nos formulários compartilhados dos
   demais módulos. Botões que já possuem SVG não recebem outro ícone. */
.medicine-module { display: grid; gap: 24px; }
.medicine-search-bar { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.medicine-search-bar label { display: block; margin-bottom: 8px; font-weight: 600; }
.medicine-search-controls { display: flex; gap: 10px; }
.medicine-search-controls input { flex: 1; min-width: 0; width: 100%; }
.medicine-search-results { padding: 0 24px; color: var(--muted); font-size: 13px; }
.medicine-detail-modal { width: min(1040px, 96vw); }
.medicine-detail-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.medicine-detail-body { display: flex; flex-direction: column; gap: 22px; }
.medicine-detail-section { border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.medicine-detail-section h3 { margin: 0 0 16px; font-size: 18px; }
.medicine-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.medicine-detail-body dt { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.medicine-detail-body dd { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; white-space: pre-wrap; }
.medicine-detail-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.medicine-detail-heading h4 { font-size: 16px; margin: 0; }
.medicine-label-detail + .medicine-label-detail { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.medicine-label-detail h5 { font-size: 14px; margin: 20px 0 10px; }
.medicine-detail-ingredients { padding: 0; list-style: none; display: grid; gap: 8px; }
.medicine-detail-ingredients li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px; border-radius: 8px; background: #f3f7f5; }
.medicine-withdrawal-grid, .medicine-batch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.medicine-withdrawal-card, .medicine-batch-card { border: 1px solid var(--border); padding: 16px; border-radius: 10px; background: #f8faf9; }
.medicine-withdrawal-card h6 { font-size: 14px; margin: 0 0 12px; }
.medicine-withdrawal-card dl { display: grid; gap: 12px; margin: 0; }
.medicine-batch-grid { margin-top: 20px; }
.medicine-detail-note { padding: 10px 12px; border-radius: 8px; background: #fff4da; font-size: 13px; }
@media (max-width: 600px) {
  .medicine-detail-grid, .medicine-withdrawal-grid, .medicine-batch-grid { grid-template-columns: 1fr; }
  .medicine-detail-section { padding: 14px; }
  .medicine-search-bar { padding: 14px; }
  .medicine-search-controls { flex-wrap: wrap; }
  .medicine-search-controls input { flex-basis: 100%; }
}
.medicine-module-hero, .medicine-catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.medicine-module-hero h2 { margin: 6px 0; font-size: 28px; }
.medicine-module-hero p, .medicine-catalog-toolbar p { margin: 6px 0 0; color: var(--muted); }
.medicine-module-eyebrow { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.medicine-module-farm { font-size: 13px; color: var(--muted); }
.medicine-catalog-panel { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; }
.medicine-catalog-toolbar { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.medicine-catalog-toolbar h3 { margin: 0; font-size: 18px; }
.medicine-product-list, .medicine-presentation-list { list-style: none; padding: 0; margin: 0; }
.medicine-product-row + .medicine-product-row { border-top: 1px solid var(--border); }
.medicine-product-toggle { width: 100%; display: flex; align-items: center; gap: 16px; padding: 22px 24px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.medicine-product-toggle:hover { background: var(--surface-alt, #f5f8f7); }
.medicine-product-heading { display: grid; gap: 5px; flex: 1; min-width: 0; }
.medicine-product-name { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.medicine-product-manufacturer, .medicine-presentation-meta { color: var(--muted); font-size: 13px; }
.medicine-product-badges, .medicine-presentation-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.medicine-product-chevron { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #edf4f2; color: #265d52; font-size: 20px; }
.medicine-presentations { padding: 0 24px 22px; }
.medicine-presentation-list { display: grid; gap: 10px; }
.medicine-presentation-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; background: #f7faf9; border: 1px solid var(--border); border-radius: 12px; }
.medicine-presentation-main { display: grid; gap: 6px; min-width: 0; }
.medicine-presentation-name { font-weight: 600; overflow-wrap: anywhere; }
.medicine-modal > form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; overflow: hidden; max-height: inherit; }
.medicine-modal:has(> form) { grid-template-rows: minmax(0, 1fr); }
.medicine-modal .modal-body { overflow-y: auto; min-height: 0; scrollbar-gutter: stable; overscroll-behavior: contain; }
.medicine-modal .field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.medicine-modal .field { min-width: 0; }
.medicine-modal .modal-header h2 { font-size: 20px; }
.medicine-modal .modal-header .icon-only { flex-shrink: 0; font-size: 24px; }
.iatf-module-tabs { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: #edf3f1; }
.iatf-module-tab { border: 0; border-radius: 8px; padding: 11px 22px; background: transparent; color: #4d6963; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; }
.iatf-module-tab:hover { background: #e0ebe7; }
.iatf-module-tab.active { background: #fff; color: #165d49; box-shadow: 0 2px 6px #12372b14; }
.medicine-product-toggle:focus-visible, .iatf-module-tab:focus-visible { outline: 2px solid #26765f; outline-offset: -3px; }
@media (max-width: 600px) {
  .medicine-catalog-toolbar, .medicine-product-toggle { padding: 16px; }
  .medicine-catalog-toolbar .button { width: 100%; justify-content: center; }
  .medicine-presentations { padding: 0 12px 16px; }
  .medicine-presentation-row { flex-direction: column; align-items: stretch; padding: 14px; }
  .medicine-product-toggle { flex-wrap: wrap; gap: 10px; }
  .medicine-product-badges { order: 3; width: 100%; }
  .medicine-modal .field-row { grid-template-columns: 1fr; }
  .medicine-modal .modal-header h2 { font-size: 17px; }
}

.modal-footer .button:not(:has(.kbd-icon)):not(:has(.dairy-button-icon))::before {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.modal-footer [data-action="close-modal"]:not(:has(.dairy-button-icon))::before,
.modal-footer .button:not(.primary):not(.danger):not(:has(.kbd-icon)):not(:has(.dairy-button-icon))::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234D6970' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3Cpath d='M9 12h10'/%3E%3C/svg%3E");
}

.modal-footer .button.primary:not(:has(.kbd-icon)):not(:has(.dairy-button-icon))::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
}

.modal-footer .button.danger:not(:has(.kbd-icon)):not(:has(.dairy-button-icon))::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B84025' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}


@media (max-width: 1380px) and (min-width: 901px) {
  .topbar { padding-inline: 16px; gap: 14px; }
  .topbar-title p { display: none; }
  #farm-filter { width: 174px; min-width: 174px; }
  #period-filter { width: 132px; min-width: 132px; }
  .notification-button { min-width: 44px; padding-inline: 10px; }
  .notification-button span:not(.kbd-icon):not(.badge) { display: none; }
  .profile-button { max-width: 205px; }
  .profile-copy strong,
  .profile-copy small { max-width: 112px; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 72px; }
  .topbar { height: auto; min-height: 0; padding: 14px 16px; gap: 12px; }
  .topbar-actions {
    width: 100%;
    height: auto;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(130px, .65fr) 44px 48px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  #farm-filter,
  #period-filter { width: 100%; min-width: 0; }
  .notification-button { min-width: 44px; width: 44px; padding: 0; }
  .profile-menu-wrap,
  .profile-button { width: 48px; }
  .profile-button { padding: 5px; justify-content: center; }
  .profile-button::after,
  .profile-copy { display: none; }
}

@media (max-width: 560px) {
  .topbar-actions { grid-template-columns: minmax(0, 1fr) 44px 48px; }
  #period-filter { grid-column: 1 / 2; grid-row: 2; }
  #farm-filter { grid-column: 1 / -1; }
  .notification-button { grid-column: 2; grid-row: 2; }
  .profile-menu-wrap { grid-column: 3; grid-row: 2; }
}

/* DASHBOARD-METRIC-ALIGN-C8 — títulos com descrição longa (como Mortalidade
   acumulada) não podem deslocar o ícone para baixo ao centralizar o bloco. */
.dashboard-view .metric-head,
.view > .dashboard-grid .metric-head {
  align-items: flex-start;
}

.dashboard-view .metric-icon,
.view > .dashboard-grid .metric-icon {
  margin-top: 0;
}

/* Compact module summaries, searchable details and consistent confirmations. */
.module-insight-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.module-insight-list .module-insight { padding:12px 14px; gap:10px; align-items:flex-start; margin:0; }
.module-insight .metric-icon { width:32px; height:32px; flex:0 0 32px; border-radius:9px; }
.module-insight .metric-icon svg { width:18px; height:18px; }
.module-insight-heading { font-size:14px; line-height:1.35; }
.module-insight-message { font-size:13px; line-height:1.45; margin:5px 0 9px; }
.module-insight-context { margin-top:8px; font-size:12px; color:var(--muted); }
.module-insight-context summary { cursor:pointer; }
.module-insight-context .module-insight-source, .module-insight-context .module-insight-period, .module-insight-context .module-insight-metric { font-size:12px; margin-top:5px; }
.dashboard-grid.primary { gap:12px; }
.dashboard-grid.primary .metric-card { padding:14px; min-height:0; }
.insight-kpi-chip { font:inherit; cursor:pointer; }
.alert-card-list { gap:10px; }
.insight-card { padding:12px 14px; }
.insight-card-header .metric-icon { width:32px; height:32px; }
.insight-card-context { font-size:13px; margin:6px 0; }
.alert-group { scroll-margin-top:100px; }
.record-detail-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px 20px; margin:0; }
.record-detail-grid dt { color:var(--muted); font-size:12px; margin-bottom:4px; }
.record-detail-grid dd { margin:0; font-size:14px; overflow-wrap:anywhere; white-space:pre-line; }
.clinical-detail, .insight-detail-modal { width:min(1060px,96vw); max-height:90dvh; display:flex; flex-direction:column; }
.clinical-detail .modal-body, .insight-detail-modal .modal-body { overflow-y:auto; min-height:0; }
.insight-record-row { padding:16px; border:1px solid var(--border); border-radius:12px; margin:10px 0; }
.insight-record-row > button { margin-top:12px; }
.confirmation-backdrop { z-index:10000; }
.confirmation-dialog { width:min(480px,94vw); }
.confirmation-dialog .modal-body p { white-space:pre-line; }
.module-filter-panel { width:100%; border:1px solid var(--border); border-radius:10px; padding:9px 12px; }
.module-filter-panel summary { cursor:pointer; font-weight:600; font-size:13px; }
.module-filter-fields { display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; align-items:flex-end; }
.module-filter-fields label { display:flex; flex-direction:column; gap:5px; font-size:12px; flex:1 1 160px; }
.module-filter-fields select, .module-filter-fields input { width:100%; min-height:38px; border:1px solid var(--border); border-radius:8px; padding:8px; background:var(--surface,#fff); color:inherit; }
.view-toolbar { align-items:flex-start; }
.view-toolbar > .toolbar-left { flex:1; min-width:200px; flex-wrap:wrap; }
.view-toolbar .search-wrap { flex:1 1 300px; }
.table-panel { border-radius:14px; overflow:hidden; }
.table-scroll { max-height:65vh; scrollbar-width:thin; }
.table-scroll thead th { position:sticky; top:0; z-index:2; background:var(--surface,#f4f8f8); font-size:12px; white-space:nowrap; }
.table-scroll tbody td { padding:11px 13px; font-size:13px; vertical-align:middle; }
.table-scroll tbody tr:nth-child(even) { background:rgba(0,100,100,.025); }
.table-scroll tbody tr:hover { background:rgba(0,100,100,.065); }
.table-actions { gap:5px; flex-wrap:wrap; }
.table-actions .button.icon-only { width:32px; height:32px; min-width:32px; padding:6px; }
.iatf-module { border:1px solid var(--border); border-radius:14px; background:var(--surface,#fff); padding:16px; margin:16px 0; }
.iatf-module-header { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.iatf-protocol-list, .iatf-version-list, .iatf-step-list { list-style:none; padding:0; margin:0; display:grid; gap:10px; }
.iatf-protocol-row { border:1px solid var(--border); border-radius:12px; padding:12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.iatf-protocol-toggle, .iatf-version-toggle { border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; display:flex; align-items:center; gap:10px; padding:6px; font:inherit; flex:1; min-width:180px; }
.iatf-protocol-toggle { flex-wrap:wrap; }
.iatf-protocol-name { font-weight:700; font-size:15px; }
.iatf-protocol-description { color:var(--muted); font-size:13px; flex-basis:100%; }
.iatf-versions, .iatf-steps { flex-basis:100%; width:100%; }
.iatf-version-row { padding:10px; border-radius:9px; background:rgba(0,100,100,.04); display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.iatf-step-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:8px; }
.iatf-step-day { background:#e0f1ee; border-radius:6px; padding:5px 8px; font-weight:700; }
@media(max-width:760px) { .module-insight-list { grid-template-columns:1fr; } .record-detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .iatf-protocol-toggle { flex-basis:100%; } .view-toolbar > .toolbar-right { flex-wrap:wrap; } }
@media(max-width:420px) { .record-detail-grid { grid-template-columns:1fr; } }

.financial-overview { display:grid; gap:16px; margin:12px 0 20px; }
.financial-overview-heading h2 { margin:0; font-size:20px; }
.financial-overview-heading p, .financial-chart > p { color:var(--muted); font-size:12px; margin:5px 0 12px; }
.financial-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.financial-metric { display:flex; flex-direction:column; gap:6px; padding:14px; background:var(--surface,#fff); border:1px solid var(--border); border-radius:12px; }
.financial-metric > span { font-size:12px; font-weight:600; color:var(--muted); }
.financial-metric > strong { font-size:clamp(17px,1.6vw,24px); color:var(--text); }
.financial-metric > small { font-size:11px; color:var(--muted); line-height:1.4; }
.financial-chart-grid { display:grid; grid-template-columns:1.3fr 1fr; gap:14px; }
.financial-chart { border:1px solid var(--border); border-radius:12px; padding:16px; min-width:0; background:var(--surface,#fff); }
.financial-chart h3 { margin:0; font-size:15px; }
.financial-chart svg { display:block; width:100%; max-height:240px; }
.financial-chart svg text { fill:var(--text); }
.financial-chart-legend { display:flex; gap:18px; font-size:12px; color:#087f73; }
.financial-chart-legend span + span { color:#a46415; }
.financial-category-list { max-height:265px; overflow:auto; }
.financial-category { margin-bottom:14px; }
.financial-category > div:first-child { display:flex; justify-content:space-between; gap:10px; font-size:12px; }
.financial-category-track { height:7px; border-radius:8px; background:#e8eeee; margin-top:7px; }
.financial-category-track span { display:block; height:100%; background:#087f73; border-radius:inherit; }
@media(max-width:1000px) { .financial-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .financial-chart-grid { grid-template-columns:1fr; } }
.agenda-workspace { display:grid; grid-template-columns:minmax(360px,1.15fr) minmax(320px,1fr); gap:16px; align-items:start; }
.calendar-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.calendar-toolbar h2 { margin:0; text-transform:capitalize; font-size:1.1rem; }
.calendar-toolbar > div { display:flex; gap:4px; }
.month-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
.weekday { text-align:center; font-size:.8rem; font-weight:700; padding:8px 0; }
.month-day { min-height:88px; border:1px solid var(--border,#d3e3e2); border-radius:8px; background:var(--surface,#fff); padding:7px; text-align:left; display:flex; flex-direction:column; gap:4px; color:inherit; cursor:pointer; }
.month-day.outside { opacity:.45; }
.month-day.today > strong { color:#007f75; text-decoration:underline; text-underline-offset:4px; }
.month-day[aria-pressed="true"] { border-color:#008577; box-shadow:inset 0 0 0 1px #008577; background:#edf9f6; }
.calendar-holiday { color:#895800; font-size:.72rem; overflow-wrap:anywhere; }
.day-counts { display:flex; flex-wrap:wrap; gap:3px; margin-top:auto; font-size:.66rem; }
.day-counts > span { border-radius:4px; padding:2px 4px; }
.day-counts .overdue { background:#fff0ee; color:#a12c1b; }
.day-counts .pending { background:#fff4d8; color:#785600; }
.day-counts .completed { background:#e6f5ef; color:#136b4b; }
.agenda-status-tabs { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:12px; }
.agenda-status-tabs [aria-pressed="true"] { background:#006c64; color:white; }
.agenda-task-group h3 { font-size:.9rem; margin:12px 0 8px; }
.agenda-task-group.overdue h3 { color:#a12c1b; }
.agenda-task-card { padding:12px; border:1px solid var(--border,#d3e3e2); border-radius:10px; margin-bottom:8px; }
.agenda-task-card p { margin:5px 0; font-size:.82rem; }
.agenda-task-card .table-actions { justify-content:flex-start; flex-wrap:wrap; gap:8px; margin-top:10px; }
.agenda-day-tasks { max-height:65vh; overflow:auto; }
.preserve-lines { white-space:pre-wrap; }
@media (max-width:1100px) { .agenda-workspace { grid-template-columns:1fr; } }
@media (max-width:600px) { .month-day { min-height:66px; padding:4px; } .day-count-label { display:none; } .calendar-holiday { font-size:.6rem; } }
.document-card-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:12px; }
.document-card { padding:16px; border:1px solid var(--border,#d3e3e2); border-radius:12px; min-width:0; }
.document-card h3, .document-card p { overflow-wrap:anywhere; }
.document-card h3 { font-size:1rem; margin:10px 0; }
.document-card p { font-size:.85rem; margin:8px 0; }
.document-card .table-actions { justify-content:flex-start; flex-wrap:wrap; gap:6px; }
.document-library { display:grid; gap:14px; }
.agenda-workspace > .table-panel { padding:16px; }
.month-panel .month-grid { grid-template-rows:32px repeat(6,88px); }
.month-panel .month-day { min-height:0; overflow:hidden; }
.month-panel .calendar-holiday { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.month-panel .day-count-label { display:none; }
.month-panel > small { display:block; margin-top:12px; line-height:1.4; }
@media(max-width:600px) { .month-panel .month-grid { grid-template-rows:28px repeat(6,72px); } .agenda-workspace > .table-panel { padding:10px; } }
.agenda-task-card .table-checkbox { display:inline-flex; align-items:center; gap:6px; width:auto; height:auto; min-width:90px; white-space:nowrap; }
.calendar-legend { display:flex; flex-wrap:wrap; gap:12px; margin-top:12px; font-size:.75rem; }
.calendar-legend span::before { content:""; display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; background:#b57a16; }
.calendar-legend .overdue::before { background:#b23624; }
.calendar-legend .completed::before { background:#18764f; }


/* ═══════════════════════════════════════════════════════════════════════════
   ACOMGEST MODERNIZAÇÃO COMPLETA — v5 (2026-10)
   Cobre: sidebar, topbar, dashboard, KPI cards, formulários, tabelas,
   todos os módulos. Referência visual: mockup entregue pelo cliente.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── BASE RESET ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── APP SHELL ─────────────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0,1fr);
  background: var(--background);
  transition: grid-template-columns var(--transition);
}
.app-shell.collapsed {
  grid-template-columns: var(--sidebar-collapsed) minmax(0,1fr);
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  color: rgba(255,255,255,0.88);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  transition: width var(--transition);
}

.sidebar-header {
  min-height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  flex-shrink: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
}

.sidebar .brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.10);
  padding: 3px;
}

.sidebar .brand-name {
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.sidebar .brand-system {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.50);
  white-space: nowrap;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,0.14);
  color: #FFFFFF;
}

/* NAV */
.nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }

.nav-section {
  margin-bottom: 2px;
}
.nav-section > summary {
  list-style: none;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  cursor: pointer;
  user-select: none;
}
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section-chevron {
  opacity: 0.45;
  transition: transform var(--transition-fast);
  display: flex;
}
.nav-section[open] .nav-section-chevron { transform: rotate(180deg); }

.nav-items {
  padding: 2px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,255,255,0.68);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-button .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-button .nav-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}
.nav-button .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.92);
}

.nav-button.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  font-weight: 700;
}
.nav-button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-button.active .nav-icon svg {
  color: var(--accent);
}

/* Sidebar collapsed */
.app-shell.collapsed .brand-name,
.app-shell.collapsed .brand-system,
.app-shell.collapsed .nav-label,
.app-shell.collapsed .nav-section > summary span:first-child,
.app-shell.collapsed .nav-section-chevron { display: none; }
.app-shell.collapsed .nav-button { justify-content: center; padding: 10px 0; border-radius: 8px; }
.app-shell.collapsed .nav-items { padding: 2px 8px 6px; }
.app-shell.collapsed .nav-section > summary { padding: 6px 8px; justify-content: center; }
.app-shell.collapsed .sidebar-header { padding: 0 10px; justify-content: center; }

/* ─── TOPBAR ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-topbar);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}
.topbar-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-title p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

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

.topbar-select {
  height: 40px;
  min-width: 160px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6E73' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.topbar-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63,174,138,0.18);
}

.notification-button,
.profile-button {
  height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}
.notification-button:hover,
.profile-button:hover {
  background: var(--background-muted);
  border-color: var(--border);
  color: var(--text-primary);
}
.notification-button svg,
.profile-button svg { width: 18px; height: 18px; }

.notification-button.has-alerts {
  border-color: rgba(220,38,38,0.25);
  background: rgba(220,38,38,0.05);
  color: var(--error);
}

.notification-button .badge {
  position: absolute;
  right: -5px;
  top: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Profile button */
.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-copy strong { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); }
.profile-copy small { font-size: 11px; color: var(--text-secondary); }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(13,66,73,0.14);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.profile-menu button {
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.profile-menu button:hover { background: var(--background-muted); }
.profile-menu[hidden] { display: none !important; }
.profile-menu-wrap { position: relative; }

/* ─── CONTENT AREA ───────────────────────────────────────────────────────── */
.main-area { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.content { flex: 1; padding: 24px 26px; overflow: auto; }
.view { display: grid; gap: 20px; }

/* ─── DAILY SUMMARY (greeting) ───────────────────────────────────────────── */
/* Mockup: fundo transparente, texto escuro, date+period selector à direita */
.daily-summary {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 0 4px !important;
  box-shadow: none !important;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.daily-summary-greeting {
  font-size: 28px !important;
  font-weight: 900 !important;
  color: var(--text-primary) !important;
  margin-bottom: 4px !important;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.daily-summary-subtitle {
  font-size: 14px !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0 !important;
}
.daily-summary-farm {
  display: none !important; /* período já está no topbar */
}
.daily-summary-list {
  display: none !important; /* bullets saem do summary — ficam nos alertas */
}
.daily-summary-empty {
  display: none !important;
}

/* ─── DASHBOARD SECTION TITLES ───────────────────────────────────────────── */
.dashboard-section-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  margin: 0 !important;
  letter-spacing: -0.2px;
}

/* ─── DASHBOARD GRID ─────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  gap: 14px;
}
.dashboard-grid.primary {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.dashboard-grid.secondary {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* ─── METRIC CARDS ───────────────────────────────────────────────────────── */
.metric-card,
.chart-panel,
.table-panel,
.settings-panel,
.report-panel,
.detail-panel {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
  transition: transform var(--transition), box-shadow var(--transition) !important;
}
.metric-card:hover,
.chart-panel:hover,
.table-panel:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-card-hover) !important;
}

.metric-card {
  padding: 20px 20px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  position: relative !important;
  overflow: hidden !important;
  min-width: 0 !important;
}

/* Remove top border stripe (substituído por design limpo sem stripe) */
.dashboard-view .metric-card {
  border-top: none !important;
}
.dashboard-view .metric-card::after { display: none !important; }

/* Tinted card backgrounds por tipo */
.dashboard-view .metric-card:has(.metric-icon.success) {
  background: linear-gradient(160deg, #FFFFFF 60%, #F0FBF6 100%) !important;
  border-color: #C6EAD9 !important;
}
.dashboard-view .metric-card:has(.metric-icon.warning) {
  background: linear-gradient(160deg, #FFFFFF 60%, #FFF8EE 100%) !important;
  border-color: #F0DDB8 !important;
}
.dashboard-view .metric-card:has(.metric-icon.error) {
  background: linear-gradient(160deg, #FFFFFF 60%, #FFF3F0 100%) !important;
  border-color: #F0C4BC !important;
}
.dashboard-view .metric-card:has(.metric-icon.info) {
  background: linear-gradient(160deg, #FFFFFF 60%, #F0F6FF 100%) !important;
  border-color: #BFD6F5 !important;
}
.dashboard-view .metric-card:has(.metric-icon.secondary) {
  background: linear-gradient(160deg, #FFFFFF 60%, #F4F1FF 100%) !important;
  border-color: #D4CAFE !important;
}

.metric-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.metric-label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--text-secondary) !important;
  text-transform: none !important;
  letter-spacing: 0.04em !important;
  line-height: 1.3 !important;
}

.metric-value {
  font-size: 32px !important;
  font-weight: 900 !important;
  color: var(--text-primary) !important;
  line-height: 1 !important;
  letter-spacing: -1px !important;
  min-width: 0 !important;
  overflow-wrap: break-word !important;
}

.metric-meta {
  font-size: 12px !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
}

/* Ícone do card */
.metric-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.metric-icon svg { width: 20px !important; height: 20px !important; }

.metric-icon.success { background: #DCFCE7; color: #059669; }
.metric-icon.warning { background: #FEF3C7; color: #D97706; }
.metric-icon.error   { background: #FEE2E2; color: #DC2626; }
.metric-icon.info    { background: #DBEAFE; color: #2563EB; }
.metric-icon.secondary { background: #EDE9FE; color: #7157D9; }
.metric-icon.primary { background: #CCEDE5; color: #0F4F55; }

/* Variation badge (ex: ↑ +6% vs. mês anterior) */
.metric-change,
.metric-variation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.metric-change.up,
.metric-variation.up {
  background: #DCFCE7;
  color: #059669;
}
.metric-change.down,
.metric-variation.down {
  background: #FEE2E2;
  color: #DC2626;
}

/* Ação do card */
.metric-action {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.metric-action a,
.metric-action button {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: color var(--transition-fast);
}
.metric-action a:hover,
.metric-action button:hover { color: var(--accent); }

/* ─── CHART PANELS ───────────────────────────────────────────────────────── */
.chart-panel {
  padding: 20px !important;
  display: grid !important;
  gap: 14px !important;
  min-width: 0 !important;
}
.chart-panel,
.dashboard-view .chart-panel {
  border-top: none !important;
}
.table-panel,
.dashboard-view .table-panel {
  border-top: none !important;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.panel-title p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  background: transparent !important;
}

/* ─── OPERATIONAL SHORTCUTS ──────────────────────────────────────────────── */
.dashboard-operational-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.shortcut-card,
.op-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition-fast);
  text-decoration: none;
}
.shortcut-card:hover,
.op-shortcut:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent);
  color: var(--primary);
}

/* ─── REPORT ALERTS BLOCK ────────────────────────────────────────────────── */
.report-alert-block {
  border-radius: var(--radius-md);
  border: 1px solid #F0DDB8;
  background: #FFFDF5;
  padding: 16px 18px;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────── */
.table-panel {
  padding: 0 !important;
  overflow: hidden !important;
}
.table-panel .panel-toolbar {
  padding: 16px 18px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--background);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--background); }
tbody td {
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-badge.success, .status-badge.concluido, .status-badge.ativo {
  background: var(--success-bg); color: var(--success);
}
.status-badge.warning, .status-badge.andamento, .status-badge.analise {
  background: var(--warning-bg); color: var(--warning);
}
.status-badge.error, .status-badge.pendente, .status-badge.vencido {
  background: var(--error-bg); color: var(--error);
}
.status-badge.info {
  background: var(--info-bg); color: var(--info);
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), 
              box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}
.button.primary:hover:not(:disabled) {
  background: #0D4249;
  border-color: #0D4249;
  box-shadow: 0 4px 14px rgba(13,66,73,0.25);
}

.button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.button.accent:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(63,174,138,0.30);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.button.secondary:hover:not(:disabled) {
  background: var(--background-muted);
  border-color: var(--primary);
  color: var(--primary);
}

.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.button.ghost:hover:not(:disabled) {
  background: var(--background-muted);
  color: var(--text-primary);
}

.button.danger {
  background: var(--error-bg);
  border-color: rgba(220,38,38,0.30);
  color: var(--error);
}
.button.danger:hover:not(:disabled) {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.button.icon-only {
  padding: 9px;
  width: 38px;
  height: 38px;
}
.button svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.topbar-select,
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.field textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 100px;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63,174,138,0.16);
}
.field input::placeholder,
.field textarea::placeholder,
.search-input::placeholder { color: var(--text-muted); }

.field-error {
  font-size: 11.5px;
  color: var(--error);
  font-weight: 600;
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13,27,30,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(13,27,30,0.22);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.modal-body {
  padding: 22px 24px;
  flex: 1;
  overflow-y: auto;
  display: grid;
  gap: 16px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--background);
}

/* ─── VIEW TOOLBAR ───────────────────────────────────────────────────────── */
.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── SEARCH INPUT ───────────────────────────────────────────────────────── */
.search-input {
  width: 260px;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.35;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0;
}
.empty-state p {
  font-size: 13.5px;
  margin: 0;
}

/* ─── BADGE ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: var(--error);
  color: #fff;
}

/* ─── TABS ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}
.tab-button {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab-button:hover { color: var(--text-primary); }
.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
  font-weight: 800;
}

/* Tabs do "Minhas tarefas" no mockup */
.task-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}
.task-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: var(--background-muted);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.task-tab.active {
  background: var(--primary);
  color: #fff;
}
.task-tab-count {
  margin-left: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10.5px;
}

/* ─── TASK ITEMS (minhas tarefas) ────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 40px;
  flex-shrink: 0;
}
.task-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.task-icon.success { background: var(--success-bg); color: var(--success); }
.task-icon.warning { background: var(--warning-bg); color: var(--warning); }
.task-icon.info    { background: var(--info-bg); color: var(--info); }
.task-icon.error   { background: var(--error-bg); color: var(--error); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.task-meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ─── QUICK ACCESS (acesso rápido) ──────────────────────────────────────── */
.quick-access-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.quick-access-item:hover {
  background: var(--background-muted);
  border-color: var(--accent);
}
.quick-access-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--background-muted);
}
.quick-access-label { font-size: 13px; font-weight: 600; flex: 1; }
.quick-access-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* ─── KPI INLINE (indicadores reprodutivos) ─────────────────────────────── */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--background);
}
.kpi-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.8px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.05em;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
}
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--error); }

/* ─── CARDS GERAIS (animal, fazenda, etc.) ───────────────────────────────── */
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--transition), border-color var(--transition-fast);
}
.record-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

/* ─── ALERTS TABLE ───────────────────────────────────────────────────────── */
.alerts-table .table-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* ─── SCROLLBAR GLOBAL ───────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── TOOLTIPS ───────────────────────────────────────────────────────────── */
[data-tooltip]:not([data-tooltip=""]) {
  position: relative;
}
[data-tooltip]:not([data-tooltip=""])::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 500;
}
[data-tooltip]:not([data-tooltip=""]):hover::after { opacity: 1; }

/* Sidebar collapsed — tooltip na direita */
.app-shell.collapsed [data-tooltip]:not([data-tooltip=""])::after {
  opacity: 0;
}
.app-shell.collapsed .nav-button[data-tooltip]:not([data-tooltip=""])::after {
  opacity: 0;
}
.app-shell.collapsed .nav-button:hover[data-tooltip]:not([data-tooltip=""])::after {
  opacity: 1;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dashboard-grid.primary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr !important; }
  .sidebar { display: none; }
  .mobile-tabbar { display: grid; }
  .content { padding: 16px; padding-bottom: calc(var(--mobile-tabbar-height) + 16px); }
  .topbar { padding: 0 16px; }
  .dashboard-grid.primary,
  .dashboard-grid.secondary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .dashboard-grid.primary,
  .dashboard-grid.secondary { grid-template-columns: 1fr; }
  .metric-value { font-size: 28px !important; }
  .daily-summary-greeting { font-size: 22px !important; }
}

/* ─── PRINT ──────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .mobile-tabbar { display: none !important; }
  .content { padding: 0 !important; }
}

/* ─── FOCUS VISIBLE ──────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   FIM — ACOMGEST MODERNIZAÇÃO COMPLETA v5
   ═══════════════════════════════════════════════════════════════════════════ */
