/* ═══════════════════════════════════════════════════════════
   Medical Manager — Production Stylesheet v1.0
   ───────────────────────────────────────────────────────────
   Design language:
     Primary   #2563EB  (medical blue)
     Accent    #6a1827  (deep crimson — used sparingly)
     No borders · 8px radius · No transparency · Shadow depth
     Font: DM Sans (system fallback)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ── Design tokens ───────────────────────────────────────── */
:root {
  --mm-blue:        #2563EB;
  --mm-blue-dark:   #1d4ed8;
  --mm-blue-mid:    #3b82f6;
  --mm-blue-light:  #eff6ff;
  --mm-blue-faint:  #f0f6ff;

  --mm-accent:      #6a1827;
  --mm-accent-dark: #581420;
  --mm-accent-soft: #f9f0f2;

  --mm-white:   #ffffff;
  --mm-bg:      #F8FAFC;
  --mm-surface: #ffffff;
  --mm-text:    #1E293B;
  --mm-muted:   #64748B;
  --mm-subtle:  #94A3B8;
  --mm-faint:   #E2E8F0;
  --mm-hairline:#F1F5F9;

  /* Status colours */
  --mm-s-booked:      #2563EB;
  --mm-s-booked-bg:   #EFF6FF;
  --mm-s-process:     #D97706;
  --mm-s-process-bg:  #FFFBEB;
  --mm-s-done:        #16A34A;
  --mm-s-done-bg:     #F0FDF4;
  --mm-s-overrun:     #DC2626;
  --mm-s-overrun-bg:  #FEF2F2;
  --mm-s-pending:     #94A3B8;
  --mm-s-pending-bg:  #F8FAFC;

  /* Geometry */
  --mm-radius:    8px;
  --mm-radius-sm: 6px;
  --mm-radius-lg: 12px;

  /* Shadows */
  --mm-shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --mm-shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
  --mm-shadow:    0 2px 8px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.05);
  --mm-shadow-lg: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.07);

  /* Typography */
  --mm-font: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mm-mono: 'DM Mono', 'Fira Mono', 'Courier New', monospace;

  /* Animation */
  --mm-ease:    180ms cubic-bezier(0.4, 0, 0.2, 1);
  --mm-spring:  300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════
   BASE RESET
═══════════════════════════════════════════════════════════ */
.mm-wrap *,
.mm-wrap *::before,
.mm-wrap *::after,
.mm-modal-overlay *,
.mm-modal-overlay *::before,
.mm-modal-overlay *::after {
  box-sizing: border-box;
  font-family: var(--mm-font);
}

.mm-wrap {
  background: var(--mm-bg);
  color: var(--mm-text);
  font-size: 15px;
  line-height: 1.55;
  padding: 28px 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mm-wrap h1,
.mm-wrap h2,
.mm-wrap h3,
.mm-wrap h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--mm-text);
}

.mm-wrap p { margin: 0; }
.mm-wrap ul, .mm-wrap ol { margin: 0; padding: 0; list-style: none; }

/* ═══════════════════════════════════════════════════════════
   SURFACE / SECTION
═══════════════════════════════════════════════════════════ */
.mm-section {
  background: var(--mm-surface);
  border-radius: var(--mm-radius);
  box-shadow: var(--mm-shadow-sm);
  padding: 24px;
  margin-bottom: 16px;
}

.mm-section:last-child { margin-bottom: 0; }

.mm-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.mm-section-subtitle {
  font-size: 13px;
  color: var(--mm-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY UTILITIES
═══════════════════════════════════════════════════════════ */
.mm-mono  { font-family: var(--mm-mono); }
.mm-muted { color: var(--mm-muted); }
.mm-small { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   AUTH CARD
═══════════════════════════════════════════════════════════ */
.mm-auth-card {
  background: var(--mm-surface);
  border-radius: var(--mm-radius-lg);
  box-shadow: var(--mm-shadow);
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
}

#mm-staff-login-wrap .mm-auth-card { max-width: 400px; }

.mm-auth-subtitle {
  font-size: 14px;
  color: var(--mm-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.mm-auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--mm-muted);
  margin-top: 18px;
}

/* ═══════════════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════════════ */
.mm-auth-tabs,
.mm-staff-tabs {
  display: flex;
  background: var(--mm-hairline);
}

.mm-staff-tabs {
  border-radius: var(--mm-radius) var(--mm-radius) 0 0;
  overflow: hidden;
}

.mm-tab-btn {
  flex: 1;
  padding: 13px 10px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-muted);
  cursor: pointer;
  transition: color var(--mm-ease), background var(--mm-ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  position: relative;
}

.mm-tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--mm-blue);
  transform: scaleX(0);
  transition: transform var(--mm-ease);
}

.mm-tab-btn--active {
  background: var(--mm-surface);
  color: var(--mm-blue);
}

.mm-tab-btn--active::after { transform: scaleX(1); }

.mm-tab-btn:hover:not(.mm-tab-btn--active) {
  color: var(--mm-text);
  background: var(--mm-faint);
}

/* Tab panels */
.mm-tab-panel { display: none; padding: 26px 26px 28px; }
.mm-tab-panel--active { display: block; }

/* Staff panels */
.mm-staff-panel {
  display: none;
  background: var(--mm-surface);
  border-radius: 0 0 var(--mm-radius) var(--mm-radius);
  box-shadow: var(--mm-shadow-sm);
  padding: 24px;
}
.mm-staff-panel--active { display: block; }

/* Tab badges */
.mm-tab-badge {
  background: var(--mm-faint);
  color: var(--mm-muted);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}

.mm-tab-badge--alert {
  background: var(--mm-s-overrun-bg);
  color: var(--mm-s-overrun);
}

/* ═══════════════════════════════════════════════════════════
   FORM FIELDS
═══════════════════════════════════════════════════════════ */
.mm-field { margin-bottom: 16px; }
.mm-field:last-child { margin-bottom: 0; }

.mm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mm-field-row--inline { align-items: flex-end; }
.mm-field--grow { flex: 1; }
.mm-field--btn  { flex-shrink: 0; }

/* Label */
.mm-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mm-muted);
  margin-bottom: 6px;
}

.mm-req { color: var(--mm-accent); }

/* Input */
.mm-input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: var(--mm-bg);
  border: none;
  border-radius: var(--mm-radius);
  font-size: 14px;
  color: var(--mm-text);
  outline: none;
  transition: box-shadow var(--mm-ease), background var(--mm-ease);
  box-shadow: 0 0 0 1.5px var(--mm-faint);
  -webkit-appearance: none;
}

.mm-input:focus {
  box-shadow: 0 0 0 2px var(--mm-blue);
  background: var(--mm-white);
}

.mm-input:hover:not(:focus) {
  box-shadow: 0 0 0 1.5px var(--mm-subtle);
}

.mm-input::placeholder { color: var(--mm-subtle); }
.mm-input:disabled { opacity: 0.55; cursor: not-allowed; }

.mm-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

/* Input with eye-toggle */
.mm-input-wrap { position: relative; }
.mm-input-wrap .mm-input { padding-right: 42px; }

.mm-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--mm-subtle);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--mm-radius-sm);
  transition: color var(--mm-ease), background var(--mm-ease);
}
.mm-eye-btn:hover {
  color: var(--mm-text);
  background: var(--mm-faint);
}

/* Input with currency prefix */
.mm-input-prefix-wrap {
  display: flex;
  align-items: stretch;
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  box-shadow: 0 0 0 1.5px var(--mm-faint);
  overflow: hidden;
  transition: box-shadow var(--mm-ease);
}
.mm-input-prefix-wrap:focus-within {
  box-shadow: 0 0 0 2px var(--mm-blue);
}
.mm-input-prefix {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-muted);
  background: var(--mm-faint);
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.mm-input--prefixed {
  box-shadow: none;
  border-radius: 0 var(--mm-radius) var(--mm-radius) 0;
}
.mm-input--prefixed:focus,
.mm-input--prefixed:hover:not(:focus) { box-shadow: none; }

/* Field hints & read-only values */
.mm-field-hint {
  font-size: 12px;
  color: var(--mm-muted);
  margin-top: 5px;
  line-height: 1.4;
}

.mm-field-value {
  font-size: 14px;
  color: var(--mm-text);
  margin: 0;
  padding: 10px 14px;
  background: var(--mm-hairline);
  border-radius: var(--mm-radius);
}

/* Password strength */
.mm-password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}
.mm-strength-bar {
  flex: 1;
  height: 4px;
  background: var(--mm-faint);
  border-radius: 4px;
  overflow: hidden;
}
.mm-strength-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 280ms ease, background 280ms ease;
}
.mm-strength-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mm-muted);
  min-width: 42px;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.mm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--mm-radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--mm-ease),
    box-shadow var(--mm-ease),
    transform var(--mm-ease);
  -webkit-user-select: none;
  user-select: none;
}

.mm-btn:active { transform: scale(0.97); }
.mm-btn:focus-visible {
  outline: 2px solid var(--mm-blue);
  outline-offset: 2px;
}

/* Primary */
.mm-btn--primary {
  background: var(--mm-blue);
  color: #fff;
}
.mm-btn--primary:hover {
  background: var(--mm-blue-dark);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* Accent (used sparingly — settings button only) */
.mm-btn--accent {
  background: var(--mm-accent);
  color: #fff;
}
.mm-btn--accent:hover {
  background: var(--mm-accent-dark);
  box-shadow: 0 4px 12px rgba(106, 24, 39, 0.25);
}

/* Ghost */
.mm-btn--ghost {
  background: var(--mm-bg);
  color: var(--mm-text);
  box-shadow: 0 0 0 1.5px var(--mm-faint);
}
.mm-btn--ghost:hover {
  background: var(--mm-faint);
  box-shadow: 0 0 0 1.5px var(--mm-subtle);
}

/* Danger ghost */
.mm-btn--danger {
  background: var(--mm-s-overrun-bg);
  color: var(--mm-s-overrun);
}
.mm-btn--danger:hover {
  background: var(--mm-s-overrun);
  color: #fff;
}

/* Modifiers */
.mm-btn--full { width: 100%; }
.mm-btn--sm   { padding: 7px 14px; font-size: 12px; }
.mm-btn--lg   { padding: 13px 26px; font-size: 15px; }

.mm-btn[disabled],
.mm-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

/* Link button (inline text) */
.mm-link-btn {
  background: none;
  border: none;
  color: var(--mm-blue);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(37, 99, 235, 0.4);
  transition: text-decoration-color var(--mm-ease);
}
.mm-link-btn:hover {
  text-decoration-color: var(--mm-blue);
}

/* Book trigger — full-width prominent CTA */
.mm-book-trigger {
  width: 100%;
  padding: 11px 20px;
  font-size: 14px;
  margin-bottom: 14px;
  border-radius: var(--mm-radius);
}

/* Back nav button */
.mm-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--mm-blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  transition: gap var(--mm-ease), opacity var(--mm-ease);
}
.mm-back-btn:hover { gap: 10px; }

/* Loading spinner inside button */
.mm-btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
  animation: mm-spin 0.6s linear infinite;
}
.mm-btn--ghost .mm-btn-spinner,
.mm-btn--danger .mm-btn-spinner {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--mm-text);
}

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

/* ═══════════════════════════════════════════════════════════
   NOTICES / ALERTS
═══════════════════════════════════════════════════════════ */
.mm-notice {
  border-radius: var(--mm-radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 14px;
}
.mm-notice:last-child { margin-bottom: 0; }

.mm-notice--error   { background: var(--mm-s-overrun-bg); color: #b91c1c; }
.mm-notice--success { background: var(--mm-s-done-bg);    color: #15803d; }
.mm-notice--info    { background: var(--mm-blue-light);   color: var(--mm-blue); }
.mm-notice--warn    { background: var(--mm-s-process-bg); color: #b45309; }

/* Booking confirmed banner (top of portal after redirect) */
#mm-patient-portal > .mm-notice--success:first-child {
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  border-left: 4px solid var(--mm-s-done);
}

/* ═══════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════ */
.mm-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mm-badge--approved { background: var(--mm-s-done-bg);    color: #15803d; }
.mm-badge--pending  { background: var(--mm-s-pending-bg); color: var(--mm-muted); }
.mm-badge--rejected { background: var(--mm-s-overrun-bg); color: #b91c1c; }

.mm-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   PORTAL TOP BAR
═══════════════════════════════════════════════════════════ */
.mm-portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--mm-surface);
  border-radius: var(--mm-radius);
  box-shadow: var(--mm-shadow-sm);
  padding: 14px 22px;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.mm-portal-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mm-greeting-text {
  font-size: 15px;
  color: var(--mm-text);
}

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

/* ═══════════════════════════════════════════════════════════
   PATIENT PORTAL GRID
═══════════════════════════════════════════════════════════ */
.mm-portal-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}

.mm-portal-main   { min-width: 0; }
.mm-portal-sidebar { min-width: 0; }

/* ═══════════════════════════════════════════════════════════
   STATUS CARD (pending / rejected screens)
═══════════════════════════════════════════════════════════ */
.mm-status-card {
  background: var(--mm-surface);
  border-radius: var(--mm-radius-lg);
  box-shadow: var(--mm-shadow);
  max-width: 440px;
  margin: 40px auto;
  padding: 48px 36px;
  text-align: center;
}

.mm-status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.mm-status-icon--pending  { background: var(--mm-s-process-bg); color: var(--mm-s-process); }
.mm-status-icon--rejected { background: var(--mm-s-overrun-bg); color: var(--mm-s-overrun); }
.mm-status-icon--approved { background: var(--mm-s-done-bg);    color: var(--mm-s-done); }

.mm-status-title { font-size: 20px; font-weight: 700; margin-bottom: 14px; }
.mm-status-body  { font-size: 14px; color: var(--mm-muted); margin-bottom: 10px; line-height: 1.6; }
.mm-status-hint  { font-size: 13px; color: var(--mm-subtle); margin-bottom: 28px; }

/* ═══════════════════════════════════════════════════════════
   QR CARD
═══════════════════════════════════════════════════════════ */
.mm-qr-card {
  background: var(--mm-surface);
  border-radius: var(--mm-radius);
  box-shadow: var(--mm-shadow-sm);
  padding: 22px;
  text-align: center;
  position: sticky;
  top: 24px;
}

.mm-qr-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.mm-qr-hint {
  font-size: 12px;
  color: var(--mm-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.mm-qr-canvas {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.mm-qr-canvas canvas {
  border-radius: var(--mm-radius);
  display: block;
}

.mm-qr-ref {
  font-family: var(--mm-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-blue);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.mm-qr-datetime {
  font-size: 12px;
  color: var(--mm-muted);
}

.mm-qr-empty {
  font-size: 13px;
  color: var(--mm-subtle);
  margin-top: 8px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   BOOKING CARDS (my appointments list)
═══════════════════════════════════════════════════════════ */
.mm-bookings-list { display: flex; flex-direction: column; gap: 10px; }

.mm-booking-card {
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: background var(--mm-ease);
}

.mm-booking-card:hover { background: var(--mm-hairline); }

.mm-booking-card-meta { flex: 1; min-width: 0; }

.mm-booking-card-ref {
  font-family: var(--mm-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--mm-muted);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.mm-booking-card-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
  margin-bottom: 2px;
}

.mm-booking-card-desc {
  font-size: 12px;
  color: var(--mm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-booking-card-price {
  font-size: 11px;
  font-weight: 600;
  color: var(--mm-text);
  margin-top: 4px;
}

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

.mm-bookings-empty {
  text-align: center;
  color: var(--mm-muted);
  font-size: 14px;
  padding: 32px 0;
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
}

/* ═══════════════════════════════════════════════════════════
   MINI CALENDAR (inside booking modal)
═══════════════════════════════════════════════════════════ */
.mm-mini-cal { user-select: none; }

.mm-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mm-cal-nav-btn {
  background: var(--mm-bg);
  border: none;
  border-radius: var(--mm-radius);
  padding: 6px 11px;
  cursor: pointer;
  color: var(--mm-text);
  font-size: 18px;
  line-height: 1;
  transition: background var(--mm-ease), color var(--mm-ease);
}
.mm-cal-nav-btn:hover { background: var(--mm-faint); }

.mm-cal-month { font-size: 15px; font-weight: 700; }

.mm-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.mm-cal-dow {
  font-size: 10px;
  font-weight: 700;
  color: var(--mm-subtle);
  text-align: center;
  padding: 5px 0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.mm-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--mm-radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--mm-ease), color var(--mm-ease);
}

.mm-cal-day:hover:not(.mm-cal-day--disabled):not(.mm-cal-day--blocked):not(.mm-cal-day--selected) {
  background: var(--mm-blue-light);
  color: var(--mm-blue);
}

.mm-cal-day--today:not(.mm-cal-day--selected) {
  color: var(--mm-blue);
  font-weight: 700;
}

.mm-cal-day--selected {
  background: var(--mm-blue);
  color: #fff;
  font-weight: 700;
}

.mm-cal-day--disabled {
  color: var(--mm-faint);
  cursor: default;
}

.mm-cal-day--blocked {
  background: var(--mm-s-overrun-bg);
  color: #dc2626;
  cursor: default;
}

.mm-cal-day--empty { pointer-events: none; }

.mm-booking-days-hint {
  font-size: 12px;
  color: var(--mm-muted);
  margin-top: 12px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   SLOT GRID
═══════════════════════════════════════════════════════════ */
.mm-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 7px;
}

.mm-slot-btn {
  padding: 10px 4px;
  border-radius: var(--mm-radius);
  border: none;
  background: var(--mm-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
  cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--mm-faint);
  text-align: center;
  transition: background var(--mm-ease), color var(--mm-ease), box-shadow var(--mm-ease), transform var(--mm-ease);
}

.mm-slot-btn:hover:not(.mm-slot-btn--taken):not(.mm-slot-btn--selected) {
  background: var(--mm-blue-light);
  color: var(--mm-blue);
  box-shadow: 0 0 0 1.5px var(--mm-blue);
  transform: translateY(-1px);
}

.mm-slot-btn--selected {
  background: var(--mm-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.mm-slot-btn--taken {
  background: var(--mm-hairline);
  color: var(--mm-subtle);
  cursor: not-allowed;
  opacity: 0.5;
  text-decoration: line-through;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════
   BOOKING MODAL STEPS
═══════════════════════════════════════════════════════════ */
.mm-booking-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--mm-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
}

.mm-booking-summary {
  background: var(--mm-blue-faint);
  border-radius: var(--mm-radius);
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--mm-blue);
  line-height: 1.4;
}

.mm-booking-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--mm-hairline);
  margin-top: 8px;
  font-size: 14px;
  color: var(--mm-muted);
}

.mm-booking-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--mm-blue);
  font-variant-numeric: tabular-nums;
}

.mm-booking-payment-note {
  font-size: 12px;
  color: var(--mm-muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   PUBLIC CALENDAR GRID
═══════════════════════════════════════════════════════════ */
.mm-public-cal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.mm-pub-day-card {
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  padding: 14px;
  transition: background var(--mm-ease);
}

.mm-pub-day-card:hover { background: var(--mm-hairline); }

.mm-pub-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--mm-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.mm-pub-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.mm-pub-slot {
  padding: 5px 4px;
  border-radius: var(--mm-radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mm-pub-slot--available   { background: var(--mm-s-done-bg);    color: #15803d; }
.mm-pub-slot--unavailable { background: var(--mm-hairline);      color: var(--mm-subtle); text-decoration: line-through; }

/* ═══════════════════════════════════════════════════════════
   PROGRESS INDICATOR
═══════════════════════════════════════════════════════════ */
.mm-progress-bar-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
  margin-bottom: 16px;
  border-radius: var(--mm-radius);
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--mm-faint) transparent;
}

/* Staff version — the INNER track scrolls, so the wrapper must not clip it */
#mm-staff-progress .mm-progress-bar-wrap {
  overflow: visible;
  padding-bottom: 0;
}
.mm-progress-bar-wrap::-webkit-scrollbar { height: 4px; }
.mm-progress-bar-wrap::-webkit-scrollbar-track { background: transparent; }
.mm-progress-bar-wrap::-webkit-scrollbar-thumb { background: var(--mm-faint); border-radius: 4px; }

.mm-progress-track {
  display: flex;
  align-items: stretch;
  gap: 3px;
  min-width: 600px;
  height: 58px;
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  padding: 6px;
  position: relative;
}

.mm-progress-slot {
  flex: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  min-width: 44px;
  cursor: default;
  position: relative;
  transition: transform var(--mm-ease), box-shadow var(--mm-ease);
}

.mm-progress-slot:hover {
  transform: scaleY(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1;
}

.mm-progress-slot-ref {
  font-family: var(--mm-mono);
  font-size: 9px;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.02em;
}

.mm-progress-slot-time {
  font-size: 9px;
  opacity: 0.85;
  margin-top: 2px;
  font-family: var(--mm-mono);
  font-variant-numeric: tabular-nums;
}

.mm-progress-slot--available {
  background: var(--mm-hairline);
  color: var(--mm-subtle);
}

/* Delayed indicator flag */
.mm-progress-slot--delayed::before {
  content: '';
  position: absolute;
  top: -4px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--mm-accent);
  border-radius: 50%;
  border: 1.5px solid var(--mm-white);
}

/* Patient's own slot */
.mm-progress-slot[style*="outline"] {
  outline: 2.5px solid var(--mm-accent) !important;
  outline-offset: 1px;
  z-index: 2;
}

/* "Now" marker line */
.mm-progress-now-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--mm-accent);
  border-radius: 2px;
  pointer-events: none;
  z-index: 10;
  /* left: set in px by JS — works inside scrolling flex container */
}

.mm-progress-now-marker::before {
  content: 'NOW';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 800;
  color: var(--mm-accent);
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: var(--mm-surface, #fff);
  padding: 0 2px;
  border-radius: 2px;
}

.mm-progress-loading {
  color: var(--mm-muted);
  font-size: 13px;
  margin: auto;
}

/* Legend */
.mm-progress-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.mm-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mm-muted);
}

.mm-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   STAFF AGENDA TABLE
═══════════════════════════════════════════════════════════ */
.mm-agenda-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.mm-agenda-controls .mm-label { margin-bottom: 0; }

.mm-input--date { width: auto; min-width: 150px; }

/* Table */
.mm-table-wrap {
  overflow-x: auto;
  border-radius: var(--mm-radius);
  scrollbar-width: thin;
  scrollbar-color: var(--mm-faint) transparent;
}

.mm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}

.mm-table thead tr {
  background: var(--mm-bg);
}

.mm-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mm-muted);
  white-space: nowrap;
}

.mm-table thead th:first-child { border-radius: var(--mm-radius-sm) 0 0 0; }
.mm-table thead th:last-child  { border-radius: 0 var(--mm-radius-sm) 0 0; }

.mm-table tbody tr {
  border-top: 1px solid var(--mm-hairline);
  transition: background var(--mm-ease);
}

.mm-table tbody tr:hover { background: var(--mm-bg); }

.mm-table tbody td {
  padding: 12px 14px;
  color: var(--mm-text);
  vertical-align: middle;
}

.mm-table-empty {
  text-align: center;
  color: var(--mm-muted);
  padding: 40px 20px !important;
  font-size: 14px;
}

.mm-table .mm-mono-cell {
  font-family: var(--mm-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.mm-table .mm-time--delayed {
  color: var(--mm-s-overrun);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   APPROVALS
═══════════════════════════════════════════════════════════ */
.mm-approvals-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.mm-filter-btn {
  padding: 7px 16px;
  border-radius: var(--mm-radius);
  border: none;
  background: var(--mm-bg);
  color: var(--mm-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--mm-faint);
  transition: background var(--mm-ease), color var(--mm-ease), box-shadow var(--mm-ease);
}

.mm-filter-btn--active {
  background: var(--mm-blue);
  color: #fff;
  box-shadow: none;
}

.mm-filter-btn:hover:not(.mm-filter-btn--active) {
  background: var(--mm-faint);
  color: var(--mm-text);
}

/* ═══════════════════════════════════════════════════════════
   BLOCKED DATES
═══════════════════════════════════════════════════════════ */
.mm-blocked-controls { margin-bottom: 22px; }

/* ═══════════════════════════════════════════════════════════
   STATUS BUTTONS (inside update modal)
═══════════════════════════════════════════════════════════ */
.mm-status-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 9px;
  margin-bottom: 20px;
}

.mm-status-btn {
  padding: 12px 8px;
  border-radius: var(--mm-radius);
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  background: color-mix(in srgb, var(--s-color) 10%, #fff);
  color: var(--s-color);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--s-color) 25%, transparent);
  transition: background var(--mm-ease), box-shadow var(--mm-ease), color var(--mm-ease), transform var(--mm-ease);
}

.mm-status-btn:hover,
.mm-status-btn--active {
  background: var(--s-color);
  color: #fff;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--s-color) 30%, transparent);
  transform: translateY(-1px);
}

.mm-modal-ref {
  font-family: var(--mm-mono);
  font-size: 12px;
  color: var(--mm-muted);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */
.mm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: mm-overlay-in 150ms ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

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

.mm-modal {
  background: var(--mm-white);
  border-radius: var(--mm-radius-lg);
  box-shadow: var(--mm-shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: mm-modal-in 220ms var(--mm-spring);
}

.mm-modal--wide { max-width: 600px; }

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

.mm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
  flex-shrink: 0;
}

.mm-modal-title {
  font-size: 16px;
  font-weight: 700;
}

.mm-modal-close {
  background: none;
  border: none;
  color: var(--mm-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--mm-radius-sm);
  display: flex;
  align-items: center;
  transition: background var(--mm-ease), color var(--mm-ease);
}
.mm-modal-close:hover {
  background: var(--mm-faint);
  color: var(--mm-text);
}

.mm-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.mm-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--mm-hairline);
  flex-shrink: 0;
}

.mm-modal-footer--settings {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mm-modal-footer--settings .mm-btn--ghost {
  margin-right: auto; /* pin Cancel to the left */
}

/* Prevent body scroll when modal open */
body.mm-modal-open { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════
   SKELETON LOADERS
═══════════════════════════════════════════════════════════ */
.mm-skeleton {
  background: linear-gradient(
    90deg,
    var(--mm-hairline) 25%,
    var(--mm-faint)    50%,
    var(--mm-hairline) 75%
  );
  background-size: 200% 100%;
  animation: mm-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--mm-radius);
}

.mm-skeleton--card { height: 66px; }

@keyframes mm-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════════════════════ */
.mm-divider {
  border: none;
  border-top: 1px solid var(--mm-hairline);
  margin: 18px 0;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .mm-portal-grid {
    grid-template-columns: 1fr;
  }

  .mm-portal-sidebar { order: -1; }

  .mm-qr-card { position: static; }

  .mm-public-cal {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  .mm-field-row { grid-template-columns: 1fr; gap: 0; }

  .mm-staff-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .mm-tab-btn { padding: 12px 10px; font-size: 12px; flex-shrink: 0; }

  /* Hide less critical table columns */
  .mm-table thead th:nth-child(4),
  .mm-table tbody td:nth-child(4),
  .mm-table thead th:nth-child(5),
  .mm-table tbody td:nth-child(5) {
    display: none;
  }

  .mm-modal { border-radius: var(--mm-radius); }
  .mm-modal--wide { max-width: 100%; }

  .mm-status-btn-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .mm-wrap { padding: 14px 0; }

  .mm-section { padding: 18px 14px; }

  .mm-portal-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
  }

  .mm-tab-panel { padding: 18px 14px 22px; }

  .mm-auth-card { border-radius: var(--mm-radius); }

  .mm-status-card { padding: 36px 20px; margin: 20px auto; }

  .mm-public-cal { grid-template-columns: 1fr 1fr; }

  .mm-modal-overlay { padding: 10px; align-items: flex-end; }

  .mm-modal {
    max-height: 96vh;
    border-radius: var(--mm-radius-lg) var(--mm-radius-lg) 0 0;
    animation: mm-modal-up 220ms var(--mm-spring);
  }

  @keyframes mm-modal-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .mm-modal-header { padding: 18px 16px 0; }
  .mm-modal-body   { padding: 18px 16px; }
  .mm-modal-footer { padding: 12px 16px 18px; }

  .mm-slots-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }

  .mm-booking-price { font-size: 20px; }

  .mm-progress-track { min-width: 480px; height: 52px; }

  .mm-table thead th:nth-child(3),
  .mm-table tbody td:nth-child(3) { display: none; }

  .mm-staff-panel { padding: 16px; }

  .mm-agenda-controls { gap: 10px; }
}

@media (max-width: 360px) {
  .mm-public-cal { grid-template-columns: 1fr; }
  .mm-tab-btn    { font-size: 11px; padding: 11px 8px; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT (QR code page)
═══════════════════════════════════════════════════════════ */
@media print {
  .mm-portal-topbar,
  .mm-book-trigger,
  .mm-section:not(.mm-qr-print),
  .mm-portal-main { display: none !important; }

  .mm-portal-grid  { grid-template-columns: 1fr; }
  .mm-qr-card      { box-shadow: none; position: static; max-width: 300px; margin: 0 auto; }
}

/* ═══════════════════════════════════════════════════════════
   FOCUS VISIBLE (accessibility)
═══════════════════════════════════════════════════════════ */
.mm-input:focus-visible,
.mm-btn:focus-visible,
.mm-slot-btn:focus-visible,
.mm-cal-day:focus-visible,
.mm-tab-btn:focus-visible {
  outline: 2px solid var(--mm-blue);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   MOTION REDUCTION
═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   SUPPLEMENTAL — classes identified during final audit
═══════════════════════════════════════════════════════════ */

/* Booking wizard steps (show/hide via JS) */
.mm-booking-step { }

/* Inline button text (toggled during loading state) */
.mm-btn-text { }

/* Profile read-only fields block */
.mm-profile-readonly {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--mm-hairline);
}

/* Progress date inline label */
.mm-progress-date {
  font-size: 13px;
  font-weight: 400;
  color: var(--mm-muted);
  margin-left: 8px;
}

/* Greeting badge (approved patient label in top bar) */
.mm-greeting-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--mm-s-done-bg);
  color: #15803d;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   STAFF AGENDA — date navigation
═══════════════════════════════════════════════════════════ */
.mm-agenda-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.mm-agenda-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.mm-agenda-date-nav .mm-input--date {
  width: 150px;
  flex-shrink: 0;
}

.mm-agenda-day-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-text);
  margin-left: 2px;
  white-space: nowrap;
}

.mm-td-desc {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   STAFF CALENDAR
═══════════════════════════════════════════════════════════ */
.mm-staff-cal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: nowrap;
}

.mm-staff-cal-month-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--mm-text);
  min-width: 180px;
  flex-shrink: 0;
}

.mm-staff-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

/* Day-of-week headers */
.mm-staff-cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--mm-subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 6px 0;
}

/* Calendar day cells */
.mm-staff-cal-day {
  min-height: 90px;
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  padding: 7px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--mm-ease);
  position: relative;
}

.mm-staff-cal-day--empty {
  background: transparent;
  pointer-events: none;
}

.mm-staff-cal-day--weekend {
  background: var(--mm-hairline);
  opacity: 0.6;
}

.mm-staff-cal-day--past {
  opacity: 0.65;
}

.mm-staff-cal-day--bookable {
  cursor: pointer;
}

.mm-staff-cal-day--bookable:hover {
  background: var(--mm-blue-faint);
}

.mm-staff-cal-day--today {
  background: var(--mm-blue-light);
}

.mm-staff-cal-day--today .mm-staff-cal-date-num {
  color: var(--mm-blue);
  font-weight: 700;
}

.mm-staff-cal-date-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
  line-height: 1;
  margin-bottom: 3px;
}

.mm-staff-cal-pills {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

/* Booking pill inside calendar cell */
.mm-cal-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity var(--mm-ease);
}

.mm-cal-pill:hover { opacity: 0.85; }

.mm-cal-pill-time {
  font-family: var(--mm-mono);
  font-size: 9px;
  opacity: 0.9;
  flex-shrink: 0;
}

.mm-cal-pill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.mm-cal-pill-more {
  font-size: 10px;
  font-weight: 700;
  color: var(--mm-muted);
  padding: 1px 4px;
}

.mm-staff-cal-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--mm-hairline);
}

/* ═══════════════════════════════════════════════════════════
   STAFF PROGRESS — tab header
═══════════════════════════════════════════════════════════ */
.mm-staff-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* Taller staff progress track to fit patient name */
.mm-progress-track--staff {
  height: 72px;
}

.mm-progress-slot--staff {
  gap: 1px;
}

.mm-progress-slot-name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
  text-align: center;
  opacity: 0.95;
}

/* ═══════════════════════════════════════════════════════════
   STAFF PROGRESS — queue cards below timeline
═══════════════════════════════════════════════════════════ */
.mm-staff-queue-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mm-progress-card {
  background: var(--mm-bg);
  border-radius: var(--mm-radius);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-shadow: var(--mm-shadow-xs);
  transition: box-shadow var(--mm-ease);
}

.mm-progress-card:hover {
  box-shadow: var(--mm-shadow-sm);
}

.mm-progress-card-bar {
  width: 4px;
  flex-shrink: 0;
  border-radius: var(--mm-radius) 0 0 var(--mm-radius);
}

.mm-progress-card-body {
  flex: 1;
  padding: 10px 12px;
  min-width: 0;
}

.mm-progress-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--mm-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-progress-card-ref {
  font-family: var(--mm-mono);
  font-size: 11px;
  color: var(--mm-muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.mm-progress-card-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
  font-variant-numeric: tabular-nums;
}

.mm-progress-card-orig {
  color: var(--mm-subtle);
  text-decoration: line-through;
  margin-right: 4px;
  font-size: 12px;
}

.mm-progress-card-est {
  color: var(--mm-s-overrun);
  font-weight: 700;
}

.mm-progress-card-actions {
  display: flex;
  align-items: center;
  padding: 0 10px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — staff calendar on small screens
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mm-staff-cal-day { min-height: 64px; }
  .mm-staff-cal-date-num { font-size: 12px; }
  .mm-cal-pill { font-size: 9px; }
  .mm-cal-pill-time { display: none; }
  .mm-staff-queue-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .mm-staff-cal-grid { gap: 2px; }
  .mm-staff-cal-day { min-height: 52px; padding: 4px 3px; }
  .mm-staff-cal-date-num { font-size: 11px; }
  .mm-cal-pill { display: none; } /* Too small — show count only */
  .mm-cal-pill-more { display: block; font-size: 9px; }
  .mm-staff-queue-cards { grid-template-columns: 1fr; }
  .mm-agenda-date-nav { flex-wrap: wrap; }
  .mm-agenda-day-label { width: 100%; margin-left: 0; margin-top: 4px; }
  .mm-progress-track--staff { height: 60px; }
}

/* ═══════════════════════════════════════════════════════════
   QUEUE — Time-label row above the booking track
═══════════════════════════════════════════════════════════ */
.mm-queue-time-row {
  display: flex;
  flex-direction: row;
  gap: 4px;
  overflow-x: hidden; /* scrollLeft synced by JS to match track */
  overflow-y: visible;
  padding: 0 6px;
  margin-bottom: 2px;
  pointer-events: none;
}

.mm-queue-time-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--mm-muted);
  font-family: var(--mm-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  text-align: center;
  /* Must match SLOT_W in JS (110px) */
  min-width: 110px;
  width: 110px;
  flex-shrink: 0;
  height: 18px;
}

.mm-queue-time-overrun {
  color: var(--mm-s-overrun);
  font-size: 9px;
  margin-left: 2px;
}

/* Staff progress track — scrollable, fixed-height, positions Now marker */
.mm-progress-track--staff {
  height: 80px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--mm-faint) transparent;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  gap: 4px;
  cursor: grab;
  position: relative; /* so absolute Now marker is positioned within track */
}

.mm-progress-track--staff:active {
  cursor: grabbing;
}

.mm-progress-track--staff::-webkit-scrollbar { height: 4px; }
.mm-progress-track--staff::-webkit-scrollbar-track { background: transparent; }
.mm-progress-track--staff::-webkit-scrollbar-thumb { background: var(--mm-faint); border-radius: 4px; }

/* Fixed-width slots — must match SLOT_W = 110 in JS */
.mm-progress-slot--staff {
  min-width: 110px;
  width: 110px;
  flex: none;
  height: 64px;
  padding: 6px 4px;
  gap: 2px;
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════
   PATIENT PORTAL — delay notice on booking card
═══════════════════════════════════════════════════════════ */
.mm-booking-card--delayed {
  border-left: 3px solid var(--mm-s-overrun) !important;
}

.mm-booking-card-delay {
  font-size: 12px;
  color: var(--mm-s-overrun);
  margin-top: 3px;
  font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════
   PAYMENT TYPE BADGES (v1.4)
═══════════════════════════════════════════════════════════ */
.mm-badge--medaid {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.mm-badge--private {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════
   PAYMENT TYPE TOGGLE
═══════════════════════════════════════════════════════════ */
.mm-payment-toggle {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.mm-payment-option {
  flex: 1;
  cursor: pointer;
}

.mm-payment-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mm-payment-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 2px solid var(--mm-border);
  border-radius: var(--mm-radius);
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}

.mm-payment-option input[type="radio"]:checked + .mm-payment-label {
  border-color: var(--mm-blue);
  background: #eff6ff;
  color: var(--mm-blue);
}

/* ═══════════════════════════════════════════════════════════
   MEDICAL AID FIELDS
═══════════════════════════════════════════════════════════ */
.mm-medaid-fields {
  border-left: 3px solid #bfdbfe;
  padding-left: 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   BOOKING CARD ACTIONS (invoice button)
═══════════════════════════════════════════════════════════ */
.mm-booking-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mm-btn--xs {
  font-size: 12px;
  padding: 4px 10px;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════
   PATIENT ID CARD (business card)
═══════════════════════════════════════════════════════════ */
.mm-patient-id-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  padding: 14px 14px 10px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  /* Business card 3.5:2 aspect ratio */
  aspect-ratio: 3.5 / 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mm-patient-id-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 5px;
  background: #3b82f6;
}

.mm-pid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.mm-pid-logo-area {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  letter-spacing: .03em;
}

.mm-pid-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
}

.mm-pid-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 6px 0;
}

.mm-pid-body--centered {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.mm-pid-left {
  flex-shrink: 0;
}

.mm-pid-qr {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.mm-pid-qr img,
.mm-pid-qr canvas {
  width: 72px !important;
  height: 72px !important;
  display: block;
}

.mm-pid-right {
  flex: 1;
  min-width: 0;
}

.mm-pid-name {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  letter-spacing: 0.02em;
}

.mm-pid-medaid {
  font-size: 10px;
  color: #93c5fd;
  margin: 0 0 1px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-pid-private {
  color: #94a3b8 !important;
}

.mm-pid-medaid-nr {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  font-family: var(--mm-mono);
  margin: 0 0 4px;
}

.mm-pid-status {
  display: inline-block;
  background: #22c55e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mm-pid-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 6px;
}

.mm-pid-ref {
  font-size: 9px;
  color: rgba(255,255,255,.4);
  font-family: var(--mm-mono);
}

.mm-btn--download-card {
  width: 100%;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   INVOICE STYLES
═══════════════════════════════════════════════════════════ */
.mm-invoice {
  font-family: var(--mm-sans, sans-serif);
}

.mm-invoice-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--mm-border);
}

.mm-invoice-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.mm-invoice-ref {
  font-size: 13px;
  color: var(--mm-muted);
  font-family: var(--mm-mono);
}

.mm-invoice-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--mm-blue);
}

.mm-invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
}

.mm-invoice-table th {
  background: var(--mm-faint);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--mm-border);
}

.mm-invoice-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--mm-faint);
}

.mm-invoice-table td:first-child {
  color: var(--mm-muted);
  width: 40%;
}

.mm-invoice-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--mm-text, #1e293b);
  color: #fff;
  padding: 14px 16px;
  border-radius: var(--mm-radius);
  margin-bottom: 12px;
  font-weight: 600;
}

.mm-invoice-amount {
  font-size: 20px;
  font-weight: 700;
}

.mm-invoice-footer {
  font-size: 12px;
  color: var(--mm-subtle);
  text-align: center;
  margin-top: 8px;
}


/* ═══════════════════════════════════════════════════════════
   BLOCKOUT BUILDER (v1.4)
═══════════════════════════════════════════════════════════ */
.mm-blockout-builder {
  background: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg, 12px);
  padding: 20px;
  width: 100%;
}

.mm-blockout-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 14px;
}

.mm-blockout-type-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.mm-blockout-hint {
  font-size: 12px;
  color: var(--mm-muted);
  margin: 0 0 12px;
}

/* Blockout calendar — reuses mm-staff-cal-* base styles */
.mm-blockout-cal {
  margin-bottom: 10px;
}

/* Hover state for selectable blockout cells */
.mm-blockout-day:not(.mm-cal-day--disabled):not(.mm-blockout-day--selected):hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* Selected (blocked) state */
.mm-blockout-day--selected {
  background: #dc2626 !important;
  color: #fff !important;
}

.mm-blockout-day--selected .mm-staff-cal-date-num {
  color: #fff !important;
}

.mm-blockout-day--weekend {
  background: var(--mm-hairline);
  opacity: 0.6;
}

.mm-blockout-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

.mm-blockout-selected-label {
  font-weight: 600;
}

.mm-btn-link {
  background: none;
  border: none;
  color: var(--mm-blue);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}

.mm-blockout-slots-grid {
  margin-bottom: 12px;
}

/* Slot select buttons in blockout */
.mm-slots-grid--blockout {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mm-blockout-slot-btn {
  padding: 5px 10px;
  font-size: 12px;
  border: 1.5px solid var(--mm-border);
  border-radius: 6px;
  background: var(--mm-surface);
  cursor: pointer;
  font-family: var(--mm-mono);
  transition: border-color .12s, background .12s;
}

.mm-blockout-slot-btn:hover {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #b91c1c;
}

.mm-blockout-slot-btn.mm-slot-btn--selected {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

/* Appointment area compact (v1.4) */
.mm-book-trigger {
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
}

#mm-patient-portal .mm-section {
  padding: 16px;
}
