:root {
  --teal: #1997ab;
  --teal-dark: #147a8a;
  --teal-light: #e3f4f5;
  --honey: #e8a33d;
  --honey-dark: #a86a1c;
  --honey-light: #fdf1dc;
  --ink: #24272b;
  --bg: #f0f7f8;
  --card: #ffffff;
  --border: #e0e8ea;
  --muted: #6b7480;
  --danger: #d64545;
  --danger-bg: #fbeaea;
  --coral: #e0735f;
  --coral-light: #fbe7e3;
  --lavender: #7c6fd6;
  --lavender-light: #ece9fb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,24,32,.04), 0 6px 16px rgba(16,24,32,.07);
  --shadow-hover: 0 4px 10px rgba(16,24,32,.07), 0 14px 32px rgba(16,24,32,.12);
  --font-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(25,151,171,.10), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(25,151,171,.06), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25,151,171,.15);
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 700;
  transition: background .15s, opacity .15s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--teal-light); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { opacity: .8; }
.btn-sm { padding: 8px 15px; font-size: 12.5px; }
.btn-link {
  background: none; border: none; padding: 0; font: inherit; font-weight: 600;
  color: var(--teal-dark); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.btn-link:hover { color: var(--teal); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-logo { width: 220px; height: auto; max-height: 140px; object-fit: contain; margin-bottom: 20px; }
.login-card { padding-top: 24px; }
.login-card h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.login-card label { text-align: left; margin-top: 14px; }
.login-card .btn { width: 100%; margin-top: 18px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* ---------- APP SHELL (sidebar) ---------- */
.app { min-height: 100vh; display: flex; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width .18s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh; /* en móvil 100vh incluye la barra del navegador y tapa el final del menú */
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 16px rgba(0,0,0,.12);
  z-index: 10;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-logo-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
/* El logo por defecto (assets/logo-wordmark-white.png) ya es blanco y va
   directo sobre el sidebar oscuro -- la tarjeta blanca solo se agrega (vía
   JS, aplicarLogoDeLaEmpresa en main.js) cuando una clínica sube SU PROPIO
   logo, que puede venir en cualquier color y necesita un fondo claro para
   verse bien. */
.sidebar-brand-logo-wrap.has-custom-logo {
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
.sidebar-brand-logo {
  height: auto;
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}
.sidebar-brand .sidebar-collapse-btn { margin-left: auto; flex-shrink: 0; }
.sidebar-collapse-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.25); color: #cfd6d9;
  border-radius: 6px; width: 24px; height: 24px; font-size: 13px; flex-shrink: 0; line-height: 1;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.1); }

.sidebar-nav { flex: 1; min-height: 0; padding: 10px 8px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.nav-group { margin-bottom: 6px; }
.nav-group-header {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: #cfd6d9;
  padding: 11px 10px; border-radius: 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.nav-group-header:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group-icon {
  font-size: 18px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,.07);
  border-radius: 10px;
  transition: background .15s ease;
}
.nav-group-header:hover .nav-group-icon { background: rgba(255,255,255,.14); }
.nav-group-icon svg { width: 18px; height: 18px; stroke: currentColor; }
.nav-group-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group-caret { font-size: 11px; transition: transform .15s ease; }
.nav-group.collapsed .nav-group-caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }

.nav-group-items { display: flex; flex-direction: column; gap: 3px; padding: 2px 0 8px; }
.tab {
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: #cfd6d9;
  padding: 11px 14px 11px 27px;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, border-color .15s;
}
.tab:hover { background: rgba(255,255,255,.08); color: #fff; }
.tab.active { background: rgba(25,151,171,.22); color: #fff; border-left-color: var(--teal); }

.sidebar-utilities {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-utility-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: #cfd6d9;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.sidebar-utility-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-utility-btn[hidden] { display: none; }

.sidebar-toggle-mobile {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 40;
  background: var(--ink); color: #fff; border: none; border-radius: 8px;
  width: 38px; height: 38px; font-size: 16px;
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }

/* Collapsed (icons-only) sidebar */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-brand-logo-wrap,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-group-caret,
.sidebar.collapsed .sidebar-utilities,
.sidebar.collapsed .tab { display: none; }
.sidebar.collapsed .nav-group-items { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

.content { flex: 1; padding: 20px; max-width: 1100px; width: 100%; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

/* ---------- GENERIC COMPONENTS ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
  transition: box-shadow .25s ease, transform .25s ease;
}
.card h2 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.balance-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border-left: 4px solid var(--teal);
  transition: box-shadow .25s ease, transform .25s ease;
}
.balance-card:hover, .stat:hover, .chart-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.balance-card .name { font-size: 13px; color: var(--muted); font-weight: 600; }
.balance-card .amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; margin-top: 5px; }
.balance-card.negative { border-left-color: var(--danger); }
.balance-card.negative .amount { color: var(--danger); }

.summary-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.summary-row .stat {
  flex: 1; min-width: 180px; display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
  transition: box-shadow .25s ease, transform .25s ease;
}
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 600; margin-top: 5px; }
.stat.income .value { color: var(--teal-dark); }
.stat.expense .value { color: var(--danger); }

.stat-icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.stat-icon-teal { background: var(--teal-light); }
.stat-icon-coral { background: var(--coral-light); }
.stat-icon-honey { background: var(--honey-light); }
.stat-icon-lavender { background: var(--lavender-light); }

/* ---------- Dashboard: encabezado, acciones rápidas, layout, citas de hoy ---------- */
.dash-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.dash-header-eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-dark); }
.dash-header-title { font-size: clamp(22px, 3vw, 28px); margin: 4px 0 0; }

.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.quick-action-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--card); border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; cursor: pointer; text-align: left; font-family: inherit;
  transition: box-shadow .25s ease, transform .25s ease;
}
.quick-action-tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.quick-action-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.quick-action-icon-teal { background: var(--teal-light); }
.quick-action-icon-coral { background: var(--coral-light); }
.quick-action-icon-honey { background: var(--honey-light); }
.quick-action-icon-lavender { background: var(--lavender-light); }
.quick-action-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }

.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; margin-top: 4px; }
.dash-main { min-width: 0; }
.dash-sidebar { padding: 18px; position: sticky; top: 20px; }

.citas-hoy-list { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.cita-hoy-item {
  display: flex; gap: 12px; align-items: center; width: 100%;
  border: none; background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; text-align: left; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.cita-hoy-item:hover { background: var(--teal-light); transform: translateX(2px); }
.cita-hoy-hora { font-size: 13px; font-weight: 700; color: var(--teal-dark); flex-shrink: 0; width: 38px; }
.cita-hoy-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cita-hoy-nombre { font-size: 13.5px; font-weight: 600; }

@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { position: static; }
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.clickable { cursor: pointer; }
tr:has(td.clickable):hover { background: var(--teal-light); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--teal-light); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.tag.venta { background: var(--teal-light); color: var(--teal-dark); }
.tag.gasto { background: var(--danger-bg); color: var(--danger); }
.tag.formula { background: var(--teal-light); color: var(--teal-dark); }
.tag.laboratorio { background: var(--honey-light); color: var(--honey-dark); }
.tag.declinacion { background: var(--danger-bg); color: var(--danger); }
.tag.migrado, .tag.otro { background: #eef1f2; color: var(--muted); }
.tag.bano, .tag.bano_medicado, .tag.bano_antipulgas { background: var(--teal-light); color: var(--teal-dark); }
.tag.cirugia { background: var(--honey-light); color: var(--honey-dark); }
.tag.consulta { background: #eef1f2; color: var(--ink); }
.tag.ecografia, .tag.rx, .tag.laboratorio { background: var(--teal-light); color: var(--teal-dark); }
.tag.interconsulta { background: #eef1f2; color: var(--ink); }
.tag.procedimiento { background: #e5f6ec; color: #1e8e5a; }
.tag.vigente, .tag.reforzada { background: #e5f6ec; color: #1e8e5a; }
.tag.proxima { background: var(--honey-light); color: var(--honey-dark); }
.tag.vencida { background: var(--danger-bg); color: var(--danger); }
.tag.sin_fecha { background: #eef1f2; color: var(--ink); }
.tag.preparando { background: var(--honey-light); color: var(--honey-dark); }
.tag.asignado { background: #e8e0fb; color: #6b46c1; }
.tag.aceptado { background: #dbeafe; color: #1d4ed8; }
.tag.en_ruta { background: var(--teal-light); color: var(--teal-dark); }
.tag.entregado { background: #e5f6ec; color: #1e8e5a; }
.tag.pending, .tag.on-hold { background: var(--honey-light); color: var(--honey-dark); }
.tag.processing { background: var(--teal-light); color: var(--teal-dark); }
.tag.completed { background: #e5f6ec; color: #1e8e5a; }
.tag.cancelled, .tag.failed { background: var(--danger-bg); color: var(--danger); }
.tag.refunded { background: #eef1f2; color: var(--muted); }

/* ---------- CALENDARIO DE CITAS ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 4px 0; }
.cal-day { border: 1px solid var(--border); border-radius: 8px; min-height: 92px; padding: 6px; cursor: pointer; transition: background .1s ease; min-width: 0; overflow: hidden; }
.cal-day:hover { background: var(--teal-light); }
.cal-day.otro-mes { opacity: .4; }
.cal-day.hoy { border-color: var(--teal); border-width: 2px; }
.cal-day-num { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.cal-pill { display: block; border-radius: 4px; padding: 2px 5px; margin-bottom: 2px; font-size: 10.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

.cal-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-nav-actions { display: flex; gap: 8px; }
.cal-more { font-size: 10.5px; }

/* En pantallas angostas las 7 columnas no alcanzan para leer "10:00 Mascota":
   cada cita pasa a ser un puntito de color y tocar el día abre su lista. */
@media (max-width: 780px) {
  .cal-nav { flex-wrap: wrap; }
  .cal-nav-txt { display: none; }
  .cal-grid { gap: 3px; }
  .cal-dow { font-size: 10px; letter-spacing: 0; }
  .cal-day { min-height: 54px; padding: 4px 3px; border-radius: 6px; }
  .cal-day.hoy { border-width: 1.5px; }
  .cal-day-num { font-size: 11.5px; margin-bottom: 3px; text-align: center; }
  .cal-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .cal-day .cal-pill {
    display: inline-block; width: 7px; height: 7px; padding: 0; margin: 0;
    border-radius: 50%; font-size: 0; background: currentColor; pointer-events: none;
  }
  .cal-more { display: block; text-align: center; font-size: 9px; margin-top: 2px; }
}

/* ---------- PORTAL: TARJETA DE MASCOTA ---------- */
.pet-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 14px; cursor: pointer;
  border-left: 4px solid var(--teal);
  transition: box-shadow .25s ease, transform .25s ease;
}
.pet-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.pet-card-photo {
  width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--teal-light); display: flex; align-items: center; justify-content: center;
}
.pet-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.pet-card-photo .placeholder { font-size: 34px; }
.pet-card-body { flex: 1; min-width: 0; }
.pet-card-name { font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--ink); }
.pet-card-meta { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.pet-card-arrow { color: var(--muted); font-size: 22px; flex-shrink: 0; }

.balance-card.vac-vigente { border-left-color: #1e8e5a; }
.balance-card.vac-proxima { border-left-color: var(--honey); }
.balance-card.vac-vencida { border-left-color: var(--danger); }
.balance-card.vac-sin_fecha { border-left-color: var(--border); }
.balance-card.vac-reforzada { border-left-color: #1e8e5a; }

/* La tarjeta de vacuna trae más texto y hasta 3 botones -- necesita más
   ancho mínimo que las tarjetas de saldo, y el tag/acciones van en filas
   separadas para no forzarlos a compartir una sola línea angosta. */
.vac-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.vac-card-footer { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vac-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.vac-card-actions .vac-eliminar { padding-left: 10px; padding-right: 10px; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 6px; }
.slot-btn {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 6px; background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.slot-btn:hover:not(:disabled) { border-color: var(--teal); }
.slot-btn.selected { background: var(--teal); border-color: var(--teal); color: #fff; }
.slot-btn:disabled { color: #b9c0c4; text-decoration: line-through; cursor: not-allowed; background: #f0f2f3; }

.table-wrap { overflow-x: auto; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 160px; }

.items-table th, .items-table td { padding: 6px; }
.items-table input, .items-table select { padding: 6px 8px; font-size: 13px; }
.items-table .col-qty, .items-table .col-price, .items-table .col-sub { width: 100px; }
.items-table .col-action { width: 36px; }

.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }

.segmented-wrap { display: flex; flex-direction: column; gap: 5px; }
.segmented-wrap .segmented-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: #fff;
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--teal); color: #fff; }

/* ---------- BUSCADOR CON SUGERENCIAS (autocomplete) ---------- */
.autocomplete-list {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); margin: -10px 0 12px; max-height: 220px; overflow-y: auto;
}
.autocomplete-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--teal-light); }
.autocomplete-item .ac-mascota { font-weight: 700; font-size: 13.5px; }
.autocomplete-item .ac-cliente { color: var(--muted); font-size: 12px; margin-top: 1px; }
.filters label { margin-bottom: 0; min-width: 140px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal { background: #fff; border-radius: var(--radius); max-width: 500px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 22px; }
.modal h3 { margin-top: 0; }
.modal-close { float: right; background: none; border: none; font-size: 18px; color: var(--muted); }

/* Botón circular de solo ícono, para acciones secundarias/ocasionales
   que no deben competir en peso visual con la acción principal de la vista. */
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 100;
}
.toast.error { background: var(--danger); }

.empty-state { color: var(--muted); font-size: 13.5px; padding: 20px 0; text-align: center; }

/* ---------- HISTORIAS CLINICAS ---------- */
.hc-badge {
  display: inline-flex; align-items: baseline; gap: 10px;
  background: var(--teal-light); color: var(--teal-dark);
  border-radius: 10px; padding: 10px 18px; margin-bottom: 14px;
}
.hc-badge-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.hc-badge-value { font-size: 21px; font-weight: 700; }
.visita-card { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.visita-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; cursor: pointer; background: #fafbfb; font-size: 13.5px;
}
.visita-card-header:hover { background: #f0f7f8; }
.visita-card-caret { color: var(--muted); font-size: 11px; transition: transform .15s ease; }
.visita-card.expanded .visita-card-caret { transform: rotate(180deg); }
.visita-card-body { display: none; padding: 14px; font-size: 13.5px; }
.visita-card.expanded .visita-card-body { display: block; }
.visita-card-body h4 { margin: 14px 0 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.visita-card-body h4:first-child { margin-top: 0; }
.visita-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 16px; }

.archivo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.archivo-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.archivo-nombre { font-size: 12.5px; word-break: break-word; }
.archivo-actions { display: flex; gap: 6px; flex-shrink: 0; }
.archivo-suelto {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; font-size: 13px;
}
.archivo-suelto:last-child { margin-bottom: 0; }

/* ---------- ACTIVIDAD DEL MES (grafico + tarjetas pequenas) ---------- */
.activity-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 20px; }
.chart-card { flex: 1 1 500px; min-width: 320px; }
.activity-stats { display: flex; flex-direction: column; gap: 14px; width: 200px; flex-shrink: 0; }

.chart-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chart-legend { display: flex; gap: 14px; }
.legend-item { font-size: 12.5px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff;
  padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.6;
  box-shadow: var(--shadow); white-space: nowrap; z-index: 5;
}
.chart-tooltip .legend-swatch { width: 8px; height: 8px; margin-right: 4px; }
.chart-tooltip-date { font-weight: 700; margin-bottom: 2px; }

@media (max-width: 560px) {
  .activity-stats { flex-direction: row; width: 100%; }
}

/* ---------- SCROLL REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s cubic-bezier(.2,.7,.3,1), transform .55s cubic-bezier(.2,.7,.3,1);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- PORTAL DE CLIENTES ---------- */
.portal-topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  padding: 10px 16px;
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow);
}
.portal-topbar-title { flex: 1; font-weight: 700; font-size: 14.5px; }
.portal-topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.portal-topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }

.portal-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.portal-tab {
  flex-shrink: 0; background: var(--card); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.portal-tab:hover { background: #f0f7f8; }
.portal-tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }

@media (max-width: 780px) {
  .sidebar-toggle-mobile { display: flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-collapse-btn { display: none; }
  .content { padding-top: 60px; }
}

/* --- Página pública /precios --- */
.precios-body { background: var(--bg); }
.precios-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; max-width: 1080px; margin: 0 auto;
}
.precios-logo { height: 34px; width: auto; }
.precios-main { max-width: 1080px; margin: 0 auto; padding: 20px 32px 64px; }
.precios-intro { text-align: center; max-width: 620px; margin: 0 auto 40px; }
.precios-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--teal-dark);
}
.precios-intro h1 { margin: 10px 0 10px; font-size: 32px; }
.precios-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  align-items: stretch;
}
.precio-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 24px; position: relative;
  display: flex; flex-direction: column;
}
.precio-card-destacado { border: 2px solid var(--teal); box-shadow: var(--shadow-hover); }
.precio-badge {
  position: absolute; top: -13px; left: 24px; background: var(--teal); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.precio-card h2 { margin: 6px 0 4px; font-size: 22px; }
.precio-tagline { margin: 0 0 18px; font-size: 13.5px; min-height: 38px; }
.precio-precio { display: flex; align-items: baseline; gap: 4px; margin-bottom: 18px; }
.precio-precio .precio-monto { font-size: 30px; font-weight: 700; color: var(--ink); }
.precio-precio .precio-moneda { font-size: 18px; font-weight: 700; color: var(--ink); }
.precio-precio .precio-periodo { font-size: 12.5px; color: var(--muted); margin-left: 2px; }
.precio-limites { list-style: none; padding: 0; margin: 0 0 20px; font-size: 12.5px; }
.precio-limites li { padding: 3px 0; }
.precio-cta { width: 100%; text-align: center; margin-bottom: 20px; }
.precio-features { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.precio-feature { padding: 6px 0 6px 26px; position: relative; }
.precio-feature.si { color: var(--ink); }
.precio-feature.si::before { content: "✓"; position: absolute; left: 0; color: var(--teal-dark); font-weight: 700; }
.precio-feature.no { color: var(--muted); }
.precio-feature.no::before { content: "–"; position: absolute; left: 0; color: var(--muted); font-weight: 700; }
.precios-nota { text-align: center; margin-top: 36px; font-size: 13.5px; }

@media (max-width: 860px) {
  .precios-grid { grid-template-columns: 1fr; }
}
