/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg-page:      #F0F4F8;
  --bg-surface:   #FFFFFF;
  --bg-subtle:    #F8FAFC;
  --bg-input:     #F1F5F9;

  /* Azure – primary medical accent */
  --accent:       #0066FF;
  --accent-dark:  #0052CC;
  --accent-soft:  #EFF6FF;
  --accent-mid:   #BFDBFE;
  --accent-glow:  rgba(0, 102, 255, 0.12);

  /* Text scale */
  --text-900:     #0F172A;
  --text-700:     #334155;
  --text-600:     #475569;
  --text-400:     #94A3B8;

  /* Borders */
  --border-lo:    #E2E8F0;
  --border-mid:   #CBD5E1;

  /* User bubble */
  --user-a:       #0066FF;
  --user-b:       #004ECB;

  /* Emerald – success / confirmed */
  --green:        #10B981;
  --green-mid:    #34D399;
  --green-bg:     #ECFDF5;
  --green-border: #A7F3D0;
  --green-text:   #065F46;

  /* Error */
  --red:          #EF4444;
  --red-bg:       #FEF2F2;

  /* Sidebar (dark navy) */
  --sb-bg:        #0A1628;
  --sb-text:      rgba(255, 255, 255, 0.65);
  --sb-text-dim:  rgba(255, 255, 255, 0.32);
  --sb-hover:     rgba(255, 255, 255, 0.06);
  --sb-active-bg: rgba(0, 102, 255, 0.18);
  --sb-active-tx: #93C5FD;
  --sb-border:    rgba(255, 255, 255, 0.07);

  /* Radii */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-2xl:  24px;
  --r-pill: 9999px;

  /* Shadows */
  --sh-xs:   0 1px 2px rgba(15, 23, 42, .05);
  --sh-sm:   0 1px 6px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --sh-md:   0 4px 16px rgba(15, 23, 42, .08), 0 1px 4px rgba(15, 23, 42, .04);
  --sh-card: 0 2px 10px rgba(0, 102, 255, .07), 0 1px 3px rgba(15, 23, 42, .05);
  --sh-lift: 0 8px 28px rgba(0, 102, 255, .14), 0 2px 8px rgba(15, 23, 42, .08);
  --sh-user: 0 4px 14px rgba(0, 102, 255, .34);
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-900);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Mobile sidebar overlay ────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.52);
  z-index: 25;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.sidebar-overlay.overlay--visible {
  opacity: 1;
}

/* ── App Shell ─────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  z-index: 30;
  transition: transform 0.28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-inner {
  padding: 20px 14px 20px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--sb-border);
  position: relative;
}

.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(140deg, var(--accent), var(--accent-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 102, 255, .38);
}
.logo-mark svg { width: 17px; height: 17px; }

.logo-text { flex: 1; min-width: 0; }

.logo-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.2px;
}
.logo-sub {
  font-size: 0.61rem;
  color: var(--sb-text-dim);
  letter-spacing: 0.2px;
  margin-top: 2px;
}

/* Sidebar close button (mobile only) */
.sidebar-close {
  display: none;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--sb-border);
  background: var(--sb-hover);
  color: rgba(255, 255, 255, .55);
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .13s, color .13s;
}
.sidebar-close:hover {
  background: rgba(255, 255, 255, .1);
  color: white;
}

/* Sidebar sections */
.sidebar-section { margin-bottom: 8px; }

.sidebar-label {
  font-size: 0.59rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sb-text-dim);
  margin-bottom: 6px;
  padding: 0 10px;
}

.specialty-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.specialty-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sb-text);
  transition: background .13s, color .13s, transform .12s;
  user-select: none;
}
.specialty-item .sp-icon {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.specialty-item:hover {
  background: var(--sb-hover);
  color: #FFFFFF;
  transform: translateX(3px);
}
.specialty-item:active { transform: translateX(1px); }

/* Sidebar bottom */
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--sb-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-meta .sidebar-label { padding: 0; margin-bottom: 5px; }

.session-id-box {
  font-family: 'Cascadia Code', 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.59rem;
  color: var(--sb-text-dim);
  background: rgba(255, 255, 255, .04);
  padding: 7px 10px;
  border-radius: var(--r-sm);
  word-break: break-all;
  border: 1px solid var(--sb-border);
  line-height: 1.7;
}

.btn-new-session {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid rgba(0, 102, 255, .35);
  border-radius: var(--r-sm);
  background: rgba(0, 102, 255, .12);
  color: #93C5FD;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 600;
  font-family: inherit;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn-new-session:hover {
  background: rgba(0, 102, 255, .24);
  border-color: rgba(0, 102, 255, .55);
  color: #BFDBFE;
}
.btn-new-session:active { transform: scale(0.98); }

/* ── Sidebar scrollbar ─────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

/* ── Chat Main ─────────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
  min-width: 0;
}

/* ── Header ────────────────────────────────────────────────────── */
.chat-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-lo);
  padding: 0 22px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 8px rgba(15, 23, 42, .06);
  z-index: 10;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger — hidden on desktop */
.btn-menu-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-lo);
  background: var(--bg-subtle);
  color: var(--text-600);
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .14s;
}
.btn-menu-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--accent);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}

.header-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(140deg, var(--accent-soft), #DBEAFE);
  border: 1.5px solid var(--accent-mid);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.header-avatar svg { stroke: var(--accent); }

.header-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-900);
  letter-spacing: -0.15px;
}

.header-status {
  font-size: 0.7rem;
  color: var(--text-600);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border-mid);
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .18);
  animation: dot-pulse 2.8s ease-in-out infinite;
}
.status-dot.thinking {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  animation: dot-pulse 1s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(0.8); }
}

.header-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: var(--r-pill);
  padding: 3px 11px;
  white-space: nowrap;
}

/* ── Messages ──────────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 30px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 4px;
}

/* ── Message Rows ──────────────────────────────────────────────── */
.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 76%;
  animation: slide-up 0.2s cubic-bezier(.25, 1, .5, 1) both;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-row.ai-row   { align-self: flex-start; }
.message-row.user-row { align-self: flex-end; flex-direction: row-reverse; }

.message-row.row--wide {
  max-width: 96%;
}
.message-row.row--wide .bubble {
  width: 100%;
}

@media (min-width: 860px) {
  .row--wide .mbl-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 859px) {
  .row--wide .mbl-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Avatars ───────────────────────────────────────────────────── */
.avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.avatar.ai {
  background: linear-gradient(140deg, var(--accent-soft), #DBEAFE);
  border: 1.5px solid var(--accent-mid);
}
.avatar.user {
  background: linear-gradient(140deg, var(--user-a), var(--user-b));
}

/* ── Bubbles ───────────────────────────────────────────────────── */
.bubble {
  padding: 11px 15px;
  line-height: 1.65;
  font-size: 0.875rem;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
}

/* AI bubble */
.ai-row .bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-lo);
  border-left: 3px solid var(--accent);
  border-radius: 4px var(--r-lg) var(--r-lg) var(--r-lg);
  color: var(--text-900);
  box-shadow: var(--sh-sm);
}

/* User bubble */
.user-row .bubble {
  background: linear-gradient(140deg, var(--user-a), var(--user-b));
  border-radius: var(--r-lg) 4px var(--r-lg) var(--r-lg);
  color: #fff;
  white-space: pre-wrap;
  box-shadow: var(--sh-user);
}

.bubble strong { color: var(--accent); font-weight: 700; }
.user-row .bubble strong { color: #BAD8FF; }
.bubble em { color: var(--text-600); font-style: normal; }

/* ── Typing Indicator ──────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 5px 2px;
  align-items: center;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-mid);
  animation: bounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; background: var(--accent-mid); }
  30%            { transform: translateY(-6px); opacity: 1;   background: var(--accent); }
}

/* ── Doctor Cards ──────────────────────────────────────────────── */
.doctor-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.doctor-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-lo);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  box-shadow: var(--sh-sm);
}
.doctor-card:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--sh-lift);
  transform: translateY(-2px);
}

/* Specialty color stripe */
.dc-stripe {
  height: 3px;
  background: var(--accent);
  flex-shrink: 0;
}

/* Card inner padding */
.dc-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Top row: avatar + info + fee */
.dc-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.dc-avatar {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  /* Colors set inline via JS */
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1.5px solid var(--accent-mid);
}

.dc-main { flex: 1; min-width: 0; }

.dc-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.dc-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-900);
  letter-spacing: -0.1px;
}
.dc-fee {
  font-size: 0.87rem;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.dc-specialty {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  font-size: 0.61rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}

/* Detail rows */
.dc-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.dc-row {
  font-size: 0.77rem;
  color: var(--text-600);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 7px;
}
.dc-row .dc-icon { flex-shrink: 0; font-size: 0.8rem; }
.dc-slots {
  font-size: 0.7rem;
  color: var(--text-400);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: var(--r-xs);
  border: 1px solid var(--border-lo);
}

.dc-select-btn {
  padding: 9px 16px;
  background: linear-gradient(140deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.1px;
  transition: all .15s;
  text-align: center;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 102, 255, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.dc-select-btn:hover {
  background: linear-gradient(140deg, var(--accent-dark), #003FA3);
  box-shadow: 0 4px 14px rgba(0, 102, 255, .38);
  transform: translateY(-1px);
}
.dc-select-btn:active { transform: none; }

/* ── Slot Buttons ──────────────────────────────────────────────── */
.slot-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.slot-btn {
  padding: 8px 15px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-700);
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all .14s;
  box-shadow: var(--sh-xs);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.slot-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 10px var(--accent-glow);
  transform: translateY(-1px);
}
.slot-btn:active { transform: none; }

/* ── Booking Confirmed Card ────────────────────────────────────── */
.booking-confirmed-card {
  background: var(--bg-surface);
  border: 1px solid var(--green-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: var(--sh-sm);
}

.bc-header {
  background: var(--green-bg);
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--green-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.bc-icon {
  width: 40px; height: 40px;
  background: var(--green);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, .30);
}
.bc-icon svg { stroke: white; }

.bc-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--green-text);
  letter-spacing: -0.2px;
}

.bc-id {
  font-family: 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--green);
  background: white;
  border: 1px solid var(--green-border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  display: inline-block;
}

.bc-body {
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--border-lo);
  gap: 10px;
}
.bc-row:last-child { border-bottom: none; }
.bc-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-400);
  flex-shrink: 0;
  min-width: 68px;
}
.bc-row span:last-child {
  font-weight: 600;
  color: var(--text-900);
  text-align: right;
}
.bc-fee-val {
  color: var(--green) !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
}

/* ── Booking Preview Card ──────────────────────────────────────── */
.booking-preview-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--accent-mid);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: var(--sh-card);
}

.bpc-header {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #DBEAFE 100%);
  padding: 10px 16px;
  border-bottom: 1px solid var(--accent-mid);
  display: flex;
  align-items: center;
  gap: 8px;
}
.bpc-title-icon { font-size: 0.88rem; }
.bpc-title-text {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--accent-dark);
}

.bpc-doctor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}
.bpc-avatar {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent-mid));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-dark);
  flex-shrink: 0;
  border: 1.5px solid var(--accent-mid);
  letter-spacing: -0.5px;
}
.bpc-doc-info { flex: 1; min-width: 0; }
.bpc-doc-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-900);
  letter-spacing: -0.1px;
}
.bpc-doc-sub {
  font-size: 0.74rem;
  color: var(--text-600);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bpc-details {
  padding: 0 16px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bpc-detail-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-lo);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.bpc-detail-full { grid-column: span 2; }
.bpc-detail-label {
  font-size: 0.59rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-400);
  margin-bottom: 3px;
}
.bpc-detail-value {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}
.bpc-fee {
  font-size: 1rem;
  color: var(--green);
}

.bpc-patient {
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-lo);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.bpc-patient-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-700);
}
.bpc-pi-icon { font-size: 0.82rem; flex-shrink: 0; }

.bpc-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border-lo);
  display: flex;
  gap: 9px;
}
.bpc-confirm-btn {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(140deg, var(--green), #047857);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
  font-family: inherit;
  transition: all .15s;
  box-shadow: 0 2px 10px rgba(16, 185, 129, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bpc-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, .38);
}
.bpc-confirm-btn:active { transform: none; }

.bpc-cancel-btn {
  padding: 10px 18px;
  background: transparent;
  color: var(--text-600);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  font-family: inherit;
  transition: all .15s;
}
.bpc-cancel-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}
.bpc-cancel-btn:active { transform: scale(0.97); }

/* ── My Bookings Grid ──────────────────────────────────────────── */
.mbl-outer {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mbl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mbl-more-btn {
  width: 100%;
  padding: 9px 16px;
  background: var(--bg-subtle);
  border: 1.5px dashed var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-600);
  font-size: 0.79rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.mbl-more-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Individual Booking Card ───────────────────────────────────── */
.mbc {
  background: var(--bg-surface);
  border: 1px solid var(--border-lo);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-xs);
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}
.mbc:hover {
  box-shadow: var(--sh-sm);
  transform: translateY(-2px);
}

.mbc-top-stripe {
  height: 3px;
  background: var(--sp, var(--accent));
  flex-shrink: 0;
}

.mbc-body {
  padding: 11px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.mbc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  flex-wrap: wrap;
}

.mbc-spec {
  font-size: 0.59rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sp, var(--accent));
  border: 1.5px solid var(--sp, var(--accent));
  border-radius: var(--r-pill);
  padding: 2px 8px;
  background: var(--bg-subtle);
  white-space: nowrap;
}

.mbc-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.57rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-border);
  border-radius: var(--r-pill);
  padding: 2px 7px;
  white-space: nowrap;
}
.mbc-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.mbc-status--past {
  background: var(--bg-subtle);
  color: var(--text-400);
  border-color: var(--border-mid);
}
.mbc-status--past::before { background: var(--text-400); }

.mbc-doctor {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-900);
  line-height: 1.25;
}

.mbc-hospital {
  font-size: 0.72rem;
  color: var(--text-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mbc-dt {
  background: var(--bg-subtle);
  border: 1px solid var(--border-lo);
  border-radius: var(--r-sm);
  padding: 6px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}
.mbc-dt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}
.mbc-dt-icon { font-size: 0.73rem; flex-shrink: 0; }

.mbc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  gap: 4px;
}
.mbc-id {
  font-family: 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.mbc-fee {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Input Area ────────────────────────────────────────────────── */
.chat-input-area {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-lo);
  padding: 12px 22px 16px;
  flex-shrink: 0;
  box-shadow: 0 -2px 14px rgba(15, 23, 42, .05);
}

.chat-input-row {
  display: flex;
  gap: 0;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-xl);
  padding: 7px 7px 7px 16px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.chat-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-surface);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-900);
  font-size: 0.875rem;
  resize: none;
  line-height: 1.55;
  max-height: 130px;
  overflow-y: auto;
  font-family: inherit;
  padding: 4px 12px 4px 0;
}
.chat-textarea::placeholder { color: var(--text-400); }

.btn-send {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 102, 255, .34);
  transition: all .15s;
}
.btn-send:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(0, 102, 255, .44);
}
.btn-send:active { transform: scale(0.95); }
.btn-send:disabled {
  background: var(--border-mid);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

/* ── Quick Action Chips ────────────────────────────────────────── */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.quick-btn {
  padding: 5px 13px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-lo);
  border-radius: var(--r-pill);
  color: var(--text-600);
  font-size: 0.73rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .14s;
  box-shadow: var(--sh-xs);
  white-space: nowrap;
}
.quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.quick-btn:active { transform: none; }
.quick-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-400);
  padding: 40px;
  text-align: center;
  animation: slide-up 0.3s cubic-bezier(.25, 1, .5, 1) both;
}

.empty-icon {
  width: 56px; height: 56px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-mid);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-600);
}

.empty-sub {
  font-size: 0.8rem;
  color: var(--text-400);
  max-width: 260px;
  line-height: 1.55;
}

/* ── Error / warning inline ────────────────────────────────────── */
.msg-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--red-bg);
  border: 1px solid #FECACA;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  color: #B91C1C;
  font-weight: 500;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Show overlay */
  .sidebar-overlay { display: block; }

  /* Slide sidebar off-screen; only show when open */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 280px;
    min-width: 280px;
  }
  .sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(10, 22, 40, .28);
  }

  /* Show hamburger and close buttons */
  .btn-menu-toggle {
    display: flex;
  }
  .sidebar-close {
    display: flex;
  }

  .message-row { max-width: 92%; }
  .chat-messages { padding: 16px 14px 12px; }
  .chat-header { padding: 0 14px; height: 56px; }
  .chat-input-area { padding: 10px 12px 14px; }
  .header-badge { display: none; }

  /* Single-column booking grid on small screens */
  .mbl-grid { grid-template-columns: 1fr !important; }
  .row--wide .mbl-grid { grid-template-columns: 1fr !important; }
  .bpc-details { grid-template-columns: 1fr !important; }
  .bpc-detail-full { grid-column: span 1 !important; }
}

@media (max-width: 480px) {
  .chat-messages { padding: 12px 10px 10px; }
  .message-row { max-width: 96%; }
  .quick-actions { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
