:root {
  --bg-outer: #EFECE6;
  --bg-chat: #FAF8F5;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F3EFE9;
  --bg-sage-soft: #EDF4F1;
  --bg-sage-tint: #DFEBE6;
  --bg-amber-soft: #FEF5E7;
  --bg-rose-soft: #FDF0EF;
  --bg-info-soft: #EEF4F9;

  --brand: #2B5B50;
  --brand-hover: #20473E;
  --brand-accent: #C27858;

  --text-main: #1C2320;
  --text-sec: #4C5752;
  --text-muted: #7C8781;

  --ok: #25604D;
  --ok-bg: #E7F4EE;
  --warn: #A35C16;
  --warn-bg: #FEF3E2;
  --high: #B23E37;
  --high-bg: #FCECEB;

  --border: #EAE4DB;
  --border-strong: #D6CEC2;

  --font-serif: "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "Inter", "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-outer);
  color: var(--text-main);
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.turnstile-hidden {
  position: fixed;
  bottom: -200px;
  left: -200px;
  opacity: 0;
  pointer-events: none;
}

/* ==================== APP SHELL (MOBILE FULLSCREEN + DESKTOP CENTERED CARD) ==================== */
.app-shell {
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app-card {
  width: 100%;
  max-width: 480px;
  height: min(880px, calc(100dvh - 32px));
  background: var(--bg-chat);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(24, 34, 30, 0.12), 0 4px 16px rgba(24, 34, 30, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==================== HEADER ==================== */
.chat-header {
  height: 56px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250, 248, 245, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(234, 228, 219, 0.9);
  flex-shrink: 0;
  z-index: 20;
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ai-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2B5B50 0%, #4E8577 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.hdr-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.hdr-sub {
  font-size: 12.5px;
  color: var(--brand);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #359672;
  display: inline-block;
  flex-shrink: 0;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.country-pill {
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
  padding: 5px 11px;
  border-radius: 99px;
  cursor: pointer;
}

.country-pill:hover {
  border-color: var(--brand);
}

.lang-pill {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-sec);
  font-size: 12px;
  font-weight: 700;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

.lang-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.hdr-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hdr-menu-btn:hover {
  background: var(--bg-subtle);
}

/* ==================== STATUS BANNER ==================== */
.status-banner {
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.status-banner.circuit {
  background: var(--bg-amber-soft);
  color: var(--warn);
}

.status-banner.followup {
  background: var(--bg-sage-soft);
  color: var(--brand);
  font-weight: 600;
}

/* ==================== CHAT STREAM ==================== */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.chat-stream::-webkit-scrollbar { width: 4px; }
.chat-stream::-webkit-scrollbar-thumb { background: rgba(124, 135, 129, 0.22); border-radius: 99px; }

/* Welcome Hero */
.welcome-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(28, 35, 32, 0.05);
}

.welcome-photo {
  height: 168px;
  position: relative;
  overflow: hidden;
  background: var(--bg-sage-soft);
}

.welcome-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.welcome-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(28,35,32,0.5) 100%);
}

.welcome-photo-badge {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(43, 91, 80, 0.9);
  backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: 99px;
}

.welcome-body {
  padding: 17px 18px 18px;
}

.welcome-h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
  margin-bottom: 9px;
}

.welcome-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-sec);
}

.welcome-price-strip {
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--bg-sage-soft);
  border: 1px solid var(--bg-sage-tint);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--brand);
}

.welcome-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeUp 0.2s ease;
}

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

.msg-row.user { align-items: flex-end; }
.msg-row.ai { align-items: flex-start; }

.bubble-user {
  max-width: 86%;
  background: var(--brand);
  color: #FFFFFF;
  padding: 11px 15px;
  border-radius: 18px 18px 4px 18px;
  font-size: 17px;
  line-height: 1.65;
  box-shadow: 0 3px 10px rgba(43, 91, 80, 0.16);
  word-break: break-word;
}

.bubble-ai {
  max-width: 94%;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 13px 15px;
  border-radius: 18px 18px 18px 4px;
  font-size: 17px;
  line-height: 1.72;
  box-shadow: 0 2px 8px rgba(28, 35, 32, 0.04);
  word-break: break-word;
}

/* Artifact Cards */
.artifact-card {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(28, 35, 32, 0.05);
}

.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.artifact-title {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text-main);
}

.pill-tag {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  background: var(--bg-sage-soft);
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.pill-tag.accent {
  color: #8C472B;
  background: #FBECE6;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.b-high { background: var(--high-bg); color: var(--high); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-pending { background: #FEF3E1; color: #9C5A14; border: 1px dashed #DF9F4D; }

/* Summary rows */
.sym-list {
  border-top: 1px solid var(--border);
  margin-bottom: 10px;
}
.sym-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.sym-name {
  font-size: 15.5px;
  font-weight: 600;
}

/* Lab Table & Inline Edit */
.lab-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.lab-row-left { min-width: 0; flex: 1; }
.lab-row-name { font-size: 15.5px; font-weight: 700; color: var(--text-main); }
.lab-row-ref { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.lab-row-right { text-align: right; flex-shrink: 0; }
.lab-val { font-size: 16px; font-weight: 700; color: var(--text-main); }
.lab-unit { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.lab-edit-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.lab-edit-item {
  display: grid;
  grid-template-columns: 1fr 94px 76px;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.lab-edit-input {
  height: 40px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  padding: 0 9px;
  font-size: 15px;
  color: var(--text-main);
  background: #FFFFFF;
}
.lab-edit-input:focus {
  outline: none;
  border-color: var(--brand);
}

/* Blurred Preview */
.blur-box {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
  background: #FCFBF9;
  overflow: hidden;
  margin-top: 10px;
}
.blur-lines {
  filter: blur(4px);
  opacity: 0.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.bline { height: 8px; border-radius: 6px; background: #D4DAD6; }
.blur-mask {
  position: absolute;
  inset: 30px 0 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.96) 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.crisis-box {
  background: var(--bg-info-soft);
  border: 1px solid #D0E0EE;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #2A455C;
  margin-top: 10px;
}

.err-box {
  background: var(--bg-rose-soft);
  border: 1px solid #F0C4C1;
  border-left: 3.5px solid var(--high);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #6B2A26;
}

.report-ready-card {
  background: linear-gradient(135deg, #EDF4F1 0%, #FAF8F5 100%);
  border: 1.5px solid var(--brand);
  border-radius: 18px;
  padding: 15px;
}

/* Typing */
.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: 0.35;
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ==================== UNIFIED BOTTOM DOCK + COMPOSER ==================== */
.composer-wrap {
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  z-index: 25;
  box-shadow: 0 -6px 20px rgba(28, 35, 32, 0.04);
}

.context-dock {
  margin-bottom: 9px;
}

.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  padding: 0 2px;
  gap: 8px;
}

.dock-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 5px;
}

.dock-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.dock-question-preview {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Dock Chip Row */
.dock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 156px;
  overflow-y: auto;
}

.dock-chip {
  min-height: 44px;
  padding: 9px 15px;
  border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--text-main);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dock-chip:hover {
  border-color: var(--brand);
  background: var(--bg-sage-soft);
  color: var(--brand);
}

.dock-chip.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(43, 91, 80, 0.2);
}

.dock-chip.primary:hover {
  background: var(--brand-hover);
  color: #FFFFFF;
}

.dock-chip.accent {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #FFFFFF;
}

/* 4-Level Severity Tactile Bar */
.dock-scale-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.dock-scale-btn {
  min-height: 50px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.14s ease;
}

.dock-scale-btn:hover {
  border-color: var(--brand);
  background: var(--bg-sage-soft);
  color: var(--brand);
}

.dock-scale-btn.sev-high:hover {
  border-color: var(--high);
  background: var(--high-bg);
  color: var(--high);
}

/* Primary Dock Action Stack */
.dock-action-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dock-primary-btn {
  width: 100%;
  min-height: 50px;
  padding: 11px 16px;
  border-radius: 13px;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 16.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(43, 91, 80, 0.2);
}

.dock-primary-btn:hover { background: var(--brand-hover); }
.dock-primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.dock-secondary-row {
  display: flex;
  gap: 7px;
}

.dock-sec-btn {
  flex: 1;
  min-height: 42px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-chat);
  color: var(--text-sec);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.dock-sec-btn:hover { border-color: var(--brand); color: var(--brand); }

/* Composer Box */
.composer-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 4px 5px 4px 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.composer-box:focus-within {
  border-color: var(--brand);
  background: #FFFFFF;
}

.composer-box.disabled {
  opacity: 0.65;
  background: #F1EFEA;
}

.composer-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.composer-icon-btn:hover { color: var(--brand); background: rgba(43, 91, 80, 0.08); }
.composer-icon-btn.highlight { color: var(--brand); background: var(--bg-sage-soft); }

.composer-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-main);
  font-family: var(--font-sans);
  outline: none;
  min-width: 0;
  padding: 5px 0;
}

.char-counter {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-right: 2px;
}
.char-counter.warn { color: var(--high); font-weight: 600; }

.composer-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.composer-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.composer-links {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.composer-links a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.composer-links a:hover {
  text-decoration: underline;
}

/* ==================== SHEETS & MENU ==================== */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 26, 23, 0.45);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet-panel {
  width: 100%;
  max-height: 86%;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-backdrop.open .sheet-panel { transform: translateY(0); }

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: #D5D0C8;
  margin: 0 auto 14px;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 26, 23, 0.42);
  z-index: 45;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

.menu-panel {
  width: 280px;
  height: 100%;
  background: #FFFFFF;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}
.menu-backdrop.open .menu-panel { transform: translateX(0); }

.menu-item {
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 15.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.menu-item:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--bg-sage-soft);
}

/* Form Controls & Buttons */
.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border-radius: 13px;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1.5px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.input-std {
  width: 100%;
  height: 46px;
  border-radius: 11px;
  border: 1.5px solid var(--border-strong);
  padding: 0 12px;
  font-size: 16px;
  color: var(--text-main);
  background: #FFFFFF;
  outline: none;
}
.input-std:focus { border-color: var(--brand); }

.field-lbl {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  display: block;
}

.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #FFFFFF;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
}
.chip.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
}

/* Checkout Tier Cards */
.tier-card {
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #FFFFFF;
  transition: all 0.14s ease;
}
.tier-card.selected {
  border-color: var(--brand);
  background: var(--bg-sage-soft);
  box-shadow: 0 3px 12px rgba(43, 91, 80, 0.1);
}
.tier-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.tier-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.tier-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
}
.tier-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-sec);
}
.pay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}
.pay-badge {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-sec);
  border: 1px solid var(--border);
}

.invite-details {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.invite-summary {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.invite-summary::-webkit-details-marker { display: none; }

.toast {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(28, 35, 32, 0.92);
  color: #FFFFFF;
  font-size: 14.5px;
  padding: 10px 16px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== EXTRA LARGE FONT MODE (40–55+ READABILITY) ==================== */
html.font-large .bubble-user,
html.font-large .bubble-ai {
  font-size: 19px;
  line-height: 1.78;
}
html.font-large .welcome-h1 { font-size: 24px; }
html.font-large .welcome-desc { font-size: 18px; }
html.font-large .welcome-price-strip { font-size: 16px; }
html.font-large .dock-chip { font-size: 17.5px; min-height: 48px; }
html.font-large .dock-scale-btn { font-size: 18px; min-height: 54px; }
html.font-large .dock-primary-btn { font-size: 18.5px; min-height: 54px; }
html.font-large .dock-sec-btn { font-size: 16px; }
html.font-large .dock-label { font-size: 15.5px; }
html.font-large .lab-row-name,
html.font-large .sym-name { font-size: 17.5px; }
html.font-large .lab-val { font-size: 18px; }
html.font-large .composer-input { font-size: 18px; }

/* Mobile Fullscreen */
@media (max-width: 540px) {
  .app-shell {
    padding: 0;
  }
  .app-card {
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

.lab-report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 12px 0;
  font-size: 0.9em;
}

.lab-report-table th,
.lab-report-table td {
  border-bottom: 1px solid var(--border);
  padding: 7px 4px;
  text-align: left;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.lab-report-table .lab-edit-input {
  width: 100%;
  min-width: 0;
  padding: 6px 4px;
}

.contact-qr {
  display: block;
  max-width: 100%;
  margin: 8px 0;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}

.manual-price {
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 700;
}

.manual-payment {
  padding-inline-start: 1.5rem;
}

.manual-payment li + li {
  margin-top: 8px;
}

.mvp-email-form {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.mvp-form-status:empty {
  display: none;
}

.quota-exits {
  margin: 12px 0;
}

.quota-contact-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--border);
  color: var(--text-sec);
}

.referral-card {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}

.referral-card .input-std {
  width: 100%;
  min-width: 0;
}

.lab-aha-card,
.lab-upgrade-card {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  margin: 0.75rem 0;
}

.lab-consultation-chips {
  max-height: none;
  margin: 0.75rem 0;
}

.lab-consultation-chips .dock-chip {
  white-space: normal;
  text-align: left;
}

.lab-upgrade-card .mvp-email-form {
  width: 100%;
}
