@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ground: #f7f9f4;
  --surface: #ffffff;
  --raised: #f1f4ec;
  --active: #e9efe2;
  --border: #e0e6d8;
  --rule: #edf0e8;
  --control: #cbd4c1;
  --text: #182015;
  --muted: #5b6656;
  --faint: #5c6656;
  --accent: #3f5b32;
  --accent-soft: #eff4e9;
  --accent-track: #dbe7d1;
  --accent-ink: #2b3f22;
  --primary: #1d2418;
  --positive: #247b50;
  --negative: #b3262c;
  --warning: #8a4a0f;
  --chart-1: #3f5b32;
  --chart-2: #93a485;
  --chart-3: #c8d3bc;
  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #14532d;
  --pill-negative-bg: #ffedea;
  --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;
  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #f1f4ec;
  --pill-neutral-ink: #4b5547;
  --pill-accent-bg: #eff4e9;
  --pill-accent-ink: #2b3f22;
  --radius-card: 8px;
  --radius-control: 6px;
  --sidebar-width: 232px;
  --topbar-height: 64px;
  --gap: 24px;
  --pad: 29px;
  --control-height: 34px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-title: 24px;
  --fs-section: 16px;
  --fs-kpi: 24px;
  --fs-body: 14px;
  --fs-small: 12px;
  --shadow-float: 0 12px 32px rgba(24, 32, 21, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--ground); }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
.num, .kpi-value, .stat-value, .capacity-value, .bar-value, .list-meta strong,
.timeline-date, .user-role, table { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot {
  min-height: 100vh; display: grid; place-content: center; gap: 12px;
  justify-items: center; color: var(--muted);
}
.boot-mark { color: var(--accent); }
.boot p { margin: 0; font-size: 14px; }
.noscript { padding: 32px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.bottom-nav { display: none; }
.shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--ground);
  padding: 18px 12px 14px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 8px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; color: #f4f8ee; flex: none;
}
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.brand-name span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0.01em; }
.account {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface);
}
.account-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.account-plan { font-size: 12px; color: var(--muted); margin-top: 2px; }
.account-btn {
  border: 0; background: transparent; color: var(--muted); padding: 4px;
  border-radius: 4px; display: grid; place-items: center;
}
.nav { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 12px; color: var(--faint); padding: 0 10px 4px; font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 34px;
  padding: 6px 10px; border-radius: 6px; color: var(--muted);
  text-decoration: none; font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--active); color: var(--accent-ink); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { color: var(--faint); flex: none; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
}
.nav-badge.alert { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.user-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; }
.user-row:hover { background: var(--raised); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-track);
  color: var(--accent-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700;
  flex: none;
}
.user-name { display: block; font-size: 13px; font-weight: 600; line-height: 1.15; }
.user-role { display: block; font-size: 12px; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-height); flex: none; display: flex; align-items: center; gap: 16px;
  padding: 0 var(--pad); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; background: var(--ground);
}
.menu-btn { display: none; }
.search {
  position: relative; width: min(420px, 42vw); flex: none;
}
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; height: 34px; border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); padding: 0 12px 0 34px; font-size: 13px;
}
.search input::placeholder { color: var(--faint); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  padding: 4px 8px; border-radius: 999px; background: var(--raised);
}
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.sync-dot.off { background: var(--warning); }
.top-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  border: 0;
}
.content { padding: 26px var(--pad) 56px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-title { margin: 0; font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.page-sub { margin: 5px 0 0; font-size: 13px; color: var(--muted); max-width: 720px; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb strong { color: var(--text); font-weight: 600; }

/* ── Controls ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-height); padding: 6px 12px; border-radius: var(--radius-control);
  border: 1px solid transparent; background: transparent; color: var(--text);
  font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #2a3324; }
.btn-secondary { background: var(--surface); border-color: var(--control); }
.btn-secondary:hover { background: var(--raised); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--raised); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #e9c3c0; color: var(--negative); }
.btn-danger:hover { background: var(--pill-negative-bg); }
.btn-sm { min-height: 28px; padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid transparent;
  border-radius: var(--radius-control); background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; min-height: 20px; padding: 2px 7px;
  border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
}
.pill-positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill-negative { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill-warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill-accent { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.pill-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-high { background: var(--negative); }
.dot-medium { background: #b7791f; }
.dot-low { background: var(--faint); }
.dot-positive { background: var(--positive); }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tab {
  border: 0; background: transparent; padding: 9px 0 10px; font-size: 13px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 10px; font-size: 12px; color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent-track); color: var(--accent-ink); font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 12px; }
.toolbar .search { width: 260px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-height); border: 1px solid var(--control);
  border-radius: var(--radius-control); background: var(--surface); padding: 6px 10px;
  font-size: 13px;
}
.textarea { min-height: 74px; resize: vertical; padding-top: 8px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-track); outline-offset: 0; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 32px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.inline-note { font-size: 12px; color: var(--muted); padding: 8px 10px; background: var(--raised); border-radius: 6px; }

/* ── Cards, grid, KPI ──────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: var(--gap); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.rail-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 0; }
.card-title { margin: 0; font-size: var(--fs-section); font-weight: 600; letter-spacing: -0.01em; }
.card-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.card-body { padding: 14px 18px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--rule); display: flex; justify-content: center; }
.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  overflow: hidden; margin-bottom: var(--gap);
}
.kpi { padding: 14px 18px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { margin-top: 4px; font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi.lead .kpi-value { font-size: 30px; }
.kpi-caption { margin-top: 4px; font-size: 12px; color: var(--muted); }
.kpi-caption strong { font-weight: 600; color: var(--text); }
.kpi-caption .up { color: var(--positive); }
.kpi-caption .down { color: var(--negative); }
.kpi-caption .flat { color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section-head p { margin: 0; font-size: 12px; color: var(--muted); }
.section-head .right { margin-left: auto; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-mark { width: 12px; height: 2px; border-radius: 1px; background: var(--chart-1); }
.legend-mark.dashed { height: 0; background: transparent; border-top: 2px dashed var(--chart-2); }
.chart-empty { height: 190px; display: grid; place-items: center; font-size: 12px; color: var(--muted); }

/* ── Lists and tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.table-scroll { max-height: 430px; overflow-y: auto; }
.table-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 8px 10px; white-space: nowrap;
}
th.num, td.num { text-align: right; }
td { padding: 9px 10px; border-top: 1px solid var(--rule); font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #fbfcf9; }
tbody tr.clickable { cursor: pointer; }
.cell-animal { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex: none; background: var(--accent-track); color: var(--accent-ink);
}
.avatar.lactancia { background: #e4edf8; color: #244a73; }
.avatar.gestante { background: #efe7f6; color: #5b3d74; }
.avatar.retiro { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.avatar.cuarentena { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.identity { min-width: 0; }
.identity strong { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity span { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
.sub { font-size: 12px; color: var(--muted); }
.empty {
  padding: 30px 18px; text-align: center; color: var(--muted); font-size: 13px;
}
.empty strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 3px; }
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule);
}
.list-row:first-child { border-top: 0; }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.list-main span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.list-meta { margin-left: auto; text-align: right; flex: none; }
.list-meta strong { display: block; font-size: 13px; font-weight: 600; }
.list-meta span { font-size: 12px; color: var(--muted); }
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--rule);
  cursor: pointer;
}
.alert-item:first-child { border-top: 0; }
.alert-item:hover .alert-title { color: var(--accent); }
.alert-body { min-width: 0; flex: 1; }
.alert-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.alert-detail { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.alert-when { font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; padding-top: 1px; }

/* ── Capacity and bars ──────────────────────────────────────────────────── */
.capacity-list { display: flex; flex-direction: column; gap: 11px; }
.capacity-row { display: grid; grid-template-columns: 140px 1fr 84px; gap: 10px; align-items: center; }
.capacity-name { font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.capacity-name span { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.capacity-track { height: 8px; background: var(--raised); border-radius: 4px; overflow: hidden; }
.capacity-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.capacity-fill.warn { background: #b7791f; }
.capacity-fill.over { background: var(--negative); }
.capacity-value { text-align: right; font-size: 12px; color: var(--muted); white-space: normal; line-height: 1.2; overflow: hidden; }
.capacity-value strong { color: var(--text); font-weight: 600; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 126px 1fr 82px; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 7px; background: var(--raised); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--chart-2); border-radius: 4px; }
.bar-fill.top { background: var(--chart-1); }
.bar-value { text-align: right; font-size: 13px; font-weight: 600; }

/* ── Animal ficha ───────────────────────────────────────────────────────── */
.ficha-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.ficha-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ficha-title h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.ficha-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.ficha-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-row {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  overflow: hidden; margin-bottom: var(--gap);
}
.stat { padding: 12px 16px; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 1px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; font-size: 13px; font-weight: 500; }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 11px; padding: 10px 0; border-top: 1px solid var(--rule); }
.timeline-item:first-child { border-top: 0; }
.timeline-mark {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center; flex: none; margin-top: 1px;
}
.timeline-body { min-width: 0; flex: 1; }
.timeline-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.timeline-detail { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.timeline-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.event-photo { max-width: 100%; border-radius: 6px; margin-top: 6px; }

/* ── Campo ──────────────────────────────────────────────────────────────── */
.campo-hero {
  background: var(--accent); color: #f4f8ee; border-radius: var(--radius-card);
  padding: 20px; margin-bottom: 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.campo-hero h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.campo-hero p { margin: 4px 0 0; font-size: 12px; color: #dbe7d1; max-width: 520px; }
.campo-hero .btn { background: #f4f8ee; color: var(--accent-ink); }
.campo-hero .btn:hover { background: #fff; }
.campo-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.action-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); text-align: left; min-height: 92px;
}
.action-tile:hover { border-color: var(--accent-track); background: var(--accent-soft); }
.action-tile strong { font-size: 13px; }
.action-tile span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.action-tile svg { color: var(--accent); }
.queue { display: flex; flex-direction: column; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); }
.queue-item:first-child { border-top: 0; }
.queue-status { font-size: 10px; font-weight: 600; color: var(--warning); }
.campo-search { display: flex; gap: 8px; margin-bottom: 12px; }
.campo-search .search { flex: 1; width: auto; }
.recent-animals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recent-animal {
  display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); text-align: left;
}
.recent-animal:hover { border-color: var(--accent-track); }
.recent-animal strong { display: block; font-size: 12.5px; }
.recent-animal span { display: block; font-size: 11px; color: var(--muted); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.login-panel { padding: 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .brand-mark { width: 34px; height: 34px; }
.login-brand strong { font-size: 15px; }
.login-panel h1 { margin: 0; font-size: 32px; line-height: 1.05; letter-spacing: -0.03em; max-width: 480px; }
.login-panel .lead { margin: 14px 0 0; font-size: 16px; color: var(--muted); max-width: 440px; }
.login-sample { margin-top: 26px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: 16px; max-width: 460px; }
.login-sample-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.login-sample-head strong { color: var(--text); }
.login-sample .capacity-row { grid-template-columns: 110px 1fr 64px; }
.login-foot { font-size: 12px; color: var(--muted); }
.login-card-wrap { background: var(--accent); display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { background: var(--surface); border-radius: 12px; padding: 28px; width: min(390px, 100%); }
.login-card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.login-card p { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-demo { margin-top: 16px; padding: 10px; border-radius: 6px; background: var(--raised); font-size: 12px; color: var(--muted); line-height: 1.5; }
.login-demo strong { color: var(--text); }
.login-error { margin-top: 12px; padding: 9px 10px; border-radius: 6px; background: var(--pill-negative-bg); color: var(--pill-negative-ink); font-size: 12px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(24, 32, 21, 0.32); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px 24px;
  overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 10px; width: min(560px, 100%);
  box-shadow: var(--shadow-float); border: 1px solid var(--border);
}
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--rule); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.modal-error { margin-bottom: 12px; padding: 9px 10px; border-radius: 6px; background: var(--pill-negative-bg); color: var(--pill-negative-ink); font-size: 12px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; box-shadow: var(--shadow-float); font-size: 12.5px; line-height: 1.4;
  display: flex; gap: 8px; align-items: flex-start;
}
.toast strong { font-weight: 600; }
.toast.positive { border-left: 3px solid var(--positive); }
.toast.negative { border-left: 3px solid var(--negative); }
.toast.warning { border-left: 3px solid #b7791f; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--rule); margin: 14px 0; }
.skeleton { background: var(--raised); border-radius: 4px; color: transparent; }
.status-line { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.status-line .dot { width: 6px; height: 6px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid { grid-template-columns: minmax(0, 1fr) 330px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(4) { border-top: 1px solid var(--rule); }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-left: 0; border-top: 1px solid var(--rule); }
  .stat:nth-child(5) { border-top: 1px solid var(--rule); }
}
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .rail { order: 2; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-card-wrap { padding: 40px 24px; }
  .login-panel { padding: 28px 24px; }
  .login-panel h1 { font-size: 30px; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    transform: translateX(-102%); transition: transform 180ms ease;
    width: 270px; flex-basis: 270px;
  }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-float); }
  body.menu-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(24, 32, 21, 0.3);
    z-index: 40;
  }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .search { display: none; }
  .content { padding: 20px 16px 90px; }
  .page-head { flex-wrap: wrap; }
  .head-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; font-size: 11px; color: var(--muted); text-decoration: none;
    border-radius: 6px; min-height: 48px; justify-content: center;
  }
  .bottom-nav a.active { color: var(--accent-ink); background: var(--accent-soft); }
  .bottom-nav a span { white-space: nowrap; }
  .campo-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ficha-actions { width: 100%; margin-left: 0; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; border-left: 0; }
  .capacity-row { grid-template-columns: 120px 1fr 70px; }
  .kv { grid-template-columns: 110px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; border-radius: 12px 12px 0 0; max-height: 92vh; overflow-y: auto; }
  .toasts { bottom: 74px; }
}
@media (max-width: 560px) {
  .page-title { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 14px; }
  .kpi.lead .kpi-value { font-size: 26px; }
  .kpi-value { font-size: 21px; }
  .two-col { gap: 16px; }
  .grid { gap: 16px; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 12px 14px 14px; }
  .card-foot { padding: 10px 14px; }
  .table-wrap { margin: 0 -14px; }
  th, td { padding: 8px; }
  .hide-sm { display: none !important; }
  .capacity-row { grid-template-columns: 96px 1fr 62px; gap: 8px; }
  .bar-row { grid-template-columns: 96px 1fr 72px; }
  .recent-animals { grid-template-columns: 1fr; }
  .login-panel h1 { font-size: 24px; }
  .login-card { padding: 22px; }
  .ficha-title h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
