/* ==========================================================================
   EzeeHealth Surgical Decision & Cost Navigator
   Light Professional Medical Theme — White background, Black text, Tables
   ========================================================================== */

:root {
  --white: #ffffff;
  --off-white: #f8f9fa;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --brand-blue: #1e40af;
  --brand-blue-mid: #2563eb;
  --brand-blue-light: #dbeafe;
  --brand-blue-border: #bfdbfe;
  --brand-teal: #0f766e;
  --brand-teal-light: #d1fae5;
  --brand-amber: #b45309;
  --brand-amber-light: #fef3c7;
  --brand-red: #b91c1c;
  --brand-red-light: #fee2e2;
  --brand-green: #15803d;
  --brand-green-light: #dcfce7;

  --border: #e5e7eb;
  --border-mid: #d1d5db;

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Outfit', var(--font);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);

  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 14px;
  background: var(--white);
  color: var(--gray-900);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body { min-height: 100vh; background: var(--off-white); }

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.logo-icon { width: 32px; height: 32px; }

.brand-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-badge {
  background: var(--brand-blue-light);
  border: 1px solid var(--brand-blue-border);
  color: var(--brand-blue);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--gray-500);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--gray-50);
  color: var(--gray-600);
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-green);
}

.engine-pill { color: var(--brand-blue); background: var(--brand-blue-light); border-color: var(--brand-blue-border); }
.pill-icon { width: 12px; height: 12px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid var(--border-mid);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--white);
  background: var(--brand-blue-mid);
  border: 1px solid var(--brand-blue);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-key:hover { background: var(--brand-blue); }

.btn-icon { width: 13px; height: 13px; }

/* ==========================================================================
   Main Layout
   ========================================================================== */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* ==========================================================================
   Page Header Strip
   ========================================================================== */
.hero-section {
  margin-bottom: 1.5rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  background: var(--brand-blue-light);
  border: 1px solid var(--brand-blue-border);
  border-radius: 999px;
  color: var(--brand-blue);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}

.hero-tag-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-blue-mid);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.text-gradient {
  color: var(--brand-blue-mid);
}

.hero-desc {
  font-size: 0.88rem;
  color: var(--gray-500);
  max-width: 680px;
  line-height: 1.55;
}

/* ==========================================================================
   Console / Input Card
   ========================================================================== */
.console-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.treatment-form { display: flex; flex-direction: column; gap: 1.1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }

.input-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
}

.label-icon { width: 13px; height: 13px; color: var(--brand-blue-mid); }
.input-hint { font-size: 0.7rem; color: var(--gray-400); }

.textarea-wrapper { position: relative; }

.diagnosis-textarea {
  width: 100%;
  padding: 0.75rem 2.2rem 0.75rem 0.85rem;
  font-family: var(--font);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 72px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.diagnosis-textarea:focus {
  outline: none;
  border-color: var(--brand-blue-mid);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.diagnosis-textarea::placeholder { color: var(--gray-400); }

.btn-clear {
  position: absolute;
  top: 0.55rem; right: 0.65rem;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100);
  border: none; border-radius: 50%;
  color: var(--gray-500);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-clear:hover { background: var(--gray-200); color: var(--gray-800); }

/* Chips */
.suggestions-bar { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.3rem; }
.suggestions-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); }

.chip-scroll { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chip {
  background: var(--white);
  border: 1px solid var(--border-mid);
  color: var(--gray-600);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--brand-blue-light);
  border-color: var(--brand-blue-border);
  color: var(--brand-blue);
}

/* Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* City Toggle */
.city-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  background: var(--gray-100);
  padding: 0.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.city-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 0.4rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}
.city-btn:hover { background: var(--white); color: var(--gray-800); }
.city-btn.active {
  background: var(--white);
  border: 1px solid var(--border-mid);
  color: var(--brand-blue);
  box-shadow: var(--shadow-sm);
}
.city-name { font-family: var(--font-heading); font-weight: 700; font-size: 0.8rem; }
.city-count { font-size: 0.65rem; color: var(--gray-400); margin-top: 1px; }
.city-btn.active .city-count { color: var(--brand-blue-mid); }

.select-wrapper { position: relative; }

.custom-select, .custom-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-family: var(--font);
  font-size: 0.84rem;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.custom-select:focus, .custom-input:focus {
  outline: none;
  border-color: var(--brand-blue-mid);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Patient accordion */
.patient-details-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
}
.accordion-summary::-webkit-details-marker { display: none; }

.summary-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-600);
}
.summary-icon { width: 14px; height: 14px; }
.summary-arrow { font-size: 0.65rem; color: var(--gray-400); transition: transform 0.15s; }
.patient-details-accordion[open] .summary-arrow { transform: rotate(180deg); }

.accordion-content {
  padding: 0.5rem 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.context-grid { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 0.85rem; }

/* Submit */
.submit-row { display: flex; justify-content: center; padding-top: 0.25rem; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 2rem;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--white);
  background: var(--brand-blue-mid);
  border: 1px solid var(--brand-blue);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-blue); box-shadow: var(--shadow); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary-icon { width: 16px; height: 16px; }
.btn-glow { display: none; }

/* ==========================================================================
   Loading
   ========================================================================== */
.loading-section { margin: 2.5rem auto; max-width: 540px; }

.loading-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.pulse-loader {
  position: relative;
  width: 60px; height: 60px;
  margin: 0 auto 1.25rem;
  display: flex; align-items: center; justify-content: center;
}

.pulse-circle {
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.3);
  animation: ripple 2s infinite ease-out;
}
.pulse-circle-2 { animation-delay: 0.65s; }

@keyframes ripple {
  0% { transform: scale(0.65); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.pulse-icon {
  position: relative; z-index: 2;
  width: 36px; height: 36px;
  background: var(--brand-blue-mid);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
}
.pulse-icon svg { width: 18px; height: 18px; }

.loading-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.3rem; }
.loading-subtitle { font-size: 0.82rem; color: var(--brand-blue-mid); margin-bottom: 1.5rem; }

.loading-steps { display: flex; flex-direction: column; gap: 0.5rem; max-width: 380px; margin: 0 auto; text-align: left; }

.step-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--gray-400);
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius);
  background: var(--gray-50);
  border: 1px solid transparent;
}
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-300); }
.step-item.active { color: var(--gray-800); background: var(--brand-blue-light); border-color: var(--brand-blue-border); }
.step-item.active .step-dot { background: var(--brand-blue-mid); }
.step-item.completed { color: var(--brand-green); }
.step-item.completed .step-dot { background: var(--brand-green); }

/* ==========================================================================
   Results
   ========================================================================== */
.results-section { display: flex; flex-direction: column; gap: 1.5rem; animation: fadeSlide 0.3s ease-out; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toolbar */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.engine-badge-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--brand-blue);
}

.engine-indicator {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-green);
}

.toolbar-actions { display: flex; gap: 0.4rem; }

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--border-mid);
  color: var(--gray-600);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-tool:hover { background: var(--gray-50); color: var(--gray-900); }
.tool-icon { width: 13px; height: 13px; }

/* Alert boxes */
.alert-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.5;
}
.alert-info { background: var(--brand-blue-light); border: 1px solid var(--brand-blue-border); color: var(--brand-blue); }
.alert-note { background: var(--brand-amber-light); border: 1px solid #fde68a; color: var(--brand-amber); }
.alert-note a { color: var(--brand-blue); }
.alert-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.header-icon { width: 20px; height: 20px; color: var(--brand-blue-mid); flex-shrink: 0; margin-top: 1px; }
.card-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.card-subtitle { font-size: 0.78rem; color: var(--gray-500); margin-top: 1px; }

/* ==========================================================================
   Clinical Summary Card
   ========================================================================== */
.clinical-card { border-top: 3px solid var(--brand-blue-mid); }

.condition-badge-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.specialty-tag {
  background: var(--brand-blue-light);
  border: 1px solid var(--brand-blue-border);
  color: var(--brand-blue);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.urgency-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.urgency-elective { background: var(--brand-green-light); border: 1px solid #bbf7d0; color: var(--brand-green); }
.urgency-semi-urgent { background: var(--brand-amber-light); border: 1px solid #fde68a; color: var(--brand-amber); }
.urgency-urgent { background: var(--brand-red-light); border: 1px solid #fecaca; color: var(--brand-red); }

.condition-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  line-height: 1.25;
}

.condition-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 0.85rem;
}

.meta-divider { color: var(--gray-300); }
.text-teal { color: var(--brand-teal); font-weight: 600; }

.clinical-desc {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.55;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

/* ==========================================================================
   Surgical Options Section
   ========================================================================== */
.surgical-options-wrapper { display: flex; flex-direction: column; gap: 1.25rem; }

.section-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}
.section-sub { font-size: 0.76rem; color: var(--gray-500); }

/* Procedure Tabs */
.procedure-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-50);
}

.proc-tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border);
}
.proc-tab-btn:last-child { border-right: none; }
.proc-tab-btn:hover { background: var(--white); color: var(--gray-900); }
.proc-tab-btn.active { background: var(--brand-blue-mid); color: var(--white); }

/* Procedure Detail Card */
.procedure-detail-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Procedure Header */
.proc-info-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}

.proc-main-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.primary-badge {
  background: var(--brand-green-light);
  border: 1px solid #bbf7d0;
  color: var(--brand-green);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.alt-badge {
  background: var(--gray-100);
  border: 1px solid var(--border);
  color: var(--gray-600);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.proc-specs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: 0.78rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}
.proc-spec-item { display: flex; align-items: center; gap: 0.35rem; }
.spec-icon { width: 13px; height: 13px; color: var(--brand-blue-mid); }

.proc-rationale-text { font-size: 0.82rem; color: var(--gray-600); line-height: 1.5; }

/* ==========================================================================
   Procedure Summary Table (Pros/Cons inline table)
   ========================================================================== */
.proc-summary-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.summary-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--gray-700);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-table td {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--gray-700);
  vertical-align: top;
  line-height: 1.45;
}

.summary-table td.pro { color: var(--brand-green); }
.summary-table td.con { color: var(--brand-red); }
.summary-table td strong { color: var(--gray-900); }

/* ==========================================================================
   Hospital Tariff Cost Table
   ========================================================================== */
.hosp-cost-section {
  padding: 1.25rem 1.5rem;
}

.cost-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cost-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-900);
}

.city-badge {
  padding: 0.2rem 0.65rem;
  background: var(--brand-blue-light);
  border: 1px solid var(--brand-blue-border);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-blue);
}

/* Aggregate Stats Row */
.agg-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.agg-stat {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--gray-50);
}

.agg-stat.agg-primary {
  background: var(--brand-blue-light);
  border-color: var(--brand-blue-border);
}

.agg-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.agg-primary .agg-label { color: var(--brand-blue); }

.agg-val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.agg-primary .agg-val { color: var(--brand-blue-mid); }

.agg-sub { font-size: 0.65rem; color: var(--gray-400); margin-top: 2px; }
.agg-primary .agg-sub { color: var(--brand-blue); opacity: 0.7; }

/* Hospital comparison table */
.hospital-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.hospital-table thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--gray-900);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hospital-table thead th:first-child { border-radius: 6px 0 0 0; }
.hospital-table thead th:last-child { border-radius: 0 6px 0 0; text-align: right; }

.hospital-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.hospital-table tbody tr:hover { background: var(--gray-50); }
.hospital-table tbody tr:last-child { border-bottom: none; }

.hospital-table tbody td {
  padding: 0.65rem 0.75rem;
  color: var(--gray-700);
  vertical-align: middle;
}

.hospital-table tbody td:last-child { text-align: right; }

.hosp-name-cell {
  font-weight: 700;
  color: var(--gray-900);
  display: block;
  margin-bottom: 1px;
}

.hosp-loc-cell {
  font-size: 0.72rem;
  color: var(--gray-400);
}

.tier-pill {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tier-q1 { background: #ede9fe; border: 1px solid #c4b5fd; color: #5b21b6; }
.tier-t1 { background: var(--brand-blue-light); border: 1px solid var(--brand-blue-border); color: var(--brand-blue); }
.tier-tr { background: var(--brand-green-light); border: 1px solid #bbf7d0; color: var(--brand-green); }
.tier-t2 { background: var(--brand-amber-light); border: 1px solid #fde68a; color: var(--brand-amber); }

.price-cell {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--gray-900);
}

.price-range-cell {
  font-size: 0.7rem;
  color: var(--gray-400);
  display: block;
}

.diff-cell {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  display: inline-block;
}
.diff-below { background: var(--brand-green-light); color: var(--brand-green); }
.diff-above { background: var(--brand-blue-light); color: var(--brand-blue); }
.diff-avg { background: var(--gray-100); color: var(--gray-500); }

/* Room badge */
.room-cell {
  font-size: 0.72rem;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--border);
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

/* ==========================================================================
   Consultation Checklist — now a table
   ========================================================================== */
.checklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.checklist-table th {
  text-align: left;
  padding: 0.45rem 0.85rem;
  background: var(--gray-50);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--gray-700);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checklist-table td {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  color: var(--gray-700);
  vertical-align: top;
}

.checklist-table tr:nth-child(even) td { background: var(--gray-50); }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeSlide 0.15s ease-out;
}
.modal-backdrop.hidden { display: none !important; }

.modal-box {
  background: var(--white);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-lg { max-width: 820px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}

.modal-title-group { display: flex; align-items: center; gap: 0.5rem; }
.modal-icon { width: 18px; height: 18px; color: var(--brand-blue-mid); }
.modal-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--gray-900); }

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--gray-800); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-desc { font-size: 0.84rem; color: var(--gray-600); }

.checkbox-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--gray-600); }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

.modal-search-row, .modal-filters-row { display: flex; gap: 0.5rem; }
.filter-col { flex: 1; }

.catalog-list, .hospitals-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.catalog-specialty-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.specialty-heading {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-blue);
  padding: 0.6rem 0.85rem;
  background: var(--brand-blue-light);
  border-bottom: 1px solid var(--brand-blue-border);
  border-radius: var(--radius) var(--radius) 0 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  line-height: 1.4;
}
.specialty-arrow {
  font-size: 0.9rem;
  opacity: 0.6;
  display: inline-block;
  transition: transform 0.15s;
  margin-left: 0.3rem;
}
.catalog-specialty-group.collapsed .specialty-arrow { transform: rotate(-90deg); }
.catalog-specialty-group.collapsed .specialty-procedures { display: none; }
.catalog-specialty-group.collapsed .specialty-heading {
  border-bottom-color: transparent;
  border-radius: var(--radius);
}
.specialty-count { font-weight: 400; opacity: 0.75; }

.procedure-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.procedure-item:last-child { border-bottom: none; }
.procedure-item:hover { background: var(--gray-50); }

.proc-item-title { font-size: 0.82rem; font-weight: 600; color: var(--gray-900); }
.proc-item-meta { font-size: 0.7rem; color: var(--gray-400); }

.hosp-dir-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}
.hosp-dir-title { font-family: var(--font-heading); font-size: 0.9rem; font-weight: 700; color: var(--gray-900); }

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 1rem 0;
  font-size: 0.74rem;
  color: var(--gray-500);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.hidden { display: none !important; }
.text-right { text-align: right; }
.loading-spinner { font-size: 0.84rem; color: var(--gray-500); padding: 1rem; }

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  .app-header, .console-card, .results-toolbar, .app-footer, .btn-tool, .btn-ghost, .btn-key { display: none !important; }
  .results-section { gap: 1rem; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 820px) {
  .hero-title { font-size: 1.3rem; }
  .filters-grid { grid-template-columns: 1fr; }
  .context-grid { grid-template-columns: 1fr; }
  .agg-stats-row { grid-template-columns: 1fr; }
  .section-title-row { flex-direction: column; align-items: flex-start; }
  .procedure-tabs { overflow-x: auto; }
  .hospital-table { font-size: 0.74rem; }
}
