/* ==========================================================================
   Ganadería — hoja de estilos propia
   Se carga DESPUÉS de Bootstrap 5.3.3. Todo color sale de los tokens de
   :root / [data-bs-theme="dark"]; no escribas hex sueltos en las plantillas.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens — tema claro
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
  --g-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Verde potrero (marca) */
  --g-verde-900: #12291b;
  --g-verde-800: #1a3b27;
  --g-verde-700: #215036;
  --g-verde-600: #2a6a45;
  --g-verde-500: #2e7d4f;
  --g-verde-400: #4f9a6c;
  --g-verde-200: #b9d8c4;
  --g-verde-100: #dcebe1;
  --g-verde-50:  #eef6f0;

  /* Tierra (acento cálido) */
  --g-tierra-700: #6e4520;
  --g-tierra-600: #8a5a2b;
  --g-tierra-100: #f2e7d8;
  --g-tierra-50:  #f8f2ea;

  /* Superficies y tinta */
  --g-bg: #f5f4ef;
  --g-surface: #ffffff;
  --g-surface-2: #f9f8f4;
  --g-surface-3: #efede6;
  --g-border: #e4e2d9;
  --g-border-strong: #d3d0c4;
  --g-text: #1b221e;
  --g-text-2: #4a524c;
  --g-muted: #646b65;

  /* Marca en componentes */
  --g-primario: #2a6a45;          /* botones, enlaces (6.4:1 con blanco) */
  --g-primario-hover: #215036;
  --g-primario-activo: #1a3b27;
  --g-primario-texto: #2a6a45;    /* texto de marca sobre superficie */
  --g-primario-suave: #eef6f0;
  --g-primario-borde: #b9d8c4;
  --g-foco: rgba(46, 125, 79, .28);

  /* Barra lateral */
  --g-sidebar-bg: #15281c;
  --g-sidebar-borde: rgba(255, 255, 255, .07);
  --g-sidebar-texto: #c9d6cd;
  --g-sidebar-texto-fuerte: #ffffff;
  --g-sidebar-muted: #8ea597;
  --g-sidebar-hover: rgba(255, 255, 255, .06);
  --g-sidebar-activo-bg: rgba(127, 197, 154, .16);
  --g-sidebar-acento: #7fc59a;

  /* Barra superior */
  --g-topbar-bg: rgba(255, 255, 255, .88);

  /* Estados (siempre con icono + texto, nunca solo color) */
  --g-ok-bg: #e3f1e7;      --g-ok-texto: #1d5e35;      --g-ok-borde: #b9dcc4;
  --g-aviso-bg: #fbf0d5;   --g-aviso-texto: #6f4b00;   --g-aviso-borde: #efd593;
  --g-peligro-bg: #fae3e1; --g-peligro-texto: #9b2620; --g-peligro-borde: #f0bcb7;
  --g-info-bg: #e3ecf7;    --g-info-texto: #234f86;    --g-info-borde: #bcd0ea;
  --g-neutro-bg: #efede6;  --g-neutro-texto: #4a524c;  --g-neutro-borde: #dcd9cf;

  /* Gráficas (validado con dataviz/validate_palette.js, --pairs all, superficie #ffffff) */
  --viz-1: #2e7d4f;   /* verde  */
  --viz-2: #b58324;   /* ocre   */
  --viz-3: #3d6fb5;   /* azul   */
  --viz-surface: #ffffff;
  --viz-grid: #ebe9e2;
  --viz-axis: #d3d0c4;
  --viz-texto: #646b65;
  --viz-texto-fuerte: #1b221e;

  --g-sombra-sm: 0 1px 2px rgba(20, 30, 24, .05), 0 1px 1px rgba(20, 30, 24, .03);
  --g-sombra: 0 6px 24px rgba(20, 30, 24, .08);
  --g-radio: .75rem;
  --g-radio-sm: .5rem;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --barra-inferior-h: 64px;

  /* Bootstrap */
  --bs-body-font-family: var(--g-font);
  --bs-body-bg: var(--g-bg);
  --bs-body-color: var(--g-text);
  --bs-secondary-color: var(--g-muted);
  --bs-tertiary-bg: var(--g-surface-2);
  --bs-border-color: var(--g-border);
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .75rem;
  --bs-primary: #2a6a45;
  --bs-primary-rgb: 42, 106, 69;
  --bs-primary-text-emphasis: #1a3b27;
  --bs-primary-bg-subtle: #eef6f0;
  --bs-primary-border-subtle: #b9d8c4;
  --bs-link-color: #2a6a45;
  --bs-link-color-rgb: 42, 106, 69;
  --bs-link-hover-color: #1a3b27;
  --bs-link-hover-color-rgb: 26, 59, 39;
  --bs-focus-ring-color: rgba(46, 125, 79, .28);
  --bs-heading-color: var(--g-text);
}

/* --------------------------------------------------------------------------
   2. Tokens — tema oscuro (pasos elegidos, no inversión automática)
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
  --g-bg: #0f1311;
  --g-surface: #1b1f1c;
  --g-surface-2: #202521;
  --g-surface-3: #272d29;
  --g-border: #2d3430;
  --g-border-strong: #3a423d;
  --g-text: #e6e9e5;
  --g-text-2: #b9c0ba;
  --g-muted: #939a94;

  --g-primario: #2f7a4e;
  --g-primario-hover: #378a5a;
  --g-primario-activo: #2a6a45;
  --g-primario-texto: #7cc49a;
  --g-primario-suave: rgba(79, 154, 108, .14);
  --g-primario-borde: rgba(124, 196, 154, .35);
  --g-foco: rgba(124, 196, 154, .35);

  --g-sidebar-bg: #121714;
  --g-sidebar-borde: rgba(255, 255, 255, .06);

  --g-topbar-bg: rgba(27, 31, 28, .88);

  --g-ok-bg: rgba(46, 125, 79, .2);      --g-ok-texto: #95d6ad;      --g-ok-borde: rgba(149, 214, 173, .3);
  --g-aviso-bg: rgba(201, 145, 44, .18); --g-aviso-texto: #ebc673;   --g-aviso-borde: rgba(235, 198, 115, .3);
  --g-peligro-bg: rgba(208, 59, 59, .2); --g-peligro-texto: #f3a6a1; --g-peligro-borde: rgba(243, 166, 161, .3);
  --g-info-bg: rgba(61, 111, 181, .22);  --g-info-texto: #aac5ee;    --g-info-borde: rgba(170, 197, 238, .3);
  --g-neutro-bg: #272d29;                --g-neutro-texto: #b9c0ba;  --g-neutro-borde: #3a423d;

  /* Gráficas — pasos oscuros validados contra #1b1f1c */
  --viz-1: #2a7f50;
  --viz-2: #bc8a2b;
  --viz-3: #6283d6;
  --viz-surface: #1b1f1c;
  --viz-grid: #2a302c;
  --viz-axis: #3a423d;
  --viz-texto: #939a94;
  --viz-texto-fuerte: #e6e9e5;

  --g-sombra-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --g-sombra: 0 8px 28px rgba(0, 0, 0, .4);

  --bs-body-bg: var(--g-bg);
  --bs-body-color: var(--g-text);
  --bs-secondary-color: var(--g-muted);
  --bs-tertiary-bg: var(--g-surface-2);
  --bs-border-color: var(--g-border);
  --bs-primary: #7cc49a;
  --bs-primary-rgb: 124, 196, 154;
  --bs-primary-text-emphasis: #a9dbbd;
  --bs-primary-bg-subtle: rgba(79, 154, 108, .14);
  --bs-primary-border-subtle: rgba(124, 196, 154, .35);
  --bs-link-color: #7cc49a;
  --bs-link-color-rgb: 124, 196, 154;
  --bs-link-hover-color: #a9dbbd;
  --bs-link-hover-color-rgb: 169, 219, 189;
  --bs-focus-ring-color: rgba(124, 196, 154, .35);
  --bs-heading-color: var(--g-text);
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--g-font);
  background: var(--g-bg);
  color: var(--g-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { letter-spacing: -.015em; font-weight: 650; }
.text-muted, .text-body-secondary { color: var(--g-muted) !important; }
.text-secundario { color: var(--g-text-2) !important; }
.text-marca { color: var(--g-primario-texto) !important; }
.num { font-variant-numeric: tabular-nums; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
:focus-visible { outline: 2px solid var(--g-primario-texto); outline-offset: 2px; }
.visually-hidden-focusable:focus { position: fixed !important; top: .5rem; left: .5rem; z-index: 2000; background: var(--g-surface); padding: .5rem 1rem; border-radius: var(--g-radio-sm); box-shadow: var(--g-sombra); }

/* --------------------------------------------------------------------------
   4. Bootstrap: botones, formularios, tablas, paginación, pestañas
   -------------------------------------------------------------------------- */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: .5rem; --bs-btn-padding-x: .95rem; }
.btn-lg { --bs-btn-border-radius: .625rem; }
.btn-primary {
  --bs-btn-bg: var(--g-primario);
  --bs-btn-border-color: var(--g-primario);
  --bs-btn-hover-bg: var(--g-primario-hover);
  --bs-btn-hover-border-color: var(--g-primario-hover);
  --bs-btn-active-bg: var(--g-primario-activo);
  --bs-btn-active-border-color: var(--g-primario-activo);
  --bs-btn-disabled-bg: var(--g-primario);
  --bs-btn-disabled-border-color: var(--g-primario);
  --bs-btn-focus-shadow-rgb: 46, 125, 79;
  --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}
.btn-outline-primary {
  --bs-btn-color: var(--g-primario-texto);
  --bs-btn-border-color: var(--g-primario-borde);
  --bs-btn-hover-bg: var(--g-primario-suave);
  --bs-btn-hover-color: var(--g-primario-texto);
  --bs-btn-hover-border-color: var(--g-primario-texto);
  --bs-btn-active-bg: var(--g-primario-suave);
  --bs-btn-active-color: var(--g-primario-texto);
  --bs-btn-active-border-color: var(--g-primario-texto);
  --bs-btn-focus-shadow-rgb: 46, 125, 79;
}
.btn-suave {
  --bs-btn-color: var(--g-text);
  --bs-btn-bg: var(--g-surface);
  --bs-btn-border-color: var(--g-border-strong);
  --bs-btn-hover-color: var(--g-text);
  --bs-btn-hover-bg: var(--g-surface-3);
  --bs-btn-hover-border-color: var(--g-border-strong);
  --bs-btn-active-bg: var(--g-surface-3);
  --bs-btn-active-color: var(--g-text);
  --bs-btn-active-border-color: var(--g-border-strong);
  --bs-btn-focus-shadow-rgb: 46, 125, 79;
}
.btn-fantasma {
  --bs-btn-color: var(--g-text-2);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--g-text);
  --bs-btn-hover-bg: var(--g-surface-3);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--g-surface-3);
  --bs-btn-active-color: var(--g-text);
  --bs-btn-active-border-color: transparent;
}
.btn-icono { width: 2.5rem; height: 2.5rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icono i { font-size: 1.15rem; line-height: 1; }

.form-control, .form-select {
  border-color: var(--g-border-strong);
  background-color: var(--g-surface);
  min-height: 2.75rem;            /* objetivo táctil */
}
textarea.form-control { min-height: 6rem; }
.form-control-sm, .form-select-sm { min-height: 2.25rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--g-verde-400);
  box-shadow: 0 0 0 .25rem var(--g-foco);
}
.form-control::placeholder { color: var(--g-muted); opacity: .85; }
.form-label { font-weight: 500; font-size: .925rem; margin-bottom: .35rem; color: var(--g-text); }
.form-text { color: var(--g-muted); }
.form-check-input { border-color: var(--g-border-strong); width: 1.15em; height: 1.15em; }
.form-check-input:checked { background-color: var(--g-primario); border-color: var(--g-primario); }
.form-check-input:focus { border-color: var(--g-verde-400); box-shadow: 0 0 0 .25rem var(--g-foco); }
.form-switch .form-check-input:focus:not(:checked) {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%234f9a6c'/%3e%3c/svg%3e");
}
.input-group-text { background: var(--g-surface-2); border-color: var(--g-border-strong); color: var(--g-muted); }
.requerido::after { content: " *"; color: var(--g-peligro-texto); }

.card {
  --bs-card-bg: var(--g-surface);
  --bs-card-border-color: var(--g-border);
  --bs-card-border-radius: var(--g-radio);
  --bs-card-inner-border-radius: calc(var(--g-radio) - 1px);
  --bs-card-cap-bg: transparent;
  box-shadow: var(--g-sombra-sm);
}
.dropdown-menu {
  --bs-dropdown-bg: var(--g-surface);
  --bs-dropdown-border-color: var(--g-border);
  --bs-dropdown-link-active-bg: var(--g-primario-suave);
  --bs-dropdown-link-active-color: var(--g-primario-texto);
  --bs-dropdown-link-hover-bg: var(--g-surface-3);
  --bs-dropdown-border-radius: .625rem;
  box-shadow: var(--g-sombra);
  padding: .375rem;
}
.dropdown-item { border-radius: .4rem; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { color: var(--g-muted); width: 1.1rem; text-align: center; }
.dropdown-header { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--g-muted); }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--g-text);
  --bs-table-border-color: var(--g-border);
  --bs-table-hover-bg: var(--g-surface-2);
  --bs-table-hover-color: var(--g-text);
  margin-bottom: 0;
}
.table > thead th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--g-muted); font-weight: 600; background: var(--g-surface-2);
  border-bottom-color: var(--g-border); white-space: nowrap; padding-top: .7rem; padding-bottom: .7rem;
}
.table > tbody td { vertical-align: middle; padding-top: .75rem; padding-bottom: .75rem; }
.table td.num, .table th.num { text-align: right; }
.th-orden { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.th-orden:hover { color: var(--g-text); }

.pagination {
  --bs-pagination-color: var(--g-text-2);
  --bs-pagination-bg: var(--g-surface);
  --bs-pagination-border-color: var(--g-border);
  --bs-pagination-hover-color: var(--g-text);
  --bs-pagination-hover-bg: var(--g-surface-3);
  --bs-pagination-hover-border-color: var(--g-border);
  --bs-pagination-focus-color: var(--g-text);
  --bs-pagination-focus-bg: var(--g-surface-3);
  --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--g-foco);
  --bs-pagination-active-bg: var(--g-primario);
  --bs-pagination-active-border-color: var(--g-primario);
  --bs-pagination-active-color: #fff;
  --bs-pagination-disabled-bg: var(--g-surface);
  --bs-pagination-disabled-color: var(--g-muted);
  --bs-pagination-disabled-border-color: var(--g-border);
  margin: 0;
}
.page-link { min-width: 2.5rem; min-height: 2.5rem; display: inline-flex; align-items: center; justify-content: center; }

.nav-underline {
  --bs-nav-link-color: var(--g-text-2);
  --bs-nav-link-hover-color: var(--g-text);
  --bs-nav-underline-link-active-color: var(--g-primario-texto);
  --bs-nav-underline-gap: 1.25rem;
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--g-border);
}
.nav-underline::-webkit-scrollbar { display: none; }
.nav-underline .nav-link { white-space: nowrap; font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; padding: .75rem 0; }
.nav-underline .nav-link .badge { font-weight: 600; }

.alert { --bs-alert-border-radius: .625rem; display: flex; gap: .75rem; align-items: flex-start; }
.alert > i { font-size: 1.15rem; line-height: 1.3; }
.alert-success { --bs-alert-bg: var(--g-ok-bg); --bs-alert-color: var(--g-ok-texto); --bs-alert-border-color: var(--g-ok-borde); }
.alert-warning { --bs-alert-bg: var(--g-aviso-bg); --bs-alert-color: var(--g-aviso-texto); --bs-alert-border-color: var(--g-aviso-borde); }
.alert-danger  { --bs-alert-bg: var(--g-peligro-bg); --bs-alert-color: var(--g-peligro-texto); --bs-alert-border-color: var(--g-peligro-borde); }
.alert-info    { --bs-alert-bg: var(--g-info-bg); --bs-alert-color: var(--g-info-texto); --bs-alert-border-color: var(--g-info-borde); }
.alert .btn-close { margin-left: auto; padding: .25rem; }

/* --------------------------------------------------------------------------
   5. Etiquetas de estado (pastillas)
   -------------------------------------------------------------------------- */
.etiqueta {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600; line-height: 1;
  padding: .35rem .6rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--g-neutro-borde); background: var(--g-neutro-bg); color: var(--g-neutro-texto);
}
.etiqueta i { font-size: .8rem; }
.etiqueta-ok      { background: var(--g-ok-bg);      color: var(--g-ok-texto);      border-color: var(--g-ok-borde); }
.etiqueta-aviso   { background: var(--g-aviso-bg);   color: var(--g-aviso-texto);   border-color: var(--g-aviso-borde); }
.etiqueta-peligro { background: var(--g-peligro-bg); color: var(--g-peligro-texto); border-color: var(--g-peligro-borde); }
.etiqueta-info    { background: var(--g-info-bg);    color: var(--g-info-texto);    border-color: var(--g-info-borde); }
.etiqueta-marca   { background: var(--g-primario-suave); color: var(--g-primario-texto); border-color: var(--g-primario-borde); }

/* --------------------------------------------------------------------------
   6. Estructura: shell, barra lateral, barra superior
   -------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.app-sidebar {
  --bs-offcanvas-width: 288px;
  --bs-offcanvas-bg: var(--g-sidebar-bg);
  --bs-offcanvas-color: var(--g-sidebar-texto);
  --bs-offcanvas-border-color: var(--g-sidebar-borde);
}
.sidebar-interior {
  display: flex; flex-direction: column; height: 100%; width: 100%;
  background: var(--g-sidebar-bg); color: var(--g-sidebar-texto);
}
@media (min-width: 992px) {
  .app-sidebar {
    width: var(--sidebar-w); flex: 0 0 auto;
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    transition: width .2s ease;
    z-index: 1030;
  }
}
.sidebar-cabecera {
  display: flex; align-items: center; height: var(--topbar-h); flex-shrink: 0;
  border-bottom: 1px solid var(--g-sidebar-borde);
}
.sidebar-marca {
  display: flex; align-items: center; gap: .75rem; min-width: 0;
  height: 100%; padding: 0 1.1rem; flex: 1 1 auto;
  color: var(--g-sidebar-texto-fuerte); text-decoration: none;
}
.sidebar-marca:hover { color: var(--g-sidebar-texto-fuerte); }
.marca-logo { width: 34px; height: 34px; flex-shrink: 0; color: var(--g-verde-500); }
.marca-nombre { font-weight: 700; font-size: 1.075rem; letter-spacing: -.01em; white-space: nowrap; }
.marca-sub { display: block; font-size: .7rem; font-weight: 500; color: var(--g-sidebar-muted); letter-spacing: .02em; }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: .75rem .75rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-grupo-titulo {
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--g-sidebar-muted); padding: 1rem .75rem .4rem; white-space: nowrap;
}
.nav-grupo-titulo:first-child { padding-top: .25rem; }
.sidebar-link {
  position: relative; display: flex; align-items: center; gap: .75rem;
  min-height: 44px; padding: .5rem .75rem; margin-bottom: 2px;
  border-radius: .55rem; color: var(--g-sidebar-texto); text-decoration: none;
  font-size: .925rem; font-weight: 500; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-link i { font-size: 1.15rem; width: 1.5rem; text-align: center; flex-shrink: 0; color: var(--g-sidebar-muted); transition: color .15s; }
.sidebar-link:hover { background: var(--g-sidebar-hover); color: var(--g-sidebar-texto-fuerte); }
.sidebar-link:hover i { color: var(--g-sidebar-texto-fuerte); }
.sidebar-link.active { background: var(--g-sidebar-activo-bg); color: var(--g-sidebar-texto-fuerte); }
.sidebar-link.active i { color: var(--g-sidebar-acento); }
.sidebar-link.active::before {
  content: ""; position: absolute; left: -.75rem; top: .55rem; bottom: .55rem;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--g-sidebar-acento);
}
.sidebar-link:focus-visible { outline-color: var(--g-sidebar-acento); }
.sidebar-pie {
  flex-shrink: 0; padding: .9rem 1.1rem; border-top: 1px solid var(--g-sidebar-borde);
  font-size: .78rem; color: var(--g-sidebar-muted); display: flex; align-items: center; gap: .6rem;
}
.sidebar-pie i { font-size: 1rem; }
.sidebar-cerrar { color: var(--g-sidebar-texto); margin-left: auto; }

/* Barra lateral colapsada (solo escritorio) */
@media (min-width: 992px) {
  html.sidebar-colapsada { --sidebar-w: 76px; }
  html.sidebar-colapsada .marca-texto,
  html.sidebar-colapsada .nav-texto,
  html.sidebar-colapsada .sidebar-pie-texto { display: none; }
  html.sidebar-colapsada .sidebar-marca { justify-content: center; padding: 0; }
  html.sidebar-colapsada .nav-grupo-titulo { font-size: 0; padding: .6rem 0; }
  html.sidebar-colapsada .nav-grupo-titulo::after { content: ""; display: block; height: 1px; margin: 0 .75rem; background: var(--g-sidebar-borde); }
  html.sidebar-colapsada .nav-grupo-titulo:first-child { display: none; }
  html.sidebar-colapsada .sidebar-link { justify-content: center; padding: .5rem; }
  html.sidebar-colapsada .sidebar-pie { justify-content: center; }
}

.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-h); display: flex; align-items: center; gap: .5rem;
  padding: 0 1rem; background: var(--g-topbar-bg);
  -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--g-border);
}
@media (min-width: 992px) { .app-topbar { padding: 0 1.5rem; } }
.topbar-marca-movil { display: inline-flex; align-items: center; color: var(--g-text); text-decoration: none; }
.topbar-marca-movil .marca-logo { width: 30px; height: 30px; }
.topbar-separador { width: 1px; height: 28px; background: var(--g-border); margin: 0 .25rem; }

.selector-empresa {
  display: inline-flex; align-items: center; gap: .55rem; max-width: 100%;
  border: 1px solid var(--g-border); background: var(--g-surface);
  border-radius: .6rem; padding: .35rem .65rem; color: var(--g-text); min-height: 2.5rem;
}
.selector-empresa:hover, .selector-empresa[aria-expanded="true"] { background: var(--g-surface-3); }
.selector-empresa .icono-empresa {
  width: 26px; height: 26px; border-radius: .4rem; display: inline-flex; align-items: center; justify-content: center;
  background: var(--g-tierra-100); color: var(--g-tierra-700); font-size: .85rem; flex-shrink: 0;
}
[data-bs-theme="dark"] .selector-empresa .icono-empresa { background: rgba(168, 113, 55, .2); color: #e0b98c; }
.selector-empresa .nombre { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
@media (min-width: 768px) { .selector-empresa .nombre { max-width: 260px; } }
.selector-empresa .bi-chevron-expand { color: var(--g-muted); font-size: .85rem; }
.empresa-item-activa { font-weight: 600; }

.usuario-boton { display: inline-flex; align-items: center; gap: .6rem; border: 0; background: transparent; padding: .25rem .35rem; border-radius: .6rem; color: var(--g-text); }
.usuario-boton:hover, .usuario-boton[aria-expanded="true"] { background: var(--g-surface-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--g-verde-100); color: var(--g-verde-700); font-weight: 700; font-size: .85rem; letter-spacing: .02em;
}
[data-bs-theme="dark"] .avatar { background: rgba(79, 154, 108, .22); color: #a9dbbd; }
.usuario-datos { text-align: left; line-height: 1.15; }
.usuario-nombre { display: block; font-weight: 600; font-size: .875rem; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-rol { display: block; font-size: .75rem; color: var(--g-muted); }

/* Contenido */
.app-contenido { flex: 1 0 auto; width: 100%; max-width: 1600px; margin: 0 auto; padding: 1rem 1rem calc(var(--barra-inferior-h) + 1.5rem + env(safe-area-inset-bottom)); }
@media (min-width: 576px) { .app-contenido { padding-left: 1.25rem; padding-right: 1.25rem; } }
@media (min-width: 992px) { .app-contenido { padding: 1.75rem 2rem 2.5rem; } }
.app-pie { font-size: .8rem; color: var(--g-muted); padding: 1rem 2rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1.25rem; }
@media (max-width: 991.98px) { .app-pie { display: none; } }
.encabezado-pagina { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.encabezado-pagina h1 { font-size: 1.5rem; margin: 0; }
@media (min-width: 992px) { .encabezado-pagina h1 { font-size: 1.75rem; } }
.encabezado-pagina .descripcion { color: var(--g-muted); margin: .25rem 0 0; font-size: .95rem; }
.encabezado-acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { --bs-breadcrumb-font-size: .825rem; --bs-breadcrumb-divider-color: var(--g-muted); --bs-breadcrumb-item-active-color: var(--g-muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--g-text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--g-primario-texto); text-decoration: underline; }

.zona-mensajes { display: grid; gap: .5rem; margin-bottom: 1rem; }

/* Barra inferior (móvil) */
.barra-inferior {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
  height: calc(var(--barra-inferior-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  background: var(--g-surface); border-top: 1px solid var(--g-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .04);
}
.barra-inferior a, .barra-inferior button.item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--g-muted); text-decoration: none; font-size: .68rem; font-weight: 500;
  background: transparent; border: 0; padding: 0;
}
.barra-inferior i { font-size: 1.3rem; line-height: 1; }
.barra-inferior .active { color: var(--g-primario-texto); }
.barra-inferior .boton-central { display: flex; align-items: center; justify-content: center; }
.boton-registrar {
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--g-primario); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(42, 106, 69, .35); transform: translateY(-10px);
}
.boton-registrar i { font-size: 1.6rem; }
.boton-registrar:hover { background: var(--g-primario-hover); }

/* --------------------------------------------------------------------------
   7. Panel: KPI, tarjetas, gráficas, alertas
   -------------------------------------------------------------------------- */
.barra-filtros {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  margin-bottom: 1.25rem;
}
.barra-filtros .form-select { width: auto; min-width: 12rem; }
@media (max-width: 575.98px) { .barra-filtros .form-select, .barra-filtros > * { flex: 1 1 100%; } }

.kpi { height: 100%; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; }
@media (min-width: 992px) { .kpi { padding: 1.15rem 1.25rem; } }
.kpi-cabecera { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kpi-etiqueta { font-size: .825rem; font-weight: 500; color: var(--g-text-2); line-height: 1.25; }
.kpi-icono {
  width: 34px; height: 34px; border-radius: .55rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--g-primario-suave); color: var(--g-primario-texto); font-size: 1rem;
}
.kpi-icono.tierra { background: var(--g-tierra-50); color: var(--g-tierra-600); }
[data-bs-theme="dark"] .kpi-icono.tierra { background: rgba(168, 113, 55, .18); color: #e0b98c; }
.kpi-valor { font-size: 1.6rem; font-weight: 650; letter-spacing: -.025em; line-height: 1.1; color: var(--g-text); word-break: break-word; }
@media (min-width: 1400px) { .kpi-valor { font-size: 1.8rem; } }
@media (max-width: 575.98px) { .kpi { padding: .85rem .9rem; } .kpi-valor { font-size: 1.3rem; } .kpi-icono { width: 30px; height: 30px; font-size: .9rem; } .kpi-etiqueta { font-size: .78rem; } }
.kpi-unidad { font-size: .85rem; font-weight: 500; color: var(--g-muted); letter-spacing: 0; margin-left: .15rem; }
.kpi-pie { font-size: .78rem; color: var(--g-muted); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: auto; }
.delta { display: inline-flex; align-items: center; gap: .15rem; font-weight: 600; }
.delta-sube { color: var(--g-ok-texto); }
.delta-baja { color: var(--g-peligro-texto); }
.delta-igual { color: var(--g-muted); }
.proporcion { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; background: transparent; margin-top: .15rem; }
.proporcion > span { display: block; height: 100%; border-radius: 3px; }
.proporcion .p-hembras { background: var(--viz-1); }
.proporcion .p-machos { background: var(--viz-3); }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.punto-1 { background: var(--viz-1); }
.punto-2 { background: var(--viz-2); }
.punto-3 { background: var(--viz-3); }

.tarjeta-encabezado {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
  padding: 1rem 1.1rem .5rem;
}
@media (min-width: 992px) { .tarjeta-encabezado { padding: 1.15rem 1.25rem .5rem; } }
.tarjeta-titulo { font-size: 1rem; font-weight: 650; margin: 0; display: flex; align-items: center; gap: .5rem; }
.tarjeta-titulo i { color: var(--g-muted); font-size: 1rem; }
.tarjeta-sub { font-size: .8rem; color: var(--g-muted); margin: .15rem 0 0; }
.tarjeta-cuerpo { padding: .5rem 1.1rem 1.1rem; }
@media (min-width: 992px) { .tarjeta-cuerpo { padding: .5rem 1.25rem 1.25rem; } }

.leyenda { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--g-text-2); margin-bottom: .5rem; }
.leyenda span { display: inline-flex; align-items: center; gap: .4rem; }
.leyenda .clave { width: 10px; height: 10px; border-radius: 3px; }
.leyenda .clave-linea { width: 14px; height: 2px; border-radius: 1px; }

.grafica-caja { position: relative; height: 280px; width: 100%; }
.grafica-caja.alta { height: 320px; }
.grafica-caja.baja { height: 200px; }
@media (max-width: 575.98px) { .grafica-caja, .grafica-caja.alta { height: 240px; } }
.grafica-caja canvas { display: block; }
.tabla-grafica { max-height: 280px; overflow: auto; border: 1px solid var(--g-border); border-radius: var(--g-radio-sm); }
.tabla-grafica table { font-size: .85rem; }
.tabla-grafica td, .tabla-grafica th { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla-grafica thead th { position: sticky; top: 0; z-index: 1; }
.btn-ver-tabla { white-space: nowrap; flex-shrink: 0; }
.btn-ver-tabla[aria-pressed="true"] { background: var(--g-primario-suave); color: var(--g-primario-texto); border-color: var(--g-primario-borde); }

.lista-alertas { list-style: none; margin: 0; padding: 0; }
.lista-alertas li { display: flex; align-items: center; gap: .85rem; padding: .7rem 0; border-top: 1px solid var(--g-border); }
.lista-alertas li:first-child { border-top: 0; }
.lista-alertas .alerta-principal { min-width: 0; flex: 1 1 auto; }
.lista-alertas .alerta-titulo { font-weight: 600; font-size: .925rem; color: var(--g-text); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-alertas a.alerta-titulo:hover { color: var(--g-primario-texto); text-decoration: underline; }
.lista-alertas .alerta-meta { font-size: .78rem; color: var(--g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fecha-bloque {
  width: 46px; flex-shrink: 0; text-align: center; border-radius: .5rem; overflow: hidden;
  border: 1px solid var(--g-border); background: var(--g-surface-2); line-height: 1;
}
.fecha-bloque .mes { display: block; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .25rem 0; background: var(--g-tierra-50); color: var(--g-tierra-700); }
[data-bs-theme="dark"] .fecha-bloque .mes { background: rgba(168, 113, 55, .18); color: #e0b98c; }
.fecha-bloque .dia { display: block; font-size: 1.05rem; font-weight: 700; padding: .3rem 0 .35rem; }
.icono-alerta { width: 38px; height: 38px; border-radius: .55rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.icono-alerta.ok { background: var(--g-ok-bg); color: var(--g-ok-texto); }
.icono-alerta.aviso { background: var(--g-aviso-bg); color: var(--g-aviso-texto); }
.icono-alerta.peligro { background: var(--g-peligro-bg); color: var(--g-peligro-texto); }
.icono-alerta.neutro { background: var(--g-neutro-bg); color: var(--g-neutro-texto); }
.contador { font-size: .75rem; font-weight: 600; color: var(--g-muted); background: var(--g-surface-3); border-radius: 999px; padding: .15rem .5rem; }
.enlace-ver-todo { font-size: .825rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.enlace-ver-todo:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   8. Estados vacíos
   -------------------------------------------------------------------------- */
.estado-vacio { text-align: center; padding: 2.5rem 1rem; max-width: 420px; margin: 0 auto; }
.estado-vacio.compacto { padding: 1.25rem .5rem; }
.estado-vacio svg { width: 132px; height: auto; margin-bottom: 1rem; }
.estado-vacio.compacto svg { width: 84px; margin-bottom: .5rem; }
.estado-vacio-icono {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto .85rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--g-primario-suave); color: var(--g-primario-texto); font-size: 1.5rem;
}
.estado-vacio.compacto .estado-vacio-icono { width: 44px; height: 44px; font-size: 1.2rem; margin-bottom: .6rem; }
.estado-vacio h2, .estado-vacio h3 { font-size: 1.05rem; font-weight: 650; margin-bottom: .35rem; }
.estado-vacio p { color: var(--g-muted); font-size: .9rem; margin-bottom: 1rem; }
.estado-vacio.compacto p { font-size: .85rem; margin-bottom: .5rem; }
.ilus-trazo { stroke: var(--g-border-strong); }
.ilus-relleno { fill: var(--g-surface-3); }
.ilus-marca { fill: var(--g-primario-suave); stroke: var(--g-primario-borde); }
.ilus-acento { fill: var(--g-verde-400); }

/* --------------------------------------------------------------------------
   9. Listados: barra de herramientas y tabla → tarjetas en móvil
   -------------------------------------------------------------------------- */
.barra-herramientas { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem; border-bottom: 1px solid var(--g-border); }
.barra-herramientas .buscador { flex: 1 1 260px; min-width: 0; position: relative; }
.barra-herramientas .buscador i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--g-muted); pointer-events: none; }
.barra-herramientas .buscador .form-control { padding-left: 2.4rem; }
.barra-herramientas .filtro { flex: 0 1 190px; min-width: 0; }
@media (max-width: 575.98px) { .barra-herramientas .filtro { flex: 1 1 calc(50% - .25rem); } }
.filtros-activos { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .85rem 0; }
.pie-tabla { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1rem; border-top: 1px solid var(--g-border); font-size: .85rem; color: var(--g-muted); }

.celda-principal { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.celda-principal .miniatura {
  width: 38px; height: 38px; border-radius: .5rem; flex-shrink: 0; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--g-primario-suave); color: var(--g-primario-texto); font-weight: 700; font-size: .8rem;
}
.celda-principal .titulo { font-weight: 600; color: var(--g-text); text-decoration: none; display: block; }
.celda-principal a.titulo:hover { color: var(--g-primario-texto); text-decoration: underline; }
.celda-principal .subtitulo { font-size: .8rem; color: var(--g-muted); display: block; }
.celda-acciones { white-space: nowrap; text-align: right; width: 1%; }
.celda-acciones .btn { --bs-btn-padding-x: .5rem; }

@media (max-width: 767.98px) {
  .tabla-responsiva thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tabla-responsiva, .tabla-responsiva tbody, .tabla-responsiva tr, .tabla-responsiva td { display: block; width: 100%; }
  .tabla-responsiva tbody { padding: .75rem; display: grid; gap: .75rem; }
  .tabla-responsiva tr {
    border: 1px solid var(--g-border); border-radius: var(--g-radio); background: var(--g-surface);
    padding: .35rem .9rem; box-shadow: var(--g-sombra-sm);
  }
  .tabla-responsiva > tbody > tr > td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .45rem 0; border: 0; border-top: 1px dashed transparent; text-align: right; font-size: .9rem;
  }
  .tabla-responsiva > tbody > tr > td + td { border-top: 1px solid var(--g-border); }
  .tabla-responsiva > tbody > tr > td::before {
    content: attr(data-label); color: var(--g-muted); font-size: .78rem; font-weight: 500; text-align: left; flex-shrink: 0;
  }
  .tabla-responsiva > tbody > tr > td.celda-titulo { padding: .6rem 0 .55rem; text-align: left; }
  .tabla-responsiva > tbody > tr > td.celda-titulo::before,
  .tabla-responsiva > tbody > tr > td.celda-acciones::before { content: none; }
  .tabla-responsiva > tbody > tr > td.celda-acciones { width: 100%; justify-content: flex-end; gap: .35rem; padding: .55rem 0 .45rem; }
  .tabla-responsiva > tbody > tr > td.celda-acciones .btn { min-height: 2.5rem; }
  .tabla-responsiva .table-hover > tbody > tr:hover > * { --bs-table-bg-state: transparent; }
  .tabla-responsiva td.num { text-align: right; }
  .card > .tabla-contenedor .tabla-responsiva tbody { background: var(--g-bg); }
}

/* --------------------------------------------------------------------------
   10. Formularios
   -------------------------------------------------------------------------- */
.formulario-tarjeta { max-width: 920px; }
.seccion-form + .seccion-form { border-top: 1px solid var(--g-border); padding-top: 1.25rem; margin-top: 1.25rem; }
.seccion-form-titulo { font-size: .95rem; font-weight: 650; margin-bottom: .85rem; }
.acciones-form {
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end;
  padding: 1rem 1.25rem; border-top: 1px solid var(--g-border); background: var(--g-surface-2);
  border-radius: 0 0 var(--g-radio) var(--g-radio);
}
@media (max-width: 767.98px) {
  .acciones-form {
    position: sticky; bottom: calc(var(--barra-inferior-h) + env(safe-area-inset-bottom)); z-index: 5;
    border-radius: 0; margin: 0 -1px -1px; box-shadow: 0 -6px 16px rgba(0, 0, 0, .05);
  }
  .acciones-form .btn { flex: 1 1 0; min-height: 2.9rem; }
}
.campo-archivo-actual { font-size: .825rem; color: var(--g-muted); }
.errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--g-peligro-texto); font-size: .825rem; }

/* --------------------------------------------------------------------------
   11. Ficha de animal
   -------------------------------------------------------------------------- */
.ficha-cabecera { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; padding: 1.25rem; }
.ficha-foto {
  width: 112px; height: 112px; border-radius: 1rem; flex-shrink: 0; object-fit: cover;
  background: var(--g-primario-suave); border: 1px solid var(--g-primario-borde);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ficha-foto svg { width: 72%; height: auto; }
@media (min-width: 992px) { .ficha-foto { width: 128px; height: 128px; } }
.ficha-identidad { flex: 1 1 260px; min-width: 0; }
.ficha-codigo { font-size: .8rem; font-weight: 600; letter-spacing: .04em; color: var(--g-muted); text-transform: uppercase; display: inline-flex; align-items: center; gap: .35rem; }
.ficha-nombre { font-size: 1.6rem; margin: .1rem 0 .5rem; }
.ficha-etiquetas { display: flex; flex-wrap: wrap; gap: .4rem; }
.ficha-acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) { .ficha-acciones { width: 100%; } .ficha-acciones > .btn, .ficha-acciones > .dropdown { flex: 1 1 auto; } .ficha-acciones .dropdown > .btn { width: 100%; } }
.ficha-cifras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--g-border); }
@media (min-width: 768px) { .ficha-cifras { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ficha-cifras > div { padding: .9rem 1.25rem; border-right: 1px solid var(--g-border); border-bottom: 1px solid var(--g-border); min-width: 0; }
@media (min-width: 768px) { .ficha-cifras > div { border-bottom: 0; } .ficha-cifras > div:last-child { border-right: 0; } }
@media (max-width: 767.98px) { .ficha-cifras > div:nth-child(2n) { border-right: 0; } .ficha-cifras > div:nth-last-child(-n+2) { border-bottom: 0; } }
.cifra-etiqueta { font-size: .75rem; color: var(--g-muted); font-weight: 500; display: block; }
.cifra-valor { font-size: 1.15rem; font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lista-datos { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: .55rem 1rem; margin: 0; font-size: .9rem; }
.lista-datos dt { color: var(--g-muted); font-weight: 500; }
.lista-datos dd { margin: 0; text-align: right; font-weight: 500; word-break: break-word; }

.genealogia { display: grid; gap: 1rem; }
.linea-gen-titulo { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--g-muted); margin-bottom: .4rem; }
.nodo-gen {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: .6rem;
  border: 1px solid var(--g-border); background: var(--g-surface-2); color: var(--g-text); text-decoration: none; min-height: 44px;
}
a.nodo-gen:hover { border-color: var(--g-primario-borde); background: var(--g-primario-suave); }
.nodo-gen .sexo { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .85rem; }
.nodo-gen .sexo.h { background: var(--g-primario-suave); color: var(--g-primario-texto); }
.nodo-gen .sexo.m { background: var(--g-info-bg); color: var(--g-info-texto); }
.nodo-gen .nodo-codigo { font-weight: 600; font-size: .875rem; display: block; }
.nodo-gen .nodo-sub { font-size: .75rem; color: var(--g-muted); display: block; }
.nodo-gen.vacio { border-style: dashed; background: transparent; color: var(--g-muted); }
.abuelos { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0 0 1rem; padding-left: .85rem; border-left: 2px solid var(--g-border); }
.abuelos .nodo-gen { padding: .4rem .55rem; }
.abuelos .nodo-gen .sexo { width: 22px; height: 22px; font-size: .7rem; }
@media (max-width: 400px) { .abuelos { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   12. Login y páginas de error
   -------------------------------------------------------------------------- */
.pagina-simple { min-height: 100vh; min-height: 100dvh; display: flex; background: var(--g-bg); }
.login-marca {
  position: relative; display: none; flex: 1 1 50%; overflow: hidden;
  background: linear-gradient(160deg, #1d3b28 0%, #15281c 55%, #0f1d14 100%);
  color: #e8f0ea; padding: 3rem;
}
@media (min-width: 992px) { .login-marca { display: flex; flex-direction: column; justify-content: space-between; } }
.login-marca .paisaje { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: auto; pointer-events: none; }
.login-marca .marca-logo { width: 44px; height: 44px; color: #4f9a6c; }
.login-marca h2 { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; max-width: 26ch; color: #fff; }
.login-marca p { color: #b7c9bd; max-width: 40ch; }
.login-marca .beneficios { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; color: #d3e0d7; font-size: .95rem; }
.login-marca .beneficios i { color: #7fc59a; margin-right: .5rem; }
.login-panel { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.login-caja { width: 100%; max-width: 400px; }
.login-caja .marca-movil { display: flex; align-items: center; gap: .65rem; margin-bottom: 2rem; color: var(--g-text); }
.login-caja .marca-movil .marca-logo { width: 40px; height: 40px; }
@media (min-width: 992px) { .login-caja .marca-movil { display: none; } }
.login-caja h1 { font-size: 1.6rem; }
.boton-ojo { border-color: var(--g-border-strong); }

.pagina-error { margin: auto; text-align: center; padding: 2rem 1.25rem; max-width: 520px; }
.pagina-error .codigo { font-size: 4.5rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; color: var(--g-primario-texto); }
.pagina-error svg.ilus { width: 220px; max-width: 70%; height: auto; margin-bottom: 1.25rem; }

/* --------------------------------------------------------------------------
   13. Utilidades varias
   -------------------------------------------------------------------------- */
.min-w-0 { min-width: 0; }
.texto-truncado { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.separador-vertical { width: 1px; align-self: stretch; background: var(--g-border); }
.aviso-preview {
  font-size: .78rem; background: var(--g-aviso-bg); color: var(--g-aviso-texto);
  border-bottom: 1px solid var(--g-aviso-borde); padding: .35rem 1rem; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .app-sidebar, .app-topbar, .barra-inferior, .encabezado-acciones, .btn-ver-tabla, .acciones-form { display: none !important; }
  .app-contenido { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Inventario por categoría (tabla categorías x lotes) ---------- */
.tabla-inventario .fila-grupo th {
  background: var(--g-neutro-bg);
  color: var(--g-text);
  font-weight: 600;
}
.tabla-inventario thead th:first-child,
.tabla-inventario tbody th[scope="row"],
.tabla-inventario tfoot th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--g-surface);
  min-width: 9.5rem;
}
.tabla-inventario thead th { white-space: nowrap; }
