/* ========================================
   City Multi-Speciality Hospital - Modern UI
   ======================================== */

:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --primary-light: #22d3ee;
  --success: #10b981;
  --bg-dark: #0f172a;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #0891b2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ========================================
   AUTH SCREEN
   ======================================== */

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: linear-gradient(135deg, #0c4a6e 0%, #164e63 50%, #134e4a 100%);
}

.auth-left {
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  backdrop-filter: blur(10px);
}

.brand h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand .tagline {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.hero-desc {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.stats-row {
  display: flex;
  gap: 28px;
  margin-bottom: 32px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.9);
}

.stat-dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.spec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.spec-tags span {
  padding: 8px 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.spec-tags span:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}

/* Auth Card */
.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: #f8fafc;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 32px;
}

/* Tabs */
.tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 28px;
}

.tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Form Areas */
.form-area {
  display: none;
}

.form-area.active {
  display: block;
}

.form-step {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  margin-top: 20px;
}

label:first-child {
  margin-top: 0;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.2s;
  background: #fff;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.1);
}

input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-link {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--primary-dark);
}

/* Success Banner */
.success-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  color: #065f46;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.success-banner svg {
  color: var(--success);
  flex-shrink: 0;
}

/* OTP Section */
.otp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.otp-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.back-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.otp-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.otp-hint strong {
  color: var(--text-primary);
}

/* OTP Input Boxes */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.otp-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  transition: all 0.2s;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.1);
}

.otp-digit.filled {
  border-color: var(--primary);
  background: #f0fdfa;
}

/* Status Message */
.status {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 16px;
  padding: 10px;
  border-radius: var(--radius-sm);
}

.status:empty {
  display: none;
}

.status.error {
  background: #fef2f2;
  color: #dc2626;
}

.status.success {
  background: #ecfdf5;
  color: #059669;
}

/* ========================================
   CHAT SCREEN
   ======================================== */

.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  background: #f1f5f9;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(135deg, #0c4a6e 0%, #164e63 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
  flex-shrink: 0; /* Don't shrink */
  height: 76px;
  min-height: 76px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-brand span {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.online-dot {
  width: 10px;
  height: 10px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.logout-btn {
  padding: 8px 16px;
  margin-left: 16px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* Chat Body */
.chat-body {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
  min-height: 0; /* Important for flex children to scroll */
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 24px;
  padding-bottom: 40px; /* Extra padding at bottom for scroll */
  overflow-y: auto;
  height: 100%;
  max-height: calc(100vh - 76px); /* Subtract topbar height */
}

.patient-info {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.patient-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.patient-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.patient-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* Sidebar Sections */
.sidebar-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header span:first-child {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.appt-list {
  list-style: none;
}

.appt-list li {
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.appt-list li:hover {
  border-color: var(--primary);
  background: #f0fdfa;
}

.appt-list:empty::before {
  content: "No items";
  display: block;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.consultation-list li.consultation-item {
  display: block;
  background: #fffdf7;
  border-color: #f3e5b1;
  padding: 10px 12px;
}
.consultation-list li.consultation-item:hover {
  background: #fff8e6;
  border-color: #e8c963;
}
.cons-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.cons-head strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}
.cons-spec {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #92763a;
}
.cons-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cons-row {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-secondary);
  margin-top: 4px;
}
.cons-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 4px;
}

/* Past Reports list */
.report-list li.report-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #f0fdfa;
  border: 1px solid #a5f3fc;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.report-list li.report-item:hover {
  background: #ecfeff;
  border-color: #06b6d4;
  transform: translateX(2px);
}
.report-list li.report-item:active {
  transform: translateX(0);
}
.report-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #06b6d4;
  color: #fff;
  flex-shrink: 0;
}
.report-item-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.report-item-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-item-date {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 2px;
}
.report-list li.report-item-empty {
  background: transparent;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  cursor: default;
  padding: 10px;
}
.report-list li.report-item-empty:hover {
  background: transparent;
  border-color: #cbd5e1;
  transform: none;
}

/* "Report attached" badge inside an appointment list item */
.apt-report-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0e7490;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  padding: 2px 8px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.apt-report-link:hover {
  background: #cffafe;
  border-color: #06b6d4;
}

/* Chat Main */
.chat-main {
  display: flex;
  flex-direction: column;
  background: #fff;
  height: 100%;
  max-height: calc(100vh - 76px); /* Subtract topbar height */
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0; /* Important for flex scroll */
}

.msg {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.bot {
  background: #f1f5f9;
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Markdown rendering inside bot bubbles */
.msg.bot p { margin: 0 0 10px; line-height: 1.55; }
.msg.bot p:last-child { margin-bottom: 0; }
.msg.bot .md-h1,
.msg.bot .md-h2,
.msg.bot .md-h3,
.msg.bot .md-h4 {
  margin: 14px 0 8px;
  line-height: 1.3;
  color: #0f172a;
  font-weight: 700;
}
.msg.bot .md-h1:first-child,
.msg.bot .md-h2:first-child,
.msg.bot .md-h3:first-child,
.msg.bot .md-h4:first-child { margin-top: 2px; }
.msg.bot .md-h1 { font-size: 1.25rem; border-bottom: 1px solid #cbd5e1; padding-bottom: 4px; }
.msg.bot .md-h2 { font-size: 1.12rem; color: #0e7490; }
.msg.bot .md-h3 { font-size: 1.02rem; color: #155e75; }
.msg.bot .md-h4 { font-size: 0.96rem; color: #334155; }
.msg.bot .md-ul,
.msg.bot .md-ol {
  margin: 6px 0 10px;
  padding-left: 22px;
  line-height: 1.55;
}
.msg.bot .md-ul li,
.msg.bot .md-ol li { margin: 3px 0; }
.msg.bot code {
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
.msg.bot strong { color: #0f172a; }

/* Markdown tables */
.msg.bot .md-table-wrap {
  overflow-x: auto;
  margin: 8px 0 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
.msg.bot .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.msg.bot .md-table th,
.msg.bot .md-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.msg.bot .md-table th {
  background: #ecfeff;
  color: #0e7490;
  font-weight: 700;
  border-bottom: 2px solid #a5f3fc;
  white-space: nowrap;
}
.msg.bot .md-table tbody tr:last-child td { border-bottom: none; }
.msg.bot .md-table tbody tr:nth-child(even) td { background: #f8fafc; }

.msg.user {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Composer */
.composer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0; /* Prevent shrinking */
}

.composer input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-family: inherit;
}

.composer input:focus {
  outline: none;
  border-color: var(--primary);
}

#sendBtn {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}

#sendBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.45);
}

#sendBtn:active {
  transform: translateY(0);
}

/* Composer icon button (upload report) */
.report-tip-wrap {
  position: relative;
  align-self: center;
  display: flex;
}
.composer-icon-btn {
  height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
.composer-icon-btn:hover {
  border-color: var(--primary);
  background: #f0fdfa;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}
.composer-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.composer-icon-label {
  display: inline-block;
}

/* Hover tooltip explaining the Attach report button */
.report-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 320px;
  max-width: 80vw;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #a5f3fc;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
  z-index: 50;
}
.report-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 28px;
  border: 7px solid transparent;
  border-top-color: #ffffff;
  filter: drop-shadow(0 1px 0 #a5f3fc);
}
.report-tip-wrap:hover .report-tip,
.report-tip-wrap:focus-within .report-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.report-tip-title {
  font-weight: 700;
  color: #0e7490;
  margin-bottom: 4px;
}
.report-tip-body {
  color: #334155;
}
.report-tip-note {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

/* Voice dictation input controls */
.chat-input-wrap {
  position: relative;
  flex: 1;
}

.chat-input-wrap #chatInput {
  width: 100%;
  padding-right: 96px;
}

.voice-inside-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.voice-inside-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0fdfa;
}

.voice-inside-btn .icon-stop {
  display: none;
}

.voice-listening .voice-inside-btn {
  border-color: #ef4444;
  color: #ef4444;
  background: #fee2e2;
  animation: micPulse 1.1s infinite;
}

.voice-listening .voice-inside-btn .icon-mic {
  display: none;
}

.voice-listening .voice-inside-btn .icon-stop {
  display: inline-flex;
}

.voice-processing .voice-inside-btn {
  border-color: #0ea5e9;
  color: #0ea5e9;
  background: #e0f2fe;
}

.voice-waveform {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  pointer-events: none;
}

.voice-waveform.hidden {
  display: none;
}

.voice-waveform .bar {
  width: 3px;
  height: 6px;
  border-radius: 99px;
  background: #22c55e;
  transform-origin: bottom;
  transition: transform 80ms linear;
}

.voice-mode-btn {
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.voice-mode-btn.active {
  border-color: #0ea5e9;
  color: #075985;
  background: #e0f2fe;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

@media (max-width: 640px) {
  .chat-input-wrap #chatInput {
    padding-right: 88px;
  }

  .voice-inside-btn {
    width: 34px;
    height: 34px;
    right: 6px;
  }

  .voice-waveform {
    right: 45px;
  }

  .voice-mode-btn {
    padding: 0 10px;
  }

}

/* Report-mode banner */
.report-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 24px 10px;
  padding: 10px 12px 10px 14px;
  background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%);
  border: 1px solid #a5f3fc;
  border-left: 4px solid #06b6d4;
  border-radius: 12px;
  font-size: 0.85rem;
  color: #155e75;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.08);
  animation: reportPillIn 0.25s ease-out;
}
@keyframes reportPillIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.report-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #06b6d4;
  color: #fff;
  flex-shrink: 0;
}
.report-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  flex: 1;
}
.report-pill-label {
  font-weight: 700;
  color: #0e7490;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.report-pill-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: #475569;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-pill-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #fca5a5;
  background: #fff;
  color: #dc2626;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.report-pill-clear:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

.policy-pill {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #bfdbfe;
  border-left-color: #3b82f6;
  color: #1e3a8a;
}

.policy-pill .report-pill-icon {
  background: #3b82f6;
}

.policy-pill .report-pill-label {
  color: #1d4ed8;
}

/* Report-attached user bubble (replaces plain "Uploaded report: ...") */
.msg.user.report-upload-card {
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  padding: 10px 14px;
}
.report-upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  flex-shrink: 0;
}
.report-upload-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.report-upload-meta .ru-title {
  font-size: 0.78rem;
  opacity: 0.9;
  font-weight: 500;
}
.report-upload-meta .ru-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* Animated "Analyzing..." thinking bubble */
.msg.bot.report-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.report-thinking-text {
  font-size: 0.9rem;
  color: #475569;
  font-style: italic;
}
.report-thinking-dots {
  display: inline-flex;
  gap: 4px;
}
.report-thinking-dots span {
  width: 7px;
  height: 7px;
  background: #06b6d4;
  border-radius: 50%;
  display: inline-block;
  animation: reportDotPulse 1.2s ease-in-out infinite;
}
.report-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.report-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes reportDotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* "Book a doctor about this report" call-to-action bubble */
.msg.bot.report-book-cta {
  background: linear-gradient(180deg, #ffffff 0%, #ecfeff 100%);
  border: 1px solid #a5f3fc;
  border-left: 4px solid #06b6d4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  max-width: 480px;
}
.report-book-cta-text {
  font-size: 0.9rem;
  color: #155e75;
  line-height: 1.5;
}
.report-book-cta-text strong {
  color: #0e7490;
}
.report-book-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.1s ease, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}
.report-book-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}
.report-book-cta-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.report-book-cta-secondary {
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}
.report-book-cta-secondary:hover {
  color: #0e7490;
}

/* "Register new patient" call-to-action bubble (third-party redirect) */
.msg.bot.register-third-party-cta {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  max-width: 480px;
}
.register-third-party-text {
  font-size: 0.9rem;
  color: #78350f;
  line-height: 1.5;
}
.register-third-party-text strong {
  color: #92400e;
}
.register-third-party-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
  border: none;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.1s ease, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}
.register-third-party-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

/* Single-form-card in-chat registration (third-party referral) */
.msg.bot.registration-form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  padding: 16px 18px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.registration-form-card .reg-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.registration-form-card .reg-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.registration-form-card .reg-subtitle {
  font-size: 0.85rem;
  color: #475569;
}
.registration-form-card .reg-subtitle strong {
  color: #1e293b;
  text-transform: capitalize;
}
.registration-form-card .reg-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.registration-form-card .reg-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.registration-form-card .reg-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.registration-form-card .reg-field-input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.92rem;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.registration-form-card .reg-field-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.registration-form-card .reg-field-error {
  font-size: 0.78rem;
  color: #b91c1c;
  min-height: 1em;
}
.registration-form-card .reg-form-error {
  font-size: 0.82rem;
  color: #b91c1c;
  min-height: 1em;
}
.registration-form-card .reg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.registration-form-card .btn-reg-cancel,
.registration-form-card .btn-reg-submit {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s, background 0.15s;
}
.registration-form-card .btn-reg-cancel {
  background: #f1f5f9;
  color: #475569;
}
.registration-form-card .btn-reg-cancel:hover:not(:disabled) {
  background: #e2e8f0;
}
.registration-form-card .btn-reg-submit {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.registration-form-card .btn-reg-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.registration-form-card .btn-reg-cancel:disabled,
.registration-form-card .btn-reg-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.registration-form-card.registration-form-card-done {
  opacity: 0.85;
  border-left-color: #16a34a;
}

/* "Did you visit the doctor?" Yes/No CTA after past-time follow-up */
.msg.bot.followup-visit-cta {
  background: transparent;
  border: none;
  padding: 4px 0;
  max-width: 480px;
  box-shadow: none;
}
.followup-visit-cta-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.followup-visit-yes,
.followup-visit-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s;
  border: 1.5px solid transparent;
}
.followup-visit-yes {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}
.followup-visit-yes:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}
.followup-visit-no {
  background: #fff;
  color: #475569;
  border-color: #cbd5e1;
}
.followup-visit-no:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.followup-visit-yes:disabled,
.followup-visit-no:disabled {
  opacity: 0.5;
  cursor: default;
}
.followup-visit-cta-done {
  opacity: 0.7;
}

/* "Reschedule / Cancel" CTA after the user answers "No, not yet" */
.msg.bot.followup-visit-action-cta {
  background: transparent;
  border: none;
  padding: 4px 0;
  max-width: 520px;
  box-shadow: none;
}
.followup-visit-text {
  margin-bottom: 8px;
  color: #334155;
  line-height: 1.45;
}
.followup-visit-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.followup-visit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.1s ease, box-shadow 0.15s;
}
.followup-visit-reschedule {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.followup-visit-reschedule:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.followup-visit-cancel {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.followup-visit-cancel:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
}
.followup-visit-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ========================================
   INSURANCE POLICY
   ======================================== */

/* Sidebar card: empty state */
.policy-card {
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.policy-card-empty {
  flex-direction: column;
  align-items: stretch;
  background: rgba(8, 145, 178, 0.06);
  border: 1.5px dashed rgba(8, 145, 178, 0.4);
}
.policy-empty-text {
  font-size: 0.82rem;
  color: #0e7490;
  line-height: 1.45;
}
.policy-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}
.policy-attach-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.35);
}

/* Sidebar card: filled state */
.policy-card-filled {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border: 1px solid rgba(8, 145, 178, 0.25);
  border-left: 3px solid #0891b2;
}
.policy-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}
.policy-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}
.policy-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.policy-provider {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0e7490;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.policy-plan {
  font-size: 0.78rem;
  color: #155e75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.policy-expiry {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 2px;
}
.policy-mini-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.policy-mini-item {
  border: 1px solid rgba(8, 145, 178, 0.25);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.55);
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.policy-mini-item span {
  font-size: 0.63rem;
  color: #475569;
  line-height: 1.1;
}
.policy-mini-item strong {
  font-size: 0.72rem;
  color: #0f172a;
  line-height: 1.2;
  word-break: break-word;
}
.policy-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.policy-actions .policy-attach-btn {
  flex: 1;
}
.policy-delete-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.policy-delete-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* Inline "Attach my policy" chat bubble */
.msg.bot.attach-policy-cta {
  background: linear-gradient(180deg, #ecfeff 0%, #cffafe 100%);
  border: 1px solid #67e8f9;
  border-left: 4px solid #0891b2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  max-width: 480px;
}
.attach-policy-cta-text {
  font-size: 0.9rem;
  color: #155e75;
  line-height: 1.5;
}
.attach-policy-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.1s ease, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}
.attach-policy-cta-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.35);
}
.attach-policy-cta-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }
  
  .auth-left {
    display: none;
  }
  
  .auth-right {
    min-height: 100vh;
    background: linear-gradient(135deg, #0c4a6e 0%, #164e63 50%, #134e4a 100%);
  }
  
  .chat-body {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
}

@media (max-width: 600px) {
  .auth-card {
    padding: 24px;
  }
  
  .otp-digit {
    width: 42px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .composer {
    padding: 16px;
  }
}

/* ========================================
   LOADING STATE
   ======================================== */

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary.loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   PAYMENT CARD + CHECKOUT MODAL
   ======================================== */
.msg.payment-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  white-space: normal;
  line-height: 1.3;
}
.msg.payment-card * {
  white-space: normal;
}
.payment-card.payment-card-done {
  opacity: 0.55;
  filter: grayscale(0.5);
}
.payment-card .pay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.payment-card .pay-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.payment-card .pay-amount {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1.05rem;
  white-space: nowrap;
}
.payment-card .pay-body {
  background: #f8fafc;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border: 1px solid #eef2f7;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.payment-card .pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}
.payment-card .pay-row > * {
  margin: 0;
  padding: 0;
}
.payment-card .pay-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.payment-card .pay-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.payment-card .pay-actions button {
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  line-height: 1.3;
}
.payment-card .btn-pay-now {
  background: var(--primary);
  color: #fff;
}
.payment-card .btn-pay-now:hover:not(:disabled) {
  background: var(--primary-dark);
}
.payment-card .btn-pay-now:disabled,
.payment-card .btn-cancel-pay:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.payment-card .btn-cancel-pay {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--border);
}
.payment-card .btn-cancel-pay:hover:not(:disabled) {
  background: #f1f5f9;
}

/* Checkout modal */
.checkout-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.checkout-dialog {
  background: #fff;
  border-radius: 14px;
  width: 92%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
}
.checkout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
}
.checkout-title {
  font-weight: 700;
  font-size: 1rem;
}
.checkout-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.checkout-body {
  padding: 18px;
}
.checkout-amount {
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.checkout-field {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}
.checkout-field label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 600;
}
.checkout-field input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'Courier New', monospace;
}
.checkout-field input:focus {
  outline: none;
  border-color: var(--primary);
}
.checkout-row {
  display: flex;
  gap: 10px;
}
.checkout-row .checkout-field {
  flex: 1;
}
.checkout-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.checkout-status {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 1.2em;
}
.checkout-status.processing { color: var(--primary-dark); }
.checkout-status.ok { color: var(--success); }
.checkout-status.error { color: #dc2626; }
.checkout-foot {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.checkout-foot .btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.checkout-foot .btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}
.checkout-foot .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.checkout-foot .btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.checkout-foot .btn-secondary:hover {
  background: #f1f5f9;
}

/* ========================================
   TRIAGE CARD (symptom-triage agent output)
   ======================================== */
.msg.triage-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 460px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
  white-space: normal;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg.triage-card * { white-space: normal; }
.triage-card.triage-card-done { opacity: 0.6; filter: grayscale(0.4); }

/* Variant colours */
.triage-card.triage-card-emergency_er {
  border-left-color: #dc2626;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 60%);
}
.triage-card.triage-card-crisis_hotline {
  border-left-color: #db2777;
  background: linear-gradient(180deg, #fff1f6 0%, #ffffff 60%);
}
.triage-card.triage-card-urgent_appointment {
  border-left-color: #d97706;
  background: linear-gradient(180deg, #fffaf2 0%, #ffffff 60%);
}
.triage-card.triage-card-schedule_appointment {
  border-left-color: var(--primary);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 60%);
}
.triage-card.triage-card-self_care {
  border-left-color: #059669;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
}

.triage-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.triage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.triage-card-emergency_er .triage-tag { color: #b91c1c; }
.triage-card-crisis_hotline .triage-tag { color: #be185d; }
.triage-card-urgent_appointment .triage-tag { color: #b45309; }
.triage-card-schedule_appointment .triage-tag { color: var(--primary-dark); }
.triage-card-self_care .triage-tag { color: #047857; }
.triage-icon { font-size: 0.95rem; }
.triage-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.triage-body {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.triage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-primary);
  gap: 8px;
}
.triage-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.triage-summary {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.45;
}

.triage-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.triage-numbers, .triage-hotlines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.triage-number-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 8px;
}
.triage-number-row > span {
  color: var(--text-secondary);
}
a.triage-number {
  font-weight: 700;
  color: #b91c1c;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid #fecaca;
  padding: 2px 8px;
  border-radius: 6px;
}
a.triage-number:hover { background: #fef2f2; }
.triage-card-crisis_hotline a.triage-number {
  color: #be185d;
  border-color: #fbcfe8;
}
.triage-card-crisis_hotline a.triage-number:hover { background: #fdf2f8; }

.triage-plan {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.triage-plan-block { display: flex; flex-direction: column; gap: 4px; }
.triage-plan-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}
.triage-plan-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.triage-disclaimer {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  padding-top: 4px;
  border-top: 1px dashed #e2e8f0;
}

.triage-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.triage-actions button {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.2;
}
.triage-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.btn-triage-primary {
  background: var(--primary);
  color: #fff;
}
.btn-triage-primary:hover:not(:disabled) { background: var(--primary-dark); }
.triage-card-urgent_appointment .btn-triage-primary {
  background: #d97706;
}
.triage-card-urgent_appointment .btn-triage-primary:hover:not(:disabled) {
  background: #b45309;
}
.btn-triage-secondary {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-triage-secondary:hover:not(:disabled) { background: #f1f5f9; }
.btn-triage-ack {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.triage-card-crisis_hotline .btn-triage-ack {
  color: #be185d;
  border-color: #fbcfe8;
}
.btn-triage-ack:hover:not(:disabled) { background: #fef2f2; }
.triage-card-crisis_hotline .btn-triage-ack:hover:not(:disabled) { background: #fdf2f8; }

/* Emergency action button (Send ambulance / Connect counsellor) */
.btn-triage-emergency {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
  animation: triagePulse 1.6s ease-in-out infinite;
}
.btn-triage-emergency:hover:not(:disabled) { background: #b91c1c; }
.btn-triage-emergency:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  cursor: default;
  animation: none;
  box-shadow: none;
}
.triage-card-crisis_hotline .btn-triage-emergency {
  background: #be185d;
  border-color: #9d174d;
  box-shadow: 0 2px 6px rgba(190, 24, 93, 0.35);
}
.triage-card-crisis_hotline .btn-triage-emergency:hover:not(:disabled) { background: #9d174d; }

@keyframes triagePulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35); }
  50%      { box-shadow: 0 2px 14px rgba(220, 38, 38, 0.75); }
}

/* Dispatch confirmation panel (demo-only) */
.triage-dispatch {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #7c2d12;
  font-size: 13px;
}
.triage-card-crisis_hotline .triage-dispatch {
  background: #fdf2f8;
  border-color: #f9a8d4;
  color: #831843;
}
.triage-dispatch-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 8px;
}
.triage-dispatch-icon { font-size: 18px; }
.triage-dispatch-badge {
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: triagePulse 1.6s ease-in-out infinite;
}
.triage-card-crisis_hotline .triage-dispatch-badge { background: #be185d; }
.triage-dispatch-rows {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin-bottom: 8px;
}
.triage-dispatch-key {
  font-weight: 600;
  opacity: 0.8;
}
.triage-dispatch-val { word-break: break-word; }
.triage-dispatch-msg {
  padding: 8px 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 6px;
  margin-bottom: 6px;
}
.triage-dispatch-note {
  font-size: 11px;
  opacity: 0.7;
  font-style: italic;
}

/* Video consultation session panel */
.video-session {
  margin-top: 12px;
  padding: 14px;
  border-radius: 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e1b4b;
  font-size: 13px;
}
.video-session-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.video-session-icon { font-size: 20px; }
.video-session-tag {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: #4338ca;
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
}
.video-session-badge {
  margin-left: auto;
  font-size: 11px;
  background: #fff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 3px 8px;
  border-radius: 999px;
}
.video-session-rows {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin-bottom: 10px;
}
.video-session-key {
  font-weight: 600;
  opacity: 0.8;
}
.video-session-val { word-break: break-word; }
.video-session-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.btn-video-join {
  background: #4338ca;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid #3730a3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-video-join:hover { background: #3730a3; }
.btn-video-copy {
  background: #fff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}
.btn-video-copy:hover { background: #f5f3ff; }
.video-session-note {
  font-size: 11px;
  opacity: 0.7;
  font-style: italic;
}

/* Secondary "Talk to a doctor on video" button on triage cards */
.btn-triage-video {
  background: #4338ca;
  color: #fff;
  border: 1px solid #3730a3;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
}
.btn-triage-video:hover:not(:disabled) { background: #3730a3; }
.btn-triage-video:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  cursor: default;
  box-shadow: none;
}

/* Mode tag inside the payment card */
.pay-mode {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pay-mode-in_clinic {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.pay-mode-video {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* Post-payment "Join video consult" CTA card */
.booked-video-card {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 8px 0;
  max-width: 580px;
}
.booked-video-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.booked-video-icon { font-size: 22px; }
.booked-video-tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #6d28d9;
}
.booked-video-state {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
}
.booked-video-state:empty { display: none; }
.booked-video-rows {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.booked-video-row {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #4c1d95;
}
.booked-video-key {
  min-width: 90px;
  font-weight: 600;
  color: #6d28d9;
}
.booked-video-actions { display: flex; gap: 8px; }
.btn-video-launch {
  background: #6d28d9;
  color: #fff;
  border: 1px solid #5b21b6;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.25);
}
.btn-video-launch:hover:not(:disabled) { background: #5b21b6; }
.btn-video-launch:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  cursor: default;
  box-shadow: none;
}
.booked-video-note {
  margin-top: 10px;
  font-size: 12px;
  font-style: italic;
  color: #6b21a8;
}
