/* App do Paciente — identidade azul, leitura fácil e interface mobile nativa. */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-deep: #0f2f6f;
  --primary-soft: #eff6ff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --danger: #dc2626;
  --danger-bg: #fff1f2;
  --success-bg: #e0f2fe;
  --tap-min: 56px;
  --shadow: 0 12px 32px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }
html { font-size: 18px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(circle at 85% 0%, rgba(37,99,235,.10), transparent 26%),
    #edf3fb;
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 55px rgba(15,23,42,.12);
  position: relative;
  overflow-x: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.05rem .95rem;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary) 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  box-shadow: 0 8px 24px rgba(30,64,175,.18);
}

.app-header::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  right: -48px;
  top: -66px;
  background: rgba(255,255,255,.09);
  pointer-events: none;
}

.app-header .back-btn {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}
.app-header .back-btn:active { background: rgba(255,255,255,.26); transform: scale(.96); }
.app-header .back-btn[hidden] { visibility: hidden; }
.app-header .header-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.app-header .header-title { font-size: 1.12rem; font-weight: 780; line-height: 1.2; letter-spacing: -.025em; }
.app-header .header-step { font-size: .78rem; opacity: .82; margin-top: 3px; }

.app-body {
  flex: 1;
  padding: 1.1rem 1rem calc(6.2rem + env(safe-area-inset-bottom));
}
.app-body.no-bottom-pad { padding-bottom: 1.1rem; }

#app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-size: 1rem;
  font-weight: 650;
  color: var(--gray-600);
}

.card {
  background: white;
  border: 1px solid #e5edf7;
  border-radius: 18px;
  padding: 1.15rem;
  margin-bottom: .9rem;
  box-shadow: 0 6px 22px rgba(15,23,42,.045);
}

.card-proxima {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary) 100%);
  color: white;
  border: none;
  box-shadow: 0 16px 34px rgba(37,99,235,.22);
}
.card-proxima::after {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  right: -60px;
  top: -72px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
}
.card-proxima .label { font-size: .75rem; opacity: .8; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.card-proxima .especialidade { font-size: 1.45rem; font-weight: 800; margin: .38rem 0 .58rem; letter-spacing: -.035em; position: relative; z-index: 1; }
.card-proxima .data-hora { font-size: 1rem; font-weight: 650; display: flex; align-items: center; gap: .5rem; position: relative; z-index: 1; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: .85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 750;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 9px 20px rgba(37,99,235,.20);
}
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-200); }
.btn-danger-outline { background: white; color: var(--danger); border-color: #fecdd3; }
.btn-block-mt { margin-top: .8rem; }

.option-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  min-height: 68px;
  padding: .9rem 1rem;
  border-radius: 16px;
  border: 1px solid #dfe8f3;
  background: white;
  box-shadow: 0 4px 15px rgba(15,23,42,.035);
  font-family: inherit;
  font-size: .98rem;
  font-weight: 680;
  color: var(--gray-900);
  text-align: left;
  cursor: pointer;
  margin-bottom: .7rem;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.option-card:active { background: var(--gray-50); border-color: var(--primary); transform: scale(.99); }
.option-card .icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #dbeafe;
}
.option-card .option-sub { font-size: .8rem; font-weight: 520; color: var(--gray-600); margin-top: .12rem; }

.progress-steps { display: flex; gap: .4rem; margin-bottom: 1rem; }
.progress-steps .step-dot { flex: 1; height: 6px; border-radius: 99px; background: #dce5f0; }
.progress-steps .step-dot.done { background: linear-gradient(90deg, var(--primary), #60a5fa); }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .86rem; font-weight: 720; margin-bottom: .4rem; color: var(--gray-700); }
.form-input {
  width: 100%;
  min-height: var(--tap-min);
  padding: .82rem .95rem;
  border: 1px solid var(--gray-300);
  border-radius: 13px;
  font-size: .98rem;
  font-family: inherit;
  color: var(--gray-900);
  background: white;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.11); }

.alert {
  padding: .85rem .95rem;
  border-radius: 13px;
  font-size: .9rem;
  font-weight: 650;
  margin-bottom: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  border: 1px solid transparent;
}
.alert-erro { background: var(--danger-bg); color: var(--danger); border-color: #fecdd3; }
.alert-sucesso { background: var(--success-bg); color: #075985; border-color: #bae6fd; }

.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--gray-600); }
.empty-state .icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  margin: 0 auto .8rem;
  color: var(--primary);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state .icon svg { width: 30px; height: 30px; }
.empty-state p { font-size: .96rem; }

.tab-switch {
  display: flex;
  background: #eaf0f7;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 1.15rem;
}
.tab-switch button {
  flex: 1;
  padding: .72rem;
  border: none;
  background: transparent;
  border-radius: 11px;
  font-size: .92rem;
  font-weight: 740;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
}
.tab-switch button.active { background: white; color: var(--primary-dark); box-shadow: 0 3px 10px rgba(15,23,42,.08); }

.logo-area { text-align: center; padding: 1.25rem 0 1rem; }
.logo-area img {
  max-width: 116px;
  max-height: 84px;
  object-fit: contain;
  padding: .5rem;
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}
.logo-area h1 { font-size: 1.35rem; font-weight: 800; margin: .65rem 0 0; letter-spacing: -.03em; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  min-height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid #e2e8f0;
  display: flex;
  z-index: 20;
  box-shadow: 0 -10px 28px rgba(15,23,42,.08);
}
.bottom-nav button {
  flex: 1;
  border: none;
  background: none;
  padding: .62rem 0 .72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  font-family: inherit;
  font-size: .73rem;
  font-weight: 730;
  color: var(--gray-600);
  cursor: pointer;
}
.bottom-nav button.active { color: var(--primary-dark); }
.bottom-nav button svg { width: 22px; height: 22px; }

.consulta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  padding: .95rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  margin-bottom: .7rem;
  box-shadow: 0 4px 14px rgba(15,23,42,.035);
}
.consulta-item .info .especialidade { font-weight: 750; font-size: .96rem; }
.consulta-item .info .data-hora { font-size: .82rem; color: var(--gray-600); margin-top: .18rem; }
.link-cancelar {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  color: var(--danger);
  font-weight: 730;
  font-size: .8rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: .48rem .62rem;
}

@media (max-width: 480px) {
  .app-shell { box-shadow: none; }
  .app-body { padding-inline: .85rem; }
}
