/* ============================================================
   AGRO COMMAND CENTER — Custom CSS over Radzen
   Sections:
     1. Tokens & resets
     2. Typography
     3. Shell (sidebar + topbar)
     4. Cards, panels, surfaces
     5. KPI, badges, status pills
     6. Map mock, field cards
     7. Tables/lists
     8. Drawer + forms
     9. Tabs (expediente)
    10. Mobile / field
    11. Utilities & animations
   ============================================================ */

/* ------- 1. TOKENS ------- */
:root {
  /* Surfaces — warm, agricultural, premium */
  --agro-bg:           #f4efe6;   /* marfil / arena claro */
  --agro-bg-soft:      #ebe4d6;
  --agro-surface:      #fbf8f2;   /* blanco cálido */
  --agro-surface-2:    #f7f2e8;
  --agro-surface-alt:  var(--agro-surface-2);
  --agro-line:         #e2d9c6;
  --agro-line-strong:  #c9bea4;
  --agro-border:       var(--agro-line);
  --agro-border-strong: var(--agro-line-strong);

  /* Primary palette — olive + sage */
  --agro-primary:      #4f6b3a;   /* verde olivo profundo */
  --agro-primary-700:  #3f5630;
  --agro-primary-800:  #2f4124;
  --agro-primary-50:   #eaf0df;
  --agro-sage:         #8fa67a;   /* verde salvia */
  --agro-sage-soft:    #c8d4b6;

  /* Semantics */
  --agro-water:        #2f7c83;   /* teal — riego */
  --agro-water-soft:   #cfe4e6;
  --agro-warn:         #c98a2b;   /* ámbar climático */
  --agro-warn-soft:    #f4e3c3;
  --agro-risk:         #a8412a;   /* rojo arcilla */
  --agro-risk-soft:    #efd2c8;
  --agro-ok:           #5c8a4a;
  --agro-ok-soft:      #d8e6c8;

  /* Text */
  --agro-ink:          #22251f;   /* grafito */
  --agro-ink-2:        #4a4f44;   /* texto principal */
  --agro-text:         var(--agro-ink-2);
  --agro-muted:        #7b7f72;   /* pizarra */
  --agro-faint:        #9a9d8f;

  /* Shape */
  --agro-radius-sm: 6px;
  --agro-radius:    10px;
  --agro-radius-lg: 14px;

  /* Shadow */
  --agro-shadow-1: 0 1px 0 rgba(34,37,31,.04), 0 1px 2px rgba(34,37,31,.04);
  --agro-shadow-2: 0 1px 0 rgba(34,37,31,.04), 0 6px 18px -8px rgba(34,37,31,.18);
  --agro-shadow-pop: 0 8px 28px -10px rgba(34,37,31,.28), 0 2px 6px rgba(34,37,31,.06);

  /* Type */
  --agro-font-sans: "IBM Plex Sans", "Inter", system-ui, -apple-system, sans-serif;
  --agro-font-display: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  --agro-font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --agro-density: 1;
  --agro-gap: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--agro-font-sans);
  background: var(--agro-bg);
  color: var(--agro-ink-2);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  font-size: 14px;
  line-height: 1.45;
}

button { font: inherit; color: inherit; }

/* ------- 2. TYPOGRAPHY ------- */
.agro-display { font-family: var(--agro-font-display); font-weight: 600; letter-spacing: -0.015em; color: var(--agro-ink); }
.agro-h1 { font-family: var(--agro-font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--agro-ink); margin: 0; }
.agro-h2 { font-family: var(--agro-font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--agro-ink); margin: 0; }
.agro-h3 { font-size: 13px; font-weight: 600; color: var(--agro-ink); margin: 0; }
.agro-eyebrow {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--agro-muted); font-weight: 600;
}
.agro-num { font-family: var(--agro-font-display); font-variant-numeric: tabular-nums; }
.agro-mono { font-family: var(--agro-font-mono); }

/* ------- 3. SHELL ------- */
.agro-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  background: var(--agro-bg);
}
.agro-shell:has(.agro-sidebar[data-mode="icons"]) { grid-template-columns: 64px 1fr; }
.agro-shell:has(.agro-sidebar[data-mode="wide"]) { grid-template-columns: 296px 1fr; }

/* Sidebar */
.agro-sidebar {
  grid-row: 1 / -1;
  background: linear-gradient(180deg, #2f4124 0%, #283921 100%);
  color: #d6dac9;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(0,0,0,.12);
  position: relative;
}
.agro-sidebar::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 30% at 10% 0%, rgba(143,166,122,.18), transparent 70%),
    radial-gradient(40% 40% at 100% 100%, rgba(47,124,131,.12), transparent 70%);
  pointer-events: none;
}
.agro-sidebar > * { position: relative; z-index: 1; }
.agro-sidebar-brand {
  padding: 18px 18px 14px;
  display: flex; align-items: center; gap: 11px;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.agro-brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(160deg, #8fa67a, #4f6b3a);
  display: grid; place-items: center;
  color: #f4efe6; font-family: var(--agro-font-display); font-weight: 700; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 2px 8px rgba(0,0,0,.25);
  letter-spacing: -0.04em;
}
.agro-brand-name { font-family: var(--agro-font-display); font-weight: 600; font-size: 14px; color: #f4efe6; letter-spacing: -0.01em; }
.agro-brand-sub  { font-size: 10.5px; color: #9bab86; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 1px; }
.agro-brand-copy,
.agro-campaign-copy,
.agro-user-copy { flex: 1; min-width: 0; }
.agro-brand-name,
.agro-brand-sub,
.agro-campaign-pill .val,
.agro-user-name,
.agro-user-role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agro-campaign-pill {
  margin: 14px 14px 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 9px;
  position: relative;
}
.agro-campaign-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #c2d49e;
  box-shadow: 0 0 0 3px rgba(194,212,158,.15);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(194,212,158,.15); }
  50% { box-shadow: 0 0 0 6px rgba(194,212,158,.05); }
}
.agro-campaign-pill .lbl { font-size: 10px; color: #9bab86; letter-spacing: 0.1em; text-transform: uppercase; }
.agro-campaign-pill .val { font-size: 12.5px; color: #f4efe6; font-weight: 500; }

.agro-nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; position: relative; }
.agro-nav-group { margin-top: 14px; }
.agro-nav-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  cursor: pointer;
}
.agro-nav-group-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.18em;
  color: #7f8d6c; text-transform: uppercase;
  padding: 6px 10px 6px;
  flex: 1;
  min-width: 0;
  text-align: left;
}
.agro-nav-group-chevron {
  color: #7f8d6c;
  margin-right: 8px;
  flex-shrink: 0;
}
.agro-nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agro-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: #c4cbb1;
  transition: background 120ms ease, color 120ms ease;
  position: relative;
  text-decoration: none;
  min-width: 0;
}
.agro-nav-item span:not(.badge):not(.ico) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agro-nav-item-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.agro-nav-item-hint {
  font-size: 10.5px;
  color: #8a917a;
  opacity: .85;
  line-height: 1.2;
}
.agro-nav-item.is-active .agro-nav-item-hint,
.agro-nav-item.active .agro-nav-item-hint { color: #aeb79a; }
.agro-nav-item:hover { background: rgba(255,255,255,.04); color: #f4efe6; }
.agro-nav-item.is-active,
.agro-nav-item.active {
  background: rgba(143,166,122,.16);
  color: #f4efe6;
  font-weight: 500;
}
.agro-nav-item.is-active::before,
.agro-nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  background: #c2d49e; border-radius: 0 3px 3px 0;
}
.agro-nav-item .ico { opacity: .85; flex-shrink: 0; }
.agro-nav-item .badge {
  margin-left: auto; font-size: 10.5px; padding: 1px 6px; border-radius: 99px;
  background: rgba(168,65,42,.85); color: #f8e9e3;
  min-width: 16px; text-align: center;
}
.agro-nav-item .badge.warn { background: rgba(201,138,43,.85); color: #1a1612; }
.agro-nav-item .badge.info { background: rgba(143,166,122,.3); color: #e7eed8; }

.agro-sidebar-foot {
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
  position: relative;
}
.agro-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(140deg, #8fa67a, #2f7c83);
  color: #fbf8f2; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; font-family: var(--agro-font-display);
}
.agro-user-name { font-size: 12.5px; color: #f4efe6; }
.agro-user-role { font-size: 10.5px; color: #9bab86; }
.agro-sidebar-collapse {
  width: calc(100% - 28px);
  margin: 0 14px 10px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: #9bab86;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.agro-sidebar-collapse:hover,
.agro-sidebar-logout:hover {
  background: rgba(255,255,255,.07);
  color: #f4efe6;
}
.agro-sidebar-logout {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9bab86;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.agro-sidebar[data-mode="icons"] .agro-brand-copy,
.agro-sidebar[data-mode="icons"] .agro-campaign-copy,
.agro-sidebar[data-mode="icons"] .agro-nav-item span:not(.badge):not(.ico),
.agro-sidebar[data-mode="icons"] .agro-nav-group-label,
.agro-sidebar[data-mode="icons"] .agro-nav-group-chevron,
.agro-sidebar[data-mode="icons"] .agro-user-copy,
.agro-sidebar[data-mode="icons"] .agro-sidebar-logout { display: none; }
.agro-sidebar[data-mode="icons"] .agro-sidebar-brand,
.agro-sidebar[data-mode="icons"] .agro-campaign-pill,
.agro-sidebar[data-mode="icons"] .agro-nav-item,
.agro-sidebar[data-mode="icons"] .agro-sidebar-foot { justify-content: center; }
.agro-sidebar[data-mode="icons"] .agro-nav { padding-left: 9px; padding-right: 9px; }
.agro-sidebar[data-mode="icons"] .agro-nav-group { margin-top: 8px; }
.agro-sidebar[data-mode="icons"] .agro-nav-group-toggle { display: none; }
.agro-sidebar[data-mode="icons"] .agro-nav-item { gap: 0; padding: 9px; }
.agro-sidebar[data-mode="icons"] .agro-sidebar-collapse { width: 34px; margin-left: auto; margin-right: auto; }

/* Topbar */
.agro-main {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  justify-self: stretch;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  flex: initial;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.agro-shell > main.agro-main {
  flex: 0 0 auto;
  width: 100%;
}
.agro-main-inner {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 28px 60px;
}
.agro-topbar {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  justify-self: stretch;
  align-self: stretch;
  height: 56px;
  background: var(--agro-surface);
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  min-width: 0;
}
.agro-crumb { display: flex; align-items: center; gap: 8px; color: var(--agro-muted); font-size: 12.5px; }
.agro-crumb b { color: var(--agro-ink); font-weight: 500; }
.agro-crumb-sep { color: var(--agro-faint); }

.agro-field-crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--agro-muted); flex-wrap: wrap; margin-bottom: 10px; }
.agro-field-crumb-sep { color: var(--agro-faint); }
.agro-field-crumb-link { color: var(--agro-muted); text-decoration: none; transition: color 120ms ease; }
.agro-field-crumb-link:hover { color: var(--agro-ink); text-decoration: underline; }
.agro-field-crumb-current { color: var(--agro-ink); font-weight: 600; }

.agro-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  border-radius: 8px; padding: 6px 10px;
  flex: 1; max-width: 460px;
  color: var(--agro-muted); font-size: 12.5px;
}
.agro-search input {
  border: 0; background: transparent; outline: 0;
  width: 100%; color: var(--agro-ink); font: inherit;
}
.agro-search kbd {
  font-family: var(--agro-font-mono); font-size: 10.5px;
  background: var(--agro-surface); border: 1px solid var(--agro-line);
  padding: 1px 5px; border-radius: 4px; color: var(--agro-muted);
}

.agro-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.agro-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  display: grid; place-items: center; color: var(--agro-muted);
  cursor: pointer; position: relative;
}
.agro-icon-btn:hover { background: var(--agro-bg-soft); color: var(--agro-ink); }
.agro-icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--agro-risk); border: 2px solid var(--agro-surface);
}

.agro-weather-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 11px; border-radius: 99px;
  background: var(--agro-primary-50);
  border: 1px solid var(--agro-sage-soft);
  font-size: 12px; color: var(--agro-primary-800);
}
.agro-weather-pill span b { font-weight: 600; }
.agro-weather-pill .div { color: var(--agro-sage); }
.agro-district-pill,
.agro-context-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  color: var(--agro-muted);
  font-size: 12px;
}
.agro-context-pill span {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--agro-ink);
  font-family: var(--agro-font-mono);
  font-size: 11px;
}
.agro-district-pill .district-select {
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--agro-ink);
  font: inherit;
  max-width: 88px;
}
.agro-units-toggle {
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  background: var(--agro-surface-2);
  color: var(--agro-primary-800);
  font-family: var(--agro-font-mono);
  font-size: 11px;
  cursor: pointer;
}
.agro-units-toggle:hover { border-color: var(--agro-sage-soft); background: var(--agro-primary-50); }
.agro-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.agro-quick-action {
  position: relative;
}
.agro-quick-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 50;
  width: 260px;
  padding: 6px;
  border: 1px solid var(--agro-line);
  border-radius: 10px;
  background: var(--agro-surface);
  box-shadow: var(--agro-shadow-pop);
}
.agro-quick-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: center;
  text-align: left;
  color: var(--agro-ink-2);
  cursor: pointer;
}
.agro-quick-menu button:hover {
  background: var(--agro-bg-soft);
}
.agro-quick-menu .ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--agro-primary-50);
  color: var(--agro-primary);
}
.agro-quick-menu b {
  display: block;
  font-size: 12.5px;
  color: var(--agro-ink);
}
.agro-quick-menu small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--agro-muted);
}

/* Page area */
.agro-page {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 22px 28px 60px;
}
.agro-page-header {
  display: flex; align-items: flex-end; gap: 20px; margin-bottom: 22px;
}
.agro-page-header-left { flex: 1; }
.agro-page-title { font-family: var(--agro-font-display); font-size: 26px; font-weight: 600; color: var(--agro-ink); margin: 0; letter-spacing: -0.02em; }
.agro-page-subtitle { color: var(--agro-muted); font-size: 13px; margin-top: 4px; }
.agro-page-actions { display: flex; gap: 8px; }

/* V3 workspace primitives (Phase 0 foundation) */
.agro-command-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}
.agro-command-header-main {
  flex: 1;
  min-width: 0;
}
.agro-command-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.agro-command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.agro-command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.agro-catalog-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.agro-catalog-card {
  overflow: hidden;
}
.agro-catalog-kpis {
  padding: 14px 16px 0;
  border-bottom: 1px solid var(--agro-line);
}
.agro-catalog-kpis .agro-kpi-strip {
  margin-bottom: 14px;
}
.agro-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
  min-width: 0;
  flex-wrap: wrap;
}
.agro-filterbar-label {
  margin-right: 2px;
}
.agro-filterbar-search {
  min-width: 220px;
}
.agro-filterbar-content,
.agro-filterbar-trailing {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.agro-filterbar-spacer {
  flex: 1;
  min-width: 12px;
}
.agro-state {
  padding: 38px 18px;
  text-align: center;
  color: var(--agro-muted);
}
.agro-state svg {
  color: var(--agro-faint);
}
.agro-state.is-error svg,
.agro-state.is-error .agro-state-title {
  color: var(--agro-risk);
}
.agro-state.is-loading svg {
  color: var(--agro-water);
  transform-origin: center;
  animation: agro-spin .8s linear infinite;
}
.agro-state-title {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--agro-ink);
}
.agro-state-message {
  max-width: 520px;
  margin: 4px auto 0;
  font-size: 12.5px;
}
.agro-state-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.agro-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.agro-kpi-strip-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.agro-kpi-strip-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.agro-kpi-strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agro-kpi-strip-compact {
  gap: 12px;
  margin-bottom: 14px;
}
.agro-date-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  background: var(--agro-surface);
  color: var(--agro-ink);
  padding: 7px 10px;
  font: inherit;
}
.agro-operational-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
  gap: 16px;
  align-items: start;
}
.agro-operational-main,
.agro-operational-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.agro-center-shell {
  min-width: 0;
}
.agro-center-shell .agro-operational-layout > .agro-operational-main > .agro-operational-layout {
  grid-template-columns: minmax(0, 1fr);
}
.agro-center-shell .agro-operational-layout > .agro-operational-main > .agro-operational-layout > .agro-operational-aside {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.agro-center-status-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}
.agro-search-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
  min-width: 0;
}
.agro-search-pagination-search {
  min-width: 220px;
}
.agro-search-pagination-filters,
.agro-search-pagination-actions,
.agro-search-pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.agro-search-pagination-spacer {
  flex: 1;
  min-width: 12px;
}
.agro-search-pagination-summary,
.agro-search-pagination-page {
  color: var(--agro-muted);
  font-size: 12px;
  white-space: nowrap;
}
.agro-entity-list {
  min-width: 0;
}
.agro-entity-list-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-entity-list-items {
  display: flex;
  flex-direction: column;
  padding: 6px;
}
.agro-entity-list-row {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 10px;
  cursor: pointer;
}
.agro-entity-list-row:hover:not(:disabled),
.agro-entity-list-row:focus-visible:not(:disabled) {
  background: var(--agro-primary-50);
  outline: none;
}
.agro-entity-list-row:disabled {
  cursor: default;
}
.agro-action-list,
.agro-related-masters {
  min-width: 0;
}
.agro-action-list-head,
.agro-related-masters-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
  color: var(--agro-primary);
}
.agro-action-list-title,
.agro-related-masters-title {
  color: var(--agro-ink);
  font-family: var(--agro-font-display);
  font-size: 14px;
  font-weight: 600;
}
.agro-action-list-subtitle,
.agro-related-masters-subtitle {
  color: var(--agro-muted);
  font-size: 11.5px;
  margin-top: 2px;
}
.agro-action-list-items,
.agro-related-masters-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 12px;
}
.agro-action-list-item,
.agro-related-master-link {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  background: var(--agro-surface);
  color: var(--agro-ink);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.agro-action-list-item:hover:not(:disabled),
.agro-action-list-item:focus-visible:not(:disabled),
.agro-related-master-link:hover:not(:disabled),
.agro-related-master-link:focus-visible:not(:disabled) {
  border-color: var(--agro-primary);
  background: var(--agro-primary-50);
  outline: none;
}
.agro-action-list-item:disabled,
.agro-related-master-link:disabled {
  cursor: default;
  opacity: .62;
}
.agro-action-list-label,
.agro-related-master-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}
.agro-action-list-description,
.agro-related-master-description {
  display: block;
  color: var(--agro-muted);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 2px;
}
.agro-card-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}
.agro-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font-size: 12.5px;
  white-space: nowrap;
}
.text-right { text-align: right; }
.agro-table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.agro-detail-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
}
.agro-detail-inline div {
  display: grid;
  gap: 3px;
}
.agro-detail-inline strong {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--agro-muted);
  letter-spacing: 0;
}
.agro-stack-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 12px 12px;
}
.agro-stack-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border: 0;
  border-bottom: 1px solid var(--agro-line);
  background: transparent;
  color: var(--agro-ink);
  text-align: left;
  cursor: pointer;
}
.agro-stack-item:hover { background: var(--agro-surface-2); }
.agro-stack-item b,
.agro-stack-item strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
}
.agro-stack-item small {
  display: block;
  margin-top: 3px;
  color: var(--agro-muted);
  font-size: 11.5px;
}
.agro-stack-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}
.agro-center-tile {
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  padding: 12px;
}
.agro-center-tile b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.agro-dashboard-lots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}
.agro-dashboard-gap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 10px 12px;
  border: 1px dashed var(--agro-line-strong);
  border-radius: 8px;
  background: var(--agro-surface-2);
  color: var(--agro-muted);
  font-size: 12px;
}
.agro-dashboard-alerts {
  padding: 6px 14px 14px;
}
.agro-dashboard-alert-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--agro-line);
  font-size: 12.5px;
}
.agro-dashboard-alert-row:last-child {
  border-bottom: 0;
}
.agro-dashboard-alert-row span:last-child {
  min-width: 0;
  color: var(--agro-ink-2);
}
.agro-dashboard-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
}
.agro-dashboard-actions .agro-btn {
  justify-content: flex-start;
}
.agro-weather-day {
  flex: 1;
  min-width: 88px;
  text-align: center;
  padding: 10px 8px;
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  background: var(--agro-surface);
}
.agro-dashboard-gap-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
  color: var(--agro-muted);
  font-size: 12.5px;
}
.agro-dashboard-gap-list b {
  color: var(--agro-ink);
}
.agro-today-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
/* 6 KPIs → balanceado: 3+3 en laptop para no quedar desnivelado */
@media (max-width: 1280px) {
  .agro-today-kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Compatibility utilities used by existing Agriculture pages until Phases 3-5 migrate them. */
.agro-row { display: flex; align-items: center; gap: var(--agro-gap); min-width: 0; }
.agro-col { display: flex; flex-direction: column; gap: var(--agro-gap); min-width: 0; }
.agro-grid { display: grid; gap: var(--agro-gap); min-width: 0; }
.agro-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.agro-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agro-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) {
  .agro-grid.cols-4,
  .agro-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .agro-grid.cols-4,
  .agro-grid.cols-3,
  .agro-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
}

/* List pattern V3 */
.agro-list-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.agro-list-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.agro-list-header-main { min-width: 0; }
.agro-list-header .agro-eyebrow { margin-bottom: 4px; }
.agro-list-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.agro-list-subtitle { color: var(--agro-muted); font-size: 13px; margin-top: 4px; }
.agro-list-card { overflow: hidden; }
.agro-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
}
.agro-list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 420px;
  min-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  background: var(--agro-surface);
  color: var(--agro-muted);
}
.agro-list-search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--agro-ink);
  font: inherit;
  font-size: 13px;
}
.agro-list-spacer { flex: 1; }
.agro-list-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--agro-muted);
}
/* Reusable inline loading spinner — pair with a "Cargando…" label in .agro-list-state. */
.agro-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--agro-line, #d9d9d9);
  border-top-color: var(--agro-accent, #2f7c83);
  border-radius: 50%;
  margin-right: 9px;
  vertical-align: -3px;
  animation: agro-spin .7s linear infinite;
}
@keyframes agro-spin { to { transform: rotate(360deg); } }
.agro-list-state.is-empty {
  padding: 38px 18px;
  background: linear-gradient(180deg, rgba(143,166,122,.06), transparent);
}
.agro-table-wrap { overflow-x: auto; }
.agro-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
}
@media (max-width: 720px) {
  .agro-list-header,
  .agro-filter-bar,
  .agro-list-footer { align-items: stretch; flex-direction: column; }
  .agro-list-header-actions { justify-content: flex-start; }
  .agro-list-search { max-width: none; min-width: 0; width: 100%; }
}

/* Edit/New pattern V3 (Phase 4) */
.agro-edit-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 960px;
}
.agro-edit-page.is-wide { max-width: 1240px; }
.agro-edit-page .agro-crumb { font-size: 12.5px; }
.agro-edit-page .agro-crumb-back {
  color: var(--agro-muted);
  text-decoration: none;
  cursor: pointer;
}
.agro-edit-page .agro-crumb-back:hover { color: var(--agro-ink); }
.agro-edit-page .agro-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 0;
  margin: 0;
}
.agro-edit-page .agro-page-header-left { min-width: 0; }
.agro-edit-page .agro-page-header .agro-eyebrow { margin-bottom: 4px; }
.agro-edit-page .agro-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agro-edit-page .agro-form-section { margin-bottom: 0; }
.agro-edit-page .agro-form-footer-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--agro-line);
}
.agro-edit-page .agro-form-footer-inline .grow { flex: 1; }
@media (max-width: 720px) {
  .agro-edit-page .agro-page-header { align-items: stretch; flex-direction: column; }
  .agro-edit-page .agro-page-actions { justify-content: flex-start; }
  .agro-edit-page .agro-form-footer-inline { flex-direction: column; align-items: stretch; }
}

/* ------- 4. CARDS, PANELS ------- */
.agro-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  box-shadow: var(--agro-shadow-1);
  position: relative;
}
.agro-card > .head {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-card > .head > div:first-child { flex: 1; min-width: 0; }
.agro-card > .head .title {
  font-family: var(--agro-font-display);
  font-weight: 600;
  color: var(--agro-ink);
  font-size: 14px;
}
.agro-card > .head .subtitle { color: var(--agro-muted); font-size: 11.5px; margin-top: 2px; }
.agro-card > .head .actions { display: flex; align-items: center; gap: 8px; }
.agro-card > .body { padding: 14px 16px; }
.agro-card.pad-none > .body { padding: 0; }
.agro-card-hd {
  padding: 14px 16px 10px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-card-hd .title { font-family: var(--agro-font-display); font-weight: 600; color: var(--agro-ink); font-size: 14px; letter-spacing: -0.005em; }
.agro-card-hd .sub   { font-size: 11px; color: var(--agro-muted); }
.agro-card-hd .spacer { flex: 1; }
.agro-card-hd .link  {
  font-size: 12px; color: var(--agro-primary); cursor: pointer; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.agro-card-hd .link:hover { color: var(--agro-primary-700); }
.agro-card-bd { padding: 14px 16px; }

/* Button (Radzen override + native) */
.agro-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 8px;
  background: var(--agro-surface); border: 1px solid var(--agro-line);
  color: var(--agro-ink-2); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all 120ms ease;
}
.agro-btn:hover { background: var(--agro-bg-soft); border-color: var(--agro-line-strong); }
.agro-btn.kind-primary,
.agro-btn.kind-accent,
.agro-btn.is-primary {
  background: var(--agro-primary); color: #f4efe6;
  border-color: var(--agro-primary-700);
  box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.08);
}
.agro-btn.kind-primary:hover,
.agro-btn.kind-accent:hover,
.agro-btn.is-primary:hover { background: var(--agro-primary-700); }
.agro-btn.kind-secondary { background: var(--agro-surface); color: var(--agro-ink-2); border-color: var(--agro-line); }
.agro-btn.kind-danger { background: var(--agro-risk); color: #fbf8f2; border-color: var(--agro-risk); }
.agro-btn.kind-ghost,
.agro-btn.is-ghost { background: transparent; border-color: transparent; color: var(--agro-muted); }
.agro-btn.kind-ghost:hover,
.agro-btn.is-ghost:hover { background: var(--agro-bg-soft); color: var(--agro-ink); }
.agro-btn.is-water { background: var(--agro-water); color: #fbf8f2; border-color: #246369; }
.agro-btn.is-water:hover { background: #246369; }
.agro-btn.size-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.agro-btn.size-lg { padding: 9px 15px; font-size: 13px; }

.agro-segment,
.agro-field-radio {
  display: inline-flex; padding: 3px; border-radius: 8px;
  background: var(--agro-bg-soft); border: 1px solid var(--agro-line);
}
.agro-segment > button,
.agro-field-radio > button {
  border: 0; background: transparent; padding: 5px 11px; font-size: 12px;
  border-radius: 6px; color: var(--agro-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.agro-segment > button.is-active,
.agro-field-radio > button.is-active,
.agro-field-radio > button.active {
  background: var(--agro-surface); color: var(--agro-ink);
  box-shadow: var(--agro-shadow-1);
}

/* ------- 5. KPI, BADGES, STATUS PILLS ------- */
.agro-kpi {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  box-shadow: var(--agro-shadow-1);
}
.agro-kpi::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--agro-sage);
}
.agro-kpi.t-water::after { background: var(--agro-water); }
.agro-kpi.t-warn::after { background: var(--agro-warn); }
.agro-kpi.t-risk::after { background: var(--agro-risk); }
.agro-kpi.t-ok::after { background: var(--agro-ok); }

.agro-kpi-label {
  font-size: 11px; color: var(--agro-muted);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
.agro-kpi-value {
  font-family: var(--agro-font-display); font-size: 28px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px;
}
.agro-kpi-value .unit { font-size: 13px; font-weight: 500; color: var(--agro-muted); letter-spacing: 0; }
.agro-kpi-delta {
  font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px;
  color: var(--agro-ok); font-weight: 500;
}
.agro-kpi-delta.down { color: var(--agro-risk); }
.agro-kpi-foot { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; }

/* Spark line svg */
.agro-spark { display: block; margin-top: 4px; }

/* Status pills (badges) */
.agro-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500;
  background: var(--agro-bg-soft); color: var(--agro-ink-2);
  border: 1px solid var(--agro-line);
}
.agro-pill .pdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.agro-pill.t-ok    { background: var(--agro-ok-soft);    color: #355a26; border-color: #bccfa6; }
.agro-pill.t-warn  { background: var(--agro-warn-soft);  color: #7a5210; border-color: #e7ce9a; }
.agro-pill.t-risk  { background: var(--agro-risk-soft);  color: #6f2614; border-color: #e0b3a4; }
.agro-pill.t-water { background: var(--agro-water-soft); color: #1d5961; border-color: #b0cfd2; }
.agro-pill.t-sage  { background: var(--agro-primary-50); color: var(--agro-primary-800); border-color: var(--agro-sage-soft); }

/* ------- 6. MAP MOCK + FIELD CARDS ------- */
.agro-map {
  position: relative; height: 300px; border-radius: 10px; overflow: hidden;
  background:
    radial-gradient(120% 80% at 100% 0%, #d8e0c2 0%, #cad2b3 35%, #b8c39a 70%, #a7b385 100%);
  border: 1px solid var(--agro-line);
}
.agro-map.t-tall { height: 460px; }
.agro-map-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(34,37,31,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,37,31,.06) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  pointer-events: none;
}
.agro-map-river {
  position: absolute; left: -10%; top: 38%; width: 130%; height: 26px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(47,124,131,.55) 30%, rgba(47,124,131,.7) 60%, transparent 100%);
  transform: rotate(-6deg);
  filter: blur(0.3px);
}
.agro-map-road {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.agro-map-road svg { width: 100%; height: 100%; }

.agro-plot {
  position: absolute; cursor: pointer;
  border-radius: 4px;
  background: rgba(79,107,58,.55);
  border: 1.5px solid rgba(79,107,58,.85);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  display: grid; place-items: end start;
  padding: 6px 7px;
  color: #f4efe6;
}
.agro-plot:hover {
  transform: translateY(-2px); z-index: 3;
  box-shadow: 0 12px 24px -10px rgba(0,0,0,.4);
  background: rgba(79,107,58,.78);
}
.agro-plot.t-warn { background: rgba(201,138,43,.55); border-color: rgba(201,138,43,.9); }
.agro-plot.t-risk { background: rgba(168,65,42,.55);  border-color: rgba(168,65,42,.9); }
.agro-plot.t-ok   { background: rgba(92,138,74,.55);  border-color: rgba(92,138,74,.85); }
.agro-plot.t-water{ background: rgba(47,124,131,.55); border-color: rgba(47,124,131,.85); }
.agro-plot.is-selected { outline: 2px solid #fbf8f2; outline-offset: 2px; }

.agro-plot-tag {
  position: absolute; bottom: 4px; left: 6px;
  font-family: var(--agro-font-display); font-weight: 600;
  font-size: 11px; letter-spacing: -0.005em;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.agro-plot-ha {
  position: absolute; top: 4px; right: 6px;
  font-size: 9.5px; opacity: .9;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.agro-map-legend {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(251,248,242,.92);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  padding: 7px 10px; backdrop-filter: blur(4px);
  display: flex; gap: 12px; font-size: 11px;
}
.agro-map-legend i {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 2px; margin-right: 4px; vertical-align: -1px;
}

.agro-map-compass {
  position: absolute; top: 12px; right: 12px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(251,248,242,.92);
  border: 1px solid var(--agro-line);
  display: grid; place-items: center;
  font-family: var(--agro-font-display); font-size: 11px; font-weight: 600;
  color: var(--agro-ink); backdrop-filter: blur(4px);
}

/* Field card */
.agro-field-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--agro-shadow-1);
  transition: transform 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
}
.agro-field-card:hover { transform: translateY(-2px); box-shadow: var(--agro-shadow-2); }
.agro-field-card-img {
  height: 110px; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 80% at 30% 0%, #d8e0c2 0%, #b8c39a 70%, #a7b385 100%);
}
.agro-field-card-img.t-warn { background: radial-gradient(120% 80% at 30% 0%, #f0d999 0%, #d6b676 70%, #b89858 100%); }
.agro-field-card-img.t-risk { background: radial-gradient(120% 80% at 30% 0%, #e0b3a4 0%, #c08977 70%, #a16e5b 100%); }
.agro-field-card-img.t-water { background: radial-gradient(120% 80% at 30% 0%, #b0cfd2 0%, #82b0b4 70%, #5e9094 100%); }
.agro-field-card-img::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(34,37,31,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,37,31,.07) 1px, transparent 1px);
  background-size: 18px 18px;
}
.agro-field-card-status {
  position: absolute; top: 10px; left: 10px; z-index: 2;
}
.agro-field-card-img .icon-veg {
  position: absolute; right: 10px; bottom: 10px; opacity: .35;
}

.agro-field-card-bd { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.agro-field-card-bd .title { font-family: var(--agro-font-display); font-size: 14.5px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-field-card-bd .sub   { font-size: 12px; color: var(--agro-muted); margin-top: -3px; }
.agro-field-card-bd .meta  { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; font-size: 11.5px; }
.agro-field-card-bd .meta dt { color: var(--agro-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin: 0; }
.agro-field-card-bd .meta dd { margin: 0; font-family: var(--agro-font-display); color: var(--agro-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Phenology bar (mini progress) */
.agro-pheno {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--agro-muted);
}
.agro-pheno-bar {
  flex: 1; height: 5px; border-radius: 99px; background: var(--agro-bg-soft);
  position: relative; overflow: hidden;
}
.agro-pheno-bar > i {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, var(--agro-sage), var(--agro-primary));
  border-radius: 99px;
}

/* Deficit hídrico mini chart */
.agro-deficit {
  display: flex; align-items: center; gap: 5px;
}
.agro-deficit > i {
  width: 6px; height: 10px; background: var(--agro-bg-soft); border-radius: 1px;
}
.agro-deficit > i.on { background: var(--agro-water); }
.agro-deficit > i.on.t-warn { background: var(--agro-warn); }
.agro-deficit > i.on.t-risk { background: var(--agro-risk); }

/* ------- 7. TABLES / LISTS ------- */
.agro-list { display: flex; flex-direction: column; }
.agro-list-row {
  display: grid; align-items: center;
  padding: 10px 16px; gap: 12px;
  border-bottom: 1px solid var(--agro-line);
  font-size: 12.5px;
}
.agro-list-row:last-child { border-bottom: 0; }
.agro-list-row:hover { background: var(--agro-bg-soft); }
.agro-list-hd {
  font-size: 10.5px; color: var(--agro-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--agro-surface-2);
  font-weight: 600;
  padding: 8px 16px;
}

/* Work queue items */
.agro-work-item {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--agro-line);
  cursor: pointer;
}
.agro-work-item:last-child { border-bottom: 0; }
.agro-work-item:hover { background: var(--agro-bg-soft); }
.agro-work-check {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--agro-line-strong);
  background: var(--agro-surface);
  display: grid; place-items: center;
  transition: all 120ms ease;
}
.agro-work-check:hover { border-color: var(--agro-primary); }
.agro-work-item.is-done .agro-work-check {
  background: var(--agro-primary); border-color: var(--agro-primary);
  color: #fbf8f2;
}
.agro-work-item.is-done .agro-work-text .title { color: var(--agro-muted); text-decoration: line-through; }
.agro-work-text .title { font-size: 13px; color: var(--agro-ink); font-weight: 500; }
.agro-work-text .meta  { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Activity timeline */
.agro-timeline { display: flex; flex-direction: column; padding: 4px 0; }
.agro-timeline-item {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px;
  padding: 12px 16px; position: relative;
  align-items: flex-start;
}
.agro-timeline-item::before {
  content: ""; position: absolute; left: 32px; top: 32px; bottom: -8px;
  width: 2px; background: var(--agro-line);
}
.agro-timeline-item:last-child::before { display: none; }
.agro-timeline-ico {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--agro-primary-50); color: var(--agro-primary);
  display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--agro-sage-soft);
  z-index: 1;
}
.agro-timeline-ico.t-water { background: var(--agro-water-soft); color: var(--agro-water); border-color: #b0cfd2; }
.agro-timeline-ico.t-warn  { background: var(--agro-warn-soft);  color: var(--agro-warn);  border-color: #e7ce9a; }
.agro-timeline-ico.t-risk  { background: var(--agro-risk-soft);  color: var(--agro-risk);  border-color: #e0b3a4; }
.agro-timeline-body .title { font-size: 13px; color: var(--agro-ink); font-weight: 500; }
.agro-timeline-body .sub   { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; }
.agro-timeline-time { font-size: 11px; color: var(--agro-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------- 8. DRAWER + FORMS ------- */
.agro-drawer-mask {
  position: fixed; inset: 0; background: rgba(34,37,31,.42);
  z-index: 60; backdrop-filter: blur(2px);
  animation: fadeIn 160ms ease;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }
.agro-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px;
  background: var(--agro-surface);
  border-left: 1px solid var(--agro-line);
  box-shadow: -24px 0 60px -20px rgba(34,37,31,.4);
  z-index: 61; display: flex; flex-direction: column;
  animation: slideIn 240ms cubic-bezier(.22,.61,.36,1);
}
.agro-drawer.agro-entity-drawer.is-compact { width: 420px; }
.agro-drawer.agro-entity-drawer.is-wide { width: min(760px, 100vw); }
.agro-drawer-hd {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: flex-start; gap: 12px;
}
.agro-drawer-hd .ico {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--agro-water-soft); color: var(--agro-water);
  display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid #b0cfd2;
}
.agro-drawer-hd.t-sage .ico { background: var(--agro-primary-50); color: var(--agro-primary); border-color: var(--agro-sage-soft); }
.agro-drawer-hd.t-warn .ico { background: var(--agro-warn-soft); color: var(--agro-warn); border-color: #e7ce9a; }
.agro-drawer-hd .title { font-family: var(--agro-font-display); font-size: 17px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.01em; }
.agro-drawer-hd .sub   { font-size: 12px; color: var(--agro-muted); margin-top: 2px; }

.agro-drawer-bd { flex: 1; overflow-y: auto; padding: 18px 22px 8px; }
.agro-drawer-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--agro-water-soft);
  border-radius: 8px;
  background: rgba(207,228,230,.45);
  color: var(--agro-water);
  font-size: 12.5px;
}
.agro-drawer-section {
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  background: var(--agro-surface);
  box-shadow: var(--agro-shadow-1);
  margin-bottom: 14px;
  overflow: hidden;
}
.agro-drawer-section-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
}
.agro-drawer-section-hd .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--agro-primary-50);
  color: var(--agro-primary);
  border: 1px solid var(--agro-sage-soft);
  display: grid;
  place-items: center;
  font-family: var(--agro-font-display);
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}
.agro-drawer-section-hd .title {
  font-family: var(--agro-font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--agro-ink);
}
.agro-drawer-section-hd .sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--agro-muted);
}
.agro-drawer-section-bd {
  padding: 14px;
}
.agro-drawer-step {
  border-top: 1px solid var(--agro-line);
  padding: 16px 0 14px;
}
.agro-drawer-step:first-child { border-top: 0; padding-top: 6px; }
.agro-step-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.agro-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--agro-primary-50);
  color: var(--agro-primary);
  display: grid; place-items: center;
  font-family: var(--agro-font-display); font-weight: 600; font-size: 11px;
  border: 1px solid var(--agro-sage-soft);
}
.agro-step-num.done { background: var(--agro-primary); color: var(--agro-bg); border-color: var(--agro-primary); }
.agro-step-title { font-family: var(--agro-font-display); font-size: 13.5px; font-weight: 600; color: var(--agro-ink); }
.agro-step-sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; }

.agro-drawer-ft {
  padding: 14px 22px; border-top: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* Form bits */
.agro-field-label {
  display: block; font-size: 11px; color: var(--agro-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  margin-bottom: 5px;
}
.agro-input, .agro-select, .agro-textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 13px;
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: 7px;
  color: var(--agro-ink); outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.agro-input:focus, .agro-select:focus, .agro-textarea:focus {
  border-color: var(--agro-primary);
  box-shadow: 0 0 0 3px rgba(79,107,58,.12);
}
.agro-textarea { min-height: 64px; resize: vertical; font-family: inherit; }

.agro-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.agro-chip {
  padding: 6px 10px; border-radius: 99px; border: 1px solid var(--agro-line);
  background: var(--agro-surface); font-size: 12px; cursor: pointer;
  color: var(--agro-ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.agro-chip:hover { background: var(--agro-bg-soft); }
.agro-chip.is-active {
  background: var(--agro-primary); color: #fbf8f2; border-color: var(--agro-primary-700);
}
.agro-chip.t-water.is-active { background: var(--agro-water); border-color: #246369; }
.agro-chip.t-warn.is-active { background: var(--agro-warn); border-color: #a06f1d; }

/* ------- 9. TABS (expediente) ------- */
.agro-tabs {
  display: flex; gap: 4px; padding: 0 22px;
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface);
  overflow-x: auto;
}
.agro-tab {
  padding: 13px 14px; font-size: 13px; font-weight: 500;
  color: var(--agro-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.agro-tab:hover { color: var(--agro-ink); }
.agro-tab.is-active {
  color: var(--agro-primary-800);
  border-bottom-color: var(--agro-primary);
  font-weight: 600;
}
.agro-tab .count {
  font-size: 10.5px; padding: 1px 6px; border-radius: 99px;
  background: var(--agro-bg-soft); color: var(--agro-muted);
}
.agro-tab.is-active .count { background: var(--agro-primary-50); color: var(--agro-primary); }

/* Entity header (hero del lote) */
.agro-entity-hero {
  background: linear-gradient(135deg, #2f4124 0%, #4f6b3a 60%, #6b8b4b 100%);
  color: #f4efe6;
  border-radius: var(--agro-radius);
  padding: 22px 24px;
  position: relative; overflow: hidden;
  border: 1px solid #3f5630;
}
.agro-entity-hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 40% at 100% 0%, rgba(143,166,122,.4), transparent 70%),
    radial-gradient(40% 80% at 0% 100%, rgba(47,124,131,.25), transparent 70%);
  pointer-events: none;
}
.agro-entity-hero .row1 { display: flex; align-items: center; gap: 10px; position: relative; }
.agro-entity-hero .eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #b9c79e; }
.agro-entity-hero .title { font-family: var(--agro-font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0 0; }
.agro-entity-hero .crop  { color: #d6dac9; margin-top: 3px; font-size: 13px; }
.agro-entity-hero .kpis  { display: flex; gap: 30px; margin-top: 18px; position: relative; }
.agro-entity-hero .kpis .k label { display: block; font-size: 10.5px; color: #b9c79e; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.agro-entity-hero .kpis .k value { display: block; font-family: var(--agro-font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.agro-entity-hero .kpis .k value .u { font-size: 12px; font-weight: 500; color: #b9c79e; margin-left: 3px; }
.agro-entity-hero .actions { position: absolute; top: 22px; right: 22px; display: flex; gap: 8px; }

/* ------- 10. MOBILE / FIELD ------- */
.agro-mobile-frame {
  width: 380px; height: 760px;
  background: #1c1f17; border-radius: 38px;
  padding: 12px; position: relative; margin: 0 auto;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.4), 0 0 0 1px rgba(0,0,0,.1);
}
.agro-mobile-frame::before {
  content: ""; position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 24px; background: #1c1f17; border-radius: 18px; z-index: 3;
}
.agro-mobile-screen {
  width: 100%; height: 100%; background: var(--agro-bg);
  border-radius: 28px; overflow: hidden; display: flex; flex-direction: column;
  position: relative;
}
.agro-mobile-statusbar {
  height: 44px; padding: 0 22px 0 22px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--agro-font-display); font-size: 13px; font-weight: 600; color: var(--agro-ink);
  z-index: 5;
}
.agro-mobile-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 12px;
  background: var(--agro-surface); border-bottom: 1px solid var(--agro-line);
}
.agro-mobile-greeting { flex: 1; }
.agro-mobile-greeting .hi { font-size: 11.5px; color: var(--agro-muted); }
.agro-mobile-greeting .name { font-family: var(--agro-font-display); font-size: 15px; font-weight: 600; color: var(--agro-ink); }

.agro-mobile-content { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.agro-offline-banner {
  background: var(--agro-warn-soft);
  border: 1px solid #e7ce9a;
  color: #6b440a;
  border-radius: 8px; padding: 9px 11px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.agro-offline-banner .lbl { font-weight: 600; }
.agro-offline-banner .sub { color: #7a5210; font-size: 11px; }
.agro-offline-banner .badge {
  margin-left: auto; background: #6b440a; color: #f4e3c3;
  border-radius: 99px; padding: 1px 7px; font-size: 10.5px; font-weight: 600;
}

.agro-mobile-task {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: 12px;
  padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  box-shadow: var(--agro-shadow-1);
}
.agro-mobile-task .ico {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--agro-water-soft); color: var(--agro-water);
  display: grid; place-items: center; flex-shrink: 0;
}
.agro-mobile-task .ico.t-sage { background: var(--agro-primary-50); color: var(--agro-primary); }
.agro-mobile-task .ico.t-warn { background: var(--agro-warn-soft); color: var(--agro-warn); }
.agro-mobile-task .ico.t-risk { background: var(--agro-risk-soft); color: var(--agro-risk); }
.agro-mobile-task .body { flex: 1; min-width: 0; }
.agro-mobile-task .title { font-family: var(--agro-font-display); font-size: 14px; font-weight: 600; color: var(--agro-ink); }
.agro-mobile-task .sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; }
.agro-mobile-task .meta { font-size: 11px; color: var(--agro-muted); margin-top: 8px; display: flex; gap: 8px; align-items: center; }

.agro-mobile-fab {
  position: absolute; bottom: 80px; right: 16px;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--agro-primary); color: #f4efe6;
  display: grid; place-items: center;
  border: 1px solid var(--agro-primary-700);
  box-shadow: 0 12px 24px -6px rgba(47,65,36,.45);
  cursor: pointer;
  z-index: 6;
}
.agro-mobile-fab:hover { background: var(--agro-primary-700); }

.agro-mobile-tabbar {
  height: 64px; background: var(--agro-surface);
  border-top: 1px solid var(--agro-line);
  display: flex; padding: 6px 4px 12px;
}
.agro-mobile-tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--agro-muted); cursor: pointer; padding: 4px;
}
.agro-mobile-tabbar-item.is-active { color: var(--agro-primary); }
.agro-mobile-tabbar-item .lbl { font-size: 10.5px; font-weight: 500; }

/* ------- 11. UTILITIES ------- */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.muted { color: var(--agro-muted); }
.ink { color: var(--agro-ink); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-num { font-family: var(--agro-font-display); font-variant-numeric: tabular-nums; }
.font-display { font-family: var(--agro-font-display); }
.full { width: 100%; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Skeleton-like dividers */
.agro-divider { height: 1px; background: var(--agro-line); margin: 12px 0; }
.agro-divider-soft { height: 1px; background: var(--agro-bg-soft); margin: 10px 0; }

/* Grids used in pages */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.col-span-3 { grid-column: span 3; } .col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; } .col-span-6 { grid-column: span 6; }
.col-span-7 { grid-column: span 7; } .col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

/* Mini progress bar */
.agro-progress {
  height: 6px; background: var(--agro-bg-soft); border-radius: 99px; overflow: hidden;
}
.agro-progress > i {
  display: block; height: 100%; background: var(--agro-primary);
  border-radius: 99px;
}
.agro-progress > i.t-water { background: var(--agro-water); }
.agro-progress > i.t-warn { background: var(--agro-warn); }
.agro-progress > i.t-risk { background: var(--agro-risk); }

/* Dotted divider used in some panels */
.agro-dots-row {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.agro-dots-row .grow { flex: 1; border-top: 1px dashed var(--agro-line); }

/* Weather panel custom */
.agro-weather-card {
  background:
    linear-gradient(135deg, rgba(47,124,131,.08), transparent 60%),
    var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 16px;
  position: relative; overflow: hidden;
}
.agro-weather-card::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.55), transparent 70%);
  pointer-events: none;
}

/* Confidence meter */
.agro-confidence {
  display: flex; align-items: center; gap: 5px;
}
.agro-confidence > i {
  width: 22px; height: 4px; border-radius: 99px;
  background: var(--agro-bg-soft);
}
.agro-confidence > i.on { background: var(--agro-water); }

/* Toast / alert mini */
.agro-alert {
  border: 1px solid var(--agro-line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--agro-surface);
}
.agro-alert .ico {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--agro-warn-soft); color: var(--agro-warn);
  border: 1px solid #e7ce9a;
}
.agro-alert.t-risk .ico { background: var(--agro-risk-soft); color: var(--agro-risk); border-color: #e0b3a4; }
.agro-alert.t-water .ico { background: var(--agro-water-soft); color: var(--agro-water); border-color: #b0cfd2; }
.agro-alert.t-ok .ico { background: var(--agro-ok-soft); color: var(--agro-ok); border-color: #bccfa6; }
.agro-alert .title { font-size: 13px; color: var(--agro-ink); font-weight: 600; }
.agro-alert .sub { font-size: 12px; color: var(--agro-muted); margin-top: 2px; }

/* Phenology stages */
.agro-pheno-stages {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  margin-top: 8px;
}
.agro-pheno-stage {
  text-align: center;
  padding: 8px 4px;
  border-radius: 6px;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  font-size: 10.5px;
  color: var(--agro-muted);
}
.agro-pheno-stage.is-done { background: var(--agro-primary-50); color: var(--agro-primary); border-color: var(--agro-sage-soft); }
.agro-pheno-stage.is-current { background: var(--agro-primary); color: #f4efe6; border-color: var(--agro-primary-700); font-weight: 600; }

/* Inventory mini bars */
.agro-inv-row {
  display: grid; grid-template-columns: 1fr 80px auto; gap: 12px; align-items: center;
  padding: 9px 16px; border-bottom: 1px solid var(--agro-line);
}
.agro-inv-row:last-child { border-bottom: 0; }
.agro-inv-row .name { font-size: 13px; color: var(--agro-ink); }
.agro-inv-row .meta { font-size: 11px; color: var(--agro-muted); }

/* ============================================================
   12. MODULE PATTERNS (list / new / edit)
   ============================================================ */

/* — Saved-view tab bar — */
.agro-viewtabs {
  display: flex; align-items: center; gap: 2px;
  border-bottom: 1px solid var(--agro-line);
  margin: -6px -28px 0;
  padding: 0 28px;
  overflow-x: auto;
  background: var(--agro-bg);
}
.agro-viewtab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 14px 12px;
  font-size: 13px; color: var(--agro-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; font-weight: 500;
  border-radius: 8px 8px 0 0;
}
.agro-viewtab:hover { color: var(--agro-ink); background: var(--agro-bg-soft); }
.agro-viewtab.is-active {
  color: var(--agro-primary-800);
  border-bottom-color: var(--agro-primary);
  background: var(--agro-surface);
  font-weight: 600;
}
.agro-viewtab .count {
  background: var(--agro-bg-soft); color: var(--agro-muted);
  font-size: 10.5px; padding: 1px 6px; border-radius: 99px;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.agro-viewtab.is-active .count { background: var(--agro-primary-50); color: var(--agro-primary); }
.agro-viewtab.t-warn .count { background: var(--agro-warn-soft); color: #7a5210; }
.agro-viewtab.t-risk .count { background: var(--agro-risk-soft); color: #6f2614; }
.agro-viewtab.add { color: var(--agro-faint); font-size: 14px; padding: 11px 10px; }

/* — Toolbar (search + facets + view switch) — */
.agro-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--agro-surface);
  border: 1px solid var(--agro-line); border-top: 0;
  border-radius: 0 0 var(--agro-radius) var(--agro-radius);
  margin-bottom: 16px;
}
.agro-toolbar-search {
  flex: 1; max-width: 360px;
  display: flex; align-items: center; gap: 8px;
  background: var(--agro-bg);
  border: 1px solid var(--agro-line);
  border-radius: 7px; padding: 6px 10px;
  color: var(--agro-muted); font-size: 12.5px;
}
.agro-toolbar-search input { background: transparent; border: 0; outline: 0; width: 100%; color: var(--agro-ink); font: inherit; }
.agro-facet-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--agro-bg); border: 1px dashed var(--agro-line-strong);
  color: var(--agro-muted); padding: 5px 10px; border-radius: 99px;
  font-size: 12px; cursor: pointer;
}
.agro-facet-btn:hover { color: var(--agro-ink); border-color: var(--agro-ink-2); }
.agro-facet-btn.has-value {
  background: var(--agro-surface); border-style: solid; border-color: var(--agro-primary);
  color: var(--agro-primary-800); font-weight: 500;
}
.agro-facet-btn .clear {
  margin-left: 2px; width: 14px; height: 14px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--agro-primary); color: #f4efe6;
}

/* — Data table — */
.agro-table {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line); border-radius: var(--agro-radius);
  overflow: hidden;
  box-shadow: var(--agro-shadow-1);
}
.agro-table table { width: 100%; border-collapse: collapse; }
.agro-table thead {
  background: var(--agro-surface-2);
  border-bottom: 1px solid var(--agro-line);
}
.agro-table th {
  text-align: left; padding: 10px 14px;
  font-size: 10.5px; font-weight: 600;
  color: var(--agro-muted); letter-spacing: 0.08em; text-transform: uppercase;
  position: sticky; top: 0; background: var(--agro-surface-2);
  border-bottom: 1px solid var(--agro-line);
  white-space: nowrap;
}
.agro-table th.sortable { cursor: pointer; }
.agro-table th.sortable:hover { color: var(--agro-ink); }
.agro-table th .sort-ico { opacity: 0.4; margin-left: 4px; vertical-align: -1px; }
.agro-table th.is-sorted .sort-ico { opacity: 1; color: var(--agro-primary); }
.agro-table td {
  padding: 11px 14px; font-size: 12.5px; color: var(--agro-ink-2);
  border-bottom: 1px solid var(--agro-line); vertical-align: middle;
}
.agro-table tr:last-child td { border-bottom: 0; }
.agro-table tr.is-selected td { background: var(--agro-primary-50); }
.agro-table tbody tr { cursor: pointer; transition: background 100ms; }
.agro-table tbody tr:hover { background: var(--agro-bg-soft); }
.agro-table tbody tr:hover .row-actions { opacity: 1; }
.agro-table .row-actions {
  opacity: 0; display: inline-flex; gap: 4px; transition: opacity 120ms;
}
.agro-table .row-actions button {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--agro-surface); border: 1px solid var(--agro-line);
  color: var(--agro-muted); display: grid; place-items: center; cursor: pointer;
}
.agro-table .row-actions button:hover { background: var(--agro-primary-50); color: var(--agro-primary); border-color: var(--agro-sage-soft); }
.agro-table .id-cell { font-family: var(--agro-font-mono); font-size: 11.5px; color: var(--agro-muted); }
.agro-table td.right { text-align: right; }

/* Checkbox cell */
.agro-cb {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--agro-line-strong);
  background: var(--agro-surface); cursor: pointer;
  display: inline-grid; place-items: center;
}
.agro-cb.is-checked, .agro-cb.is-indet {
  background: var(--agro-primary); border-color: var(--agro-primary);
  color: #f4efe6;
}

/* Pagination */
.agro-pagination {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--agro-surface-2);
  border-top: 1px solid var(--agro-line);
  font-size: 12px; color: var(--agro-muted);
}
.agro-pagination .pages { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.agro-pagination .pg-btn {
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: 1px solid transparent;
  color: var(--agro-ink-2); cursor: pointer; font: inherit; font-size: 12px;
  display: grid; place-items: center;
}
.agro-pagination .pg-btn:hover { background: var(--agro-surface); border-color: var(--agro-line); }
.agro-pagination .pg-btn.is-active {
  background: var(--agro-primary); color: #f4efe6; border-color: var(--agro-primary-700);
  font-weight: 600;
}

/* Bulk action bar (appears on selection) */
.agro-bulkbar {
  position: sticky; bottom: 12px; z-index: 8;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #2f4124; color: #f4efe6;
  border-radius: 12px;
  box-shadow: var(--agro-shadow-pop);
  margin: 14px auto 0; max-width: 720px;
  animation: bulkUp 220ms cubic-bezier(.22,.61,.36,1);
}
@keyframes bulkUp {
  from { transform: translateY(20px); opacity: 0; }
}
.agro-bulkbar .count {
  background: rgba(255,255,255,.1); padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.agro-bulkbar .bbtn {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: #f4efe6; padding: 6px 11px; border-radius: 7px;
  font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.agro-bulkbar .bbtn:hover { background: rgba(255,255,255,.12); }
.agro-bulkbar .bbtn.danger { color: #f8c8b9; }

/* Priority/status dots used in lists */
.agro-pdot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--agro-faint); display: inline-block;
}
.agro-pdot.alta { background: var(--agro-risk); }
.agro-pdot.media { background: var(--agro-warn); }
.agro-pdot.baja { background: var(--agro-ok); }

/* Avatar inline */
.agro-avt {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(140deg, #8fa67a, #4f6b3a);
  color: #f4efe6; display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 600; font-family: var(--agro-font-display);
  flex-shrink: 0;
}
.agro-avt.is-empty { background: var(--agro-bg-soft); color: var(--agro-faint); border: 1.5px dashed var(--agro-line-strong); font-size: 12px; }

/* ============================================================
   13. FORM / NEW-EDIT layout
   ============================================================ */

.agro-form-shell {
  display: grid; grid-template-columns: 1fr 360px; gap: 24px;
  align-items: start;
}

.agro-form-hero {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 20px 24px;
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 20px;
  position: relative;
}
.agro-form-hero .row1 { display: flex; align-items: center; gap: 10px; }
.agro-form-hero .eyebrow {
  font-family: var(--agro-font-mono); font-size: 11px;
  color: var(--agro-muted); letter-spacing: 0.04em;
}
.agro-form-hero .title-input {
  font-family: var(--agro-font-display); font-size: 22px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.015em;
  border: 0; background: transparent; outline: 0; width: 100%;
  padding: 4px 0; margin-top: 2px;
}
.agro-form-hero .title-input:focus { box-shadow: inset 0 -2px 0 var(--agro-primary); }
.agro-form-hero .desc-input {
  border: 0; background: transparent; outline: 0; width: 100%; resize: none;
  color: var(--agro-muted); font-size: 13px; padding: 2px 0;
  font-family: inherit; min-height: 22px;
}
.agro-form-hero .actions { display: flex; gap: 8px; flex-shrink: 0; }

.agro-form-section {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  margin-bottom: 16px;
  box-shadow: var(--agro-shadow-1);
}
.agro-form-section-hd {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 10px;
}
.agro-form-section-hd .num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--agro-primary-50); color: var(--agro-primary);
  font-family: var(--agro-font-display); font-weight: 600; font-size: 11px;
  display: grid; place-items: center;
  border: 1px solid var(--agro-sage-soft);
}
.agro-form-section-hd .title { font-family: var(--agro-font-display); font-size: 14px; font-weight: 600; color: var(--agro-ink); }
.agro-form-section-hd .sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 1px; }
.agro-form-section-bd { padding: 16px 18px 18px; }

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

.agro-field { display: flex; flex-direction: column; gap: 5px; }
.agro-field .help { font-size: 11.5px; color: var(--agro-muted); }
.agro-field .err  { font-size: 11.5px; color: var(--agro-risk); }

/* Side panel column (right rail) */
.agro-rail {
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 20px;
}
.agro-rail-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  overflow: hidden;
  box-shadow: var(--agro-shadow-1);
}
.agro-rail-card .hd {
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 8px;
}
.agro-rail-card .hd .title {
  font-family: var(--agro-font-display); font-weight: 600;
  font-size: 12.5px; color: var(--agro-ink);
}
.agro-rail-card .bd { padding: 12px 14px; }

/* Audit timeline (right rail) */
.agro-audit-item {
  display: grid; grid-template-columns: 18px 1fr; gap: 8px;
  padding: 8px 0; position: relative;
  font-size: 12px;
}
.agro-audit-item::before {
  content: ""; position: absolute;
  left: 8px; top: 18px; bottom: -6px; width: 2px; background: var(--agro-line);
}
.agro-audit-item:last-child::before { display: none; }
.agro-audit-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--agro-sage);
  margin: 7px 0 0 4px; box-shadow: 0 0 0 3px var(--agro-primary-50);
  z-index: 1;
}
.agro-audit-dot.t-warn { background: var(--agro-warn); box-shadow: 0 0 0 3px var(--agro-warn-soft); }
.agro-audit-dot.t-water{ background: var(--agro-water);box-shadow: 0 0 0 3px var(--agro-water-soft); }
.agro-audit-item .who { font-weight: 600; color: var(--agro-ink); }
.agro-audit-item .what{ color: var(--agro-ink-2); }
.agro-audit-item .when{ font-size: 10.5px; color: var(--agro-muted); margin-top: 1px; }

/* Form footer (sticky save bar) */
.agro-form-footer {
  position: sticky; bottom: 0;
  margin: 18px -28px -60px;
  padding: 12px 28px;
  background: var(--agro-surface);
  border-top: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 -8px 24px -16px rgba(34,37,31,.18);
  backdrop-filter: blur(4px);
  z-index: 4;
}
.agro-form-footer .unsaved {
  font-size: 12px; color: var(--agro-warn);
  display: inline-flex; align-items: center; gap: 6px;
}
.agro-form-footer .unsaved::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--agro-warn);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Module sub-header (used by list and form) */
.agro-mod-header {
  display: flex; align-items: flex-end; gap: 20px;
  padding-bottom: 16px;
}
.agro-mod-header .left { flex: 1; min-width: 0; }
.agro-mod-header .actions { display: flex; gap: 8px; }

/* Inline editable line-item table (for purchases / labor resources) */
.agro-line-table {
  border: 1px solid var(--agro-line); border-radius: 8px; overflow: hidden;
  background: var(--agro-surface);
}
.agro-line-table .hd, .agro-line-table .row {
  display: grid; align-items: center; gap: 10px;
  padding: 8px 12px;
}
.agro-line-table .hd {
  background: var(--agro-surface-2); border-bottom: 1px solid var(--agro-line);
  font-size: 10.5px; color: var(--agro-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.agro-line-table .row { border-bottom: 1px solid var(--agro-line); font-size: 12.5px; }
.agro-line-table .row:last-of-type { border-bottom: 0; }
.agro-line-table .row input, .agro-line-table .row select {
  border: 0; background: transparent; font: inherit; outline: 0; padding: 4px 6px;
  border-radius: 5px; width: 100%; color: var(--agro-ink);
}
.agro-line-table .row input:focus, .agro-line-table .row select:focus { background: var(--agro-bg-soft); }
.agro-line-table .add-row {
  padding: 10px 12px; color: var(--agro-primary); cursor: pointer;
  font-size: 12.5px; font-weight: 500;
  background: var(--agro-surface-2); border-top: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 6px;
}
.agro-line-table .add-row:hover { background: var(--agro-primary-50); }

/* Empty state */
.agro-empty {
  padding: 60px 20px; text-align: center; color: var(--agro-muted);
}
.agro-empty .ico {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--agro-primary-50); color: var(--agro-primary);
  display: grid; place-items: center; margin: 0 auto 14px;
  border: 1px solid var(--agro-sage-soft);
}
.agro-empty .title { font-family: var(--agro-font-display); font-size: 15px; color: var(--agro-ink); font-weight: 600; }
.agro-empty .sub { font-size: 12.5px; margin-top: 4px; max-width: 360px; margin-left: auto; margin-right: auto; }

/* Inventory stock bar */
.agro-stockbar {
  position: relative; height: 22px; border-radius: 6px;
  background: var(--agro-bg-soft); overflow: hidden;
  border: 1px solid var(--agro-line);
}
.agro-stockbar > .fill {
  height: 100%; background: var(--agro-ok);
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px; color: #f4efe6;
  font-family: var(--agro-font-display); font-size: 10.5px; font-weight: 600;
}
.agro-stockbar > .fill.t-warn { background: var(--agro-warn); }
.agro-stockbar > .fill.t-risk { background: var(--agro-risk); }
.agro-stockbar > .min-mark {
  position: absolute; top: -2px; bottom: -2px; width: 1px;
  background: var(--agro-ink); opacity: .5;
}
.agro-stockbar > .min-mark::after {
  content: "mín"; position: absolute; top: -14px; left: -10px;
  font-size: 9px; color: var(--agro-muted); text-transform: uppercase; letter-spacing: 0.08em;
}

/* ============================================================
   14. HARVEST — cards, quality bars, capture flow
   ============================================================ */

/* Harvest lote card (visual tile) */
.agro-harvest-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  overflow: hidden;
  box-shadow: var(--agro-shadow-1);
  position: relative;
  transition: transform 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
}
.agro-harvest-card:hover { transform: translateY(-2px); box-shadow: var(--agro-shadow-2); }
.agro-harvest-card-hd {
  padding: 14px 16px 12px;
  background:
    linear-gradient(140deg, rgba(79,107,58,.06), transparent 70%),
    var(--agro-surface);
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 12px;
}
.agro-harvest-card-hd .glyph {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(140deg, var(--agro-sage-soft), var(--agro-primary-50));
  border: 1px solid var(--agro-sage-soft);
  display: grid; place-items: center; color: var(--agro-primary);
  flex-shrink: 0;
}
.agro-harvest-card-hd .info { flex: 1; min-width: 0; }
.agro-harvest-card-hd .title {
  font-family: var(--agro-font-display); font-size: 15px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.005em;
}
.agro-harvest-card-hd .sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 1px; }

.agro-harvest-card-bd { padding: 14px 16px; }

.agro-harvest-progress {
  display: flex; align-items: baseline; gap: 8px;
}
.agro-harvest-progress .num {
  font-family: var(--agro-font-display); font-size: 22px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.agro-harvest-progress .unit { font-size: 12px; color: var(--agro-muted); }
.agro-harvest-progress .of { font-size: 11.5px; color: var(--agro-muted); margin-left: auto; }
.agro-harvest-progress .of b { color: var(--agro-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Quality mix bar (stacked) */
.agro-qmix {
  display: flex; height: 8px; border-radius: 99px; overflow: hidden;
  background: var(--agro-bg-soft);
}
.agro-qmix > i { display: block; height: 100%; }
.agro-qmix > i.qa { background: var(--agro-ok); }
.agro-qmix > i.qb { background: var(--agro-sage); }
.agro-qmix > i.qc { background: var(--agro-warn); }
.agro-qmix > i.qr { background: var(--agro-risk); }

.agro-qmix-legend {
  display: flex; gap: 10px; font-size: 10.5px; color: var(--agro-muted);
  margin-top: 6px;
}
.agro-qmix-legend i {
  display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 4px; vertical-align: 0;
}
.agro-qmix-legend i.qa { background: var(--agro-ok); }
.agro-qmix-legend i.qb { background: var(--agro-sage); }
.agro-qmix-legend i.qc { background: var(--agro-warn); }
.agro-qmix-legend i.qr { background: var(--agro-risk); }

.agro-harvest-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--agro-line);
}
.agro-harvest-stats .s dt {
  font-size: 9.5px; color: var(--agro-muted);
  letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin: 0 0 2px;
}
.agro-harvest-stats .s dd {
  margin: 0; font-family: var(--agro-font-display); font-weight: 600;
  font-size: 13px; color: var(--agro-ink);
  font-variant-numeric: tabular-nums;
}
.agro-harvest-stats .s .u { font-size: 10.5px; color: var(--agro-muted); font-weight: 500; margin-left: 2px; }

.agro-harvest-card-ft {
  padding: 10px 14px;
  background: var(--agro-surface-2);
  border-top: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px;
}
.agro-harvest-card-ft .next {
  flex: 1; color: var(--agro-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.agro-harvest-card-ft .next b { color: var(--agro-ink); font-family: var(--agro-font-display); font-weight: 600; }

/* Status ribbon on top-right of card */
.agro-harvest-ribbon {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 4px;
}

/* Stacked-bar mini chart (for daily harvests) */
.agro-daybars {
  display: flex; align-items: flex-end; gap: 3px; height: 40px;
}
.agro-daybars > div {
  flex: 1; background: var(--agro-sage); border-radius: 2px 2px 0 0;
  min-height: 4px;
  position: relative;
}
.agro-daybars > div.today { background: var(--agro-primary); }
.agro-daybars > div::after {
  content: attr(data-label); position: absolute; bottom: -16px;
  left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--agro-muted);
}

/* Big number tile (used in capture summary) */
.agro-tile {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.agro-tile .lbl {
  font-size: 10.5px; color: var(--agro-muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.agro-tile .val {
  font-family: var(--agro-font-display); font-size: 18px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.agro-tile .val .u { font-size: 11px; color: var(--agro-muted); margin-left: 3px; font-weight: 500; }
.agro-tile.t-water { border-color: #b0cfd2; background: var(--agro-water-soft); }
.agro-tile.t-ok    { border-color: #bccfa6; background: var(--agro-ok-soft); }
.agro-tile.t-warn  { border-color: #e7ce9a; background: var(--agro-warn-soft); }

/* Quality input row with kg + pct slider */
.agro-quality-row {
  display: grid; grid-template-columns: 110px 1fr 80px; gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  margin-bottom: 6px;
}
.agro-quality-row .lbl {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--agro-ink); font-weight: 600;
}
.agro-quality-row .lbl .swatch {
  width: 12px; height: 12px; border-radius: 3px;
}
.agro-quality-row .lbl .swatch.qa { background: var(--agro-ok); }
.agro-quality-row .lbl .swatch.qb { background: var(--agro-sage); }
.agro-quality-row .lbl .swatch.qc { background: var(--agro-warn); }
.agro-quality-row .lbl .swatch.qr { background: var(--agro-risk); }
.agro-quality-row .bar {
  height: 24px; border-radius: 6px;
  background: var(--agro-bg-soft); position: relative; overflow: hidden;
  border: 1px solid var(--agro-line);
}
.agro-quality-row .bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--agro-sage); transition: width 200ms ease;
}
.agro-quality-row.qa .bar > i { background: var(--agro-ok); }
.agro-quality-row.qb .bar > i { background: var(--agro-sage); }
.agro-quality-row.qc .bar > i { background: var(--agro-warn); }
.agro-quality-row.qr .bar > i { background: var(--agro-risk); }
.agro-quality-row .bar .pct {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--agro-font-display); font-weight: 600; font-size: 11.5px;
  color: var(--agro-ink); mix-blend-mode: difference; color: #f4efe6;
}
.agro-quality-row .kg {
  text-align: right; font-family: var(--agro-font-display); font-weight: 600;
  font-size: 13px; color: var(--agro-ink);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   15. PURCHASES — status flow, supplier card, reception
   ============================================================ */

/* Status flow stepper */
.agro-stepflow {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: 10px;
  overflow: hidden;
}
.agro-stepflow .step {
  padding: 11px 14px 10px;
  border-right: 1px solid var(--agro-line);
  position: relative;
  background: var(--agro-surface);
}
.agro-stepflow .step:last-child { border-right: 0; }
.agro-stepflow .step.is-done {
  background: var(--agro-primary-50);
  color: var(--agro-primary-800);
}
.agro-stepflow .step.is-current {
  background: var(--agro-primary);
  color: #f4efe6;
}
.agro-stepflow .step.is-cancel { background: var(--agro-risk-soft); color: #6f2614; }
.agro-stepflow .step.is-future { color: var(--agro-faint); }
.agro-stepflow .step::after {
  content: ""; position: absolute; top: 50%; right: -10px;
  transform: translateY(-50%) rotate(-45deg);
  width: 20px; height: 20px;
  background: inherit;
  border-top: 1px solid var(--agro-line);
  border-right: 1px solid var(--agro-line);
  z-index: 2;
}
.agro-stepflow .step:last-child::after { display: none; }
.agro-stepflow .step .num {
  font-family: var(--agro-font-display); font-weight: 600; font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.agro-stepflow .step.is-current .num { color: #c2d49e; opacity: 1; }
.agro-stepflow .step .name {
  font-family: var(--agro-font-display); font-weight: 600; font-size: 12.5px;
  letter-spacing: -0.005em;
  margin-top: 2px;
  position: relative; z-index: 3;
}
.agro-stepflow .step .when {
  font-size: 10.5px; opacity: 0.8;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  position: relative; z-index: 3;
}

/* Supplier card */
.agro-supplier-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  padding: 14px;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: 10px;
  align-items: center;
}
.agro-supplier-glyph {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(140deg, var(--agro-sage), var(--agro-primary));
  color: #f4efe6;
  display: grid; place-items: center;
  font-family: var(--agro-font-display); font-weight: 600; font-size: 16px;
  border: 1px solid var(--agro-primary-700);
  letter-spacing: -0.01em;
}
.agro-supplier-stars {
  display: inline-flex; gap: 1px; vertical-align: middle;
}
.agro-supplier-stars i {
  display: inline-block; width: 10px; height: 10px;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: #e3d5b0; margin-right: 1px;
}
.agro-supplier-stars i.on { background: var(--agro-warn); }

/* Money totals card */
.agro-totals {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
}
.agro-totals .row {
  display: grid; grid-template-columns: 1fr auto;
  padding: 7px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-totals .row:last-child { border-bottom: 0; }
.agro-totals .row.grand {
  background: var(--agro-primary-50);
  padding: 12px 14px;
  font-family: var(--agro-font-display); font-weight: 600;
  font-size: 14px;
  color: var(--agro-primary-800);
}
.agro-totals .row .val { font-family: var(--agro-font-display); font-variant-numeric: tabular-nums; color: var(--agro-ink); font-weight: 500; }
.agro-totals .row.discount .val { color: var(--agro-warn); }
.agro-totals .row.grand .val { font-size: 18px; }

/* Reception line row */
.agro-reception-row {
  display: grid;
  grid-template-columns: 1fr 140px 140px 100px;
  align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-reception-row:last-child { border-bottom: 0; }
.agro-reception-row .name { font-weight: 500; color: var(--agro-ink); }
.agro-reception-row .sku { font-family: var(--agro-font-mono); color: var(--agro-muted); font-size: 11px; }

.agro-recv-progress {
  height: 18px; border-radius: 4px;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  position: relative;
  overflow: hidden;
}
.agro-recv-progress > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--agro-ok); border-radius: 0;
}
.agro-recv-progress > i.partial { background: var(--agro-warn); }
.agro-recv-progress > .lbl {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--agro-font-mono); font-size: 10.5px;
  color: var(--agro-ink); font-weight: 600;
}

/* PC list table-specific tweaks */
.agro-table td.pc-status .pill { white-space: nowrap; }
.agro-table tr.is-cancel td { opacity: 0.55; }

/* ============================================================
   16. RIEGO — live runs, sensor tiles, calendar, water flow
   ============================================================ */

/* Live irrigation card (sector that is irrigating right now) */
.agro-irr-live {
  background: linear-gradient(180deg, var(--agro-water-soft) 0%, var(--agro-surface) 100%);
  border: 1px solid #b0cfd2;
  border-radius: var(--agro-radius);
  padding: 14px 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--agro-shadow-1);
}
.agro-irr-live::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--agro-water);
  animation: irrPulse 2s ease-in-out infinite;
}
@keyframes irrPulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.5; }
}
.agro-irr-live .head {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 10px;
}
.agro-irr-live .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--agro-water);
  box-shadow: 0 0 0 3px rgba(47,124,131,.2);
  animation: pulse 1.6s ease-in-out infinite;
  margin-top: 6px;
  flex-shrink: 0;
}
.agro-irr-live .title { font-family: var(--agro-font-display); font-size: 14px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-irr-live .sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 1px; }
.agro-irr-live .stat-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; margin: 10px 0 12px;
  padding: 10px 12px;
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
}
.agro-irr-live .stat-grid .s dt { font-size: 9.5px; color: var(--agro-muted); margin: 0 0 1px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.agro-irr-live .stat-grid .s dd { margin: 0; font-family: var(--agro-font-display); font-weight: 600; font-size: 14px; color: var(--agro-ink); font-variant-numeric: tabular-nums; }
.agro-irr-live .stat-grid .s dd .u { font-size: 10px; color: var(--agro-muted); margin-left: 2px; font-weight: 500; }

/* Animated flow bar */
.agro-flow-bar {
  height: 14px; border-radius: 99px;
  background: rgba(47,124,131,.12);
  border: 1px solid #b0cfd2;
  position: relative; overflow: hidden;
}
.agro-flow-bar > .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--agro-water) 0 10px,
      #246369 10px 20px
    );
  background-size: 28px 28px;
  border-radius: 99px;
  animation: flowMove 1s linear infinite;
}
@keyframes flowMove { from { background-position-x: 0; } to { background-position-x: -28px; } }
.agro-flow-bar > .pct {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--agro-font-display); font-size: 11px; font-weight: 600;
  color: var(--agro-ink); z-index: 2;
}

/* Compact sector state pill */
.agro-irr-state {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 500;
}
.agro-irr-state.regando { background: var(--agro-water); color: #fbf8f2; }
.agro-irr-state.regando i { background: #fbf8f2; }
.agro-irr-state .ldot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}

/* System pill */
.agro-sys-card {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px;
  align-items: center; padding: 10px 12px;
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
}
.agro-sys-card .glyph {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--agro-water-soft); color: var(--agro-water);
  border: 1px solid #b0cfd2;
  display: grid; place-items: center;
}
.agro-sys-card.t-warn .glyph { background: var(--agro-warn-soft); color: var(--agro-warn); border-color: #e7ce9a; }
.agro-sys-card.t-idle .glyph { background: var(--agro-bg-soft); color: var(--agro-faint); border-color: var(--agro-line); }
.agro-sys-card .meta { font-size: 11px; color: var(--agro-muted); }
.agro-sys-card .vals { text-align: right; font-family: var(--agro-font-display); font-variant-numeric: tabular-nums; }
.agro-sys-card .vals b { display: block; font-size: 13px; color: var(--agro-ink); font-weight: 600; }
.agro-sys-card .vals span { font-size: 10.5px; color: var(--agro-muted); font-weight: 500; }

/* Sensor tile */
.agro-sensor-tile {
  display: grid; grid-template-columns: 1fr 76px; gap: 8px;
  padding: 12px;
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  box-shadow: var(--agro-shadow-1);
  position: relative;
}
.agro-sensor-tile.t-warn { border-color: #e7ce9a; }
.agro-sensor-tile.t-risk { border-color: #e0b3a4; background: linear-gradient(180deg, var(--agro-risk-soft) 0%, var(--agro-surface) 50%); }
.agro-sensor-tile .lbl { font-size: 11px; color: var(--agro-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 2px; }
.agro-sensor-tile .name { font-size: 12.5px; color: var(--agro-ink); font-weight: 600; }
.agro-sensor-tile .sub { font-size: 11px; color: var(--agro-muted); margin-top: 1px; }
.agro-sensor-tile .val {
  font-family: var(--agro-font-display); font-size: 22px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.agro-sensor-tile .val.t-risk { color: var(--agro-risk); }
.agro-sensor-tile .val .u { font-size: 11px; color: var(--agro-muted); margin-left: 2px; font-weight: 500; }
.agro-sensor-tile .trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--agro-muted); margin-top: 2px;
}
.agro-sensor-tile .trend.down { color: var(--agro-risk); }
.agro-sensor-tile .trend.up   { color: var(--agro-ok); }

/* Recommendation card */
.agro-reco {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.agro-reco.t-risk { background: linear-gradient(180deg, var(--agro-risk-soft) 0%, var(--agro-surface) 60%); border-color: #e0b3a4; }
.agro-reco.t-warn { background: linear-gradient(180deg, var(--agro-warn-soft) 0%, var(--agro-surface) 60%); border-color: #e7ce9a; }
.agro-reco .ico {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--agro-primary-50); color: var(--agro-primary);
  border: 1px solid var(--agro-sage-soft);
  display: grid; place-items: center;
}
.agro-reco.t-risk .ico { background: var(--agro-risk); color: #fbf8f2; border-color: #7a2e1d; }
.agro-reco.t-warn .ico { background: var(--agro-warn); color: #fbf8f2; border-color: #a06f1d; }
.agro-reco .title { font-family: var(--agro-font-display); font-weight: 600; font-size: 13px; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-reco .sub { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; line-height: 1.4; }
.agro-reco .confidence {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 10.5px; color: var(--agro-muted);
}
.agro-reco .confidence > i {
  width: 18px; height: 3px; background: var(--agro-bg-soft); border-radius: 99px;
}
.agro-reco .confidence > i.on { background: var(--agro-water); }

/* Weekly calendar */
.agro-cal {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  overflow: hidden;
}
.agro-cal-hd {
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 1px solid var(--agro-line);
  background: var(--agro-surface-2);
  font-size: 11px; font-weight: 600; color: var(--agro-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.agro-cal-hd > div {
  padding: 10px 8px;
  border-right: 1px solid var(--agro-line);
  text-align: center;
}
.agro-cal-hd > div:last-child { border-right: 0; }
.agro-cal-hd > div.today {
  background: var(--agro-primary-50);
  color: var(--agro-primary-800);
}
.agro-cal-hd > div .num {
  font-family: var(--agro-font-display); font-size: 18px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.02em;
  display: block; margin-top: 2px;
}
.agro-cal-hd > div.today .num { color: var(--agro-primary-800); }
.agro-cal-row {
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 1px solid var(--agro-line);
  min-height: 60px;
}
.agro-cal-row:last-child { border-bottom: 0; }
.agro-cal-row > .time {
  padding: 8px; border-right: 1px solid var(--agro-line);
  font-family: var(--agro-font-mono); font-size: 11px;
  color: var(--agro-muted); background: var(--agro-surface-2);
  text-align: right;
}
.agro-cal-row > .cell {
  padding: 4px; border-right: 1px solid var(--agro-line);
  position: relative;
}
.agro-cal-row > .cell:last-child { border-right: 0; }
.agro-cal-row > .cell.today { background: linear-gradient(180deg, var(--agro-primary-50), transparent); }

.agro-cal-event {
  background: var(--agro-water-soft);
  border: 1px solid #b0cfd2;
  border-left: 3px solid var(--agro-water);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 11px;
  color: #1d5961;
  margin-bottom: 2px;
  cursor: pointer;
  transition: transform 100ms;
}
.agro-cal-event:hover { transform: translateX(2px); }
.agro-cal-event.alta { border-left-color: var(--agro-risk); background: var(--agro-risk-soft); color: #6f2614; border-color: #e0b3a4; }
.agro-cal-event.borrador { border-left-color: var(--agro-faint); background: var(--agro-surface-2); color: var(--agro-muted); border-style: dashed; }
.agro-cal-event.recurrente { border-left-color: var(--agro-sage); background: var(--agro-primary-50); color: var(--agro-primary-800); border-color: var(--agro-sage-soft); }
.agro-cal-event.sugerido { background: transparent; border-style: dashed; border-color: var(--agro-water); }
.agro-cal-event .title { font-weight: 600; }
.agro-cal-event .meta { font-size: 10px; opacity: 0.85; margin-top: 1px; }

/* Water balance area chart */
.agro-water-balance {
  position: relative;
  padding: 10px 0 16px;
}

/* Inline ring chart (for irrigation completion) */
.agro-ring {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  position: relative;
}
.agro-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.agro-ring svg circle { fill: none; stroke-width: 4; }
.agro-ring .bg  { stroke: var(--agro-bg-soft); }
.agro-ring .fg  { stroke: var(--agro-water); stroke-linecap: round; transition: stroke-dashoffset 400ms; }
.agro-ring .lbl {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--agro-font-display); font-size: 11px; font-weight: 600;
  color: var(--agro-ink); font-variant-numeric: tabular-nums;
}

/* ============================================================
   17. CALIDAD — range bars, kanban, certifications
   ============================================================ */

/* Parameter range bar — show optimum zone, current value, accept/reject */
.agro-rangebar {
  position: relative;
  height: 24px;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  border-radius: 6px;
  overflow: visible;
}
.agro-rangebar .accept {
  position: absolute; top: 0; bottom: 0;
  background: var(--agro-warn-soft);
  border-left: 1px dashed var(--agro-warn);
  border-right: 1px dashed var(--agro-warn);
}
.agro-rangebar .optimum {
  position: absolute; top: 0; bottom: 0;
  background: var(--agro-ok-soft);
  border-left: 1px solid var(--agro-ok);
  border-right: 1px solid var(--agro-ok);
}
.agro-rangebar .thumb {
  position: absolute; top: 50%; transform: translate(-50%, -50%) rotate(45deg);
  width: 14px; height: 14px;
  background: var(--agro-ink); border: 2px solid #fbf8f2;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  z-index: 3;
  transition: left 200ms cubic-bezier(.22,.61,.36,1);
}
.agro-rangebar .thumb.in-optimum { background: var(--agro-ok); }
.agro-rangebar .thumb.in-accept  { background: var(--agro-warn); }
.agro-rangebar .thumb.out        { background: var(--agro-risk); }
.agro-rangebar .scale {
  position: absolute; top: 100%; left: 0; right: 0;
  display: flex; justify-content: space-between;
  font-family: var(--agro-font-mono); font-size: 10px;
  color: var(--agro-muted); padding-top: 4px;
}
.agro-rangebar .opt-label {
  position: absolute; top: -16px;
  font-size: 9px; color: var(--agro-ok);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  white-space: nowrap;
}

.agro-param-row {
  display: grid; grid-template-columns: 220px 1fr 110px 80px;
  align-items: center; gap: 18px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-param-row:last-child { border-bottom: 0; }
.agro-param-row .name { font-family: var(--agro-font-display); font-size: 13px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-param-row .name .opt {
  display: block; font-family: var(--agro-font-sans); font-size: 10.5px; color: var(--agro-muted); font-weight: 500; margin-top: 1px;
  letter-spacing: 0; text-transform: none;
}
.agro-param-row .value-input {
  font-family: var(--agro-font-display); font-size: 22px; font-weight: 600;
  border: 0; background: transparent; outline: 0;
  text-align: right; color: var(--agro-ink);
  width: 100%;
}
.agro-param-row .value-input:focus { color: var(--agro-primary); }
.agro-param-row .unit { font-size: 11px; color: var(--agro-muted); text-align: right; padding-right: 4px; font-weight: 500; }
.agro-param-row .verdict {
  font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
  text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.agro-param-row .verdict.ok      { background: var(--agro-ok-soft); color: #355a26; border: 1px solid #bccfa6; }
.agro-param-row .verdict.warn    { background: var(--agro-warn-soft); color: #7a5210; border: 1px solid #e7ce9a; }
.agro-param-row .verdict.risk    { background: var(--agro-risk-soft); color: #6f2614; border: 1px solid #e0b3a4; }

/* Defect severity grid */
.agro-defect-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.agro-defect-cell {
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  background: var(--agro-surface);
  overflow: hidden;
}
.agro-defect-cell .lbl {
  padding: 8px 10px 6px;
  font-size: 11.5px; color: var(--agro-ink); font-weight: 600;
  background: var(--agro-surface-2);
  border-bottom: 1px solid var(--agro-line);
}
.agro-defect-cell .opts {
  display: flex;
}
.agro-defect-cell .opts button {
  flex: 1; padding: 6px 4px; font: inherit; font-size: 11px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--agro-muted); border-right: 1px solid var(--agro-line);
}
.agro-defect-cell .opts button:last-child { border-right: 0; }
.agro-defect-cell .opts button:hover { background: var(--agro-bg-soft); }
.agro-defect-cell .opts button.is-active {
  font-weight: 600; color: var(--agro-ink);
}
.agro-defect-cell .opts button.is-active.s1 { background: var(--agro-ok-soft); color: #355a26; }
.agro-defect-cell .opts button.is-active.s2 { background: var(--agro-warn-soft); color: #7a5210; }
.agro-defect-cell .opts button.is-active.s3 { background: var(--agro-risk-soft); color: #6f2614; }

/* Decision card (aprobada/condicional/rechazada) */
.agro-decision-card {
  border-radius: var(--agro-radius);
  padding: 16px;
  border: 1.5px solid var(--agro-line);
  background: var(--agro-surface);
  cursor: pointer;
  transition: transform 100ms, border-color 100ms;
  display: flex; flex-direction: column; gap: 8px;
}
.agro-decision-card:hover { transform: translateY(-1px); }
.agro-decision-card.is-active.ok    { background: var(--agro-ok-soft);   border-color: var(--agro-ok); }
.agro-decision-card.is-active.warn  { background: var(--agro-warn-soft); border-color: var(--agro-warn); }
.agro-decision-card.is-active.risk  { background: var(--agro-risk-soft); border-color: var(--agro-risk); }
.agro-decision-card .ico {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--agro-bg-soft); color: var(--agro-muted);
  display: grid; place-items: center;
}
.agro-decision-card.is-active.ok   .ico { background: var(--agro-ok); color: #fbf8f2; }
.agro-decision-card.is-active.warn .ico { background: var(--agro-warn); color: #fbf8f2; }
.agro-decision-card.is-active.risk .ico { background: var(--agro-risk); color: #fbf8f2; }
.agro-decision-card .ttl { font-family: var(--agro-font-display); font-size: 14px; font-weight: 600; color: var(--agro-ink); }
.agro-decision-card .sub { font-size: 11.5px; color: var(--agro-muted); line-height: 1.4; }

/* Grade chip — A / B / C / Rechazo */
.agro-grade {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-family: var(--agro-font-display); font-weight: 700;
  font-size: 14px; letter-spacing: -0.01em;
}
.agro-grade.A { background: var(--agro-ok);   color: #fbf8f2; }
.agro-grade.B { background: var(--agro-sage); color: #fbf8f2; }
.agro-grade.C { background: var(--agro-warn); color: #fbf8f2; }
.agro-grade.D, .agro-grade.X { background: var(--agro-risk); color: #fbf8f2; }

/* Kanban */
.agro-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.agro-kanban-col {
  background: var(--agro-surface-2);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  display: flex; flex-direction: column;
  min-height: 240px;
}
.agro-kanban-col .hd {
  padding: 10px 12px;
  border-bottom: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--agro-font-display); font-size: 12.5px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.005em;
}
.agro-kanban-col .hd .count {
  background: var(--agro-bg-soft); color: var(--agro-muted);
  padding: 1px 7px; border-radius: 99px; font-size: 11px;
  font-family: var(--agro-font-sans); font-weight: 600;
}
.agro-kanban-col.t-risk .hd .count { background: var(--agro-risk-soft); color: #6f2614; }
.agro-kanban-col.t-warn .hd .count { background: var(--agro-warn-soft); color: #7a5210; }
.agro-kanban-col.t-ok   .hd .count { background: var(--agro-ok-soft); color: #355a26; }
.agro-kanban-col .stripe {
  width: 6px; height: 6px; border-radius: 50%; background: var(--agro-faint);
}
.agro-kanban-col.t-risk .stripe { background: var(--agro-risk); }
.agro-kanban-col.t-warn .stripe { background: var(--agro-warn); }
.agro-kanban-col.t-ok   .stripe { background: var(--agro-ok); }
.agro-kanban-col .bd { padding: 8px; flex: 1; display: flex; flex-direction: column; gap: 8px; }

.agro-nc-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  transition: transform 100ms, box-shadow 100ms;
  border-left: 3px solid var(--agro-faint);
}
.agro-nc-card:hover { box-shadow: var(--agro-shadow-2); transform: translateY(-1px); }
.agro-nc-card.sev-alta     { border-left-color: var(--agro-risk); }
.agro-nc-card.sev-moderada { border-left-color: var(--agro-warn); }
.agro-nc-card.sev-leve     { border-left-color: var(--agro-sage); }
.agro-nc-card .id { font-family: var(--agro-font-mono); font-size: 10.5px; color: var(--agro-muted); }
.agro-nc-card .title { font-size: 12.5px; color: var(--agro-ink); font-weight: 600; line-height: 1.3; margin: 2px 0 6px; }
.agro-nc-card .meta { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--agro-muted); flex-wrap: wrap; }
.agro-nc-card .progress {
  height: 4px; border-radius: 99px; background: var(--agro-bg-soft);
  margin-top: 8px; overflow: hidden;
}
.agro-nc-card .progress > i { display: block; height: 100%; background: var(--agro-primary); border-radius: 99px; }
.agro-nc-card .progress > i.t-warn { background: var(--agro-warn); }
.agro-nc-card .progress > i.t-risk { background: var(--agro-risk); }

/* Certification card */
.agro-cert-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 16px;
  position: relative;
  box-shadow: var(--agro-shadow-1);
  display: grid; grid-template-columns: 76px 1fr; gap: 14px;
  align-items: center;
}
.agro-cert-card .ring {
  width: 76px; height: 76px;
  position: relative;
  display: grid; place-items: center;
}
.agro-cert-card .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.agro-cert-card .ring svg circle { fill: none; stroke-width: 5; }
.agro-cert-card .ring .bg { stroke: var(--agro-bg-soft); }
.agro-cert-card .ring .fg { stroke: var(--agro-ok); stroke-linecap: round; transition: stroke-dashoffset 600ms; }
.agro-cert-card.s-renovacion .ring .fg { stroke: var(--agro-warn); }
.agro-cert-card.s-vencida   .ring .fg { stroke: var(--agro-risk); }
.agro-cert-card .ring .inner {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center;
  font-family: var(--agro-font-display);
}
.agro-cert-card .ring .inner .n {
  font-size: 16px; font-weight: 700; color: var(--agro-ink); line-height: 1;
}
.agro-cert-card .ring .inner .u {
  font-size: 8.5px; color: var(--agro-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-top: 2px;
}
.agro-cert-card.s-vencida .ring .inner .n { color: var(--agro-risk); }
.agro-cert-card .info .name { font-family: var(--agro-font-display); font-size: 15px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-cert-card .info .scope { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; }
.agro-cert-card .info .meta { font-size: 11px; color: var(--agro-muted); margin-top: 8px; }
.agro-cert-card .info .meta b { color: var(--agro-ink); font-weight: 600; }
.agro-cert-card .corner {
  position: absolute; top: 12px; right: 12px;
}

/* ============================================================
   18. COSTOS — breakdown, drilldown, donuts, margin bars
   ============================================================ */

/* Cost summary hero */
.agro-cost-hero {
  background: linear-gradient(135deg, #2f4124 0%, #4f6b3a 60%, #6b8b4b 100%);
  color: #f4efe6;
  border: 1px solid #3f5630;
  border-radius: var(--agro-radius);
  padding: 22px 24px;
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 30px;
}
.agro-cost-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 40% at 100% 0%, rgba(143,166,122,.3), transparent 70%);
  pointer-events: none;
}
.agro-cost-hero .h {
  font-size: 10.5px; color: #b9c79e; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600;
}
.agro-cost-hero .v {
  font-family: var(--agro-font-display); font-size: 28px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums; margin-top: 6px;
}
.agro-cost-hero .v .u { font-size: 12px; color: #b9c79e; font-weight: 500; margin-left: 3px; }
.agro-cost-hero .sub { font-size: 11.5px; color: #d6dac9; margin-top: 6px; }
.agro-cost-hero .v.good { color: #c2d49e; }
.agro-cost-hero .v.bad { color: #f4c39a; }

/* Category breakdown row */
.agro-cat-row {
  display: grid;
  grid-template-columns: 32px 1.5fr 1fr 130px 100px 70px;
  align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-cat-row:last-child { border-bottom: 0; }
.agro-cat-row:hover { background: var(--agro-bg-soft); }
.agro-cat-row .swatch {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; color: #f4efe6;
}
.agro-cat-row .name { font-size: 13px; color: var(--agro-ink); font-weight: 600; }
.agro-cat-row .sub  { font-size: 11px; color: var(--agro-muted); }

.agro-cat-bar {
  height: 8px; border-radius: 99px; background: var(--agro-bg-soft); position: relative;
  overflow: hidden;
}
.agro-cat-bar > .actual { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.agro-cat-bar > .budget {
  position: absolute; top: -2px; bottom: -2px;
  width: 2px; background: var(--agro-ink); opacity: 0.6;
}

.agro-cat-num { font-family: var(--agro-font-display); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Donut chart container */
.agro-donut-wrap {
  position: relative;
  display: grid; place-items: center;
}
.agro-donut-wrap .center {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center;
}
.agro-donut-wrap .center .v {
  font-family: var(--agro-font-display); font-size: 22px; font-weight: 600;
  color: var(--agro-ink); letter-spacing: -0.02em;
}
.agro-donut-wrap .center .l { font-size: 11px; color: var(--agro-muted); margin-top: 2px; }

/* Lote row in cost table */
.agro-lote-cost {
  display: grid;
  grid-template-columns: 1.6fr 1fr 110px 110px 110px 110px 110px;
  align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-lote-cost:hover { background: var(--agro-bg-soft); cursor: pointer; }
.agro-lote-cost:last-child { border-bottom: 0; }

/* Mini bullet chart (vs budget) */
.agro-bullet {
  height: 18px; position: relative; border-radius: 4px;
  background: var(--agro-bg-soft); border: 1px solid var(--agro-line);
  overflow: hidden;
}
.agro-bullet .actual { position: absolute; left: 0; top: 0; bottom: 0; background: var(--agro-primary); }
.agro-bullet .actual.over { background: var(--agro-risk); }
.agro-bullet .actual.under { background: var(--agro-ok); }
.agro-bullet .budget {
  position: absolute; top: -1px; bottom: -1px; width: 2px;
  background: var(--agro-ink);
}
.agro-bullet .lbl {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--agro-font-mono); font-size: 10px; font-weight: 600;
  color: var(--agro-ink);
}

/* Monthly stacked column chart container */
.agro-monthly-chart {
  height: 220px; position: relative;
}

/* Margin pill */
.agro-margin {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-family: var(--agro-font-display); font-weight: 600;
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.agro-margin.good { background: var(--agro-ok-soft); color: #355a26; }
.agro-margin.mid  { background: var(--agro-warn-soft); color: #7a5210; }
.agro-margin.bad  { background: var(--agro-risk-soft); color: #6f2614; }
.agro-margin.na   { background: var(--agro-bg-soft); color: var(--agro-muted); }

/* ============================================================
   19. REPORTES — gallery, viewer, scheduled
   ============================================================ */

.agro-report-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  overflow: hidden;
  box-shadow: var(--agro-shadow-1);
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms;
}
.agro-report-card:hover { transform: translateY(-2px); box-shadow: var(--agro-shadow-2); }
.agro-report-card .ribbon {
  height: 4px;
  background: var(--agro-primary);
}
.agro-report-card .hd {
  padding: 14px 16px 8px;
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px;
  align-items: flex-start;
}
.agro-report-card .glyph {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--agro-primary-50); color: var(--agro-primary);
  border: 1px solid var(--agro-sage-soft);
  display: grid; place-items: center;
}
.agro-report-card .title { font-family: var(--agro-font-display); font-size: 14px; font-weight: 600; color: var(--agro-ink); letter-spacing: -0.005em; }
.agro-report-card .desc  { font-size: 11.5px; color: var(--agro-muted); margin-top: 2px; line-height: 1.4; }
.agro-report-card .fav { color: var(--agro-warn); cursor: pointer; }
.agro-report-card .fav.off { color: var(--agro-faint); opacity: 0.4; }
.agro-report-card .bd {
  padding: 4px 16px 12px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.agro-report-card .bd .k {
  font-size: 10px; color: var(--agro-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.agro-report-card .bd .v {
  font-size: 11.5px; color: var(--agro-ink); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.agro-report-card .ft {
  padding: 8px 12px;
  background: var(--agro-surface-2);
  border-top: 1px solid var(--agro-line);
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--agro-muted);
  margin-top: auto;
}
.agro-report-card .ft .views {
  display: inline-flex; align-items: center; gap: 4px;
}
.agro-report-card .actions { display: flex; gap: 4px; margin-left: auto; }
.agro-report-card .actions button {
  width: 24px; height: 24px; border-radius: 5px;
  background: transparent; border: 1px solid transparent;
  color: var(--agro-muted); cursor: pointer;
  display: grid; place-items: center;
}
.agro-report-card .actions button:hover { background: var(--agro-surface); border-color: var(--agro-line); color: var(--agro-ink); }

/* KPI board (drag & arrange feel) */
.agro-kpi-board {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.agro-board-card {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 16px;
  box-shadow: var(--agro-shadow-1);
  position: relative;
  min-height: 140px;
  display: flex; flex-direction: column;
}
.agro-board-card .drag {
  position: absolute; top: 8px; right: 8px;
  color: var(--agro-faint); opacity: 0.5; cursor: grab;
}
.agro-board-card:hover .drag { opacity: 1; }
.agro-board-card .h {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--agro-muted); letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 8px;
}

/* Density tweak */
[data-density="compact"] .agro-card-bd { padding: 10px 12px; }
[data-density="compact"] .agro-kpi { padding: 11px 12px 12px; }
[data-density="compact"] .agro-list-row { padding: 7px 14px; }
[data-density="compact"] .agro-work-item { padding: 7px 12px; }
[data-density="compact"] .agro-page { padding: 16px 20px 40px; }
[data-density="comfortable"] .agro-card-bd { padding: 18px 20px; }

/* Responsive — basic */
@media (max-width: 1100px) {
  .agro-shell { grid-template-columns: 64px 1fr; }
  .agro-sidebar .agro-brand-name,
  .agro-sidebar .agro-brand-sub,
  .agro-sidebar .agro-nav-item span:not(.badge),
  .agro-sidebar .agro-nav-group-label,
  .agro-sidebar .agro-campaign-pill .lbl,
  .agro-sidebar .agro-campaign-pill .val,
  .agro-sidebar .agro-user-name,
  .agro-sidebar .agro-user-role { display: none; }
  .agro-campaign-pill { justify-content: center; }
  .agro-nav-item { justify-content: center; }
}

/* ============================================================
   Phase 6 — Mobile responsive layer
   ============================================================ */

/* Mobile menu trigger (only visible on small screens) */
.agro-mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--agro-line);
  border-radius: 8px;
  color: var(--agro-ink);
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.agro-mobile-menu-btn:hover { background: var(--agro-bg-soft); }

/* Backdrop overlay shown when mobile nav is open */
.agro-shell-mobile-backdrop {
  position: fixed; inset: 0;
  background: rgba(34, 37, 31, .42);
  border: 0; padding: 0; margin: 0;
  cursor: pointer;
  z-index: 998;
  display: none;
  animation: agro-fade-in .18s ease-out;
}
@keyframes agro-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ───── breakpoint: tablet (<= 900px) ───── */
@media (max-width: 900px) {
  /* Dashboard grids collapse */
  .grid-12 { grid-template-columns: repeat(6, 1fr); }
  .col-span-8, .col-span-12 { grid-column: span 6; }
  .col-span-3, .col-span-4, .col-span-5, .col-span-6, .col-span-7 { grid-column: span 6; }

  /* KPI strip 6→3 cols at tablet */
  .agro-page > div[style*="repeat(6, 1fr)"] { grid-template-columns: repeat(3, 1fr) !important; }
  .agro-operational-layout { grid-template-columns: 1fr; }
  .agro-cost-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

/* ───── breakpoint: mobile (<= 768px) ───── */
@media (max-width: 768px) {
  /* Shell: hide sidebar by default, show as overlay drawer when is-mobile-open.
     Must also override the .agro-shell:has([data-mode="icons"|"wide"]) rules
     (specificity 0,3,0) — otherwise on mobile the icons/wide sidebar state keeps
     the shell at "64px 1fr" and crams topbar+main into 64px. */
  .agro-shell,
  .agro-shell:has(.agro-sidebar[data-mode="icons"]),
  .agro-shell:has(.agro-sidebar[data-mode="wide"]) {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
  }
  .agro-shell .agro-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 248px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform .22s ease-out;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,.4);
  }
  .agro-shell.is-mobile-open .agro-sidebar {
    transform: translateX(0);
  }
  .agro-shell.is-mobile-open .agro-shell-mobile-backdrop { display: block; }
  /* Mobile drawer is always full (Labeled) mode — the collapse-to-icons toggle is dead here. */
  .agro-shell .agro-sidebar-collapse { display: none; }
  /* The <=1100px tablet rules hide brand/labels/icons/group-titles for the 64px icon
     rail. The mobile drawer is full-width, so restore them regardless of sidebar mode
     (otherwise the drawer text/icons stay display:none — visible gap, taps still work). */
  .agro-shell .agro-sidebar .agro-brand-name,
  .agro-shell .agro-sidebar .agro-brand-sub,
  .agro-shell .agro-sidebar .agro-nav-item span:not(.badge),
  .agro-shell .agro-sidebar .agro-nav-group-label,
  .agro-shell .agro-sidebar .agro-campaign-pill .lbl,
  .agro-shell .agro-sidebar .agro-campaign-pill .val,
  .agro-shell .agro-sidebar .agro-user-name,
  .agro-shell .agro-sidebar .agro-user-role { display: revert; }
  /* In mobile, even when "icons" mode is on, force wide overlay */
  .agro-shell .agro-sidebar[data-mode="icons"] { width: 248px; }
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-brand-copy,
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-campaign-copy,
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-nav-item span:not(.badge):not(.ico),
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-nav-group-label,
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-nav-group-chevron,
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-user-copy,
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-sidebar-logout { display: revert; }
  .agro-shell .agro-sidebar[data-mode="icons"] .agro-nav-item { justify-content: flex-start; gap: 10px; padding: 9px 12px; }

  /* Main occupies full width */
  .agro-topbar, .agro-main { grid-column: 1; }
  .agro-main-inner { padding: 14px 14px 60px; }

  /* Topbar adjustments: show menu button, hide bulky pills + search */
  .agro-mobile-menu-btn { display: inline-flex; }
  .agro-topbar { padding: 0 12px; gap: 10px; }
  .agro-topbar .agro-search,
  .agro-topbar .agro-weather-pill,
  .agro-topbar .agro-district-pill,
  .agro-topbar .agro-context-pill,
  .agro-topbar .agro-units-toggle { display: none; }
  .agro-topbar-actions { gap: 6px; }
  .agro-topbar .agro-crumb { font-size: 12px; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Page-level density */
  .agro-page { padding: 14px 14px 40px; }
  .agro-page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .agro-page-actions { justify-content: flex-start; flex-wrap: wrap; }
  .agro-page-title { font-size: 22px; }
  .agro-command-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .agro-command-actions { justify-content: flex-start; flex-wrap: wrap; }
  .agro-command-actions .agro-btn { min-height: 36px; }
  .agro-filterbar { align-items: stretch; }
  .agro-filterbar-search,
  .agro-filterbar-content,
  .agro-filterbar-trailing { width: 100%; }
  .agro-filterbar-spacer { display: none; }

  /* Dashboard grids: single column */
  .grid-12 { grid-template-columns: 1fr; gap: 12px; }
  .col-span-3, .col-span-4, .col-span-5, .col-span-6,
  .col-span-7, .col-span-8, .col-span-12 { grid-column: span 1; }
  .agro-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .agro-kpi-strip-5,
  .agro-kpi-strip-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agro-today-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .agro-dashboard-lots { grid-template-columns: 1fr; padding: 12px; }

  /* KPI strip → 2 cols at mobile */
  .agro-page > div[style*="repeat(6, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; margin-bottom: 16px !important; }

  /* Edit/list pages reflow */
  .agro-edit-page, .agro-edit-page.is-wide { max-width: 100%; }
  .agro-grid-2, .agro-grid-3 { grid-template-columns: 1fr; }
  .agro-form-shell { grid-template-columns: 1fr; }
  .agro-form-section-bd { padding: 14px; }

  /* Tables: keep horizontal scroll, but tighten padding */
  .agro-table-wrap { -webkit-overflow-scrolling: touch; }
  .agro-table th, .agro-table td { padding: 8px 10px; font-size: 12.5px; }
  .agro-detail-inline { grid-template-columns: 1fr; }

  /* Card heads */
  .agro-card-hd { padding: 12px 14px 10px; }

  /* Form footer inline: stack buttons */
  .agro-form-footer-inline { flex-direction: column-reverse; align-items: stretch; }
  .agro-form-footer-inline .agro-btn { width: 100%; justify-content: center; }

  /* Drawers: keep catalog/new/edit flows inside the viewport on phones */
  .agro-drawer,
  .agro-drawer.agro-entity-drawer.is-compact,
  .agro-drawer.agro-entity-drawer.is-wide {
    width: min(100vw, 480px);
    max-width: 100vw;
  }
  .agro-drawer .head,
  .agro-drawer-hd { padding: 14px 16px 12px; }
  .agro-drawer .body,
  .agro-drawer-bd { padding: 14px 14px 8px; }
  .agro-drawer .foot,
  .agro-drawer-ft {
    padding: 12px 14px;
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .agro-drawer .foot .agro-btn,
  .agro-drawer-ft .agro-btn { width: 100%; justify-content: center; }
}

/* ───── breakpoint: small mobile (<= 480px) ───── */
@media (max-width: 480px) {
  /* KPI strip → 1 col */
  .agro-page > div[style*="repeat(6, 1fr)"] { grid-template-columns: 1fr !important; }
  .agro-kpi-strip { grid-template-columns: 1fr; }
  .agro-kpi-strip-5,
  .agro-kpi-strip-4 { grid-template-columns: 1fr; }
  .agro-today-kpi-strip { grid-template-columns: 1fr; }

  /* Topbar: hide bell at very small */
  .agro-topbar .agro-icon-btn { width: 32px; height: 32px; }

  /* Cards full bleed */
  .agro-card, .agro-form-section { border-radius: 10px; }
  .agro-page-title { font-size: 20px; letter-spacing: -0.015em; }
  .agro-page-subtitle { font-size: 12px; }
  .agro-cost-hero { grid-template-columns: 1fr; padding: 18px; gap: 14px; }
  .agro-cost-hero .v { font-size: 24px; }
}

/* ============================================================
   Toasts — restored from pre-V3 agro.css with z-index high enough
   to stack above drawers (z:60-61), mobile backdrop (z:998) and
   any future modal. Without this rule the AgroToastHost stack
   renders unstyled in document flow (often hidden behind drawers).
   ============================================================ */
.agro-toast-host {
  position: fixed; right: 16px; bottom: 16px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.agro-toast {
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-left: 3px solid var(--agro-primary);
  border-radius: var(--agro-radius);
  box-shadow: 0 12px 32px -8px rgba(34,37,31,.32);
  padding: 10px 14px;
  font-size: 13px;
  min-width: 240px;
  max-width: 420px;
  color: var(--agro-ink);
  pointer-events: auto;
  animation: agro-toast-in .22s ease-out;
}
.agro-toast.tone-ok     { border-left-color: var(--agro-ok); }
.agro-toast.tone-warn   { border-left-color: var(--agro-warn); }
.agro-toast.tone-danger { border-left-color: var(--agro-risk); }
.agro-toast.tone-info   { border-left-color: var(--agro-water); }
@keyframes agro-toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   Stage 12C — Crop-cycle planning wizard
   ============================================================ */
.agro-wizard-steps {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px;
}
.agro-wizard-step {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 0; min-width: 110px;
  background: var(--agro-surface);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius);
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}
.agro-wizard-step:hover { border-color: var(--agro-line-strong); }
.agro-wizard-step .num {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  color: var(--agro-muted);
  font-size: 12px; font-weight: 700;
  font-family: var(--agro-font-mono);
}
.agro-wizard-step .lbl { font-size: 12.5px; color: var(--agro-muted); font-weight: 600; }
.agro-wizard-step.is-active {
  border-color: var(--agro-primary);
  background: var(--agro-primary-50);
}
.agro-wizard-step.is-active .num { background: var(--agro-primary); border-color: var(--agro-primary); color: #fff; }
.agro-wizard-step.is-active .lbl { color: var(--agro-primary-800); }
.agro-wizard-step.is-done .num { background: var(--agro-ok-soft); border-color: var(--agro-ok); color: var(--agro-ok); }
.agro-wizard-step.is-done .lbl { color: var(--agro-text); }

.agro-wizard-card { display: block; }

.agro-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.agro-info-chip {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--agro-bg-soft);
  border: 1px solid var(--agro-line);
  border-radius: var(--agro-radius-sm);
  padding: 8px 10px;
}
.agro-info-chip .k { font-size: 11px; color: var(--agro-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.agro-info-chip .v { font-size: 14px; color: var(--agro-ink); font-weight: 600; font-family: var(--agro-font-mono); }

.agro-callout {
  border: 1px solid var(--agro-line);
  border-left: 3px solid var(--agro-line-strong);
  border-radius: var(--agro-radius-sm);
  background: var(--agro-bg-soft);
  padding: 10px 12px;
  font-size: 13px; color: var(--agro-text);
}
.agro-callout ul { margin: 6px 0 0; padding-left: 18px; }
.agro-callout li { margin: 2px 0; }
.agro-callout.is-warn {
  border-left-color: var(--agro-warn);
  background: var(--agro-warn-soft);
  color: var(--agro-ink);
}

.agro-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agro-checklist li { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; color: var(--agro-text); }
.agro-check { display: inline-flex; flex-shrink: 0; font-weight: 700; width: 16px; }
.agro-check.ok { color: var(--agro-ok); }
.agro-check.muted { color: var(--agro-faint); }

.agro-grid.cols-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 768px) {
  .agro-grid.cols-5 { grid-template-columns: 1fr; }
}

/* ============================================================
   UIKIT-V3 primitives
   ============================================================ */
.agro-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
.agro-dl.cols-1 { grid-template-columns: 1fr; }
.agro-dl .dl-item { display: flex; flex-direction: column; gap: 2px; }
.agro-dl dt {
  margin: 0;
  font-size: 10.5px;
  color: var(--agro-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.agro-dl dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--agro-ink);
  font-weight: 500;
}
.agro-dl dd.mono {
  font-family: var(--agro-font-mono);
  font-size: 12px;
}

.agro-ws-hero {
  background: linear-gradient(135deg, #2f4124 0%, #3f5630 60%, #4f6b3a 100%);
  border-radius: var(--agro-radius-lg);
  padding: 22px 24px;
  color: #f4efe6;
  position: relative;
  overflow: hidden;
}
.agro-ws-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 90% 0%, rgba(143, 166, 122, .25), transparent 60%);
  pointer-events: none;
}
.agro-ws-hero > * { position: relative; z-index: 1; }
.agro-ws-hero .wh-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b9c79e;
  font-weight: 600;
}
.agro-ws-hero .wh-title {
  font-family: var(--agro-font-display);
  font-size: 25px;
  font-weight: 600;
  margin: 4px 0 2px;
}
.agro-ws-hero .wh-sub { font-size: 13px; color: #d3dcc2; }
.agro-ws-hero .wh-stats {
  display: flex;
  gap: 26px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.agro-ws-hero .wh-stat .k {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9bab86;
}
.agro-ws-hero .wh-stat .v {
  font-family: var(--agro-font-display);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.agro-ws-hero .wh-stat .v small {
  font-size: 12px;
  color: #b9c79e;
  font-weight: 500;
}

.agro-track {
  height: 8px;
  border-radius: 99px;
  background: var(--agro-bg-soft);
  overflow: hidden;
}
.agro-track > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--agro-primary);
}
.agro-track > i.t-water { background: var(--agro-water); }
.agro-track > i.t-warn { background: var(--agro-warn); }
.agro-track > i.t-risk { background: var(--agro-risk); }
.agro-track > i.t-ok { background: var(--agro-ok); }

.agro-stepper { display: flex; gap: 0; }
.agro-stepper .stp {
  flex: 1;
  position: relative;
  text-align: center;
  padding-top: 22px;
}
.agro-stepper .stp::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--agro-line);
}
.agro-stepper .stp:first-child::before { left: 50%; }
.agro-stepper .stp:last-child::before { right: 50%; }
.agro-stepper .stp .dot {
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--agro-surface);
  border: 2px solid var(--agro-line-strong);
  z-index: 1;
}
.agro-stepper .stp.is-done .dot { background: var(--agro-primary); border-color: var(--agro-primary); }
.agro-stepper .stp.is-done::before { background: var(--agro-primary); }
.agro-stepper .stp.is-active .dot {
  background: var(--agro-surface);
  border-color: var(--agro-primary);
  box-shadow: 0 0 0 3px var(--agro-primary-50);
}
.agro-stepper .stp .lbl { font-size: 11px; color: var(--agro-muted); font-weight: 600; }
.agro-stepper .stp.is-active .lbl,
.agro-stepper .stp.is-done .lbl { color: var(--agro-ink); }
.agro-stepper .stp .sub { font-size: 10px; color: var(--agro-faint); }

.agro-tree { display: flex; flex-direction: column; gap: 2px; }
.agro-tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
}
.agro-tree-node:hover { background: var(--agro-bg-soft); }
.agro-tree-node.is-active { background: var(--agro-primary-50); border-color: var(--agro-sage-soft); }
.agro-tree-node .tn-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.agro-tree-node .tn-ico.lv1 { background: #e7ddc6; color: #7b5a2e; }
.agro-tree-node .tn-ico.lv2 { background: var(--agro-primary-50); color: var(--agro-primary); }
.agro-tree-node .tn-ico.lv3 { background: var(--agro-ok-soft); color: #355c28; }
.agro-tree-node .tn-ico.lv4 { background: var(--agro-water-soft); color: var(--agro-water); }
.agro-tree-node .tn-name { font-weight: 600; color: var(--agro-ink); font-size: 13px; }
.agro-tree-node .tn-meta { font-size: 11px; color: var(--agro-muted); }
.agro-tree-children {
  margin-left: 22px;
  padding-left: 14px;
  border-left: 1px dashed var(--agro-line-strong);
}

.agro-aging {
  display: flex;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--agro-line);
}
.agro-aging .ag-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 2px;
}
.agro-aging-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.agro-aging-legend .al { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.agro-aging-legend .al i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.agro-aging-legend .al .v {
  margin-left: auto;
  font-family: var(--agro-font-display);
  font-weight: 600;
  color: var(--agro-ink);
  font-variant-numeric: tabular-nums;
}

.agro-bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.agro-bars .bar {
  flex: 1;
  min-width: 6px;
  border-radius: 3px 3px 0 0;
  background: var(--agro-sage-soft);
}
.agro-bars .bar.t-primary { background: var(--agro-primary); }
.agro-bars .bar.t-water { background: var(--agro-water); }
.agro-bars .bar.t-warn { background: var(--agro-warn); }
.agro-bars .bar.t-ok { background: var(--agro-ok); }
.agro-bars .bar.t-risk { background: var(--agro-risk); }

.agro-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}
.agro-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.agro-donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--agro-surface);
}
.agro-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.agro-donut-legend .dl { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.agro-donut-legend .dl i { width: 9px; height: 9px; border-radius: 2px; }
.agro-donut-legend .dl .v {
  margin-left: auto;
  font-weight: 600;
  color: var(--agro-ink);
  font-variant-numeric: tabular-nums;
}

.agro-req-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--agro-line);
}
.agro-req-row:last-child { border-bottom: 0; }
.agro-req-row .rr-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--agro-line-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
}
.agro-req-row.is-done .rr-check { background: var(--agro-ok); border-color: var(--agro-ok); }
.agro-req-row.is-pending .rr-check { border-color: var(--agro-warn); }
.agro-req-row .rr-main { flex: 1; min-width: 0; }
.agro-req-row .rr-title { font-size: 13px; color: var(--agro-ink); font-weight: 500; }
.agro-req-row .rr-meta { font-size: 11.5px; color: var(--agro-muted); margin-top: 1px; }

.agro-score {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  position: relative;
}
.agro-score .sc-inner {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--agro-surface);
  display: grid;
  place-items: center;
}
.agro-score .sc-val {
  font-family: var(--agro-font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--agro-ink);
}

.agro-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.agro-tile .tl-k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--agro-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.agro-tile .tl-v {
  font-family: var(--agro-font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--agro-ink);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.agro-tile .tl-v small { font-size: 12px; color: var(--agro-muted); font-weight: 500; }
.agro-tile .tl-foot { font-size: 11px; color: var(--agro-muted); margin-top: 3px; }

.agro-note {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--agro-water-soft);
  border: 1px solid #aacdd0;
  color: #1d5961;
  font-size: 12px;
  align-items: flex-start;
}
.agro-note.t-warn { background: var(--agro-warn-soft); border-color: #e7ce9a; color: #8a5e16; }
.agro-note .nt-ico { flex-shrink: 0; margin-top: 1px; }

.agro-conf { display: inline-flex; gap: 2px; }
.agro-conf i {
  width: 14px;
  height: 5px;
  border-radius: 2px;
  background: var(--agro-line);
}
.agro-conf.high i { background: var(--agro-ok); }
.agro-conf.medium i:nth-child(-n+2) { background: var(--agro-warn); }
.agro-conf.low i:first-child { background: var(--agro-risk); }

.agro-statrow { display: flex; gap: 22px; flex-wrap: wrap; }
.agro-statrow .sr .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--agro-muted);
  font-weight: 600;
}
.agro-statrow .sr .v {
  font-family: var(--agro-font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--agro-ink);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .agro-dl { grid-template-columns: 1fr; }
  .agro-donut-wrap { align-items: flex-start; flex-direction: column; }
  .agro-stepper { overflow-x: auto; padding-bottom: 6px; }
  .agro-stepper .stp { min-width: 92px; }
}

/* ── Trabajo del día · Agenda (calendario) + Requiere atención lado a lado ─── */
.agro-today-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.agro-today-attention-card { position: sticky; top: 12px; }
@media (max-width: 1100px) {
  .agro-today-split { grid-template-columns: 1fr; }
  .agro-today-attention-card { position: static; }
}

/* Contenedor del RadzenScheduler — alinea el acento del tema al verde de la app */
.agro-sched-wrap {
  padding: 4px 2px 2px;
  --rz-scheduler-highlight-color: var(--agro-primary, #2f6d46);
  --rz-primary: var(--agro-primary, #2f6d46);
  --rz-scheduler-today-background-color: var(--agro-primary-50, #eef5f0);
}
.agro-sched-wrap .rz-scheduler { font-family: var(--agro-font-sans, inherit); border-radius: 10px; }
.agro-sched-wrap .rz-event {
  border: 1px solid var(--agro-line, #e3e8e3);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.25;
  padding: 2px 5px;
}
.agro-sched-evt { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.agro-sched-evt-src { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.agro-sched-evt-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tira de actividades sin horario (insumos / calidad sin fecha programada) */
.agro-untimed { margin-top: 12px; border-top: 1px dashed var(--agro-line, #e3e8e3); padding-top: 10px; }
.agro-untimed-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--agro-muted, #5b675f); font-weight: 600; margin-bottom: 8px;
}
.agro-untimed-list { display: flex; flex-wrap: wrap; gap: 8px; }
.agro-untimed-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--agro-line, #e3e8e3); background: var(--agro-surface, #fff);
  font-size: 12px; color: var(--agro-ink, #1f2a24); max-width: 100%;
}
.agro-untimed-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agro-untimed-chip:hover { background: var(--agro-bg-soft, #f3f6f3); border-color: var(--agro-line-strong, #c8d2cb); }

/* Panel lateral "Requiere atención" — lista compacta con acento por fuente */
.agro-attn-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 2px; }
.agro-attn-item {
  padding: 8px 10px; border: 1px solid var(--agro-line, #e3e8e3);
  border-left: 3px solid var(--attn-accent, var(--agro-warn, #e0a93b));
  border-radius: 9px; background: var(--agro-surface, #fff);
}
.agro-attn-item.tone-danger, .agro-attn-item.tone-risk { --attn-accent: var(--agro-risk, #d2553f); }
.agro-attn-item.tone-ok       { --attn-accent: var(--agro-ok, #3a9d5b); }
.agro-attn-item.tone-info     { --attn-accent: var(--agro-water, #3b82c4); }
.agro-attn-item.tone-neutral  { --attn-accent: var(--agro-sage, #7e8c80); }
.agro-attn-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.agro-attn-when { font-size: 11px; color: var(--agro-muted, #5b675f); }
.agro-attn-title { font-weight: 600; font-size: 13px; color: var(--agro-ink, #1f2a24); line-height: 1.3; }
.agro-attn-reason { font-size: 12px; color: var(--agro-muted, #5b675f); margin-top: 2px; }
.agro-attn-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

/* RadzenDataList del panel de atención — se usa la API de variables nativas de Radzen
   (los items son <li> dentro de .rz-datalist-data) para quitar el chrome por defecto
   sin pelear con su scroll/DOM. */
.agro-attn-rz {
  --rz-datalist-padding: 0;
  --rz-datalist-border: none;
  --rz-datalist-background-color: transparent;
  --rz-datalist-shadow: none;
  --rz-datalist-item-border: none;
  --rz-datalist-item-padding: 0;
  --rz-datalist-item-shadow: none;
  --rz-datalist-item-background-color: transparent;
  --rz-datalist-item-margin-block: 0 9px;
  --rz-datalist-item-margin-inline: 0;
}
/* La lista de items (<ul>) hace scroll interno cap a ~la altura del calendario; el pager
   queda fuera de ese scroll, fijo abajo → las dos columnas quedan balanceadas. */
.agro-attn-rz .rz-datalist-data { max-height: 520px; overflow-y: auto; padding-right: 6px; }
.agro-attn-rz .rz-paginator {
  border: 0; background: transparent; padding: 12px 0 2px; margin-top: 8px;
  border-top: 1px solid var(--agro-line, #e3e8e3);
}
.agro-attn-rz .rz-paginator .rz-paginator-element { color: var(--agro-ink-2, #5b675f); }

/* En layout apilado (móvil/tablet) la lista fluye sin tope de altura. */
@media (max-width: 1100px) {
  .agro-attn-rz .rz-datalist-data { max-height: none; overflow: visible; }
}

/* Botón en estado "ocupado": el icono (sync) gira mientras corre la acción */
.agro-btn.is-busy svg { transform-origin: center; animation: agro-spin .8s linear infinite; }
/* Indicador inline "Procesando…" en la barra de la serie diaria */
.agro-inline-busy { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--agro-muted, #5b675f); font-weight: 500; }
.agro-inline-busy svg { transform-origin: center; animation: agro-spin .8s linear infinite; }
