:root {
  /* ===== Diseño Agro Manager (ver .claude/skills/agro-manager-design) ===== */
  /* superficies */
  --c-page: #faf8ff; --c-surface: #ffffff; --c-tint-1: #f2f3ff; --c-tint-2: #eaedff; --c-tint-3: #e2e7ff; --c-tint-4: #dae2fd;
  /* verde de marca */
  --c-primary: #004c22; --c-primary-fill: #166534; --c-primary-soft: #a6f4b5; --c-on-primary-soft: #00210b; --c-primary-soft-2: #93e0a2; --c-on-primary: #ffffff;
  /* secundarios */
  --c-secondary: #006c49; --c-mint: #6cf8bb; --c-on-mint: #00714d; --c-lime: #acf847; --c-on-lime: #2b4800; --c-chart-expected: #4edea3;
  /* estados */
  --c-danger: #ba1a1a; --c-danger-soft: #ffdad6; --c-on-danger-soft: #93000a; --c-warn-soft: #fdf1d6; --c-on-warn-soft: #7a4f00;
  /* texto */
  --c-text: #131b2e; --c-text-2: #404940; --c-text-muted: #707a6f; --c-text-faint: #bfc9bd;
  /* filas */
  --c-border: #eaedff; --row-selected: rgba(166, 244, 181, .25); --row-current: rgba(242, 243, 255, .4); --row-alert: #fff8f7; --row-totals: #e2e7ff;
  /* tipografía */
  --font-head: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* radios, sombras y medidas */
  --r-xs: 2px; --r-sm: 4px; --r-md: 8px; --r-pill: 12px;
  --sh-card: 0 1px 2px rgba(0, 0, 0, .05); --sh-shell: 0 1px 4px rgba(0, 0, 0, .04); --sh-inset: inset 0 2px 4px rgba(0, 0, 0, .05);
  --w-aside: 240px; --h-topbar: 64px; --pad-page-x: 20px; --gap-section: 12px;

  /* nombres anteriores, apuntando al diseño nuevo (los usa el resto de las pantallas) */
  --bg: var(--c-page); --surface: var(--c-surface); --surface-2: var(--c-tint-1); --text: var(--c-text); --muted: var(--c-text-muted); --border: var(--c-tint-3);
  --accent: var(--c-primary-fill); --accent-text: var(--c-on-primary);
  --urgent: var(--c-danger); --urgent-bg: var(--c-danger-soft); --soon: var(--c-on-warn-soft); --soon-bg: var(--c-warn-soft);
  --plan: var(--c-secondary); --plan-bg: var(--c-tint-2); --ok-bg: var(--c-primary-soft);
  --radius: var(--r-md); --gutter: 16px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.sticky-top { position: sticky; top: 0; z-index: 5; }
.syncbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 8px var(--gutter); background: var(--soon-bg); color: var(--soon); font-weight: 600; font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.syncbar.error { background: var(--urgent-bg); color: var(--urgent); }
.syncbar[hidden] { display: none; }
.syncbar .btn { background: transparent; color: inherit; border-color: currentColor; min-height: 34px; }
.timeline li.cat-pending { border-color: var(--soon); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .farm { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar select { max-width: 55vw; }
main { max-width: 720px; margin: 0 auto; padding: var(--gutter); display: grid; gap: 14px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: grid; place-items: center; gap: 2px; padding: 10px 4px; min-height: 60px;
  text-decoration: none; color: var(--muted); font-size: 0.8rem; font-weight: 600;
}
.tabs a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.tabs .ico { font-size: 1.35rem; line-height: 1; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.danger { color: var(--urgent); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 0.9rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.btn[disabled] { opacity: 0.55; cursor: progress; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }

label.field { display: grid; gap: 4px; font-weight: 600; font-size: 0.92rem; }
label.field small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
textarea { min-height: 80px; resize: vertical; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 650;
  background: var(--surface-2); color: var(--text);
}
.badge.urgent { background: var(--urgent-bg); color: var(--urgent); }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.plan { background: var(--plan-bg); color: var(--plan); }
.badge.ok { background: var(--ok-bg); color: var(--accent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 0.9rem;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: transparent; }

.list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.item .title { font-weight: 700; }
.item .sub { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; }
a.item:hover { border-color: var(--accent); }
.group-title { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.group-title .count { color: var(--muted); font-weight: 400; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
.facts div { display: grid; }
.facts dt { color: var(--muted); font-size: 0.82rem; }
.facts dd { margin: 0; font-weight: 650; }

.alert { padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.alert.urgent { background: var(--urgent-bg); color: var(--urgent); }
.alert.soon { background: var(--soon-bg); color: var(--soon); }

.timeline { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.timeline li { display: grid; gap: 2px; padding: 10px 0 10px 14px; border-left: 3px solid var(--border); position: relative; }
.timeline li.cat-repro { border-color: var(--plan); }
.timeline li.cat-salud { border-color: var(--urgent); }
.timeline li.cat-baja { border-color: var(--muted); }
.timeline .when { color: var(--muted); font-size: 0.85rem; }

.kpi { display: grid; gap: 2px; }
.kpi .value { font-size: 1.8rem; font-weight: 750; line-height: 1.1; }
.kpi .unit { color: var(--muted); font-size: 0.85rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
.scroll-x { overflow-x: auto; }

svg.spark { width: 100%; height: 90px; display: block; }
svg.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.spark .area { fill: var(--ok-bg); }
svg.spark .axis { stroke: var(--border); stroke-width: 1; }

/* ---------- Diálogo ---------- */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog form { display: grid; gap: 12px; }
.form-error { color: var(--urgent); font-weight: 600; margin: 0; }

/* ---------- Ingreso ---------- */
.login { max-width: 400px; margin: 0 auto; padding: 48px var(--gutter); display: grid; gap: 18px; }
.login .logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); display: grid; place-items: center; color: var(--accent-text); font-size: 1.8rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px; z-index: 20;
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.error { background: var(--urgent); color: #fff; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs { position: static; max-width: 720px; margin: 0 auto; border: 0; background: transparent; grid-template-columns: repeat(5, auto); justify-content: start; gap: 8px; }
  .tabs a { grid-auto-flow: column; min-height: 44px; padding: 0 16px; border-radius: 999px; }
  .tabs a[aria-current="page"] { background: var(--ok-bg); box-shadow: none; }
  .toast { bottom: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .item { transition: background-color .12s, border-color .12s; }
}

/* ---------- Seguridad: 2FA, códigos de recuperación, enlaces ---------- */
.linkbtn { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--accent); font: inherit; font-weight: 600; text-align: left; cursor: pointer; text-decoration: underline; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.06em; word-break: break-all; background: var(--surface-2); padding: 12px; border-radius: 10px; margin: 0; user-select: all; }
.codes { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 14px; background: var(--surface-2); border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.04em; user-select: all; }
.login .stack { display: grid; gap: 14px; }

/* ---------- Leche: captura del día ---------- */
.small { font-size: 0.85rem; }
.date-nav { flex-wrap: nowrap; }
.date-nav input { flex: 1; min-width: 0; text-align: center; }
.date-nav .btn { min-width: 48px; font-size: 1.3rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; }
.segmented button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 650; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.18); color: var(--accent); }
.milk-summary { position: sticky; top: 0; z-index: 3; display: grid; gap: 8px; }
.sticky-top ~ main .milk-summary { top: 56px; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.milk-done { margin: 0; color: var(--accent); font-weight: 700; }
.milk-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.milk-row[hidden] { display: none; }
.milk-cow { display: grid; gap: 2px; min-width: 0; }
.milk-cow .title { font-weight: 700; font-size: 1.05rem; }
.milk-entry { display: flex; align-items: center; gap: 6px; }
.milk-input { width: 5.6rem; min-height: 52px; font-size: 1.4rem; font-weight: 700; text-align: right; padding: 4px 10px; }
.milk-entry .unit { color: var(--muted); font-weight: 600; }
.mark { width: 1.6rem; text-align: center; font-weight: 800; }
.mark.saved { color: var(--accent); }
.mark.error { color: var(--urgent); }
.milk-input[aria-invalid="true"] { border-color: var(--urgent); }
.muted.warn, .warn { color: var(--soon); font-weight: 700; }

/* ---------- Selección de varios animales ---------- */
.actionbar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 6;
  display: grid; gap: 8px; padding: 10px var(--gutter); background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
.actionbar[hidden] { display: none; }
.actionbar .row { justify-content: space-between; }
.bar-spacer { height: 96px; }
.item.selectable { grid-template-columns: auto 1fr; cursor: pointer; }
.item.selectable input[type="checkbox"] { width: 26px; height: 26px; min-height: 0; accent-color: var(--accent); }
.item.selectable .grid-rest { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.item.selectable .grid-rest .sub { grid-column: 1 / -1; }
.filters select { flex: 1; }

/* ---------- Más y lotes ---------- */
.more-item { grid-template-columns: auto 1fr; }
.more-item .ico { font-size: 1.6rem; grid-row: span 2; }
button.item { width: 100%; text-align: left; cursor: pointer; font: inherit; }
.lot-card .lot-n { font-size: 1.5rem; font-weight: 750; }
@media (min-width: 900px) { .actionbar { bottom: 0; left: 50%; right: auto; transform: translateX(-50%); width: min(720px, 100%); border-radius: 14px 14px 0 0; } }

/* ---------- Toros e inventario ---------- */
.sire-card .row { justify-content: flex-end; }
.sire-card.inactive { opacity: 0.65; }
.supply-qty { font-size: 1.05rem; text-align: right; white-space: nowrap; }
.supply-qty b { font-size: 1.35rem; }
.stat.warnstat b { color: var(--soon); }
.stat.urgentstat b { color: var(--urgent); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.check input { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); flex: none; }
.supply-box { padding: 12px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); }
.stock-alert { text-decoration: none; display: block; }
.lot-row { display: grid; gap: 6px; }
h2 { margin-top: 6px; }

/* ---------- Reportes ---------- */
.report-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.report-params .btn { align-self: end; }
.grow { flex: 1; min-width: 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
.report-table { min-width: 100%; white-space: nowrap; }
.report-table th, .report-table td { padding: 8px 10px; }
.report-table td.num, .report-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table thead th { position: sticky; top: 0; background: var(--surface-2); }
.report-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.report-table .total-row td { font-weight: 800; border-top: 2px solid var(--border); }
.th-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; min-height: 32px; text-align: inherit; }
.print-head { display: none; }

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --text: #000; --muted: #444; --border: #bbb; }
  body { padding: 0; background: #fff; color: #000; font-size: 10pt; }
  .tabs, .sticky-top, .noprint, .toast, dialog, .syncbar, .actionbar { display: none !important; }
  main { max-width: none; padding: 0; display: block; }
  .print-head { display: block; margin-bottom: 8px; }
  .print-head h1 { font-size: 14pt; }
  .print-head p { margin: 2px 0; }
  .summary { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
  .stat { break-inside: avoid; padding: 4px 8px; }
  .stat b { font-size: 12pt; }
  .table-wrap { overflow: visible; border: 0; }
  .report-table { white-space: normal; font-size: 9pt; }
  .report-table th, .report-table td { padding: 3px 5px; border-bottom: 1px solid #ccc; }
  .report-table thead { display: table-header-group; }
  .report-table tr { break-inside: avoid; }
  .report-table thead th { position: static; }
  .th-btn { font-weight: 700; }
  @page { margin: 12mm; }
}

/* ---------- Gráficas ---------- */
.chart-fig { margin: 0; display: grid; gap: 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
svg.chart .axis { stroke: var(--muted); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 9px; }
svg.chart .axis-label { fill: var(--muted); font-size: 10px; font-weight: 600; }
svg.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
svg.chart .line.s0, svg.chart .dot.s0 { stroke: var(--accent); }
svg.chart .line.s1, svg.chart .dot.s1 { stroke: var(--plan); }
svg.chart .dot { fill: var(--surface); stroke-width: 1.6; }
svg.chart .dashed, .swatch.dashed { stroke-dasharray: 5 4; }
svg.chart .bar.s0 { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 22px; height: 0; border-top: 3px solid var(--accent); }
.swatch.s1 { border-top-color: var(--plan); }
.swatch.dashed { border-top-style: dashed; }
@media print { svg.chart .tick, svg.chart .axis-label { fill: #000; } .chart-fig { break-inside: avoid; } }

/* ---------- Crías, genealogía ---------- */
.calf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; padding: 10px; background: var(--surface-2); border-radius: 12px; }
.calf-row strong, .calf-row .linkbtn { grid-column: 1 / -1; }
.calf-row .linkbtn { text-align: right; min-height: 32px; }
ul.plain { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
section.card th[scope="row"] { width: 42%; font-weight: 600; color: var(--muted); }

/* ---------- Usuarios y datos ---------- */
.member-card.inactive { opacity: 0.65; }
.member-card .sub { gap: 6px 10px; }
details.card summary { cursor: pointer; font-weight: 650; min-height: 32px; }
textarea[aria-label="Filas de leche"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
input[type="file"] { padding: 10px; }

/* ---------- Protocolos y pendientes ---------- */
.rule { padding: 8px 0; border-top: 1px solid var(--border); }
.rule summary { cursor: pointer; }
.inactive { opacity: 0.55; }
ul.plain li.row { padding: 4px 0; }

.hint-move { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2, rgba(127,127,127,0.12)); font-weight: 600; }

/* ---------- Tablero del hato ---------- */
.counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.counter { display: grid; gap: 2px; align-content: start; min-height: 76px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none; }
.counter b { font-size: 1.6rem; line-height: 1.1; font-weight: 750; }
.counter span { font-size: 0.86rem; color: var(--muted); }
.counter.zero b { color: var(--muted); font-weight: 600; }
.counter.hot { border-color: var(--urgent); background: var(--urgent-bg); }
.counter.hot b { color: var(--urgent); }
.counter.hot span { color: var(--text); }
.counter:focus-visible, .counter:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alert-strip a.badge { text-decoration: none; padding: 6px 10px; }
.muted.small { font-size: 0.85rem; }
@media print { .counter { break-inside: avoid; } }

/* ---------- Indicadores con meta ---------- */
a.kpi-card { text-decoration: none; color: var(--text); gap: 4px; }
a.kpi-card:hover, a.kpi-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kpi .value small { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
svg.kpi-bar { width: 100%; height: 18px; display: block; margin: 2px 0; }
svg.kpi-bar .zone.bad { fill: #d9534f; } svg.kpi-bar .zone.warn { fill: #e0a526; } svg.kpi-bar .zone.good { fill: #3f9a68; }
svg.kpi-bar .goal { stroke: var(--surface); stroke-width: 0.8; }
svg.kpi-bar .m12 { fill: var(--text); stroke: var(--surface); stroke-width: 0.4; }
svg.kpi-bar .m90 { fill: var(--plan, #2b6cb0); }
.trend.better { color: var(--accent); font-weight: 600; } .trend.worse { color: var(--urgent); font-weight: 600; } .trend.flat { color: var(--muted); }
.asof input { width: auto; min-height: 36px; padding: 4px 8px; }
svg.chart .line.s2, svg.chart .dot.s2 { stroke: var(--muted); }
.swatch.s2 { border-top-color: var(--muted); }

/* ---------- Actualizar desde un respaldo ---------- */
pre.report-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.82rem; margin: 8px 0 0; padding: 10px; border-radius: 8px; background: var(--surface-2); max-height: 60vh; overflow: auto; }
progress { width: 100%; height: 14px; accent-color: var(--accent); }

/* ---------- Vistas personalizadas ---------- */
.view-table td:first-child, .view-table th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.view-table thead th:first-child { background: var(--surface-2); z-index: 2; }
.view-table tfoot td { background: var(--surface-2); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; padding-top: 8px; }
ol.chosen { margin: 0; padding-left: 1.4rem; display: grid; gap: 6px; }
ol.chosen li input { flex: 1; min-width: 0; }
.filter-row { flex-wrap: wrap; }
.filter-row select, .filter-row input { flex: 1 1 150px; min-width: 0; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 70px; padding: 8px 0; background: var(--bg); z-index: 3; }
@media print { .no-print { display: none !important; } .view-table td:first-child, .view-table th:first-child { position: static; } }

/* ---------- Control lechero (células, grasa y proteína junto a los litros) ---------- */
.milk-extra { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.milk-extra-field { display: inline-flex; align-items: center; gap: 4px; }
.milk-input.small { width: 5.2rem; min-height: 44px; font-size: 1rem; }
.milk-extra .unit { font-size: 0.8rem; color: var(--muted); }

/* estándares de crecimiento: tabla de 37 meses con el peso editable */
.std-table td.num, .std-table th { text-align: right; font-variant-numeric: tabular-nums; }
.std-table td.num.bad { color: #d9534f; font-weight: 650; }
.std-table input { width: 6.5rem; text-align: right; padding: 6px 8px; }

/* registro masivo: hoja editable tipo Excel (filas = registros, columnas = datos del evento) */
.sheet-wrap { overflow: auto; max-height: 72vh; border-radius: var(--r-sm); background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-tint-3); }
table.sheet { border-collapse: separate; border-spacing: 0; min-width: 100%; font: 500 13px/18px var(--font-body); color: var(--c-text); }
.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--c-tint-2); font: 700 10px/18px var(--font-body); letter-spacing: .5px; text-transform: uppercase; color: var(--c-text-2); text-align: left; padding: 7px 8px; white-space: nowrap; border-bottom: 1px solid var(--c-tint-3); border-right: 1px solid var(--c-tint-3); }
.sheet thead th .req { color: var(--c-danger); }
.sheet td { padding: 0; border-bottom: 1px solid var(--c-tint-2); border-right: 1px solid var(--c-tint-2); vertical-align: middle; background: var(--c-surface); }
.sheet .n { position: sticky; left: 0; z-index: 1; width: 2.6rem; min-width: 2.6rem; padding: 0 8px; text-align: right; color: var(--c-text-muted); background: var(--c-tint-1); font-variant-numeric: tabular-nums; }
.sheet thead th.n { z-index: 3; background: var(--c-tint-2); }
main .sheet-wrap table.sheet input, main .sheet-wrap table.sheet select { display: block; width: 100%; min-width: 7rem; min-height: 44px; margin: 0; border: 1px solid transparent; border-radius: 0; background: transparent; padding: 4px 8px; font: inherit; color: inherit; box-sizing: border-box; }
@media (min-width: 900px) { main .sheet-wrap table.sheet input, main .sheet-wrap table.sheet select { min-height: 36px; } }
.sheet select { min-width: 9rem; }
.sheet input.w-tag { min-width: 8rem; font-weight: 600; }
.sheet input.w-date { min-width: 9.5rem; }
.sheet input.w-num { min-width: 5.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.sheet input.w-notes { min-width: 14rem; }
.sheet input:focus, .sheet select:focus { outline: 0; background: var(--c-surface); border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.sheet input[aria-invalid="true"] { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.sheet td.ro { padding: 0 8px; min-width: 9rem; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-muted); font-size: 12px; }
.sheet td.ro.bad { color: var(--c-danger); font-weight: 600; }
.sheet td.st { padding: 0 8px; min-width: 8rem; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--c-text-2); }
.sheet tr.saved td, .sheet tr.queued td { background: var(--c-tint-1); color: var(--c-text-muted); }
.sheet tr.saved td.st { color: var(--c-secondary); font-weight: 600; }
.sheet tr.queued td.st { color: var(--c-text-2); font-weight: 600; }
.sheet tr.error td.st { color: var(--c-danger); font-weight: 600; }
.sheet tr.saving td.st { color: var(--c-text-muted); }
.sheet input:disabled, .sheet select:disabled { color: var(--c-text-muted); opacity: 1; -webkit-text-fill-color: var(--c-text-muted); }
.sheet .rm { display: grid; place-items: center; width: 34px; min-height: 36px; margin: 0; padding: 0; border: 0; background: none; color: var(--c-text-faint); font: 600 18px/1 var(--font-body); cursor: pointer; }
.sheet .rm:hover { color: var(--c-danger); }
.sheet td.fields { padding: 3px 6px; min-width: 18rem; white-space: nowrap; }
.sheet td.fields .mini { display: inline-grid; gap: 1px; vertical-align: top; margin: 2px 8px 2px 0; }
.sheet td.fields .mini > span { font: 600 10px/14px var(--font-body); letter-spacing: .4px; text-transform: uppercase; color: var(--c-text-muted); white-space: nowrap; }
.sheet td.fields .mini > span .req { color: var(--c-danger); }
.sheet td.fields .mini input, .sheet td.fields .mini select { min-height: 34px; min-width: 6.5rem; width: auto; border: 1px solid var(--c-tint-3); border-radius: var(--r-xs); background: var(--c-surface); }
.sheet td.fields .mini input.w-num { width: 6.5rem; }
.sheet select.w-type { min-width: 16rem; }
.sheet td.type-cell { padding: 0; }
.sheet td.fields .fields-sum { display: inline-block; margin-left: 8px; vertical-align: middle; font-size: 12px; color: var(--c-text-2); white-space: normal; max-width: 28rem; }
.sheet td.fields .btn.small { vertical-align: middle; }
.panel-actions .field { gap: 2px; font-size: 12px; }
.panel-actions .field small { display: none; }
@media (min-width: 900px) { .panel-actions .field small { display: block; } }

/* =====================================================================
   DISEÑO AGRO MANAGER — estructura, componentes y tabla de datos
   (reglas y medidas: .claude/skills/agro-manager-design/SKILL.md)
   ===================================================================== */
h1, h2, h3 { font-family: var(--font-head); color: var(--c-text); letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.page-head select { width: auto; }
a { color: var(--c-primary); }
.card { border: 0; box-shadow: var(--sh-card); border-radius: var(--r-md); }
.btn { border: 0; border-radius: var(--r-sm); background: var(--c-tint-2); color: var(--c-text); font-weight: 600; box-shadow: none; text-decoration: none; }
.btn.primary { background: var(--c-primary-fill); color: var(--c-on-primary); box-shadow: var(--sh-card); }
.btn.primary:hover:not([disabled]) { background: var(--c-primary); }
.btn:hover:not([disabled]):not(.primary) { background: var(--c-tint-3); }
.btn.ghost { background: transparent; color: var(--c-text-2); }
.btn.danger { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--c-primary); outline-offset: 2px;
}
input, select, textarea { border: 1px solid var(--c-tint-3); border-radius: var(--r-sm); background: var(--c-surface); }
.badge { border-radius: var(--r-pill); background: var(--c-tint-3); font-weight: 600; }
.badge.ok { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.chip { border: 0; background: var(--c-tint-2); color: var(--c-text); border-radius: 16px; }
.chip[aria-pressed="true"] { background: var(--c-primary); color: #fff; }
.item { border: 0; box-shadow: var(--sh-card); }
a.item:hover { box-shadow: 0 0 0 1px var(--c-primary-soft-2), var(--sh-card); }
.stat { border: 0; background: var(--c-tint-1); border-radius: var(--r-sm); }
th, td { border-bottom-color: var(--c-border); }
dialog { border: 0; border-radius: var(--r-md); box-shadow: 0 12px 40px rgba(19, 27, 46, .25); }
dialog::backdrop { background: rgba(19, 27, 46, .45); }
.toast { border-radius: var(--r-sm); background: var(--c-text); }
.linkbtn { color: var(--c-primary); }

/* iconos del diseño: el SVG hace de máscara y toma el color del texto */
.ic { display: inline-block; flex: none; width: 1.1em; height: 1.1em; background: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }

/* ---------- estructura: menú lateral + cabecera (pantallas anchas); barra inferior (teléfono) ---------- */
.shell { display: block; }
.sidebar { display: none; }
.topbar { border-bottom: 0; box-shadow: var(--sh-shell); }
.top-search, .top-user small, .top-farm small, .top-farm .ic { display: none; }
.top-farm, .top-user { display: flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; color: inherit; }
.top-user { background: transparent; border: 0; padding: 4px; border-radius: var(--r-md); font: inherit; text-align: left; cursor: pointer; }
.top-user:hover, .top-user[aria-expanded="true"] { background: var(--c-tint-1); }
.top-user .avatar, .avatar.big { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--c-tint-2); color: var(--c-text-2); }
.top-user .avatar .ic { width: 15px; height: 15px; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.top-pop { position: relative; }
.top-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--c-text-2); cursor: pointer; }
.top-btn:hover, .top-btn[aria-expanded="true"] { background: var(--c-tint-1); }
.top-bell .ic { width: 17px; height: 17px; }
.bell-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--c-danger); color: #fff; font: 700 10px/17px var(--font-body); text-align: center; box-shadow: 0 0 0 2px var(--c-surface); }
.bell-badge[hidden] { display: none; }
.top-btn:focus-visible, .top-user:focus-visible, .menu-item:focus-visible { outline: 2px solid var(--c-primary-fill); outline-offset: 1px; }

/* ventanas emergentes de la cabecera: avisos y menú de la persona */
.pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; background: var(--c-surface); border-radius: var(--r-md); box-shadow: 0 12px 40px rgba(19, 27, 46, .18), 0 0 0 1px var(--c-tint-2); }
.pop[hidden] { display: none; }
.pop-notices { display: flex; flex-direction: column; width: min(420px, calc(100vw - 24px)); max-height: min(72vh, 640px); }
.notice-body { overflow-y: auto; overscroll-behavior: contain; }
.pop-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; }
.pop-head h2 { margin-right: auto; font: 700 16px/22px var(--font-head); letter-spacing: -.2px; }
.pop-count { font: 600 11px/14px var(--font-body); letter-spacing: .44px; color: var(--c-text-muted); }
.pop-head .linkbtn, .pop-foot .linkbtn, .notice-foot .linkbtn { min-height: 0; padding: 0; font: 600 12px/16px var(--font-body); }
.pop-notices .chips { flex-wrap: wrap; overflow: visible; padding: 0 16px 8px; }
.pop-notices .chip { white-space: nowrap; font: 600 12px/16px var(--font-body); padding: 5px 10px; }
.notice-list { list-style: none; margin: 0; padding: 0 8px 4px; display: grid; gap: 6px; }
.notice { padding: 10px 12px; border-radius: var(--r-sm); background: var(--c-tint-1); box-shadow: inset 3px 0 0 var(--c-tint-4); }
.notice.urgent { box-shadow: inset 3px 0 0 var(--c-danger); }
.notice.soon { box-shadow: inset 3px 0 0 var(--c-on-warn-soft); }
.notice.read { background: transparent; box-shadow: inset 3px 0 0 var(--c-tint-3), 0 0 0 1px var(--c-tint-2); }
.notice-head { display: flex; align-items: center; gap: 8px; }
.notice-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary-fill); }
.notice.read .notice-dot { background: var(--c-tint-4); }
.notice-title { flex: 1; min-width: 0; font: 700 13px/18px var(--font-body); color: var(--c-text); }
.notice.read .notice-title { font-weight: 500; color: var(--c-text-2); }
.notice-detail { margin: 4px 0 0 16px; font: 400 12px/17px var(--font-body); color: var(--c-text-2); }
.notice-animals { margin: 6px 0 0 16px; display: flex; flex-wrap: wrap; gap: 4px; }
.notice-animals a { text-decoration: none; background: var(--c-tint-2); color: var(--c-text); }
.notice-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0 16px; }
.notice-foot .linkbtn, .notice-foot .btn { white-space: nowrap; }
.pop-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 14px; font: 600 12px/16px var(--font-body); }
.pop-foot a { color: var(--c-primary); }
.pop-user { width: min(300px, calc(100vw - 24px)); padding: 4px 0; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.avatar.big { width: 44px; height: 44px; }
.avatar.big .ic { width: 18px; height: 18px; }
.user-card b { font: 700 14px/20px var(--font-body); color: var(--c-text); }
.user-card small { display: block; font: 400 12px/16px var(--font-body); color: var(--c-text-muted); overflow-wrap: anywhere; }
.menu-list { display: grid; padding: 4px 0; border-top: 1px solid var(--c-tint-2); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 9px 16px; border: 0; background: transparent; text-align: left; font: 500 13px/18px var(--font-body); color: var(--c-text); text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--c-tint-1); }
.menu-item.danger { color: var(--c-danger); }
.stack-0 { display: grid; min-width: 0; }
.tabs { border-top: 0; box-shadow: 0 -1px 4px rgba(0, 0, 0, .06); }
.tabs a[aria-current="page"] { color: var(--c-primary); box-shadow: inset 0 3px 0 var(--c-primary); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs { display: none; }
  .shell { display: grid; grid-template-columns: var(--w-aside) minmax(0, 1fr); min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--c-surface); box-shadow: var(--sh-shell); z-index: 6; }
  .brand { display: flex; align-items: center; gap: 8px; height: var(--h-topbar); padding: 0 12px; background: var(--c-tint-1); text-decoration: none; flex: none; }
  .brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--c-primary); color: #fff; box-shadow: var(--sh-card); }
  .brand-mark .ic { width: 20px; height: 16px; }
  .brand-text { display: grid; }
  .brand-text b { font: 600 18px/22.5px var(--font-head); letter-spacing: -0.45px; color: var(--c-primary); }
  .brand-text small { font: 600 11px/14px var(--font-body); letter-spacing: .55px; text-transform: uppercase; color: var(--c-text-2); }
  .side-nav { display: grid; gap: 4px; padding: 8px 12px; flex: 1; align-content: start; }
  .side-label { font: 600 11px/14px var(--font-body); letter-spacing: .55px; text-transform: uppercase; color: var(--c-text-muted); padding: 8px 4px 2px; }
  .side-nav a { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--r-sm); font: 400 13px/18px var(--font-body); color: var(--c-text-2); text-decoration: none; }
  .side-nav a .ic { width: 15px; height: 15px; }
  .side-nav a:hover { background: var(--c-tint-1); }
  .side-nav a[aria-current="page"] { background: var(--c-tint-2); color: var(--c-primary); font-weight: 600; }
  .side-foot { display: flex; align-items: center; gap: 6px; padding: 12px; background: var(--c-tint-1); font: 500 11px/14px var(--font-body); letter-spacing: .44px; color: var(--c-text-2); flex: none; }
  .status-dot { width: 8px; height: 8px; border-radius: 12px; background: var(--c-mint); flex: none; }
  .status-dot.off { background: var(--c-danger); }

  .topbar { height: var(--h-topbar); padding: 0 var(--pad-page-x); gap: 20px; }
  .top-farm { background: var(--c-tint-2); border-radius: var(--r-sm); padding: 6px 12px; gap: 6px; }
  .top-farm .ic { display: inline-block; color: var(--c-secondary); width: 17px; height: 15px; }
  .top-farm small, .top-user small { display: block; font: 600 11px/12px var(--font-body); letter-spacing: .44px; color: var(--c-text-muted); }
  .top-farm .farm, .top-farm select { font: 600 13px/16px var(--font-body); color: var(--c-text); }
  .top-farm select { min-height: 0; padding: 0; border: 0; background: transparent; max-width: 280px; }
  .top-search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 340px; height: 36px; padding: 0 12px; background: var(--c-page); border-radius: var(--r-sm); color: var(--c-text-muted); margin-right: auto; }
  .top-search input { min-height: 0; height: 34px; padding: 0; border: 0; background: transparent; font: 400 13px/18px var(--font-body); color: var(--c-text); outline: 0; }
  .top-search:focus-within { box-shadow: 0 0 0 2px var(--c-primary-soft-2); }
  .top-user { gap: 10px; padding: 4px 10px 4px 4px; }
  .top-user b { font: 600 13px/16px var(--font-body); color: var(--c-text); }
  .top-user small { color: var(--c-secondary); }
  .top-actions { gap: 8px; }

  main { max-width: 100%; width: 100%; margin: 0; padding: 16px var(--pad-page-x) 40px; gap: var(--gap-section); align-content: start; }
  main > h1 { font: 700 22px/28px var(--font-head); letter-spacing: -0.55px; }
  /* tamaños densos de escritorio */
  .btn { min-height: 36px; padding: 0 12px; font: 600 12px/16px var(--font-body); letter-spacing: .24px; gap: 6px; }
  .btn.small { min-height: 28px; padding: 0 8px; font: 600 11px/14px var(--font-body); letter-spacing: .44px; border-radius: var(--r-xs); gap: 4px; }
  input, select, textarea { min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .chip { min-height: 28px; padding: 0 12px; font: 600 12px/16px var(--font-body); }
  .toast { bottom: 24px; }
}

/* ---------- cabecera de página, paneles y etiquetas ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font: 700 22px/28px var(--font-head); letter-spacing: -0.55px; }
.panel { background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--sh-card); padding: 12px; display: grid; gap: 10px; min-width: 0; align-content: start; }
.panel.flush { padding: 0; gap: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel > .panel-head { margin: -12px -12px 0; padding: 8px 12px; background: var(--c-tint-1); border-radius: var(--r-md) var(--r-md) 0 0; }
.panel.flush > .panel-head { margin: 0; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font: 700 18px/24px var(--font-head); letter-spacing: -0.09px; }
.panel-head h2 .ic { color: var(--c-primary); width: 17px; height: 17px; }
.panel-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.accent-bar { width: 10px; height: 20px; border-radius: 12px; background: var(--c-primary); flex: none; }
.hint { font-size: 12px; margin: 0; }
.empty-state { margin: 0; padding: 20px 12px; text-align: center; color: var(--c-text-muted); font-size: 13px; }
.chip-s, .tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-xs); font: 600 12px/16px var(--font-body); white-space: nowrap;
  background: var(--c-tint-3); color: var(--c-text); }
.chip-s.ok { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.chip-s.dot::before { content: ""; width: 6px; height: 6px; border-radius: 6px; background: var(--c-primary); }
.chip-s.danger { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.chip-s.pending { background: transparent; box-shadow: inset 0 0 0 1px var(--c-text-faint); color: var(--c-text-muted); }
.tag { font: 700 11px/14px var(--font-body); letter-spacing: .44px; text-transform: uppercase; }
.tag.ok { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.tag.info { background: var(--c-mint); color: var(--c-on-mint); }
.tag.lime { background: var(--c-lime); color: var(--c-on-lime); }
.tag.neutral { background: var(--c-tint-4); color: var(--c-text-2); }
.tag.warn { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.tag.danger { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; }
.kv div { display: grid; padding: 6px 8px; background: var(--c-tint-1); border-radius: var(--r-sm); min-width: 0; }
.kv dt { font: 400 11px/16px var(--font-body); color: var(--c-text-muted); }
.kv dd { margin: 0; font: 600 13px/18px var(--font-body); color: var(--c-text); overflow-wrap: anywhere; }
.stack-s { display: grid; gap: 4px; min-width: 0; }
.selbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--row-selected); font-size: 13px; }
.selbar[hidden] { display: none; }
.search { max-width: 280px; background: var(--c-page); border: 0; }

/* ---------- ficha del animal ---------- */
.ficha { display: grid; gap: var(--gap-section); min-width: 0; }
.ficha-head { background: var(--c-tint-1); border-radius: var(--r-md); box-shadow: var(--sh-shell); padding: 8px 12px 0; display: grid; gap: 6px; }
.ctxbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ctx-id { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.ctx-back { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); text-decoration: none; font-size: 20px; color: var(--c-text-2); }
.ctx-back:hover { background: var(--c-tint-2); }
.ctx-num { background: var(--c-tint-2); border-radius: var(--r-xs); padding: 2px 8px; font: 700 18px/24px var(--font-head); color: var(--c-primary); }
.ctx-name { font: 600 14px/20px var(--font-body); color: var(--c-text); margin-right: 4px; }
.ctxbar .btn { background: var(--c-surface); box-shadow: var(--sh-card); flex: 1 1 auto; }
.ctxbar .btn.primary { background: var(--c-primary-fill); }
.tabnav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: thin; }
.tabnav a { flex: none; padding: 6px 0 8px; font: 600 12px/16px var(--font-body); letter-spacing: .24px; color: var(--c-text-2); text-decoration: none; white-space: nowrap; }
.tabnav a:hover { color: var(--c-primary); }
.tabnav a[aria-current="page"] { color: var(--c-primary); font-weight: 700; box-shadow: inset 0 -2px 0 var(--c-primary); }
.overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ov-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.ov-avatar { width: 56px; height: 56px; flex: none; border-radius: var(--r-md); background: var(--c-primary); color: #fff; display: grid; place-items: center; font: 700 12px/15px var(--font-body); letter-spacing: .3px; box-shadow: var(--sh-card); }
.overview h1 { font: 700 22px/28px var(--font-head); letter-spacing: -0.55px; color: var(--c-primary); }
.overview h1 small { font: 500 13px/18px var(--font-body); color: var(--c-text-muted); letter-spacing: 0; }
.overview p { margin: 0; font-size: 13px; }
.ov-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 400 13px/18px var(--font-body); color: var(--c-text); margin-top: 4px; }
.ov-facts span { display: inline-flex; align-items: center; gap: 4px; }
.ov-facts .ic { color: var(--c-primary); width: 13px; height: 13px; }
.kpi-tiles { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi-tile { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--c-tint-1); min-width: 128px; flex: 1 1 128px; align-content: start; }
.kpi-label { font: 600 11px/14px var(--font-body); letter-spacing: .55px; text-transform: uppercase; color: var(--c-text-muted); }
.kpi-value { font: 700 18px/24px var(--font-head); letter-spacing: -0.45px; color: var(--c-text); }
.kpi-value small { font: 500 11px/14px var(--font-body); color: var(--c-text-muted); letter-spacing: 0; }
.kpi-sub { font: 600 11px/14px var(--font-body); letter-spacing: .44px; color: var(--c-primary); }
.kpi-tile.good .kpi-value { color: var(--c-secondary); }
.kpi-tile.strong { background: var(--c-primary-fill); box-shadow: var(--sh-card); }
.kpi-tile.strong .kpi-label, .kpi-tile.strong .kpi-sub { color: var(--c-primary-soft-2); }
.kpi-tile.strong .kpi-value { color: #fff; }
.subtabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--c-tint-2); box-shadow: var(--sh-inset); max-width: 100%; overflow-x: auto; justify-self: start; }
.subtabs button { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  font: 500 12px/16px var(--font-body); letter-spacing: .24px; color: var(--c-text-2); }
.subtabs button[aria-selected="true"] { background: var(--c-surface); box-shadow: var(--sh-card); font-weight: 700; color: var(--c-primary); }
.subtabs button small { font: 700 10px/14px var(--font-body); padding: 0 5px; border-radius: 8px; background: var(--c-tint-3); color: var(--c-text-2); }
.subtabs .ic { width: 14px; height: 14px; }
.split { display: grid; gap: var(--gap-section); grid-template-columns: minmax(0, 1fr); align-items: start; }
.side { display: grid; gap: var(--gap-section); min-width: 0; align-content: start; }
@media (min-width: 1180px) { .split { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } }
.supply { display: grid; gap: 6px; padding: 8px; border-radius: var(--r-sm); background: var(--c-tint-1); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 8px; border-radius: var(--r-sm); background: var(--c-tint-2); font-size: 13px; }
.total-line b { font: 700 18px/24px var(--font-head); color: var(--c-primary); }
.kid { display: grid; gap: 2px; padding: 8px; border-radius: var(--r-sm); background: var(--c-tint-1); text-decoration: none; color: var(--c-text); font-size: 13px; }
.kid b { font: 700 18px/24px var(--font-head); color: var(--c-primary); }
.lact-no { font-weight: 700; color: var(--c-primary); }

/* ---------- tabla de datos (web/grid.js) ---------- */
.dg { display: grid; min-width: 0; }
.dg-tools { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 4px 8px; }
.dg-tools .btn[aria-pressed="true"] { background: var(--c-tint-2); color: var(--c-primary); }
.dg-scroll { overflow: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.dg-table { width: 100%; border-collapse: collapse; font: 500 13px/18px var(--font-body); letter-spacing: -0.065px; }
.dg-table th, .dg-table td { padding: 8px 12px; white-space: nowrap; border: 0; border-top: 1px solid var(--c-border); text-align: left; color: var(--c-text); }
.dg-table thead th { position: sticky; top: 0; z-index: 1; background: var(--c-tint-2); border-top: 0; font: 700 10px/18px var(--font-body); letter-spacing: .5px; text-transform: uppercase; color: var(--c-text-2); user-select: none; }
.dg-table th.sortable { cursor: pointer; }
.dg-table th.sortable:hover { color: var(--c-primary); }
.dg-table th[aria-sort] { color: var(--c-primary); }
.dg-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dg-table td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.dg-table tbody tr.click { cursor: pointer; }
.dg-table tbody tr.click:hover { background: var(--row-current); }
.dg-table tbody tr.sel { background: var(--row-selected); }
.dg-table tbody tr.sel td { font-weight: 700; }
.dg-table tbody tr.sel .lact-no { display: inline-block; min-width: 24px; text-align: center; padding: 0 6px; border-radius: var(--r-xs); background: var(--c-primary); color: #fff; box-shadow: var(--sh-card); }
.dg-table tbody tr.pending td { color: var(--c-text-muted); font-style: italic; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(234, 237, 255, .55) 6px 12px); }
.dg-table tbody tr.pending .tag { opacity: .7; }
.dg-table tfoot td { background: var(--row-totals); font: 700 11px/18px var(--font-body); text-transform: uppercase; padding: 10px 12px; }
.dg-table.compact th, .dg-table.compact td { padding: 6px 10px; }
.dg-filter th { background: var(--c-surface) !important; padding: 4px 6px !important; top: 34px !important; text-transform: none !important; }
.dg-filter input { min-height: 28px; height: 28px; padding: 2px 8px; min-width: 64px; border: 0; background: var(--c-page); border-radius: var(--r-sm); font: 400 12px/16px var(--font-body); letter-spacing: 0; }
.dg-filter input:focus { box-shadow: 0 0 0 2px var(--c-primary-soft-2); outline: 0; }
.dg-check { width: 36px; text-align: center !important; }
.dg-check input, .dg-layout input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--c-primary); }
.dg-empty td { text-align: center !important; color: var(--c-text-muted); padding: 22px 12px !important; }
.dg-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; }
.dg-foot { font: 400 11px/16px var(--font-body); color: var(--c-text-muted); }
.cell-link { font-weight: 700; color: var(--c-primary); text-decoration: none; }
.cell-link:hover { text-decoration: underline; }
.dg-layout { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 50vh; overflow: auto; }
.dg-layout li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: var(--r-sm); font-size: 13px; }
.dg-layout li:hover { background: var(--c-tint-1); }
.dg-layout label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.row.wrap { flex-wrap: wrap; align-items: end; }
/* menú con clic derecho sobre los encabezados */
.menu { position: fixed; z-index: 60; min-width: 250px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; padding: 4px; background: var(--c-surface);
  border-radius: var(--r-md); box-shadow: 0 8px 28px rgba(19, 27, 46, .22), 0 0 0 1px var(--c-tint-3); display: grid; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 6px 10px; border: 0; background: transparent; border-radius: var(--r-sm);
  font: 500 13px/18px var(--font-body); color: var(--c-text); text-align: left; cursor: pointer; }
.menu button:hover:not([disabled]), .menu button:focus-visible { background: var(--c-tint-2); outline: 0; }
.menu button[disabled] { color: var(--c-text-faint); cursor: default; }
.menu button small { color: var(--c-text-muted); font-size: 11px; }
.menu hr { border: 0; border-top: 1px solid var(--c-tint-3); margin: 4px 0; width: 100%; }
.menu-info { padding: 6px 10px; font: 600 11px/14px var(--font-body); color: var(--c-text-muted); background: var(--c-tint-1); border-radius: var(--r-sm); }
/* impresión de tablas (una o varias) y de la ficha */
.print-root { display: none; }
@media print {
  body.printing > *:not(.print-root) { display: none !important; }
  body.printing .print-root { display: block; }
  .print-table { break-inside: auto; margin-bottom: 18px; }
  .print-table h2 { font-size: 14pt; margin: 0 0 4px; }
  .print-table p { margin: 0 0 6px; font-size: 9pt; color: #444; }
  .print-table table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .print-table th, .print-table td { border: 1px solid #999; padding: 3px 5px; text-align: left; }
  .print-table .num { text-align: right; }
  .sidebar, .topbar, .tabs, .dg-tools, .dg-bottom .btn, .ctxbar .btn, .ctx-back, .subtabs, .noprint { display: none !important; }
  .shell { display: block; }
  .dg-scroll { overflow: visible; }
  main { max-width: none; padding: 0; }
}

/* ---------- pantallas anteriores con el diseño nuevo: Hoy, Leche, Tablero, Reportes, Vistas ---------- */
.h-section { font: 700 18px/24px var(--font-head); }
.page-head p { margin: 2px 0 0; font-size: 13px; max-width: 80ch; }
.list.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.list.cards .item { height: 100%; align-content: start; background: var(--c-tint-1); box-shadow: none; border-radius: var(--r-sm); }
.list.cards a.item:hover { background: var(--c-tint-2); box-shadow: none; }
.list.cards .item .title { color: var(--c-primary); font: 700 14px/20px var(--font-body); }
.list.cards .item .sub { font-size: 12px; line-height: 16px; }
/* contadores del tablero */
.counter { border: 0; border-radius: var(--r-sm); background: var(--c-tint-1); text-decoration: none; color: var(--c-text); min-height: 68px; padding: 8px 12px; }
.counter b { font: 700 22px/28px var(--font-head); letter-spacing: -0.45px; color: var(--c-text); }
.counter span { font: 600 11px/14px var(--font-body); letter-spacing: .44px; color: var(--c-text-2); }
.counter.zero b { color: var(--c-text-faint); font-weight: 700; }
.counter.hot { background: var(--c-danger-soft); }
.counter.hot b, .counter.hot span { color: var(--c-on-danger-soft); }
.counter:focus-visible, .counter:hover { outline: 2px solid var(--c-primary-soft-2); outline-offset: 0; }
/* tarjetas de indicador con meta */
.kpis { gap: 8px; }
a.kpi-card { background: var(--c-tint-1); box-shadow: none; border-radius: var(--r-sm); padding: 10px 12px; }
a.kpi-card:hover, a.kpi-card:focus-visible { outline: 2px solid var(--c-primary-soft-2); outline-offset: 0; }
.kpi-card .muted { font: 600 11px/14px var(--font-body); letter-spacing: .44px; text-transform: uppercase; color: var(--c-text-muted); }
.kpi .value { font: 700 22px/28px var(--font-head); letter-spacing: -0.45px; color: var(--c-text); }
.kpi .value small { font: 500 11px/14px var(--font-body); color: var(--c-text-muted); letter-spacing: 0; }
.kpi .unit { font-size: 12px; }
svg.kpi-bar .zone.bad { fill: var(--c-danger-soft); } svg.kpi-bar .zone.warn { fill: var(--c-warn-soft); } svg.kpi-bar .zone.good { fill: var(--c-primary-soft); }
svg.kpi-bar .goal { stroke: var(--c-text-2); stroke-width: 0.6; }
svg.kpi-bar .m12 { fill: var(--c-primary); stroke: var(--c-surface); }
svg.kpi-bar .m90 { fill: var(--c-text-2); }
.trend.better { color: var(--c-secondary); } .trend.worse { color: var(--c-danger); }
.asof { flex-wrap: nowrap; font-size: 13px; }
.kpi-tile.alert { background: var(--c-danger-soft); }
.kpi-tile.alert .kpi-label, .kpi-tile.alert .kpi-value { color: var(--c-on-danger-soft); }
.chip-s.warn { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.alert-strip { padding: 8px 12px; background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--sh-card); font-size: 13px; }
.alert-strip a.badge { background: var(--c-danger-soft); color: var(--c-on-danger-soft); border-radius: var(--r-xs); font: 600 12px/16px var(--font-body); padding: 4px 8px; }
.alert { border-radius: var(--r-sm); font-size: 13px; }
/* formulario de un reporte */
.report-params { border: 0; border-radius: var(--r-md); box-shadow: var(--sh-card); background: var(--c-surface); }
.dg-table tbody tr.total-row td { font-weight: 700; background: var(--row-totals); }
/* cuadro de fertilidad: una marca por vaca, cada estado con su forma y su color */
.chart-fig.wide { max-width: 980px; }
.chart-fig.compact { max-width: 560px; }
svg.chart .pt { fill: var(--c-text-muted); stroke: none; }
svg.chart .pt.hollow { fill: var(--c-surface); stroke: var(--c-text-muted); stroke-width: 1.6; }
svg.chart .pt.stroke { fill: none; stroke: var(--c-text); stroke-width: 1.8; stroke-linecap: round; }
svg.chart .pt.f-pregnant { fill: var(--c-primary-fill); }
svg.chart .pt.f-served { fill: var(--c-chart-expected); stroke: var(--c-on-mint); stroke-width: .8; }
svg.chart .pt.f-not_served { fill: var(--c-lime); stroke: var(--c-on-lime); stroke-width: .8; }
svg.chart .pt.f-pd_negative { fill: var(--c-danger); }
svg.chart .pt.pick { cursor: pointer; }
svg.chart .pt.pick:hover { stroke: var(--c-text); stroke-width: 1.6; }
svg.chart .ref { stroke: var(--c-text-2); stroke-width: 1; stroke-dasharray: 5 4; }
svg.chart .ref-label { fill: var(--c-text-2); font-weight: 600; }
svg.chart.mark-icon { width: 14px; height: 14px; flex: none; }
.mark-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.mark-legend label.check { margin: 0; gap: 6px; font-size: 0.85rem; }
.chart-params { padding: 0; }
/* asistente: conversación, casilla de pregunta y opciones */
.panel.chat { display: grid; gap: 10px; }
.chat-log { display: grid; gap: 8px; align-content: start; min-height: 220px; max-height: min(62vh, 640px); overflow-y: auto; padding: 4px 2px; }
.chat-msg { max-width: min(680px, 92%); padding: 8px 12px; border-radius: var(--r-md); font: 400 14px/20px var(--font-body); overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 6px; } .chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: 0 0 6px; padding-left: 18px; }
.chat-msg.user { justify-self: end; background: var(--c-primary-fill); color: var(--c-surface); }
.chat-msg.bot { justify-self: start; background: var(--c-tint-1); color: var(--c-text); }
.chat-msg.bot.error { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.chat-msg.bot.pending { font-style: italic; }
.chat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.chat-empty { display: grid; gap: 8px; align-content: center; min-height: 200px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.chat-form textarea { width: 100%; resize: vertical; min-height: 44px; }
.chat-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chat-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.chat-options label.check, .chat-provider { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
/* asistente: tarjeta de un registro preparado (nada se guarda hasta tocar «Guardar») */
.draft-card { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--sh-card); color: var(--c-text); }
.draft-card.discarded, .draft-card.expired, .draft-card.undone { opacity: .7; }
.draft-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.draft-head strong { font: 600 13px/18px var(--font-body); }
.draft-head .chip-s { margin-left: auto; }
.draft-animals { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.chat-msg .draft-animals { padding-left: 0; margin: 0; }
.draft-animals li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 4px 8px; background: var(--c-tint-1); border-radius: var(--r-sm); font: 500 13px/18px var(--font-body); }
.draft-animals li a { font-weight: 700; }
.chat-msg .draft-effect, .chat-msg .draft-warn, .chat-msg .draft-error { margin: 0; padding: 4px 8px; border-radius: var(--r-sm); font: 500 12px/16px var(--font-body); }
.draft-effect { background: var(--c-tint-2); color: var(--c-text-2); }
.draft-warn { background: var(--c-warn-soft); color: var(--c-on-warn-soft); }
.draft-error { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.draft-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 560px) { .draft-actions .btn.primary { flex: 1; } }
@media (max-width: 560px) { .chat-form { grid-template-columns: minmax(0, 1fr); } .chat-actions { justify-content: stretch; } .chat-actions .btn { flex: 1; } }
@media print { .chat-form, .chat-options { display: none; } .chat-log { max-height: none; overflow: visible; } }
/* vistas de animales: barra de seleccionar, entrada rápida y contadores */
.view-head { flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.view-select, .view-quick { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.view-quick input { width: 150px; min-height: 30px; padding: 2px 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
/* cifra que abre sus animales (estructura del hato): se ve como un enlace y queda marcada la elegida */
.dg-table td button.cell-pick { border: 0; background: none; margin: -3px -8px; padding: 3px 8px; min-width: 36px; border-radius: var(--r-sm); font: inherit; font-weight: 700; color: var(--c-primary); cursor: pointer; text-align: right; }
.dg-table td button.cell-pick:hover { background: var(--c-tint-2); }
.dg-table td button.cell-pick.on { background: var(--c-primary-fill); color: var(--c-surface); }
.dg-table td button.cell-pick.late { color: var(--c-danger); }
.dg-table td button.cell-pick.late.on { background: var(--c-danger); color: var(--c-surface); }
.dg-table td button.cell-pick:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.dg-table tbody tr.overdue td { background: var(--row-alert); }
.dg-table td .btn.small { min-height: 26px; }
/* leche */
.segmented { background: var(--c-tint-2); border-radius: var(--r-md); box-shadow: var(--sh-inset); }
.segmented button { border-radius: var(--r-sm); font: 500 12px/16px var(--font-body); color: var(--c-text-2); }
.segmented button[aria-pressed="true"] { background: var(--c-surface); box-shadow: var(--sh-card); color: var(--c-primary); font-weight: 700; }
.milk-row { border: 0; border-radius: var(--r-sm); background: var(--c-tint-1); }
.milk-summary { box-shadow: none; background: var(--c-tint-2); border-radius: var(--r-sm); }
.milk-done { color: var(--c-primary); }
.check { font-size: 13px; }
.check.panel-actions { min-height: 0; font-weight: 500; }
.check.panel-actions input { width: 16px; height: 16px; }
@media (min-width: 900px) {
  .date-nav input { width: 150px; flex: none; }
  .date-nav .btn { min-width: 36px; font-size: 16px; }
  .segmented { display: inline-flex; }
  .segmented button { min-height: 28px; padding: 0 12px; }
  .milk-list { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .milk-input { min-height: 40px; font-size: 18px; width: 5rem; }
  .sticky-top ~ main .milk-summary, .milk-summary { top: calc(var(--h-topbar) + 4px); }
}
@media print {
  .panel { box-shadow: none; padding: 0; }
  .panel > .panel-head { margin: 0 0 4px; padding: 0; background: none; }
  .dg-table { font-size: 9pt; }
  .dg-table th, .dg-table td { padding: 3px 5px; white-space: normal; max-width: none; border-top: 1px solid #ccc; }
  .dg-table thead th { position: static; background: #eee; }
  .dg-table thead { display: table-header-group; }
  .dg-table tr { break-inside: avoid; }
  .dg-filter, .selbar, .dg-check { display: none !important; }
  .kpi-tile { border: 1px solid #ccc; }
}

/* gráficos: línea real en verde, esperada en menta, tercera serie en gris; nunca más anchos de lo que se lee bien */
.chart-fig { max-width: 760px; margin: 0; }
svg.chart .line.s0, svg.chart .dot.s0 { stroke: var(--c-primary); }
svg.chart .line.s1, svg.chart .dot.s1 { stroke: var(--c-chart-expected); }
svg.chart .line.s2, svg.chart .dot.s2 { stroke: var(--c-text-muted); }
svg.chart .bar.s0 { fill: var(--c-primary-fill); }
.swatch.s0 { border-top-color: var(--c-primary); }
.swatch.s1 { border-top-color: var(--c-chart-expected); }
.swatch.s2 { border-top-color: var(--c-text-muted); }

/* barra inferior del teléfono y menú «Más»: iconos del diseño */
.tabs a .ic { width: 20px; height: 20px; }
.more-item .ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--c-tint-2); color: var(--c-primary); }
.more-item .ico .ic { width: 18px; height: 18px; }
.login .logo { border-radius: var(--r-md); background: var(--c-primary); color: #fff; }
.login .logo .ic { width: 28px; height: 22px; }
.more-item .ico { grid-row: span 2; font-size: inherit; }

/* hato elegido: selector en la cabecera y pantalla para elegirlo */
.top-herd { display: flex; }
.top-herd select { min-height: 0; padding: 0 2px; border: 0; background: transparent; font-weight: 600; max-width: 46vw; }
.chooser { max-width: 560px; }
.herd-card { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; grid-template-columns: 1fr; }
.herd-card.strong .title { color: var(--c-primary); }
.herd-card:hover { box-shadow: 0 0 0 2px var(--c-primary-soft-2), var(--sh-card); }
@media (min-width: 900px) {
  .top-herd select { font: 600 13px/16px var(--font-body); color: var(--c-text); max-width: 260px; }
  .top-herd .ic { color: var(--c-secondary); width: 15px; height: 15px; }
}

/* ---------- pantallas de administración: mismas tarjetas y tablas, sin tocar su estructura ---------- */
main > .row.between > h1, main > h1 { font: 700 22px/28px var(--font-head); letter-spacing: -0.55px; }
main > p.muted { margin: 0; font-size: 13px; max-width: 90ch; }
.card.stack, section.card { gap: 10px; }
.card.stack > h2:first-child, section.card > h2:first-child, .card.stack > .row.between:first-child {
  margin: -14px -14px 2px; padding: 8px 12px; background: var(--c-tint-1); border-radius: var(--r-md) var(--r-md) 0 0;
  font: 700 18px/24px var(--font-head); letter-spacing: -0.09px; }
.card.stack > .row.between:first-child h2 { font: inherit; }
section.stack > h2, .group-title { font: 700 18px/24px var(--font-head); }
main table:not(.dg-table) { font: 500 13px/18px var(--font-body); }
main table:not(.dg-table) th { background: var(--c-tint-2); border: 0; padding: 8px 12px; font: 700 10px/18px var(--font-body); letter-spacing: .5px; text-transform: uppercase; color: var(--c-text-2); white-space: nowrap; }
main table:not(.dg-table) td { padding: 8px 12px; border-bottom: 1px solid var(--c-border); }
main table:not(.dg-table) input, main table:not(.dg-table) select { min-height: 32px; }
.empty, .card.empty { color: var(--c-text-muted); font-size: 13px; }
.codes li, .secret { font-family: ui-monospace, monospace; }
@media (min-width: 900px) {
  /* formularios largos (Ajustes): varias columnas en vez de una sola fila interminable */
  main form.card.stack { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; column-gap: 16px; }
  main form.card.stack > h2, main form.card.stack > p, main form.card.stack > .btn, main form.card.stack > .row { grid-column: 1 / -1; }
  main form.card.stack > .btn { justify-self: start; }
}

/* ---------- árbol genealógico: ramas de izquierda a derecha ---------- */
.ped-wrap { padding: 8px 4px 12px; }
.ped { display: flex; align-items: center; }
.ped-kids { display: flex; flex-direction: column; margin-left: 28px; position: relative; }
.ped-kids::before { content: ""; position: absolute; left: -28px; top: 50%; width: 14px; border-top: 2px solid var(--c-text-faint); }     /* de la tarjeta al tronco */
.ped-kid { position: relative; padding: 5px 0 5px 14px; }
.ped-kid::before { content: ""; position: absolute; left: -14px; top: 50%; width: 28px; border-top: 2px solid var(--c-text-faint); }      /* del tronco a la rama */
.ped-kid::after { content: ""; position: absolute; left: -14px; border-left: 2px solid var(--c-text-faint); }                            /* el tronco */
.ped-kid:first-child::after { top: 50%; bottom: 0; }
.ped-kid:last-child::after { top: 0; bottom: 50%; }
.ped-card { display: grid; gap: 1px; min-width: 150px; max-width: 200px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--c-tint-1);
  box-shadow: inset 3px 0 0 var(--c-text-faint); flex: none; }
.ped-card.male { box-shadow: inset 3px 0 0 var(--c-text-2); }
.ped-card.female { box-shadow: inset 3px 0 0 var(--c-chart-expected); }
.ped-card.self { background: var(--c-primary-fill); box-shadow: var(--sh-card); }
.ped-card.self .ped-role, .ped-card.self .ped-meta { color: var(--c-primary-soft-2); }
.ped-card.self .ped-tag, .ped-card.self .ped-name { color: #fff; }
.ped-card.unknown { background: transparent; box-shadow: none; outline: 1px dashed var(--c-text-faint); outline-offset: -1px; }
.ped-card.unknown .ped-tag { color: var(--c-text-muted); font: 600 13px/18px var(--font-body); }
.ped-role { font: 600 10px/14px var(--font-body); letter-spacing: .5px; text-transform: uppercase; color: var(--c-text-muted); }
.ped-tag { font: 700 16px/22px var(--font-head); color: var(--c-primary); text-decoration: none; overflow-wrap: anywhere; }
a.ped-tag:hover { text-decoration: underline; }
.ped-name { font: 600 12px/16px var(--font-body); color: var(--c-text); overflow-wrap: anywhere; }
.ped-meta { font: 400 11px/14px var(--font-body); color: var(--c-text-muted); }
.ped-card .chip-s { justify-self: start; margin-top: 2px; font-size: 11px; }
.ped-legend { gap: 12px; }
.ped-key { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/14px var(--font-body); color: var(--c-text-2); }
.ped-key::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--c-text-2); }
.ped-key.female::before { background: var(--c-chart-expected); }
@media print { .ped-card.self { background: #fff; outline: 2px solid #000; } .ped-card.self .ped-tag, .ped-card.self .ped-name, .ped-card.self .ped-role, .ped-card.self .ped-meta { color: #000; } }

/* teléfono: la cabecera lleva finca, hato, la campana y el avatar (el menú de la persona); el nombre se ve al abrir el menú */
@media (max-width: 899px) {
  .topbar > * { min-width: 0; }
  .topbar { overflow: visible; }
  .top-user .stack-0 { display: none; }
  .top-farm .farm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-herd { flex: 1; justify-content: flex-end; }
  .top-actions { margin-left: auto; }
  .top-pop { position: static; }
  .pop { position: fixed; left: 8px; right: 8px; top: calc(var(--h-topbar) + 6px); width: auto; }
  .pop-notices { max-height: calc(100vh - var(--h-topbar) - 110px); }
}

/* árbol genealógico: la madre genética que es una donadora */
.ped-card.donor { box-shadow: inset 3px 0 0 var(--c-lime); }
.ped-card.donor.unknown { outline: 0; background: var(--c-tint-1); }
.ped-card.donor.unknown .ped-tag { color: var(--c-primary); font: 700 16px/22px var(--font-head); }
.ped-key.donor::before { background: var(--c-lime); }
.ped-meta a { color: var(--c-primary); font-weight: 600; }
.ped-card.self .ped-meta a { color: #fff; text-decoration: underline; }

/* ---------- Seleccionar hato y lote / grupo ---------- */
a.top-herd { cursor: pointer; }
a.top-herd .herd-now { font: 600 13px/16px var(--font-body); color: var(--c-text); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.top-herd > .ic:last-child { display: inline-block; width: 10px; height: 10px; color: var(--c-text-2); margin-left: 4px; }
a.top-herd[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--c-primary-soft); }
@media (min-width: 900px) { a.top-herd .herd-now { max-width: 300px; } }
.sel-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r-md); background: var(--c-primary-fill); color: #fff; box-shadow: var(--sh-card); }
.sel-bar .ic { width: 18px; height: 16px; flex: none; }
.sel-summary { margin: 0; font: 500 13px/18px var(--font-body); }
.sel-summary b { font: 700 15px/20px var(--font-head); }

/* rejilla lote × grupo: columnas de ancho fijo (ajustable), encabezados que no se montan */
.selm-box { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; max-width: 100%; }
.selm-wrap { max-width: 100%; max-height: 64vh; overflow: auto; border-radius: var(--r-sm); padding-bottom: 2px; }
main table.selm { table-layout: fixed; border-collapse: separate; border-spacing: 2px; font: 500 13px/18px var(--font-body); }
main table.selm th, main table.selm td { position: relative; height: 1px; padding: 0; border: 0; background: transparent; text-align: center; vertical-align: middle; text-transform: none; letter-spacing: 0; white-space: normal; font: inherit; color: inherit; overflow: hidden; }
main table.selm thead th { position: sticky; top: 0; z-index: 2; background: var(--c-surface); }
main table.selm tbody th, main table.selm tfoot th, main table.selm th.selm-corner { position: sticky; left: 0; z-index: 1; background: var(--c-surface); }
main table.selm thead th.selm-corner { z-index: 3; }
.selm button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 2px; width: 100%; height: 100%; min-height: 38px; padding: 5px 8px; border-radius: var(--r-sm); cursor: pointer; text-align: center; }
.selm button:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -2px; }
.selm button:disabled { cursor: default; opacity: .5; }
.selm-head button { background: var(--c-tint-2); color: var(--c-text); }
.selm thead .selm-head button { min-height: 68px; align-content: start; padding-top: 8px; }
.selm-head button b { max-width: 100%; font: 700 13px/16px var(--font-body); letter-spacing: .1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selm-head button small { max-width: 100%; font: 500 11px/13px var(--font-body); color: var(--c-text-muted); text-transform: lowercase; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
.selm-head button small::first-letter { text-transform: uppercase; }
.selm tbody .selm-head button { justify-items: start; text-align: left; }
.selm tbody .selm-head button small { -webkit-line-clamp: 2; line-clamp: 2; }
.selm-corner button { background: var(--c-tint-3); color: var(--c-text-2); font: 700 10px/14px var(--font-body); letter-spacing: .5px; text-transform: uppercase; justify-items: start; align-content: end; text-align: left; }
.selm button.selm-cell { background: var(--c-tint-1); color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.selm button:not(:disabled):hover { box-shadow: inset 0 0 0 2px var(--c-primary-soft); }
.selm button.selm-cell.on, .selm-head.on button, .selm-corner.on button { background: var(--c-primary-fill); color: #fff; }
.selm-head.on button small { color: var(--c-primary-soft); }
.selm-head.some button, .selm-corner.some button { background: var(--c-primary-soft); color: var(--c-on-primary-soft); }
.selm-head.some button small { color: var(--c-on-primary-soft); }
main table.selm .selm-total { padding: 4px 8px; background: var(--c-tint-3); border-radius: var(--r-sm); font: 700 12px/18px var(--font-body); color: var(--c-text-2); font-variant-numeric: tabular-nums; }
main table.selm thead .selm-total { text-transform: uppercase; font-size: 10px; letter-spacing: .5px; }
@media (max-width: 899px) { .selm button { min-height: 44px; } }

/* ---------- Ancho de columnas ajustable (todas las tablas): tirador en el borde derecho del encabezado ---------- */
.col-resize { position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: col-resize; touch-action: none; user-select: none; z-index: 2; }
.col-resize::after { content: ""; position: absolute; top: 20%; bottom: 20%; right: 2px; width: 2px; border-radius: 1px; background: var(--c-text-faint); opacity: 0; transition: opacity .12s; }
th:hover > .col-resize::after { opacity: .9; }
.col-resize:hover::after, .col-resize.on::after { opacity: 1; background: var(--c-primary); top: 0; bottom: 0; }
.dg-table thead th { padding-right: 14px; }
.dg-table .dg-sized { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-table th.dg-sized input { min-width: 0; width: 100%; }
@media (hover: none) { .col-resize { width: 16px; } .col-resize::after { opacity: .6; } }
@media print { .col-resize { display: none; } }

/* ---------- Reportes de manejo y lista del veterinario ---------- */
.mgmt-list .item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.mgmt-list .item > .ic { width: 20px; height: 20px; color: var(--c-secondary); }
.mgmt-list .item.off { opacity: .75; cursor: default; }
.vet-params { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 20px; padding: 14px 16px; }
.vet-params .field, .vet-params label.check { margin: 0; }
.vet-params .btn { min-height: 36px; }
input.num-small { width: 76px; min-width: 0; text-align: right; }
.dg-table td .cell-lines { display: block; white-space: pre-line; min-width: 200px; max-width: 420px; line-height: 17px; }
.dg-table td:has(> .cell-lines) { max-width: 440px; vertical-align: top; }
.check-list { display: grid; gap: 6px; max-height: 52vh; overflow: auto; padding: 2px; }
@media print { .vet-params, .mgmt-list { display: none; } .dg-table td .cell-lines { max-width: none; min-width: 0; } }

/* ---- Costos: parámetros del costeo (web/costos.js) ---- */
.cost-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.cost-ckgroup { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cost-ckgroup.cost-ckcol { flex-direction: column; gap: 6px; }
.cost-ck { display: inline-flex; align-items: center; gap: 8px; font: 500 13px/18px var(--font-body); color: var(--c-text); min-height: 28px; }
.cost-ck input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--c-primary-fill); }
.cost-ck input.num-small { width: 130px; height: 32px; margin-left: 6px; }
.cost-h3 { font: 700 11px/14px var(--font-body); color: var(--c-primary); margin: 6px 0 0; text-transform: uppercase; letter-spacing: 0.55px; }
.cell-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; min-height: 0; }
.chips.cost-wrap { flex-wrap: wrap; overflow: visible; }
.cost-month { align-items: flex-start; }
.cost-month > input { margin-top: 3px; flex: none; }
.cost-month-body { gap: 6px; min-width: 0; }
.cost-monthbar { flex-wrap: wrap; gap: 8px; }
.cost-maprow { display: grid; grid-template-columns: 1fr minmax(200px, 260px); gap: 8px 12px; align-items: center; padding: 6px 8px; background: var(--c-tint-1); border-radius: var(--r-sm); }
.cost-maprow select { min-width: 0; }
.cost-maplist { gap: 6px; }
.cost-warnlist li { margin: 2px 0; }
.dg tr.totals td { font-weight: 700; background: var(--row-totals); }
@media (max-width: 480px) { .cost-maprow { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .cost-two { grid-template-columns: 1fr; } }

/* ---- Transferencia de embriones (web/embriones.js) ---- */
div.field { display: grid; gap: 4px; font-weight: 600; font-size: 0.92rem; min-width: 0; }
div.field > small { font-weight: 400; color: var(--c-text-muted); }
div.field[hidden] { display: none; }
div.field > .btn { justify-self: start; }
.et-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.et-steps li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px 12px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--c-border); font-size: 13px; }
.et-steps li:first-child { border-top: 0; }
.et-daytag { justify-self: start; padding: 2px 8px; border-radius: var(--r-xs); background: var(--c-tint-2); color: var(--c-primary); font: 700 11px/16px var(--font-body); letter-spacing: .44px; text-transform: uppercase; white-space: nowrap; }
.et-stepside { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.et-next { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--c-tint-1); font-size: 13px; color: var(--c-text); }
.et-next b { color: var(--c-primary); }
.et-next.late { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.et-next.late b { color: var(--c-on-danger-soft); }
.et-rows { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; }
.et-row { display: grid; grid-template-columns: minmax(70px, 110px) minmax(120px, 170px) minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); background: var(--c-tint-1); font-size: 13px; }
.et-row select, .et-row input, .et-share select, .et-share input, .et-item input, .et-calf select, .et-calf input, .et-pick-row select { min-width: 0; }
.et-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.et-share { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; gap: 8px; align-items: center; }
.et-share input { text-align: right; }
.et-bad { color: var(--c-danger); font-weight: 600; }
.et-pick { display: grid; gap: 4px; max-height: 34vh; overflow: auto; padding: 2px; }
.et-pick-row { display: grid; grid-template-columns: minmax(64px, 100px) minmax(0, 1fr) 120px; gap: 8px; align-items: center; padding: 4px 8px; border-radius: var(--r-sm); background: var(--c-tint-1); font-size: 13px; }
.et-pick-row.bad { background: var(--c-danger-soft); color: var(--c-on-danger-soft); }
.et-pick-row.bad .muted { color: var(--c-on-danger-soft); }
.et-stepedit { display: grid; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--c-tint-1); }
.et-stepedit .et-day { width: 84px; flex: none; }
.et-stepedit .grow { flex: 1 1 200px; min-width: 0; }
.et-item { display: grid; grid-template-columns: minmax(0, 2fr) 76px 76px 76px auto; gap: 6px; align-items: center; }
.et-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: end; }
.et-calf { display: grid; grid-template-columns: 124px 96px minmax(0, 1fr) 88px auto; gap: 6px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); background: var(--c-tint-1); }
.total-line + .total-line { margin-top: 0; }
@media (max-width: 640px) {
  .et-steps li { grid-template-columns: 64px minmax(0, 1fr); }
  .et-stepside { grid-column: 1 / -1; justify-content: flex-start; }
  .et-row { grid-template-columns: 1fr 1fr; }
  .et-row > :last-child:not(select) { grid-column: 1 / -1; }
  .et-two { grid-template-columns: 1fr; }
  .et-item { grid-template-columns: 1fr 1fr 1fr; }
  .et-item > :first-child { grid-column: 1 / -1; }
  .et-calf { grid-template-columns: 1fr 1fr; }
  .et-pick-row { grid-template-columns: 72px minmax(0, 1fr); }
  .et-pick-row select { grid-column: 1 / -1; }
}
.et-row.et-go { grid-template-columns: minmax(96px, 130px) minmax(0, 1fr) minmax(0, 1fr); }
.et-goes { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.et-goes input { width: 18px; height: 18px; min-height: 0; margin: 0; flex: none; accent-color: var(--c-primary-fill); }
.et-row.out { background: transparent; box-shadow: inset 0 0 0 1px var(--c-text-faint); color: var(--c-text-muted); }
.et-row.out b { text-decoration: line-through; }

/* ---- Asistente flotante y conversaciones guardadas (web/chat.js) ---- */
.chat-view { display: grid; gap: 10px; min-width: 0; min-height: 0; }
.chatfab { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: grid; justify-items: end; gap: 10px; pointer-events: none; }
.chatfab[hidden] { display: none; }
.chatfab > * { pointer-events: auto; }
.chatfab-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--c-primary-fill); color: var(--c-surface); font: 600 13px/18px var(--font-body); letter-spacing: .24px; box-shadow: 0 6px 18px rgba(19, 27, 46, .22); }
.chatfab-btn .ic { width: 18px; height: 18px; }
.chatfab-btn:hover, .chatfab-btn:focus-visible { background: var(--c-primary); }
.chatfab.open .chatfab-btn { display: none; }
.chatfab-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 96px)); overflow: hidden;
  background: var(--c-surface); border-radius: var(--r-md); box-shadow: 0 12px 40px rgba(19, 27, 46, .28); }
.chatfab-panel[hidden] { display: none; }
.chatfab-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; background: var(--c-tint-1); }
.chatfab-head b { font: 700 15px/20px var(--font-head); color: var(--c-primary); }
.chatfab-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.chatfab-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.chatfab-tools .btn { padding: 0 8px; text-decoration: none; }
.chatfab-x { font-size: 18px; line-height: 1; }
.chatfab-body { overflow-y: auto; padding: 10px 12px; min-height: 0; }
.chatfab-panel .chat-view { grid-template-rows: minmax(0, 1fr) auto auto auto; padding: 10px 12px; gap: 8px; }
.chatfab-panel .chat-log { min-height: 0; max-height: none; }
.chatfab-panel .chat-msg { max-width: 94%; font-size: 13px; line-height: 19px; }
.chatfab-panel .chat-form { grid-template-columns: minmax(0, 1fr) auto; }
.chatfab-panel .chat-form textarea { min-height: 40px; max-height: 120px; }
.chatfab-panel .chat-actions { flex-wrap: nowrap; }
.chatfab-panel .chat-options .check { min-height: 0; font-size: 12px; font-weight: 500; color: var(--c-text-2); }
.chatfab-panel .chat-options .check input { width: 16px; height: 16px; }
.chatfab-panel .chat-empty { min-height: 0; }
.chat-go { justify-self: start; margin-top: 6px; background: var(--c-surface); text-decoration: none; }
.chat-history { display: grid; gap: 6px; }
.chat-hrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px; align-items: center; padding: 2px 4px 2px 0; border-radius: var(--r-sm); background: var(--c-tint-1); }
.chat-hrow.on { background: var(--row-selected); }
.chat-hopen { display: grid; gap: 1px; min-width: 0; padding: 6px 8px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--c-text); min-height: 0; }
.chat-hopen b { font: 600 13px/18px var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-hopen small { font-size: 11px; }
@media (max-width: 899px) {
  .chatfab { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .chatfab-btn span { display: none; }
  .chatfab-btn { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 24px; }
  .chatfab.open { inset: 0; right: 0; bottom: 0; z-index: 60; }
  .chatfab.open .chatfab-panel { width: 100vw; height: 100dvh; border-radius: 0; }
}
@media (max-width: 480px) {
  .chatfab-panel .chat-form { grid-template-columns: minmax(0, 1fr); }
  .chatfab-panel .chat-actions .btn { flex: 1; }
}
@media print { .chatfab { display: none !important; } }

/* opciones de un diálogo con explicación debajo (p. ej. qué incluir al imprimir un informe) */
.et-choice { align-items: flex-start; min-height: 0; padding: 6px 8px; border-radius: var(--r-sm); background: var(--c-tint-1); font-weight: 400; }
.et-choice input { margin-top: 2px; }
.et-choice b { font: 600 13px/18px var(--font-body); }

/* totales y subtotales dentro de una tabla (inventario de animales): el subtotal en negrita sobre fondo suave, el total sobre el fondo de totales */
.dg-table tbody tr.subtotal td, .dg-table tbody tr.grand td { font-weight: 700; }
.dg-table tbody tr.subtotal:not(.sel) { background: var(--c-tint-1); }
.dg-table tbody tr.subtotal.deep:not(.sel) { background: var(--c-tint-2); }
.dg-table tbody tr.grand:not(.sel) { background: var(--row-totals); }
.dg-table tbody tr.grand td { border-top: 2px solid var(--c-tint-4); text-transform: uppercase; letter-spacing: .2px; }
.dg-table tbody tr.subtotal .cell-link, .dg-table tbody tr.grand .cell-link { font-weight: 700; }
@media print {
  .print-table tr.subtotal td, .print-table tr.grand td { font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tr.subtotal td { background: #eeeeee; }
  .print-table tr.subtotal.deep td { background: #e3e3e3; }
  .print-table tr.grand td { background: #d9d9d9; border-top: 2px solid #333; text-transform: uppercase; }
}

/* tarjeta a la que la pantalla baja sola (la lista de animales de la categoría elegida): deja ver su título bajo la cabecera */
.scroll-anchor { scroll-margin-top: 76px; }
.row.between > .hint { margin: 0; flex: 1 1 260px; }
