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

:root {
  --preto:    #0D0D0D;
  --vermelho: #C8102E;
  --vm-dark:  #9B0B22;
  --creme:    #F5F2ED;
  --cinza-cl: #E8E5E0;
  --cinza-md: #9E9B96;
  --cinza-dk: #4A4845;
  --branco:   #FFFFFF;
  --verde:    #2D7A4F;
  --azul:     #1A5FA8;

  --radius:   12px;
  --radius-sm:8px;
  --shadow:   0 2px 16px rgba(0,0,0,.12);
  --transition: .18s ease;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--preto);
  color: var(--branco);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Layout shell ─────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

/* ── Header ───────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  background: var(--preto);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 32px; height: 32px;
  background: var(--vermelho);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: -.5px;
  color: #fff;
}
.logo-text { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }
.logo-sub  { font-size: 10px; color: var(--cinza-md); display: block; margin-top: 1px; }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.06);
  color: var(--cinza-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Scrollable content ───────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(var(--safe-bottom) + 80px);
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ───────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 430px;
  padding: 10px 8px calc(var(--safe-bottom) + 10px);
  background: rgba(13,13,13,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  justify-content: space-around;
  z-index: 200;
}

.nav-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 10px;
  border: none; background: none;
  color: var(--cinza-md);
  font-size: 10px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 56px;
}
.nav-item svg { width: 22px; height: 22px; transition: color var(--transition); }
.nav-item.active { color: var(--vermelho); }
.nav-item.active svg { color: var(--vermelho); }

/* ── Cards ────────────────────────────────────── */
.card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.card-dark {
  background: #161616;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.card-red {
  background: linear-gradient(135deg, var(--vermelho) 0%, var(--vm-dark) 100%);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.card-red::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}

/* ── Section label ────────────────────────────── */
.section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--cinza-md);
  margin-bottom: 10px;
}

/* ── Tipo. scale ──────────────────────────────── */
.t-hero  { font-size: 26px; font-weight: 800; line-height: 1.15; }
.t-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.t-sub   { font-size: 13px; color: rgba(255,255,255,.55); line-height: 1.5; }
.t-body  { font-size: 14px; line-height: 1.6; }
.t-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.t-red   { color: var(--vermelho); }
.t-muted { color: var(--cinza-md); }

/* ── Badge ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.badge-red   { background: rgba(200,16,46,.18); color: var(--vermelho); }
.badge-green { background: rgba(45,122,79,.2);  color: #4CAF80; }
.badge-gray  { background: rgba(255,255,255,.08); color: var(--cinza-md); }

/* ── Termômetro ───────────────────────────────── */
.termometro {
  display: flex; gap: 5px; margin: 14px 0 6px;
}
.termo-btn {
  flex: 1; height: 40px;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: var(--cinza-md);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.termo-btn:hover { background: rgba(255,255,255,.1); }
.termo-btn.selected {
  background: var(--vermelho);
  color: #fff;
  transform: scaleY(1.08);
}
.termo-btn[data-n="1"].selected,
.termo-btn[data-n="2"].selected,
.termo-btn[data-n="3"].selected { background: #2D7A4F; }
.termo-btn[data-n="4"].selected,
.termo-btn[data-n="5"].selected,
.termo-btn[data-n="6"].selected,
.termo-btn[data-n="7"].selected { background: #1A5FA8; }

/* ── Textarea / Input ─────────────────────────── */
textarea, input[type="text"], input[type="email"] {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  resize: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
textarea:focus, input:focus {
  border-color: var(--vermelho);
}
textarea::placeholder, input::placeholder { color: rgba(255,255,255,.25); }

/* ── Botões ───────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  border-radius: var(--radius);
  border: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 700;
  transition: all var(--transition);
  letter-spacing: .02em;
}
.btn-primary {
  background: var(--vermelho);
  color: #fff;
}
.btn-primary:hover { background: #a80d26; }
.btn-primary:active { transform: scale(.98); }
.btn-ghost {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.1);
}
.btn-ghost:hover { background: rgba(255,255,255,.1); }

/* ── Gráfico de histórico ─────────────────────── */
.chart-wrap { position: relative; height: 140px; margin: 12px 0; }
.chart-canvas { width: 100% !important; height: 100% !important; }

/* ── Lista de áudios ──────────────────────────── */
.audio-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  margin-bottom: 10px;
  cursor: pointer;
  transition: background var(--transition);
}
.audio-item:hover { background: rgba(255,255,255,.08); }
.audio-play {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 50%;
  background: var(--vermelho);
  display: flex; align-items: center; justify-content: center;
}
.audio-play svg { width: 16px; height: 16px; margin-left: 2px; }
.audio-info h4 { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.audio-info span { font-size: 11px; color: var(--cinza-md); }

/* ── Divisor ──────────────────────────────────── */
.divider {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 16px 0;
}

/* ── Progress ring ────────────────────────────── */
.progress-ring { position: relative; display: inline-flex; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .ring-bg  { fill: none; stroke: rgba(255,255,255,.08); }
.progress-ring .ring-val { fill: none; stroke: var(--vermelho); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.progress-ring .ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px;
}
.progress-ring .ring-label { font-size: 9px; color: var(--cinza-md); font-weight: 500; }

/* ── Login ────────────────────────────────────── */
#login-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 28px;
  background: var(--preto);
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--vermelho);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px; color: #fff;
  margin-bottom: 24px;
  letter-spacing: -1px;
}
.login-error {
  color: #ff6b6b; font-size: 12px;
  text-align: center; margin-top: 8px;
  display: none;
}

/* ── Toast ────────────────────────────────────── */
#toast {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,30,.95);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 30px;
  opacity: 0; pointer-events: none;
  transition: all .3s ease;
  white-space: nowrap; z-index: 9999;
  backdrop-filter: blur(12px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Animations ───────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .3s ease forwards; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* ── Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ── Reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
