/* VetCloud — Custom styles (Tailwind overrides + custom components) */

:root {
  --sidebar-width: 220px;
  --topbar-height: 60px;
  --sidebar-bg: #1e293b;
  --sidebar-active: var(--brand-primary);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --primary: var(--brand-primary);
  --primary-hover: color-mix(in srgb, var(--brand-primary) 82%, black);
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --content-bg: #f1f5f9;
}

/* Select2 clear button visibility */
.select2-container--default .select2-selection--single .select2-selection__clear {
  display: block !important;
}

/* ── Sidebar ────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

#sidebar .brand {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

#sidebar .brand-name {
  color: #f1f5f9;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar .brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 0.5rem;
  object-fit: contain;
  background: transparent;
}

#sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#sidebar .nav-section-label {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #475569;
  text-transform: uppercase;
}

#sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 1rem;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 6px;
  margin: 0 0.5rem;
  transition: background 0.15s, color 0.15s;
}

#sidebar .nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--sidebar-text-hover);
}

#sidebar .nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

#sidebar .nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Topbar ─────────────────────────────────── */
#topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ── Main content ───────────────────────────── */
#main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--content-bg);
  display: flex;
  flex-direction: column;
}

#main-content {
  flex: 1;
  padding: 1.5rem;
}

/* ── Cards ──────────────────────────────────── */
.vc-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  padding: 1.25rem;
}

.kpi-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Dashboard menu ────────────────────────── */
.dashboard-menu {
  max-width: 1440px;
  margin: 0 auto;
}

.dashboard-menu-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  overflow: hidden;
  padding: 2rem 2.25rem;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: linear-gradient(115deg, #eff6ff 0%, #ffffff 62%, #f0fdf4 100%);
  box-shadow: 0 8px 24px rgba(30, 64, 175, 0.07);
}

.dashboard-menu-hero::after {
  content: "";
  position: absolute;
  right: -3.5rem;
  bottom: -5rem;
  width: 13rem;
  height: 13rem;
  border: 2rem solid rgba(37, 99, 235, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.dashboard-menu-eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 0.35rem;
  color: var(--brand-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-menu-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #1e293b;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 750;
  letter-spacing: -0.035em;
}

.dashboard-menu-subtitle {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 0.55rem 0 0;
  color: #64748b;
  font-size: 0.95rem;
}

.dashboard-menu-date {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.dashboard-menu-date svg {
  width: 17px;
  height: 17px;
  color: var(--brand-primary);
}

.dashboard-menu-sections {
  display: grid;
  gap: 1.75rem;
  margin-top: 1.75rem;
}

.dashboard-menu-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.dashboard-menu-section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard-menu-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
}

.dashboard-menu-section-icon svg {
  width: 21px;
  height: 21px;
}

.dashboard-menu-section-icon--blue { background: #dbeafe; color: var(--brand-primary); }
.dashboard-menu-section-icon--teal { background: #ccfbf1; color: #0f766e; }
.dashboard-menu-section-icon--purple { background: #ede9fe; color: #7c3aed; }

.dashboard-menu-section-title {
  margin: 0;
  color: #1e293b;
  font-size: 1.05rem;
  font-weight: 700;
}

.dashboard-menu-section-description {
  margin: 0.15rem 0 0;
  color: #64748b;
  font-size: 0.8rem;
}

.dashboard-menu-section-count {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.dashboard-menu-card {
  --card-accent: var(--brand-primary);
  --card-tint: #eff6ff;
  --card-border: #bfdbfe;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.85rem;
  min-height: 142px;
  padding: 1.1rem;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-top: 4px solid var(--card-accent);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
  color: #1e293b;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-menu-card::after {
  position: absolute;
  right: -2rem;
  bottom: -3.5rem;
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  background: var(--card-tint);
  content: "";
  pointer-events: none;
}

.dashboard-menu-card:hover {
  border-color: var(--card-accent);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
  color: #1e293b;
  transform: translateY(-3px);
}

.dashboard-menu-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--card-accent) 28%, transparent);
  outline-offset: 2px;
}

.dashboard-menu-card-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card-tint);
  color: var(--card-accent);
}

.dashboard-menu-card-icon svg {
  width: 22px;
  height: 22px;
}

.dashboard-menu-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.35rem;
}

.dashboard-menu-card-title {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.25;
}

.dashboard-menu-card-description {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dashboard-menu-card-action {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--card-tint);
  color: var(--card-accent);
}

.dashboard-menu-card-action svg {
  width: 16px;
  height: 16px;
}

.dashboard-menu-card.is-locked {
  cursor: not-allowed;
  opacity: 0.58;
}

.dashboard-menu-card.is-locked:hover {
  border-color: var(--card-border);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
  transform: none;
}

.dashboard-menu-card--blue { --card-accent: var(--brand-primary); --card-tint: #eff6ff; --card-border: #bfdbfe; }
.dashboard-menu-card--violet { --card-accent: #7c3aed; --card-tint: #f5f3ff; --card-border: #ddd6fe; }
.dashboard-menu-card--emerald { --card-accent: #059669; --card-tint: #ecfdf5; --card-border: #a7f3d0; }
.dashboard-menu-card--amber { --card-accent: #d97706; --card-tint: #fffbeb; --card-border: #fde68a; }
.dashboard-menu-card--sky { --card-accent: #0284c7; --card-tint: #f0f9ff; --card-border: #bae6fd; }
.dashboard-menu-card--pink { --card-accent: #db2777; --card-tint: #fdf2f8; --card-border: #fbcfe8; }
.dashboard-menu-card--cyan { --card-accent: #0891b2; --card-tint: #ecfeff; --card-border: #a5f3fc; }
.dashboard-menu-card--rose { --card-accent: #e11d48; --card-tint: #fff1f2; --card-border: #fecdd3; }
.dashboard-menu-card--indigo { --card-accent: #4f46e5; --card-tint: #eef2ff; --card-border: #c7d2fe; }
.dashboard-menu-card--green { --card-accent: #16a34a; --card-tint: #f0fdf4; --card-border: #bbf7d0; }
.dashboard-menu-card--orange { --card-accent: #ea580c; --card-tint: #fff7ed; --card-border: #fed7aa; }
.dashboard-menu-card--purple { --card-accent: #9333ea; --card-tint: #faf5ff; --card-border: #e9d5ff; }

/* ── Tables ─────────────────────────────────── */
.vc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.vc-table th {
  background: #f8fafc;
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
}

.vc-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.vc-table tr:last-child td {
  border-bottom: none;
}

.vc-table tr:hover td {
  background: #f8fafc;
}

/* ── Audit log ──────────────────────────────── */
.audit-filters {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(14rem, 20rem) auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.audit-filters .btn {
  min-height: 2.35rem;
  justify-content: center;
}

.audit-table-card {
  overflow: hidden;
  padding: 0;
}

.audit-table-scroll {
  overflow-x: auto;
}

.audit-table {
  min-width: 58rem;
}

.audit-col-date { width: 10.5rem; }
.audit-col-user { width: 12rem; }
.audit-col-action { width: 8rem; }
.audit-col-object { width: 22%; }
.audit-col-changes { width: auto; }
.audit-col-ip { width: 8.5rem; }

.audit-table td {
  vertical-align: top;
}

.audit-user,
.audit-object-name,
.audit-changes {
  overflow-wrap: anywhere;
}

.audit-object-type,
.audit-object-name {
  display: block;
}

.audit-object-type {
  margin-bottom: 0.2rem;
  color: #94a3b8;
  font-size: 0.75rem;
}

.audit-changes {
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.55;
}

.audit-changes strong {
  color: #1e293b;
}

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

  .audit-filters .btn {
    width: 100%;
  }
}

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

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

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #15803d; color: #fff; }

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.375rem;
  background: transparent;
  color: #64748b;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: #f1f5f9; color: #1e293b; }
.btn-icon.danger:hover { background: #fee2e2; color: var(--danger); }

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: #dbeafe; color: color-mix(in srgb, var(--brand-primary) 82%, black); }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-cyan   { background: #cffafe; color: #0e7490; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ── Forms ──────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.3rem;
}

.form-control {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control.error {
  border-color: var(--danger);
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 0.2rem;
}

.form-group {
  margin-bottom: 1rem;
}

/* ── Patient photo picker ───────────────────── */
.patient-photo-picker {
  position: relative;
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 7.5rem;
  padding: 1rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc, #fff);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.patient-photo-picker:hover,
.patient-photo-picker:focus-within,
.patient-photo-picker.is-dragover {
  border-color: #60a5fa;
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.patient-photo-picker.is-dragover {
  border-style: solid;
  background: #eff6ff;
}

.patient-photo-preview {
  display: grid;
  width: 5.5rem;
  height: 5.5rem;
  overflow: hidden;
  place-items: center;
  border: 1px solid #dbeafe;
  border-radius: 50%;
  background: #eff6ff;
  color: #60a5fa;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.patient-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patient-photo-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.patient-photo-placeholder svg {
  width: 2.2rem;
  height: 2.2rem;
}

.patient-photo-copy {
  min-width: 0;
}

.patient-photo-copy strong,
.patient-photo-copy p,
.patient-photo-copy small {
  display: block;
}

.patient-photo-copy strong {
  color: #1e293b;
  font-size: 0.9rem;
}

.patient-photo-copy p {
  overflow: hidden;
  margin: 0.15rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-photo-copy small {
  margin-top: 0.2rem;
  color: #94a3b8;
  font-size: 0.7rem;
}

.patient-photo-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.patient-photo-remove {
  border: 0;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
}

.patient-photo-remove:hover {
  color: #991b1b;
  text-decoration: underline;
}

.patient-photo-drop-hint {
  color: #94a3b8;
  font-size: 0.7rem;
  white-space: nowrap;
}

.patient-photo-picker > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .patient-photo-picker {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }

  .patient-photo-preview {
    width: 4.5rem;
    height: 4.5rem;
  }

  .patient-photo-drop-hint {
    display: none;
  }
}

/* ── Modal ──────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modal-in 0.18s ease;
}

.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 1040px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

.modal-body {
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

/* Membership management modal */
.membership-management-modal {
  width: min(1080px, calc(100vw - 1.5rem));
  max-width: none;
}

.membership-management-modal .modal-header {
  padding: 1.5rem 2rem 1.25rem;
}

.membership-management-modal .modal-title {
  font-size: 1.35rem;
}

.membership-management-body {
  padding: 1.75rem 2rem 2rem;
  display: grid;
  gap: 1.5rem;
}

.membership-management-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.membership-management-summary-card {
  min-height: 6rem;
  padding: 1rem 1.25rem;
  border: 1px solid #e8edf4;
  border-radius: .75rem;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.membership-management-summary-card p {
  color: #64748b;
  font-size: .78rem;
  margin: 0 0 .25rem;
}

.membership-management-summary-card strong {
  color: #1e293b;
  font-size: 1.1rem;
  line-height: 1.25;
}

.membership-summary-icon,
.membership-advance-icon {
  width: 3rem;
  height: 3rem;
  flex: 0 0 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.membership-summary-icon svg,
.membership-advance-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 2.25;
}

.membership-summary-icon.is-status {
  color: #059669;
  background: #d1fae5;
}

.membership-summary-icon.is-level {
  color: #0284c7;
  background: #e0f2fe;
}

.membership-summary-icon.is-date {
  color: #7c3aed;
  background: #ede9fe;
}

.membership-management-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.membership-management-actions details,
.membership-management-actions summary {
  width: 100%;
}

.membership-management-actions summary {
  justify-content: center;
  min-height: 3rem;
  gap: .65rem;
}

.membership-management-actions summary svg,
.membership-advance-submit svg {
  width: 1.25rem;
  height: 1.25rem;
}

.membership-management-action-form {
  margin-top: .75rem;
  padding: 1rem;
  border: 1px solid;
  border-radius: .75rem;
  display: grid;
  gap: .75rem;
}

.membership-management-action-form.is-reset {
  border-color: #fde68a;
  background: #fffbeb;
}

.membership-management-action-form.is-cancel {
  border-color: #fecaca;
  background: #fef2f2;
}

.membership-management-payment {
  min-width: 0;
}

.membership-installment-card {
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  background: #fff;
}

.membership-installment-payment-form {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.4fr) auto;
  align-items: end;
  gap: .75rem;
}

.membership-advance-card {
  padding: 1.5rem;
  border: 1px solid #86efac;
  border-radius: .85rem;
  background: #ecfdf5;
}

.membership-advance-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.membership-advance-icon {
  color: #059669;
  background: #d1fae5;
}

.membership-advance-heading h4 {
  font-size: 1.1rem;
}

.membership-advance-form {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: end;
}

.membership-advance-form > .sm\:col-span-2,
.membership-advance-submit {
  grid-column: 1 / -1;
}

.membership-advance-amount {
  grid-column: 1 / -1;
  padding: 1rem 1.25rem;
  border: 1px solid #6ee7b7;
  border-radius: .75rem;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .2rem 1rem;
}

.membership-advance-amount span {
  color: #047857;
  font-size: .8rem;
  font-weight: 600;
}

.membership-advance-amount strong {
  grid-row: span 2;
  color: #065f46;
  font-size: 1.5rem;
}

.membership-advance-amount small {
  color: #64748b;
  font-size: .75rem;
}

.membership-advance-submit {
  justify-self: end;
  min-width: 18rem;
  min-height: 3rem;
  gap: .65rem;
}

@media (max-width: 700px) {
  .membership-management-modal {
    width: calc(100vw - 1rem);
  }

  .membership-management-modal .modal-header,
  .membership-management-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .membership-management-summary,
  .membership-management-actions,
  .membership-advance-form,
  .membership-installment-payment-form {
    grid-template-columns: 1fr;
  }

  .membership-management-summary-card {
    min-height: auto;
  }

  .membership-advance-submit {
    width: 100%;
    min-width: 0;
  }

  .membership-advance-amount {
    grid-template-columns: 1fr;
  }

  .membership-advance-amount strong {
    grid-row: auto;
  }
}

/* ── Page header ────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}

/* ── Search bar ─────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 2.25rem;
}

/* ── Status badges for entities ──────────────── */
.status-scheduled  { background: #dbeafe; color: color-mix(in srgb, var(--brand-primary) 82%, black); }
.status-confirmed  { background: #dcfce7; color: #15803d; }
.status-completed  { background: #d1fae5; color: #065f46; }
.status-cancelled  { background: #fee2e2; color: #b91c1c; }
.status-no_show    { background: #f1f5f9; color: #475569; }

/* ── Pagination ─────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 1rem;
}

.pagination a, .pagination span {
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.85rem;
  color: #475569;
  text-decoration: none;
  border: 1px solid #e2e8f0;
}

.pagination a:hover { background: #f1f5f9; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── FullCalendar custom ─────────────────────── */
.fc .fc-toolbar-title { font-size: 1.1rem !important; font-weight: 700; }
.fc .fc-button-primary { background: var(--primary) !important; border-color: var(--primary) !important; }
.fc .fc-button-primary:hover { background: var(--primary-hover) !important; }
.fc-event { border-radius: 4px !important; font-size: 0.78rem !important; padding: 1px 4px !important; }

/* Highlight slot on hover */
.fc-timegrid-slot-lane:hover {
  background-color: rgba(37, 99, 235, 0.08) !important;
  cursor: pointer;
}

/* ── Utils ──────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

/* Responsive sidebar toggle */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-wrapper { margin-left: 0; }

  .dashboard-menu-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 1.5rem;
  }

  .dashboard-menu-date {
    align-self: flex-start;
  }

  .dashboard-menu-section-header {
    align-items: flex-start;
  }
}

/* ── Select2 integration ────────────────────── */
.select2-container--default .select2-selection--single {
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.95rem;
  color: #374151;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px;
  padding-left: 0.875rem;
  color: #374151;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}
.select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(15,23,42,0.1);
  font-size: 0.9rem;
  z-index: 9999;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--primary);
}
.select2-search--dropdown .select2-search__field {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #94a3b8;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
  margin-right: 8px;
  font-size: 1.1rem;
  line-height: 1;
  color: #94a3b8;
}
.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: #475569;
}
.select2-filter-wrap {
  flex: 1;
  min-width: 160px;
}

/* ── Day-picker pills ───────────────────────── */
.day-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #475569;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.day-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.day-pill--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.day-pill--active:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

/* ── Clinical-file compact layout ───────────────────────────────────── */
.ficha-form-shell {
  padding-bottom: 5.5rem;
}

.ficha-form-shell > .vc-card {
  margin-bottom: 0.85rem !important;
}

.ficha-header-card {
  padding: 1rem 1.15rem;
}

.ficha-header-card .form-label,
.ficha-form-shell .form-label {
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.ficha-form-shell .form-control {
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
}

.ficha-form-shell textarea.form-control {
  min-height: 5.5rem;
  resize: vertical;
}

.ficha-form-shell textarea[name="motivo_consulta"] {
  min-height: 4.25rem;
}

.ficha-form-shell textarea[name="anamnesis"] {
  min-height: 13rem;
}

.ficha-form-shell textarea[name="examen_observaciones"],
.ficha-form-shell textarea[name="diagnostico"] {
  min-height: 7rem;
}

.ficha-header-card .select2-container--default .select2-selection--single {
  height: 2.35rem;
}

.ficha-header-card .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 2.2rem;
}

.ficha-header-card .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 2.25rem;
}

.patient-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid #dbeafe;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.patient-summary-card[hidden] {
  display: none;
}

.patient-summary-copy {
  min-width: 0;
}

.patient-summary-eyebrow {
  margin: 0 0 0.15rem;
  color: var(--brand-primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.patient-summary-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
  margin: 0;
  color: #1e293b;
  font-size: 1rem;
  line-height: 1.35;
}

.patient-summary-separator {
  color: #94a3b8;
  font-weight: 400;
}

.patient-summary-details,
.patient-summary-owner {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
}

.patient-summary-owner {
  margin-top: 0.35rem;
}

.patient-summary-owner span {
  color: #334155;
  font-weight: 500;
}

.patient-summary-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ficha-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  margin: 0 0 0.85rem;
  padding: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #e2e8f0;
  scrollbar-width: none;
}

.ficha-tabs::-webkit-scrollbar {
  display: none;
}

.ficha-tab {
  flex: 0 0 auto;
  min-height: 2.35rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.ficha-tab:hover {
  color: #1e40af;
}

.ficha-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.ficha-tab.is-active {
  border-color: #bfdbfe;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ficha-tab-panel[hidden] {
  display: none !important;
}

.ficha-consulta-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 0.85rem;
  align-items: start;
}

.ficha-history-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.85rem;
}

.ficha-history-card,
.ficha-exam-card,
.ficha-diagnosis-card {
  min-width: 0;
  margin-bottom: 0 !important;
  padding: 1rem;
}

.ficha-history-card > h2,
.ficha-exam-card > h2,
.ficha-diagnosis-card > h2 {
  margin-bottom: 0.7rem;
}

.ficha-vitals-grid,
.ficha-general-grid {
  gap: 0.65rem;
}

#panel-consulta h3 {
  margin-top: 0.15rem;
  margin-bottom: 0.55rem;
  color: #475569;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#panel-consulta .ficha-vitals-grid {
  margin-bottom: 1rem;
}

#panel-consulta details {
  margin-top: 0.85rem;
}

#panel-consulta details dl {
  padding: 0.7rem;
}

#panel-estudios .vc-card,
#panel-tratamientos .vc-card {
  padding: 1rem;
}

#estudios-forms,
#tratamientos-forms {
  gap: 0.65rem;
}

#estudios-forms > .study-row,
#tratamientos-forms > .treatment-row {
  padding: 0.85rem !important;
  background: #fbfdff;
}

#estudios-forms .form-label,
#tratamientos-forms .form-label {
  font-size: 0.75rem;
}

.ficha-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid #93c5fd;
  border-radius: 9999px;
  background: #eff6ff;
  color: var(--brand-primary);
  cursor: help;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.ficha-actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.75rem 0 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -5px 14px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(8px);
}

.ficha-tab-navigation {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 900px) {
  .ficha-consulta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .ficha-form-shell {
    padding-bottom: 5rem;
  }

  .patient-summary-card {
    align-items: stretch;
    flex-direction: column;
  }

  .patient-summary-actions {
    justify-content: stretch;
  }

  .patient-summary-actions .btn {
    flex: 1 1 0;
  }

  .ficha-tabs {
    margin-right: -0.25rem;
  }

  .ficha-vitals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ficha-actions--sticky {
    justify-content: stretch;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .ficha-actions--sticky .btn {
    flex: 1 1 0;
  }
}

/* ── Patient summary and related-data modal ─────────────────────────── */
.ficha-responsible-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.ficha-responsible-bar .form-label {
  margin: 0;
  white-space: nowrap;
}

.ficha-responsible-bar .form-control {
  width: min(100%, 20rem);
}

.patient-summary-card.is-empty {
  align-items: center;
}

.patient-summary-empty {
  min-width: 0;
  width: 100%;
}

.patient-summary-empty[hidden],
.patient-summary-actions[hidden],
#patient-summary-selected[hidden] {
  display: none;
}

.patient-summary-empty-text {
  margin: 0.25rem 0 0.65rem;
  color: #64748b;
  font-size: 0.8rem;
}

.patient-summary-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  max-width: 48rem;
}

.patient-summary-search .select2-container {
  min-width: 0;
}

.ficha-modal[hidden] {
  display: none;
}

.ficha-modal {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.ficha-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.ficha-modal-dialog {
  position: relative;
  display: flex;
  width: min(100%, 62rem);
  max-height: min(90vh, 52rem);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe3ee;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.ficha-modal-header,
.ficha-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 1rem 1.25rem;
}

.ficha-modal-header {
  border-bottom: 1px solid #e2e8f0;
}

.ficha-modal-header h2 {
  margin: 0;
  color: #1e293b;
  font-size: 1.05rem;
  font-weight: 700;
}

.ficha-modal-eyebrow {
  margin: 0 0 0.15rem;
  color: var(--brand-primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ficha-modal-close {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.ficha-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.ficha-modal-body {
  overflow-y: auto;
  padding: 1.25rem;
}

.ficha-modal-section + .ficha-modal-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.ficha-modal-section h3 {
  display: flex;
  align-items: center;
  margin: 0 0 0.85rem;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 700;
}

.ficha-modal-footer {
  justify-content: flex-end;
  gap: 0.65rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ficha-modal-footer [role="alert"] {
  flex: 1 1 auto;
  margin: 0 auto 0 0;
}

.ficha-field-error {
  margin: 0.3rem 0 0;
  color: #dc2626;
  font-size: 0.68rem;
  line-height: 1.3;
}

.ficha-field-error[hidden] {
  display: none;
}

#patient-data-modal .form-control.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

body.ficha-modal-open {
  overflow: hidden;
}

.ficha-consulta-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.85rem;
}

.ficha-date-field {
  width: min(100%, 15rem);
}

.ficha-history-card,
.ficha-exam-card,
.ficha-diagnosis-card {
  padding: 1.15rem !important;
}

.ficha-vaccines-card {
  margin-top: 0.85rem;
  padding: 1.15rem;
}

.ficha-vaccines-card h2 {
  display: flex;
  align-items: center;
  margin: 0;
}

@media (max-width: 767px) {
  .ficha-responsible-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.3rem;
  }

  .ficha-responsible-bar .form-control,
  .ficha-date-field {
    width: 100%;
  }

  .patient-summary-search {
    grid-template-columns: 1fr;
  }

  .patient-summary-search .btn {
    width: 100%;
  }

  .ficha-modal {
    align-items: flex-end;
    padding: 0;
  }

  .ficha-modal-dialog {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 1rem 1rem 0 0;
  }
}

/* ── Clinical-file reference styling ────────────────────────────────── */
.ficha-page-header .ficha-top-cancel {
  display: none;
}

.ficha-form-shell .vc-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.ficha-form-shell .form-control {
  min-height: 2.6rem;
  padding: 0.55rem 0.75rem;
}

.ficha-form-shell textarea[name="anamnesis"] {
  min-height: 14.5rem;
}

.ficha-form-shell textarea[name="examen_observaciones"],
.ficha-form-shell textarea[name="diagnostico"] {
  min-height: 6rem;
}

.patient-summary-card {
  min-height: 6.4rem;
  padding: 1rem 1.25rem;
  border-color: #d7dee8;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.patient-summary-avatar {
  display: flex;
  flex: 0 0 4.25rem;
  align-items: center;
  justify-content: center;
  width: 4.25rem;
  height: 4.25rem;
  overflow: hidden;
  border: 3px solid #f1f5f9;
  border-radius: 9999px;
  background: #dbeafe;
  color: var(--brand-primary);
}

.patient-summary-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patient-summary-avatar svg {
  width: 2rem;
  height: 2rem;
}

.patient-summary-title {
  gap: 0.38rem;
  color: #334155;
  font-size: 1rem;
  font-weight: 500;
}

.patient-summary-title #patient-summary-name {
  color: #1e293b;
  font-weight: 700;
}

.patient-summary-title #patient-summary-species,
.patient-summary-title #patient-summary-breed,
.patient-summary-title #patient-summary-details {
  font-weight: 500;
}

.patient-summary-title .patient-summary-details {
  display: inline;
  margin: 0;
  color: inherit;
  font-size: inherit;
}

.patient-summary-owner {
  margin-top: 0.45rem;
  font-size: 0.82rem;
}

.patient-summary-actions .btn,
.ficha-actions--sticky .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.patient-summary-actions .btn svg,
.ficha-actions--sticky .btn svg {
  flex: 0 0 auto;
}

.ficha-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 1rem;
  padding: 0;
  overflow: hidden;
  border-color: #e2e8f0;
  background: #fff;
}

.ficha-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.35rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 500;
}

.ficha-tab:hover {
  background: #f8fafc;
  color: color-mix(in srgb, var(--brand-primary) 82%, black);
}

.ficha-tab.is-active {
  border: 0;
  background: #fff;
  color: var(--brand-primary);
  box-shadow: none;
  font-weight: 600;
}

.ficha-tab.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--brand-primary);
  content: "";
}

.ficha-tab-icon,
.ficha-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}

.ficha-tab-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.ficha-tab-count::before {
  content: " (";
}

.ficha-tab-count::after {
  content: ")";
}

.ficha-tab-count {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 500;
}

.ficha-tab.is-active .ficha-tab-count {
  color: var(--brand-primary);
}

.ficha-section-icon {
  margin-right: 0.5rem;
  vertical-align: -0.2rem;
}

.ficha-section-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.ficha-history-card,
.ficha-exam-card,
.ficha-diagnosis-card {
  padding: 1.15rem !important;
}

.ficha-history-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ficha-history-section + .ficha-history-section {
  padding-top: 0.95rem;
  border-top: 1px solid #f1f5f9;
}

.ficha-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#panel-consulta h3 {
  font-size: 0.9rem;
  letter-spacing: 0;
  text-transform: none;
}

.ficha-actions--sticky {
  margin-right: -1.5rem;
  margin-left: -1.5rem;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
  background: rgba(255, 255, 255, 0.98);
}

@media (max-width: 767px) {
  .patient-summary-card {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 1rem;
  }

  .patient-summary-copy {
    flex: 1 1 calc(100% - 5rem);
  }

  .patient-summary-actions {
    width: 100%;
  }

  .ficha-tabs {
    display: flex;
    overflow-x: auto;
  }

  .ficha-tab {
    min-width: 11rem;
  }

  .ficha-actions--sticky {
    margin-right: -0.25rem;
    margin-left: -0.25rem;
    padding-right: 0.25rem;
    padding-left: 0.25rem;
  }
}

/* ── Final compact refinements for the clinical-file form ─────────────── */
.ficha-form-shell {
  padding-bottom: 4.25rem;
}

.ficha-general-card {
  display: grid;
  grid-template-columns: minmax(0, 0.2fr) minmax(0, 0.35fr) minmax(0, 0.45fr);
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.ficha-general-field {
  min-width: 0;
}

.ficha-general-field > .form-label,
.ficha-general-patient > .form-label {
  margin-bottom: 0.25rem;
  color: #475569;
  font-size: 0.72rem;
}

.ficha-general-field > .form-control,
.ficha-general-vet .select2-container,
.ficha-general-date input {
  width: 100%;
}

.ficha-general-patient > .form-label {
  display: block;
}

.ficha-general-patient .patient-summary-card {
  min-height: 0;
  margin: 0;
  padding: 0.1rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ficha-general-patient .patient-summary-avatar {
  flex-basis: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border-width: 2px;
}

.ficha-general-patient .patient-summary-avatar svg {
  width: 1.2rem;
  height: 1.2rem;
}

.ficha-general-patient .patient-summary-title {
  gap: 0.2rem;
  font-size: 0.8rem;
  line-height: 1.25;
}

.ficha-general-patient .patient-summary-details,
.ficha-general-patient .patient-summary-owner {
  font-size: 0.68rem;
  line-height: 1.25;
}

.ficha-general-patient .patient-summary-owner {
  margin-top: 0.2rem;
}

.ficha-general-patient .patient-summary-actions {
  gap: 0.35rem;
}

.ficha-general-patient .patient-summary-actions .btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.7rem;
}

.patient-summary-empty .patient-summary-title {
  margin-bottom: 0.1rem;
  font-size: 0.76rem;
}

.patient-summary-empty-text,
.patient-summary-help {
  margin: 0.1rem 0 0.35rem;
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.25;
}

.patient-summary-help {
  margin: 0.25rem 0 0;
}

.patient-summary-search {
  max-width: none;
  gap: 0.4rem;
}

.patient-summary-search .btn {
  min-height: 2.25rem;
  padding: 0.4rem 0.6rem;
  white-space: nowrap;
}

.patient-summary-search .select2-container--default .select2-selection--single {
  height: 2.25rem;
}

.patient-summary-search .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 2.15rem;
}

.patient-summary-search .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 2.15rem;
}

.ficha-tabs {
  margin-top: 0.35rem !important;
  margin-bottom: 0.5rem !important;
}

.ficha-tab {
  min-height: 2.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.ficha-tab-panel {
  margin-top: 0;
}

.ficha-consulta-grid {
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
  gap: 0.75rem;
}

.ficha-history-sections {
  gap: 0.65rem;
}

.ficha-history-section + .ficha-history-section {
  padding-top: 0.65rem;
}

.ficha-history-section > .text-xs,
.ficha-anamnesis-help {
  margin-top: 0.1rem;
  margin-bottom: 0.3rem;
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.25;
}

.ficha-vitals-grid {
  gap: 0.5rem;
  margin-bottom: 0.75rem !important;
}

.ficha-input-with-unit {
  position: relative;
}

.ficha-input-with-unit .form-control {
  padding-right: 3rem;
}

.ficha-input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.ficha-general-grid {
  column-gap: 0.6rem;
  row-gap: 0.5rem;
}

.ficha-label-with-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.ficha-label-with-help .form-label {
  margin-bottom: 0.25rem;
}

.ficha-sensorio-guide {
  position: relative;
  flex: 0 0 auto;
  margin-bottom: 0.25rem;
}

.ficha-sensorio-guide summary {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  border-radius: 9999px;
  background: #eff6ff;
  color: var(--brand-primary);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  list-style: none;
}

.ficha-sensorio-guide summary::-webkit-details-marker {
  display: none;
}

.ficha-sensorio-guide-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.35rem);
  right: 0;
  width: min(25rem, 34vw);
  padding: 0.65rem;
  border: 1px solid #dbe3ee;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.3;
}

.ficha-sensorio-guide-panel dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.7rem;
  margin: 0;
}

.ficha-sensorio-guide-panel dt {
  color: #475569;
}

.ficha-sensorio-guide-panel dd {
  margin: 0;
}

.ficha-form-shell textarea[name="anamnesis"] {
  height: 8.5rem;
  min-height: 8.5rem !important;
  resize: vertical;
}

.ficha-form-shell textarea[name="examen_observaciones"] {
  height: 6.25rem;
  min-height: 6.25rem !important;
  resize: vertical;
}

.ficha-form-shell textarea[name="diagnostico"] {
  height: 5.75rem;
  min-height: 5.75rem !important;
  resize: vertical;
}

.ficha-exam-card > .mt-5 {
  margin-top: 0.85rem !important;
}

.ficha-actions--sticky {
  min-height: 3.4rem;
  margin-top: 0.65rem;
  padding: 0.5rem 1rem 0.55rem;
}

@media (max-width: 767px) {
  .ficha-general-card {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem;
  }

  .ficha-general-patient .patient-summary-card {
    align-items: flex-start;
  }

  .ficha-general-patient .patient-summary-actions {
    width: auto;
  }

  .patient-summary-search {
    grid-template-columns: 1fr auto;
  }

  .ficha-sensorio-guide-panel {
    right: auto;
    left: 0;
    width: min(24rem, calc(100vw - 3rem));
  }

  .ficha-actions--sticky {
    min-height: 3.1rem;
    padding: 0.4rem 0.5rem 0.45rem;
  }
}

@media (max-width: 480px) {
  .patient-summary-search {
    grid-template-columns: 1fr;
  }

  .patient-summary-search .btn {
    width: 100%;
  }
}

/* ── Clinical-file hierarchy refinements ────────────────────────────── */
.patient-summary-card {
  display: block;
  min-height: 0;
  margin-bottom: 0.45rem;
  padding: 0.65rem 0.9rem;
}

.patient-summary-label {
  display: block;
  margin-bottom: 0.35rem;
}

.patient-summary-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.patient-summary-card .patient-summary-avatar {
  flex-basis: 2.65rem;
  width: 2.65rem;
  height: 2.65rem;
  border-width: 2px;
}

.patient-summary-card .patient-summary-avatar svg {
  width: 1.35rem;
  height: 1.35rem;
}

.patient-summary-card .patient-summary-copy {
  flex: 1 1 auto;
}

.patient-summary-card .patient-summary-title {
  font-size: 0.9rem;
}

.patient-summary-card .patient-summary-owner {
  margin-top: 0.2rem;
  font-size: 0.74rem;
}

.patient-summary-card .patient-summary-actions {
  gap: 0.35rem;
}

.patient-summary-card .patient-summary-actions .btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.7rem;
}

.ficha-general-card {
  grid-template-columns: minmax(0, 0.3fr) minmax(0, 0.7fr);
  margin-top: 0;
  margin-bottom: 0.45rem;
}

.ficha-tab-shell {
  margin-top: 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f5f9ff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.ficha-tab-shell > .ficha-tabs {
  margin: 0 !important;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0.75rem 0.75rem 0 0;
}

.ficha-tab-shell > .ficha-tab-panel {
  padding: 0.75rem 0.75rem 0;
}

.ficha-tab-shell > #panel-consulta {
  background: #f5f9ff;
  border-radius: 0 0 0.75rem 0.75rem;
}

.ficha-tab-shell > .ficha-tab-panel > .vc-card:last-child {
  margin-bottom: 0.75rem !important;
}

.ficha-tab-shell > .ficha-tab-panel > .ficha-actions--sticky {
  margin-right: -0.75rem;
  margin-left: -0.75rem;
}

.ficha-consulta-grid {
  align-items: stretch;
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
  gap: 0.75rem;
}

.ficha-history-column {
  align-self: stretch;
}

.ficha-history-card,
.ficha-exam-card {
  height: 100%;
  box-sizing: border-box;
}

.ficha-diagnosis-card {
  margin-top: 0.85rem !important;
}

/* Keep the help icon out of the field's layout flow so every select starts
   on the same baseline. */
#panel-consulta .ficha-label-with-help {
  position: relative;
}

#panel-consulta .ficha-sensorio-guide {
  position: absolute;
  top: 0;
  right: 0.1rem;
  margin: 0 !important;
}

@media (max-width: 900px) {
  .ficha-consulta-grid {
    align-items: stretch;
  }
}

@media (max-width: 767px) {
  .patient-summary-content {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .patient-summary-card {
    padding: 0.65rem 0.75rem;
  }

  .ficha-general-card {
    grid-template-columns: 1fr;
    margin-bottom: 0.45rem;
  }

  .ficha-tab-shell > .ficha-tab-panel {
    padding: 0.6rem 0.55rem 0;
  }

  .ficha-tab-shell > .ficha-tab-panel > .ficha-actions--sticky {
    margin-right: -0.55rem;
    margin-left: -0.55rem;
  }

  .ficha-history-card,
  .ficha-exam-card {
    height: auto;
  }
}

/* Anamnesis information is an interactive, keyboard-accessible disclosure. */
.ficha-help-details {
  position: relative;
  flex: 0 0 auto;
  margin: 0 !important;
}

.ficha-help-details > .ficha-help-icon {
  cursor: pointer;
  list-style: none;
}

.ficha-help-details > .ficha-help-icon::-webkit-details-marker {
  display: none;
}

.ficha-help-details > .ficha-help-icon:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.ficha-help-details[open] > .ficha-help-icon {
  background: #dbeafe;
}

.ficha-help-popover {
  position: absolute;
  z-index: 15;
  top: calc(100% + 0.35rem);
  right: 0;
  width: min(26rem, calc(100vw - 3rem));
  padding: 0.65rem 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 767px) {
  .ficha-help-popover {
    right: auto;
    left: 0;
  }
}

/* Inline study attachments: same drop-style interaction used elsewhere in
   the system while preserving the original multiple file input. */
.study-file-dropzone {
  position: relative;
  display: flex;
  min-height: 5.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border: 2px dashed #cbd5e1;
  border-radius: 0.7rem;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.study-file-dropzone:hover,
.study-file-dropzone:focus-visible,
.study-file-dropzone.is-dragover {
  border-color: #60a5fa;
  background: #eff6ff;
  color: var(--brand-primary);
  outline: none;
}

.study-file-dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  pointer-events: none;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
}

.study-file-dropzone-empty small {
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 400;
}

.study-file-dropzone-icon {
  display: inline-flex;
  color: #60a5fa;
}

.study-file-dropzone-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.study-file-dropzone > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.study-file-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-file-list:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.study-file-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid #dbeafe;
  border-radius: 0.45rem;
  background: #fff;
  color: #475569;
  font-size: 0.7rem;
  text-align: left;
}

.study-file-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-file-remove {
  flex: 0 0 auto;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.study-file-remove:hover {
  color: #b91c1c;
}

.ficha-subsection {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.ficha-subsection-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ficha-subsection-header h3 {
  display: flex;
  align-items: center;
  margin: 0;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
}

.ficha-subsection-header p {
  margin: 0.2rem 0 0;
  color: #94a3b8;
  font-size: 0.68rem;
}

.ficha-inline-empty {
  margin: 0.5rem 0 0;
  padding: 0.7rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  color: #94a3b8;
  font-size: 0.72rem;
  text-align: center;
}

.vaccine-row {
  background: #fbfdff;
}

.vaccine-row textarea {
  min-height: 4.25rem !important;
}

@media (max-width: 640px) {
  .ficha-subsection-header {
    align-items: stretch;
    flex-direction: column;
  }

  .ficha-subsection-header .btn {
    width: 100%;
  }
}

/* ── Clinical-file patient type picker ──────────────────────────────── */
.ficha-page-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.8rem;
}

.ficha-page-heading-icon {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.65rem;
  background: #eff6ff;
  color: var(--brand-primary);
}

.ficha-page-heading-icon svg {
  width: 1.45rem;
  height: 1.45rem;
}

.ficha-page-heading .page-title {
  margin: 0;
}

.ficha-page-heading p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
}

.ficha-patient-picker {
  margin-bottom: 0.75rem;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid #dbe3ef;
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.045);
}

.ficha-patient-picker-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.ficha-patient-picker-heading-icon {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 0.05rem;
  color: var(--brand-primary);
}

.ficha-patient-picker-heading-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.ficha-patient-picker-heading h2 {
  margin: 0;
  color: #1e293b;
  font-size: 0.95rem;
  font-weight: 750;
}

.ficha-patient-picker-heading p {
  margin: 0.15rem 0 0;
  color: #64748b;
  font-size: 0.7rem;
}

.patient-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.patient-type-card {
  position: relative;
  min-width: 0;
  padding: 1rem;
  border: 1px solid #dbe3ef;
  border-radius: 0.75rem;
  background: #fff;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.patient-type-card.is-active {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #f8fbff 0%, #fff 78%);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.patient-type-radio {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 9999px;
  background: #fff;
}

.patient-type-card.is-active .patient-type-radio {
  border-color: #3b82f6;
  box-shadow: inset 0 0 0 3px #fff;
  background: #3b82f6;
}

.patient-type-card-layout {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}

.patient-type-icon {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  border-radius: 9999px;
}

.patient-type-icon svg {
  width: 1.65rem;
  height: 1.65rem;
}

.patient-type-icon--registered {
  background: #dbeafe;
  color: var(--brand-primary);
}

.patient-type-icon--unregistered {
  background: #ede9fe;
  color: #7c3aed;
}

.patient-type-content {
  min-width: 0;
}

.patient-type-content h3 {
  margin: 0 1.5rem 0.12rem 0;
  color: #1e293b;
  font-size: 0.86rem;
  font-weight: 750;
}

.patient-type-content > p {
  margin: 0 0 0.65rem;
  color: #64748b;
  font-size: 0.68rem;
}

.patient-type-content small {
  display: block;
  margin-top: 0.55rem;
  color: #94a3b8;
  font-size: 0.62rem;
  line-height: 1.35;
}

.patient-type-search {
  position: relative;
}

.patient-type-search-icon {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 0.72rem;
  display: inline-flex;
  color: #94a3b8;
  pointer-events: none;
  transform: translateY(-50%);
}

.patient-type-search > select {
  padding-left: 2.2rem;
}

.patient-type-search .select2-container {
  width: 100% !important;
}

.patient-type-search .select2-container--default .select2-selection--single {
  height: 2.55rem;
  border-color: #d5dde8;
  border-radius: 0.55rem;
}

.patient-type-search .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 2.2rem;
  line-height: 2.45rem;
}

.patient-type-search .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 2.45rem;
}

.patient-manual-button {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.55rem;
  background: #eff6ff;
  color: var(--brand-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.patient-manual-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.patient-manual-button svg {
  width: 1rem;
  height: 1rem;
}

.patient-selected-summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #dbeafe;
  border-radius: 0.7rem;
  background: #f8fbff;
}

.patient-selected-summary[hidden] {
  display: none;
}

.patient-selected-summary .patient-summary-avatar {
  width: 3rem;
  height: 3rem;
  flex-basis: 3rem;
}

.patient-selected-summary .patient-summary-avatar svg {
  width: 1.4rem;
  height: 1.4rem;
}

.patient-selected-summary .patient-summary-copy {
  flex: 1 1 auto;
}

.patient-summary-source {
  margin: 0 0 0.12rem;
  color: var(--brand-primary);
  font-size: 0.6rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .patient-type-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ficha-page-heading {
    align-items: flex-start;
  }

  .ficha-patient-picker {
    padding: 0.85rem;
  }

  .patient-type-card-layout {
    grid-template-columns: 2.7rem minmax(0, 1fr);
    gap: 0.65rem;
  }

  .patient-type-icon {
    width: 2.7rem;
    height: 2.7rem;
  }

  .patient-selected-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .patient-selected-summary .patient-summary-actions {
    width: 100%;
  }

  .patient-manual-button {
    width: 100%;
  }
}

/* ── Staff service booking: registered or new patient ───────────────── */
.service-booking-fields {
  display: grid;
  gap: 1rem;
}

.service-patient-picker,
.service-data-section {
  padding: 1rem;
  border: 1px solid #dbe3ef;
  border-radius: 0.8rem;
  background: #fff;
}

.service-patient-picker {
  background: #f8fafc;
}

.service-booking-fields .patient-type-card {
  background: #fff;
}

.service-booking-fields .patient-type-content > p {
  min-height: 2em;
}

.service-patient-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.65rem;
  background: #eff6ff;
}

.service-patient-summary[hidden],
.service-manual-data[hidden] {
  display: none;
}

.service-patient-summary .patient-summary-avatar {
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 2.65rem;
}

.service-patient-summary-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.service-patient-summary-copy strong {
  overflow: hidden;
  color: #1e293b;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-patient-summary-copy span {
  color: #64748b;
  font-size: 0.7rem;
}

.booking-member-badge {
  display: inline-flex;
  min-height: 1.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 750;
  white-space: nowrap;
}

.booking-member-badge.is-member {
  border-color: #86efac;
  background: #dcfce7;
  color: #15803d;
}

.booking-member-badge.is-non-member {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.service-manual-data {
  display: grid;
  gap: 1rem;
}

.service-data-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #e2e8f0;
}

.service-data-section-heading h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 750;
}

.service-data-section-heading h3 svg {
  width: 1rem;
  height: 1rem;
  color: var(--brand-primary);
}

.service-appointment-data {
  background: #f8fafc;
}

@media (max-width: 640px) {
  .service-patient-summary,
  .service-data-section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .service-patient-summary .booking-member-badge {
    margin-left: 3.4rem;
  }
}

/* ── WhatsApp broadcasts ─────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

.broadcast-page { max-width: 1840px; margin: 0 auto; color: #17233b; }
.broadcast-create-modal { max-width:1100px; padding:0; }.broadcast-modal-page { max-width:none; margin:0; padding:1.1rem 1.2rem 1.2rem; }.broadcast-modal-header { display:flex; align-items:center; gap:.7rem; margin:-1.1rem -1.2rem 0; padding:.9rem 1.2rem; border-bottom:1px solid #edf1f6; }.broadcast-modal-header > div:first-child { min-width:0; flex:1; }.broadcast-modal-header h2,.broadcast-modal-header p { margin:0; }.broadcast-modal-header h2 { color:#0f1f3a; font-size:1rem; font-weight:800; }.broadcast-modal-header p { margin-top:.15rem; color:#64748b; font-size:.62rem; }.broadcast-modal-header .broadcast-channel-state { flex:0 0 auto; }.broadcast-modal-header > .btn-icon { flex:0 0 auto; }
.broadcast-page-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.1rem; }
.broadcast-page-header-actions { display:flex; align-items:center; justify-content:flex-end; gap:.65rem; }
.broadcast-page-header h1 { margin:0; color:#0f1f3a; font-size:1.55rem; font-weight:800; letter-spacing:-.025em; }
.broadcast-page-header p { margin:.2rem 0 0; color:#64748b; font-size:.82rem; }
.broadcast-channel-state { display:flex; align-items:center; gap:.65rem; padding:.55rem .85rem; border:1px solid #dbe3ef; border-radius:.75rem; background:#fff; }
.broadcast-channel-state strong,.broadcast-channel-state small { display:block; }
.broadcast-channel-state strong { font-size:.73rem; }.broadcast-channel-state small { color:#94a3b8; font-size:.63rem; }
.broadcast-whatsapp-mark { display:grid; width:1.8rem; height:1.8rem; place-items:center; border-radius:50%; background:#16a34a; color:#fff; font-size:.72rem; font-weight:900; }
.broadcast-channel-state.is-disconnected .broadcast-whatsapp-mark { background:#94a3b8; }

.broadcast-layout { display:grid; grid-template-columns:minmax(560px,.94fr) minmax(590px,1.06fr); gap:1rem; align-items:start; }
.broadcast-create-layout { grid-template-columns:minmax(560px,900px); }
.broadcast-card { border:1px solid #dbe3ef; border-radius:.85rem; background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.035); }
.broadcast-composer { padding:1.15rem; }
.broadcast-card-heading { display:flex; align-items:center; gap:.65rem; padding-bottom:.95rem; }
.broadcast-card-heading h2,.broadcast-history h2 { margin:0; font-size:1rem; font-weight:800; }
.broadcast-heading-icon { display:grid; width:1.75rem; height:1.75rem; place-items:center; border-radius:.38rem; background:#16a34a; color:#fff; font-weight:800; }
.broadcast-mode-badge { margin-left:.35rem; padding:.28rem .65rem; border-radius:999px; background:#dcfce7; color:#16803c; font-size:.62rem; font-weight:700; }
.broadcast-step { padding:1rem 0; border-top:1px solid #edf1f6; }
.broadcast-step-title { display:flex; align-items:center; gap:.5rem; margin-bottom:.75rem; }
.broadcast-step-title > span { display:grid; width:1.2rem; height:1.2rem; place-items:center; border-radius:50%; background:var(--brand-primary); color:#fff; font-size:.58rem; font-weight:800; }
.broadcast-step-title h3 { margin:0; font-size:.78rem; font-weight:800; }.broadcast-step-title small { color:#94a3b8; font-size:.65rem; font-weight:500; }
.broadcast-fields-grid { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; }
.broadcast-step .form-label { margin-bottom:.3rem; color:#334155; font-size:.65rem; font-weight:700; }.broadcast-step .form-label b { color:#ef4444; }.broadcast-step .form-label span { color:#94a3b8; font-weight:500; }
.broadcast-step .form-control { min-height:2.4rem; padding:.48rem .65rem; font-size:.72rem; }
.broadcast-match-count { display:inline-flex; align-items:center; gap:.4rem; margin-top:.65rem; padding:.34rem .65rem; border-radius:999px; background:#ecfdf3; color:#16a34a; font-size:.65rem; }.broadcast-match-count svg { width:14px;height:14px; }

.broadcast-audience-picker { display:grid; grid-template-columns:minmax(0,1fr) 2rem minmax(0,1fr); gap:.55rem; }
.broadcast-contact-panel { overflow:hidden; border:1px solid #dbe3ef; border-radius:.65rem; background:#fff; }
.broadcast-contact-panel-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.55rem .65rem .35rem; font-size:.64rem; }
.broadcast-contact-panel-head span { display:grid; min-width:1.35rem; height:1.35rem; padding:0 .25rem; place-items:center; border-radius:999px; background:#f1f5f9; color:#64748b; font-size:.58rem; }
.broadcast-search { display:flex; align-items:center; gap:.4rem; margin:.25rem .55rem .45rem; padding:.42rem .5rem; border:1px solid #e2e8f0; border-radius:.5rem; background:#fff; color:#94a3b8; }
.broadcast-search svg { flex:0 0 auto; width:14px; height:14px; }.broadcast-search input { min-width:0; width:100%; border:0; outline:0; background:transparent; color:#334155; font-size:.64rem; }
.broadcast-contact-list { height:10.5rem; overflow:auto; padding:0 .35rem .35rem; }
.broadcast-contact-row { display:flex; align-items:center; gap:.45rem; min-height:2.25rem; padding:.35rem .25rem; border-bottom:1px solid #f1f5f9; cursor:pointer; }
.broadcast-contact-row:hover { background:#f8fafc; }.broadcast-contact-row input { width:.78rem; height:.78rem; accent-color:var(--brand-primary); }
.broadcast-contact-row > span { display:flex; min-width:0; flex:1; justify-content:space-between; gap:.35rem; }
.broadcast-contact-row strong { overflow:hidden; color:#334155; font-size:.63rem; font-weight:600; text-overflow:ellipsis; white-space:nowrap; }
.broadcast-contact-row small { flex:0 0 auto; color:#94a3b8; font-size:.59rem; }
.broadcast-remove-contact { padding:.15rem; border:0; background:transparent; color:#64748b; cursor:pointer; font-size:.9rem; line-height:1; }.broadcast-remove-contact:hover { color:#ef4444; }
.broadcast-transfer-actions { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.35rem; }
.broadcast-transfer-actions button { display:grid; width:1.85rem; height:1.85rem; place-items:center; border:1px solid #dbe3ef; border-radius:.4rem; background:#fff; color:var(--brand-primary); cursor:pointer; font-size:1rem; font-weight:700; }
.broadcast-transfer-actions button:first-child { border-color:var(--brand-primary); background:var(--brand-primary); color:#fff; }.broadcast-transfer-actions button:disabled { opacity:.35; cursor:not-allowed; }
.broadcast-list-empty { margin:2.5rem .4rem 0; color:#94a3b8; font-size:.62rem; text-align:center; }
.broadcast-helper { margin:.45rem 0 0; color:#94a3b8; font-size:.59rem; }

.broadcast-content-grid { display:grid; grid-template-columns:minmax(0,1fr) 12rem; gap:.75rem; }
.broadcast-whatsapp-preview { display:flex; min-height:8.5rem; align-items:center; margin-top:.55rem; padding:1rem; border:1px solid #e6e2d8; border-radius:.6rem; background-color:#efeae2; background-image:radial-gradient(rgba(100,116,139,.09) .7px,transparent .7px); background-size:10px 10px; }
.broadcast-message-bubble { position:relative; width:min(88%,28rem); padding:.65rem .75rem .9rem; border-radius:.45rem; background:#d9fdd3; box-shadow:0 1px 1px rgba(15,23,42,.12); }
.broadcast-message-bubble:before { position:absolute; top:0; left:-.4rem; border-top:.55rem solid #d9fdd3; border-left:.55rem solid transparent; content:""; }
.broadcast-message-bubble p { margin:0; color:#23302b; font-size:.69rem; line-height:1.45; white-space:pre-wrap; }.broadcast-message-bubble time { position:absolute; right:.45rem; bottom:.25rem; color:#5798b7; font-size:.5rem; }
.broadcast-preview-empty { width:100%; color:#64748b; font-size:.64rem; text-align:center; }
.broadcast-template-meta,.broadcast-template-error { margin:.35rem 0 0; font-size:.58rem; }.broadcast-template-meta { color:#64748b; }.broadcast-template-error { color:#dc2626; }
.broadcast-parameter-editor { margin-top:.65rem; overflow:hidden; border:1px solid #dbe3ef; border-radius:.6rem; background:#fbfdff; }
.broadcast-parameter-heading { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.55rem .65rem; border-bottom:1px solid #e2e8f0; background:#f8fafc; }.broadcast-parameter-heading strong,.broadcast-parameter-heading p { display:block; margin:0; }.broadcast-parameter-heading strong { color:#334155; font-size:.63rem; }.broadcast-parameter-heading p { margin-top:.1rem; color:#94a3b8; font-size:.52rem; }.broadcast-parameter-heading > span { padding:.25rem .45rem; border-radius:999px; background:#eff6ff; color:var(--brand-primary); font-size:.51rem; font-weight:700; white-space:nowrap; }
.broadcast-parameter-row { display:grid; grid-template-columns:2.1rem minmax(150px,1fr) minmax(150px,1fr); gap:.5rem; align-items:end; padding:.6rem .65rem; border-bottom:1px solid #edf1f6; }.broadcast-parameter-row:last-child { border:0; }.broadcast-parameter-number { display:grid; width:1.8rem; height:1.8rem; place-items:center; align-self:center; border-radius:.42rem; background:#e0e7ff; color:#4338ca; font-size:.58rem; font-weight:800; }.broadcast-parameter-row label { display:block; margin-bottom:.22rem; color:#64748b; font-size:.51rem; font-weight:700; }.broadcast-parameter-row .form-control { min-height:2.05rem; padding:.38rem .5rem; font-size:.59rem; }.broadcast-parameter-value span { display:flex; min-height:2.05rem; align-items:center; overflow:hidden; padding:.38rem .5rem; border:1px dashed #cbd5e1; border-radius:.42rem; background:#fff; color:#475569; font-size:.59rem; text-overflow:ellipsis; white-space:nowrap; }
.broadcast-summary { align-self:end; overflow:hidden; border:1px solid #dbe3ef; border-radius:.65rem; }
.broadcast-summary > div { display:flex; align-items:center; gap:.55rem; padding:.7rem; border-bottom:1px solid #edf1f6; }.broadcast-summary > div:last-child { border:0; }
.broadcast-summary-icon { display:grid; width:2rem; height:2rem; flex:0 0 auto; place-items:center; border-radius:50%; background:#eff6ff; color:var(--brand-primary); }.broadcast-summary-icon svg { width:15px;height:15px; }.broadcast-summary-icon.whatsapp { background:#ecfdf3; color:#16a34a; font-size:.67rem; font-weight:900; }
.broadcast-summary p,.broadcast-summary strong,.broadcast-summary small { display:block; margin:0; }.broadcast-summary p { color:#64748b; font-size:.58rem; }.broadcast-summary strong { margin:.05rem 0; color:#17233b; font-size:.8rem; }.broadcast-summary small { color:#94a3b8; font-size:.54rem; }
.broadcast-form-actions { display:flex; align-items:center; justify-content:flex-end; gap:.55rem; padding-top:1rem; border-top:1px solid #edf1f6; }
.broadcast-draft-button { border:1px solid #dbe3ef; background:#fff; color:#475569; }.broadcast-send-button { min-width:9rem; }.broadcast-send-button:disabled { opacity:.45; cursor:not-allowed; }

.broadcast-history { overflow:hidden; }.broadcast-history-header { display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem; padding:1rem 1rem .75rem; }
.broadcast-history-header p { margin:.18rem 0 0; color:#94a3b8; font-size:.62rem; }.broadcast-history-tools { display:flex; align-items:center; gap:.4rem; }
.broadcast-history-tools .history-search { width:9rem; margin:0; }.broadcast-history-tools .form-control { width:8.4rem; min-height:2.1rem; padding:.35rem .45rem; font-size:.62rem; }.broadcast-history-tools .btn { min-height:2.1rem; padding:.35rem .55rem; }
.broadcast-tabs { display:flex; gap:.35rem; padding:0 1rem .8rem; }.broadcast-tabs a { padding:.5rem .75rem; border-radius:.45rem; color:#64748b; font-size:.64rem; font-weight:700; text-decoration:none; }.broadcast-tabs a:hover { background:#f8fafc; }.broadcast-tabs a.active { background:#eff6ff; color:var(--brand-primary); }
.broadcast-table-wrap { margin:0 .7rem; overflow-x:auto; border:1px solid #e5eaf1; border-radius:.65rem; }
.broadcast-table { width:100%; border-collapse:collapse; font-size:.63rem; }.broadcast-table th { padding:.7rem .55rem; background:#f8fafc; color:#475569; font-size:.59rem; font-weight:800; text-align:left; white-space:nowrap; }.broadcast-table td { padding:.72rem .55rem; border-top:1px solid #edf1f6; color:#475569; vertical-align:middle; }
.broadcast-table td > strong,.broadcast-table td > small { display:block; }.broadcast-table td > strong { color:#334155; font-size:.63rem; }.broadcast-table td > small { max-width:10rem; overflow:hidden; margin-top:.12rem; color:#94a3b8; font-size:.55rem; text-overflow:ellipsis; white-space:nowrap; }
.broadcast-template-pill { display:inline-block; max-width:8rem; overflow:hidden; padding:.27rem .45rem; border-radius:.35rem; background:#dcfce7; color:#15803d; font-size:.56rem; text-overflow:ellipsis; white-space:nowrap; }
.broadcast-status { display:inline-flex; align-items:center; justify-content:center; gap:.3rem; min-width:4.7rem; padding:.3rem .5rem; border-radius:999px; background:#f1f5f9; color:#64748b; font-size:.55rem; font-weight:700; white-space:nowrap; }
.broadcast-status-completed,.broadcast-status-delivered,.broadcast-status-read { background:#dcfce7; color:#15803d; }.broadcast-status-error { background:#fee2e2; color:#dc2626; }.broadcast-status-sending { background:#eff6ff; color:var(--brand-primary); }
.broadcast-status-sending i { width:.45rem;height:.45rem;border:1.5px solid #93c5fd;border-top-color:var(--brand-primary);border-radius:50%;animation:broadcast-spin .8s linear infinite; }.broadcast-error-number { color:#dc2626 !important; font-weight:700; }
.broadcast-status-active { background:#dcfce7; color:#15803d; }.broadcast-status-inactive { background:#f1f5f9; color:#64748b; }
.broadcast-type-pill { display:inline-flex; padding:.27rem .45rem; border-radius:.35rem; font-size:.55rem; font-weight:700; white-space:nowrap; }.broadcast-type-manual { background:#eff6ff; color:var(--brand-primary); }.broadcast-type-automatic { background:#f5f3ff; color:#7c3aed; }
.broadcast-no-activity { color:#94a3b8; font-size:.57rem; }
.broadcast-status-table { min-width:1050px; }
@keyframes broadcast-spin { to { transform:rotate(360deg); } }
.broadcast-row-actions { display:flex; gap:.25rem; }.broadcast-row-actions .btn-icon { display:grid; width:1.8rem;height:1.8rem;place-items:center;border:1px solid #e2e8f0;border-radius:.4rem;color:#64748b;text-decoration:none; }.broadcast-row-actions .btn-icon:hover { border-color:#bfdbfe;background:#eff6ff;color:var(--brand-primary); }
.broadcast-empty-history { padding:3rem 1rem; text-align:center; }.broadcast-empty-history span { display:grid;width:2.4rem;height:2.4rem;margin:0 auto .5rem;place-items:center;border-radius:50%;background:#f1f5f9;color:#94a3b8; }.broadcast-empty-history strong { display:block; }.broadcast-empty-history p { margin:.2rem 0 0;color:#94a3b8;font-size:.58rem; }
.broadcast-pagination { display:flex; align-items:center; justify-content:space-between; padding:.8rem 1rem; color:#64748b; font-size:.59rem; }.broadcast-pagination div { display:flex; align-items:center; gap:.3rem; }.broadcast-pagination a,.broadcast-pagination strong { display:grid;width:1.7rem;height:1.7rem;place-items:center;border:1px solid #dbe3ef;border-radius:.35rem;text-decoration:none; }.broadcast-pagination strong { border-color:var(--brand-primary);background:var(--brand-primary);color:#fff; }

.broadcast-detail-modal { width:min(920px,94vw); max-height:88vh; overflow:auto; }.broadcast-detail-modal .modal-header p { margin:.15rem 0 0;color:#94a3b8;font-size:.7rem; }
.broadcast-detail-summary { display:grid; grid-template-columns:repeat(6,1fr); gap:.45rem; padding:1rem; }.broadcast-detail-summary > div { display:flex;min-height:4rem;flex-direction:column;align-items:center;justify-content:center;border:1px solid #e2e8f0;border-radius:.55rem; }.broadcast-detail-summary small { margin-bottom:.25rem;color:#94a3b8;font-size:.58rem; }.broadcast-detail-summary strong { font-size:.9rem; }
.broadcast-detail-meta { display:grid;grid-template-columns:1fr 1fr;gap:.35rem 1rem;margin:0 1rem;padding:.7rem;border-radius:.55rem;background:#f8fafc; }.broadcast-detail-meta p { margin:0;color:#64748b;font-size:.65rem; }.broadcast-detail-error { color:#dc2626 !important; }.broadcast-detail-list { margin:1rem;overflow:auto;border:1px solid #e2e8f0;border-radius:.55rem; }
.broadcast-detail-parameters { margin:.65rem 1rem 0; padding:.65rem .7rem; border:1px solid #e2e8f0; border-radius:.55rem; }.broadcast-detail-parameters > strong { display:block; margin-bottom:.4rem; color:#475569; font-size:.6rem; }.broadcast-detail-parameters > div { display:flex; flex-wrap:wrap; gap:.35rem; }.broadcast-detail-parameters span { padding:.3rem .45rem; border-radius:.35rem; background:#eef2ff; color:#475569; font-size:.54rem; }.broadcast-detail-parameters span b { margin-right:.3rem; color:#4f46e5; }

@media (max-width: 1450px) { .broadcast-layout { grid-template-columns:1fr; }.broadcast-history { min-height:auto; } }
@media (max-width: 800px) {
  .broadcast-page-header,.broadcast-history-header { align-items:stretch; flex-direction:column; }.broadcast-page-header-actions { align-items:stretch; flex-direction:column; }.broadcast-page-header-actions .broadcast-channel-state { align-self:flex-start; }.broadcast-page-header-actions .btn { justify-content:center; }
  .broadcast-fields-grid,.broadcast-content-grid { grid-template-columns:1fr; }.broadcast-audience-picker { grid-template-columns:1fr; }.broadcast-transfer-actions { flex-direction:row; }.broadcast-transfer-actions button { transform:rotate(90deg); }
  .broadcast-history-tools { flex-wrap:wrap; }.broadcast-history-tools .history-search { width:100%; }.broadcast-history-tools .form-control { flex:1;width:auto; }
  .broadcast-detail-summary { grid-template-columns:repeat(3,1fr); }.broadcast-detail-meta { grid-template-columns:1fr; }
  .broadcast-parameter-row { grid-template-columns:2rem 1fr; }.broadcast-parameter-row > div:last-child { grid-column:2; }
}
@media (max-width: 480px) { .broadcast-composer { padding:.8rem; }.broadcast-mode-badge { margin-left:auto;font-size:.53rem; }.broadcast-tabs { overflow-x:auto; }.broadcast-form-actions { align-items:stretch;flex-direction:column; }.broadcast-form-actions .btn { width:100%; }.broadcast-detail-summary { grid-template-columns:repeat(2,1fr); } }

/* Give the broadcast status screen a comfortable reading scale. */
.broadcast-status-page .broadcast-status-card { overflow:hidden; }
.broadcast-status-page .broadcast-history-header { padding:1.25rem 1.25rem 1rem; }
.broadcast-status-page .broadcast-history-header h2 { margin:0; font-size:1.08rem; font-weight:800; }
.broadcast-status-page .broadcast-history-header p { margin-top:.28rem; font-size:.76rem; line-height:1.45; }
.broadcast-status-page .broadcast-history-tools { gap:.55rem; }
.broadcast-status-page .broadcast-history-tools .history-search { width:14rem; min-height:2.5rem; padding:.55rem .65rem; }
.broadcast-status-page .broadcast-history-tools .history-search input { font-size:.75rem; }
.broadcast-status-page .broadcast-history-tools .form-control { width:10.5rem; min-height:2.5rem; padding:.48rem .65rem; font-size:.75rem; }
.broadcast-status-page .broadcast-history-tools .btn { min-width:2.5rem; min-height:2.5rem; padding:.5rem .7rem; }
.broadcast-status-page .broadcast-tabs { gap:.45rem; padding:0 1.25rem 1rem; }
.broadcast-status-page .broadcast-tabs a { padding:.58rem .9rem; font-size:.75rem; }
.broadcast-status-page .broadcast-table-wrap { margin:0 1rem 1rem; border-radius:.7rem; }
.broadcast-status-page .broadcast-status-table { min-width:1240px; font-size:.75rem; }
.broadcast-status-page .broadcast-table th { padding:.82rem .72rem; font-size:.69rem; letter-spacing:.01em; }
.broadcast-status-page .broadcast-table td { padding:.9rem .72rem; line-height:1.35; }
.broadcast-status-page .broadcast-table td > strong { font-size:.75rem; }
.broadcast-status-page .broadcast-table td > small { max-width:12rem; margin-top:.18rem; font-size:.66rem; }
.broadcast-status-page .broadcast-template-pill,
.broadcast-status-page .broadcast-type-pill { padding:.34rem .55rem; font-size:.66rem; }
.broadcast-status-page .broadcast-status { min-width:5.4rem; padding:.38rem .62rem; font-size:.65rem; }
.broadcast-status-page .broadcast-no-activity { font-size:.68rem; }
.broadcast-status-page .broadcast-row-actions { gap:.35rem; }
.broadcast-status-page .broadcast-row-actions .btn-icon { width:2.15rem; height:2.15rem; }
.broadcast-status-page .broadcast-row-actions .btn-icon svg { width:15px; height:15px; }
.broadcast-status-page .broadcast-empty-history { padding:4rem 1rem; }
.broadcast-status-page .broadcast-empty-history span { width:3rem; height:3rem; margin-bottom:.7rem; }
.broadcast-status-page .broadcast-empty-history p { margin-top:.3rem; font-size:.72rem; }
.broadcast-status-page .broadcast-pagination { padding:.95rem 1.25rem; font-size:.7rem; }
.broadcast-status-page .broadcast-pagination a,
.broadcast-status-page .broadcast-pagination strong { width:2rem; height:2rem; }

@media (max-width: 800px) {
  .broadcast-status-page .broadcast-history-header { padding:1rem; }
  .broadcast-status-page .broadcast-history-tools .history-search { width:100%; }
  .broadcast-status-page .broadcast-history-tools .form-control { width:auto; }
  .broadcast-status-page .broadcast-tabs { padding-inline:1rem; }
  .broadcast-status-page .broadcast-table-wrap { margin-inline:.75rem; }
}

/* ── Notification settings ───────────────────────────────────────────── */
.notifications-settings-page { max-width:1840px; margin:0 auto; color:#17233b; }
.notifications-settings-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.notifications-settings-header h1 { margin:0; color:#0f1f3a; font-size:1.55rem; font-weight:800; letter-spacing:-.025em; }
.notifications-settings-header p { margin:.2rem 0 0; color:#64748b; font-size:.82rem; }
.notifications-health-pill { display:inline-flex; align-items:center; gap:.4rem; padding:.45rem .7rem; border:1px solid #e2e8f0; border-radius:999px; background:#fff; color:#64748b; font-size:.63rem; font-weight:700; }
.notifications-health-pill i { width:.48rem; height:.48rem; border-radius:50%; background:#94a3b8; box-shadow:0 0 0 3px #f1f5f9; }.notifications-health-pill.is-connected { border-color:#bbf7d0; background:#f0fdf4; color:#15803d; }.notifications-health-pill.is-connected i { background:#22c55e; box-shadow:0 0 0 3px #dcfce7; }.notifications-health-pill.is-error { border-color:#fecaca; background:#fef2f2; color:#dc2626; }.notifications-health-pill.is-error i { background:#ef4444; box-shadow:0 0 0 3px #fee2e2; }

.notifications-connection-card { position:relative; display:flex; align-items:center; justify-content:space-between; gap:1rem; overflow:hidden; padding:1rem 1.15rem; border:1px solid #bbf7d0; border-radius:.85rem; background:linear-gradient(105deg,#f0fdf4 0%,#fff 62%); box-shadow:0 1px 3px rgba(15,23,42,.035); }
.notifications-connection-card:after { position:absolute; top:-3rem; right:18%; width:9rem; height:9rem; border-radius:50%; background:rgba(34,197,94,.05); content:""; }
.notifications-connection-main { display:flex; min-width:0; align-items:center; gap:.85rem; z-index:1; }.notifications-whatsapp-logo { display:grid; width:2.65rem; height:2.65rem; flex:0 0 auto; place-items:center; border-radius:50%; background:#16a34a; color:#fff; box-shadow:0 5px 15px rgba(22,163,74,.18); font-weight:900; }
.notifications-eyebrow { display:block; margin-bottom:.12rem; color:#15803d; font-size:.56rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }.notifications-connection-main h2 { margin:0; color:#17233b; font-size:.95rem; font-weight:800; }.notifications-connection-main p { margin:.15rem 0 0; color:#64748b; font-size:.66rem; }
.notifications-connection-actions { display:flex; align-items:center; gap:.45rem; z-index:1; }.notifications-disconnect-button { border:1px solid #fecaca; background:#fff; color:#dc2626; }.notifications-disconnect-button:hover { background:#fef2f2; }
.notifications-meta-result { display:none; z-index:1; padding:.45rem .65rem; border-radius:.45rem; font-size:.63rem; }.notifications-meta-result.show { display:block; background:#eff6ff; color:color-mix(in srgb, var(--brand-primary) 82%, black); }.notifications-meta-result.success { background:#dcfce7; color:#15803d; }.notifications-meta-result.error { background:#fee2e2; color:#dc2626; }
.notifications-config-warning { display:flex; align-items:center; gap:.5rem; z-index:1; padding:.55rem .7rem; border:1px solid #fde68a; border-radius:.5rem; background:#fffbeb; color:#a16207; }.notifications-config-warning svg { flex:0 0 auto; }.notifications-config-warning strong,.notifications-config-warning span { display:block; }.notifications-config-warning span { font-size:.58rem; }.notifications-config-warning strong { font-size:.62rem; }
.notifications-meta-credentials { margin-top:.7rem; }.notifications-meta-credentials > summary { display:flex; align-items:center; gap:.65rem; padding:.8rem 1rem; cursor:pointer; list-style:none; }.notifications-meta-credentials > summary::-webkit-details-marker { display:none; }.notifications-meta-credentials > summary > span:first-child { display:grid; width:2rem; height:2rem; flex:0 0 auto; place-items:center; border-radius:.5rem; background:#eff6ff; color:var(--brand-primary); }.notifications-meta-credentials > summary > div { min-width:0; flex:1; }.notifications-meta-credentials > summary strong,.notifications-meta-credentials > summary small { display:block; }.notifications-meta-credentials > summary strong { color:#334155; font-size:.7rem; }.notifications-meta-credentials > summary small { margin-top:.1rem; color:#94a3b8; font-size:.55rem; }.notifications-meta-credentials[open] > summary { border-bottom:1px solid #edf1f6; background:#fbfdff; }.notifications-meta-credentials[open] > summary .notifications-details-chevron { transform:rotate(180deg); }
.notifications-meta-credentials-form { padding-top:.85rem; }.notifications-meta-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; padding:0 1rem .85rem; }.notifications-meta-fields .form-group { margin:0; }.notifications-meta-fields label,.notifications-webhook-config label { display:block; margin-bottom:.25rem; color:#475569; font-size:.57rem; font-weight:750; }.notifications-meta-fields .form-control,.notifications-webhook-config .form-control { min-height:2.25rem; font-size:.64rem; }.notifications-field-error { display:block; margin-top:.2rem; color:#dc2626; font-size:.52rem; }.notifications-form-error { margin:0 1rem .75rem; padding:.55rem .7rem; border:1px solid #fecaca; border-radius:.5rem; background:#fef2f2; color:#b91c1c; font-size:.58rem; }.notifications-form-error ul { margin:0; padding-left:1rem; }
.notifications-webhook-config { display:grid; grid-template-columns:1.5fr 1fr; gap:.7rem; margin:0 1rem .85rem; padding:.75rem; border:1px solid #dbeafe; border-radius:.6rem; background:#f8fbff; }.notifications-webhook-config p { grid-column:1/-1; margin:0; color:#64748b; font-size:.55rem; }.notifications-webhook-config code { font-size:.53rem; }

.notifications-metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:.7rem; margin:1rem 0; }
.notifications-metrics article { display:flex; align-items:center; gap:.65rem; min-width:0; padding:.75rem .85rem; border:1px solid #dbe3ef; border-radius:.7rem; background:#fff; }
.notifications-metric-icon { display:grid; width:2.1rem; height:2.1rem; flex:0 0 auto; place-items:center; border-radius:.55rem; }.notifications-metric-icon svg { width:15px; height:15px; }.notifications-metric-icon.green { background:#ecfdf3; color:#16a34a; }.notifications-metric-icon.blue { background:#eff6ff; color:var(--brand-primary); }.notifications-metric-icon.violet { background:#f5f3ff; color:#7c3aed; }.notifications-metric-icon.red { background:#fef2f2; color:#ef4444; }
.notifications-metrics small,.notifications-metrics strong,.notifications-metrics p { display:block; margin:0; }.notifications-metrics small { color:#64748b; font-size:.57rem; }.notifications-metrics strong { color:#17233b; font-size:.88rem; }.notifications-metrics p { color:#94a3b8; font-size:.53rem; }

.notifications-settings-layout { display:grid; grid-template-columns:minmax(550px,1fr) minmax(520px,.9fr); gap:1rem; align-items:start; }
.notifications-settings-card { overflow:hidden; border:1px solid #dbe3ef; border-radius:.85rem; background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.035); }
.notifications-card-heading { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.9rem 1rem; border-bottom:1px solid #edf1f6; }.notifications-card-heading > div { display:flex; align-items:center; gap:.6rem; min-width:0; }.notifications-card-heading h2,.notifications-card-heading p { margin:0; }.notifications-card-heading h2 { color:#17233b; font-size:.82rem; font-weight:800; }.notifications-card-heading p { margin-top:.12rem; color:#94a3b8; font-size:.57rem; }
.notifications-section-icon { display:grid; width:2rem; height:2rem; flex:0 0 auto; place-items:center; border-radius:.5rem; background:#eff6ff; color:var(--brand-primary); }.notifications-section-icon svg { width:15px; height:15px; }.notifications-section-icon.green { background:#ecfdf3; color:#16a34a; }.notifications-section-icon.violet { background:#f5f3ff; color:#7c3aed; }
.notifications-card-count { flex:0 0 auto; padding:.3rem .55rem; border-radius:999px; background:#f1f5f9; color:#64748b; font-size:.55rem; font-weight:700; }

.notifications-automation-list { padding:0 1rem; }.notifications-automation-row { display:grid; grid-template-columns:minmax(230px,1fr) 4.8rem minmax(190px,.8fr); gap:.7rem; align-items:center; padding:.85rem 0; border-bottom:1px solid #edf1f6; }.notifications-automation-row:last-child { border:0; }
.notifications-automation-info { display:flex; min-width:0; align-items:center; gap:.6rem; }.notifications-event-icon { display:grid; width:2.15rem; height:2.15rem; flex:0 0 auto; place-items:center; border-radius:.55rem; }.notifications-event-icon svg { width:15px; height:15px; }.notifications-event-icon.membership { background:#eff6ff; color:var(--brand-primary); }.notifications-event-icon.appointment { background:#f5f3ff; color:#7c3aed; }.notifications-event-icon.vaccine { background:#fff7ed; color:#ea580c; }.notifications-event-icon.study { background:#ecfdf3; color:#16a34a; }
.notifications-automation-info h3,.notifications-automation-info p,.notifications-automation-info small { display:block; margin:0; }.notifications-automation-info h3 { color:#334155; font-size:.68rem; font-weight:800; }.notifications-automation-info p { margin-top:.08rem; color:#64748b; font-size:.59rem; }.notifications-automation-info small { margin-top:.08rem; color:#94a3b8; font-size:.53rem; }
.notifications-switch { display:inline-flex; align-items:center; gap:.35rem; cursor:pointer; }.notifications-switch input { position:absolute; width:1px; height:1px; opacity:0; }.notifications-switch span { position:relative; width:1.9rem; height:1.05rem; flex:0 0 auto; border-radius:999px; background:#cbd5e1; transition:.2s; }.notifications-switch span:after { position:absolute; top:.14rem; left:.14rem; width:.77rem; height:.77rem; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.25); content:""; transition:.2s; }.notifications-switch input:checked + span { background:var(--brand-primary); }.notifications-switch input:checked + span:after { transform:translateX(.85rem); }.notifications-switch input:focus-visible + span { outline:2px solid #93c5fd; outline-offset:2px; }.notifications-switch em { color:#64748b; font-size:.56rem; font-style:normal; font-weight:600; }
.notifications-template-select label { display:block; margin-bottom:.25rem; color:#64748b; font-size:.53rem; font-weight:700; }.notifications-template-select .form-control { min-height:2.15rem; padding:.4rem .55rem; font-size:.61rem; }
.notifications-automation-example { grid-column:1/-1; margin-top:-.15rem; padding:.5rem .6rem; border:1px solid #e2e8f0; border-radius:.5rem; background:#f8fafc; }.notifications-automation-example p { margin:0 0 .35rem; color:#64748b; font-size:.55rem; }.notifications-automation-example p b { color:#475569; }.notifications-automation-example div { display:flex; flex-wrap:wrap; gap:.25rem; }.notifications-automation-example span { padding:.22rem .38rem; border-radius:.3rem; background:#eef2ff; color:#4f46e5; font-size:.49rem; font-weight:700; }
.notifications-card-footer { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.75rem 1rem; border-top:1px solid #edf1f6; background:#fbfdff; }.notifications-card-footer p { margin:0; color:#94a3b8; font-size:.55rem; }

.notifications-template-list { max-height:36.5rem; overflow:auto; padding:.65rem; }.notifications-template-card { margin-bottom:.45rem; border:1px solid #e2e8f0; border-radius:.6rem; background:#fff; }.notifications-template-card:last-child { margin-bottom:0; }.notifications-template-card details > summary { display:flex; align-items:center; gap:.55rem; padding:.65rem; cursor:pointer; list-style:none; }.notifications-template-card details > summary::-webkit-details-marker { display:none; }.notifications-template-card details[open] > summary { border-bottom:1px solid #edf1f6; background:#fbfdff; }
.notifications-template-symbol { display:grid; width:1.9rem; height:1.9rem; flex:0 0 auto; place-items:center; border-radius:.48rem; background:#ecfdf3; color:#16a34a; }.notifications-template-symbol svg { width:14px; height:14px; }.notifications-template-copy { min-width:0; flex:1; }.notifications-template-copy > span { display:flex; align-items:center; gap:.35rem; }.notifications-template-copy strong { overflow:hidden; color:#334155; font-size:.65rem; text-overflow:ellipsis; white-space:nowrap; }.notifications-template-copy em { color:#94a3b8; font-size:.51rem; font-style:normal; }.notifications-template-copy small { display:block; overflow:hidden; margin-top:.12rem; color:#94a3b8; font-size:.53rem; text-overflow:ellipsis; white-space:nowrap; }
.notifications-template-tags { display:flex; align-items:center; gap:.3rem; }.notifications-use-tag,.notifications-template-status { padding:.25rem .4rem; border-radius:.35rem; font-size:.49rem; font-weight:700; white-space:nowrap; }.notifications-use-tag { background:#eff6ff; color:var(--brand-primary); }.notifications-template-status.approved { background:#dcfce7; color:#15803d; }.notifications-template-status.pending { background:#fef3c7; color:#a16207; }.notifications-details-chevron { color:#94a3b8; font-size:.8rem; transition:.2s; }.notifications-template-card details[open] .notifications-details-chevron { transform:rotate(180deg); }
.notifications-template-editor { display:grid; grid-template-columns:minmax(160px,1fr) auto auto; gap:.55rem; align-items:end; padding:.7rem; }.notifications-template-editor .form-label { margin-bottom:.25rem; font-size:.54rem; }.notifications-template-editor .form-control { min-height:2.1rem; padding:.4rem .5rem; font-size:.59rem; }.notifications-template-editor > div > small { display:block; margin-top:.2rem; color:#94a3b8; font-size:.49rem; }.notifications-switch.template-active { padding-bottom:.5rem; white-space:nowrap; }.notifications-template-full-preview { grid-column:1/-1; grid-row:2; }.notifications-template-full-preview p { max-height:12rem; overflow:auto; margin:0; padding:.7rem; border:1px solid #dbe3ef; border-radius:.5rem; background:#f8fafc; color:#334155; font-size:.61rem; line-height:1.55; white-space:normal; }

.notifications-activity { margin-top:1rem; }.notifications-activity-table-wrap { overflow-x:auto; }.notifications-activity-table { width:100%; border-collapse:collapse; font-size:.63rem; }.notifications-activity-table th { padding:.65rem 1rem; background:#f8fafc; color:#64748b; font-size:.55rem; font-weight:800; text-align:left; white-space:nowrap; }.notifications-activity-table td { padding:.7rem 1rem; border-top:1px solid #edf1f6; color:#475569; vertical-align:middle; }.notifications-activity-table td > strong,.notifications-activity-table td > small { display:block; }.notifications-activity-table td > strong { color:#334155; font-size:.62rem; }.notifications-activity-table td > small { margin-top:.1rem; color:#94a3b8; font-size:.53rem; }.notifications-channel-tag { display:inline-flex; align-items:center; gap:.3rem; color:#475569; font-size:.57rem; font-weight:700; }.notifications-channel-tag i { display:grid; width:1.25rem; height:1.25rem; place-items:center; border-radius:50%; background:#16a34a; color:#fff; font-size:.45rem; font-style:normal; font-weight:900; }.notifications-activity-error { max-width:12rem; overflow:hidden; color:#dc2626 !important; text-overflow:ellipsis; white-space:nowrap; }
.notifications-empty-state { padding:2.5rem 1rem; text-align:center; }.notifications-empty-state > span { display:grid; width:2.4rem; height:2.4rem; margin:0 auto .5rem; place-items:center; border-radius:50%; background:#f1f5f9; color:#94a3b8; }.notifications-empty-state strong { display:block; color:#475569; font-size:.66rem; }.notifications-empty-state p { margin:.18rem 0 0; color:#94a3b8; font-size:.56rem; }

@media (max-width:1450px) { .notifications-settings-layout { grid-template-columns:1fr; }.notifications-template-list { max-height:none; } }
@media (max-width:900px) { .notifications-metrics { grid-template-columns:1fr 1fr; }.notifications-connection-card { align-items:flex-start; flex-wrap:wrap; }.notifications-meta-result,.notifications-config-warning { width:100%; }.notifications-template-editor { grid-template-columns:1fr 1fr; } }
@media (max-width:700px) { .notifications-settings-header { align-items:flex-start; flex-direction:column; }.notifications-automation-row { grid-template-columns:1fr auto; }.notifications-template-select { grid-column:1/-1; }.notifications-template-tags { display:none; }.notifications-card-footer { align-items:stretch; flex-direction:column; }.notifications-card-footer .btn { width:100%; }.notifications-connection-actions { width:100%; }.notifications-connection-actions .btn,.notifications-connection-actions form { flex:1; }.notifications-connection-actions form .btn { width:100%; }.notifications-meta-fields,.notifications-webhook-config { grid-template-columns:1fr; }.notifications-webhook-config p { grid-column:1; } }
@media (max-width:480px) { .notifications-metrics { grid-template-columns:1fr; }.notifications-connection-main { align-items:flex-start; }.notifications-template-editor { grid-template-columns:1fr; }.notifications-switch.template-active { padding:.3rem 0; }.notifications-card-heading { align-items:flex-start; }.notifications-template-copy small { max-width:12rem; } }
.config-tabs { display:flex; flex-wrap:wrap; gap:.35rem; padding:.25rem; border:1px solid #dbe3ef; border-radius:.8rem; background:#f8fafc; }
.config-tab { padding:.62rem .9rem; border-radius:.6rem; color:#64748b; font-size:.78rem; font-weight:750; text-decoration:none; transition:background .15s,color .15s,box-shadow .15s; }
.config-tab:hover { color:#334155; background:#eef2f7; }
.config-tab.active { color:var(--brand-primary,#2563eb); background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.1); }
.config-tab-secondary { color:var(--brand-primary,#2563eb); }
.clinic-config-card[hidden] { display:none !important; }
.clinic-config-grid > .space-y-5 { display:contents; }
.clinic-details-card { grid-column:1 / -1; }
.clinic-details-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.clinic-details-contact { grid-column:1 / -1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; margin-top:.5rem; padding-top:1.25rem; border-top:1px solid #e2e8f0; }
.clinic-details-contact-heading { grid-column:1 / -1; }
.clinic-details-contact-email { grid-column:1 / -1; }
.clinic-config-card[data-config-group="services"], .clinic-config-card[data-config-group="agenda"] { grid-column:1 / -1; }
@media (max-width:700px) { .config-tabs { overflow-x:auto; flex-wrap:nowrap; } .config-tab { flex:0 0 auto; } .config-tab-secondary { margin-left:0; } }
@media (max-width:700px) { .clinic-details-fields { grid-template-columns:1fr; } }
@media (max-width:700px) { .clinic-details-contact { grid-template-columns:1fr; } .clinic-details-contact-heading, .clinic-details-contact-email { grid-column:auto; } }
