.farm-icon{
  width:36px;
  height:36px;
  min-width:36px;
  min-height:36px;
  flex:0 0 36px;
  aspect-ratio:1 / 1;
  border-radius:50%;
  display:grid;
  place-items:center;
  line-height:1;
  overflow:hidden;
}

/* Modal sanitario largo: mantenerlo dentro de la pantalla */
.modal-card{
  max-height:calc(100vh - 32px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

#health-form{
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-right:8px;
  margin-right:-8px;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

#health-form .modal-actions{
  position:sticky;
  bottom:0;
  z-index:4;
  background:#fff;
  border-top:1px solid #e2e6e2;
  padding-top:14px;
  padding-bottom:2px;
  margin-top:18px;
}

#health-form input,
#health-form select,
#health-form textarea{
  min-width:0;
  max-width:100%;
}

/* Selectores: tipografía y paleta visual consistentes en toda la app */
select{
  font-family:inherit!important;
  font-size:.84rem!important;
  font-weight:650!important;
  color:#24312c!important;
  line-height:1.35!important;
  background-color:#fff!important;
  border-color:#dfe5df!important;
  accent-color:#b7cd58;
}
select:focus{
  outline:none!important;
  border-color:#8eaa36!important;
  box-shadow:0 0 0 3px rgba(183,205,88,.20)!important;
}
select option{
  font-family:inherit!important;
  font-size:.84rem!important;
  font-weight:500!important;
  color:#24312c!important;
  background:#fff;
}
select option:checked{
  color:#173f32!important;
  background:#b7cd58 linear-gradient(0deg,#b7cd58 0%,#b7cd58 100%)!important;
}
select option:hover{
  color:#173f32!important;
  background:#e8efc8!important;
}

/* Botón Ejecutar: evitar que el texto se salga */
.activity-execute-btn{
  min-width:78px!important;
  padding:8px 14px!important;
  white-space:nowrap!important;
  line-height:1.1!important;
  margin-left:8px!important;
}

/* Actividades navegables */
.task.activity-clickable{cursor:pointer;border-radius:10px;padding-left:8px;padding-right:8px;transition:background .15s,box-shadow .15s}
.task.activity-clickable:hover{background:#f8faf7;box-shadow:inset 0 0 0 1px #e2e6e2}
.task.activity-clickable:focus{outline:2px solid #b7cd58;outline-offset:2px}
.calendar-event{cursor:pointer!important}

.activity-detail-modal{position:fixed;inset:0;background:rgba(12,25,20,.58);display:none;place-items:center;padding:20px;z-index:135}
.activity-detail-modal.open{display:grid}
.activity-detail-card{width:min(560px,100%);max-height:90vh;overflow:auto;background:#fff;border-radius:18px;padding:26px;box-shadow:0 30px 80px rgba(0,0,0,.25);position:relative}
.activity-detail-close{position:absolute;right:17px;top:13px;border:0;background:none;font-size:1.6rem;cursor:pointer}
.activity-detail-card h2{margin:4px 0 10px}
.activity-detail-status{display:inline-block;border-radius:20px;padding:5px 9px;font-size:.72rem;font-weight:800;margin-bottom:14px;background:#fff5ea;color:#8d481c}
.activity-detail-status.completed{background:#eaf4ed;color:#245c49}.activity-detail-status.cancelled{background:#eef0ef;color:#68746f}
.activity-detail-section{border:1px solid #e2e6e2;border-radius:12px;padding:15px;margin:10px 0;background:#fff}
.activity-detail-section.completed-box{background:#f7fbf8}
.activity-detail-section h3{margin:0 0 10px;font-size:.92rem}
.activity-detail-row{display:grid;grid-template-columns:145px 1fr;gap:12px;padding:7px 0;border-bottom:1px solid #eef0ed;font-size:.8rem}
.activity-detail-row:last-child{border-bottom:0}.activity-detail-row span{color:#68746f}.activity-detail-row strong{font-weight:700}
.activity-detail-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:16px;position:sticky;bottom:-26px;background:#fff;padding:14px 0 2px;border-top:1px solid #eef0ed}

/* Animales: mantener las dos acciones juntas y alineadas a la derecha */
#animals .section-head{
  justify-content:flex-start;
  gap:10px;
  align-items:center;
}
#animals .section-head > div:first-child{margin-right:auto}
#animals .section-import-btn{
  margin-left:0!important;
  background:#b7cd58!important;
  border-color:#b7cd58!important;
  color:#173f32!important;
  font-weight:800!important;
}
#animals .section-import-btn:hover{filter:brightness(.97)}

/* Importación de animales */
#animal-import-modal .eyebrow{display:none}
#animal-import-message::before{
  content:"Antes de importar, revisa que la categoría coincida con una opción disponible en ST Ganadería: Ternero/a, Novilla, Vaca, Vaca seca, Toro, Novillo u Otro. El nombre del lote también debe existir exactamente en la app; si no deseas asignarlo todavía, deja la celda lote vacía.\A\A";
  display:block;
  white-space:pre-line;
  color:#485650;
  font-weight:600;
  line-height:1.45;
}

.app-copyright{display:none!important}

body.authenticated::after{
  content:"© 2026 ST Ganadería · Developed by ST Radix";
  position:fixed;
  right:22px;
  bottom:14px;
  z-index:20;
  font-size:.68rem;
  line-height:1.2;
  color:#758079;
  letter-spacing:.01em;
  text-align:right;
  pointer-events:none;
  user-select:none;
}

/* Navegación: la estructura visible vive en index.html desde el primer frame. */
#nav .veterinary-catalog-nav,
#nav .inventory-nav,
.sidebar .nav-item[data-view="farm-settings"]{display:none!important}
#nav-reports-static,
#nav-veterinary-static,
#nav-inventory-static,
#nav-settings-static{visibility:visible!important;opacity:1!important}
#nav-settings-static{
  width:100%;
  margin:10px 0 0;
  padding-top:13px;
  padding-bottom:13px;
  flex:0 0 auto;
  border-top:1px solid rgba(255,255,255,.12);
  border-radius:0 0 11px 11px;
}
#nav-reports-static,#nav-veterinary-static,#nav-inventory-static{width:100%}

/* Lotes */
#lots-grid .lot-card > div:not(.lot-calf-performance){align-items:baseline!important}
#lots-grid .lot-card > div:not(.lot-calf-performance) > small:first-of-type{
  align-self:baseline!important;
  line-height:1!important;
  transform:translateY(0)!important;
}

/* Dashboard: reservar tarjeta para Producción de leche */
#dashboard .cost-chart:not(.milk-trend-card){position:relative;min-height:252px;overflow:hidden}
#dashboard .cost-chart:not(.milk-trend-card) > *{visibility:hidden!important}
#dashboard .cost-chart:not(.milk-trend-card)::before{
  content:"Producción de leche\A Tendencia de los últimos 7 días";
  white-space:pre;
  position:absolute;
  left:20px;
  top:18px;
  color:#24312c;
  font-weight:800;
  font-size:.9rem;
  line-height:1.55;
}
#dashboard .cost-chart:not(.milk-trend-card)::after{
  content:"Cargando tendencia…";
  position:absolute;
  left:20px;
  right:20px;
  top:92px;
  min-height:120px;
  display:grid;
  place-items:center;
  border-top:1px solid #eef0ed;
  color:#78837d;
  font-size:.76rem;
  font-weight:400;
}

#dashboard .herd-panel:not(.lot-inventory-ready){position:relative;overflow:hidden}
#dashboard .herd-panel:not(.lot-inventory-ready) .legend,
#dashboard .herd-panel:not(.lot-inventory-ready) .donut > div{visibility:hidden!important}
#dashboard .herd-panel:not(.lot-inventory-ready) .donut{background:#edf0ed!important}
#dashboard .herd-panel:not(.lot-inventory-ready) .panel-head p{visibility:hidden!important;position:relative}
#dashboard .herd-panel:not(.lot-inventory-ready) .panel-head p::after{
  content:"Cargando distribución por lotes…";
  visibility:visible;
  position:absolute;
  left:0;
  top:0;
  color:#68746f;
  font-weight:400;
}

/* Gestión económica: lectura visual inmediata de ingresos y egresos. */
#costs .econ4-badge{
  background:#1f7a3a!important;
  color:#fff!important;
  border:1px solid #1f7a3a!important;
}
#costs .econ4-badge.out{
  background:#c83b32!important;
  color:#fff!important;
  border-color:#c83b32!important;
}
#costs .econ4-table tr:has(.econ4-badge.out) .econ4-amount{
  color:#c83b32!important;
}

@media(max-width:560px){
  .modal{align-items:flex-start;padding:10px}
  .modal-card{max-height:calc(100vh - 20px);padding:22px 18px}
  .activity-detail-card{padding:22px 18px}
  .activity-detail-row{grid-template-columns:1fr;gap:2px}
  #animals .section-head{align-items:stretch;flex-wrap:wrap}
  #animals .section-head > div:first-child{width:100%;margin-right:0}
  #animals .section-import-btn,#animals .section-head .primary{flex:1 1 auto}
  body.authenticated::after{right:12px;bottom:8px;font-size:.62rem}
}


/* Navegación estable: sin inserciones tardías ni superposición con Ajustes. */
.sidebar{display:flex;flex-direction:column;overflow:hidden}
.sidebar .brand{flex:0 0 auto}
.sidebar #nav{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  align-content:start;
  padding-bottom:8px;
}
#nav-production-static,
#nav-reproduction-static,
#nav-reports-static,
#nav-veterinary-static,
#nav-inventory-static{width:100%;flex:0 0 auto}
#nav-settings-static{position:relative;z-index:2;background:var(--green,#174f3d)}

/* Navegación responsive: solo la lista central hace scroll. */
.sidebar nav::-webkit-scrollbar{width:5px}
.sidebar nav::-webkit-scrollbar-track{background:transparent}
.sidebar nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,.20);border-radius:999px}
@media(max-height:760px){
  .sidebar{padding-top:22px;padding-bottom:18px}
  .sidebar .brand{padding-bottom:20px}
  .sidebar .nav-item{padding-top:11px;padding-bottom:11px}
}


/* Resumen: explicación ejecutiva del ordeño del día */
#milk-today-summary{
  display:block;
  margin-top:10px;
  max-width:290px;
  color:#68746f;
  font-size:.72rem;
  line-height:1.45;
  font-weight:400;
}


/* Resumen: estado y causa del ordeño diario */
#dashboard .milk-daily-state{
  display:block;
  color:#24312c;
  font-size:.76rem;
  font-weight:700;
  line-height:1.25;
}
#dashboard .milk-daily-state.not-milked{color:#9a4b32}
#dashboard .milk-daily-state.noncommercial{color:#8a6a16}
#dashboard .milk-daily-detail{
  display:block;
  margin-top:3px;
  color:#758079;
  font-size:.68rem;
  line-height:1.3;
  font-weight:400;
}


/* Reproducción: primera capa operativa */
#reproduction .reproduction-head{margin-bottom:14px}
.reproduction-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.reproduction-tab{
  border:1px solid #dfe5df;
  background:#fff;
  color:#405049;
  border-radius:999px;
  padding:8px 13px;
  font:inherit;
  font-size:.78rem;
  font-weight:750;
  cursor:pointer;
}
.reproduction-tab.active{
  background:#173f32;
  border-color:#173f32;
  color:#fff;
}
.reproduction-tab.is-pending{
  color:#8a948f;
  background:#f4f5f1;
  cursor:default;
}
.reproduction-stats{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}
.reproduction-stat{
  min-width:0;
  min-height:124px;
  background:#fff;
  border:1px solid #e0e5e1;
  border-radius:14px;
  padding:17px 16px;
  box-shadow:0 8px 24px rgba(29,50,42,.04);
}
.reproduction-stat span,
.reproduction-stat small{display:block}
.reproduction-stat span{
  color:#52615b;
  font-size:.74rem;
  font-weight:760;
  line-height:1.25;
}
.reproduction-stat strong{
  display:block;
  margin:10px 0 7px;
  font-size:1.75rem;
  line-height:1;
  color:#173f32;
}
.reproduction-stat small{
  color:#7d8984;
  font-size:.68rem;
  line-height:1.35;
}
.reproduction-stat.attention{
  border-color:#ead8bd;
  background:#fffdf8;
}
.reproduction-stat.attention strong{color:#a86720}
.reproduction-layout{
  display:grid;
  grid-template-columns:minmax(0,1.65fr) minmax(290px,.75fr);
  gap:16px;
  align-items:start;
}
.reproduction-agenda,
.reproduction-focus{min-height:260px}
.reproduction-agenda-count{
  padding:5px 9px;
  border-radius:999px;
  background:#eef2ef;
  color:#52615b;
  font-size:.68rem;
  font-weight:800;
  white-space:nowrap;
}
.reproduction-empty{
  min-height:170px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:16px;
  padding:28px 16px;
  text-align:left;
}
.reproduction-empty-icon{
  width:48px;
  height:48px;
  flex:0 0 48px;
  border-radius:13px;
  display:grid;
  place-items:center;
  background:#eef3d5;
  color:#496226;
}
.reproduction-empty-icon svg{
  width:26px;
  height:26px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.reproduction-empty strong{
  display:block;
  margin-bottom:5px;
  color:#24312c;
  font-size:.86rem;
}
.reproduction-empty p{
  margin:0;
  max-width:600px;
  color:#738079;
  font-size:.74rem;
  line-height:1.55;
}
.reproduction-focus-list{
  display:grid;
  gap:0;
  border-top:1px solid #eef0ed;
}
.reproduction-focus-list > div{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:13px 0;
  border-bottom:1px solid #eef0ed;
}
.reproduction-focus-list span{
  color:#52615b;
  font-size:.75rem;
}
.reproduction-focus-list strong{
  color:#173f32;
  font-size:.9rem;
}
.reproduction-note{
  display:block;
  margin-top:14px;
  color:#7d8984;
  font-size:.67rem;
  line-height:1.45;
}
@media(max-width:1280px){
  .reproduction-stats{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:900px){
  .reproduction-layout{grid-template-columns:1fr}
}
@media(max-width:650px){
  .reproduction-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .reproduction-empty{align-items:flex-start}
}


/* Reproducción · Hembras */
.reproduction-panel[hidden]{display:none!important}
.reproduction-panel.active{display:block}
.reproduction-females-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  margin:2px 0 14px;
}
.reproduction-females-head h3{margin:0 0 4px;font-size:1rem}
.reproduction-females-head p{margin:0;color:#68746f;font-size:.76rem}
.reproduction-females-count{
  flex:0 0 auto;
  padding:6px 10px;
  border-radius:999px;
  background:#eef2ef;
  color:#43534c;
  font-size:.7rem;
  font-weight:800;
}
.reproduction-females-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:12px;
}
#reproduction-females-search{
  width:min(390px,100%);
  border:1px solid #dfe5df;
  border-radius:10px;
  background:#fff;
  color:#24312c;
  font:inherit;
  font-size:.78rem;
  padding:10px 12px;
  outline:none;
}
#reproduction-females-search:focus{
  border-color:#8eaa36;
  box-shadow:0 0 0 3px rgba(183,205,88,.18);
}
.reproduction-data-note{
  color:#7b8781;
  font-size:.68rem;
  line-height:1.4;
  text-align:right;
}
.reproduction-females-table-panel{padding:0;overflow:hidden}
.reproduction-females-table{min-width:980px}
.reproduction-females-table th{white-space:nowrap}
.reproduction-females-table td{vertical-align:middle}
.reproduction-animal-code{
  display:block;
  margin-top:2px;
  color:#7d8984;
  font-size:.67rem;
  font-weight:500;
}
.reproduction-state-empty,
.reproduction-next-empty{
  display:inline-block;
  border-radius:999px;
  padding:4px 8px;
  font-size:.67rem;
  font-weight:750;
  white-space:nowrap;
}
.reproduction-state-empty{
  background:#f0f2ef;
  color:#68746f;
}
.reproduction-next-empty{
  background:#fff8e9;
  color:#8a6a16;
}
.reproduction-days-open{text-align:center}
@media(max-width:720px){
  .reproduction-females-head,
  .reproduction-females-toolbar{align-items:stretch;flex-direction:column}
  .reproduction-data-note{text-align:left}
  #reproduction-females-search{width:100%}
}


.reproduction-female-row{cursor:pointer;transition:background .15s,box-shadow .15s}
.reproduction-female-row:hover{background:#f7faf6;box-shadow:inset 3px 0 0 #b7cd58}
.reproduction-female-row:focus{outline:2px solid #b7cd58;outline-offset:-2px}


.reproduction-state-heat{
  display:inline-block;
  border-radius:999px;
  padding:4px 8px;
  font-size:.67rem;
  font-weight:750;
  white-space:nowrap;
  background:#eef3d5;
  color:#496226;
}


/* Reproducción: historial de celos y ventana de servicio */
.reproduction-heat-list{display:grid;margin-top:8px;border-top:1px solid #eef0ed}
.reproduction-heat-list-head,.reproduction-heat-row{display:grid;grid-template-columns:1.05fr .9fr 1.35fr 1.1fr;gap:14px;align-items:center}
.reproduction-heat-list-head{padding:10px 4px 8px;color:#7a8680;font-size:.66rem;font-weight:800;text-transform:uppercase;letter-spacing:.035em}
.reproduction-heat-row{width:100%;border:0;border-top:1px solid #eef0ed;background:#fff;padding:12px 4px;text-align:left;color:#24312c;font:inherit;cursor:pointer}
.reproduction-heat-row:hover{background:#fafcf8}
.reproduction-heat-row b{display:block;font-size:.76rem;line-height:1.3}
.reproduction-heat-row small{display:block;margin-top:3px;color:#7a8680;font-size:.65rem;line-height:1.3}
.reproduction-window-state{display:inline-block;border-radius:999px;padding:4px 8px;font-style:normal;font-size:.66rem;font-weight:800;white-space:nowrap}
.reproduction-window-state.upcoming{background:#fff3df;color:#946016}
.reproduction-window-state.active{background:#eaf5ed;color:#2e6f43}
.reproduction-window-state.overdue{background:#fff0e9;color:#a45127}
.reproduction-window-state.done{background:#eef2fb;color:#4964a4}
.reproduction-window-state.pending{background:#f0f2ef;color:#68746f}
@media(max-width:850px){.reproduction-heat-list-head{display:none}.reproduction-heat-row{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.reproduction-heat-row{grid-template-columns:1fr}}


.reproduction-method-indicator{
  display:inline-flex;
  align-items:center;
  padding:7px 10px;
  border-radius:999px;
  background:#eef2ef;
  color:#43534c;
  font-size:.7rem;
  font-weight:800;
  white-space:nowrap;
}

.reproduction-state-pending{display:inline-flex;padding:4px 8px;border-radius:999px;background:#eef2fb;color:#4964a4;font-size:.68rem;font-weight:800}
