/* ==========================================================================
   Allela Component Classes
   Use with allela-tokens.css. Structural patterns from Maven Clinic,
   adapted to Allela pink palette with thick serif headlines.
   ========================================================================== */

/* ---------- Container ---------- */

.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

/* ---------- Site Nav ---------- */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: transparent;
  padding: var(--space-3) 0;
}

.nav-pill {
  background: linear-gradient(135deg, var(--color-deepest) 0%, #5A1530 100%);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  border: 1px solid rgba(194, 24, 91, 0.15);
  box-shadow: 0 2px 12px rgba(61, 12, 27, 0.3);
}

.nav-pill a,
.nav-pill button,
.nav-pill span {
  color: #fff;
}

.nav-pill a:hover {
  color: var(--color-mid);
}

.nav-pill-center {
  background: linear-gradient(135deg, var(--color-deepest) 0%, #5A1530 100%);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  border: 1px solid rgba(194, 24, 91, 0.15);
  box-shadow: 0 2px 12px rgba(61, 12, 27, 0.3);
}

.nav-pill-center a {
  color: rgba(255, 255, 255, 0.8);
}

.nav-pill-center a:hover {
  color: #fff;
}

.nav-pill-center a.nav-active {
  color: #fff;
}

/* Mobile menu dropdown */
.nav-mobile-panel {
  background: linear-gradient(135deg, var(--color-deepest) 0%, #5A1530 100%);
  border-radius: var(--radius-lg);
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid rgba(194, 24, 91, 0.15);
  box-shadow: 0 4px 20px rgba(61, 12, 27, 0.4);
}

.nav-mobile-panel a,
.nav-mobile-panel button {
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
}

.nav-mobile-panel a:hover,
.nav-mobile-panel button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Hamburger icon on transparent nav */
.nav-hamburger {
  color: rgba(255, 255, 255, 0.8);
}

.nav-hamburger:hover {
  color: #fff;
}

/* ---------- Site Footer ---------- */

.site-footer {
  background-color: var(--color-deepest);
  color: #fff;
  padding: var(--section-sm) 0;
  margin-top: var(--section-sm);
}

.site-footer .footer-brand {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}

.site-footer .footer-tagline {
  color: var(--white-60);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

.site-footer h4 {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white-40);
  margin-bottom: var(--space-3);
}

.site-footer a {
  color: var(--white-70);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

.site-footer a:hover {
  color: #fff;
}

.site-footer .footer-legal {
  color: var(--white-40);
  font-size: var(--text-sm);
}

.site-footer .footer-divider {
  border-top: 1px solid var(--white-10);
}

.site-footer .footer-powered {
  color: var(--white-30);
  font-size: var(--text-xs);
}

.site-footer .footer-powered a {
  color: var(--white-50);
}

.site-footer .footer-powered a:hover {
  color: #fff;
}

/* ---------- Form Elements ---------- */

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-natural-dark);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-light);
}

.form-input::placeholder {
  color: var(--color-muted);
}

.form-select {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-natural-dark);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  background-color: #fff;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-light);
}

.form-checkbox {
  accent-color: var(--color-primary);
}

/* ---------- Upload Drop Zone ---------- */

.upload-dropzone {
  display: block;
  width: 100%;
  border: 2px dashed var(--color-natural-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default),
              background-color var(--duration-fast) var(--ease-default);
}

.upload-dropzone:hover {
  border-color: var(--color-mid);
  background-color: var(--color-lightest);
}

.upload-dropzone svg {
  color: var(--color-mid);
}

/* ---------- Flash Messages ---------- */

.flash-notice {
  border-radius: var(--radius-lg);
  background-color: #E8F5E9;
  border: 1px solid #BBF7D0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: #166534;
}

.flash-alert {
  border-radius: var(--radius-lg);
  background-color: var(--color-lightest);
  border: 1px solid var(--color-light);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-deepest);
}

/* ---------- Link styles ---------- */

.link-primary {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

.link-primary:hover {
  color: var(--color-primary-hover);
}

/* ---------- Icon Box ---------- */

.icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.icon-box-primary {
  background-color: var(--color-light);
  color: var(--color-primary);
}

/* ---------- Card with brand border ---------- */

.card-brand {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-brand-light {
  background: var(--color-lightest);
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* ---------- Data Table ---------- */

.data-table {
  width: 100%;
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table thead tr {
  border-bottom: 1px solid var(--color-natural-dark);
  background: var(--color-natural);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-natural);
  transition: background-color var(--duration-fast) var(--ease-default);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover {
  background-color: var(--color-lightest);
}

/* ---------- Pagination ---------- */

.pagination-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-natural-dark);
  color: var(--color-primary);
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.pagination-link:hover {
  background-color: var(--color-lightest);
}

/* ---------- Tag ---------- */

.tag-primary {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-xl);
  background-color: var(--color-lightest);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* ---------- Progress Bar ---------- */

.progress-bar {
  background-color: var(--color-mid);
  border-radius: var(--radius-pill);
}

/* ---------- Genotype highlight ---------- */

.genotype-yours {
  border-color: var(--color-mid);
  background-color: var(--color-lightest);
}

/* ---------- Panel: Dark ---------- */

.panel-dark {
  background-color: var(--color-deepest);
  color: #fff;
  padding: var(--section-md) 0;
}

.panel-dark a:not(.btn-primary):not(.btn-secondary):not(.btn-ghost) {
  color: var(--color-mid);
  text-decoration: underline;
  text-decoration-color: var(--white-30);
  text-underline-offset: 2px;
  transition: color var(--duration-fast) var(--ease-default);
}

.panel-dark a:not(.btn-primary):not(.btn-secondary):not(.btn-ghost):hover {
  color: #fff;
  text-decoration-color: var(--white-60);
}

.panel-dark .text-muted { color: var(--white-70); }
.panel-dark .border-subtle { border-color: var(--white-10); }

/* ---------- Panel: Light ---------- */

.panel-light {
  background-color: var(--color-lightest);
  color: var(--color-deepest);
  padding: var(--section-md) 0;
}

.panel-natural {
  background-color: var(--color-natural);
  color: var(--color-deepest);
  padding: var(--section-md) 0;
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(135deg, var(--color-deepest) 0%, #5A1530 50%, var(--color-primary-hover) 100%);
  padding: var(--section-lg) 0 var(--section-sm);
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-6);
}

.hero p {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  color: var(--white-80);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  text-wrap: balance;
}


/* ---------- Headings ---------- */

.heading-display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.heading-1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.heading-2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.heading-3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  text-wrap: balance;
}

.panel-dark .eyebrow { color: var(--color-mid); }

/* ---------- Card ---------- */

.card {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-flat {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

/* ---------- Buttons ---------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  background-color: var(--color-primary);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default);
}

.btn-secondary:hover {
  background-color: var(--color-primary);
  color: #fff;
}

.panel-dark .btn-secondary,
.hero .btn-secondary {
  color: #fff;
  border-color: var(--white-40);
}

.panel-dark .btn-secondary:hover,
.hero .btn-secondary:hover {
  background-color: var(--white-20);
  border-color: #fff;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.btn-ghost:hover { background-color: var(--color-light); }
.panel-dark .btn-ghost { color: #fff; }
.panel-dark .btn-ghost:hover { background-color: var(--white-10); }

.btn-lg {
  padding: var(--space-4) var(--space-10);
  font-size: var(--text-base);
}

.btn-sm {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
}

/* ---------- Feature Grid ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--space-8);
}

@media (min-width: 640px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-item { text-align: left; }

.feature-icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-light);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
}

.panel-dark .feature-icon {
  background-color: var(--white-10);
  color: var(--color-mid);
}

.feature-item h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  text-wrap: balance;
}

.feature-item p {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-muted);
  text-wrap: balance;
}

.panel-dark .feature-item p { color: var(--white-60); }

/* ---------- Data Card ---------- */

.data-card {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.data-card-allele {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  min-width: 3.5rem;
  text-align: center;
  flex-shrink: 0;
}

.data-card-body h4 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.data-card-body p {
  font-size: var(--text-sm);
  color: #666;
  line-height: 1.5;
}

.data-card-rsid {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ---------- Severity ---------- */

.severity-critical {
  background-color: #FDE8E8;
  color: #991B1B;
  border-color: #FECACA;
}

.severity-warning {
  background-color: #FFF3E0;
  color: #9A3412;
  border-color: #FED7AA;
}

.severity-caution {
  background-color: #FFFDE7;
  color: #854D0E;
  border-color: #FEF08A;
}

.severity-normal {
  background-color: #E8F5E9;
  color: #166534;
  border-color: #BBF7D0;
}

.severity-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.severity-dot-critical { background-color: #DC2626; }
.severity-dot-warning  { background-color: #EA580C; }
.severity-dot-caution  { background-color: #CA8A04; }
.severity-dot-normal   { background-color: #16A34A; }

/* ---------- Stats ---------- */

.stat { text-align: center; }

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
}

.panel-dark .stat-value { color: var(--color-accent); }

.stat-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-2);
}

.panel-dark .stat-label { color: var(--white-60); }

/* ---------- Divider ---------- */

.divider {
  border: none;
  border-top: 1px solid var(--color-natural-dark);
  margin: var(--section-xs) 0;
}

.panel-dark .divider { border-top-color: var(--white-10); }

/* ---------- Badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  background-color: var(--color-light);
  color: var(--color-primary);
}

.badge-dark {
  background-color: var(--white-10);
  color: var(--color-mid);
}

/* ---------- iPhone Frame ---------- */

.iphone-frame {
  width: 280px;
  height: 580px;
  background: #1a1a1a;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 24px 64px rgba(61, 12, 27, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  position: relative;
  margin: 0 auto;
}

.iphone-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-deepest) 0%, #5A1530 100%);
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.iphone-notch {
  width: 80px;
  height: 24px;
  background: #1a1a1a;
  border-radius: 12px;
  margin: 8px auto 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.chat-header-area {
  flex-shrink: 0;
  margin-top: -36px;
  padding-top: 40px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  flex-shrink: 0;
}

.chat-header-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.chat-header-icon {
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.chat-messages {
  flex: 1;
  padding: 12px;
  margin: 0;
  background: #fff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
}

.chat-bubble.visible {
  animation: bubble-appear 0.35s var(--ease-default) forwards;
}

.bubble-user {
  align-self: flex-end;
  background-color: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-allela {
  align-self: flex-start;
  background-color: var(--color-lightest);
  color: var(--color-deepest);
  border-bottom-left-radius: 4px;
}

@keyframes bubble-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background-color: var(--color-lightest);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  opacity: 0;
  transform: translateY(8px);
}

.typing-indicator.visible {
  animation: bubble-appear 0.35s var(--ease-default) forwards;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

/* Chat container fade transition */
.chat-messages.fade-out {
  opacity: 0;
  transition: opacity 0.4s var(--ease-default);
}

.chat-messages.fade-in {
  opacity: 1;
  transition: opacity 0.4s var(--ease-default);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 16px;
  flex-shrink: 0;
}

.chat-input-fake {
  flex: 1;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
}

.chat-input-send {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Chat Modal ---------- */

.allela-dots {
  display: inline-block;
  width: 1.5ch;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.chat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(61, 12, 27, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s var(--ease-default);
}

.chat-modal-overlay.hidden {
  display: none;
}

.chat-modal-active {
  opacity: 1;
}

.chat-modal-active .chat-modal-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.chat-modal-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #fff;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  transition: opacity 0.3s var(--ease-default),
              transform 0.3s var(--ease-default);
}

@media (min-width: 640px) {
  .chat-modal-panel {
    width: 90vw;
    height: 85vh;
    max-width: 1100px;
    max-height: 800px;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(61, 12, 27, 0.35);
  }
}

.chat-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-natural-dark);
  flex-shrink: 0;
}

.chat-modal-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-modal-header-info {
  flex: 1;
  min-width: 0;
}

.chat-modal-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  line-height: 1.2;
}

.chat-modal-status {
  font-size: var(--text-xs);
  color: var(--color-muted);
  line-height: 1.2;
}

.chat-modal-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chat-modal-header-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-lightest);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-deepest);
  transition: background 0.15s var(--ease-default);
}

.chat-modal-header-btn:hover {
  background: var(--color-natural-dark);
}

.chat-modal-sidebar-btn {
  display: flex;
}

@media (min-width: 640px) {
  .chat-modal-sidebar-btn {
    display: none;
  }
}

.chat-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-modal-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.chat-modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-modal-messages .chat-bubble {
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-4);
  max-width: 80%;
  opacity: 1;
  transform: none;
}

.chat-modal-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-natural-dark);
  flex-shrink: 0;
}

.chat-modal-input {
  flex: 1;
  height: 40px;
  background: var(--color-lightest);
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-deepest);
  outline: none;
  transition: border-color 0.15s var(--ease-default);
}

.chat-modal-input:focus {
  border-color: var(--color-primary);
}

.chat-modal-input::placeholder {
  color: var(--color-muted);
}

.chat-modal-send {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s var(--ease-default);
}

.chat-modal-send:hover {
  background: var(--color-deep);
}

.chat-sidebar {
  width: 280px;
  border-left: 1px solid var(--color-natural-dark);
  background: var(--color-lightest);
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .chat-sidebar {
    display: flex;
  }
}

/* Mobile sidebar: slides in as full-width overlay */
@media (max-width: 639px) {
  .chat-sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 10;
    border-left: none;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-default);
  }

  .chat-sidebar-open {
    display: flex;
    transform: translateX(0);
  }
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-natural-dark);
  flex-shrink: 0;
}

.chat-sidebar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
}

.chat-sidebar-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}

@media (min-width: 640px) {
  .chat-sidebar-close {
    display: none;
  }
}

.chat-sidebar-list {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-doc-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  position: relative;
  cursor: pointer;
  transition: background 0.15s var(--ease-default);
}

.chat-doc-item:hover {
  background: rgba(61, 12, 27, 0.05);
}

.chat-doc-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.chat-doc-info {
  flex: 1;
  min-width: 0;
}

.chat-doc-name {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
}

.chat-doc-meta {
  font-size: var(--text-xs);
  color: var(--color-muted);
  line-height: 1.3;
}

/* Chat notification (documentor system messages) */
.chat-notification {
  text-align: center;
  padding: var(--space-2) 0;
}

.chat-notification-text {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-style: italic;
  padding: var(--space-1) var(--space-4);
  background: var(--color-natural);
  border-radius: var(--radius-pill);
}

.chat-notification-download {
  color: var(--color-muted);
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
}
.chat-notification-download:hover { opacity: 1; color: var(--color-primary); }

.chat-doc-download {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  background: var(--color-natural);
  transition: color 0.15s;
}
.chat-doc-item:hover .chat-doc-download { display: flex; }
.chat-doc-download:hover { color: var(--color-primary); }

/* Typing indicator inside chat modal */
.chat-typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-lightest);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-typing-indicator .typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.chat-typing-indicator .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-indicator .typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Markdown inside assistant bubbles */
.chat-bubble-markdown h1,
.chat-bubble-markdown h2,
.chat-bubble-markdown h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: var(--space-3) 0 var(--space-2);
  line-height: 1.3;
}

.chat-bubble-markdown h1 { font-size: var(--text-lg); }
.chat-bubble-markdown h2 { font-size: var(--text-base); }
.chat-bubble-markdown h3 { font-size: var(--text-sm); font-weight: 700; }

.chat-bubble-markdown h1:first-child,
.chat-bubble-markdown h2:first-child,
.chat-bubble-markdown h3:first-child {
  margin-top: 0;
}

.chat-bubble-markdown p {
  margin: var(--space-2) 0;
  line-height: 1.6;
}

.chat-bubble-markdown p:first-child { margin-top: 0; }
.chat-bubble-markdown p:last-child { margin-bottom: 0; }

.chat-bubble-markdown ul,
.chat-bubble-markdown ol {
  margin: var(--space-2) 0;
  padding-left: 1.5em;
}

.chat-bubble-markdown li {
  margin: var(--space-1) 0;
  line-height: 1.5;
}

.chat-bubble-markdown strong { font-weight: 600; }

.chat-bubble-markdown a {
  color: var(--color-primary);
  text-decoration: underline;
}

.chat-bubble-markdown code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
}

.chat-bubble-markdown pre {
  background: rgba(0, 0, 0, 0.06);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: var(--space-2) 0;
}

.chat-bubble-markdown pre code {
  background: none;
  padding: 0;
}

/* Disabled send button */
.chat-modal-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-modal-input:disabled {
  opacity: 0.6;
}

/* Dashboard document cards */
.hub-doc-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .hub-doc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .hub-doc-grid { grid-template-columns: repeat(3, 1fr); }
}

.hub-doc-card {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.hub-doc-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.hub-doc-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-lightest);
  border: 1px solid var(--color-natural-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.hub-doc-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-deepest);
  margin-bottom: var(--space-2);
}

.hub-doc-card-preview {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .chat-modal-overlay,
  .chat-modal-panel,
  .chat-sidebar {
    transition: none;
  }
}

/* ---------- Pricing Grid ---------- */

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  max-width: 960px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .pricing-grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

.pricing-card {
  background: #fff;
  border: 1px solid var(--color-natural-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  position: relative;
  transition: box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.pricing-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.pricing-card-featured {
  border-color: var(--color-primary);
  border-width: 2px;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .pricing-card-featured {
    transform: scale(1.05);
  }
  .pricing-card-featured:hover {
    transform: scale(1.05) translateY(-2px);
  }
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-pill);
}

.pricing-tier {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.pricing-price {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-deepest);
  line-height: 1;
}

.pricing-period {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-1);
  margin-bottom: var(--space-6);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
  text-align: left;
}

.pricing-features li {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-deepest);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-natural);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.pricing-features li:last-child { border-bottom: none; }

.pricing-check {
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- MCP Flow Diagram ---------- */

.mcp-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin: var(--space-8) 0;
}

.mcp-flow-node {
  background: var(--white-10);
  border: 1px solid var(--white-20);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  color: #fff;
}

.mcp-flow-node-allela {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.mcp-flow-arrow {
  color: var(--white-40);
  font-size: var(--text-xl);
}

/* ---------- Provider Logos ---------- */

.logo-mono {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ---------- Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .chat-bubble.visible {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .typing-indicator.visible {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .typing-dot {
    animation: none;
  }
  .chat-typing-indicator .typing-dot {
    animation: none;
  }
  .chat-messages.fade-out,
  .chat-messages.fade-in {
    transition: none;
  }
}
