/* Guide Model Companion - GamePlan Medical Theme Stylesheet */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* GamePlan Brand Colors */
  --gp-primary-blue: #0066CC;
  --gp-navy-dark: #073B7B;
  --gp-navy-hero: #0A448C;
  --gp-vibrant-blue: #0066FF;
  --gp-vibrant-blue-hover: #0052CC;
  --gp-sky-accent: #38BDF8;
  
  /* Backgrounds */
  --bg-app: #F0F4F9;
  --bg-card: #FFFFFF;
  --bg-card-subtle: #F8FAFC;
  --bg-input: #FFFFFF;
  
  /* Borders & Shadows */
  --border-light: #E2E8F0;
  --border-input: #CBD5E1;
  --border-focus: #0066FF;
  --shadow-card: 0 4px 20px rgba(0, 50, 120, 0.06);
  --shadow-card-hover: 0 8px 28px rgba(0, 50, 120, 0.10);
  --shadow-btn: 0 4px 14px rgba(0, 102, 255, 0.28);
  
  /* Typography */
  --text-dark: #0F172A;
  --text-navy-label: #0F2748;
  --text-secondary: #475569;
  --text-muted: #64748B;
  
  /* Status Colors */
  --status-valid-bg: #DCFCE7;
  --status-valid-text: #15803D;
  --status-valid-border: #86EFAC;
  
  --status-missing-bg: #F1F5F9;
  --status-missing-text: #64748B;
  --status-missing-border: #CBD5E1;
  
  --status-invalid-bg: #FEE2E2;
  --status-invalid-text: #B91C1C;
  --status-invalid-border: #FCA5A5;
  
  --status-review-bg: #FEF3C7;
  --status-review-text: #B45309;
  --status-review-border: #FCD34D;
  
  --status-declined-bg: #F3E8FF;
  --status-declined-text: #7E22CE;
  --status-declined-border: #D8B4FE;
  
  --status-na-bg: #F8FAFC;
  --status-na-text: #94A3B8;
  --status-na-border: #E2E8F0;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 18px 40px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

button, select, input, .btn-toggle-mask {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ==================== SCREENS ==================== */
.screen-card {
  display: none;
}

.screen-card.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

#screen-voice.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  overflow: hidden;
}

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

/* ==================== 1. INITIAL SCREEN (Care Navigator Voice Launch) ==================== */
.welcome-hero-card {
  --hero-sym-pad: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--hero-sym-pad) 28px;
  box-shadow: var(--shadow-card);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Hero Avatar - Marin Virtual Care Navigator (Starts hero card immediately, maximizes space) */
.hero-avatar-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto var(--hero-sym-pad) auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.hero-avatar-img {
  width: 100%;
  max-width: 435px;
  height: auto;
  max-height: min(456px, 55vh);
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(11, 45, 90, 0.14));
  border-radius: 12px;
  transition: transform 0.3s ease;
  display: block;
}

.hero-avatar-img:hover {
  transform: scale(1.02);
}

.hero-call-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto 4px auto;
  line-height: 1.45;
  text-align: center;
}

/* Prominent Circular Call Button - Distinct from avatar with ripple overlap */
.circular-call-btn-container {
  position: relative;
  z-index: 2;
  width: 112px;
  height: 112px;
  margin: 0 auto var(--hero-sym-pad) auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.ripple-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  border: 2.5px solid rgba(34, 197, 94, 0.45);
  z-index: 1;
}

.ripple-ring-1 {
  width: 138px;
  height: 138px;
  animation: call-ripple 2.4s infinite cubic-bezier(0.2, 0.8, 0.4, 1);
}

.ripple-ring-2 {
  width: 168px;
  height: 168px;
  animation: call-ripple 2.4s infinite 0.7s cubic-bezier(0.2, 0.8, 0.4, 1);
}

@keyframes call-ripple {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.9; }
  50% { opacity: 0.45; }
  100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
}

.circular-start-btn {
  position: relative;
  z-index: 2;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 50%, #15803D 100%);
  border: 4px solid #FFFFFF;
  box-shadow: 0 10px 28px rgba(34, 197, 94, 0.45), 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.circular-start-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px rgba(34, 197, 94, 0.6), 0 4px 10px rgba(0, 0, 0, 0.16);
  background: linear-gradient(135deg, #4ADE80 0%, #22C55E 50%, #16A34A 100%);
}

.circular-start-btn:active {
  transform: scale(0.96);
}

.circular-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.circular-btn-inner svg {
  width: 34px;
  height: 34px;
  stroke: #FFFFFF;
  fill: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.btn-start-text {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Permission Notice Box - Base element for symmetric vertical spacing */
.permission-notice-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: #1E3A8A;
  font-size: 0.85rem;
  line-height: 1.45;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  margin: 0;
}

.notice-icon-svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ==================== 2. ACTIVE VOICE SCREEN (Compact Layout) ==================== */
.voice-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  min-height: 70px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.voice-status-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-status-avatar-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #22C55E;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #FFFFFF;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.voice-status-avatar-wrapper.status-ready {
  border-color: #22C55E;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}

.voice-status-avatar-wrapper.status-connecting {
  border-color: #3B82F6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.45);
}

.voice-status-avatar-wrapper.status-invalid {
  border-color: #EF4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.voice-status-avatar-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.voice-status-text {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--gp-navy-dark);
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: -0.01em;
  padding: 0;
  margin: 0;
}

.voice-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-voice-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #F1F5F9;
  color: #1E293B;
  border: 1px solid #CBD5E1;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 16px;
  min-height: 42px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-voice-home svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-voice-home:hover {
  background: #E2E8F0;
  color: #0F172A;
  border-color: #94A3B8;
}

#btn-end-session {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 8px 18px;
  min-height: 42px;
  border-radius: 9999px;
  cursor: pointer;
}

#btn-end-session svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-review-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Compact AI Voice Stage */
.voice-stage-compact {
  margin-bottom: 12px;
}

.speaker-state-box-compact {
  background: linear-gradient(135deg, var(--gp-navy-dark) 0%, #0B4F9C 100%);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #FFFFFF;
  margin-bottom: 0;
  box-shadow: 0 4px 14px rgba(7, 59, 123, 0.12);
}

.speaker-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speaker-avatar-compact {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
}

.voice-cue-compact {
  font-size: 0.86rem;
  font-weight: 600;
  color: #FFFFFF;
}

.waveform-container-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
}

.waveform-container-compact .wave-bar {
  width: 4px;
  height: 8px;
  background-color: var(--gp-sky-accent);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.waveform-container-compact.active .wave-bar:nth-child(1) { animation: wave 0.8s infinite ease-in-out; }
.waveform-container-compact.active .wave-bar:nth-child(2) { animation: wave 0.8s infinite ease-in-out 0.15s; }
.waveform-container-compact.active .wave-bar:nth-child(3) { animation: wave 0.8s infinite ease-in-out 0.3s; }
.waveform-container-compact.active .wave-bar:nth-child(4) { animation: wave 0.8s infinite ease-in-out 0.45s; }
.waveform-container-compact.active .wave-bar:nth-child(5) { animation: wave 0.8s infinite ease-in-out 0.6s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 22px; }
}

/* Compact Active Question & Answer Box (Hidden per client request; retained in DOM for seamless re-enabling) */
.live-question-compact-card {
  display: none !important;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
}

.question-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.compact-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--gp-primary-blue);
  text-transform: uppercase;
}

.compact-answer-badge {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-secondary);
  background: #F8FAFC;
  border: 1px solid var(--border-light);
  padding: 3px 12px;
  border-radius: 9999px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.25s ease;
}

.compact-answer-badge.has-answer {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #065F46;
  font-style: normal;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
}

.compact-question-text {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--gp-navy-dark);
  margin-bottom: 8px;
  line-height: 1.35;
}

.options-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.option-badge {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--gp-navy-dark);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  display: inline-block;
}

/* Compact Conversation Feed - Full Screen Transcript */
.compact-feed {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.compact-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.compact-feed-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gp-navy-dark);
}

.compact-feed-header .feed-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #EFF6FF;
  color: var(--gp-primary-blue);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid #BFDBFE;
}

.compact-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 6px 14px 2px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat */
.compact-history::-webkit-scrollbar {
  width: 6px;
}

.compact-history::-webkit-scrollbar-track {
  background: transparent;
}

.compact-history::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}

.compact-history::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 86%;
  font-size: 1.02rem;
  line-height: 1.5;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  word-break: break-word;
  overflow-wrap: break-word;
}

.chat-bubble.speaker-ai {
  align-self: flex-start;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  color: #1E3A8A;
  font-weight: 500;
}

.chat-bubble.speaker-caller,
.chat-bubble.speaker-user,
.chat-bubble.speaker-patient {
  align-self: flex-end;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  color: #0F172A;
  font-weight: 500;
}

.bubble-meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.bubble-text {
  font-size: 1.02rem;
  line-height: 1.5;
}

.voice-actions {
  display: flex;
  justify-content: center;
}

/* ==================== 3. REVIEW SCREEN (EDITABLE INTAKE FORM) ==================== */
.review-page-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.form-main-heading {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gp-navy-dark);
  letter-spacing: -0.01em;
}

.form-sub-heading {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.review-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Form Sections */
.intake-form-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.section-badge {
  background: #EFF6FF;
  color: var(--gp-primary-blue);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gp-navy-dark);
  letter-spacing: -0.01em;
}

.section-condition-alert {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gp-primary-blue);
  background: #EFF6FF;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  min-width: 0;
  width: 100%;
}

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

/* Field Card */
.field-card {
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: all 0.2s ease;
  position: relative;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.field-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 14px rgba(0, 50, 120, 0.05);
}

.field-card.disabled-card {
  opacity: 0.55;
  background: #F8FAFC;
  pointer-events: none;
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.field-label-wrap {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-navy-label);
  line-height: 1.35;
  display: block;
}

.field-label.required::after {
  content: " *";
  color: #DC2626;
}

/* Condition Hint Box */
.field-condition-box {
  background: #F1F6FC;
  border-left: 3px solid var(--gp-primary-blue);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #334155;
  margin-top: 6px;
  line-height: 1.4;
  word-break: break-word;
}

.condition-prefix {
  font-weight: 800;
  color: var(--gp-primary-blue);
}

/* Controls */
.field-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 46px;
  background: #FFFFFF;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-dark);
  transition: all 0.2s ease;
}

.field-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
  outline: none;
}

select.field-control {
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
  background-size: 16px;
  padding-right: 40px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: block;
}

select.field-control:disabled {
  background-color: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
  opacity: 0.7;
}

select.field-control option {
  font-size: 15px;
  white-space: normal;
  word-wrap: break-word;
  color: var(--text-dark);
  background: #FFFFFF;
  padding: 10px 14px;
}

.mbi-input-wrapper {
  display: flex;
  gap: 8px;
}

.btn-toggle-mask {
  background: #F1F5F9;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-toggle-mask:hover {
  background: #E2E8F0;
  color: var(--text-dark);
}

/* Status Pills */
.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: capitalize;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.status-pill.status-valid {
  background: var(--status-valid-bg);
  color: var(--status-valid-text);
  border: 1px solid var(--status-valid-border);
}

.status-pill.status-missing {
  background: var(--status-missing-bg);
  color: var(--status-missing-text);
  border: 1px solid var(--status-missing-border);
}

.status-pill.status-invalid {
  background: var(--status-invalid-bg);
  color: var(--status-invalid-text);
  border: 1px solid var(--status-invalid-border);
}

.status-pill.status-needs_review,
.status-pill.status-review {
  background: var(--status-review-bg);
  color: var(--status-review-text);
  border: 1px solid var(--status-review-border);
}

.status-pill.status-declined {
  background: var(--status-declined-bg);
  color: var(--status-declined-text);
  border: 1px solid var(--status-declined-border);
}

.status-pill.status-not_applicable {
  background: var(--status-na-bg);
  color: var(--status-na-text);
  border: 1px solid var(--status-na-border);
}

.field-messages {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #DC2626;
  line-height: 1.35;
}

.error-msg-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 3px;
}

.error-bullet {
  color: #DC2626;
  font-weight: 800;
}

.field-info-note {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #0284C7;
  font-weight: 600;
  background: #F0F9FF;
  border-left: 3px solid #0284C7;
  padding: 4px 8px;
  border-radius: 4px;
}

.field-help-text {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #64748B;
  line-height: 1.35;
}

.voice-error-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #B91C1C;
  background: #FEE2E2;
  border: 1px solid #FECACA;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.field-card.status-invalid,
.field-card.has-error,
.field-card.has-submit-error {
  border-color: #EF4444;
  background: #FFFDFD;
  box-shadow: 0 0 0 1px #EF4444, 0 4px 14px rgba(239, 68, 68, 0.08);
}

.field-card.status-needs_review {
  border-color: #F59E0B;
  background: #FFFDF8;
  box-shadow: 0 0 0 1px #F59E0B, 0 4px 14px rgba(245, 158, 11, 0.08);
}

@keyframes errorPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

.field-card.has-submit-error {
  animation: errorPulse 0.3s ease-in-out;
}

.field-meta-row {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.source-tag {
  background: #EFF6FF;
  color: var(--gp-primary-blue);
  border: 1px solid #BFDBFE;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

/* Form Bottom Actions & Validation Summary */
.form-bottom-actions {
  margin-top: 28px;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-bottom-btn-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-save-large {
  padding: 12px 28px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.form-validation-summary {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
  animation: fadeIn 0.25s ease-in-out;
}

.form-validation-summary.is-error {
  background: #FEF2F2;
  border: 1.5px solid #FCA5A5;
  color: #991B1B;
}

.form-validation-summary.is-success {
  background: #F0FDF4;
  border: 1.5px solid #86EFAC;
  color: #166534;
}

.validation-summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.94rem;
  margin-bottom: 8px;
}

.validation-summary-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.validation-summary-list li {
  margin-bottom: 5px;
}

.validation-summary-list strong {
  cursor: pointer;
  text-decoration: underline;
  color: #7F1D1D;
}

.validation-summary-list strong:hover {
  color: #B91C1C;
}

.voice-summary-tag {
  color: #B91C1C;
  font-weight: 700;
  font-size: 0.76rem;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--gp-vibrant-blue);
  color: #FFFFFF;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--gp-vibrant-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 102, 255, 0.35);
}

.btn-secondary {
  background: #FFFFFF;
  border: 1.5px solid var(--border-input);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

.btn-danger {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: #B91C1C;
  transform: translateY(-1px);
}



/* ==================== MODAL ==================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gp-navy-dark);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Extraction Loading Placeholder */
.extraction-loading-placeholder {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  border: 1.5px dashed var(--border-light);
  margin: 16px 0;
}

.spinner-circle {
  width: 44px;
  height: 44px;
  border: 4px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Save Confirmation Dialog Styles */
.modal-dialog-confirm {
  max-width: 520px;
}

.confirm-modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-confirm-warning-box {
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1;
  border-radius: 12px;
  padding: 18px 20px;
}

.save-confirm-highlight {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 8px;
  line-height: 1.45;
}

.save-confirm-note {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
  margin: 0;
}

.save-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: #F8FAFC;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.btn-save-confirm {
  background: var(--gp-blue, #1E40AF) !important;
  border-color: var(--gp-blue, #1E40AF) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}

.btn-save-confirm:hover {
  background: #1D4ED8 !important;
  border-color: #1D4ED8 !important;
}

.btn-finalized {
  background: #64748B !important;
  border-color: #64748B !important;
  color: #FFFFFF !important;
  cursor: not-allowed !important;
  opacity: 0.85 !important;
}

.form-locked-banner {
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  border-radius: 12px;
  padding: 14px 20px;
  color: #1E293B;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

/* ==================== MOBILE & WEBVIEW RESPONSIVE LAYOUTS ==================== */

/* Tablet & Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  .app-container {
    padding: 12px 14px 36px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(36px, env(safe-area-inset-bottom));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* Form & input sizing - 16px font-size prevents mobile webview auto-zoom on iOS/Android */
  .field-control,
  input.field-control {
    font-size: 16px !important;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-md);
  }

  select.field-control {
    font-size: 16px !important;
    height: 48px;
    padding: 0 40px 0 14px !important;
    border-radius: var(--radius-md);
    background-position: calc(100% - 14px) center;
  }

  .btn-toggle-mask {
    height: 48px;
    padding: 0 14px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .fields-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .section-container {
    padding: 18px 16px;
    border-radius: var(--radius-lg);
  }

  .section-title {
    font-size: 1.15rem;
  }

  .review-page-banner {
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    gap: 12px;
  }

  .review-toolbar {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .review-toolbar .btn {
    flex: 1;
    min-height: 42px;
    padding: 8px 12px;
    font-size: 0.82rem;
    justify-content: center;
  }

  .form-bottom-actions {
    margin-top: 22px;
    padding: 18px 16px;
    border-radius: var(--radius-lg);
  }

  .form-bottom-btn-row {
    flex-direction: column-reverse;
    width: 100%;
    gap: 10px;
  }

  .form-bottom-btn-row .btn {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
    justify-content: center;
  }

  .btn-save-large {
    min-height: 52px;
    font-size: 1.02rem;
  }
}

/* Mobile Smartphones & WebViews (<= 600px) */
@media (max-width: 600px) {
  .app-container {
    padding: 10px 10px 30px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(30px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  /* 1. Initial Screen (Hero Call) */
  .welcome-hero-card {
    --hero-sym-pad: 15px;
    padding: var(--hero-sym-pad) 16px;
    border-radius: var(--radius-lg);
  }

  .hero-avatar-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto var(--hero-sym-pad) auto;
    width: 100%;
    position: relative;
    z-index: 1;
  }

  .hero-avatar-img {
    width: 100%;
    max-width: 380px;
    height: auto;
    max-height: 52vh;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
  }

  .circular-call-btn-container {
    margin: 0 auto var(--hero-sym-pad) auto;
    z-index: 2;
    width: 104px;
    height: 104px;
  }

  .ripple-ring-1 {
    width: 128px;
    height: 128px;
  }

  .ripple-ring-2 {
    width: 154px;
    height: 154px;
  }

  .circular-start-btn {
    width: 104px;
    height: 104px;
  }

  .circular-btn-inner svg {
    width: 30px;
    height: 30px;
  }

  .btn-start-text {
    font-size: 0.86rem;
  }

  .hero-call-subtitle {
    font-size: 0.92rem;
    margin: 0 auto 4px auto;
    max-width: 100%;
    text-align: center;
  }

  .permission-notice-box {
    padding: 10px 14px;
    font-size: 0.8rem;
    gap: 10px;
    text-align: left;
    margin: 0;
  }

  /* 2. Active Voice Screen */
  .voice-header-compact {
    padding: 12px 14px;
    min-height: 68px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    gap: 10px;
  }

  .voice-status-wrapper {
    gap: 10px;
  }

  .voice-status-avatar-wrapper {
    width: 50px;
    height: 50px;
    border-width: 3px;
  }

  .voice-status-text {
    font-size: 1.05rem;
  }

  .voice-header-actions {
    gap: 8px;
  }

  .btn-voice-home {
    padding: 8px 14px;
    font-size: 0.88rem;
    min-height: 40px;
    border-radius: 9999px;
    gap: 6px;
  }

  .btn-voice-home svg {
    width: 16px;
    height: 16px;
  }

  #btn-end-session {
    padding: 8px 16px;
    font-size: 0.88rem;
    min-height: 40px;
    border-radius: 9999px;
    gap: 6px;
  }

  #btn-end-session svg {
    width: 16px;
    height: 16px;
  }

  .btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .speaker-state-box-compact {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
  }

  .speaker-avatar-compact {
    width: 26px;
    height: 26px;
  }

  .voice-cue-compact {
    font-size: 0.8rem;
  }

  .live-question-compact-card {
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .question-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .compact-answer-badge {
    max-width: 100%;
    font-size: 0.74rem;
    white-space: normal;
    text-overflow: clip;
  }

  .compact-question-text {
    font-size: 0.94rem;
    margin-bottom: 6px;
  }

  .option-badge {
    font-size: 0.74rem;
    padding: 3px 8px;
  }

  #screen-voice.active {
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow: hidden;
  }

  .compact-feed {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    flex: 1;
    overflow: hidden;
  }

  .compact-feed-header h3 {
    font-size: 0.98rem;
  }

  .compact-feed-header .feed-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
  }

  .compact-history {
    max-height: none;
    gap: 8px;
    padding-bottom: 10px;
  }

  .chat-bubble {
    max-width: 92%;
    font-size: 0.95rem;
    line-height: 1.48;
    padding: 9px 12px;
    border-radius: 12px;
  }

  .bubble-meta {
    font-size: 0.72rem;
    margin-bottom: 3px;
  }

  .bubble-text {
    font-size: 0.95rem;
    line-height: 1.48;
  }

  /* 3. Review Form Screen */
  .form-main-heading {
    font-size: 1.25rem;
  }

  .form-sub-heading {
    font-size: 0.8rem;
  }

  .section-container {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }

  .section-header {
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .section-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .section-title {
    font-size: 1.05rem;
  }

  .section-condition-alert {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .field-card {
    padding: 12px 10px;
    border-radius: var(--radius-md);
  }

  .field-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .field-label {
    font-size: 0.86rem;
  }

  .status-pill {
    align-self: flex-start;
    font-size: 0.7rem;
    padding: 2px 8px;
  }

  .field-condition-box {
    font-size: 0.74rem;
    padding: 5px 8px;
  }

  .field-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 0.72rem;
  }

  /* Modal Dialog for Mobile */
  .modal-dialog {
    max-width: 95vw;
    max-height: 85vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 12px 16px;
  }
}

/* Extra-small screens (<= 380px) */
@media (max-width: 380px) {
  .welcome-hero-card {
    --hero-sym-pad: 12px;
    padding: var(--hero-sym-pad) 12px;
  }

  .hero-avatar-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto var(--hero-sym-pad) auto;
    width: 100%;
    position: relative;
    z-index: 1;
  }

  .hero-avatar-img {
    width: 100%;
    max-width: 320px;
    height: auto;
    max-height: 48vh;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
  }

  .circular-call-btn-container {
    margin: 0 auto var(--hero-sym-pad) auto;
    z-index: 2;
    width: 94px;
    height: 94px;
  }

  .ripple-ring-1 {
    width: 116px;
    height: 116px;
  }

  .ripple-ring-2 {
    width: 140px;
    height: 140px;
  }

  .circular-start-btn {
    width: 94px;
    height: 94px;
  }

  .circular-btn-inner svg {
    width: 26px;
    height: 26px;
  }

  .btn-start-text {
    font-size: 0.80rem;
  }

  .hero-call-subtitle {
    font-size: 0.85rem;
    margin: 0 auto 4px auto;
    line-height: 1.4;
  }

  .permission-notice-box {
    padding: 8px 12px;
    font-size: 0.78rem;
    gap: 8px;
    margin: 0;
  }

  .voice-header-compact {
    padding: 10px 12px;
    min-height: 62px;
    gap: 8px;
  }

  .voice-status-avatar-wrapper {
    width: 46px;
    height: 46px;
    border-width: 2.5px;
  }

  .voice-status-text {
    font-size: 0.98rem;
  }

  .voice-header-actions {
    gap: 6px;
  }

  .btn-voice-home {
    padding: 7px 12px;
    font-size: 0.84rem;
    min-height: 38px;
    border-radius: 9999px;
    gap: 4px;
  }

  .btn-voice-home svg {
    width: 15px;
    height: 15px;
  }

  #btn-end-session {
    padding: 7px 14px;
    font-size: 0.84rem;
    min-height: 38px;
    border-radius: 9999px;
    gap: 4px;
  }

  #btn-end-session svg {
    width: 15px;
    height: 15px;
  }

  .btn-toggle-mask {
    padding: 0 10px;
    font-size: 0.75rem;
  }

  .chat-bubble {
    max-width: 95%;
    font-size: 0.90rem;
    line-height: 1.42;
    padding: 8px 11px;
    border-radius: 10px;
  }

  .bubble-meta {
    font-size: 0.68rem;
  }

  .bubble-text {
    font-size: 0.90rem;
    line-height: 1.42;
  }
}
