/* AgroMat — estilos de la app, construidos sobre los tokens del design system "AgroMat".
   Fuente de verdad del sistema: artifact "AgroMat Design System" (tokens.json). */

:root {
  /* Superficies y texto */
  --surface: #f2f4f7;
  --surface-raised: #ffffff;
  --surface-sunken: #eef1f4;
  --line: #dde2e8;
  --ink: #1d2530;
  --ink-muted: #566170;
  /* Barra de íconos y paneles sobre el mapa */
  --rail: #1f2632;
  --rail-raised: #2b3442;
  --on-rail: #eef2f6;
  --on-rail-muted: #a7b2c0;
  /* Marca y acción */
  --brand: #2e6b37;
  --brand-hover: #25592d;
  --on-brand: #ffffff;
  --leaf: #9fd68c;
  --leaf-soft: #e3f3dc;
  --on-leaf-soft: #1e5a27;
  /* Selección y edición */
  --select: #2a71c4;
  --on-select: #ffffff;
  --select-soft: #e4effc;
  --on-select-soft: #1c5ea9;
  --focus-ring: #2a71c4;
  /* Estados */
  --danger: #b8352a;
  --danger-soft: #fde8e5;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  /* Prescripciones */
  --rx-apply: #f07c1f;
  --rx-weed: #d4f53c;
  /* Escala, forma, sombra */
  --font-sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-overlay: 0 8px 24px rgba(16, 24, 40, .18);
  --topbar-h: 56px;
  --rail-w: 64px;
  color-scheme: light;

  /* Alias heredados (pantallas existentes) */
  --muted: var(--ink-muted);
  --border: var(--line);
  --surface-1: var(--surface-raised);
  --green-700: var(--brand);
  --green-100: var(--leaf-soft);
  --ok: #2e7d32;
  --warn-ink: var(--warn);
  --radius: var(--radius-md);
  --shadow: var(--shadow-card);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-sans); background: var(--surface); color: var(--ink); font-size: 15px; line-height: 22px; }
a { color: var(--select); }
a:hover { color: var(--on-select-soft); }
h1 { font-size: 24px; line-height: 32px; font-weight: 500; margin: 0; }
h2 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 var(--space-3); }
h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0 0 var(--space-2); }
/* Anillo de foco solo en controles (teclado). Los títulos reciben foco al navegar (FocusOnNavigate,
   para lectores de pantalla) pero no deben mostrar recuadro. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* Ningún texto muestra recuadro de foco, aunque reciba foco por navegación. */
h1, h2, h3, h4, p, span, div, li, td, th, label, section, article, main { outline: none !important; }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; line-height: 18px; }
.mt { margin-top: var(--space-4); }
.right { margin-left: auto; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-ok { color: var(--ok); }
.overline { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.label { font-size: 13px; font-weight: 500; }
.am-icon { flex-shrink: 0; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===================== AppShell ===================== */
.am-app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--rail) var(--rail-w), var(--surface) var(--rail-w)); }
.am-topbar {
  grid-column: 1 / -1; position: sticky; top: 0; z-index: 1200; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-4);
  background: var(--surface-raised); border-bottom: 1px solid var(--line);
}
.am-topbar__home { text-decoration: none; color: inherit; }
.am-logo { display: inline-flex; align-items: center; gap: var(--space-2); }
.am-logo__name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); }
.am-topbar__divider { width: 1px; height: 28px; background: var(--line); }
.am-topbar__title { font-size: 20px; line-height: 28px; font-weight: 400; white-space: nowrap; }
.am-scope { display: flex; flex-direction: column; margin-left: var(--space-6); min-width: 0; }
.am-scope__label { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.am-scope__value { font-size: 14px; line-height: 18px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-usermenu { margin-left: auto; position: relative; }
.am-usermenu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.am-usermenu summary::-webkit-details-marker { display: none; }
.am-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-sunken); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); }
.am-usermenu__panel { position: absolute; right: 0; top: 46px; min-width: 240px; background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); border: 1px solid var(--line); padding: var(--space-2); }
.am-usermenu__who { display: flex; flex-direction: column; padding: var(--space-2) var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.am-usermenu__item { width: 100%; display: flex; align-items: center; gap: var(--space-2); padding: 9px var(--space-3); border: 0; border-radius: var(--radius-md); background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.am-usermenu__item:hover { background: var(--surface-sunken); }

.am-rail { grid-row: 2; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding-top: var(--space-2); z-index: 1100; }
.am-rail__item { position: relative; width: 44px; height: 44px; display: grid; place-items: center; color: var(--on-rail-muted); border-radius: var(--radius-md); text-decoration: none; }
.am-rail__item:hover { background: var(--rail-raised); color: var(--on-rail); }
.am-rail__item.active { background: var(--rail-raised); color: var(--on-rail); box-shadow: inset 3px 0 0 var(--leaf); }
.am-rail__label { position: absolute; left: 52px; top: 50%; transform: translateY(-50%); background: var(--rail); color: var(--on-rail); font-size: 13px; padding: 5px 10px; border-radius: var(--radius-sm); white-space: nowrap; box-shadow: var(--shadow-overlay); opacity: 0; pointer-events: none; transition: opacity .12s; }
.am-rail__item:hover .am-rail__label, .am-rail__item:focus-visible .am-rail__label { opacity: 1; }
.am-content { grid-column: 2; padding: var(--space-6) var(--space-8) var(--space-12); min-width: 0; max-width: 1480px; width: 100%; }
.am-content.no-rail { grid-column: 1 / -1; }
.page-loading { padding: 40px; text-align: center; color: var(--ink-muted); }

/* ===================== Bloques ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-head h1 { font-size: 28px; line-height: 36px; font-weight: 400; }
.page-head .badge, .page-head .am-badge { margin-left: var(--space-2); }
.back { font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; color: var(--ink-muted); font-weight: 500; }
.back:hover { color: var(--select); }
.card { background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: var(--space-6); margin-bottom: var(--space-6); }
.card-flush { padding: 0; overflow: hidden; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.card-item { margin: 0; }
.card-item-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.card-item-head h2, .card-item-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-6); }
.grid-2 > .card { margin-bottom: var(--space-6); }
.clickable { cursor: pointer; }
.narrow { max-width: 680px; }
.section-title { display: flex; align-items: center; gap: var(--space-2); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi { background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: var(--space-4) 20px; display: flex; flex-direction: column; }
.kpi-value { font-size: 28px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.kpi-alert { background: var(--danger-soft); }
.kpi-alert .kpi-value, .kpi-alert .kpi-label { color: var(--danger); }
.kpi-ok { background: var(--leaf-soft); }
.kpi-ok .kpi-value, .kpi-ok .kpi-label { color: var(--on-leaf-soft); }

/* Listas tipo "explotaciones" */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.list li:last-child { border-bottom: 0; }
.list li.clickable:hover { background: var(--surface-sunken); }
.am-list { background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; }
.am-listrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: 12px var(--space-4); border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.am-listrow:last-child { border-bottom: 0; }
.am-listrow:hover { background: var(--surface-sunken); color: inherit; }
.am-listrow.is-selected { background: var(--select-soft); }
.am-tile { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--leaf-soft); color: var(--on-leaf-soft); display: grid; place-items: center; }
.am-listrow__name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-listrow__sub { display: block; font-size: 13px; color: var(--ink-muted); }
.am-listrow__meta { font-size: 13px; color: var(--ink-muted); white-space: nowrap; }
.am-listrow__actions { display: flex; gap: var(--space-1); color: var(--ink-muted); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable:hover td { background: var(--surface-sunken); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Chips de estado */
.badge, .am-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); white-space: nowrap; }
.badge-danger, .am-badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge-crop, .am-badge--ok { background: var(--leaf-soft); color: var(--on-leaf-soft); }
.am-badge--info { background: var(--select-soft); color: var(--on-select-soft); }
.am-badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge-plaga { background: #fde9d9; color: #8a4a0c; }
.badge-enfermedad { background: #f3e1f5; color: #6e2878; }
.badge-maleza { background: #e5efd7; color: #3f5c16; }
.badge-fenologia { background: var(--select-soft); color: var(--on-select-soft); }
.badge-clima { background: #e2e8f0; color: #3c4a5c; }
.badge-otro { background: var(--surface-sunken); color: var(--ink-muted); }
.sev { font-size: 12px; font-weight: 600; }
.sev-1, .sev-2 { color: var(--select); }
.sev-3 { color: var(--warn); }
.sev-4, .sev-5 { color: var(--danger); }

.ndvi-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, .15); }
.ndvi-strip { display: flex; gap: 3px; flex-wrap: wrap; }
.ndvi-strip span { width: 18px; height: 10px; border-radius: 3px; }

.empty { text-align: center; padding: 56px 16px; background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.empty-icon { width: 64px; height: 64px; margin: 0 auto var(--space-3); border-radius: var(--radius-lg); background: var(--leaf-soft); color: var(--on-leaf-soft); display: grid; place-items: center; }
.empty h2 { margin-bottom: var(--space-2); }
.empty p { max-width: 520px; margin: 0 auto var(--space-4); }

.alert { padding: 10px 14px; border-radius: var(--radius-md); background: var(--select-soft); color: var(--on-select-soft); margin-bottom: var(--space-4); display: flex; gap: var(--space-2); align-items: flex-start; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--leaf-soft); color: var(--on-leaf-soft); }
.am-callout { display: flex; gap: 10px; padding: 9px 12px; border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 18px; }
.am-callout--info { background: var(--select-soft); color: var(--on-select-soft); }

/* ===================== Formularios y botones ===================== */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; line-height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-4); }
.form-grid .span-2 { grid-column: span 2; }
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.form-inline input[type=checkbox] { width: 18px; height: 18px; align-self: center; accent-color: var(--select); }
input, select, textarea {
  font: 400 15px/20px var(--font-sans); padding: 10px var(--space-3); min-height: 42px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink); width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: transparent; background: var(--surface-raised); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input:disabled, select:disabled { opacity: .7; }
.validation-message { color: var(--danger); font-size: 12px; font-weight: 400; }
.actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; min-width: 220px; }
.loc { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

.btn {
  font: 500 15px/20px var(--font-sans); min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-raised); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-muted); color: var(--ink); }
.btn:disabled { background: var(--surface-sunken); color: var(--ink-muted); border-color: var(--surface-sunken); cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn-outline { border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--leaf-soft); border-color: var(--brand); color: var(--brand); }
.btn-pill { border-radius: var(--radius-pill); }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-link { background: none; border: 0; color: var(--select); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.btn-danger-link { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; padding: 0; display: inline-flex; align-items: center; gap: 6px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin: var(--space-6) 0; }
.choice { text-align: center; padding: var(--space-6); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-raised); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); font: inherit; color: var(--ink); }
.choice:hover { border-color: var(--select); box-shadow: var(--shadow-overlay); }
.choice.selected { border: 2px solid var(--select); background: var(--select-soft); }
.choice strong { font-size: 17px; }
.choice-icon { width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--leaf-soft); color: var(--on-leaf-soft); display: grid; place-items: center; }

/* Segmentados */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-raised); }
.seg button { font: 500 14px/20px var(--font-sans); border: 0; background: none; padding: 7px 14px; cursor: pointer; color: var(--ink); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--select); color: var(--on-select); }
.seg-block { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.seg-block button { padding: 8px 0; }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.tabs button { font: 500 13px/18px var(--font-sans); border: 0; background: var(--surface-raised); padding: 10px 6px; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button + button { border-left: 1px solid var(--line); }
.tabs button.on { background: var(--select); color: var(--on-select); }
.date-chips { display: flex; gap: 6px; padding: 0 var(--space-3) var(--space-3); flex-wrap: wrap; }
.date-chips.flush { padding: 0; }
.chip { font: 400 13px/18px var(--font-sans); border: 1px solid var(--line); background: var(--surface-raised); border-radius: var(--radius-pill); padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.chip.on { border-color: var(--select); background: var(--select-soft); color: var(--on-select-soft); font-weight: 600; }
.chip:disabled, .seg button:disabled { opacity: .6; cursor: default; }

/* Sliders y KPIs del sistema */
.am-slider { display: flex; flex-direction: column; gap: 6px; }
.am-slider__head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }
.am-slider__head b { font-variant-numeric: tabular-nums; }
.am-slider__hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.am-slider input[type=range] { padding: 0; min-height: 24px; border: 0; background: none; accent-color: var(--select); }
.am-legend { display: inline-flex; align-items: center; gap: 8px; }
.am-legend__bar { width: 140px; height: 10px; border-radius: var(--radius-pill); background: linear-gradient(90deg, #a50026, #f46d43, #fee08b, #d9ef8b, #66bd63, #006837); }
.am-kpi { background: var(--surface-sunken); border-radius: var(--radius-md); padding: 8px 12px; display: flex; flex-direction: column; min-width: 0; }
.am-kpi__value { font-size: 20px; line-height: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.am-kpi__label { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.am-kpi--ok { background: var(--leaf-soft); }
.am-kpi--ok .am-kpi__value, .am-kpi--ok .am-kpi__label { color: var(--on-leaf-soft); }

/* ===================== Mapa ===================== */
.map { width: 100%; background: #6c7a50; }
.leaflet-container { font: inherit; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow-overlay) !important; border-radius: var(--radius-md) !important; overflow: hidden; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--rail) !important; color: var(--on-rail) !important; border-color: var(--rail-raised) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-bar a:hover { background: var(--rail-raised) !important; }
.leaflet-tooltip.field-label { background: rgba(31, 38, 50, .88); color: #fff; border: 0; font-weight: 600; font-size: 12px; box-shadow: none; border-radius: var(--radius-sm); }
.leaflet-tooltip.field-label::before { display: none; }
.legend { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12px; border-top: 1px solid var(--line); }
.legend-bar { width: 140px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #a50026, #f46d43, #fee08b, #d9ef8b, #66bd63, #006837); }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Paneles oscuros sobre el mapa */
.map-dark { background: var(--rail); color: var(--on-rail); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
.map-tools { position: absolute; top: 66px; left: 56px; z-index: 600; width: 220px; padding: var(--space-2); font-size: 14px; }
.map-tools__title { font-weight: 600; padding: 6px 8px 8px; }
.map-tools__section { font-size: 12px; color: var(--on-rail-muted); padding: 6px 8px 4px; }
.map-tool { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-md); border: 0; background: none; color: var(--on-rail); font: inherit; cursor: pointer; text-align: left; }
.map-tool:hover { background: var(--rail-raised); }
.map-tool.on { background: var(--select); color: var(--on-select); }
.map-tool:disabled { color: var(--on-rail-muted); cursor: default; background: none; }
.map-hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 600; padding: 8px 14px; font-size: 13px; white-space: nowrap; }
.map-namebar { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 600; display: flex; align-items: flex-end; gap: var(--space-3); padding: 12px 16px; }
.map-namebar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--on-rail-muted); }
.map-namebar input { background: var(--rail-raised); border: 2px solid var(--select); color: var(--on-rail); width: 180px; min-height: 40px; }
.map-namebar input[readonly] { border: 1px solid var(--on-rail-muted); width: 120px; }
.map-sq { width: 42px; height: 42px; border-radius: var(--radius-md); border: 0; display: grid; place-items: center; cursor: pointer; }
.map-sq--no { background: var(--rail-raised); color: var(--on-rail); }
.map-sq--ok { background: var(--brand); color: var(--on-brand); }
.map-sq:disabled { opacity: .5; cursor: default; }

/* ===================== Campo (lista + mapa) ===================== */
.farm-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; height: calc(100vh - var(--topbar-h) - 150px); min-height: 560px; }
.farm-panel { border-right: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: var(--space-4); overflow-y: auto; }
.farm-panel__head { display: flex; align-items: center; gap: var(--space-3); }
.farm-panel__head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.farm-map { position: relative; min-height: 0; }
.farm-map .map { position: absolute; inset: 0; height: 100% !important; }
.lot-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.lot-row:hover { background: var(--surface-sunken); }
.lot-row__name { display: block; font-weight: 500; }
.lot-row__meta { font-size: 13px; color: var(--ink-muted); display: flex; gap: 8px; align-items: center; }
.lot-thumb { width: 36px; height: 36px; }
.lot-thumb polygon { fill: var(--surface-sunken); stroke: var(--ink-muted); stroke-width: 1.5; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); border: 1.5px dashed var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); text-align: center; cursor: pointer; color: var(--ink-muted); font-size: 13px; }
.dropzone:hover { border-color: var(--select); color: var(--select); }
.dropzone strong { color: var(--ink); font-size: 15px; }

/* ===================== Lote ===================== */
.ndvi-big { display: flex; align-items: center; gap: 14px; margin-bottom: var(--space-3); }
.ndvi-big-value { font-size: 44px; line-height: 1; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 10px 0; }
.stats > div { background: var(--surface-sunken); border-radius: var(--radius-md); padding: 8px 12px; display: flex; flex-direction: column; }
.trend { display: inline-flex; align-items: center; gap: 4px; }
.ndvi-chart { width: 100%; height: 180px; }
.ndvi-chart .grid { stroke: var(--line); stroke-width: 1; }
.ndvi-chart .axis { font-size: 10px; fill: var(--ink-muted); }
.ndvi-chart .line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ndvi-chart .pt { stroke: #fff; stroke-width: 1.5; cursor: pointer; }
.ndvi-chart .pt.sel { stroke: var(--ink); stroke-width: 2; }
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-temp { font-size: 40px; line-height: 1; font-weight: 600; }
.wx-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.wx-day { background: var(--surface-sunken); border-radius: var(--radius-md); padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; color: var(--ink); }
.wx-day .rain { color: var(--on-select-soft); font-weight: 600; }

/* ===================== Aplicación dirigida ===================== */
.rx-head { align-items: flex-end; }
.rx-title { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.rx-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 18px; height: calc(100vh - var(--topbar-h) - 150px); min-height: 620px; }
.rx-panel { grid-row: 1 / 3; }
.rx-panel { margin: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.rx-step { display: flex; flex-direction: column; gap: 10px; }
.rx-step h2 { margin: 0; font-size: 15px; line-height: 22px; }
.rx-histo { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.rx-histo span { flex: 1; border-radius: 2px; }
.rx-dose { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px; gap: 8px; }
.rx-dose label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.rx-map { margin: 0; position: relative; min-height: 0; }
.rx-map .rx-mapview { position: absolute; inset: 0; height: 100% !important; }
.rx-layers { position: absolute; top: 14px; left: 56px; z-index: 600; display: flex; gap: 4px; padding: 4px; }
.rx-layers button { font: inherit; font-size: 14px; font-weight: 500; border: 0; border-radius: 6px; padding: 6px 12px; background: none; color: var(--on-rail); cursor: pointer; }
.rx-layers button.on { background: var(--select); color: var(--on-select); }
.rx-chip-dark { position: absolute; top: 14px; right: 14px; z-index: 600; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; }
.rx-chip-dark .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--select); box-shadow: 0 0 0 2px #fff; }
.rx-legend { position: absolute; left: 14px; bottom: 120px; z-index: 600; display: flex; gap: 14px; align-items: center; padding: 7px 12px; font-size: 12px; }
.rx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rx-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.rx-computing { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 600; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 13px; }
.rx-summary { margin: 0; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.rx-legend { bottom: 14px; }
.rx-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 1; min-width: 0; }
.rx-downloads { display: flex; flex-direction: column; gap: 6px; }
.rx-downloads-row { display: flex; gap: 6px; }
.rx-downloads-row .btn { flex: 1; }

/* ===================== Login ===================== */
.am-auth {
  position: relative; min-height: 100vh; overflow: hidden;
  background: linear-gradient(160deg, #fbfdf9 0%, #f3f8f0 55%, #edf5e9 100%);
}
/* Manchas verdes suaves en las esquinas del lado del formulario */
.am-auth__blob { position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; }
.am-auth__blob--top { width: 380px; height: 380px; left: -230px; top: -250px; background: #c9e4bd; box-shadow: 70px 60px 0 0 #e1f0d9; }
.am-auth__blob--bottom { width: 460px; height: 460px; left: -250px; bottom: -330px; background: #c9e4bd; box-shadow: 90px -40px 0 0 #e1f0d9; }

.am-auth__col {
  position: relative; z-index: 2; width: min(44%, 560px); min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
  padding: var(--space-12) var(--space-8) var(--space-12) clamp(24px, 5.5vw, 76px);
}
.am-auth__brand { display: flex; align-items: center; gap: 22px; }
.am-auth__brand .am-logo svg { border-radius: 16px; box-shadow: 0 6px 18px rgba(31, 38, 50, .18); }
.am-auth__brand b { display: block; font-size: 44px; line-height: 48px; font-weight: 700; letter-spacing: -.02em; color: #1b3a26; }
.am-auth__brand span span { display: block; font-size: 24px; line-height: 30px; color: #2e7d32; }
.am-auth__intro h1 { font-size: 40px; line-height: 48px; font-weight: 700; letter-spacing: -.02em; color: #1d2a22; margin-bottom: 10px; }
.am-auth__intro p { margin: 0; font-size: 17px; line-height: 26px; }
.am-auth .form { gap: 20px; }
.am-auth .form label { font-size: 15px; line-height: 20px; color: #1d2a22; gap: 8px; }
.am-auth__or { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--ink-muted); }
.am-auth__or::before, .am-auth__or::after { content: ""; flex: 1; height: 1px; background: #d3dbd0; }
.am-auth__foot { font-size: 15px; color: #2e7d32; font-weight: 500; }

/* Campos con ícono */
.am-input-icon { position: relative; display: block; }
.am-input-icon > .am-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #1e5a27; pointer-events: none; }
.am-input-icon input { padding-left: 50px; min-height: 54px; background: #ffffff; border: 1px solid #cfd6de; font-size: 16px; }
.am-input-icon input:focus { background: #ffffff; }
.am-input-icon__btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: var(--radius-md); background: none; color: #1d2a22; display: grid; place-items: center; cursor: pointer; }
.am-input-icon__btn:hover { background: var(--surface-sunken); }
.am-input-icon__btn[aria-pressed=true] { color: var(--select); }
.am-input-icon:has(.am-input-icon__btn) input { padding-right: 52px; }

/* Botones grandes del ingreso */
.am-auth .btn-lg { min-height: 58px; font-size: 18px; font-weight: 600; gap: 10px; }
.btn-cta { background: linear-gradient(180deg, #3f8f42 0%, #2a6b30 55%, #225a27 100%); border-color: #225a27; box-shadow: 0 6px 16px rgba(34, 90, 39, .28); }
.btn-cta:hover { background: linear-gradient(180deg, #46994a 0%, #2e7434 55%, #255f2a 100%); border-color: #225a27; }
.am-auth .btn-outline { border-width: 2px; background: rgba(255, 255, 255, .6); }

/* Foto del campo, fundida hacia el formulario */
.am-hero { position: absolute; top: 0; right: 0; bottom: 0; width: 60%; z-index: 1; background: #3f7a2e; -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .55) 9%, #000 22%); mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .55) 9%, #000 22%); }
.am-hero__photo { position: absolute; inset: 0; background: url("img/login-campo.webp") 62% 50% / cover no-repeat; }
.am-hero__fade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(251, 253, 249, .55) 0%, rgba(251, 253, 249, 0) 18%); }

@media (max-width: 1100px) {
  .am-auth__col { width: min(52%, 560px); }
  .am-hero { width: 56%; }
}
@media (max-width: 860px) {
  .am-auth { display: flex; flex-direction: column; }
  .am-hero { position: relative; width: 100%; height: clamp(360px, 54vh, 520px); flex-shrink: 0; -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%); mask-image: linear-gradient(180deg, #000 72%, transparent 100%); }
  .am-hero__photo { background-position: 50% 62%; background-size: cover; }
  .am-hero__fade { display: none; }
  .am-auth__col { order: 2; width: 100%; max-width: 520px; margin: -28px auto 0; min-height: 0; justify-content: flex-start; padding: 0 var(--space-6) var(--space-8); gap: 20px; }
  .am-auth__brand b { font-size: 34px; line-height: 38px; }
  .am-auth__brand span span { font-size: 19px; }
  .am-auth__brand .am-logo svg { width: 60px; height: 60px; }
  .am-auth__intro h1 { font-size: 30px; line-height: 38px; }
  .am-auth__blob--top { display: none; }
}

#blazor-error-ui { background: var(--warn-soft); color: var(--warn); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 3000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; border: 0; background: none; color: inherit; }

/* ===================== Responsive ===================== */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .rx-layout, .farm-layout { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
  .rx-panel { grid-row: auto; }
  .farm-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .farm-map { height: 70vh; }
  /* Orden en celular: mapa → resumen con descargas → pasos */
  .rx-map { order: -2; height: 58vh; min-height: 360px; }
  .rx-summary { order: -1; flex-direction: column; align-items: stretch; }
  .rx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-downloads-row .btn { flex: 1; }
  /* Controles del mapa: capas a la derecha del zoom, leyenda abajo sin tapar el lote, chip de monitoreos abajo a la derecha */
  .rx-layers { left: 60px; right: 12px; top: 12px; justify-content: space-between; }
  .rx-layers button { flex: 1; padding: 6px 4px; font-size: 13px; }
  .rx-legend { left: 12px; right: 12px; bottom: 46px; top: auto; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 11px; }
  .rx-map .leaflet-control-attribution { font-size: 10px; max-width: 100%; }
  .rx-chip-dark { top: auto; bottom: 86px; right: 12px; font-size: 12px; padding: 6px 10px; }
  .rx-computing { top: 60px; }
}
@media (max-width: 760px) {
  .am-app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) minmax(0, 1fr) 64px; background: var(--surface); }
  .am-topbar { padding: 0 var(--space-3); gap: var(--space-3); }
  .am-topbar__divider, .am-topbar__title { display: none; }
  .am-scope { margin-left: 0; }
  /* La barra de íconos pasa abajo, con texto */
  .am-rail { grid-row: 3; position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: 64px; flex-direction: row; justify-content: space-around; padding: 0 4px env(safe-area-inset-bottom); }
  .am-rail__item { width: auto; flex: 1; height: 56px; display: flex; flex-direction: column; gap: 2px; }
  .am-rail__item.active { box-shadow: inset 0 3px 0 var(--leaf); }
  .am-rail__label { position: static; transform: none; opacity: 1; background: none; box-shadow: none; padding: 0; font-size: 11px; color: inherit; }
  .am-content { grid-column: 1; padding: var(--space-4) var(--space-4) 88px; }
  .page-head h1 { font-size: 22px; line-height: 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .choice-grid { grid-template-columns: 1fr; }
  .wx-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-tools { left: 12px; top: 12px; width: 190px; }
  .rx-layers { left: 12px; }
}

/* Botón de Google (pautas de marca: fondo blanco, borde gris, logo G a color) */
.btn-google { background: #ffffff; border-color: #c7ccd3; color: #1f1f1f; gap: 12px; }
.btn-google:hover { background: #f7f8fa; border-color: #9aa3ad; color: #1f1f1f; }

/* ===================== Splash / carga ===================== */
.am-splash {
  position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 40%, #2b3442 0%, #1f2632 55%, #141a23 100%);
  color: #eef2f6; font-family: var(--font-sans);
  transition: opacity .55s ease, visibility .55s;
}
.am-splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.am-splash__scene { display: flex; flex-direction: column; align-items: center; gap: 18px; transform: translateY(-4vh); }
.am-splash.is-done .am-splash__scene { animation: am-splash-out .5s ease forwards; }
@keyframes am-splash-out { to { transform: translateY(-4vh) scale(1.06); opacity: 0; } }

.am-splash__mark { width: clamp(128px, 32vw, 176px); height: auto; overflow: visible; }
.am-splash__glow { animation: am-glow 2.4s ease-in-out infinite; transform-origin: 32px 32px; }
@keyframes am-glow { 0%, 100% { transform: scale(.92); opacity: .6; } 50% { transform: scale(1.08); opacity: 1; } }
.am-splash__tile { transform-origin: 32px 32px; animation: am-tile .6s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes am-tile { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* Los píxeles de la hoja aparecen uno por uno, de abajo (raíz) hacia arriba (punta) */
.am-splash__px rect { transform-origin: center; transform-box: fill-box; opacity: 0; animation: am-px .42s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(.45s + var(--i) * 85ms); }
@keyframes am-px { from { transform: scale(0) rotate(-30deg); opacity: 0; } 70% { opacity: 1; } to { transform: scale(1) rotate(0); opacity: 1; } }
/* Satélite en órbita */
.am-splash__orbit { transform-origin: 32px 32px; transform: rotate(-18deg); opacity: 0; animation: am-orbit-in .6s ease 1.1s both; }
@keyframes am-orbit-in { to { opacity: 1; } }
.am-splash__sat { offset-path: ellipse(40px 14px at 32px 32px); animation: am-sat 3.2s linear infinite; filter: drop-shadow(0 0 4px #fff); }
@keyframes am-sat { to { offset-distance: 100%; } }

.am-splash__brand { display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; animation: am-rise .6s ease 1.25s both; }
@keyframes am-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.am-splash__name { font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; }
.am-splash__tag { font-size: 16px; color: #9fd68c; }
.am-splash__bar { width: 160px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; opacity: 0; animation: am-rise .5s ease 1.5s both; }
.am-splash__bar span { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, #2e8b45, #9fd68c); animation: am-bar 1.4s ease-in-out infinite; }
@keyframes am-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.am-splash__hint { font-size: 13px; color: #a7b2c0; opacity: 0; animation: am-rise .5s ease 1.7s both; }

@media (prefers-reduced-motion: reduce) {
  .am-splash *, .am-splash *::before { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  .am-splash__px rect { opacity: 1; }
}

/* Botón de instalación (aparece solo cuando el navegador ofrece instalar) */
.am-install { display: none; }
body.can-install .am-install { display: flex; }

/* Buscador sobre el mapa (localidad, dirección, coordenadas) */
.map-search { position: absolute; top: 14px; right: 14px; z-index: 650; width: min(420px, calc(100% - 28px)); }
.map-search__form { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; color: var(--on-rail-muted); }
.map-search__form input { flex: 1; min-height: 42px; padding: 0; border: 0; background: none; color: var(--on-rail); font-size: 14px; }
.map-search__form input::placeholder { color: var(--on-rail-muted); }
.map-search__form input:focus { outline: none; }
.map-search__clear { border: 0; background: none; color: var(--on-rail-muted); cursor: pointer; width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; }
.map-search__clear:hover { background: var(--rail-raised); color: var(--on-rail); }
.map-search__busy { width: 16px; height: 16px; border: 2px solid var(--on-rail-muted); border-top-color: var(--leaf); border-radius: 50%; animation: map-search-spin .8s linear infinite; }
@keyframes map-search-spin { to { transform: rotate(360deg); } }
.map-search__list { list-style: none; margin: 0; padding: 6px; border-top: 1px solid var(--rail-raised); max-height: 260px; overflow-y: auto; }
.map-search__list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--on-rail); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.map-search__list button:hover, .map-search__list button:focus-visible { background: var(--rail-raised); }
.map-search__list button .am-icon { color: var(--leaf); }
.map-search__empty { padding: 10px 12px; font-size: 13px; color: var(--on-rail-muted); }
@media (max-width: 760px) {
  .map-search { top: 12px; left: 12px; right: 12px; width: auto; }
  .map-search__form input { font-size: 16px; } /* evita el zoom automático de iOS al enfocar */
  /* Herramientas: barra compacta de íconos abajo del mapa, sin tapar el área de dibujo */
  .map-tools { top: auto; bottom: 46px; left: 50%; right: auto; transform: translateX(-50%); width: auto; max-width: calc(100% - 24px); display: flex; gap: 4px; padding: 4px; }
  .map-tools__title, .map-tools__section { display: none; }
  .map-tool { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 11px; min-width: 64px; text-align: center; white-space: nowrap; }
  .map-tool .am-icon { width: 22px; height: 22px; }
  .map-hint { top: 62px; font-size: 12px; white-space: normal; text-align: center; max-width: calc(100% - 24px); }
  .map-namebar { left: 12px; right: 12px; bottom: 100px; transform: none; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .map-namebar label { flex: 1 1 120px; }
  .map-namebar input { width: 100%; }
  .map-namebar input[readonly] { width: 100%; }
  .farm-map .leaflet-control-attribution { font-size: 10px; }
}

/* ===================== Invitación a instalar (PWA) ===================== */
.am-install-sheet { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: end center; }
.am-install-sheet[hidden] { display: none; }
.am-install-sheet__backdrop { position: absolute; inset: 0; background: rgba(18, 24, 32, .55); backdrop-filter: blur(2px); opacity: 0; transition: opacity .3s; }
.am-install-sheet__card {
  position: relative; width: min(100%, 440px); background: var(--surface-raised); border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(16, 24, 40, .35); overflow: hidden; transform: translateY(100%); transition: transform .35s cubic-bezier(.2, .9, .3, 1);
}
.am-install-sheet.is-open .am-install-sheet__backdrop { opacity: 1; }
.am-install-sheet.is-open .am-install-sheet__card { transform: none; }
.am-install-sheet__close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; display: grid; place-items: center; cursor: pointer; }
.am-install-sheet__hero { position: relative; height: 172px; background: radial-gradient(120% 100% at 50% 100%, #2b3442 0%, #1f2632 60%, #141a23 100%); display: grid; place-items: end center; overflow: hidden; }
.am-install-sheet__glow { position: absolute; left: 50%; bottom: -60px; width: 260px; height: 160px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(159, 214, 140, .45), transparent); }
.am-install-sheet__phone { position: relative; z-index: 1; width: 128px; height: 150px; margin-bottom: -22px; border-radius: 22px 22px 0 0; background: #0f141b; border: 4px solid #2b3442; border-bottom: 0; display: flex; justify-content: center; padding-top: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.am-install-sheet__screen { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.am-install-sheet__screen .am-logo svg { border-radius: 11px; box-shadow: 0 4px 14px rgba(159, 214, 140, .35); }
.am-install-sheet__label { font-size: 11px; color: #eef2f6; font-weight: 500; }
.am-install-sheet__body { padding: 22px 24px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.am-install-sheet__body h2 { margin: 0; font-size: 22px; line-height: 28px; }
.am-install-sheet__body > p { margin: 0; color: var(--ink-muted); }
.am-install-sheet__perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.am-install-sheet__perks li { display: flex; align-items: center; gap: 10px; }
.am-install-sheet__perks .am-icon { color: var(--brand); }
.am-install-sheet__ios-title { margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.am-install-sheet__steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.am-install-sheet__steps li { display: flex; align-items: center; gap: 12px; }
.am-install-sheet__step { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--select-soft); color: var(--on-select-soft); display: grid; place-items: center; }
.am-install-sheet__later { align-self: center; border: 0; background: none; color: var(--ink-muted); font: inherit; font-size: 14px; padding: 8px 12px; cursor: pointer; }
@media (min-width: 760px) {
  .am-install-sheet { place-items: center; }
  .am-install-sheet__card { border-radius: 20px; transform: translateY(24px) scale(.97); opacity: 0; transition: transform .3s ease, opacity .3s ease; }
  .am-install-sheet.is-open .am-install-sheet__card { transform: none; opacity: 1; }
}

/* ===================== Instalando (Android): misma escena del splash + barra real ===================== */
.am-installing { z-index: 4500; }
.am-installing[hidden] { display: none; }
.am-installing .am-splash__bar { width: 220px; height: 6px; animation-delay: .9s; }
.am-installing .am-splash__bar span { width: 0; animation: none; transition: width .12s linear; }
.am-installing__pct { font-size: 28px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; color: #9fd68c; opacity: 0; animation: am-rise .5s ease 1s both; }
.am-installing .am-splash__hint { opacity: 0; animation: am-rise .5s ease 1.1s both; text-align: center; max-width: 320px; line-height: 20px; min-height: 40px; }
.am-installing__open { margin-top: 8px; min-width: 220px; }

/* Botón «Salir» (solo en la app instalada, pantalla de ingreso) */
.am-exit { margin-top: 4px; color: var(--ink-muted); }
.am-exit__hint { text-align: center; margin: 6px 0 0; }

/* Aviso sobre el mapa cuando falla «Mi ubicación» */
.map-hint--error { white-space: normal; max-width: calc(100% - 48px); display: flex; align-items: center; gap: 8px; background: #7a2b22; }
.map-hint__close { background: none; border: 0; color: inherit; padding: 2px; display: inline-flex; cursor: pointer; opacity: .8; }

/* Tras el primer arranque, el splash de carga no vuelve a aparecer (la pantalla «Instalando» sí). */
html.am-booted #am-splash { display: none !important; }

/* ---- M2 · Monitoreo: semáforo, recorrida, catálogo ---- */
.row-gap { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.tabs-inline { display: inline-grid; min-width: min(420px, 100%); }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.lvl::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #8a94a3; flex-shrink: 0; }
.lvl-sobre::before { background: #d64534; }
.lvl-cerca::before { background: #f2b630; }
.lvl-debajo::before { background: #3f9b4f; }
.lvl-sobre { color: #b23a2c; }
.rec-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: var(--space-6); align-items: start; }
.rec-map { position: relative; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); }
.rec-map .map { border-radius: 0; }
.rec-map__bar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.rec-map__bar select { min-width: 200px; }
.rec-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); padding: 8px 12px; background: var(--surface-raised); border-top: 1px solid var(--line); }
.rec-legend .lvl { font-weight: 500; font-size: 12px; color: var(--ink-muted); }
.heat-ramp { width: 120px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #3f9b4f, #f2b630 70%, #d64534); display: inline-block; vertical-align: middle; }
.decision-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.decision-opts button { border: 1px solid var(--line); background: var(--surface-raised); border-radius: var(--radius-md); padding: 10px 6px; font: 600 14px/18px var(--font-sans); color: var(--ink); cursor: pointer; }
.decision-opts button.on.aplicar { background: #fbe4e0; border-color: #d64534; color: #9b2f22; }
.decision-opts button.on.remonitorear { background: var(--warn-soft); border-color: #f2b630; color: #7a5600; }
.decision-opts button.on.no_aplicar { background: var(--leaf-soft); border-color: #3f9b4f; color: var(--on-leaf-soft); }
.suggest { border-left: 4px solid #8a94a3; background: var(--surface-sunken); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.suggest.aplicar { border-color: #d64534; } .suggest.remonitorear { border-color: #f2b630; } .suggest.no_aplicar { border-color: #3f9b4f; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); display: block; background: var(--surface-sunken); }
.photos figcaption { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }
.ref-flag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: #7a5600; background: var(--warn-soft); padding: 2px 6px; border-radius: var(--radius-sm); }
.own-flag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--on-leaf-soft); background: var(--leaf-soft); padding: 2px 6px; border-radius: var(--radius-sm); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-4); }
.cat-card h3 { margin: 0; font-size: 16px; }
.cat-card .th-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; align-items: flex-start; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; line-height: 18px; margin-bottom: var(--space-3); }
@media (max-width: 900px) {
  .rec-layout { grid-template-columns: 1fr; }
  .decision-opts { grid-template-columns: 1fr; }
}
.st-marker { background: none; border: 0; }
.st-marker span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 12px/1 var(--font-sans); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
/* Panel de edición (lateral en escritorio, hoja inferior en celular) */
.am-sheet { position: fixed; inset: 0; z-index: 2500; display: flex; justify-content: flex-end; }
.am-sheet__backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .45); }
.am-sheet__card { position: relative; width: min(560px, 100%); height: 100%; overflow-y: auto; background: var(--surface-raised); padding: var(--space-6); box-shadow: var(--shadow-overlay); display: flex; flex-direction: column; gap: var(--space-3); }
.am-sheet__card h2 { margin: 0; }
.chip input { margin: 0; accent-color: var(--select); }
@media (max-width: 700px) {
  .am-sheet { align-items: flex-end; }
  .am-sheet__card { height: auto; max-height: 92vh; border-radius: 16px 16px 0 0; padding: var(--space-4); }
}

/* ---- M3 · Clima, ventana de pulverización y lluvias ---- */
.select-lg { min-height: 40px; font-size: 15px; }
.wx-alerts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.wx-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--warn-soft); color: #6b4a00; }
.wx-alert.severe { background: var(--danger-soft); color: var(--danger); }
.spray-best { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: var(--space-3); }
.chip-ok { background: var(--leaf-soft); color: var(--on-leaf-soft); border-color: transparent; font-weight: 600; cursor: default; }
.chip-on { background: var(--select); color: var(--on-select); border-color: var(--select); }
.spray-none { padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); margin-bottom: var(--space-3); }
.spray-grid { display: flex; flex-direction: column; gap: 6px; }
.spray-day { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; }
.spray-day__name { font-size: 13px; font-weight: 600; }
.spray-day__hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; }
.spray-h { border: 0; height: 30px; border-radius: 4px; cursor: pointer; padding: 0; font: 500 10px/1 var(--font-sans); color: #fff; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; }
.spray-h.apto { background: #3f9b4f; }
.spray-h.precaucion { background: #f2b630; color: #4a3500; }
.spray-h.noapto { background: #d64534; }
.spray-h.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.spray-detail { margin-top: var(--space-3); border-left: 4px solid #8a94a3; background: var(--surface-sunken); border-radius: var(--radius-sm); padding: 12px 14px; }
.spray-detail.apto { border-color: #3f9b4f; } .spray-detail.precaucion { border-color: #f2b630; } .spray-detail.noapto { border-color: #d64534; }
.spray-detail__head { display: flex; justify-content: space-between; gap: 10px; }
.spray-detail .stats > div { display: flex; flex-direction: column; }
.spray-reasons { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.empty-inline { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; }
.rain-chart { width: 100%; height: auto; display: block; }
.rain-chart .grid { stroke: var(--line); stroke-width: 1; }
.rain-chart .axis { font: 11px var(--font-sans); fill: var(--ink-muted); }
.rain-chart .bar-est { fill: #a9c8ec; }
.rain-chart .bar-reg { fill: #2e6b37; }
.rain-chart .norm { stroke: #d64534; stroke-width: 2; stroke-dasharray: 4 3; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.sw-reg { background: #2e6b37; } .sw-est { background: #a9c8ec; } .sw-norm { background: none; border-top: 2px dashed #d64534; height: 0; width: 14px; border-radius: 0; vertical-align: 3px; }
.wx-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--space-3); }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: var(--radius-md); background: var(--surface-sunken); text-align: center; }
/* Carga rápida de lluvia */
.rain-quick { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.rain-quick h1 { margin: 0; }
.rain-quick__gauges { display: flex; gap: 8px; flex-wrap: wrap; }
.rain-quick__gauges .chip { padding: 10px 14px; font-size: 15px; }
.rain-quick__input { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.rain-quick__input input { width: 180px; font: 700 56px/1.1 var(--font-sans); text-align: center; border: 0; border-bottom: 3px solid var(--brand); background: transparent; color: var(--ink); padding: 4px 0; }
.rain-quick__input span { font-size: 22px; color: var(--ink-muted); }
.rain-quick__chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.rain-quick__chips .chip { justify-content: center; padding: 12px 0; font-size: 16px; font-weight: 600; }
.rain-quick__date { display: grid; grid-template-columns: 1fr 1fr 1.4fr; }
.rain-quick__date button, .rain-quick__date input { min-height: 44px; }
.rain-quick__date input { border: 0; border-left: 1px solid var(--line); background: none; padding: 0 8px; font: inherit; color: var(--ink); }
.rain-quick__notes { min-height: 44px; }
.rain-quick__last { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rain-quick__last li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) {
  .spray-day { grid-template-columns: 1fr; gap: 2px; }
  .spray-h { height: 26px; font-size: 0; }
  .am-rail__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; }
}
.chip-on .muted { color: inherit; opacity: .85; }

/* ---- M4 · Cultivos por campaña y catálogos ---- */
.cz-row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.cz-form { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); margin: var(--space-3) 0; background: var(--surface-sunken); }
.cz-form h3 { margin: 0 0 var(--space-3); }
.input-unit { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.cz-versions { margin-top: var(--space-4); font-size: 14px; }
.cz-versions summary { cursor: pointer; color: var(--select); }
.cz-versions ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-muted); }
.season-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 2px 4px 2px 10px; font-size: 13px; background: var(--surface-raised); }
.season-pill select { border: 0; background: transparent; font: 600 13px var(--font-sans); color: var(--ink); padding: 4px 2px; min-height: 0; }
.region-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.cat-table td.actions { white-space: nowrap; text-align: right; }
@media (max-width: 700px) { .season-pill .season-pill__label { display: none; } }
.lot-group { font-size: 13px; font-weight: 600; margin: 12px 0 4px; display: flex; align-items: center; }
.sectors { display: flex; flex-direction: column; gap: 8px; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sectors h3 { margin: 0; }
.sector-new { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sector-new input { flex: 1; min-width: 160px; }
.sector-colors { display: flex; gap: 4px; }
.sector-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sector-color.on { border-color: var(--ink); }
.sector-select { margin-left: var(--space-2); font-size: 13px; min-height: 30px; padding: 2px 6px; }

/* ---- M5 · Labores ---- */
.wo-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted); }
.wo-field { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wo-ha { width: 140px; }
.wo-product { display: grid; grid-template-columns: minmax(160px, 2fr) minmax(0, 1.4fr) 90px 110px minmax(0, 1.2fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.wo-product > input:nth-child(2):not([type=number]) { grid-column: auto; }
.wo-total { white-space: nowrap; }
.wo-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: var(--space-3) 0 0; font-size: 14px; }
.wo-info dt { color: var(--ink-muted); }
.wo-info dd { margin: 0; }
.wo-notes { white-space: pre-line; background: var(--surface-sunken); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.wo-pending { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.wo-pending li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wo-pending a { display: inline-flex; align-items: center; gap: 6px; }
.wo-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wo-cal__dow { font-size: 12px; color: var(--ink-muted); text-align: center; padding: 4px 0; }
.wo-cal__day { min-height: 92px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.wo-cal__day.empty { border: 0; }
.wo-cal__day.today { border-color: var(--select); box-shadow: inset 0 0 0 1px var(--select); }
.wo-cal__n { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.wo-cal__item { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 14px; padding: 2px 4px; border-radius: 4px; background: var(--select-soft); color: var(--on-select-soft); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-cal__item.en_curso { background: var(--warn-soft); color: #6b4a00; }
.wo-cal__item.terminada, .wo-cal__item.archivada { background: var(--leaf-soft); color: var(--on-leaf-soft); }
.stats > div { display: flex; flex-direction: column; }
@media (max-width: 700px) {
  .am-rail__item--desktop { display: none; }
  .wo-product { grid-template-columns: 1fr 1fr; }
  .wo-cal__day { min-height: 64px; }
  .wo-cal__item { font-size: 0; justify-content: center; }
  .wo-cal__item .am-icon { width: 14px; height: 14px; }
}
.price-cell { display: inline-flex; align-items: center; gap: 4px; } .price-cell input { width: 90px; text-align: right; min-height: 32px; }

/* ---- M6 · Teledetección ---- */
.layer-select { min-height: 34px; font-size: 14px; max-width: 100%; }
.idx-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: var(--space-3) 0; }
.idx { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-raised); padding: 6px 4px; display: flex; flex-direction: column; align-items: center; cursor: pointer; color: var(--ink); }
.idx strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.idx.on { border-color: var(--select); box-shadow: inset 0 0 0 1px var(--select); }
.diff-ramp { display: inline-block; width: 110px; height: 8px; border-radius: 99px; vertical-align: middle; background: linear-gradient(90deg, #d64534, #ffffff, #2e8b45); border: 1px solid var(--line); }
.health { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.report-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.report-row ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-muted); }
@media (max-width: 700px) { .idx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi-link { text-decoration: none; color: inherit; } .kpi-link:hover { box-shadow: var(--shadow-overlay); }
.blend-screen { mix-blend-mode: screen; }
.am-installing__close { background: none; border: 0; color: rgba(255,255,255,.75); text-decoration: underline; font: inherit; font-size: 14px; margin-top: 12px; cursor: pointer; }
.rate-input { width: 110px; text-align: right; min-height: 32px; }

/* ---- Estaciones meteorológicas ---- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.st-card { background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: var(--space-4); display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; }
.st-card:hover { box-shadow: 0 0 0 2px var(--select); }
.st-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.st-card__head .chip { cursor: default; font-size: 12px; padding: 2px 8px; white-space: nowrap; }
.st-card__now { display: flex; align-items: center; gap: var(--space-4); }
.st-card__now .small div { display: flex; align-items: center; gap: 4px; }
.st-temp { font-size: 40px; line-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-err { color: var(--danger); }
.st-frost { color: #2f6fdf; font-weight: 600; }
.st-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0 var(--space-4); }
.st-option { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: 4px; }
.st-player { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.st-player #st-frame-label { font-variant-numeric: tabular-nums; min-width: 90px; }
.st-credit { margin-left: auto; }
.st-radar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); border-top: 1px solid var(--line); margin-top: var(--space-4); padding-top: var(--space-4); }
.st-radar p { margin: 4px 0 0; }
.st-list { max-height: 50vh; overflow-y: auto; margin-top: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); }
.st-list__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 10px 12px; }
.st-list__row + .st-list__row { border-top: 1px solid var(--line); }
.st-config { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; margin: var(--space-3) 0; }
.st-config > div { display: flex; flex-direction: column; gap: 2px; }
.st-config code, .am-sheet code, details code { font-size: 13px; background: var(--surface-sunken, rgba(0,0,0,.05)); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
details.card > summary { cursor: pointer; }
@media (max-width: 640px) {
  .st-radar { flex-direction: column; align-items: flex-start; }
  .st-credit { margin-left: 0; }
  .card-item-head .seg { overflow-x: auto; max-width: 100%; }
}
.st-heat { color: var(--danger); font-weight: 600; }

/* ---- M8 · Modelos agronómicos ---- */
.md-stages { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; }
.md-stage { flex: 0 0 auto; min-width: 58px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface-raised); }
.md-stage.crit { border-bottom: 3px solid #f2b5a5; }
.md-stage.done { background: var(--leaf-soft, #e3efe4); }
.md-stage.now { outline: 2px solid var(--select); }
button.md-stage { font: inherit; color: inherit; cursor: pointer; }
.md-stage.sel { box-shadow: 0 0 0 2px var(--ink-muted) inset; }
.md-tip { background: var(--surface-sunken, rgba(0,0,0,.04)); border-radius: var(--radius-md); padding: 8px 12px; }
.md-src { font-size: 10px; color: var(--ink-muted); }
.md-risk { display: inline-block; font-size: 12px; line-height: 18px; padding: 1px 8px; border-radius: var(--radius-pill); margin: 1px 4px 1px 0; border: 1px solid var(--line); }
.md-risk--alto { background: #fbe0dc; border-color: #e9967a; color: #8a2414; font-weight: 600; }
.md-risk--medio { background: #fff3cd; border-color: #f0c36d; color: #6b4e00; }
.md-risk--bajo { background: var(--leaf-soft, #e3efe4); color: var(--on-leaf-soft, #2e6b37); }
.md-risk--fuera { color: var(--ink-muted); }
.md-alert { text-decoration: none; color: inherit; }
.input-num { width: 80px; text-align: right; }
.md-rules input:not([type=checkbox]), .md-rules select { width: 100%; min-width: 60px; }
.md-rules td:first-child { min-width: 200px; }
.md-rules td:first-child input + input { margin-top: 4px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .md-risk--alto { background: #4a1d16; color: #f6c1b5; }
  :root:not([data-theme="light"]) .md-risk--medio { background: #4a3a10; color: #f3dd9b; }
}
:root[data-theme="dark"] .md-risk--alto { background: #4a1d16; color: #f6c1b5; }
:root[data-theme="dark"] .md-risk--medio { background: #4a3a10; color: #f3dd9b; }

/* ---- M9 · Avisos ---- */
.am-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink); margin-left: auto; margin-right: 6px; }
.am-bell:hover { background: var(--surface-sunken, rgba(0,0,0,.05)); }
.am-bell__count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d64534; color: #fff; font: 600 11px/18px var(--font-sans); text-align: center; }
.av-list { list-style: none; margin: 0; padding: 0; }
.av-item + .av-item { border-top: 1px solid var(--line); }
.av-item button { all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 10px; padding: 10px 4px; cursor: pointer; align-items: flex-start; }
.av-item button > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.av-item.unread strong::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--select); margin-right: 6px; vertical-align: middle; }
.av-item:not(.unread) strong { font-weight: 500; }
.av-item.severe svg { color: #d64534; }
.av-pref { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.av-pref + .av-pref { border-top: 1px solid var(--line); }
.av-pref input { margin-top: 3px; }
.av-pref > span { display: flex; flex-direction: column; gap: 2px; }

/* Barra superior en celular: con la campanita no entraba todo y la página quedaba más ancha que la pantalla.
   El nombre del productor se achica con «…», el logo queda solo el ícono y nada empuja el ancho. */
.am-topbar > * { flex-shrink: 0; }
.am-topbar > .am-scope { flex: 1 1 auto; min-width: 0; }
.am-bell { margin-left: 0; }
@media (max-width: 760px) {
  .am-topbar { gap: 8px; } /* sin overflow:hidden: recortaba el menú del perfil */
  .am-scope__value { max-width: 100%; }
  .am-bell { width: 34px; height: 34px; margin-right: 0; }
}
@media (max-width: 480px) {
  .am-topbar .am-logo__name { display: none; }
  .season-pill { padding: 2px 2px 2px 6px; }
  .season-pill select { max-width: 74px; }
}

/* ---- Selectores con «+» (listas cerradas) ---- */
.pick { display: flex; gap: 6px; align-items: stretch; }
.pick select { flex: 1 1 auto; min-width: 0; }
.pick-add { flex: 0 0 auto; padding: 0 10px; }
.pick-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.am-sheet--top { z-index: 3000; }
.readonly-note { font-size: 13px; color: var(--ink-muted); background: var(--surface-sunken, rgba(0,0,0,.04)); border-radius: var(--radius-md); padding: 8px 12px; }

.rain-quick__tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.adm-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); }
.adm-link { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; }
.adm-link:hover { border-color: var(--select); }
.adm-link > span { display: flex; flex-direction: column; }

/* ---- Editor de polígonos ---- */
.pe-drawing { cursor: crosshair; }
.pe-vertex { background: #fff; border: 3px solid #2a71c4; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: grab; }
.pe-vertex:active { cursor: grabbing; }
.pe-vertex.pe-first { border-color: #2e8b45; background: #d9f2df; width: 24px !important; height: 24px !important; margin-left: -12px !important; margin-top: -12px !important; }
.pe-mid { background: rgba(255,255,255,.75); border: 2px solid #2a71c4; border-radius: 50%; cursor: copy; }
@media (pointer: coarse) {
  .pe-vertex { width: 26px !important; height: 26px !important; margin-left: -13px !important; margin-top: -13px !important; }
  .pe-mid { width: 20px !important; height: 20px !important; margin-left: -10px !important; margin-top: -10px !important; }
}
.pe-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-raised); }
.pe-bar > div { flex: 1 1 220px; }
.pe-bar__area { font-weight: 600; font-variant-numeric: tabular-nums; }
/* Los carteles del mapa del campo van debajo del buscador (antes quedaban tapados). */
.farm-map .map-hint { top: 62px; white-space: normal; text-align: center; max-width: min(560px, calc(100% - 24px)); }

/* ---- Panel de medidas del mapa ---- */
.map-info { background: rgba(23, 28, 36, .88); color: #fff; border-radius: 10px; font-size: 12px; line-height: 16px; min-width: 170px; max-width: 240px; box-shadow: 0 2px 10px rgba(0,0,0,.3); overflow: hidden; }
.map-info__head { all: unset; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; cursor: pointer; font-weight: 600; }
.map-info__head:focus-visible { outline: 2px solid #ffd23f; }
.map-info__chev { opacity: .7; }
.map-info__body { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 3px; }
.map-info__body > div:not(.map-info__sides) { display: flex; justify-content: space-between; gap: 10px; }
.map-info__body > div > span { opacity: .75; }
.map-info__sides { display: flex; flex-wrap: wrap; gap: 2px 8px; max-height: 84px; overflow-y: auto; padding-top: 3px; border-top: 1px solid rgba(255,255,255,.15); margin-top: 2px; opacity: .9; }
.map-info__sides .long { color: #ffd23f; }
.map-info__toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; padding-top: 4px; opacity: .9; }
.side-label { background: rgba(23, 28, 36, .78); color: #fff; border: 0; box-shadow: none; font-size: 11px; padding: 1px 5px; border-radius: 4px; }
.side-label::before { display: none; }
@media (max-width: 700px) { .map-info { max-width: 200px; } }

/* ---- Equipo ---- */
.am-scope__switch { font: 600 14px/18px var(--font-sans); text-transform: uppercase; letter-spacing: .02em; border: 0; background: transparent; color: var(--ink); padding: 0; max-width: 100%; text-overflow: ellipsis; cursor: pointer; }
.eq-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.eq-role { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; cursor: pointer; }
.eq-role.on { border-color: var(--select); background: var(--select-soft); }
.eq-role > span { display: flex; flex-direction: column; gap: 2px; }
.eq-link { margin-top: var(--space-4); padding: 12px; border-radius: var(--radius-md); background: var(--surface-sunken, rgba(0,0,0,.04)); display: flex; flex-direction: column; gap: 8px; }
.eq-link p { margin: 0; }
.eq-link code { word-break: break-all; font-size: 13px; }
.eq-invite { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; }
.eq-invite + .eq-invite { border-top: 1px solid var(--line); }
.eq-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: var(--space-4); border-radius: var(--radius-md); background: var(--select-soft); color: var(--on-select-soft); text-decoration: none; }
.eq-banner strong { margin-left: auto; }
.pick-checks .form-inline { display: inline-flex; align-items: center; gap: 6px; flex-direction: row; }

/* ---- Asistente de ayuda (chat) ---- */
.hc-root { position: fixed; right: 18px; bottom: 18px; z-index: 2400; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hc-fab { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--leaf, #2e6b37); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.28); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hc-fab:hover { filter: brightness(1.08); }
.hc-panel { width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100vh - 110px)); background: var(--surface-raised); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.3); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); }
.hc-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--leaf, #2e6b37); color: #fff; }
.hc-head__icon { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.18); align-items: center; justify-content: center; }
.hc-head__txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.hc-head__txt .small { opacity: .85; }
.hc-iconbtn { all: unset; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.hc-iconbtn:hover { background: rgba(255,255,255,.18); }
.hc-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column-reverse; gap: 10px; padding: 12px; background: var(--surface); }
.hc-msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.hc-msg--user { align-self: flex-end; align-items: flex-end; }
.hc-msg--bot { align-self: flex-start; }
.hc-bubble { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 20px; white-space: pre-wrap; background: var(--surface-raised); border: 1px solid var(--line); }
.hc-msg--user .hc-bubble { background: var(--leaf, #2e6b37); color: #fff; border-color: transparent; border-bottom-right-radius: 4px; }
.hc-msg--bot .hc-bubble { border-bottom-left-radius: 4px; }
.hc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--select-soft); color: var(--on-select-soft); text-decoration: none; border: 1px solid transparent; }
.hc-link:hover { border-color: var(--select); }
.hc-suggs { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.hc-sugg { font: 13px/18px var(--font-sans); padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-raised); color: var(--ink); cursor: pointer; text-align: left; }
.hc-sugg:hover { border-color: var(--select); }
.hc-inputrow { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-raised); }
.hc-input { flex: 1; min-width: 0; }
.hc-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--leaf, #2e6b37); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.hc-send:disabled { opacity: .45; cursor: default; }
.hc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.hc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: hc-blink 1.2s infinite; }
.hc-typing span:nth-child(2) { animation-delay: .2s; } .hc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes hc-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (max-width: 760px) {
  .hc-root { right: 12px; bottom: 76px; }
  .hc-root.is-open { left: 12px; bottom: 12px; align-items: stretch; }
  .hc-root.is-open .hc-panel { width: 100%; height: calc(100dvh - 24px); }
  .hc-root.is-open .hc-fab { display: none; }
}
.am-usermenu__item { text-decoration: none; }
