:root {
  /* Tokens oficiais AgroGado */
  --ag-forest-900: #003B2A;
  --ag-forest: #004D35;
  --ag-green: #087A45;
  --ag-green-light: #159447;
  --ag-leaf: #6F9F18;
  --ag-leaf-light: #8DB51F;
  --ag-lime: #A8C92A;
  --ag-lime-light: #D7E78B;
  --ag-soft-green: #EAF3E5;
  --ag-soft-lime: #F2F7DF;
  --ag-background: #F6F8F3;
  --ag-surface: #FFFFFF;
  --ag-text: #17231D;
  --ag-text-secondary: #66736C;
  --ag-border: #E1E8DE;

  /* Utilitários / aliases herdados do design system original */
  --ag-primary: var(--ag-green);
  --ag-primary-dark: var(--ag-forest);
  --ag-primary-darker: var(--ag-forest-900);
  --ag-bg: var(--ag-background);
  --ag-success: var(--ag-green-light);
  --ag-danger: #D94A4A;
  --ag-warning: #E5A72C;
  --ag-info: #3F9FD1;
  --ag-radius: 12px;
  --ag-radius-small: 8px;
  --ag-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
  --ag-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --ag-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --ag-font: 'Inter', sans-serif;
  --ag-sidebar-width: 260px;
  --ag-topbar-height: 80px;
  --ag-transition: 0.2s ease;

  /* aliases legados */
  --agro-green: var(--ag-success);
  --agro-green-light: #4CAF50;
  --agro-green-dark: var(--ag-primary-dark);
  --agro-green-50: var(--ag-soft-green);
  --agro-bg: var(--ag-background);
  --agro-surface: var(--ag-surface);
  --agro-text: var(--ag-text);
  --agro-text-muted: var(--ag-text-secondary);
  --agro-border: var(--ag-border);
  --agro-blue: var(--ag-info);
  --agro-red: var(--ag-danger);
  --agro-yellow: var(--ag-warning);
  --agro-purple: #7C71D1;
  --agro-pink: #C85BA8;
  --agro-radius: var(--ag-radius);
  --agro-radius-sm: var(--ag-radius-small);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--ag-font);
  color: var(--ag-text);
  background: var(--ag-background);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  min-height: 100vh;
  display: flex;
}

/* ========== SIDEBAR ========== */
.ag-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--ag-sidebar-width);
  background: var(--ag-forest);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 120;
  transition: transform var(--ag-transition);
}

.ag-sidebar__brand {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ag-sidebar__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--ag-radius-small);
  object-fit: contain;
}

.ag-brand {
  display: flex;
  flex-direction: column;
}

.ag-brand__main,
.brand-main {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.ag-brand__highlight,
.brand-highlight {
  color: var(--ag-lime);
}

.ag-brand__sub,
.brand-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 0.25rem;
}

.ag-sidebar__property {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ag-property-select {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--ag-radius-small);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--ag-transition);
}

.ag-property-select:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ag-property-select__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--ag-radius-small);
  background: var(--ag-leaf);
  color: #fff;
  font-size: 20px;
}

.ag-property-select__label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  text-align: left;
}

.ag-property-select__top {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.ag-property-select__name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ag-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem 1.5rem;
}

.ag-nav-group {
  margin-bottom: 1.25rem;
}

.ag-nav-group__title {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 0.5rem 0.4rem;
}

.ag-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.2rem;
  border-radius: var(--ag-radius-small);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ag-transition), color var(--ag-transition);
}

.ag-nav-item:hover,
.ag-nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.ag-nav-item.active {
  background: var(--ag-forest);
  box-shadow: inset 3px 0 0 0 var(--ag-lime);
  color: #fff;
}

.ag-nav-item.active .ag-nav-item__icon,
.ag-nav-item.active .material-symbols-rounded {
  color: var(--ag-lime);
}

.ag-nav-item__icon,
.ag-nav-item .material-symbols-rounded {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.ag-nav-item__label {
  flex: 1;
}

.ag-sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ag-plan-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--ag-radius-small);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.ag-plan-badge .material-symbols-rounded {
  color: var(--ag-lime);
}

.ag-sidebar__close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* ========== OVERLAY ========== */
.ag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 110;
  display: none;
  opacity: 0;
  transition: opacity var(--ag-transition);
}

.ag-overlay.show {
  display: block;
  opacity: 1;
}

/* ========== WRAPPER / TOPBAR / MAIN ========== */
.ag-wrapper {
  flex: 1;
  margin-left: var(--ag-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ag-topbar {
  height: var(--ag-topbar-height);
  background: var(--ag-surface);
  border-bottom: 1px solid var(--ag-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.ag-topbar__left,
.ag-topbar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ag-topbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--ag-radius-small);
  border: none;
  background: var(--ag-background);
  color: var(--ag-text);
  cursor: pointer;
}

.ag-topbar__heading {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ag-topbar__title,
.screen-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ag-text);
  line-height: 1.2;
}

.ag-topbar__subtitle,
.screen-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ag-text-secondary);
}

.ag-main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--ag-background);
}

/* ========== VIEWS ========== */
.view {
  display: none;
}

.view-active {
  display: block;
}

.ag-page-header,
.immersive-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ag-border);
}

.ag-page-header__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ag-text);
}

.ag-page-header__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--ag-text-secondary);
}

.ag-page-header__actions,
.immersive-header + .view-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ag-content,
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ========== TYPOGRAPHY HELPERS ========== */
.ag-section-title,
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ag-text);
  margin: 0 0 0.75rem;
  border-left: 3px solid var(--ag-leaf);
  padding-left: 0.5rem;
}

/* ========== BUTTONS ========== */
.ag-btn,
.btn,
.ag-btn-primary,
.btn-primary,
.ag-btn-secondary,
.btn-ghost,
.ag-btn-danger,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: var(--ag-radius-small);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background var(--ag-transition), color var(--ag-transition), transform 0.1s;
}

.ag-btn:active,
.btn:active {
  transform: scale(0.98);
}

.ag-btn-primary,
.btn-primary {
  background: var(--ag-primary);
  color: #fff;
}

.ag-btn-primary:hover,
.btn-primary:hover {
  background: var(--ag-primary-dark);
}

.ag-btn-secondary,
.btn-ghost {
  background: #fff;
  color: var(--ag-text);
  border: 1px solid var(--ag-border);
}

.ag-btn-secondary:hover,
.btn-ghost:hover {
  background: var(--ag-background);
  border-color: var(--ag-border);
}

.ag-btn-danger,
.btn-danger {
  background: var(--ag-danger);
  color: #fff;
}

.ag-btn-danger:hover,
.btn-danger:hover {
  background: #C23B3B;
}

.ag-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--ag-background);
  color: var(--ag-text);
}

.ag-btn--icon:hover {
  background: var(--ag-border);
}

.ag-btn-block,
.btn-block {
  width: 100%;
}

/* ========== CARDS ========== */
.ag-card,
.detail-card,
.summary-card,
.recent-activities {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 1.25rem;
  box-shadow: var(--ag-shadow);
}

.ag-card--quick-actions,
.ag-card--recent {
  padding: 1.25rem;
}

/* ========== KPI ========== */
.ag-kpi-grid,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.ag-kpi,
.kpi-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--ag-shadow);
  transition: border-color var(--ag-transition), box-shadow var(--ag-transition);
}

.ag-kpi:hover,
.kpi-card:hover {
  border-color: var(--ag-primary);
  box-shadow: var(--ag-shadow-md);
}

.ag-kpi__icon,
.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  flex-shrink: 0;
}

.ag-kpi--herd .ag-kpi__icon,
.kpi-herd .kpi-icon,
.ag-kpi--management .ag-kpi__icon,
.kpi-management .kpi-icon { background: var(--ag-leaf); }

.ag-kpi--active .ag-kpi__icon,
.kpi-active .kpi-icon,
.ag-kpi--weighing .ag-kpi__icon,
.kpi-weighing .kpi-icon { background: var(--ag-green-light); }

.ag-kpi--births .ag-kpi__icon,
.kpi-births .kpi-icon,
.ag-kpi--males .ag-kpi__icon,
.kpi-males .kpi-icon { background: var(--ag-lime); }

.ag-kpi--females .ag-kpi__icon,
.kpi-females .kpi-icon,
.ag-kpi--lots .ag-kpi__icon,
.kpi-lots .kpi-icon { background: var(--ag-leaf-light); }

.ag-kpi__info,
.kpi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ag-kpi__label,
.kpi-label {
  font-size: 0.8rem;
  color: var(--ag-text-secondary);
}

.ag-kpi__value,
.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ag-text);
}

/* ========== ACTIONS GRID ========== */
.ag-actions-grid,
.actions-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.ag-action-card,
.action-card {
  background: var(--ag-surface);
  border-radius: var(--ag-radius);
  border: 1px solid var(--ag-border);
  padding: 0.85rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color var(--ag-transition), background var(--ag-transition), box-shadow var(--ag-transition);
}

.ag-action-card:hover,
.action-card:hover {
  border-color: var(--ag-primary);
  background: var(--ag-soft-green);
  box-shadow: var(--ag-shadow);
}

.ag-action-card__icon,
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--ag-radius-small);
  background: var(--ag-soft-green);
  color: var(--ag-primary);
  font-size: 20px;
}

.ag-action-card__label,
.action-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ag-text);
  text-align: center;
}

/* ========== LISTS ========== */
.ag-list,
.simple-list,
.activity-list,
#activity-list,
ul.ag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ag-list__item,
.simple-list-item,
.ag-list li:not(.ag-empty):not(.ag-empty--small),
.activity-list li:not(.activity-empty) {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-small);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--ag-shadow);
  cursor: pointer;
  transition: border-color var(--ag-transition), background var(--ag-transition), box-shadow var(--ag-transition);
}

.ag-list__item:hover,
.simple-list-item:hover {
  border-color: var(--ag-primary);
  background: var(--ag-soft-green);
  box-shadow: var(--ag-shadow-md);
}

.ag-list__main,
.list-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.ag-list__main strong,
.list-item-main strong {
  font-weight: 600;
  color: var(--ag-text);
}

.ag-list__meta,
.list-item-meta {
  font-size: 0.8rem;
  color: var(--ag-text-secondary);
}

.ag-list__amount,
.list-item-amount {
  font-weight: 700;
  font-size: 0.95rem;
}

.ag-list__amount.positive,
.list-item-amount.positive { color: var(--ag-success); }
.ag-list__amount.negative,
.list-item-amount.negative { color: var(--ag-danger); }

/* ========== BADGES ========== */
.ag-badge,
.list-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  text-transform: lowercase;
  background: var(--ag-background);
  color: var(--ag-text-secondary);
  border: 1px solid var(--ag-border);
}

.ag-badge--success,
.list-item-badge.ativo,
.list-item-badge.active { background: var(--ag-soft-green); color: var(--ag-green); border-color: var(--ag-soft-green); }

.ag-badge--danger,
.list-item-badge.inativo,
.list-item-badge.inactive { background: #FDEFEF; color: var(--ag-danger); border-color: #F8D4D4; }

.ag-badge--warning { background: #FDF6EA; color: var(--ag-warning); border-color: #F6E3C4; }

.ag-badge--info { background: var(--ag-soft-lime); color: var(--ag-forest); border-color: var(--ag-lime-light); }

.ag-badge--highlight { background: var(--ag-primary); color: #fff; border-color: var(--ag-primary); }

/* ========== TOOLBARS ========== */
.ag-toolbar,
.view-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ag-search,
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.ag-search input,
.search-box input {
  width: 100%;
  padding: 0.65rem 0.75rem 0.65rem 2.4rem;
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-small);
  font-size: 0.95rem;
  outline: none;
  background: var(--ag-surface);
  color: var(--ag-text);
}

.ag-search .material-symbols-rounded,
.search-box .material-symbols-rounded {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ag-text-secondary);
  font-size: 20px;
}

/* ========== FORMS ========== */
.ag-form-group,
.form-group {
  margin-bottom: 1rem;
}

.ag-form-group label,
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ag-text-secondary);
  margin-bottom: 0.35rem;
}

.ag-input,
.ag-select,
.ag-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-small);
  font-size: 0.95rem;
  outline: none;
  background: var(--ag-surface);
  color: var(--ag-text);
  transition: border-color var(--ag-transition), box-shadow var(--ag-transition);
}

.ag-input:focus,
.ag-select:focus,
.ag-textarea:focus,
input:focus,
select:focus,
textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--ag-primary);
  box-shadow: 0 0 0 3px rgba(8, 122, 69, 0.08);
}

textarea,
.ag-textarea,
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.ag-form-section,
.form-section {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ag-primary);
  margin: 1.5rem 0 0.75rem;
}

/* ========== DATA ROWS ========== */
.ag-data-row,
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--ag-border);
  gap: 1rem;
}

.ag-data-row:last-child,
.detail-row:last-child { border-bottom: none; }

.ag-data-row__label,
.detail-label {
  color: var(--ag-text-secondary);
  font-size: 0.85rem;
}

.ag-data-row__value,
.detail-value {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ag-text);
  text-align: right;
}

/* ========== FINANCE SUMMARY ========== */
.ag-finance-summary,
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.ag-finance-summary__item,
.finance-summary-item {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--ag-shadow);
}

.ag-finance-summary__label,
.finance-summary-label {
  font-size: 0.75rem;
  color: var(--ag-text-secondary);
}

.ag-finance-summary__value,
.finance-summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ag-text);
}

.ag-finance-summary__value.income,
.finance-summary-value.income { color: var(--ag-success); }
.ag-finance-summary__value.expense,
.finance-summary-value.expense { color: var(--ag-danger); }
.ag-finance-summary__value.balance,
.finance-summary-value.balance { color: var(--ag-info); }

/* ========== MENU GRID ========== */
.ag-menu-grid,
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.ag-menu-card,
.menu-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  box-shadow: var(--ag-shadow);
  transition: border-color var(--ag-transition), background var(--ag-transition), box-shadow var(--ag-transition);
}

.ag-menu-card:hover,
.menu-card:hover {
  border-color: var(--ag-primary);
  background: var(--ag-soft-green);
  box-shadow: var(--ag-shadow-md);
}

.ag-menu-card__icon,
.menu-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--ag-radius-small);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ag-soft-green);
  color: var(--ag-primary);
  font-size: 24px;
  flex-shrink: 0;
}

.ag-menu-card__info,
.menu-card-info {
  display: flex;
  flex-direction: column;
}

.ag-menu-card__title,
.menu-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ag-text);
}

.ag-menu-card__subtitle,
.menu-card-subtitle {
  font-size: 0.75rem;
  color: var(--ag-text-secondary);
}

/* ========== TABLES ========== */
.ag-table,
table.ag-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.ag-table th,
.ag-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ag-border);
  text-align: left;
  color: var(--ag-text);
}

.ag-table th {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ag-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--ag-background);
}

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

.ag-table tbody tr:hover { background: var(--ag-soft-green); }

.ag-table tbody tr.active { background: var(--ag-soft-lime); }

/* ========== STATES ========== */
.ag-empty,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  color: var(--ag-text-secondary);
}

.ag-empty .material-symbols-rounded,
.empty-state .material-symbols-rounded {
  font-size: 48px;
  color: var(--ag-forest);
}

.ag-empty p,
.empty-state p { margin: 0; }

.ag-empty--small {
  padding: 1.5rem 1rem;
}

.ag-empty--small .material-symbols-rounded {
  font-size: 32px;
}

.ag-loading,
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--ag-text-secondary);
}

.ag-error,
.error {
  text-align: center;
  padding: 2rem;
  color: var(--ag-danger);
  background: #FDEFEF;
  border: 1px solid #F8D4D4;
  border-radius: var(--ag-radius);
}

/* ========== MODAL ========== */
.ag-modal,
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.ag-modal.modal-open,
.modal.modal-open,
.ag-modal--open,
.modal-open {
  display: flex;
}

.ag-modal__card,
.modal-card {
  background: var(--ag-surface);
  border-radius: var(--ag-radius);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  box-shadow: var(--ag-shadow-lg);
}

.ag-modal__header,
.modal-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.ag-tabs,
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--ag-border);
  margin-bottom: 1rem;
}

.ag-tab,
.auth-tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  color: var(--ag-text-secondary);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.95rem;
}

.ag-tab.active,
.auth-tab.active {
  color: var(--ag-primary);
  border-bottom-color: var(--ag-primary);
}

.ag-form,
.agro-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-message {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ag-danger);
  text-align: center;
}

/* ========== SNACKBAR ========== */
#snackbar,
.ag-snackbar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ag-text);
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--ag-radius);
  z-index: 300;
  display: none;
  box-shadow: var(--ag-shadow-lg);
  font-size: 0.9rem;
  min-width: 280px;
  max-width: 90vw;
  text-align: center;
}

#snackbar.show,
.ag-snackbar.show { display: block; }

/* ========== MATERIAL ICONS ========== */
.material-symbols-rounded {
  font-variation-settings:
    'FILL' 1,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
  font-family: 'Material Symbols Rounded', sans-serif;
  font-size: 20px;
  line-height: 1;
}

/* ========== AUTH PAGE (LOGIN / CADASTRO) ========== */
#auth-modal.auth-page {
  background:
    var(--ag-forest-900)
    url('../assets/images/auth_background.jpg')
    center / cover
    no-repeat;
}

#auth-modal.auth-page.modal-open {
  overflow-y: auto;
}

#auth-modal.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 59, 42, 0.55) 0%,
    rgba(0, 59, 42, 0.80) 100%
  );
  z-index: 0;
}

.auth-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 2rem 1.5rem;
  gap: 2rem;
}

@media (min-width: 900px) {
  .auth-layout {
    flex-direction: row;
    gap: 4.5rem;
    align-items: center;
    justify-content: center;
  }

  .auth-brand {
    align-items: flex-start;
    text-align: left;
  }

  .auth-brand__content {
    align-items: flex-start;
    text-align: left;
  }

  .auth-brand__main {
    justify-content: flex-start;
  }
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  color: #fff;
  max-width: 440px;
}

.auth-brand__logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin-bottom: 0.85rem;
  border-radius: 50%;
  align-self: flex-start;
  margin-left: 0;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.auth-brand__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
}

.auth-brand__main {
  font-size: 2.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}

.auth-brand__agro {
  color: #fff;
}

.auth-brand__gado {
  color: var(--ag-lime);
}

.auth-brand__sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ag-lime);
  letter-spacing: 0.14em;
  margin-top: 0.3rem;
  display: block;
}

.auth-brand__slogan {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.90);
  margin: 0.75rem 0 0;
  line-height: 1.45;
}

.auth-brand__slogan span {
  color: var(--ag-lime);
  font-weight: 600;
}

.auth-brand__benefits {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.88);
}

.auth-brand__benefits li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
}

.auth-brand__benefits .material-symbols-rounded {
  color: var(--ag-lime);
  font-size: 20px;
  flex-shrink: 0;
}

@media (max-width: 899px) {
  .auth-layout {
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  .auth-brand {
    align-items: center;
    text-align: center;
  }

  .auth-brand__content {
    align-items: center;
    text-align: center;
  }

  .auth-brand__main {
    justify-content: center;
    font-size: 2rem;
  }

  .auth-brand__benefits {
    display: none;
  }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 590px;
  max-height: 92vh;
  padding: 1.75rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.auth-card__header {
  text-align: center;
  margin-bottom: 0.75rem;
  height: 76px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.auth-card__leaf {
  color: var(--ag-green);
  font-size: 26px;
  margin-bottom: 0.15rem;
}

.auth-card__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ag-text);
  margin: 0;
  line-height: 1.2;
}

.auth-card__subtitle {
  font-size: 0.85rem;
  color: var(--ag-text-secondary);
  margin: 0.2rem 0 0;
  line-height: 1.2;
}

.auth-card .ag-tabs {
  display: flex;
  border-bottom: 1px solid var(--ag-border);
  margin-bottom: 1rem;
  height: 38px;
  flex-shrink: 0;
}

.auth-card .ag-tab {
  border: none;
  background: transparent;
  color: var(--ag-text-secondary);
  padding: 0.5rem 0.5rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.auth-card .ag-tab:hover {
  color: var(--ag-green);
}

.auth-card .ag-tab.active {
  color: var(--ag-green);
  border-bottom-color: var(--ag-green);
}

.auth-forms-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
}

.auth-form {
  display: none;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.auth-form.active {
  display: flex;
}

.auth-form-fields {
  display: flex;
  flex-direction: column;
}

.auth-form-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.ag-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 46px;
  background: #ffffff !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 13px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: inherit;
  margin-bottom: 0.15rem;
}

.ag-btn-google:hover {
  background: #f9fafb !important;
  border-color: #9ca3af !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.ag-btn-google:active {
  transform: translateY(0) scale(0.99);
}

.ag-btn-google:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ag-btn-google .google-icon {
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 0.65rem 0 0.85rem;
  color: var(--ag-text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.auth-divider span {
  padding: 0 0.75rem;
}

.auth-security-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ag-text-secondary);
  font-size: 0.8rem;
  margin: 0.25rem 0 0.75rem;
  padding: 0.45rem 0.65rem;
  background: rgba(30, 122, 69, 0.08);
  border-radius: 10px;
}

.auth-security-note .material-symbols-rounded {
  color: var(--ag-green);
  font-size: 17px;
  flex-shrink: 0;
}

.auth-card .ag-form-group label {
  color: var(--ag-text);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.auth-input {
  background: rgba(255, 255, 255, 0.82) !important;
  border: none !important;
  border-radius: 14px !important;
  padding: 0.95rem 1rem !important;
  font-size: 0.95rem;
  color: var(--ag-text);
}

.auth-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ag-green);
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin: 0.25rem 0 0.75rem;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ag-text-secondary);
  cursor: pointer;
}

.auth-remember input {
  accent-color: var(--ag-green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.auth-link {
  background: transparent;
  border: none;
  color: var(--ag-green);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-submit {
  min-height: 50px;
  border-radius: 13px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--ag-green) !important;
  color: #fff !important;
}

.auth-submit:hover {
  background: var(--ag-forest) !important;
}

.auth-message {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--ag-danger);
  text-align: center;
}
