/* Veterinaria Pradera — sistema visual de la skill business-management-app con los colores
   del logo: azul del corazón #0450b9, azul marino del texto #15325a y gris carbón de las siluetas.
   Tipografía: Nunito (no la del logo). Toda la paleta vive aquí en :root. */
:root {
  --brand: #0450b9;        /* azul del corazón: botones, activo, enlaces */
  --brand-dark: #15325a;   /* azul marino del texto del logo: hover y texto sobre fondos suaves */
  --brand-soft: #dde8f8;   /* círculos de íconos, chips */
  --brand-softer: #eef4fc; /* banners informativos */
  --accent: #15325a;       /* realce (barra de "hoy" en gráficos) */
  --accent-soft: #e8edf3;  /* gris azulado claro: fondos de avatar, avisos neutros */
  --accent-ink: #2f353d;   /* gris carbón de las siluetas del logo */
  --ink: #1b2430;
  --gray: #5b6573;
  --gray-light: #b8c0cc;
  --line: #e1e6ee;
  --paper: #ffffff;
  --bg: #f4f6fa;
  --danger: #c63b4c; --danger-soft: #fbe3e5;
  --success: #2f7d52; --success-soft: #e1f1e7;
  --warn: #9a5b00;  --warn-soft: #fdefd2;
  --r-lg: 22px; --r-md: 16px; --r-sm: 10px; --r-pill: 999px;
  --shadow-sm: 0 4px 16px rgba(15, 35, 75, 0.07);
  --shadow-md: 0 10px 30px rgba(15, 35, 75, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 35, 75, 0.18);
  /* tipos de cita */
  --t-consulta: #0450b9; --t-consulta-soft: #dde8f8;
  --t-bano: #0e7490;     --t-bano-soft: #dcf1f6;
  --t-vacunacion: #2f7d52; --t-vacunacion-soft: #e1f1e7;
  --t-cirugia: #b23a48;  --t-cirugia-soft: #fbe3e5;
  --t-control: #7a4d00;  --t-control-soft: #fdefd2;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--brand); }
h1, h2, h3, h4 { font-family: inherit; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
h3 { font-size: 18px; }
h4 { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell / topbar ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--bg); border: 1px solid var(--line); flex-shrink: 0; }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar-brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: 0; color: var(--brand-dark); }
.topbar-brand-text span { font-size: 10px; color: var(--gray); white-space: nowrap; }
.demo-badge { font-size: 9px; font-weight: 800; letter-spacing: .06em; padding: 3px 7px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.avatar {
  width: 38px; height: 38px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: var(--brand); font-weight: 700; font-size: 14px;
}

/* El display:grid/gap va en #view-root (el que recibe el innerHTML de cada vista),
   NO en #app-main (que solo tiene un hijo). Ver qa-checklist #1. */
#app-main { flex: 1; max-width: 760px; width: 100%; margin: 0 auto; padding: 22px 16px 112px; }
#view-root { display: grid; gap: 32px; align-content: start; }
#view-root > * { min-width: 0; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--paper);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(15, 35, 75, 0.06);
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  flex: 1; min-width: 0; border: 0; background: transparent; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 6px 0; color: var(--gray); border-radius: var(--r-sm); position: relative;
}
.bottom-nav button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bottom-nav button span { font-size: 10px; font-weight: 600; }
.bottom-nav button.active { color: var(--brand); }
.bottom-nav button.active svg { stroke-width: 2.2; }
.nav-badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; font-style: normal;
}

/* ---------- Welcome / quick actions ---------- */
.welcome-eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--gray); font-weight: 600; }
.welcome h1 { font-size: 25px; line-height: 1.2; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 6px; }
.quick-action { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--ink); padding: 0; }
.qa-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand-dark); transition: transform .12s; }
.quick-action:hover .qa-icon { transform: translateY(-2px); }
.qa-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.quick-action > span:last-child { font-size: 11px; font-weight: 600; color: var(--ink); text-align: center; }

/* ---------- Panels ---------- */
.panel { background: var(--paper); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); min-width: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel + .panel-inner, .panel-section + .panel-section { margin-top: 20px; }
.sub { margin-top: 4px; font-size: 12px; color: var(--gray); }
.view-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-title h1 { font-size: 24px; }
.text-btn { border: 0; background: transparent; color: var(--brand); font-weight: 700; font-size: 12px; padding: 4px 0; }
.text-btn.danger { color: var(--danger); }
.text-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Buttons ---------- */
.primary {
  background: var(--brand); color: #fff; border: 0; padding: 12px 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 13px; white-space: nowrap;
}
.primary:hover:not(:disabled) { background: var(--brand-dark); }
.secondary {
  border: 1px solid var(--line); background: var(--paper); padding: 11px 17px; border-radius: var(--r-pill);
  color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.secondary:hover:not(:disabled) { border-color: var(--brand); }
.danger-btn { background: var(--danger); color: #fff; border: 0; padding: 12px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: 13px; }
.btn-sm { padding: 8px 13px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Segmented tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: 0; background: transparent; padding: 9px 14px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; color: var(--gray); white-space: nowrap; }
.tabs button.active { background: var(--brand); color: #fff; }
.tabs .count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 10px; }

/* ---------- Filtros / búsqueda ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 11px 16px; background: var(--paper); font-size: 14px; }
.date-input, .select-input { border: 1px solid var(--line); border-radius: var(--r-pill); padding: 9px 14px; background: var(--paper); font-size: 13px; color: var(--ink); }
.chip-filter { border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-pill); padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--gray); }
.chip-filter.active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-softer); }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; min-height: 96px; box-shadow: var(--shadow-sm); min-width: 0; }
.metric-label { color: var(--gray); font-size: 11px; font-weight: 600; }
.metric-value { margin: 9px 0 5px; font-size: 21px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-change { color: var(--gray); font-size: 11px; font-weight: 600; }
.metric-change.good { color: var(--success); }
.metric-change.bad { color: var(--danger); }
button.metric { all: unset; box-sizing: border-box; display: block; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; min-height: 96px; cursor: pointer; box-shadow: var(--shadow-sm); }
button.metric:hover, button.metric:focus-visible { border-color: var(--brand); }
.finance-formula { margin: 0; padding: 14px 16px; background: var(--brand-softer); border-radius: var(--r-md); font-size: 12px; color: var(--ink); line-height: 1.7; }
.finance-formula strong { color: var(--brand-dark); }

/* ---------- Próxima cita ---------- */
.next-appt { display: flex; align-items: center; gap: 12px; cursor: pointer; border: 0; background: transparent; padding: 0; width: 100%; text-align: left; color: inherit; }
.next-appt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.next-appt-info strong { font-size: 15px; }
.next-appt-info span { font-size: 12px; color: var(--gray); }
.chevron { width: 18px; height: 18px; stroke: var(--gray-light); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ---------- Avatares de mascota ---------- */
.pet-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 18px; background: var(--accent-soft); }
.pet-avatar.gato { background: var(--brand-soft); }
.pet-avatar.lg { width: 64px; height: 64px; font-size: 30px; }
.pet-avatar svg { width: 60%; height: 60%; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Agenda ---------- */
.agenda { display: grid; gap: 10px; }
.appointment { display: grid; grid-template-columns: 50px 1fr; gap: 6px 12px; padding: 13px 14px; border: 1px solid var(--line); border-left: 4px solid var(--t-color, var(--brand)); border-radius: var(--r-md); background: var(--paper); }
.appointment.is-done { opacity: .78; }
.appointment.is-cancel { opacity: .55; }
.appointment .time { font-weight: 800; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.appointment .time small { display: block; font-weight: 600; font-size: 10px; color: var(--gray); }
.appt-body { min-width: 0; display: grid; gap: 4px; }
.appt-body strong { font-size: 14px; }
.appt-meta { font-size: 12px; color: var(--gray); overflow-wrap: anywhere; }
.appt-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 4px; }
.week-grid { display: grid; gap: 16px; }
.week-day h4 { font-size: 13px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.week-day h4 span { font-size: 11px; color: var(--gray); font-weight: 600; }
.week-day.today h4 { color: var(--brand); }
.week-empty { font-size: 12px; color: var(--gray-light); padding: 8px 2px; border-top: 1px dashed var(--line); }
.type-chip { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-pill); padding: 3px 9px; font-size: 10px; font-weight: 800; letter-spacing: .02em; background: var(--t-soft, var(--brand-soft)); color: var(--t-color, var(--brand-dark)); white-space: nowrap; }
.t-consulta { --t-color: var(--t-consulta); --t-soft: var(--t-consulta-soft); }
.t-bano { --t-color: var(--t-bano); --t-soft: var(--t-bano-soft); }
.t-vacunacion { --t-color: var(--t-vacunacion); --t-soft: var(--t-vacunacion-soft); }
.t-cirugia { --t-color: var(--t-cirugia); --t-soft: var(--t-cirugia-soft); }
.t-control { --t-color: var(--t-control); --t-soft: var(--t-control-soft); }

/* ---------- Pills de estado ---------- */
.pill { display: inline-block; border-radius: var(--r-pill); padding: 4px 10px; font-size: 10px; font-weight: 800; color: var(--warn); background: var(--warn-soft); white-space: nowrap; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: #eef0ec; color: var(--gray); }
.pill.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Filas tipo tarjeta (listas) ---------- */
.list { display: grid; gap: 10px; }
.row-card {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); width: 100%; text-align: left; color: inherit; font: inherit; min-width: 0;
}
button.row-card { cursor: pointer; }
button.row-card:hover { border-color: var(--brand); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.row-main strong { font-size: 14px; overflow-wrap: anywhere; }
.row-main span { font-size: 12px; color: var(--gray); overflow-wrap: anywhere; }
.row-side { display: grid; justify-items: end; gap: 4px; flex-shrink: 0; text-align: right; font-size: 12px; }
.row-side strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.empty-hint { color: var(--gray); font-size: 13px; padding: 14px 4px; margin: 0; }

/* ---------- Alertas ---------- */
.alert-list { display: grid; gap: 8px; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r-md); background: var(--warn-soft); font-size: 12px; color: var(--ink); }
.alert-item.danger { background: var(--danger-soft); }
.alert-item.info { background: var(--brand-softer); }
.alert-item svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; margin-top: 1px; color: var(--warn); }
.alert-item.danger svg { color: var(--danger); }
.alert-item.info svg { color: var(--brand); }
.alert-item strong { display: block; font-size: 13px; }
.alert-item > div { min-width: 0; flex: 1; }
.alert-item .text-btn { flex-shrink: 0; }

/* ---------- Gráficos (barras semanales y línea de peso) ---------- */
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--gray); font-size: 11px; }
.chart-svg .bar { fill: var(--brand); }
.chart-svg .bar.today { fill: var(--accent); }
.chart-svg .hit { fill: transparent; cursor: pointer; }
.chart-svg .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .dot { fill: var(--brand); stroke: var(--paper); stroke-width: 2; }
.chart-svg .crosshair { stroke: var(--gray-light); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .value-label { fill: var(--ink); font-size: 11px; font-weight: 700; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 10px;
  font-size: 11px; line-height: 1.4; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s; z-index: 2;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip strong { font-size: 12px; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.chart-table th, .chart-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.chart-table td:last-child, .chart-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
details.table-toggle summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--brand); margin-top: 10px; }
.trend-note { font-size: 12px; margin-top: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--brand-softer); }
.trend-note.warn { background: var(--warn-soft); }

/* ---------- Ficha de paciente ---------- */
.back-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--brand); font-weight: 700; font-size: 13px; padding: 0; }
.back-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.pet-header { display: flex; gap: 14px; align-items: center; }
.pet-header h1 { font-size: 26px; }
.pet-header .sub { font-size: 13px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray); font-weight: 700; }
.facts dd { margin: 3px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.medical-flag { padding: 11px 13px; border-radius: var(--r-md); background: var(--danger-soft); font-size: 12px; margin-top: 14px; }
.medical-flag strong { color: var(--danger); }
.timeline { display: grid; gap: 10px; }
.visit { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: grid; gap: 8px; }
.visit-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.visit-head strong { font-size: 14px; }
.visit-head span { font-size: 12px; color: var(--gray); }
.visit-vitals { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--gray); }
.visit-vitals b { color: var(--ink); }
.visit p { margin: 0; font-size: 13px; line-height: 1.5; }
.visit p em { font-style: normal; font-weight: 700; color: var(--gray); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

/* ---------- Formularios ---------- */
.field-grid { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ink); min-width: 0; }
.field-label input:not([type="checkbox"]), .field-label select, .field-label textarea {
  border: 1px solid var(--line); background: var(--bg); padding: 12px 13px; border-radius: var(--r-md);
  color: var(--ink); font-size: 16px; font-weight: 400; width: 100%; min-width: 0;
}
.field-label textarea { resize: vertical; }
.field-hint { font-size: 11px; font-weight: 500; color: var(--gray); }
.check-label { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 600; line-height: 1.4; }
.check-label input { width: 20px; height: 20px; flex-shrink: 0; margin: 0; accent-color: var(--brand); }
.form-error { color: var(--danger); font-size: 12px; background: var(--danger-soft); padding: 9px 12px; border-radius: var(--r-sm); margin: 0; }
.form-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray); font-weight: 800; margin-top: 6px; }

/* ---------- Líneas de venta / productos aplicados ---------- */
.line-items { display: grid; gap: 8px; }
.line-item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); font-size: 13px; }
.line-item .li-name { min-width: 0; overflow-wrap: anywhere; }
.line-item .li-name small { display: block; color: var(--gray); font-size: 11px; }
.line-item input { width: 56px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; text-align: center; font-size: 16px; }
.line-item .remove { border: 0; background: transparent; color: var(--danger); font-size: 18px; line-height: 1; padding: 4px 6px; }
.line-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.line-add select { border: 1px solid var(--line); background: var(--bg); padding: 11px 12px; border-radius: var(--r-md); font-size: 16px; min-width: 0; width: 100%; }
.totals { display: grid; gap: 4px; font-size: 13px; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-softer); }
.totals div { display: flex; justify-content: space-between; gap: 10px; }
.totals .grand { font-size: 16px; font-weight: 800; color: var(--brand-dark); }
.totals .muted { color: var(--gray); font-size: 12px; }

/* ---------- Modal ---------- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 25, 50, 0.5); align-items: flex-start; justify-content: center; padding: 20px 12px; z-index: 50; overflow-y: auto; }
.modal-backdrop.show { display: flex; }
.modal { width: min(520px, 100%); margin: auto 0; background: var(--paper); border-radius: var(--r-lg); padding: 24px 20px; box-shadow: var(--shadow-lg); min-width: 0; }
.modal.wide { width: min(720px, 100%); }
.modal h2 { font-size: 20px; margin: 0 0 6px; }
.modal > p { font-size: 13px; color: var(--gray); margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Consentimientos ---------- */
.doc-preview { border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 16px; background: #fffef9; font-size: 13.5px; line-height: 1.6; max-height: 46vh; overflow-y: auto; }
.doc-preview h3 { font-family: "Nunito", system-ui, sans-serif; font-size: 15px; text-align: center; margin-bottom: 12px; }
.doc-preview p { margin: 0 0 10px; }
.doc-preview ul { margin: 0 0 10px; padding-left: 20px; }
.doc-preview li { margin-bottom: 4px; }
.doc-preview mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.doc-preview.full { max-height: none; }
.sig-wrap { display: grid; gap: 6px; }
.sig-pad { width: 100%; height: 170px; border: 2px dashed var(--gray-light); border-radius: var(--r-md); background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-pad.has-ink { border-style: solid; border-color: var(--brand); }
.sig-tools { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--gray); }
.sig-img { max-width: 260px; width: 100%; border-bottom: 1px solid var(--ink); display: block; }
.locked-note { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--success); font-weight: 700; }
.locked-note svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Carnet ---------- */
.carnet-box { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.qr-holder { width: 132px; height: 132px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); display: grid; place-items: center; }
.qr-holder img, .qr-holder canvas { width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.carnet-link { font-size: 11px; color: var(--gray); word-break: break-all; }

/* ---------- Catálogo ---------- */
.catalog-list { display: grid; gap: 8px; margin-top: 10px; }
.catalog-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; background: var(--bg); border-radius: var(--r-sm); font-size: 13px; }
.catalog-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.catalog-row > div:first-child span { font-size: 11px; color: var(--gray); margin-top: 2px; }
.catalog-row-actions { display: flex; gap: 14px; }

/* ---------- Toasts ---------- */
#toast-container { position: fixed; top: 14px; right: 14px; left: 14px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-md); font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; max-width: 340px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ---------- Login y páginas públicas ---------- */
.login-body, .public-body { min-height: 100vh; background: var(--bg); }
.login-body { display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.login-card { width: min(400px, 100%); background: var(--paper); border-radius: var(--r-lg); padding: 30px 24px; box-shadow: var(--shadow-md); text-align: center; }
.login-logo { width: 190px; max-width: 70%; height: auto; display: block; margin: 0 auto; }
.login-card h1 { font-size: 21px; margin: 18px 0 4px; }
.login-card .sub { margin: 0 0 20px; }
.login-card .field-grid { text-align: left; }
.login-card .primary { width: 100%; padding: 14px; margin-top: 6px; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--gray); text-align: left; background: var(--accent-soft); padding: 12px 14px; border-radius: var(--r-md); line-height: 1.5; }
.login-hint code { font-size: 12px; color: var(--accent-ink); font-weight: 700; }
.public-wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 24px; }
.public-head { text-align: center; }
.public-head img { width: 170px; max-width: 60%; height: auto; }
.public-head h1 { font-size: 22px; margin-top: 10px; }
.public-head p { font-size: 13px; color: var(--gray); margin: 6px 0 0; line-height: 1.5; }
.public-foot { text-align: center; font-size: 11px; color: var(--gray); line-height: 1.6; }
.success-box { text-align: center; padding: 10px 4px; }
.success-box .big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; margin: 0 auto 12px; }
.success-box .big-check svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; }
.carnet-card { background: var(--paper); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.carnet-top { background: var(--brand); color: #fff; padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.carnet-top h1 { color: #fff; font-size: 24px; }
.carnet-top p { margin: 3px 0 0; font-size: 13px; opacity: .92; }
.carnet-top .pet-avatar { background: #fff; }
.carnet-body { padding: 18px 20px; display: grid; gap: 18px; }
.vax-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.vax-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.vax-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .quick-actions { grid-template-columns: repeat(8, 1fr); }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .modal { padding: 26px; }
}
@media (min-width: 1024px) {
  #app-main { max-width: 980px; }
  .week-grid { grid-template-columns: repeat(7, 1fr); gap: 10px; }
  .week-grid .appointment { grid-template-columns: 1fr; padding: 10px; }
  .week-grid .appt-actions { display: none; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
}
@media (max-width: 420px) {
  /* Ajustes finos de celular chico. #view-root mantiene el mismo gap (32px) que arriba a
     propósito — si se cambia aquí, cambiarlo también arriba (qa-checklist #2). */
  #app-main { padding: 18px 14px 108px; }
  .welcome h1 { font-size: 22px; }
  .metric { padding: 14px; min-height: 90px; }
  .metric-value { font-size: 18px; }
  .panel { padding: 18px 14px; }
  .field-row { grid-template-columns: 1fr; }
  .topbar-brand-text span { display: none; }
}
.inline-icon { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; vertical-align: -2px; }
