/* components.css — shared UI component styles */

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--color-teal);
  color: var(--color-navy);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #00e5c8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 201, 177, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
}

.btn-teal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  background: rgba(0, 201, 177, 0.15);
  color: var(--color-teal);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid rgba(0, 201, 177, 0.3);
  cursor: pointer;
}

.btn-teal:hover {
  background: rgba(0, 201, 177, 0.25);
  border-color: var(--color-teal);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: color var(--transition-fast);
  border: none;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--color-text);
}

/* Disabled state for all button types */
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-teal:disabled,
.btn-outline:disabled,
.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Gate modal sits above SmartIQ and all other modals */
#gateModal {
  z-index: var(--z-gate, 7000);
}

/* Site password gate — sits above everything */
#siteGateModal {
  z-index: var(--z-gate);
}

.site-gate-box {
  max-width: 400px;
  margin: auto;
}

.modal-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;

  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-normal);
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

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

.modal-header h2,
.modal-header h3 {
  font-size: var(--text-xl);
  color: var(--color-text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 240px;
  max-width: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  z-index: var(--z-toast);
}

.toast.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

.toast--info {
  border-color: rgba(0, 116, 183, 0.4);
  color: var(--color-text);
}

.toast--success {
  border-color: rgba(0, 201, 177, 0.4);
  color: var(--color-teal);
}

.toast--error {
  border-color: rgba(220, 60, 60, 0.4);
  color: #ff6b6b;
}

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.form-label--required::after {
  content: ' *';
  color: #ff6b6b;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(0, 201, 177, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(232,244,248,0.5)' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

.form-select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════
   STEPPER
══════════════════════════════════════════════════════ */

.stepper {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}

.stepper::-webkit-scrollbar {
  display: none;
}

.step-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid transparent;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  margin-bottom: -1px;
}

.step-tab:hover {
  color: var(--color-text);
}

.step-tab.active {
  color: var(--color-teal);
  border-bottom-color: var(--color-teal);
}

.step-tab.done {
  color: var(--color-text-muted);
}

.step-tab.done::before {
  content: '✓';
  color: var(--color-teal);
  font-size: var(--text-xs);
}

/* ══════════════════════════════════════════════════════
   CARRIER CHIPS
══════════════════════════════════════════════════════ */

.carrier-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.carrier-search {
  width: 100%;
  margin-bottom: var(--space-4);
}

.carrier-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.carrier-chip:hover {
  border-color: rgba(0, 201, 177, 0.4);
  color: var(--color-text);
}

.carrier-chip.selected {
  background: rgba(0, 201, 177, 0.15);
  border-color: rgba(0, 201, 177, 0.5);
  color: var(--color-teal);
}

.carrier-chip.state-match {
  border-color: rgba(0, 116, 183, 0.5);
  color: var(--color-blue);
}

/* ══════════════════════════════════════════════════════
   UPLOAD ZONE
══════════════════════════════════════════════════════ */

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-10) var(--space-6);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: rgba(0, 201, 177, 0.5);
  background: rgba(0, 201, 177, 0.04);
}

.upload-zone.locked {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.upload-zone__icon {
  font-size: 2rem;
  opacity: 0.5;
}

.upload-zone__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.upload-zone__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ══════════════════════════════════════════════════════
   INFO ROW
══════════════════════════════════════════════════════ */

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.info-row__value {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  text-align: right;
}

/* ══════════════════════════════════════════════════════
   MASKED / LOCKED
══════════════════════════════════════════════════════ */

.masked {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
}

.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: rgba(133, 113, 77, 0.15);
  border: 1px solid rgba(133, 113, 77, 0.3);
  color: var(--color-gold);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════════ */

.step-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.step-progress-fill {
  height: 100%;
  background: var(--color-teal);
  border-radius: 999px;
  transition: width var(--transition-normal);
}

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */

.footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-8);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer__nav {
  display: flex;
  gap: var(--space-6);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--color-text);
}

@media (max-width: 480px) {
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════
   Atlas Phase 3 additions — appended after Phase 1 rename
   ═══════════════════════════════════════════════════════════ */

/* ── Typing indicator ─────────────────────────────── */
.atlas-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
}
.atlas-typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue2, var(--blue));
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.atlas-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.atlas-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Reveal animation ─────────────────────────────── */
.reveal-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-section.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── For Brokers stats ────────────────────────────── */
.broker-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 32px 0;
}
.broker-stat {
  flex: 1;
  min-width: 140px;
  padding: 20px 24px;
  border: 1px solid rgba(0, 201, 177, 0.15);
  border-radius: 14px;
  background: rgba(0, 31, 63, 0.5);
  backdrop-filter: blur(8px);
}
.broker-stat-number {
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 6px;
}
.broker-stat-label {
  font-size: 0.8rem;
  color: var(--gray-light, #aab);
}

/* ── Progress bar (bottom nav) ────────────────────── */
.progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(0, 31, 63, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 201, 177, 0.2);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-bar.is-visible {
  transform: translateY(0);
}
.progress-bar[hidden] {
  display: none !important;
}
.progress-bar__pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 201, 177, 0.35);
  background: rgba(0, 201, 177, 0.08);
  color: var(--teal);
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.progress-pill:hover {
  background: rgba(0, 201, 177, 0.18);
  border-color: var(--teal);
  transform: translateY(-1px);
}
.progress-pill--complete {
  border-color: var(--teal);
  background: rgba(0, 201, 177, 0.15);
}
.progress-pill--pulse {
  animation: pill-pulse 2s ease-in-out infinite;
}
@keyframes pill-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 201, 177, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(0, 201, 177, 0.2); }
}
.progress-bar__cta {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Feature cards grid ───────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 48px;
}
.feature-card {
  padding: 32px 28px;
  border: 1px solid rgba(0, 201, 177, 0.12);
  border-radius: 16px;
  background: rgba(0, 31, 63, 0.45);
  backdrop-filter: blur(8px);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.feature-card:hover {
  border-color: rgba(0, 201, 177, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 201, 177, 0.08);
}
.feature-card__icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}
.feature-card__title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 8px;
}
.feature-card__body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gray-light, #aab);
}

/* ── How It Works steps ───────────────────────────── */
.hiw-steps {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: 48px auto 0;
  padding: 0 24px;
}
.hiw-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 200px;
}
.hiw-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 201, 177, 0.1);
  border: 1px solid rgba(0, 201, 177, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hiw-num {
  color: rgb(0, 201, 177);
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  margin-top: 12px;
}
.hiw-title {
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 6px;
}
.hiw-desc {
  color: var(--color-text-muted, #8899aa);
  font-size: 0.875rem;
  margin-top: 8px;
  line-height: 1.5;
}
.hiw-connector {
  flex: 0 0 24px;
  height: 1px;
  background: linear-gradient(to right, rgba(0, 201, 177, 0.4), rgba(0, 201, 177, 0.1));
  align-self: flex-start;
  margin-top: 28px;
}

/* ── Section headings ─────────────────────────────── */
.section-heading {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
}
.section-subheading {
  text-align: center;
  font-size: 1rem;
  color: var(--gray-light, #aab);
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.65;
}
.broker-cta {
  display: block;
  margin: 32px auto 0;
}

/* ── Chat widget ──────────────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 4000;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(0, 201, 177, 0.6);
  cursor: pointer;
  padding: 0;
  background: transparent;
  box-shadow: 0 0 0 4px rgba(0, 201, 177, 0.15), 0 4px 16px rgba(0, 201, 177, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 6px rgba(0, 201, 177, 0.2), 0 6px 20px rgba(0, 201, 177, 0.35);
}
.chat-fab img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.chat-panel {
  position: fixed;
  bottom: 176px;
  right: 24px;
  z-index: 4000;
  width: 380px;
  height: 520px;
  border-radius: 20px;
  border: 1px solid rgba(0, 201, 177, 0.2);
  background: var(--navy, #001f3f);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}
.chat-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
.chat-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(0, 201, 177, 0.12);
  flex-shrink: 0;
}
.chat-panel__title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}
.chat-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-light, #aab);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.chat-panel__close:hover { color: #fff; }
.chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg--assistant {
  align-self: flex-start;
  background: rgba(0, 201, 177, 0.1);
  border: 1px solid rgba(0, 201, 177, 0.15);
  color: #e8f4f8;
  border-bottom-left-radius: 4px;
}
.chat-msg--assistant p         { margin: 0 0 8px; }
.chat-msg--assistant p:last-child { margin-bottom: 0; }
.chat-msg--assistant ul,
.chat-msg--assistant ol        { margin: 6px 0 6px 16px; }
.chat-msg--assistant code {
  font-family: var(--font-mono, monospace);
  font-size: 0.82em;
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
}
.chat-panel__footer {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(0, 201, 177, 0.12);
  flex-shrink: 0;
}
.chat-panel__input {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid rgba(0, 201, 177, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #e8f4f8;
  font-family: var(--font-body, sans-serif);
  font-size: 0.88rem;
  padding: 10px 14px;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-panel__input:focus { border-color: var(--teal); }
.chat-panel__send {
  flex-shrink: 0;
  align-self: flex-end;
}
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 160px;
  }
  .chat-fab {
    bottom: 80px;
    right: 16px;
  }
}

/* ── Loss run analysis panel ──────────────────────── */
.lr-analysis-panel {
  margin-top: 20px;
  padding: 20px 24px;
  border-radius: 14px;
  border: 1px solid rgba(0, 201, 177, 0.2);
  background: rgba(0, 31, 63, 0.5);
  backdrop-filter: blur(8px);
  font-size: 0.9rem;
  line-height: 1.65;
  color: #e8f4f8;
}
.lr-analysis-panel[hidden] { display: none; }
.lr-analysis-panel__title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--teal);
  margin-bottom: 12px;
}
.lr-analysis-panel p       { margin: 0 0 10px; }
.lr-analysis-panel p:last-child { margin-bottom: 0; }
.lr-analysis-panel ul,
.lr-analysis-panel ol      { margin: 6px 0 6px 16px; }

/* END Atlas Phase 3 additions */

/* ══════════════════════════════════════════════════════
   Atlas Phase 4 additions
══════════════════════════════════════════════════════ */

/* ── Task 4c — CSS containment ── */
.feature-card  { contain: layout style; }
.hiw-step      { contain: layout style; }
.progress-pill { contain: layout style; }
.chat-msg      { contain: layout style; }

/* ── Task 1d — Gate modal bottom sheet @768px ── */
@media (max-width: 768px) {
  #gateModal {
    align-items: flex-end;
    padding: 0;
  }
  #gateModal .modal-box {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }
}

/* ── How It Works mobile ── */
@media (max-width: 768px) {
  .hiw-steps {
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }
  .hiw-step {
    max-width: 100%;
    width: 100%;
  }
  .hiw-connector {
    display: none;
  }
}

/* ── Task 1e — Progress bar overflow + CTA shrink ── */
@media (max-width: 640px) {
  .progress-bar__pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  body {
    padding-bottom: 72px;
  }
  #progressBuildBtn {
    font-size: 0.75rem;
    padding: 6px 10px;
    white-space: nowrap;
  }
}

/* ── Tasks 1f, 1g — Broker stats + features grid ── */
@media (max-width: 480px) {
  .broker-stats {
    flex-direction: column;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
}
