@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════════════════════
   PETERINARY — Clinical Calm Design System
   Teal as accent, never as background. Nunito throughout.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  /* Accent — verde vibrante (principal, logo) */
  --clr-primary: #24d46e;
  --clr-primary-dark: #1aaa57;
  --clr-primary-deeper: #0d7a3c;
  --clr-primary-gradient: #24d46e;
  /* sólido, sin degradado */
  --clr-primary-glow: rgba(36, 212, 110, 0.20);
  --clr-primary-soft: #e6fdf0;

  /* Secondary — muted neutral */
  --clr-secondary: #7A8481;
  --clr-secondary-soft: rgba(122, 132, 129, 0.08);

  /* Surface hierarchy — neutros fríos, sin saturación */
  --surface: #F5F6F5;
  /* canvas */
  --surface-low: #FAFAF8;
  /* section areas */
  --surface-lowest: #FFFFFF;
  /* cards / modules */
  --surface-high: #F0F2F0;
  /* grouped/elevated bg */
  --surface-highest: #EAEDEA;
  /* input bg, chips */
  --surface-sidebar: #FDFDFC;
  /* sidebar clara */

  /* On-surface */
  --on-surface: #00001C;
  --on-surface-mid: #3A4744;
  --on-surface-variant: #7A8481;
  --on-surface-subtle: #A8B0AD;
  --outline-variant: #E8E9E6;

  /* Border */
  --border: #E8E9E6;
  --border-strong: #D6D8D2;

  /* Accent chips / active items */
  --clr-accent-soft: #e6fdf0;
  --clr-accent-ink: #0a5c2e;

  /* Semantic */
  --clr-success: #1aaa57;
  --clr-success-soft: #e6fdf0;
  --clr-success-text: #0d7a3c;
  --clr-warning: #c49a00;
  --clr-warning-brand: #fed627;
  --clr-warning-soft: #fffbe6;
  --clr-warning-text: #7a5e00;
  --clr-danger: #ff3897;
  --clr-danger-soft: #fff0f7;
  --clr-danger-text: #c2005a;
  --clr-info: #2327f7;
  --clr-info-soft: #eceeff;
  --clr-info-text: #1a1db8;

  /* Condition glows — softer */
  --glow-mejoria: 0 0 0 4px rgba(26, 170, 87, 0.14);
  --glow-estable: 0 0 0 4px rgba(35, 39, 247, 0.12);
  --glow-empeoramiento: 0 0 0 4px rgba(196, 154, 0, 0.16);
  --glow-grave: 0 0 0 4px rgba(255, 56, 151, 0.16);

  /* Shadows — neutros */
  --shadow-xs: 0 1px 2px rgba(16, 32, 29, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 32, 29, 0.04), 0 1px 0 rgba(16, 32, 29, 0.03);
  --shadow-md: 0 8px 24px rgba(16, 32, 29, 0.10), 0 1px 2px rgba(16, 32, 29, 0.05);
  --shadow-lg: 0 16px 48px rgba(16, 32, 29, 0.12), 0 4px 12px rgba(16, 32, 29, 0.06);
  --shadow-xl: 0 24px 64px rgba(16, 32, 29, 0.14), 0 8px 20px rgba(16, 32, 29, 0.07);
  --shadow-primary: 0 4px 14px rgba(36, 212, 110, 0.25), 0 2px 6px rgba(36, 212, 110, 0.16);

  /* Radius */
  --radius-xs: 0.375rem;
  /*  6px */
  --radius-sm: 0.5rem;
  /*  8px */
  --radius-md: 0.75rem;
  /* 12px */
  --radius-lg: 1rem;
  /* 16px */
  --radius-xl: 1.25rem;
  /* 20px */
  --radius-full: 9999px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 60px;

  /* Typography — Nunito */
  --font-display: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Nunito', ui-sans-serif, system-ui, sans-serif;

  /* Easing */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* Missing/alias tokens */
  --clr-danger-rgb: 255, 56, 151;
  --clr-success-ink: var(--clr-success-text);
  --clr-success-dark: #0d7a3c;
  --clr-danger-dark: #8a0042;
  --clr-info-dark: #0f11a0;
  --border-subtle: #EDEEED;
  --surface-variant: var(--surface-highest);
  --primary: var(--clr-primary);
  --primary-container: var(--clr-accent-soft);
  --on-primary-container: var(--clr-accent-ink);
  --topbar-height: var(--topbar-h);
}

/* ── Accessibility utilities ─────────────────────────────────────────────── */
.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--clr-primary);
  color: #fff;
  font-weight: 700;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  font-size: 14px;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: var(--clr-primary-dark);
  text-decoration: none;
}

button {
  font-family: var(--font-body);
}

input,
select,
textarea {
  font-family: var(--font-body);
}


/* UI Helpers */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}

.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface-low);
}

.search-result-item:last-child {
  border: none;
}

.search-result-item:hover {
  background: var(--surface-lowest);
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Login: split hero layout ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  overflow: hidden;
  background: var(--surface);
}

/* Left hero panel */
.login-hero {
  flex: 2;
  background: linear-gradient(180deg, var(--clr-primary) 0%, #0d7a3c 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-hero-bg {
  position: absolute;
  inset: -10%;
  opacity: 0.25;
  filter: grayscale(0.5);
  pointer-events: none;
  animation: hero-float 60s ease-in-out infinite alternate;
}

.login-hero-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  animation: bg-fade 36s infinite linear;
  /* changed to linear for smoother motion */
  will-change: transform, opacity;
}

/* Animations for 6 images (6s each, total 36s cycle) */
.login-hero-img:nth-child(1) {
  animation-delay: 0s;
  --kb-x: -1%;
  --kb-y: -1%;
  --kb-s: 1.12;
}

.login-hero-img:nth-child(2) {
  animation-delay: 6s;
  --kb-x: 1%;
  --kb-y: -1%;
  --kb-s: 1.15;
}

.login-hero-img:nth-child(3) {
  animation-delay: 12s;
  --kb-x: -1%;
  --kb-y: 1%;
  --kb-s: 1.10;
}

.login-hero-img:nth-child(4) {
  animation-delay: 18s;
  --kb-x: 1%;
  --kb-y: 1%;
  --kb-s: 1.18;
}

.login-hero-img:nth-child(5) {
  animation-delay: 24s;
  --kb-x: 0%;
  --kb-y: -2%;
  --kb-s: 1.14;
}

.login-hero-img:nth-child(6) {
  animation-delay: 30s;
  --kb-x: -1%;
  --kb-y: 0%;
  --kb-s: 1.13;
}

@keyframes bg-fade {
  0% {
    opacity: 0;
    transform: scale(1.03) translate(0, 0);
  }

  2.78% {
    opacity: 1;
  }

  16.67% {
    opacity: 1;
  }

  19.44% {
    opacity: 0;
    transform: scale(var(--kb-s)) translate(var(--kb-x), var(--kb-y));
  }

  100% {
    opacity: 0;
  }
}

/* Overriding float to be slower since we have crossfade */
@keyframes hero-float {
  0% {
    transform: scale(1) rotate(0deg);
  }

  50% {
    transform: scale(1.1) rotate(1deg);
  }

  100% {
    transform: scale(1.05) rotate(-0.5deg);
  }
}

.login-hero-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.login-hero-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.login-hero-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-hero-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.login-brand-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.login-hero-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.login-hero-label {
  font-size: 14px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-family: var(--font-mono);
}

.login-hero-headline {
  font-family: var(--font-display);
  font-size: clamp(52px, 7vw, 96px);
  font-weight: 600;
  letter-spacing: -2px;
  line-height: 1.02;
}

.login-hero-sub {
  font-size: 18px;
  opacity: 0.72;
  max-width: 65%;
  line-height: 1.6;
}

.login-hero-footer {
  display: flex;
  gap: 28px;
  font-size: 12px;
  opacity: 0.5;
  position: relative;
  z-index: 1;
}

.login-hero-deco {
  position: absolute;
  bottom: -60px;
  right: -40px;
  opacity: 0.07;
  pointer-events: none;
}

/* Right form panel */
.login-panel {
  flex: 1;
  background: var(--surface-lowest);
  padding: 80px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 380px;
}

.login-eyebrow {
  font-size: 11px;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 500;
  margin-bottom: 12px;
}

.login-logo {
  margin-bottom: 0;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--on-surface);
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.login-logo p {
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  margin-bottom: 28px;
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-card .login-hero-mark {
  background: var(--clr-primary);
  color: #fff;
}

@media (min-width: 769px) {
  .login-brand-header {
    display: none;
  }
}

.login-hint {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--on-surface);
  line-height: 1.8;
}

.login-hint strong {
  color: var(--on-surface);
}

.login-hint small {
  font-size: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Sidebar — clara con acento puntual ──────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-header {
  padding: 20px 16px 14px;
  display: flex;
  align-items: center;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.sidebar-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--clr-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.sidebar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--on-surface);
  letter-spacing: -0.02em;
}

.sidebar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--on-surface-variant);
  padding: 4px;
  margin-left: 4px;
  border-radius: var(--radius-xs);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--on-surface-subtle);
  padding: 8px 12px 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 2px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--on-surface-mid);
  font-size: 13px;
  font-weight: 400;
  position: relative;
  transition: background .14s var(--ease-out-quart), color .14s;
}

.nav-item:hover {
  background: var(--surface-high);
  color: var(--on-surface);
}

.nav-item.active {
  background: var(--clr-accent-soft);
  color: var(--clr-accent-ink);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: var(--clr-primary);
  border-radius: 2px;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--clr-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 12px 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--clr-accent-soft);
  color: var(--clr-accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info {
  font-size: 12px;
  color: var(--on-surface-mid);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.user-info strong {
  color: var(--on-surface);
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.topbar-avatar {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--on-surface-variant);
  cursor: pointer;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.02em;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-brand {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.topbar-brand-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.topbar-sep {
  opacity: 0.5;
  font-weight: 400;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS & SECTIONS — no borders, only depth
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.card-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--on-surface);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 20px 24px 24px;
}

.card-header+.card-body {
  padding-top: 6px;
}

/* header ya aporta su padding inferior */
.card-body--flush {
  padding: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Divider replacement — background label strip */
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  margin: 32px 0 14px;
  padding: 6px 12px;
  background: var(--primary);
  border-radius: var(--radius-xs);
  display: block;
}

/* ── Collapsible detail sections ─────────────────────────────────── */
.detail-section { margin-bottom: 16px; }
.detail-section-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.detail-section-hdr .form-section-title { margin: 0; flex: 1; }
.detail-section-body {
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 4000px;
}
.detail-section.collapsed .detail-section-body { max-height: 0; }
.detail-section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--outline);
  cursor: pointer;
  color: var(--on-surface);
  transition: transform 0.2s, background 0.15s;
}
.detail-section-toggle:hover { background: var(--surface-low); }
.detail-section.collapsed .detail-section-toggle { transform: rotate(-90deg); }

/* ═══════════════════════════════════════════════════════════════════════════
   STATS CARDS — editorial large numerals
   ═══════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}

#bill-stats-kpis .stats-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* Resumen facturación: KPIs agrupados en secciones (Ingresos / Facturas) */
.bill-stat-groups {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 26px;
}

.bill-stat-group-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--on-surface-variant);
  margin: 0 0 12px;
}

.bill-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.bill-stat-row .stat-card {
  flex: 1 1 170px;
  min-width: 0;
}

@media (max-width: 768px) {
  .bill-stat-row { gap: 10px; }
  .bill-stat-row .stat-card { flex: 1 1 140px; }
}

.stat-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* SVG icon box for stat cards */
.stat-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-accent {
  background: var(--clr-accent-soft);
  color: var(--clr-primary);
}

.stat-icon-info {
  background: var(--clr-info-soft);
  color: var(--clr-info);
}

.stat-icon-warn {
  background: var(--clr-warning-soft);
  color: var(--clr-warning);
}

.stat-icon-danger {
  background: var(--clr-danger-soft);
  color: var(--clr-danger);
}

.stat-icon-neutral {
  background: var(--surface-high);
  color: var(--on-surface-variant);
}

.stat-icon-warm {
  background: #F4ECDC;
  color: #6F5828;
}

.stat-icon-success {
  background: var(--clr-success-soft);
  color: var(--clr-success);
}

.stat-icon-purple {
  background: #EDE9FE;
  color: #6D28D9;
}

/* Legacy emoji icon (fallback) */
.stat-icon {
  font-size: 22px;
  display: block;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Birthday Grid */
.birthday-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.birthday-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-high);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  min-width: 0;
}

.birthday-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.birthday-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.birthday-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.birthday-info {
  flex: 1;
  min-width: 0;
}

.birthday-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--on-surface);
}

.birthday-meta {
  font-size: 11px;
  color: var(--on-surface);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.birthday-icon {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.birthday-check {
  background: var(--clr-success-soft);
  color: var(--clr-success-ink);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 1400px) {
  .birthday-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1100px) {
  .birthday-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* Vet tabs bar */
.vet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.vet-tabs .btn {
  font-size: 13px;
}

/* Appointments calendar: wider left panel */
.appt-cal-grid {
  grid-template-columns: 1.3fr 1fr;
  height: 80vh;
}

.appt-cal-grid .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.appt-cal-grid .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#calendar-grid {
  flex: 1;
  min-height: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

#appt-day-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  min-height: 0;
}

@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .appt-cal-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

/* ── Sidebar backdrop ────────────────────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 34, 0.50);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 199;
  animation: backdrop-in .22s ease;
}

.sidebar-backdrop.open {
  display: block;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE — no dividers
   ═══════════════════════════════════════════════════════════════════════════ */
.table-wrap,
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: transparent;
  text-align: left;
}

tbody td {
  padding: 13px 18px;
  vertical-align: middle;
  background: transparent;
  transition: background .12s;
}

tbody tr {
  border-radius: var(--radius-sm);
}

tbody tr:hover td {
  background: var(--surface-low);
}

/* Ghost separator — 15% opacity only */
tbody tr+tr td {
  box-shadow: inset 0 1px 0 rgba(78, 96, 115, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS — Soft Inset
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
}

.input-password-wrap {
  position: relative;
}

.input-password-wrap input[type="password"],
.input-password-wrap input[type="text"] {
  padding-right: 40px;
}

.btn-toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  line-height: 1;
  transition: color .15s;
}

.btn-toggle-password:hover {
  color: var(--on-surface);
}

.form-row {
  display: grid;
  gap: 14px;
}

.form-row-2 {
  grid-template-columns: 1fr 1fr;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 9px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  outline: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--on-surface);
  transition: border-color .15s, box-shadow .15s;
}

select {
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8481' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(36, 212, 110, 0.22), var(--shadow-xs);
}

textarea {
  resize: vertical;
  min-height: 82px;
}

.form-hint {
  font-size: 12px;
  color: var(--on-surface-subtle);
  margin-top: 5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS — pill shape, gradient CTAs
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  border: 1px solid transparent;
  transition: background .14s, box-shadow .14s, transform .12s;
  white-space: nowrap;
  letter-spacing: .01em;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

.btn-primary:hover {
  background: var(--clr-primary-dark);
  border-color: var(--clr-primary-dark);
}

.btn-success {
  background: var(--clr-success);
  color: #fff;
  border-color: var(--clr-success);
}

.btn-danger {
  background: var(--clr-danger);
  color: #fff;
  border-color: var(--clr-danger);
}

.btn-warning {
  background: var(--clr-warning);
  color: #fff;
  border-color: var(--clr-warning);
}

.btn-ghost {
  background: var(--surface);
  color: var(--on-surface);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-high);
}

.btn-back {
  background: #FC715E;
  color: #fff;
  border-color: #FC715E;
  font-weight: 700;
  padding: 9px 18px;
  box-shadow: 0 2px 8px rgba(252, 113, 94, .35);
}

.btn-back:hover {
  background: #e85c49;
  border-color: #e85c49;
  box-shadow: 0 4px 12px rgba(252, 113, 94, .5);
}

.btn-back .back-arrow {
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  position: relative;
  top: -1px;
}

.btn-icon {
  padding: 7px 10px;
}


.btn-block {
  width: 100%;
  justify-content: center;
}

.btn:disabled,
button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* ── Segmented Control ─────────────────────────────────────────────────── */
.segmented-control {
  display: flex;
  background: var(--surface-highest);
  padding: 4px;
  border-radius: var(--radius-lg);
  gap: 2px;
  position: relative;
  border: 1px solid var(--border);
}

.segmented-control .segment-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all .2s var(--ease-out-quart);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.segmented-control .segment-btn.active {
  background: var(--surface-lowest);
  color: var(--clr-primary);
  box-shadow: var(--shadow-sm);
}

.segmented-control .segment-btn:hover:not(.active) {
  background: rgba(0,0,0,0.03);
  color: var(--on-surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES — soft glowing pills
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-success {
  background: var(--clr-success-soft);
  color: var(--clr-success-text);
}

.badge-warning {
  background: var(--clr-warning-soft);
  color: var(--clr-warning-text);
}

.badge-danger {
  background: var(--clr-danger-soft);
  color: var(--clr-danger-text);
}

.badge-info {
  background: var(--clr-info-soft);
  color: var(--clr-info-text);
}

.badge-primary {
  background: var(--clr-accent-soft);
  color: var(--clr-accent-ink);
}

.badge-gray {
  background: var(--surface-high);
  color: var(--on-surface);
}

/* ── Condition badges — glowing ─────────────────────────────────────────── */
.cond-mejoria {
  background: var(--clr-success-soft);
  color: var(--clr-success-text);
  box-shadow: var(--glow-mejoria);
}

.cond-estable {
  background: var(--clr-info-soft);
  color: var(--clr-info-text);
  box-shadow: var(--glow-estable);
}

.cond-empeoramiento {
  background: var(--clr-warning-soft);
  color: var(--clr-warning-text);
  box-shadow: var(--glow-empeoramiento);
}

.cond-grave {
  background: var(--clr-danger-soft);
  color: var(--clr-danger-text);
  box-shadow: var(--glow-grave);
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {

  0%,
  100% {
    box-shadow: var(--glow-grave);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(255, 56, 151, 0.08);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
}

.alert-error {
  background: var(--clr-danger-soft);
  color: var(--clr-danger-text);
}

.alert-success {
  background: var(--clr-success-soft);
  color: var(--clr-success-text);
}

.alert-info {
  background: var(--clr-info-soft);
  color: var(--clr-info-text);
}

.row-danger {
  background-color: rgba(var(--clr-danger-rgb), 0.05);
}

.row-danger:hover {
  background-color: rgba(var(--clr-danger-rgb), 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS — Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 34, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modal-in .32s var(--ease-out-expo);
}

.modal-container.modal-lg {
  max-width: 780px;
}

.modal-container.modal-xl {
  max-width: 1100px;
  min-height: 72vh;
}

@keyframes modal-in {
  from {
    transform: translateY(-18px) scale(.97);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.modal-header {
  padding: 22px 26px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Modal header actions (Editar + ···) ────────────────────────── */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-right: 8px;
}

.pet-action-menu-wrap {
  position: relative;
}

.pet-action-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
  background: #334155;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 2px;
  transition: background 0.15s;
}
.pet-action-menu-btn:hover { background: #1e293b; }

.pet-action-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 200;
  padding: 4px 0;
  overflow: hidden;
}

.pet-action-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13.5px;
  color: var(--on-surface);
  cursor: pointer;
  transition: background 0.12s;
}
.pet-action-item:hover { background: var(--surface-low); }
.pet-action-item--blue   { color: #1d4ed8; }
.pet-action-item--blue:hover   { background: #eff6ff; }
.pet-action-item--purple { color: #7c3aed; }
.pet-action-item--purple:hover { background: #f5f3ff; }
.pet-action-item--teal   { color: #0f766e; }
.pet-action-item--teal:hover   { background: #f0fdfa; }
.pet-action-item--gray   { color: #475569; }
.pet-action-item--gray:hover   { background: #f1f5f9; }
.pet-action-item--warn   { color: #b45309; }
.pet-action-item--warn:hover   { background: #fef3c7; }
.pet-action-item--danger { color: var(--clr-danger-ink); }
.pet-action-item--danger:hover { background: var(--clr-danger-soft); }
.pet-action-item--success { color: #065f46; }
.pet-action-item--success:hover { background: #d1fae5; }

.pet-action-divider {
  height: 1px;
  background: var(--outline);
  margin: 4px 0;
}

.modal-close {
  background: rgba(0,0,0,.55);
  border: none;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transform-origin: center center;
  transition: background .2s, transform .2s;
}

.modal-close svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.modal-close:hover {
  background: rgba(0,0,0,.8);
  transform: rotate(90deg);
}

.modal-body {
  padding: 4px 26px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 4px 26px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--on-surface);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .28s var(--ease-out-expo);
  max-width: 360px;
  min-width: 250px;
}

.toast.toast-success {
  background: var(--clr-success-dark);
  border-left: 4px solid var(--clr-primary);
}

.toast.toast-error {
  background: var(--clr-danger-dark);
  border-left: 4px solid var(--clr-danger);
}

.toast.toast-info {
  background: var(--clr-info-dark);
  border-left: 4px solid var(--clr-info);
}

.toast.toast-out {
  animation: toast-out .22s ease forwards;
}

@keyframes toast-in {
  from {
    transform: translateX(110%);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes toast-out {
  to {
    transform: translateX(110%);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOSPITALIZATION REMINDER CARD
   ═══════════════════════════════════════════════════════════════════════════ */
.hosp-reminder-card {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1900;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--clr-danger);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  max-width: 310px;
  min-width: 260px;
  animation: hosp-card-in .3s var(--ease-out-expo);
}

.hosp-reminder-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.hosp-reminder-card-icon {
  flex-shrink: 0;
  color: var(--clr-warning);
  margin-top: 1px;
}

.hosp-reminder-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 2px;
}

.hosp-reminder-card-sub {
  font-size: 12px;
  color: var(--on-surface-subtle);
}

.hosp-reminder-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.hosp-reminder-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.hosp-reminder-progress-bar {
  height: 100%;
  background: var(--clr-danger);
  border-radius: 2px;
  transition: width 1s linear;
}

@keyframes hosp-card-in {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.hosp-card-out {
  animation: hosp-card-out .22s ease forwards !important;
}

@keyframes hosp-card-out {
  to { transform: translateX(110%); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════════════════════════════ */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .55s linear infinite;
  flex-shrink: 0;
}

.spinner-dark {
  border-color: rgba(19, 30, 42, .15);
  border-top-color: var(--clr-primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dot-loader { display:flex; align-items:flex-end; gap:10px; height:40px; }
.dot-loader-dot {
  width:13px; height:13px; border-radius:50%;
  animation: dot-bounce 1s ease-in-out infinite;
  opacity:.55;
}
@keyframes dot-bounce {
  0%,100% { transform:translateY(0);     opacity:.55; }
  40%,60%  { transform:translateY(-22px); opacity:1;   }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .55;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes login-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── Page & content entrance ─────────────────────────────────────────────── */
.page-content.page-entering {
  animation: page-enter 300ms var(--ease-out-quart) both;
}

/* Stat cards: fade in together when data loads */
.stat-card {
  animation: card-enter 300ms var(--ease-out-quart) both;
}

/* ── Login card entrance ─────────────────────────────────────────────────── */
.login-card {
  animation: login-enter 500ms var(--ease-out-expo);
}

/* ── Modal overlay entrance ──────────────────────────────────────────────── */
.modal-overlay:not(.hidden) {
  animation: overlay-in 220ms ease-out;
}

/* ── Empty state icon float ──────────────────────────────────────────────── */
.empty-state .empty-icon {
  animation: float 3s ease-in-out infinite;
}

/* ── Button press micro-feedback ─────────────────────────────────────────── */
.btn:active:not(:disabled) {
  transform: scale(0.96) !important;
  transition-duration: 80ms !important;
}

/* ── prefers-reduced-motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════════════════════════════════ */
/* Inline filter selects (search bars, section headers) */
.select-filter {
  padding: 7px 36px 7px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  outline: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2324d46e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 11px;
}

.select-filter:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(36, 212, 110, 0.22), var(--shadow-xs);
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 14px;
  background: var(--surface-highest);
  border: none;
  outline: none;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  color: var(--on-surface);
  min-width: 200px;
  transition: background .15s, box-shadow .15s;
  font-family: var(--font-body);
}

.search-input:focus {
  background: var(--surface-lowest);
  box-shadow: 0 0 0 2px rgba(36, 212, 110, 0.30), var(--shadow-xs);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PET CARDS — avatar cluster cutout
   ═══════════════════════════════════════════════════════════════════════════ */
.pets-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.pet-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}

.pet-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.pet-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.pet-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.pet-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
  color: var(--on-surface);
}

.pet-breed {
  font-size: 12.5px;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

.pet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.pet-owner {
  font-size: 12.5px;
  color: var(--on-surface-mid);
  margin-top: 10px;
  display: block;
  padding-top: 10px;
  box-shadow: inset 0 1px 0 var(--outline-variant);
}

/* ── Tag list (patologías, alergias) ─────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.pathology-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--clr-accent-soft);
  color: var(--clr-accent-ink);
  padding: 3px 6px 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 500;
}
.pathology-tag .tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-size: 16px;
  color: inherit;
  opacity: 0.55;
  display: flex;
  align-items: center;
}
.pathology-tag .tag-remove:hover { opacity: 1; }

.allergy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.10);
  color: var(--clr-warning-text);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════════════════════════════ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface-low);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--outline-variant);
  border-top: 1px solid var(--outline-variant);
}

.cal-day-name {
  padding: 10px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-low);
}

.cal-day {
  background: var(--surface-lowest);
  min-height: 60px;
  padding: 7px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cal-day:hover {
  background: var(--surface-low);
}

.cal-day.today {
  background: var(--clr-accent-soft);
}

.cal-day.today .cal-day-num {
  background: var(--clr-primary);
  color: #fff;
  font-weight: 700;
}

.cal-day.other-month {
  color: var(--on-surface-subtle);
  background: var(--surface-low);
}

.cal-day.selected {
  box-shadow: inset 0 0 0 2px rgba(36, 212, 110, 0.40);
}

.cal-day.selected:not(.today) .cal-day-num {
  background: var(--clr-accent-soft);
  color: var(--clr-accent-ink);
}

.cal-day--past {
  opacity: 0.8;
  cursor: default;
}
.cal-day--past:hover {
  background: var(--surface);
}
.cal-day--past .cal-day-num {
  color: var(--on-surface-subtle);
}

.cal-day--holiday {
  background: #ffedd5;
}
.cal-day--holiday .cal-day-num {
  color: #9a3412;
  font-weight: 700;
}
.cal-day--holiday:hover {
  background: #fed7aa;
}

.cal-day-num {
  font-family: var(--font-display);
  font-weight: 600;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-bottom: 3px;
  flex-shrink: 0;
}

.cal-day-badge {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  border-radius: 4px;
  padding: 2px 4px;
  margin: auto 0;
  line-height: 1.4;
  width: 100%;
}

.cal-day-badge--past {
  background: var(--surface-high);
  color: var(--on-surface-variant);
}

.cal-day-badge--open {
  background: #dcfce7;
  color: #166534;
}

.cal-day-badge--tight {
  background: #fef3c7;
  color: #92400e;
}

.cal-day-badge--full {
  background: #fee2e2;
  color: #991b1b;
}

.appt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.appt-item {
  background: var(--surface-low);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: box-shadow .15s;
}

.appt-item:hover {
  box-shadow: var(--shadow-sm);
}

.appt-time {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  color: var(--clr-primary);
  min-width: 48px;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.appt-details {
  flex: 1;
  min-width: 0;
}

.appt-pet {
  font-weight: 600;
  font-size: 13.5px;
}

.appt-reason {
  font-size: 12.5px;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

/* ── Day timeline ────────────────────────────────────────────────────────── */
.day-timeline {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100%;
}

.tslot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  min-height: 36px;
  transition: background .12s;
  cursor: pointer;
  box-shadow: inset 0 -1px 0 rgba(78, 96, 115, 0.06);
}

.tslot:last-child {
  box-shadow: none;
}

.tslot-time {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--on-surface-subtle);
  min-width: 40px;
  flex-shrink: 0;
}

.tslot--booked {
  background: var(--clr-accent-soft);
  border-left: 3px solid var(--clr-primary);
  padding: 24px 16px 24px 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  box-shadow: none;
}

.tslot--booked .tslot-time {
  color: var(--clr-primary);
  font-family: var(--font-mono);
}

.tslot--free:hover {
  background: var(--surface-low);
}

.tslot-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tslot-pet {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tslot-reason {
  font-size: 11.5px;
  color: var(--on-surface-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tslot-avail {
  font-size: 12px;
  color: var(--on-surface-subtle);
  flex: 1;
}

.tslot-badge {
  flex-shrink: 0;
}

.tslot-plus {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  line-height: 24px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
}

.tslot--free:hover .tslot-plus {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOSPITALIZATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.hosp-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hosp-cage {
  background: var(--on-surface);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  font-family: var(--font-display);
}

/* Condition text colors */
.condition-mejoria {
  color: var(--clr-success-text);
  font-weight: 700;
}

.condition-estable {
  color: var(--clr-info-text);
  font-weight: 700;
}

.condition-empeoramiento {
  color: var(--clr-warning-text);
  font-weight: 700;
}

.condition-grave {
  color: var(--clr-danger-text);
  font-weight: 700;
}

/* Timeline */
.update-timeline {
  border-left: 2px solid var(--outline-variant);
  padding-left: 22px;
  margin-left: 7px;
}

.update-item {
  position: relative;
  padding-bottom: 22px;
}

.update-item:last-child {
  padding-bottom: 0;
}

.update-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid var(--surface-lowest);
  position: absolute;
  left: -29px;
  top: 3px;
  box-shadow: 0 0 0 2px var(--outline-variant);
}

.dot-mejoria {
  background: var(--clr-success);
  box-shadow: var(--glow-mejoria);
}

.dot-estable {
  background: var(--clr-info);
  box-shadow: var(--glow-estable);
}

.dot-empeoramiento {
  background: var(--clr-warning);
  box-shadow: var(--glow-empeoramiento);
}

.dot-grave {
  background: var(--clr-danger);
  box-shadow: var(--glow-grave);
}

.update-date {
  font-size: 12px;
  color: var(--on-surface-subtle);
  font-family: var(--font-display);
}

.update-desc {
  font-size: 13.5px;
  color: var(--on-surface-mid);
  margin-top: 3px;
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DETAIL PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  position: relative;
}

.avatar-edit-btn {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s;
  z-index: 10;
}

.avatar-edit-btn:hover {
  transform: scale(1.1);
}

.detail-info h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--on-surface);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
  font-size: 13.5px;
}

.info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}

.info-value {
  font-weight: 500;
  color: var(--on-surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.notif-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.notif-total-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: middle;
  font-family: var(--font-display);
}

.notif-tabs-bar {
  display: flex;
  gap: 2px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.notif-tab:hover {
  color: var(--on-surface);
}

.notif-tab-active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
  font-weight: 600;
}

.notif-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  font-family: var(--font-display);
}

.notif-tab-badge-active {
  background: var(--clr-primary);
  color: #fff;
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
  position: relative;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--surface-variant);
}

.notif-unread {
  background: color-mix(in srgb, var(--clr-primary) 5%, var(--surface));
}

.notif-unread:hover {
  background: color-mix(in srgb, var(--clr-primary) 10%, var(--surface));
}

.notif-unread-indicator {
  width: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clr-primary);
  flex-shrink: 0;
}

.notif-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  opacity: 0.9;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-unread .notif-title {
  font-weight: 700;
}

.notif-sub {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-preview {
  font-size: 12.5px;
  color: var(--on-surface-variant);
  margin-top: 3px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.notif-time {
  font-size: 12px;
  color: var(--on-surface-subtle);
  white-space: nowrap;
  font-family: var(--font-display);
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION DETAIL MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.notif-detail {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.notif-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 16px;
  background: color-mix(in srgb, var(--clr-primary) 6%, var(--surface));
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin: -4px -4px 0;
}

.notif-detail-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.notif-detail-header-text {
  flex: 1;
  min-width: 0;
}

.notif-detail-subject {
  font-size: 15px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.3;
  word-break: break-word;
}

.notif-detail-time {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-top: 4px;
  font-family: var(--font-display);
}

.notif-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--on-surface-variant);
}

.notif-detail-meta-item strong {
  color: var(--on-surface);
  font-weight: 600;
}

.notif-detail-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-detail-section:last-child {
  border-bottom: none;
}

.notif-detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-surface-subtle);
  margin-bottom: 8px;
}

.notif-detail-message {
  font-size: 13.5px;
  color: var(--on-surface);
  line-height: 1.65;
  padding: 14px 16px;
  background: var(--surface-lowest);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--clr-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.notif-detail-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notif-detail-status-time {
  font-size: 12px;
  color: var(--on-surface-variant);
  font-family: var(--font-display);
}

.notif-detail-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--clr-danger-soft);
  border: 1px solid color-mix(in srgb, var(--clr-danger) 25%, transparent);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--clr-danger-text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.notif-detail-image img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-highest);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--on-surface-subtle);
}

.empty-state .empty-icon {
  font-size: 44px;
  margin-bottom: 14px;
  opacity: .7;
}

.empty-state h3 {
  font-size: 15px;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
  font-weight: 600;
}

.empty-state p {
  font-size: 13.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hide page-title indicator — page context is clear from sidebar + section headers */
.page-title {
  display: none;
}

/* On desktop, the topbar serves no purpose (hamburger is hidden, title is hidden) */
@media (min-width: 769px) {
  .topbar {
    display: none;
  }
}

/* ── Tablet (≤ 960px) ────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Mobile (≤ 768px) ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --topbar-h: 60px;
  }

  /* Sidebar: off-canvas */
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .sidebar-close {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    overflow-x: hidden;
  }

  .menu-toggle {
    display: flex;
  }

  /* Topbar: green background, white elements */
  .topbar {
    padding: 0 16px;
    background: var(--clr-primary);
    border-bottom: none;
    color: #fff;
  }

  .topbar * {
    color: #fff;
  }

  .page-title {
    display: flex;
    font-size: 1rem;
  }

  .topbar-sep {
    opacity: 0.6;
  }

  .topbar-avatar {
    display: flex;
  }

  /* Content area */
  .page-content {
    padding: 16px 14px;
  }

  /* Dashboard grid: single column, items contained */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-grid>* {
    min-width: 0;
  }

  /* Stats: 3 cols on tablet→mobile transition, then 2 below */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 18px 14px;
  }

  .stat-value {
    font-size: 2rem;
  }

  /* Appointments calendar: stack at ≤768 */
  .appt-cal-grid {
    grid-template-columns: 1fr;
  }

  /* Calendar cells shrink */
  .cal-day {
    min-height: 48px;
  }

  .cal-day-badge {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* Forms */
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* iOS Safari: font-size < 16px triggers auto-zoom on input focus */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Section header: keep in row, wrap naturally */
  .section-header {
    gap: 10px;
  }

  /* Toast: full-width strip, above iPhone gesture bar */
  .toast-container {
    right: 14px;
    left: 14px;
    bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  }

  .toast {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  /* Touch targets: 44px minimum for inputs, 40px for buttons */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="tel"],
  select {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .btn {
    min-height: 40px;
  }


  /* Modals: taller on mobile */
  .modal-container {
    max-height: 95vh;
  }

  /* Detail info-grid: single column */
  .info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Pet grid: single column */
  .pet-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Login: mobile layout with background carousel ────────────────────────── */
@media (max-width: 768px) {
  .login-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .login-hero {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    padding: 0;
  }

  /* Hide hero background photos on mobile per user request */
  .login-hero-bg {
    display: none !important;
  }

  /* Hide hero text content on mobile to focus on the card */
  .login-hero-logo,
  .login-hero-body,
  .login-hero-footer {
    display: none !important;
  }

  .login-panel {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: transparent;
    padding: 0;
    justify-content: center;
    min-width: 0;
  }

  .login-card {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 40px 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.4);
    width: 100%;
    animation: login-enter 0.6s var(--ease-out-expo) both;
  }
}

/* ── Small mobile (≤ 480px) ──────────────────────────────────────────────── */
@media (max-width: 480px) {

  /* Stats: 2 compact cols */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    padding: 14px 12px;
  }

  /* Card padding tighter on small screens */
  .card-body {
    padding: 14px 16px 18px;
  }

  .card-header {
    padding: 14px 16px 10px;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .stat-icon {
    font-size: 22px;
    margin-bottom: 8px;
  }

  /* Calendar: minimal cells */
  .cal-day {
    min-height: 44px;
    padding: 4px;
  }

  .cal-day-num {
    font-size: 11px;
  }

  .cal-day-name {
    padding: 8px 2px;
    font-size: 10px;
  }

  /* Modal: bottom sheet */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-container {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 93vh;
    max-height: 93dvh;
  }

  .modal-footer {
    flex-direction: column;
    padding: 14px 20px max(28px, calc(env(safe-area-inset-bottom, 0px) + 14px));
  }

  .modal-footer .btn {
    justify-content: center;
  }

  .pet-detail-footer-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  /* Modal close: 44×44 touch target */
  .modal-close {
    width: 44px;
    height: 44px;
  }

  /* Login card: tighter */
  .login-card {
    padding: 32px 22px;
  }

  .login-logo h1 {
    font-size: 1.8rem;
  }

  /* Topbar title hidden to save space */
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  /* Page content even tighter */
  .page-content {
    padding: 14px 12px;
  }

  /* Search bar: stack and stretch on very small screens */
  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }

  .select-filter {
    width: 100%;
  }

  /* Section header: stack vertically */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header .btn,
  .section-header>div {
    align-self: stretch;
  }

  .section-header .btn {
    justify-content: center;
  }

  /* Pets toolbar: search full width, then species + button below */
  .pets-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .pets-toolbar .search-bar {
    width: 100%;
  }

  .pets-actions {
    width: 100%;
  }

  /* Pets controls: stack search + button to full width */
  .pets-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pets-controls .search-bar {
    width: 100%;
  }

  .pets-controls .btn {
    width: 100%;
    justify-content: center;
  }

  /* Appt item: compact */
  .appt-item {
    padding: 12px;
    gap: 10px;
  }

  .appt-time {
    font-size: 13px;
    min-width: 42px;
  }

  /* Card padding */
  .card-header {
    padding: 16px 18px 12px;
  }

  .card-body {
    padding: 14px 18px 18px;
  }

  .card-header+.card-body {
    padding-top: 4px;
  }
}

/* ───────────────────────────────────────────────────────────────
   FORM VALIDATION
   ─────────────────────────────────────────────────────────────── */
.form-group input.is-invalid,
.form-group select.is-invalid,
.form-group textarea.is-invalid {
  box-shadow: 0 0 0 2px rgba(var(--clr-danger-rgb), 0.2) !important;
  border: 1.5px solid var(--clr-danger) !important;
  background-color: var(--clr-danger-soft) !important;
}

.error-hint {
  color: var(--clr-danger);
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: modal-in 0.2s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.2s ease-in-out 0s 2;
}

.pet-card-hospitalized {
  border: 1.5px solid rgba(var(--clr-danger-rgb), 0.5);
  box-shadow: 0 0 0 1px rgba(var(--clr-danger-rgb), 0.15), var(--shadow-sm);
}

/* Skeleton loader */
.sk {
  background: var(--outline-variant);
  border-radius: 6px;
  animation: pulse 1.6s ease-in-out infinite;
}
.sk-circle { border-radius: 50%; }

/* Rainbow Bridge Styles */
.pet-card-deceased {
  border-color: #6366f1 !important;
  opacity: 0.85;
  background: linear-gradient(to right, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
}

.pet-card-deceased .pet-avatar {
  background: linear-gradient(135deg, #6366f1, #a855f7) !important;
  color: white !important;
}

.deceased-header {
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(to right, #6366f1, #a855f7, #ec4899, #f97316, #eab308) 1;
}

.pet-card-deceased .badge-primary,
.deceased-header .badge-primary {
  background: linear-gradient(135deg, #6366f1, #a855f7) !important;
  color: white !important;
}

/* ── Appointment Slot Picker ──────────────────────────────────────────────── */
.appt-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}

.appt-slots-hint {
  font-size: 13px;
  color: var(--on-surface-subtle);
  padding: 10px 0 4px;
}

.appt-slots-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--on-surface-subtle);
  padding: 10px 0 4px;
}

.appt-slot {
  padding: 6px 11px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  background: var(--surface-lowest);
  color: var(--on-surface);
  line-height: 1;
}

.appt-slot:hover:not(:disabled) {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  background: var(--clr-primary-soft);
}

.appt-slot--selected {
  background: var(--clr-primary) !important;
  border-color: var(--clr-primary) !important;
  color: #fff !important;
}

.appt-slot--booked {
  background: var(--surface-high);
  border-color: var(--surface-high);
  color: var(--on-surface);
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: .55;
}

.appt-slot--past {
  background: var(--surface-high);
  border-color: var(--surface-high);
  color: var(--on-surface);
  cursor: not-allowed;
  opacity: .4;
}

.appt-slot--pet-conflict {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  cursor: not-allowed;
}

.appt-slot--pet-same-vet {
  text-decoration: line-through;
  opacity: 0.75;
}

/* ── Custom Select Component ──────────────────────────────────────────────── */
.cs-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.cs-wrap--filter {
  display: inline-flex;
  width: auto;
  align-items: center;
}

.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--on-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
  white-space: nowrap;
}

.cs-wrap--filter .cs-trigger {
  border-radius: var(--radius-md);
  padding: 7px 12px 7px 14px;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
}

.cs-trigger:focus,
.cs-wrap--open .cs-trigger {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(36, 212, 110, 0.22), var(--shadow-xs);
}

.cs-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-arrow {
  flex-shrink: 0;
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  transition: transform .2s;
}

.cs-wrap--open .cs-arrow {
  transform: rotate(180deg);
}

.cs-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  padding: 4px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
}

.cs-wrap--open .cs-dropdown,
.cs-dropdown--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cs-option {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 13.5px;
  color: var(--on-surface);
  cursor: pointer;
  transition: background .1s;
  white-space: nowrap;
}

.cs-option:hover {
  background: var(--clr-primary-soft);
  color: var(--clr-accent-ink);
}

.cs-option--selected {
  background: var(--clr-primary-soft);
  color: var(--clr-accent-ink);
  font-weight: 600;
}

.cs-wrap.is-invalid .cs-trigger {
  border-color: var(--clr-danger) !important;
  box-shadow: 0 0 0 2px rgba(var(--clr-danger-rgb), 0.2) !important;
}

/* Toggle Buttons Styles */
.btn-toggle-pet {
  padding-left: 16px !important;
  padding-right: 16px !important;
  transition: all 0.2s ease;
}

.btn-toggle-pet.btn-primary {
  box-shadow: 0 2px 4px var(--clr-primary-glow);
}

/* ───────────────────────────────────────────────────────────────
   STAFF AVATAR — tabla de trabajadores
   ─────────────────────────────────────────────────────────────── */
.staff-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  position: relative;
  flex-shrink: 0;
  transition: transform .2s;
  cursor: pointer;
}

.staff-avatar-sm:hover {
  border-color: var(--clr-primary);
  transform: scale(1.08);
}

/* Estado sin foto: icono centrado */
.staff-avatar-sm--empty {
  background: var(--surface-low, #f3f4f6);
  border: 1.5px dashed var(--on-surface-subtle, #9ca3af);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-subtle, #9ca3af);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.page-profile {
  padding: 20px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.profile-card {
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.profile-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 20px;
}

.profile-photo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.profile-photo {
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--border);
  outline: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--on-surface);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(36, 212, 110, 0.22), var(--shadow-xs);
}

select.form-control {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8481' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

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

/* ── Mis Facturas: tabla en escritorio, tarjetas en móvil ───────────────────── */
.mis-fact-cards {
  display: none;
}

.mis-fact-card {
  width: 100%;
  text-align: left;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: background .12s;
}

.mis-fact-card:active {
  background: var(--surface-low);
}

.mis-fact-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mis-fact-num {
  font-weight: 700;
  font-size: 14px;
}

.mis-fact-meta {
  font-size: 13px;
  color: var(--on-surface-variant);
}

.mis-fact-total {
  font-size: 15px;
  white-space: nowrap;
}

/* Líneas de factura: tarjetas en móvil */
.inv-lines-cards {
  display: none;
}

.inv-line-card {
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-line-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inv-line-desc {
  font-weight: 600;
  font-size: 13px;
}

.inv-line-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inv-line-meta {
  font-size: 12px;
  color: var(--on-surface-variant);
}

.inv-line-total {
  font-size: 14px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .mis-fact-table {
    display: none;
  }
  .mis-fact-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .inv-lines-table {
    display: none;
  }
  .inv-lines-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }
}

/* ── Chat ──────────────────────────────────────────────────────────────────── */
.chat-wrap {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 48px);
  min-height: 400px;
  background: var(--surface-low);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.chat-wrap--staff .chat-sidebar {
  width: 280px;
  min-width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-sidebar-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--on-surface);
}

#chat-conv-list {
  overflow-y: auto;
  flex: 1;
}

.chat-new-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--primary-container, #c8e6c9);
  color: var(--on-primary-container, #1b5e20);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.chat-new-btn:hover {
  background: var(--primary, #4caf50);
  color: #fff;
}

.chat-filter-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-filter-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
}

.chat-filter-input {
  width: 100%;
  padding: 7px 28px 7px 10px;
  padding-left: 42px !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  background: var(--surface);
  color: var(--on-surface);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.chat-filter-input:focus {
  border-color: var(--primary);
}

.chat-filter-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  line-height: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-filter-clear:hover {
  color: var(--on-surface);
  background: var(--hover-overlay, rgba(0,0,0,0.06));
}

.chat-search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  background: var(--surface);
  color: var(--on-surface);
  box-sizing: border-box;
  outline: none;
}

.chat-search-input:focus {
  border-color: var(--primary);
}

.chat-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm, 6px) var(--radius-sm, 6px);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.chat-search-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.chat-search-item:last-child {
  border-bottom: none;
}

.chat-search-item:hover {
  background: var(--surface-variant, #f0f0f0);
}

.chat-search-item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface);
}

.chat-search-item-sub {
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: 1px;
}

.chat-search-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--on-surface-variant);
}

.chat-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle, var(--border));
  transition: background 0.12s;
}

.chat-conv-item:hover {
  background: var(--surface-variant);
}

.chat-conv-item.active {
  background: var(--primary-container, #e8f5e9);
}

.chat-conv-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.chat-conv-avatar--photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.chat-conv-info {
  flex: 1;
  min-width: 0;
}

.chat-conv-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conv-preview {
  font-size: 12px;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-conv-time {
  font-size: 11px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

.chat-conv-badge {
  background: var(--clr-danger);
  color: #fff;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chat-window--full {
  flex: 1;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  gap: 12px;
}

.chat-placeholder-icon {
  font-size: 48px;
  opacity: 0.4;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.chat-header-icon {
  font-size: 18px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 8px 10px;
  color: var(--on-surface-variant);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-day-divider::before,
.chat-day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outline-variant, #e0e0e0);
}

.chat-empty {
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 13px;
  padding: 32px 16px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-bubble-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  max-width: 75%;
  margin-bottom: 6px;
}

.chat-bubble-wrap--right {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble-wrap--left {
  align-self: flex-start;
}

.chat-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-msg-avatar--mine {
  background: var(--primary-container, #c8e6c9);
  color: var(--on-primary-container, #1b5e20);
}

.chat-msg-avatar--theirs {
  background: var(--surface-variant, #e8e8e8);
  color: var(--on-surface-variant, #555);
}

.chat-msg-avatar--photo {
  background-size: cover;
  background-position: center;
  background-color: var(--surface-variant, #e8e8e8);
}

.chat-msg-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.chat-bubble-wrap--right .chat-msg-content {
  align-items: flex-end;
}

.chat-sender-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin-bottom: 3px;
  padding: 0 4px;
}

.chat-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: default;
}

.chat-bubble--mine {
  border-bottom-right-radius: 4px;
}

.chat-bubble--theirs {
  border-bottom-left-radius: 4px;
}

.chat-bubble--cliente-msg {
  background: var(--surface-high, #F0F2F0);
  color: var(--on-surface);
}

.chat-bubble--clinica-msg {
  background: var(--clr-accent-soft, #E4F1EE);
  color: var(--clr-accent-ink, #0a5c2e);
}

.chat-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
  padding: 0 4px;
}

.chat-time {
  font-size: 11px;
  color: var(--on-surface-variant);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  resize: none;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface-variant, #f5f5f5);
  color: var(--on-surface);
  outline: none;
  line-height: 1.4;
  height: 38px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}

.chat-send-btn:hover {
  opacity: 0.88;
}

.chat-send-btn:active {
  transform: scale(0.93);
}

.chat-send-btn svg {
  display: block;
  transform: translate(-1px, 1px);
}

@media (max-width: 640px) {
  .chat-wrap--staff {
    flex-direction: column;
  }

  .chat-wrap--staff .chat-sidebar {
    width: 100%;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
