/* ── Font imports (inside <style> for iOS Safari GAS iframe compatibility) ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Outlined');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

/* ============================================================
   DESIGN SYSTEM - Agendamento de Transporte de Saúde
   Enterprise-grade UI • Mobile-first • Accessibility-ready
   ============================================================ */

:root {
  /* ── Cores Primárias ── */
  --primary: #1565C0;
  --primary-dark: #0D47A1;
  --primary-light: #42A5F5;
  --primary-surface: #E3F2FD;
  --primary-on: #FFFFFF;

  /* ── Cores de Ação ── */
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --warning: #F57F17;
  --warning-light: #FFF8E1;
  --error: #C62828;
  --error-light: #FFEBEE;

  /* ── Neutros ── */
  --surface: #FFFFFF;
  --surface-variant: #F5F7FA;
  --background: #EEF2F7;
  --outline: #DAE0E8;
  --outline-variant: #C4CDD8;
  --text-primary: #1A2332;
  --text-secondary: #546478;
  --text-tertiary: #8494A7;
  --text-on-dark: #FFFFFF;

  /* ── Espaçamento ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-xxl: 40px;

  /* ── Tipografia ── */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* ── Raios ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ── Sombras ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15), 0 8px 20px rgba(0,0,0,0.1);

  /* ── Transições ── */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: var(--space-2xl);
}

/* ══════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════ */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: var(--text-on-dark);
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -15%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.header-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.header-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-icon {
  font-size: 32px;
  color: #fff;
}

.header-text {
  flex: 1;
}

.header-title {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-xs);
}

.header-subtitle {
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.subtitle-icon {
  font-size: 16px;
}

.header-dept {
  font-size: var(--text-xs);
  opacity: 0.7;
  margin-top: 2px;
  font-weight: 400;
}

.header-ambulance {
  position: absolute;
  bottom: 12px;
  right: 16px;
  z-index: 1;
}

.ambulance-icon {
  font-size: 48px;
  opacity: 0.12;
}

/* ══════════════════════════════════════════
   BARRA DE PROGRESSO
   ══════════════════════════════════════════ */
.progress-bar-container {
  background: var(--surface);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-md);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-variant);
  border: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step-circle .material-icons-round {
  font-size: 20px;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(21,101,192,0.35);
}

.step.active .step-circle .material-icons-round {
  color: #fff;
}

.step.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
}

.step.completed .step-circle .material-icons-round {
  color: #fff;
}

.step-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
}

.step.active .step-label {
  color: var(--primary);
}

.step.completed .step-label {
  color: var(--success);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--outline);
  margin: 0 6px;
  margin-bottom: 22px;
  max-width: 40px;
  transition: var(--transition);
}

.step-line.active {
  background: var(--primary);
}

.progress-track {
  height: 4px;
  background: var(--surface-variant);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════════
   SEÇÕES DO FORMULÁRIO
   ══════════════════════════════════════════ */
.form-section {
  display: none;
  padding: var(--space-lg);
  animation: fadeSlideIn 0.4s ease-out;
}

.form-section.active {
  display: block;
}

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

.section-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.section-icon {
  font-size: 28px;
  color: var(--primary);
  background: var(--primary-surface);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.section-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   UPLOAD DE IMAGEM
   ══════════════════════════════════════════ */
.upload-area {
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-surface);
}

.upload-placeholder {
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.upload-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-surface), #BBDEFB);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.upload-icon {
  font-size: 40px;
  color: var(--primary);
}

.upload-text-main {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.upload-text-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.upload-formats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: var(--surface-variant);
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

.upload-formats .material-icons-outlined {
  font-size: 14px;
}

.upload-preview {
  position: relative;
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.upload-preview img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.btn-remove-image {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-image:hover {
  background: var(--error);
}

.preview-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--success);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.preview-badge .material-icons-round {
  font-size: 18px;
}

/* ══════════════════════════════════════════
   CAMPOS DE FORMULÁRIO
   ══════════════════════════════════════════ */
.field-group {
  margin-bottom: var(--space-lg);
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.label-icon {
  font-size: 18px;
  color: var(--primary);
}

.field-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--outline);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(21,101,192,0.12);
}

.field-input::placeholder {
  color: var(--text-tertiary);
}

.field-textarea {
  resize: vertical;
  min-height: 80px;
}

.field-row {
  display: flex;
  gap: var(--space-md);
}

.field-half {
  flex: 1;
}

.field-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-sm);
}

.field-hint .material-icons-outlined {
  font-size: 14px;
}

.required-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--error);
  background: var(--error-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.optional-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--surface-variant);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ══════════════════════════════════════════
   AUTOCOMPLETE
   ══════════════════════════════════════════ */
.autocomplete-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 22px;
  pointer-events: none;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--surface-variant);
  transition: var(--transition);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: var(--primary-surface);
}

.autocomplete-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.autocomplete-item-detail {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.autocomplete-item-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-surface);
  color: var(--primary);
  margin-top: 4px;
  width: fit-content;
}

.autocomplete-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════
   CHECKBOX / MOBILIDADE
   ══════════════════════════════════════════ */
.mobility-toggle {
  margin-bottom: var(--space-lg);
}

.checkbox-card {
  display: block;
  cursor: pointer;
}

.checkbox-card input {
  display: none;
}

.checkbox-card-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 2px solid var(--outline);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: var(--transition);
}

@media (hover: hover) {
  .checkbox-card:hover .checkbox-card-content {
    border-color: var(--primary-light);
    background: var(--primary-surface);
  }
}

.checkbox-card input:checked ~ .checkbox-card-content {
  border-color: var(--primary);
  background: var(--primary-surface);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.15);
}

.checkbox-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.checkbox-card-icon .material-icons-round {
  font-size: 24px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.checkbox-card input:checked ~ .checkbox-card-content .checkbox-card-icon {
  background: var(--primary);
}

.checkbox-card input:checked ~ .checkbox-card-content .checkbox-card-icon .material-icons-round {
  color: #fff;
}

.checkbox-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.checkbox-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.checkbox-card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.checkbox-card-check {
  flex-shrink: 0;
  opacity: 0;
  transition: var(--transition);
}

.checkbox-card-check .material-icons-round {
  font-size: 36px;
  color: var(--primary);
}

.checkbox-card input:checked ~ .checkbox-card-content .checkbox-card-check {
  opacity: 1;
}

/* ── Detalhes de mobilidade ── */
.mobility-details {
  background: var(--surface);
  border: 2px solid var(--primary-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  animation: fadeSlideIn 0.3s ease-out;
}

.mobility-reasons-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.chip-option {
  cursor: pointer;
}

.chip-option input {
  display: none;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid var(--outline);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  transition: var(--transition);
}

.chip-icon {
  font-size: 20px;
}

.chip-option:hover .chip {
  border-color: var(--primary-light);
}

.chip-option input:checked ~ .chip {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(21,101,192,0.3);
}

.chip-option input:checked ~ .chip .chip-icon {
  color: #fff;
}

/* ── Endereço + Geolocalização ── */
.address-search-wrapper {
  position: relative;
}

.address-input-row {
  display: flex;
  gap: var(--space-sm);
}

.address-input-row .field-input {
  flex: 1;
}

.btn-location {
  width: 52px;
  height: 52px;
  border: 2px solid var(--outline);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-location:hover {
  background: var(--primary-surface);
  border-color: var(--primary);
}

.btn-location:active {
  background: var(--primary);
  color: #fff;
}

.btn-location .material-icons-round {
  font-size: 24px;
}

/* ── Autocomplete de endereço ── */
.address-autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--outline);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.address-autocomplete-dropdown.open {
  display: block;
}

.address-autocomplete-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--divider);
  transition: background 0.15s;
}

.address-autocomplete-item:last-child {
  border-bottom: none;
}

.address-autocomplete-item:hover,
.address-autocomplete-item:active {
  background: var(--primary-surface);
}

.address-autocomplete-item .addr-icon {
  color: var(--primary);
  font-size: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.address-autocomplete-item .addr-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.address-autocomplete-item .addr-main {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-autocomplete-item .addr-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-autocomplete-item .addr-distance {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.address-loading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.address-loading .spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid var(--outline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Campo Número do endereço ── */
.address-numero-group {
  margin-top: var(--space-sm);
  animation: fadeSlideIn 0.3s ease-out;
}

.field-input-numero {
  max-width: 160px;
}

/* ── Modal do Mapa ── */
.map-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.map-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  z-index: 10;
  flex-shrink: 0;
}

.map-modal-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--surface-variant);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.map-modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.map-container {
  flex: 1;
  position: relative;
  z-index: 1;
}

/* Pin fixo no centro do mapa */
.map-pin-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 1000;
  pointer-events: none;
}

.map-pin-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-pin-icon .material-icons-round {
  font-size: 44px;
  color: var(--primary-dark);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.map-pin-shadow {
  width: 12px;
  height: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 50%;
  margin: -4px auto 0;
}

/* Botões flutuantes do mapa */
.map-controls-right {
  position: absolute;
  bottom: 180px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-btn-float {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-btn-float:active {
  background: var(--primary-surface);
}

.map-btn-float.active {
  background: var(--primary);
  color: #fff;
}

.map-modal-footer {
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  z-index: 10;
  flex-shrink: 0;
}

.map-modal-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.map-address-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.map-address-display .material-icons-round {
  color: var(--primary);
  font-size: 20px;
  flex-shrink: 0;
}

.map-address-display #mapAddressText {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.map-btn-confirm {
  width: 100%;
}

/* ══════════════════════════════════════════
   DESTINO INFO
   ══════════════════════════════════════════ */
.destino-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: var(--space-sm);
  padding: 10px 14px;
  background: var(--primary-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--primary-dark);
}

.destino-info .material-icons-outlined {
  font-size: 18px;
  margin-top: 1px;
}

/* ══════════════════════════════════════════
   RESUMO / CONFIRMAÇÃO
   ══════════════════════════════════════════ */
.summary-card {
  background: var(--surface);
  border: 2px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

.summary-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
}

.summary-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-icon .material-icons-round {
  font-size: 22px;
  color: var(--primary);
}

.summary-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.summary-divider {
  height: 1px;
  background: var(--surface-variant);
  margin: 0 var(--space-md);
}

/* ══════════════════════════════════════════
   TELA DE SUCESSO
   ══════════════════════════════════════════ */
.success-container {
  text-align: center;
  padding: var(--space-xl) 0;
}

.success-icon-wrapper {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-icon {
  font-size: 56px;
  color: var(--success);
}

.success-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.success-message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

.success-id-card {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--surface);
  border: 2px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.success-id-card .material-icons-outlined {
  font-size: 28px;
  color: var(--primary);
}

.success-id-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.success-id-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
}

/* ══════════════════════════════════════════
   BOTÕES
   ══════════════════════════════════════════ */
.step-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn .material-icons-round {
  font-size: 20px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(21,101,192,0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(21,101,192,0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--outline-variant);
  color: var(--text-tertiary);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 2px solid var(--outline);
}

.btn-secondary:hover {
  background: var(--surface-variant);
  border-color: var(--outline-variant);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,125,50,0.3);
}

.btn-success:hover {
  background: #1B5E20;
  box-shadow: 0 6px 20px rgba(46,125,50,0.4);
  transform: translateY(-1px);
}

.btn-lg {
  flex: 1;
  padding: 16px 28px;
  font-size: var(--text-lg);
}

/* ══════════════════════════════════════════
   LOADING
   ══════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,35,50,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  background: var(--surface);
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto var(--space-md);
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - 32px);
  max-width: 480px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease-out;
  font-size: var(--text-sm);
  font-weight: 500;
}

.toast.toast-error {
  background: var(--error);
  color: #fff;
}

.toast.toast-success {
  background: var(--success);
  color: #fff;
}

.toast.toast-warning {
  background: var(--warning);
  color: #fff;
}

.toast .material-icons-round {
  font-size: 22px;
  flex-shrink: 0;
}

.toast.removing {
  animation: toastOut 0.3s ease-in forwards;
}

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

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

/* ══════════════════════════════════════════
   COMPANION (ACOMPANHANTE)
   ══════════════════════════════════════════ */
.companion-toggle {
  margin-bottom: var(--space-lg);
}

/* ══════════════════════════════════════════
   ANÁLISE DE DOCUMENTO (IA)
   ══════════════════════════════════════════ */
.analysis-overlay {
  background: var(--surface);
  border: 2px solid var(--primary-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  margin-bottom: var(--space-lg);
  animation: fadeSlideIn 0.4s ease-out;
}

.analysis-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.analysis-icon-pulse {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-surface), #BBDEFB);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: analysisPulse 1.5s ease-in-out infinite;
}

.analysis-icon-pulse .material-icons-round {
  font-size: 36px;
  color: var(--primary);
}

@keyframes analysisPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(21,101,192,0.2); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(21,101,192,0); }
}

.analysis-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.analysis-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 280px;
}

.analysis-progress {
  width: 100%;
  max-width: 240px;
  height: 4px;
  background: var(--surface-variant);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.analysis-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  width: 0%;
  animation: analysisProgress 8s ease-out forwards;
}

@keyframes analysisProgress {
  0% { width: 0%; }
  20% { width: 30%; }
  50% { width: 60%; }
  80% { width: 85%; }
  100% { width: 95%; }
}

.analysis-result {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--success-light);
  border: 2px solid #A5D6A7;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  animation: fadeSlideIn 0.4s ease-out;
}

.analysis-result-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.analysis-result-icon .material-icons-round {
  font-size: 24px;
  color: #fff;
}

.analysis-result-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.analysis-result-text strong {
  font-size: var(--text-base);
  color: var(--success);
}

.analysis-result-text span {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Aviso de foto ilegível */
.analysis-warning {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--warning-light);
  border: 2px solid #FFE082;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  text-align: center;
  animation: fadeSlideIn 0.4s ease-out;
}

.analysis-warning-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
}

.analysis-warning-icon .material-icons-round {
  font-size: 32px;
  color: #fff;
}

.analysis-warning-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.analysis-warning-tips {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: left;
  line-height: 1.8;
  max-width: 320px;
}

.analysis-warning-tips li {
  margin-bottom: 4px;
}

.analysis-warning .btn {
  margin-top: var(--space-sm);
}

.analysis-tentativas {
  font-size: var(--text-sm);
  color: var(--warning);
  font-weight: 500;
  margin-top: var(--space-xs);
}

/* ── Limite de tentativas ── */
.analysis-limit {
  background: var(--surface);
  border: 2px solid var(--error);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  margin-top: var(--space-md);
}

.analysis-phone-card {
  background: var(--primary-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-md);
}

.analysis-phone-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.analysis-phone-number {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s;
}

.analysis-phone-number:active {
  background: var(--primary-surface);
}

.analysis-phone-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-sm);
}

/* ══════════════════════════════════════════
   RESPONSIVIDADE
   ══════════════════════════════════════════ */
@media (max-width: 380px) {
  .header-title { font-size: var(--text-lg); }
  .step-circle { width: 34px; height: 34px; }
  .step-circle .material-icons-round { font-size: 17px; }
  .step-label { font-size: 10px; }
  .btn-lg { padding: 14px 20px; font-size: var(--text-base); }
  .field-row { flex-direction: column; gap: 0; }
  .reason-chips { flex-direction: column; }
}

@media (min-width: 520px) {
  #app { margin-top: var(--space-lg); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-xl); }
  .app-header { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}

/* ── Tablet (768px+) ── */
@media (min-width: 768px) {
  body { background: var(--surface-variant); display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: var(--space-xl) 0; }
  #app { max-width: 640px; width: 100%; margin: 0 auto; border-radius: var(--radius-xl); box-shadow: 0 8px 40px rgba(0,0,0,0.12); }
  .form-section { padding: var(--space-xl) var(--space-xl); }
  .section-header { gap: var(--space-md); }
  .section-title { font-size: var(--text-xl); }
  .field-input { font-size: var(--text-base); padding: 14px 16px; }
  .btn-lg { font-size: var(--text-base); padding: 16px 32px; }
  .summary-card { padding: var(--space-lg); }
  .upload-area { min-height: 220px; }
  .step-actions { padding: var(--space-lg) 0 0; }
}

/* ── Desktop (1024px+) ── */
@media (min-width: 1024px) {
  body { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 32px 16px; }
  #app { max-width: 600px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; background: var(--surface); }
  .app-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-xl) var(--space-xxl); }
  .header-title { font-size: 1.5rem; }
  .form-section { padding: var(--space-xl) var(--space-xxl); }
  .progress-bar-container { padding: var(--space-md) var(--space-xxl); }
  .field-row { gap: var(--space-md); }
  .reason-chips { gap: var(--space-sm); }
  .summary-row { padding: var(--space-md) 0; }
  .success-container { padding: var(--space-xxl); }
}
