/* ============================================================
   MINHA CORRIDA — Estilos
   Tema CLEAN · claro · saúde & esporte · verde como cor principal
   Mobile-first · acessível
   ============================================================ */

:root {
  /* Superfícies (claras e arejadas) */
  --bg:        #f4f8f6;
  --bg-2:      #ffffff;
  --card:      #ffffff;
  --card-2:    #eef3f1;
  --line:      #e5ebe8;
  --line-2:    #eef2f0;

  /* Texto */
  --txt:       #14211c;
  --txt-dim:   #5d6f68;
  --txt-mute:  #98a8a1;

  /* Cor principal: verde saúde + apoio teal */
  --accent:    #059669;
  --accent-2:  #10b981;
  --accent-3:  #34d399;
  --grad:      linear-gradient(135deg, #059669 0%, #0d9488 100%);
  --accent-soft: rgba(16,185,129,.10);

  /* Cores de apoio (usadas em pequenos detalhes, suaves) */
  --green:  #10b981;
  --blue:   #0ea5e9;
  --indigo: #6366f1;
  --amber:  #f59e0b;
  --rose:   #f43f5e;
  --gold:   #eab308;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow:    0 1px 2px rgba(20,33,28,.04), 0 8px 24px rgba(20,50,40,.06);
  --shadow-sm: 0 1px 2px rgba(20,33,28,.05), 0 4px 12px rgba(20,50,40,.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
body {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background:
    radial-gradient(900px 360px at 50% -220px, rgba(16,185,129,.12), transparent 70%),
    var(--bg);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background: rgba(244,248,246,.82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.2px; }
.brand-logo { font-size: 22px; }
.brand-text { font-size: 18px; color: var(--txt); }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--txt-dim);
  width: 40px; height: 40px; border-radius: 12px; font-size: 17px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .15s, color .15s;
}
.icon-btn:active { transform: scale(.92); }

/* ---------- App container ---------- */
.app {
  padding: 18px 16px calc(100px + var(--safe-bot));
  animation: fade .35s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Títulos ---------- */
.section-title { font-size: 12px; font-weight: 700; color: var(--txt-mute);
  text-transform: uppercase; letter-spacing: 1.4px; margin: 26px 4px 12px; }
.h1 { font-size: 27px; font-weight: 800; line-height: 1.12; margin-bottom: 6px; letter-spacing: -.5px; }
.sub { color: var(--txt-dim); font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 12px; }

/* Hero — verde monocromático, calmo */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad); color: #fff;
  border-radius: 24px; padding: 24px 22px;
  box-shadow: 0 14px 34px rgba(5,150,105,.28);
}
.hero::after {
  content: "🏃"; position: absolute; right: -6px; bottom: -20px;
  font-size: 116px; opacity: .14; transform: rotate(-8deg);
}
.hero-greet { font-size: 13px; opacity: .92; font-weight: 600; letter-spacing: .2px; }
.hero-week { font-size: 30px; font-weight: 800; margin: 5px 0 3px; letter-spacing: -.5px; }
.hero-phase { font-size: 14px; font-weight: 700; opacity: .96; }
.hero-foco { font-size: 13.5px; opacity: .94; margin-top: 10px; }

/* Anel + barra de progresso */
.progress-wrap { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%;
  background: conic-gradient(var(--accent-2) calc(var(--p)*1%), var(--card-2) 0);
  display: grid; place-items: center; }
.ring-inner { width: 64px; height: 64px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: var(--accent); }
.bar { height: 9px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--grad); width: 0; transition: width .6s ease; border-radius: 999px; }

/* Grade de números */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 10px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-num { font-size: 23px; font-weight: 800; color: var(--accent); }
.stat-lb { font-size: 11px; color: var(--txt-dim); margin-top: 3px; }

/* ---------- Linha de treino ---------- */
.workout {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 15px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .15s;
}
.workout:active { transform: scale(.99); }
.workout.done { opacity: .58; }
.workout.done .w-title { text-decoration: line-through; }
.w-tag { width: 4px; align-self: stretch; border-radius: 999px; flex: 0 0 4px; opacity: .9; }
.w-ic { font-size: 20px; flex: 0 0 24px; text-align: center; }
.w-main { flex: 1; min-width: 0; }
.w-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.w-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.2px; }
.w-meta { font-size: 12px; color: var(--txt-dim); }
.w-check {
  width: 27px; height: 27px; flex: 0 0 27px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 14px; color: transparent; transition: all .15s;
}
.workout.done .w-check { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* ---------- Semana (plano) ---------- */
.phase-head {
  display: flex; align-items: center; gap: 12px; margin: 28px 2px 10px;
}
.phase-badge { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 16px; box-shadow: var(--shadow-sm); }
.phase-name { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.phase-meta { font-size: 12px; color: var(--txt-dim); }
.phase-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; font-size: 13px; color: var(--txt-dim); box-shadow: var(--shadow-sm); line-height: 1.55; }
.phase-card b { color: var(--txt); font-weight: 700; }

.week {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.week-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px; cursor: pointer;
  width: 100%; background: none; border: 0; color: var(--txt); text-align: left;
}
.week-num { font-size: 12px; font-weight: 800; color: var(--accent); flex: 0 0 auto; letter-spacing: .3px; }
.week-foco { flex: 1; font-size: 14px; font-weight: 600; }
.week-mini { display: flex; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); }
.dot.done { background: var(--accent-2); border-color: var(--accent-2); }
.chev { color: var(--txt-mute); transition: transform .2s; font-size: 12px; }
.week.open .chev { transform: rotate(90deg); }
.week-body { display: none; padding: 0 12px 12px; }
.week.open .week-body { display: block; animation: fade .25s; }
.week-body .workout { box-shadow: none; }
.week-body .workout + .workout { margin-top: 8px; }
.badge-leve { font-size: 10px; font-weight: 700; color: var(--blue); background: rgba(14,165,233,.12);
  padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

/* ---------- Guias ---------- */
.guide {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px; cursor: pointer; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); transition: transform .12s, border-color .15s;
}
.guide:active { transform: scale(.99); }
.guide-ic { font-size: 26px; flex: 0 0 40px; height: 40px; border-radius: 12px; background: var(--accent-soft);
  display: grid; place-items: center; }
.guide-tt { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.guide-rs { font-size: 12.5px; color: var(--txt-dim); margin-top: 1px; }
.guide .chev { margin-left: auto; }

/* ---------- Sheet (painel deslizante) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20,33,28,.34); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
.sheet-overlay[hidden] { display: none; }
.toast[hidden] { display: none; }
.sheet {
  position: relative; width: 100%; max-width: 640px;
  background: var(--bg-2); border-top-left-radius: 26px; border-top-right-radius: 26px;
  max-height: 88vh; overflow-y: auto;
  padding: 10px 18px calc(28px + var(--safe-bot));
  box-shadow: 0 -10px 40px rgba(20,40,30,.18);
  animation: slideup .3s cubic-bezier(.16,1,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 42px; height: 5px; border-radius: 999px; background: var(--line);
  margin: 6px auto 14px; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--txt-dim); font-size: 15px; cursor: pointer; }

.sh-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; color: #fff; }
.sh-title { font-size: 22px; font-weight: 800; margin: 14px 0 4px; letter-spacing: -.4px; }
.sh-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.pill { font-size: 12px; font-weight: 600; background: var(--card-2); border: 1px solid var(--line);
  color: var(--txt-dim); padding: 6px 11px; border-radius: 999px; }
.sh-block { margin-top: 20px; }
.sh-block h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--accent);
  margin-bottom: 8px; font-weight: 700; }
.sh-list { list-style: none; }
.sh-list li { position: relative; padding: 9px 0 9px 24px; font-size: 14.5px; color: var(--txt);
  border-bottom: 1px solid var(--line-2); line-height: 1.5; }
.sh-list li:last-child { border-bottom: 0; }
.sh-list li::before { content: ""; position: absolute; left: 3px; top: 16px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); }
.sh-tip { margin-top: 20px; background: var(--accent-soft); border: 1px solid rgba(16,185,129,.22);
  border-radius: var(--radius-sm); padding: 14px 15px; font-size: 13.5px; color: var(--txt); line-height: 1.5; }
.sh-tip b { color: var(--accent); }

.big-btn {
  display: block; width: 100%; margin-top: 24px; padding: 16px;
  border: 0; border-radius: 15px; font-size: 16px; font-weight: 800; cursor: pointer;
  color: #fff; background: var(--accent-2); box-shadow: 0 8px 20px rgba(16,185,129,.3);
  transition: transform .12s, filter .15s;
}
.big-btn:active { transform: scale(.98); }
.big-btn.undo { background: var(--card); color: var(--txt-dim); border: 1px solid var(--line); box-shadow: none; }

/* Formulário de config */
.field { margin-top: 18px; }
.field label { display: block; font-size: 13px; color: var(--txt-dim); margin-bottom: 7px; font-weight: 600; }
.field input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--txt); font-size: 16px; }
.field input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.danger-btn { width: 100%; margin-top: 14px; padding: 14px; border-radius: 12px; cursor: pointer;
  background: rgba(244,63,94,.08); border: 1px solid rgba(244,63,94,.28); color: #e11d48; font-weight: 700; }

/* ---------- Barra de navegação ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 640px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bot);
}
.tab { background: none; border: 0; color: var(--txt-mute); cursor: pointer;
  padding: 11px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; transition: color .15s; }
.tab-ic { font-size: 19px; filter: grayscale(1) opacity(.55); transition: filter .15s, transform .15s; }
.tab.active { color: var(--accent); }
.tab.active .tab-ic { filter: none; transform: translateY(-1px) scale(1.06); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bot)); transform: translateX(-50%);
  background: var(--txt); color: #fff;
  padding: 12px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  z-index: 70; box-shadow: 0 10px 30px rgba(20,40,30,.25); animation: toastin .25s ease;
  max-width: 90%;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------- Detalhe do treino: fases, passos, chips ---------- */
.sh-resumo { margin-top: 12px; font-size: 14.5px; color: var(--txt-dim); line-height: 1.5; }

.phase {
  background: var(--card-2); border-radius: var(--radius-sm);
  padding: 15px 15px 16px; margin-top: 16px;
}
.phase-h { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.phase-emoji { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--card);
  display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow-sm); }
.phase-t { font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.phase-d { font-size: 12px; color: var(--txt-dim); }
.phase-intro { font-size: 13.5px; color: var(--txt-dim); line-height: 1.55; margin: 2px 0 12px; }
.phase-intro b { color: var(--txt); }
.phase-note { font-size: 12.5px; color: var(--txt-dim); line-height: 1.5; margin-top: 12px; }

/* Chips tocáveis (movimentos) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); color: var(--txt);
  padding: 9px 13px 9px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s, border-color .15s;
}
.chip:active { transform: scale(.96); }
.chip::after { content: "›"; color: var(--accent); font-weight: 800; margin-left: 1px; }
.chip-ic { font-size: 15px; }

/* Passos numerados */
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; font-size: 14.5px;
  color: var(--txt); border-bottom: 1px solid var(--line-2); line-height: 1.45; }
.step:last-child { border-bottom: 0; }
.step-n { flex: 0 0 23px; width: 23px; height: 23px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center; margin-top: 1px; }

/* Figura animada (detalhe do movimento) */
.back-btn { display: inline-flex; align-items: center; background: none; border: 0;
  color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; padding: 2px 0; margin: 2px 0 6px; }
.move-fig { display: grid; place-items: center; margin: 2px 0 6px; }
.move-fig .move-svg { width: 190px; height: 190px; }

/* Biblioteca de movimentos */
.lib-item { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 13px 10px 10px; margin-bottom: 9px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .15s; }
.lib-item:active { transform: scale(.99); }
.lib-fig { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 13px; overflow: hidden;
  display: grid; place-items: center; }
.lib-fig .move-svg { width: 56px; height: 56px; }
.lib-txt { flex: 1; display: flex; flex-direction: column; }
.lib-nome { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.lib-dur { font-size: 12px; color: var(--txt-dim); }
.lib-item .chev { margin-left: auto; }

/* Destaque do atalho da Biblioteca na aba Guias */
.guide-lib { border-color: rgba(16,185,129,.4); background: linear-gradient(180deg, var(--accent-soft), var(--card)); }
.guide-lib .guide-ic { background: var(--accent-2); }

/* ---------- Strava ---------- */
.strava-link-btn { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--txt); font-size: 14.5px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .12s; }
.strava-link-btn:active { transform: scale(.98); }
.strava-hint { margin-top: 18px; font-size: 13px; color: var(--txt-dim); line-height: 1.5; }
.strava-card { margin-top: 18px; border: 1px solid rgba(252,76,2,.3);
  background: linear-gradient(180deg, rgba(252,76,2,.06), var(--card)); border-radius: var(--radius-sm); padding: 15px; }
.strava-h { font-size: 11.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #fc4c02; margin-bottom: 12px; }
.strava-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.strava-stats > div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.strava-stats b { display: block; font-size: 17px; font-weight: 800; }
.strava-stats span { font-size: 11px; color: var(--txt-dim); }
.link-sm { margin-top: 12px; background: none; border: 0; color: var(--txt-dim); font-size: 13px;
  font-weight: 600; cursor: pointer; text-decoration: underline; }
code { background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* Observação do treino */
.note-add-btn { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 18px; padding: 14px; border: 1px dashed var(--line); border-radius: 14px;
  background: var(--card); color: var(--txt-dim); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .12s, border-color .15s; }
.note-add-btn:active { transform: scale(.99); }
.note-card { margin-top: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 15px; cursor: pointer; box-shadow: var(--shadow-sm); }
.note-h { font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: var(--accent); display: flex; align-items: center; gap: 8px; }
.note-edit-tag { font-size: 11px; font-weight: 700; color: var(--txt-mute); text-transform: none;
  letter-spacing: 0; margin-left: auto; text-decoration: underline; }
.note-sent { display: inline-block; margin-top: 10px; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; }
.note-text { margin-top: 10px; font-size: 14px; color: var(--txt); line-height: 1.5; white-space: pre-wrap; }

/* Tela de edição da observação */
.sent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.sent-btn { display: flex; align-items: center; gap: 9px; padding: 13px 14px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--txt); font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s; }
.sent-btn:active { transform: scale(.97); }
.sent-btn.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); }
.sent-emoji { font-size: 19px; }
.note-area { width: 100%; min-height: 120px; resize: vertical; padding: 13px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--txt);
  font-size: 15px; font-family: inherit; line-height: 1.5; }
.note-area:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Gráficos (Evolução) */
.chart { width: 100%; height: auto; display: block; margin-top: 2px; }
.chart-title { font-size: 12.5px; font-weight: 700; color: var(--txt); margin-bottom: 8px; line-height: 1.35; }

/* Auxiliares */
.empty { text-align: center; color: var(--txt-dim); padding: 40px 20px; font-size: 14px; }
.link { color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; }

@media (min-width: 480px) {
  .h1 { font-size: 30px; }
}
