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

:root {
  --bg: #070d1a;
  --surface: #0d1829;
  --surface2: #111f35;
  --border: #1a2e4a;
  --accent: #00c2e0;
  --accent2: #0ea5a0;
  --accent-dim: rgba(0, 194, 224, 0.12);
  --text: #ddeaf5;
  --muted: #4d6b8a;
  --danger: #e85c5c;
  --success: #34c77b;
  --warn: #f0a430;
  --radius: 14px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Inter', sans-serif;
  --sidebar-w: 278px;
}

html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ════════════════════════════════════════════
 TOAST NOTIFICATIONS
════════════════════════════════════════════ */
#toast-rack {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}
.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.toast.info {
  background: rgba(13, 24, 41, 0.95);
  border-color: rgba(0, 194, 224, 0.35);
  color: var(--text);
}
.toast.success {
  background: rgba(13, 24, 41, 0.95);
  border-color: rgba(52, 199, 123, 0.4);
  color: #34c77b;
}
.toast.error {
  background: rgba(13, 24, 41, 0.95);
  border-color: rgba(232, 92, 92, 0.4);
  color: #e85c5c;
}
.toast.warn {
  background: rgba(13, 24, 41, 0.95);
  border-color: rgba(240, 164, 48, 0.4);
  color: #f0a430;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ════════════════════════════════════════════
 LANDING
════════════════════════════════════════════ */
#landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(7, 13, 26, 0.75);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(26, 46, 74, 0.6);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.nav-logo img {
  height: 34px;
  width: auto;
}
.nav-logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-ctas {
  display: flex;
  gap: 10px;
}

.btn-ghost {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn-primary {
  padding: 8px 22px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #070d1a;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 18px rgba(0, 194, 224, 0.3);
}
.btn-primary:hover {
  opacity: 0.88;
  box-shadow: 0 0 30px rgba(0, 194, 224, 0.5);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Hero */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 130px 24px 70px;
  position: relative;
  overflow: hidden;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(26, 46, 74, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 46, 74, 0.18) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse 75% 65% at 50% 50%,
    black 20%,
    transparent 100%
  );
  pointer-events: none;
}

/* ── Animated SVG Knowledge Graph ── */
.hero-graph {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
#kg-svg {
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-logo-wrap {
  margin-bottom: 24px;
  display: inline-block;
}
.hero-logo {
  height: 72px;
  width: auto;
  filter: drop-shadow(0 0 28px rgba(0, 194, 224, 0.5));
  animation: float 5s ease-in-out infinite alternate;
}
@keyframes float {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-9px);
  }
}

.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.5vw, 3.9rem);
  font-weight: 800;
  line-height: 1.07;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  background: linear-gradient(130deg, #fff 0%, #aad8ea 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  color: var(--muted);
  max-width: 560px;
  line-height: 1.72;
  margin-bottom: 38px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 64px;
}
.hero-actions .btn-primary {
  padding: 13px 32px;
  font-size: 1rem;
  border-radius: 10px;
}
.hero-actions .btn-ghost {
  padding: 13px 32px;
  font-size: 1rem;
  border-radius: 10px;
  color: var(--text);
}

/* Claim-check chips */
.claim-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 56px;
}
.chip {
  padding: 6px 14px;
  background: rgba(0, 194, 224, 0.07);
  border: 1px solid rgba(0, 194, 224, 0.2);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}

/* Video */
.video-section {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.video-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  text-align: center;
}
.video-frame-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 0 60px rgba(0, 194, 224, 0.07), 0 40px 80px rgba(0, 0, 0, 0.6);
}
.video-frame-wrap::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 19px;
  background: linear-gradient(
    135deg,
    rgba(0, 194, 224, 0.18),
    rgba(14, 165, 160, 0.12)
  );
  z-index: -1;
  filter: blur(18px);
}
.video-inner {
  position: relative;
  padding-bottom: 56.25%;
}
.video-inner iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Features */
.features {
  padding: 80px 24px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  transition: border-color 0.25s, transform 0.25s;
}
.feature-card:hover {
  border-color: rgba(0, 194, 224, 0.35);
  transform: translateY(-4px);
}
.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.feature-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.65;
}

.landing-footer {
  text-align: center;
  padding: 22px;
  border-top: 1px solid var(--border);
  font-size: 0.73rem;
  color: var(--muted);
}

/* Aetna info strip */
.aetna-info-strip {
  width: 100%;
  max-width: 820px;
  background: rgba(0, 194, 224, 0.04);
  border: 1px solid rgba(0, 194, 224, 0.15);
  border-radius: 14px;
  padding: 18px 24px 14px;
  margin: 0 auto 40px;
}
.aetna-info-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.aetna-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  flex: 1;
  min-width: 180px;
}
.aetna-info-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.aetna-info-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.aetna-info-value {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}
.aetna-info-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}
.aetna-disclaimer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid rgba(26, 46, 74, 0.6);
  padding-top: 10px;
  line-height: 1.6;
}
.aetna-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.aetna-link:hover {
  text-decoration: underline;
}
.plan-badge {
  background: rgba(0, 194, 224, 0.08) !important;
  border: 1px solid rgba(0, 194, 224, 0.25) !important;
  color: var(--accent) !important;
  text-decoration: none;
  transition: background 0.2s;
}
.plan-badge:hover {
  background: rgba(0, 194, 224, 0.15) !important;
}
@media (max-width: 700px) {
  .aetna-info-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .aetna-info-divider {
    display: none;
  }
  .aetna-info-item {
    padding: 0 8px;
  }
  .aetna-info-strip {
    padding: 16px;
  }
}

/* ════════════════════════════════════════════
 AUTH MODAL
════════════════════════════════════════════ */
#auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#auth-overlay.open {
  display: flex;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 42px 38px 34px;
  width: 100%;
  max-width: 396px;
  position: relative;
  animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.auth-close {
  position: absolute;
  top: 15px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}
.auth-close:hover {
  color: var(--text);
}
.auth-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.auth-logo-row img {
  height: 28px;
}
.auth-logo-row span {
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.auth-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 5px;
}
.auth-card > p {
  color: var(--muted);
  font-size: 0.83rem;
  margin-bottom: 26px;
}
.tab-row {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}
.tab.active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.field {
  margin-bottom: 17px;
}
.field label {
  display: block;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.field input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 194, 224, 0.1);
}
.field input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
.btn-auth {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #070d1a;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(0, 194, 224, 0.3);
}
.btn-auth:hover {
  opacity: 0.88;
  box-shadow: 0 0 30px rgba(0, 194, 224, 0.5);
}
.btn-auth:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.err {
  color: var(--danger);
  font-size: 0.79rem;
  margin-top: 11px;
  min-height: 17px;
}

/* ════════════════════════════════════════════
 MAIN APP
════════════════════════════════════════════ */
#app {
  display: none;
  height: 100vh;
  overflow: hidden;
}
#app.visible {
  display: flex;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 18px 16px 13px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}
.sidebar-brand img {
  height: 24px;
}
.sidebar-brand span {
  font-family: var(--font-display);
  font-size: 0.92rem;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface2);
  border-radius: 8px;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.63rem;
  font-weight: 700;
  color: #070d1a;
  flex-shrink: 0;
}
.user-name {
  font-size: 0.81rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.new-session-btn {
  margin: 13px;
  padding: 10px;
  background: transparent;
  border: 1px dashed rgba(0, 194, 224, 0.3);
  border-radius: 10px;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.new-session-btn:hover {
  background: rgba(0, 194, 224, 0.06);
  border-color: var(--accent);
}
.sessions-label {
  padding: 0 16px 7px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
#session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 9px;
}
.session-item {
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.session-item:hover {
  background: var(--surface2);
}
.session-item.active {
  background: rgba(0, 194, 224, 0.07);
  border-color: rgba(0, 194, 224, 0.2);
}
.session-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.s-label {
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.s-date {
  font-size: 0.69rem;
  color: var(--muted);
}
.sidebar-footer {
  padding: 13px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.81rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Chat panel */
#chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
#chat-header {
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
}
#chat-title {
  font-size: 0.93rem;
  font-weight: 600;
}
.header-badge {
  font-size: 0.66rem;
  padding: 2px 8px;
  background: rgba(0, 194, 224, 0.1);
  border: 1px solid rgba(0, 194, 224, 0.22);
  border-radius: 20px;
  color: var(--accent);
  font-weight: 500;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-row {
  display: flex;
  gap: 7px;
}
.export-btn {
  padding: 5px 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.73rem;
  transition: all 0.15s;
}
.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
}
#messages-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.msg-row {
  display: flex;
  gap: 13px;
  animation: msg-in 0.3s ease;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.msg-row.user {
  justify-content: flex-end;
}
.msg-row.agent {
  justify-content: flex-start;
}
.agent-avatar {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 4px;
}
.msg-bubble {
  max-width: 72%;
  border-radius: 18px;
  padding: 13px 17px;
  font-size: 0.9rem;
  line-height: 1.67;
}
.msg-bubble.user {
  background: rgba(0, 194, 224, 0.09);
  border: 1px solid rgba(0, 194, 224, 0.2);
  border-bottom-right-radius: 4px;
}
.msg-bubble.agent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  font-size: 0.67rem;
  color: var(--muted);
  margin-top: 7px;
}

/* ── Markdown styles inside agent bubbles ── */
.msg-bubble.agent strong {
  color: var(--text);
  font-weight: 600;
}
.msg-bubble.agent em {
  font-style: italic;
  color: var(--text);
}
.msg-bubble.agent h1,
.msg-bubble.agent h2,
.msg-bubble.agent h3 {
  font-family: var(--font-display);
  color: var(--text);
  margin: 12px 0 6px;
  line-height: 1.25;
}
.msg-bubble.agent h1 {
  font-size: 1.05rem;
}
.msg-bubble.agent h2 {
  font-size: 0.97rem;
}
.msg-bubble.agent h3 {
  font-size: 0.9rem;
}
.msg-bubble.agent p {
  margin-bottom: 10px;
}
.msg-bubble.agent p:last-child {
  margin-bottom: 0;
}
.msg-bubble.agent ul,
.msg-bubble.agent ol {
  margin: 8px 0 8px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-bubble.agent li {
  font-size: 0.88rem;
  line-height: 1.6;
}
.msg-bubble.agent code {
  background: rgba(0, 194, 224, 0.1);
  border: 1px solid rgba(0, 194, 224, 0.18);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--accent);
}
.msg-bubble.agent pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
}
.msg-bubble.agent pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.81rem;
  color: #8bcfdf;
}
.msg-bubble.agent blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--muted);
  font-style: italic;
  margin: 8px 0;
}
.msg-bubble.agent table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  margin: 10px 0;
}
.msg-bubble.agent th {
  background: var(--surface2);
  color: var(--accent);
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}
.msg-bubble.agent td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  color: var(--text);
}
.msg-bubble.agent a {
  color: var(--accent);
  text-decoration: underline;
}

/* Verdict badge */
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 10px;
}
.verdict-badge.pass {
  background: rgba(52, 199, 123, 0.12);
  border: 1px solid rgba(52, 199, 123, 0.35);
  color: #34c77b;
}
.verdict-badge.fail {
  background: rgba(232, 92, 92, 0.12);
  border: 1px solid rgba(232, 92, 92, 0.35);
  color: #e85c5c;
}
.verdict-badge.review {
  background: rgba(240, 164, 48, 0.12);
  border: 1px solid rgba(240, 164, 48, 0.35);
  color: #f0a430;
}

.trace-btn {
  margin-top: 10px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid rgba(0, 194, 224, 0.25);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.71rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.trace-btn:hover {
  background: rgba(0, 194, 224, 0.08);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
  min-height: 300px;
}
.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.empty-state p {
  font-size: 0.88rem;
  max-width: 250px;
}
.empty-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.example-chip {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.79rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  text-align: left;
}
.example-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Thinking / loading */
.thinking-row {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  animation: msg-in 0.3s ease;
}
.thinking-content {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.thinking-label {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.shimmer-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.shimmer {
  height: 11px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface2) 40%,
    var(--surface) 80%
  );
  background-size: 200% 100%;
  animation: shimmer-move 1.6s linear infinite;
}
.shimmer:nth-child(1) {
  width: 250px;
}
.shimmer:nth-child(2) {
  width: 195px;
  animation-delay: 0.14s;
}
.shimmer:nth-child(3) {
  width: 220px;
  animation-delay: 0.28s;
}
@keyframes shimmer-move {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.pulse-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 3px 0;
}
.pulse-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.pulse-dots span:nth-child(1) {
  animation-delay: 0s;
}
.pulse-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.pulse-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(0.8);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Input */
#input-area {
  padding: 18px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.input-box {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 7px 4px 15px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 194, 224, 0.08);
}
#query-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  padding: 12px 0;
  line-height: 1.55;
  max-height: 140px;
}
#query-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
#send-btn {
  width: 37px;
  height: 37px;
  border-radius: 9px;
  background: var(--accent);
  border: none;
  color: #070d1a;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, box-shadow 0.2s;
  margin-bottom: 4px;
}
#send-btn:hover {
  box-shadow: 0 0 16px rgba(0, 194, 224, 0.4);
}
#send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}
.input-hint {
  text-align: center;
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 7px;
}

/* ════════════════════════════════════════════
 GRAPH MODAL
════════════════════════════════════════════ */
#graph-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
#graph-modal.open {
  display: flex;
}
.graph-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(710px, 95vw);
  padding: 26px;
  animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.graph-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.graph-card-header h4 {
  font-size: 0.97rem;
  font-weight: 600;
}
.close-modal {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}
.close-modal:hover {
  color: var(--text);
}
#graph-svg {
  width: 100%;
  height: 330px;
  background: var(--bg);
  border-radius: 9px;
  border: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}
.sidebar-overlay.open {
  display: block;
}
@media (max-width: 700px) {
  .nav {
    padding: 13px 18px;
  }
  .nav-logo-text {
    display: none;
  }
  .nav-ctas .btn-ghost {
    display: none;
  }
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  .menu-toggle {
    display: flex;
  }
  .msg-bubble {
    max-width: 90%;
  }
  .shimmer:nth-child(1) {
    width: 170px;
  }
  .shimmer:nth-child(2) {
    width: 140px;
  }
  .shimmer:nth-child(3) {
    width: 155px;
  }
  #messages-inner {
    padding: 0 13px;
  }
  #input-area {
    padding: 13px;
  }
  .auth-card {
    padding: 34px 22px 26px;
  }
  .hero {
    padding: 95px 18px 55px;
  }
  #toast-rack {
    bottom: 16px;
    right: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo,
  #kg-svg .kg-node {
    animation: none;
  }
  .shimmer {
    animation: none;
    background: var(--surface2);
  }
  .pulse-dots span {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════════════
   MEDICAL HISTORY MODAL
════════════════════════════════════════════ */
#mh-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#mh-modal.open {
  display: flex;
}

.mh-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mh-card-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mh-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.mh-card-header p {
  font-size: 0.8rem;
  color: var(--muted);
}
.mh-required-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 10px;
  background: rgba(240, 164, 48, 0.1);
  border: 1px solid rgba(240, 164, 48, 0.3);
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--warn);
  font-weight: 500;
}
.mh-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.mh-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.mh-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Basic fields row */
.mh-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.mh-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}
.mh-field label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.mh-field label span.req {
  color: var(--danger);
}
.mh-input {
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.mh-input:focus {
  border-color: var(--accent);
}
select.mh-input {
  cursor: pointer;
}
select.mh-input option {
  background: var(--surface);
}

/* Dynamic list items (conditions, meds, etc.) */
.mh-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mh-list-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.mh-list-item .mh-field {
  min-width: 100px;
}
.mh-remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 5px;
  margin-top: 20px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.mh-remove-btn:hover {
  color: var(--danger);
}
.mh-add-btn {
  padding: 8px 14px;
  background: transparent;
  border: 1px dashed rgba(0, 194, 224, 0.3);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
}
.mh-add-btn:hover {
  background: rgba(0, 194, 224, 0.06);
  border-color: var(--accent);
}

/* Tag input (allergies, past procedures) */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 42px;
  cursor: text;
  transition: border-color 0.2s;
}
.tag-input-wrap:focus-within {
  border-color: var(--accent);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: rgba(0, 194, 224, 0.12);
  border: 1px solid rgba(0, 194, 224, 0.25);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
}
.tag-remove {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
}
.tag-remove:hover {
  opacity: 1;
}
.tag-ghost-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  min-width: 120px;
  flex: 1;
}
.tag-hint {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
}

.mh-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}
.mh-skip-btn {
  padding: 9px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}
.mh-skip-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}
.mh-save-btn {
  padding: 9px 24px;
  background: var(--accent);
  border: none;
  border-radius: 9px;
  color: #070d1a;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 16px rgba(0, 194, 224, 0.3);
}
.mh-save-btn:hover {
  opacity: 0.88;
}
.mh-save-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Inline badge in chat header showing history is saved */
.mh-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.66rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
}
.mh-status-badge.saved {
  background: rgba(52, 199, 123, 0.1);
  border-color: rgba(52, 199, 123, 0.3);
  color: var(--success);
}
.mh-status-badge.missing {
  background: rgba(240, 164, 48, 0.1);
  border-color: rgba(240, 164, 48, 0.3);
  color: var(--warn);
}

/* Blocked input overlay */
.input-blocked-banner {
  padding: 10px 18px;
  background: rgba(240, 164, 48, 0.08);
  border-top: 1px solid rgba(240, 164, 48, 0.2);
  text-align: center;
  font-size: 0.78rem;
  color: var(--warn);
  cursor: pointer;
  transition: background 0.2s;
}
.input-blocked-banner:hover {
  background: rgba(240, 164, 48, 0.14);
}

@media (max-width: 700px) {
  .mh-card {
    max-height: 95vh;
  }
  .mh-body {
    padding: 16px 18px;
  }
  .mh-card-header {
    padding: 18px 18px 14px;
  }
  .mh-footer {
    padding: 12px 18px;
  }
  .mh-row {
    flex-direction: column;
  }
}
