.appointment-page {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.appointment-header,
.appointment-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e6edf7);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

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

.appointment-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-color, #0f172a);
}

.appointment-header p,
.appointment-card-title span {
  margin: 2px 0 0;
  color: var(--muted-color, #64748b);
  font-size: 12px;
}

.appointment-header-actions,
.appointment-actions,
.appointment-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.appointment-filter-row #appointmentDoctorFilter {
  min-width: 190px;
}

.appointment-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.appointment-page.queue-first .appointment-list-card {
  order: 1;
}

.appointment-page.queue-first .appointment-form-card {
  order: 2;
}

.appointment-page.entry-first .appointment-form-card {
  order: 1;
}

.appointment-page.entry-first .appointment-list-card {
  order: 2;
}

.appointment-page.entry-first .appointment-list-card,
.appointment-page.queue-first .appointment-form-card {
  display: none;
}

.appointment-card {
  padding: 11px 14px;
  min-width: 0;
}

.appointment-card-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 7px;
}

.appointment-card-title strong {
  display: block;
  font-size: 14px;
  color: var(--text-color, #0f172a);
}

.appointment-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px 11px;
  align-items: end;
}

.appointment-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-color, #64748b);
}

.appointment-form .form-control,
.appointment-form .form-select {
  min-height: 38px;
  height: 38px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.appointment-form textarea.form-control {
  min-height: 40px;
  height: 40px;
  resize: vertical;
}

.appointment-form .is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-validation {
  color: #dc2626;
  font-size: 12px;
  font-weight: 800;
}

.appointment-form .span-2,
.appointment-message {
  grid-column: 1 / -1;
}

.doctor-fee-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.14);
  align-items: center;
}

.doctor-fee-strip span {
  font-size: 10.5px;
  color: var(--muted-color, #64748b);
}

.doctor-fee-strip strong {
  display: block;
  color: var(--text-color, #0f172a);
  font-size: 13px;
}

.appointment-message {
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  font-weight: 700;
}

.appointment-whatsapp-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #166534;
}

.appointment-whatsapp-panel > div:first-child strong,
.appointment-whatsapp-panel > div:first-child span {
  display: block;
}

.appointment-whatsapp-panel > div:first-child span {
  margin-top: 2px;
  color: #15803d;
  font-size: 12px;
}

.appointment-whatsapp-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.appointment-whatsapp-actions .icon-text-btn,
.appointment-whatsapp-actions .primary-action {
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
}

.appointment-whatsapp-actions .icon-text-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

.appointment-whatsapp-actions .icon-text-btn span,
.appointment-whatsapp-actions .primary-action span {
  color: inherit;
  font-size: 12px;
}

.appointment-whatsapp-actions .primary-action {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.appointment-list-card {
  overflow: hidden;
}

.slot-picker-btn {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(79, 70, 229, 0.08));
  color: #1d4ed8;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.appointment-notes {
  grid-column: span 2;
}

.appointment-actions {
  justify-content: flex-end;
  align-self: end;
}

.due-amount-input {
  color: #1d4ed8;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.04);
}

.appointment-booking-type-badge {
  min-height: 38px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
}

.patient-autocomplete-wrap {
  position: relative;
}

.patient-autocomplete {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #dbe7f3);
  background: var(--card-bg, #fff);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.patient-autocomplete-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-color, #0f172a);
}

.patient-autocomplete-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

.patient-autocomplete-item strong,
.patient-autocomplete-item span {
  display: block;
}

.patient-autocomplete-item span,
.patient-autocomplete-empty {
  color: var(--muted-color, #64748b);
  font-size: 12px;
}

.patient-autocomplete-empty {
  padding: 10px;
}

.selected-patient-summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.appointment-mode-pill {
  flex: 0 0 auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.selected-patient-summary strong,
.selected-patient-summary span {
  display: block;
}

.selected-patient-summary span {
  font-size: 12px;
  color: #15803d;
}

.appointment-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.appointment-status.pending { background: #fef3c7; color: #92400e; }
.appointment-status.confirmed { background: #dbeafe; color: #1d4ed8; }
.appointment-status.registered { background: #dcfce7; color: #166534; }
.appointment-status.cancelled { background: #fee2e2; color: #991b1b; }
.appointment-status.payment-not-required { background: #e0f2fe; color: #075985; }
.appointment-status.payment-paid { background: #dcfce7; color: #166534; }
.appointment-status.payment-pending { background: #fef3c7; color: #92400e; }
.appointment-status.payment-failed { background: #fee2e2; color: #991b1b; }

.precheck-overlay {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.28);
}

.precheck-dialog {
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--border-color, #e6edf7);
  border-radius: 14px;
  background: var(--card-bg, #fff);
  box-shadow: 0 24px 62px rgba(15, 23, 42, .22);
}

.precheck-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 10px;
  border-bottom: 1px solid var(--border-color, #e6edf7);
  background: var(--card-bg, #fff);
}

.precheck-head strong,
.precheck-head span {
  display: block;
}

.precheck-head strong {
  color: var(--text-color, #0f172a);
  font-size: 16px;
  font-weight: 950;
}

.precheck-head span {
  margin-top: 3px;
  color: var(--muted-color, #64748b);
  font-size: 12px;
  font-weight: 700;
}

.precheck-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px 11px;
  padding: 14px;
}

.precheck-form label {
  display: grid;
  gap: 4px;
  color: var(--muted-color, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.precheck-form .span-2 {
  grid-column: span 2;
}

.precheck-form .form-control,
.precheck-form .form-select {
  min-height: 38px;
}

.precheck-form textarea.form-control {
  min-height: 54px;
}

.precheck-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.slot-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vh, 24px);
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(1.5px);
}

.slot-dialog {
  position: relative;
  width: min(1060px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  border: 1px solid var(--border-color, #e6edf7);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slot-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-color, #e6edf7);
  background: var(--card-bg, #fff);
}

.slot-header > div {
  min-width: 0;
}

.slot-header strong {
  display: block;
  font-size: 16px;
  color: var(--text-color, #0f172a);
}

.slot-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted-color, #64748b);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-header .row-action {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  align-self: flex-start;
  border-color: rgba(37, 99, 235, 0.18);
  background: #f8fafc;
  color: #0f172a;
}

.slot-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 7px;
  padding: 12px 16px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  overscroll-behavior: contain;
}

.slot-alert {
  flex: 0 0 auto;
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 800;
}

.slot-button {
  min-height: 68px;
  border: 1px solid var(--border-color, #dbe7f3);
  border-radius: 10px;
  background: var(--input-bg, #fff);
  text-align: left;
  padding: 8px 9px;
  color: var(--text-color, #0f172a);
  display: grid;
  gap: 4px;
  align-content: start;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.slot-button strong {
  display: block;
  font-size: 13px;
  line-height: 1;
}

.slot-button span,
.slot-button em {
  font-size: 11px;
  color: var(--muted-color, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-badge-row {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

.slot-button em {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
  overflow: visible;
  white-space: nowrap;
  text-overflow: clip;
}

.slot-patient,
.slot-mobile,
.slot-note {
  display: block;
  min-width: 0;
  line-height: 1.25;
}

.slot-button.available:hover {
  border-color: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.slot-button.available:focus-visible,
.slot-button.is-selected {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.slot-button.booked,
.slot-button.operation,
.slot-button.emergency,
.slot-button.meeting,
.slot-button.wardround,
.slot-button.leave,
.slot-button.leave,
.slot-button.doctor-leave,
.slot-button.first-half-leave,
.slot-button.second-half-leave,
.slot-button.holiday,
.slot-button.break,
.slot-button.blocked,
.slot-button.past-time {
  cursor: not-allowed;
  border-color: #cbd5e1;
}

.slot-button.available em { background: #dcfce7; color: #166534; }
.slot-button.booked { background: #eef2ff; }
.slot-button.booked em { background: #dbeafe; color: #1d4ed8; }
.slot-button.operation { background: #f5f3ff; border-color: #c4b5fd; }
.slot-button.operation em { background: #7c3aed; color: #fff; }
.slot-button.emergency { background: #fef2f2; border-color: #fca5a5; }
.slot-button.emergency em { background: #ef4444; color: #fff; }
.slot-button.meeting { background: #111827; border-color: #111827; color: #f8fafc; }
.slot-button.meeting strong,
.slot-button.meeting span { color: #f8fafc; }
.slot-button.meeting em { background: #374151; color: #fff; }
.slot-button.wardround { background: #e0f2fe; border-color: #7dd3fc; }
.slot-button.wardround em { background: #0ea5e9; color: #fff; }
.slot-button em.booking-online,
.slot-legend .online::before { background: #7c3aed; }
.slot-button em.booking-online { color: #fff; }
.slot-button em.booking-offline { background: #e0f2fe; color: #075985; }
.slot-legend .offline::before { background: #0ea5e9; }
.slot-button em.payment-paid { background: #dcfce7; color: #166534; }
.slot-button em.payment-pending { background: #fef3c7; color: #92400e; }
.slot-button em.payment-not-required { background: #f1f5f9; color: #475569; }
.slot-button em.payment-failed { background: #fee2e2; color: #991b1b; }
.slot-button.leave,
.slot-button.doctor-leave,
.slot-button.first-half-leave,
.slot-button.second-half-leave { background: #fff7ed; }
.slot-button.leave em,
.slot-button.doctor-leave em,
.slot-button.first-half-leave em,
.slot-button.second-half-leave em { background: #fed7aa; color: #9a3412; }
.slot-button.holiday { background: #ffffff; border-color: #cbd5e1; }
.slot-button.holiday em { background: #f1f5f9; color: #475569; }
.slot-button.break { background: #f8fafc; }
.slot-button.break em { background: #e2e8f0; color: #475569; }
.slot-button.blocked { background: #f3f4f6; }
.slot-button.blocked em { background: #d1d5db; color: #374151; }
.slot-button.past-time { background: #f1f5f9; opacity: 0.78; }
.slot-button.past-time em { background: #cbd5e1; color: #334155; }

.slot-legend {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
  color: var(--muted-color, #64748b);
  font-size: 12px;
}

.slot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.slot-legend span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
}

.slot-legend .booked::before { background: #3b82f6; }
.slot-legend .operation::before { background: #7c3aed; }
.slot-legend .emergency::before { background: #ef4444; }
.slot-legend .meeting::before { background: #111827; }
.slot-legend .wardround::before { background: #0ea5e9; }
.slot-legend .leave::before,
.slot-legend .doctor-leave::before,
.slot-legend .first-half-leave::before,
.slot-legend .second-half-leave::before { background: #f97316; }
.slot-legend .holiday::before { background: #f8fafc; border: 1px solid #94a3b8; }
.slot-legend .break::before { background: #94a3b8; }
.slot-legend .blocked::before { background: #9ca3af; }
.slot-legend .past-time::before { background: #64748b; }

.slot-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border-color, #e6edf7);
  background: var(--card-bg, #fff);
  box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.06);
}

.slot-footer > div {
  min-width: 0;
}

.slot-footer span {
  display: block;
  color: var(--muted-color, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.slot-footer strong {
  display: block;
  color: var(--text-color, #0f172a);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.primary-action.compact {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
}

.slot-footer .primary-action.compact {
  min-width: 236px;
  justify-content: center;
  gap: 8px;
  color: #fff;
}

.slot-footer .primary-action.compact i,
.slot-footer .primary-action.compact span {
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-weight: 900;
}

body[data-theme="dark"] .slot-overlay,
body.theme-dark .slot-overlay {
  background: rgba(2, 6, 23, 0.44);
}

body[data-theme="dark"] .slot-dialog,
body.theme-dark .slot-dialog,
body[data-theme="dark"] .slot-footer,
body.theme-dark .slot-footer {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.22);
}

body[data-theme="dark"] .slot-footer,
body.theme-dark .slot-footer {
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.22);
}

body[data-theme="dark"] .slot-button,
body.theme-dark .slot-button {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.28);
  color: #e5e7eb;
}

body[data-theme="dark"] .slot-button strong,
body[data-theme="dark"] .slot-header strong,
body[data-theme="dark"] .slot-footer strong,
body.theme-dark .slot-button strong,
body.theme-dark .slot-header strong,
body.theme-dark .slot-footer strong {
  color: #f8fafc;
}

body[data-theme="dark"] .slot-button span,
body[data-theme="dark"] .slot-header span,
body[data-theme="dark"] .slot-footer span,
body.theme-dark .slot-button span,
body.theme-dark .slot-header span,
body.theme-dark .slot-footer span {
  color: #94a3b8;
}

body[data-theme="dark"] .slot-button.available,
body.theme-dark .slot-button.available {
  background: rgba(22, 101, 52, 0.18);
  border-color: rgba(34, 197, 94, 0.42);
}

body[data-theme="dark"] .slot-button.booked,
body.theme-dark .slot-button.booked {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(96, 165, 250, 0.34);
}

body[data-theme="dark"] .slot-button.holiday,
body.theme-dark .slot-button.holiday {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(248, 113, 113, 0.36);
}

body[data-theme="dark"] .slot-button.doctor-leave,
body[data-theme="dark"] .slot-button.first-half-leave,
body[data-theme="dark"] .slot-button.second-half-leave,
body.theme-dark .slot-button.doctor-leave,
body.theme-dark .slot-button.first-half-leave,
body.theme-dark .slot-button.second-half-leave {
  background: rgba(124, 45, 18, 0.22);
  border-color: rgba(251, 146, 60, 0.36);
}

body[data-theme="dark"] .slot-button.break,
body[data-theme="dark"] .slot-button.past-time,
body.theme-dark .slot-button.break,
body.theme-dark .slot-button.past-time {
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(148, 163, 184, 0.28);
}

.slot-counters {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
}

.slot-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color, #dbe7f3);
  background: var(--input-bg, #fff);
  color: var(--muted-color, #64748b);
  font-size: 12px;
  font-weight: 900;
}

.slot-counter em {
  font-style: normal;
}

.slot-counter strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 12px;
}

.slot-counter.available { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.slot-counter.booked { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.slot-counter.past-time { border-color: #cbd5e1; color: #334155; background: #f8fafc; }
.slot-counter.blocked { border-color: #d1d5db; color: #374151; background: #f9fafb; }
.slot-counter.other { border-color: #ddd6fe; color: #5b21b6; background: #f5f3ff; }

.slot-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 0;
}

.slot-filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.slot-filter-chip {
  min-height: 34px;
  border: 1px solid var(--border-color, #dbe7f3);
  border-radius: 999px;
  background: var(--input-bg, #fff);
  color: var(--text-color, #0f172a);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.slot-filter-chip:hover,
.slot-filter-chip.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.slot-search {
  flex: 0 1 220px;
  min-width: 170px;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border-color, #dbe7f3);
  border-radius: 999px;
  background: var(--input-bg, #fff);
  color: var(--muted-color, #64748b);
}

.slot-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-color, #0f172a);
  font: inherit;
  font-size: 13px;
}

.slot-legend {
  gap: 7px;
}

.slot-legend span {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border-color, #dbe7f3);
  border-radius: 999px;
  background: var(--input-bg, #fff);
  color: var(--text-color, #0f172a);
  line-height: 1;
}

.slot-grid {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 9px;
}

.slot-empty {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed var(--border-color, #dbe7f3);
  border-radius: 12px;
  color: var(--muted-color, #64748b);
  font-weight: 800;
  text-align: center;
}

.slot-button {
  position: relative;
  min-height: 92px;
  padding: 11px 12px;
  border-radius: 12px;
  gap: 6px;
}

.slot-button strong {
  color: var(--text-color, #0f172a);
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0;
}

.slot-button[disabled],
.slot-button[aria-disabled="true"] {
  opacity: 0.9;
  cursor: pointer;
  filter: saturate(0.82);
}

.slot-button[disabled]:hover,
.slot-button[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

.slot-button[disabled] strong,
.slot-button[aria-disabled="true"] strong {
  color: #334155;
}

.slot-button[disabled] span,
.slot-button[disabled] .slot-patient,
.slot-button[disabled] .slot-mobile,
.slot-button[disabled] .slot-note,
.slot-button[aria-disabled="true"] span,
.slot-button[aria-disabled="true"] .slot-patient,
.slot-button[aria-disabled="true"] .slot-mobile,
.slot-button[aria-disabled="true"] .slot-note {
  color: #64748b;
}

.slot-button[data-slot-tooltip]::after {
  content: none;
}

.slot-selected-badge,
.slot-now-marker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.slot-selected-badge {
  top: 8px;
  right: 8px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
}

.slot-now-marker {
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(37, 99, 235, 0.26);
  background: #dbeafe;
  color: #1d4ed8;
}

.slot-button.is-selected {
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}

.slot-button.is-selected strong,
.slot-button.is-selected span,
.slot-button.is-selected .slot-note,
.slot-button.is-selected .slot-patient,
.slot-button.is-selected .slot-mobile {
  color: #fff;
}

.slot-button.is-selected em {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.slot-button.is-selected .slot-selected-badge {
  opacity: 1;
  transform: none;
}

.slot-button.is-selected .slot-now-marker {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.slot-button.booked[disabled],
.slot-button.booked[aria-disabled="true"] {
  min-height: 98px;
  opacity: 1;
  filter: none;
  background: #f3f6ff;
  border-color: #bfcbdf;
}

.slot-button.booked[disabled] strong,
.slot-button.booked[aria-disabled="true"] strong {
  color: #475569;
}

.slot-button.booked[disabled] .slot-badge-row,
.slot-button.booked[aria-disabled="true"] .slot-badge-row {
  gap: 5px;
}

.slot-button.booked[disabled] em,
.slot-button.booked[aria-disabled="true"] em {
  min-height: 20px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.2;
}

.slot-button.booked[disabled] .slot-patient,
.slot-button.booked[disabled] .slot-mobile,
.slot-button.booked[aria-disabled="true"] .slot-patient,
.slot-button.booked[aria-disabled="true"] .slot-mobile {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.slot-detail-panel {
  position: absolute;
  top: 84px;
  right: 16px;
  bottom: 74px;
  z-index: 8;
  width: min(390px, calc(100% - 32px));
  min-height: 0;
}

.slot-detail-card {
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  background: var(--card-bg, #fff);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22);
}

.slot-detail-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--border-color, #e6edf7);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(14, 165, 233, 0.08));
}

.slot-detail-head span,
.slot-detail-head strong {
  display: block;
}

.slot-detail-head span {
  color: var(--muted-color, #64748b);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.slot-detail-head strong {
  margin-top: 3px;
  color: var(--text-color, #0f172a);
  font-size: 16px;
  font-weight: 950;
}

.slot-detail-head .row-action {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-color: rgba(37, 99, 235, 0.24);
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.1);
}

.slot-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px 14px;
  overflow: auto;
}

.slot-detail-body div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-color, #e6edf7);
  border-radius: 10px;
  background: #f8fafc;
}

.slot-detail-body dt,
.slot-detail-body dd {
  margin: 0;
}

.slot-detail-body dt {
  color: var(--muted-color, #64748b);
  font-size: 11px;
  font-weight: 900;
}

.slot-detail-body dd {
  margin-top: 3px;
  color: var(--text-color, #0f172a);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.slot-selected-summary {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.slot-selected-summary dl {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.slot-selected-summary dl div {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e6edf7);
}

.slot-selected-summary dt,
.slot-selected-summary dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
}

.slot-selected-summary dt {
  color: var(--muted-color, #64748b);
  font-weight: 800;
}

.slot-selected-summary dd {
  color: var(--text-color, #0f172a);
  font-weight: 900;
}

#slotConfirm:disabled {
  cursor: not-allowed;
  opacity: 0.66;
  filter: saturate(0.7);
  color: #fff;
}

body[data-theme="dark"] .slot-counter,
body[data-theme="dark"] .slot-filter-chip,
body[data-theme="dark"] .slot-search,
body[data-theme="dark"] .slot-legend span,
body[data-theme="dark"] .slot-selected-summary dl div,
body[data-theme="dark"] .slot-detail-card,
body[data-theme="dark"] .slot-detail-body div,
body.theme-dark .slot-counter,
body.theme-dark .slot-filter-chip,
body.theme-dark .slot-search,
body.theme-dark .slot-legend span,
body.theme-dark .slot-selected-summary dl div,
body.theme-dark .slot-detail-card,
body.theme-dark .slot-detail-body div {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.24);
  color: #e5e7eb;
}

body[data-theme="dark"] .slot-filter-chip.active,
body[data-theme="dark"] .slot-filter-chip:hover,
body.theme-dark .slot-filter-chip.active,
body.theme-dark .slot-filter-chip:hover {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.24);
  color: #bfdbfe;
}

body[data-theme="dark"] .slot-button.is-selected,
body.theme-dark .slot-button.is-selected {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  color: #fff;
}

body[data-theme="dark"] .slot-footer .primary-action.compact i,
body[data-theme="dark"] .slot-footer .primary-action.compact span,
body.theme-dark .slot-footer .primary-action.compact i,
body.theme-dark .slot-footer .primary-action.compact span {
  color: inherit;
}

body[data-theme="dark"] .slot-button.booked[disabled],
body[data-theme="dark"] .slot-button.booked[aria-disabled="true"],
body.theme-dark .slot-button.booked[disabled],
body.theme-dark .slot-button.booked[aria-disabled="true"] {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(96, 165, 250, 0.42);
}

body[data-theme="dark"] .slot-button.booked[disabled] strong,
body[data-theme="dark"] .slot-button.booked[disabled] .slot-patient,
body[data-theme="dark"] .slot-button.booked[disabled] .slot-mobile,
body[data-theme="dark"] .slot-button.booked[aria-disabled="true"] strong,
body[data-theme="dark"] .slot-button.booked[aria-disabled="true"] .slot-patient,
body[data-theme="dark"] .slot-button.booked[aria-disabled="true"] .slot-mobile,
body.theme-dark .slot-button.booked[disabled] strong,
body.theme-dark .slot-button.booked[disabled] .slot-patient,
body.theme-dark .slot-button.booked[disabled] .slot-mobile {
  color: #cbd5e1;
}

body.theme-dark .slot-button.booked[aria-disabled="true"] strong,
body.theme-dark .slot-button.booked[aria-disabled="true"] .slot-patient,
body.theme-dark .slot-button.booked[aria-disabled="true"] .slot-mobile,
body[data-theme="dark"] .slot-detail-head strong,
body[data-theme="dark"] .slot-detail-body dd,
body.theme-dark .slot-detail-head strong,
body.theme-dark .slot-detail-body dd {
  color: #f8fafc;
}

@media (min-width: 1280px) {
  .appointment-form {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .appointment-form .span-2,
  .appointment-notes,
  .appointment-actions,
  .appointment-whatsapp-panel {
    grid-column: span 2;
  }

  .appointment-actions {
    grid-column: span 2;
  }
}

@media (max-width: 1200px) {
  .appointment-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .appointment-notes,
  .appointment-actions,
  .appointment-whatsapp-panel {
    grid-column: span 3;
  }
}

@media (max-width: 900px) {
  .precheck-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .appointment-header,
  .appointment-card-title {
    align-items: stretch;
    flex-direction: column;
  }

  .appointment-form,
  .doctor-fee-strip,
  .precheck-form {
    grid-template-columns: 1fr;
  }

  .appointment-notes,
  .appointment-actions,
  .appointment-whatsapp-panel,
  .precheck-form .span-2 {
    grid-column: 1 / -1;
  }

  .precheck-actions {
    flex-direction: column;
  }

  .appointment-whatsapp-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .appointment-whatsapp-actions {
    justify-content: stretch;
  }

  .appointment-filter-row,
  .appointment-filter-row input {
    width: 100%;
  }

  .slot-overlay {
    align-items: flex-end;
    padding: 8px;
  }

  .slot-dialog {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 16px 16px 12px 12px;
  }

  .slot-header {
    padding: 12px 12px 10px;
  }

  .slot-legend {
    padding: 9px 12px 0;
  }

  .slot-counters,
  .slot-controls {
    padding-left: 12px;
    padding-right: 12px;
  }

  .slot-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .slot-filter-chips {
    gap: 6px;
  }

  .slot-filter-chip {
    flex: 1 1 calc(50% - 6px);
    padding: 0 9px;
  }

  .slot-search {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .slot-alert {
    margin: 9px 12px 0;
  }

  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px 12px;
  }

  .slot-button {
    min-height: 88px;
    padding: 10px;
  }

  .slot-footer {
    align-items: stretch;
    flex-direction: column;
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 11px 12px calc(11px + env(safe-area-inset-bottom));
  }

  .slot-footer .primary-action {
    width: 100%;
    justify-content: center;
  }

  .slot-detail-panel {
    top: auto;
    right: 8px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: min(58vh, 420px);
  }

  .slot-detail-body {
    grid-template-columns: 1fr;
    max-height: 44vh;
    overflow: auto;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .slot-dialog {
    width: min(760px, 96vw);
  }

  .slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .slot-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }
}
