/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--base-font-size, 14px); scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: #f1f5f9; color: #1e293b; line-height: 1.5; }
a { text-decoration: none; color: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ===== PAGES ===== */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* ===== LOGIN ===== */
.login-container { display: flex; width: 100%; min-height: 100vh; }
.login-left {
  flex: 1; background: linear-gradient(135deg, #065f46 0%, #064e3b 50%, #022c22 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 3rem; color: #fff;
}
.brand-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.login-left h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.25rem; }
.login-left p { font-size: 1.1rem; opacity: 0.85; margin-bottom: 2.5rem; }
.login-features { display: flex; flex-direction: column; gap: 0.75rem; }
.feature-item { display: flex; align-items: center; gap: 0.75rem; font-size: 1rem; opacity: 0.9; }
.feature-item i { color: #6ee7b7; }
.login-right {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem; background: #fff;
}
.login-form-container { width: 100%; max-width: 400px; }
.login-form-container h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-subtitle { color: #64748b; margin-bottom: 2rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.35rem; color: #374151; font-size: 0.875rem; }
.form-input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], textarea, .form-select {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s; background: #fff;
}
.form-input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.12); }
.form-row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: #64748b; cursor: pointer; }
.link { color: #059669; font-size: 0.875rem; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.25rem; border: none;
  border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: #059669; color: #fff; }
.btn-primary:hover { background: #047857; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn-block { width: 100%; justify-content: center; padding: 0.75rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-icon {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.35rem;
  cursor: pointer;
  color: #64748b;
  border-radius: 8px;
  transition: all 0.15s;
}
.btn-icon i { font-size: 0.82rem; }
.btn-icon:hover { background: #e2e8f0; color: #1e293b; border-color: #cbd5e1; }

/* ===== FARM SELECT ===== */
.farm-select-container {
  width: 100%; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem; background: linear-gradient(180deg, #f0fdf4 0%, #f1f5f9 100%);
}
.farm-select-header { text-align: center; margin-bottom: 2.5rem; }
.brand-icon-sm { font-size: 2.5rem; color: #059669; }
.farm-select-header h1 { font-size: 2rem; font-weight: 800; color: #065f46; }
.farm-select-header p { color: #64748b; margin-top: 0.25rem; }
.farm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; max-width: 960px; width: 100%; }
.farm-card {
  background: #fff; border-radius: 12px; padding: 1.5rem; cursor: pointer; border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: all 0.2s; position: relative;
}
.farm-card:hover { border-color: #059669; box-shadow: 0 4px 12px rgba(5,150,105,0.15); transform: translateY(-2px); }
.farm-card-icon { font-size: 2rem; color: #059669; margin-bottom: 0.75rem; }
.farm-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; }
.farm-card-info { display: flex; flex-direction: column; gap: 0.35rem; color: #64748b; font-size: 0.85rem; }
.farm-card-info i { width: 18px; color: #94a3b8; }
.farm-card-badge { position: absolute; top: 1rem; right: 1rem; }
.farm-select-footer { margin-top: 2rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.6rem;
  border-radius: 100px; font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-sold { background: #e2e8f0; color: #475569; }
.badge-lot { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ===== APP LAYOUT ===== */
#app-layout { display: none; }
#app-layout.active { display: flex; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px; height: 100vh; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100; transition: transform 0.3s;
  overflow: hidden;
}
.sidebar-header {
  display: flex; align-items: center; gap: 0.75rem; padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 1.1rem; font-weight: 700;
}
.sidebar-header i { color: #6ee7b7; font-size: 1.5rem; }
.sidebar-toggle { display: none; background: none; border: none; color: #94a3b8; cursor: pointer; margin-left: auto; font-size: 1.1rem; }
.sidebar-farm-info {
  padding: 0.75rem 1rem; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.farm-name { font-size: 0.8rem; font-weight: 600; color: #6ee7b7; }
.btn-change-farm {
  background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 0.72rem;
  display: flex; align-items: center; gap: 0.25rem;
}
.btn-change-farm:hover { color: #e2e8f0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.nav-section-title { padding: 0.75rem 1rem 0.35rem; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 1rem; color: #94a3b8;
  cursor: pointer; transition: all 0.15s; font-size: 0.85rem; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.nav-item.active { background: rgba(5,150,105,0.15); color: #6ee7b7; border-left-color: #059669; }
.nav-item i { width: 20px; text-align: center; font-size: 0.92rem; opacity: 0.95; }
.sidebar-footer {
  padding: 0.75rem 1rem; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 0.65rem; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #059669; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 0.8rem; font-weight: 600; }
.user-role { font-size: 0.65rem; color: #64748b; }
.btn-logout { background: none; border: none; color: #64748b; cursor: pointer; font-size: 1rem; padding: 0.35rem; border-radius: 6px; }
.btn-logout:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: #fff; padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 50;
}
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.25rem; cursor: pointer; color:#475569; }
.topbar-breadcrumb { font-weight: 600; font-size: 1rem; color: #1e293b; }
.topbar-actions { display: flex; gap: 0.5rem; }
.topbar-actions .badge { font-size: 0.72rem; }
.topbar-btn {
  background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #64748b; padding: 0.4rem;
  border-radius: 8px; position: relative;
}
.topbar-btn:hover { background: #f1f5f9; color: #1e293b; }
.notification-badge {
  position: absolute; top: 0; right: 0; width: 16px; height: 16px; background: #ef4444; color: #fff;
  border-radius: 50%; font-size: 0.6rem; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
#beta-badge {
  align-self: center;
  white-space: nowrap;
}

/* ===== CONTENT SECTIONS ===== */
.content-section { display: none; padding: 1.5rem; flex: 1; }
.content-section.active { display: block; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }
.section-header h2 { font-size: 1.5rem; font-weight: 700; color: #0f172a; }
.section-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: #fff; border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e2e8f0;
}
.kpi-icon { width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.bg-blue { background: #dbeafe; color: #2563eb; }
.bg-green { background: #dcfce7; color: #16a34a; }
.bg-yellow { background: #fef3c7; color: #d97706; }
.bg-red { background: #fee2e2; color: #dc2626; }
.bg-pink { background: #fce7f3; color: #db2777; }
.bg-purple { background: #ede9fe; color: #7c3aed; }
.kpi-content { display: flex; flex-direction: column; }
.kpi-label { font-size: 0.82rem; color: #475569; font-weight: 600; }
.kpi-value { font-size: 1.72rem; font-weight: 800; color: #0f172a; line-height: 1.15; letter-spacing: -0.01em; }
.kpi-change { font-size: 0.8rem; font-weight: 600; margin-top: 0.2rem; }
.kpi-change.positive { color: #16a34a; }
.kpi-change.negative { color: #dc2626; }
.kpi-change.neutral { color: #64748b; }

/* ===== CHARTS ===== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.chart-card {
  background: #fff; border-radius: 12px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e2e8f0;
}
.chart-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; color: #374151; }
.chart-placeholder { min-height: 200px; display: flex; align-items: flex-end; justify-content: center; }
.chart-bars { display: flex; gap: 1.25rem; align-items: flex-end; height: 180px; width: 100%; justify-content: center; }
.chart-bars.dual { gap: 0.5rem; }
.chart-bar-group { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.chart-bars.dual .chart-bar-group { flex-direction: column; align-items: center; gap: 0.15rem; }
.chart-header-emphasis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.chart-emphasis-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}
.chart-big-number {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}
.chart-big-number span {
  font-size: 1rem;
  color: #475569;
  font-weight: 700;
}
.chart-trend-up {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.82rem;
  font-weight: 700;
}
.chart-bar {
  width: 40px; background: #059669; border-radius: 6px 6px 0 0; display: flex; align-items: flex-start;
  justify-content: center; transition: all 0.3s; min-height: 20px;
}
.chart-bar span { font-size: 0.72rem; color: #fff; font-weight: 700; padding-top: 4px; white-space: nowrap; }
.chart-bar.active { background: #065f46; }
.chart-bar.income { background: #10b981; width: 32px; }
.chart-bar.expense { background: #ef4444; width: 32px; }
.chart-bar-label { font-size: 0.8rem; color: #475569; font-weight: 600; }
.donut-chart { display: flex; align-items: center; justify-content: center; width: 100%; }
.donut-visual {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  background: conic-gradient(#3b82f6 0 33%, #10b981 33% 58%, #f59e0b 58% 75%, #ef4444 75% 89%, #8b5cf6 89% 96%, #ec4899 96% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.25rem;
}
.donut-center {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  text-align: center;
  line-height: 1.15;
}
.donut-center span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}
.donut-legend { display: flex; flex-direction: column; gap: 0.5rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.96rem; color: #334155; }
.legend-item strong { margin-left: auto; color: #0f172a; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-inline { display: flex; gap: 1.5rem; justify-content: center; margin-top: 0.75rem; font-size: 0.8rem; color: #64748b; }
.chart-legend-inline span { display: flex; align-items: center; gap: 0.35rem; }

.evo-placeholder {
  align-items: stretch;
  min-height: 230px;
}
.evo-chart-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.evo-svg {
  width: 100%;
  height: 210px;
}
.evo-grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}
.evo-area {
  fill: url(#evoAreaGradient);
}
.evo-line {
  fill: none;
  stroke: #059669;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.evo-dot {
  fill: #10b981;
  stroke: #fff;
  stroke-width: 2;
}
.evo-dot-active {
  fill: #047857;
  stroke: #fff;
  stroke-width: 3;
}
.evo-value {
  fill: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-anchor: middle;
}
.evo-value-active {
  fill: #0f172a;
  font-size: 13px;
  font-weight: 800;
}
.evo-xlabels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
  margin-top: -0.1rem;
}
.evo-xlabels span {
  text-align: center;
}

.cash-placeholder {
  align-items: stretch;
  min-height: 230px;
}
.cash-chart-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cash-svg {
  width: 100%;
  height: 210px;
}
.cash-grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}
.cash-area-income { fill: url(#cashIncomeArea); }
.cash-area-expense { fill: url(#cashExpenseArea); }
.cash-area-income-solo { fill: url(#cashIncomeAreaSolo); }
.cash-area-expense-solo { fill: url(#cashExpenseAreaSolo); }
.cash-line-income {
  fill: none;
  stroke: #10b981;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cash-line-expense {
  fill: none;
  stroke: #ef4444;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cash-dot-income,
.cash-dot-expense {
  stroke: #fff;
  stroke-width: 2;
}
.cash-dot-income { fill: #10b981; }
.cash-dot-expense { fill: #ef4444; }
.cash-dot-income-active { fill: #047857; stroke: #fff; stroke-width: 2.5; }
.cash-dot-expense-active { fill: #b91c1c; stroke: #fff; stroke-width: 2.5; }
.cash-xlabels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
}
.cash-xlabels span { text-align: center; }

/* ===== FILTERS ===== */
.filters-bar {
  display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center;
  padding: 0.75rem; background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
}
.search-box {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db;
  border-radius: 8px; flex: 1; min-width: 220px; background: #fff;
}
.search-box i { color: #94a3b8; }
.search-box input { border: none; outline: none; flex: 1; font-size: 0.85rem; }
.form-select {
  padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.85rem;
  background: #fff; color: #374151; cursor: pointer;
}
.select-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.data-table th {
  background: #f8fafc; padding: 0.65rem 0.85rem; text-align: left; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; font-weight: 600;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.data-table th i { margin-left: 0.25rem; font-size: 0.65rem; }
.data-table td {
  padding: 0.65rem 0.85rem; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.row-inactive { opacity: 0.55; }
.brinco-tag { color: #059669; font-weight: 700; }
.text-pink { color: #ec4899; }
.text-blue { color: #3b82f6; }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-warning { color: #d97706; }
.text-muted { color: #64748b; font-size: 0.85rem; }
.actions-cell { white-space: nowrap; }
.table-footer {
  display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem;
  font-size: 0.8rem; color: #64748b; background: #fff; border-radius: 0 0 12px 12px; border: 1px solid #e2e8f0; border-top: none;
}
.pagination { display: flex; gap: 0.25rem; }
.btn-page {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #d1d5db; border-radius: 6px; background: #fff; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-page:hover:not(:disabled) { background: #f1f5f9; }
.btn-page.active { background: #059669; color: #fff; border-color: #059669; }
.btn-page:disabled { opacity: 0.4; cursor: default; }

/* ===== MASS ACTIONS ===== */
.mass-actions {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff;
  padding: 0.75rem 1.5rem; border-radius: 12px; display: flex; gap: 0.75rem; align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 200; font-size: 0.85rem;
}
.mass-actions .btn-outline { color: #e2e8f0; border-color: #475569; }
.mass-actions .btn-outline:hover { background: rgba(255,255,255,0.1); }

/* ===== LOT CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.lot-card {
  background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e2e8f0;
  overflow: hidden; transition: box-shadow 0.2s;
}
.lot-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.lot-card-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.lot-card-header h3 { font-size: 1.05rem; font-weight: 700; }
.lot-card-body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.45rem; }
.lot-stat { display: flex; align-items: center; gap: 0.65rem; font-size: 0.85rem; color: #475569; }
.lot-stat i { width: 18px; text-align: center; color: #94a3b8; font-size: 0.8rem; }
.lot-card-footer { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1.25rem; border-top: 1px solid #f1f5f9; }
.lot-card-footer .btn {
  flex: 1 1 140px;
  justify-content: center;
  min-height: 40px;
  white-space: nowrap;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}
.lot-occupancy {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
}
.lot-occupancy-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.35rem;
}
.lot-occupancy-meta strong {
  font-size: 0.9rem;
  color: #0f172a;
}
.lot-occupancy-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.lot-occupancy-bar div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* ===== LOTE INFO STRIP (modal ver animais) ===== */
.lote-info-strip {
  display: flex; flex-wrap: wrap; gap: 1rem; padding: 0.85rem 1rem;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
}
.lote-strip-item {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: #374151;
}
.lote-strip-item i { color: #059669; font-size: 0.78rem; }

/* ===== PROGRESS BAR ===== */
.progress-bar { width: 80px; height: 6px; background: #e2e8f0; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 0.35rem; }
.progress-fill { height: 100%; background: #059669; border-radius: 3px; transition: width 0.3s; }
.progress-fill.warning { background: #f59e0b; }
.progress-label { font-size: 0.75rem; color: #64748b; font-weight: 600; }

/* ===== ALERTS ===== */
.alerts-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: #374151; }
.alerts-section h3 i { color: #f59e0b; margin-right: 0.35rem; }
.alert-list { display: flex; flex-direction: column; gap: 0.65rem; }
.alert-item {
  display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1rem; border-radius: 10px;
  font-size: 0.85rem; border-left: 4px solid;
}
.alert-item i { font-size: 1.25rem; flex-shrink: 0; }
.alert-item div { flex: 1; }
.alert-item strong { display: block; margin-bottom: 0.15rem; }
.alert-item p { color: #475569; font-size: 0.86rem; margin: 0; }
.alert-time { font-size: 0.75rem; color: #94a3b8; white-space: nowrap; }
.alert-count {
  min-width: 44px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
}
.alert-warning { background: #fffbeb; border-color: #f59e0b; }
.alert-warning i { color: #f59e0b; }
.alert-danger { background: #fef2f2; border-color: #ef4444; }
.alert-danger i { color: #ef4444; }
.alert-info { background: #eff6ff; border-color: #3b82f6; }
.alert-info i { color: #3b82f6; }

/* ===== MANEJO TYPE GRID ===== */
.manejo-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.manejo-type-card {
  background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 1.25rem; text-align: center;
  cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 0.65rem;
}
.manejo-type-card i { font-size: 1.75rem; color: #059669; }
.manejo-type-card span { font-size: 0.85rem; font-weight: 600; color: #374151; line-height: 1.2; }
.manejo-type-card:hover { border-color: #059669; background: #f0fdf4; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(5,150,105,0.12); }

/* ===== MANEJO SUMMARY ===== */
.manejo-summary {
  display: flex; gap: 1.5rem; padding: 0.75rem 1rem; background: #f8fafc; border-radius: 8px;
  margin-top: 0.75rem; font-size: 0.85rem; color: #64748b; flex-wrap: wrap;
}

/* ===== CALENDAR ===== */
.calendar-section { margin-top: 1.5rem; }
.calendar-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: #374151; }
.calendar-items { display: flex; flex-direction: column; gap: 0.65rem; }
.calendar-item {
  display: flex; align-items: center; gap: 1rem; padding: 1rem; background: #fff; border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.calendar-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 52px; background: #f1f5f9; border-radius: 8px; flex-shrink: 0;
}
.cal-day { font-size: 1.25rem; font-weight: 800; color: #0f172a; line-height: 1; }
.cal-month { font-size: 0.6rem; text-transform: uppercase; color: #64748b; font-weight: 600; letter-spacing: 0.05em; }
.calendar-info { flex: 1; }
.calendar-info strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.calendar-info p { font-size: 0.8rem; color: #64748b; margin: 0; }
.calendar-item.overdue { border-left: 4px solid #ef4444; }
.calendar-item.upcoming { border-left: 4px solid #f59e0b; }

/* ===== REPORTS ===== */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.report-card {
  background: #fff; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 0.65rem;
}
.report-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}
.report-card h3 { font-size: 1rem; font-weight: 700; }
.report-card p { font-size: 0.85rem; color: #64748b; flex: 1; }
.reports-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
}

/* ===== MAPA DA PROPRIEDADE ===== */
.property-map-layout {
  display: block;
}
#property-map.leaflet-map-container {
  min-height: 460px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

/* ===== SETTINGS ===== */
.settings-grid { width: 100%; }
.settings-tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.5rem; flex-wrap: wrap; }
.settings-tab {
  padding: 0.65rem 1.25rem; background: none; border: none; cursor: pointer; font-weight: 600;
  font-size: 0.875rem; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.settings-tab:hover { color: #059669; }
.settings-tab.active { color: #059669; border-bottom-color: #059669; }
.settings-content { display: none; }
.settings-content.active { display: block; }
.form-card {
  background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.form-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-grid .form-group { margin-bottom: 0; }
.form-group small { display: block; margin-top: 0.25rem; color: #94a3b8; font-size: 0.75rem; }

.farm-boundary-editor {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.farm-boundary-editor h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}
.farm-boundary-layout {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap: 0.75rem;
}
.farm-boundary-map-wrap {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}
.farm-boundary-map {
  min-height: 320px;
}

#farm-lots-overlay-status {
  font-weight: 600;
  color: #334155;
}

.farm-boundary-editor .section-actions .btn.btn-sm {
  min-width: 38px;
  justify-content: center;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.farm-layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lot-map-editor {
  margin-top: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  background: #f8fafc;
}
.lot-map-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.lot-map-editor-head h4 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}
.lot-map-canvas {
  min-height: 280px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}
.lot-map-editor-actions {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ===== ACESSIBILIDADE ===== */
.visual-scale-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.9rem;
  background: #f8fafc;
}
.visual-scale-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.visual-scale-range {
  width: 100%;
  accent-color: #059669;
}
.visual-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* ===== TAGS ===== */
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.85rem; background: #f1f5f9;
  border-radius: 100px; font-size: 0.85rem; font-weight: 500; color: #374151; border: 1px solid #e2e8f0;
}
.tag-remove {
  background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1rem; padding: 0;
  line-height: 1; transition: color 0.15s;
}
.tag-remove:hover { color: #ef4444; }

/* ===== MODALS ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.2s ease-out;
}
.modal.modal-lg { max-width: 800px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h3 { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #94a3b8;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.modal-close:hover { background: #f1f5f9; color: #1e293b; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #e2e8f0; display: flex; gap: 0.5rem; justify-content: flex-end; }
.form-input-sm { padding: 0.35rem 0.5rem; font-size: 0.8rem; }

/* ===== ANIMAL DETAIL ===== */
.animal-detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; }
.animal-info-card {
  background: #f8fafc; padding: 1.25rem; border-radius: 10px; border: 1px solid #e2e8f0;
}
.animal-info-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; color: #374151; }
.info-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.85rem; border-bottom: 1px solid #f1f5f9; }
.info-row span:first-child { color: #64748b; }
.animal-timeline h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; color: #374151; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-dot {
  position: absolute; left: -1.5rem; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 2px #e2e8f0;
}
.timeline-content { padding-left: 0.5rem; }
.timeline-date { font-size: 0.72rem; color: #94a3b8; font-weight: 500; }
.timeline-content strong { display: block; font-size: 0.85rem; margin: 0.1rem 0; }
.timeline-content p { font-size: 0.8rem; color: #64748b; margin: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .login-container { flex-direction: column; }
  .login-left { padding: 2rem; }
  .login-left h1 { font-size: 1.75rem; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle, .mobile-menu-btn { display: block; }
  .main-content { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .kpi-icon { width: 48px; height: 48px; font-size: 1.2rem; }
  .kpi-value { font-size: 1.5rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .search-box { min-width: 100%; }
  .mass-actions { flex-wrap: wrap; justify-content: center; bottom: 0.75rem; left: 1rem; right: 1rem; transform: none; }
  .animal-detail-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0 0.5rem; }
  .farm-cards { grid-template-columns: 1fr; }
  .property-map-layout { grid-template-columns: 1fr; }
  .donut-chart { flex-direction: column; gap: 0.85rem; align-items: center; }
  .donut-visual { margin-right: 0; }
  .chart-header-emphasis { flex-direction: column; align-items: flex-start; }
  .btn, .btn-sm { min-height: 40px; }
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; justify-content: center; }
  #beta-badge { display: none; }
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }
  .data-table th { white-space: normal; }
  .cards-grid { grid-template-columns: 1fr; }
  .lot-card-footer { flex-wrap: wrap; }
  .lot-card-footer .btn { min-width: 120px; }
  .farm-boundary-layout { grid-template-columns: 1fr; }
  .lot-map-editor-head,
  .lot-map-editor-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .manejo-type-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-big-number { font-size: 1.65rem; }
  .alert-item { align-items: flex-start; }
  .alert-count { min-width: 40px; height: 30px; font-size: 0.95rem; }
  .table-container { border-radius: 10px; }
}

/* ===== MODAL XL (mapa de áreas) ===== */
.modal-xl {
  width: min(1080px, 96vw);
  max-width: 96vw;
}
.modal-xl .modal-body {
  padding: 0;
}

/* ===== LAYOUT FORM + MAPA ===== */
.area-form-layout {
  display: flex;
  height: 540px;
}
.area-form-fields {
  width: 320px;
  min-width: 260px;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
}
.area-form-map {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== LEAFLET MAP CONTAINER ===== */
.leaflet-map-container {
  flex: 1;
  height: 100%;
  min-height: 400px;
  background: #e8f5e9;
}

/* ===== GPS RESULT BOX ===== */
.gps-result-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}
.gps-result-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #15803d;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.gps-coords-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 180px;
  overflow-y: auto;
}
.gps-coord-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #d1fae5;
}
.gps-coord-index {
  background: #16a34a;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.gps-coord-val {
  color: #374151;
  font-family: monospace;
  font-size: 0.78rem;
}

/* ===== LAYER TOGGLE ===== */
.layer-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.layer-toggle:hover { background: #f3f4f6; }

.map-legend {
  background: rgba(255,255,255,0.96);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  padding: 0.55rem 0.65rem;
  font-size: 0.76rem;
  color: #334155;
  line-height: 1.25;
  min-width: 150px;
}
.map-legend-toggle {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 0.35rem;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}
.map-legend-toggle:hover {
  background: #e2e8f0;
}
.map-legend-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #0f172a;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.18rem;
}
.map-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.map-legend-swatch.swatch-farm {
  background: #2563eb;
}
.map-legend-swatch.swatch-area {
  background: #059669;
}
.map-legend-swatch.swatch-invalid {
  background: #dc2626;
}
.map-legend-swatch.swatch-selected {
  background: #f59e0b;
}

.btn.active {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #60a5fa;
}

.distance-tooltip {
  background: #1e40af;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  padding: 4px 8px;
}

/* ===== INFO ROW (modal visualização) ===== */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #6b7280;
}
.info-row strong { color: #111827; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  pointer-events: auto;
  animation: toastIn 0.28s ease;
  min-width: 220px;
  max-width: 360px;
}
.toast.toast-hide {
  animation: toastOut 0.28s ease forwards;
}
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info    { background: #2563eb; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}

/* ===== MOBILE: modal-xl vira scroll ===== */
@media (max-width: 768px) {
  .modal-xl { width: 100%; margin: 0; border-radius: 0; }
  .area-form-layout { flex-direction: column; height: auto; }
  .area-form-fields { width: 100%; border-right: none; border-bottom: 1px solid #e5e7eb; }
  .leaflet-map-container { min-height: 280px; }
  .modal-lg { width: 98%; max-width: none; }
}

/* ===== DETAIL GRID 2-COL ===== */
.detail-grid-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 1.5rem;
}
@media (max-width: 600px) { .detail-grid-2col { grid-template-columns: 1fr; } }

/* ===== EDIT INFO BOX ===== */
.edit-info-box {
  display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem;
  background: #eff6ff; border-left: 3px solid #3b82f6; border-radius: 6px; margin-top: 0.75rem;
  font-size: 0.85rem; color: #1e40af;
}
.edit-info-box i { margin-top: 2px; }

/* ===== MODAL LG (wider) ===== */
.modal-lg { width: 720px; max-width: 95vw; }

/* ===== BTN DANGER ===== */
.btn-danger {
  background: #dc2626; color: #fff; border: none;
}
.btn-danger:hover { background: #b91c1c; }

