/* FitnessPro: nova interface do aluno */
:root {
  --bg: #F4F5F7;
  --surface-1: #FFFFFF;
  --surface-2: #F1F2F5;
  --surface-3: #E7E9EE;
  --line: #E1E4EA;
  --text: #14171F;
  --text-2: #5A6170;
  --text-3: #959BA8;
  --accent: #3B63E0;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(59, 99, 224, .09);
  --ok: #16A34A;
  --ok-soft: rgba(22, 163, 74, .1);
  --warn: #B7791F;
  --danger: #DC2626;
  --shadow: 0 1px 2px rgba(20, 23, 31, .05), 0 2px 8px rgba(20, 23, 31, .04);
  --bar: rgba(255, 255, 255, .94);
  --contrast: #1C2030;
  --warn-bg: #FFF7E8;
  --warn-line: #F5DEB0;
  --danger-bg: #FEF1F1;
  --danger-line: #F8CDCD;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0D12;
  --surface-1: #161A22;
  --surface-2: #1E232D;
  --surface-3: #282E3A;
  --line: #2F3644;
  --text: #F1F3F7;
  --text-2: #A6ADBA;
  --text-3: #6F7686;
  --accent: #4D6CF0;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(110, 142, 247, .15);
  --ok: #4ADE80;
  --ok-soft: rgba(74, 222, 128, .12);
  --warn: #F0B95A;
  --danger: #F87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --bar: rgba(22, 26, 34, .94);
  --contrast: #2B3240;
  --warn-bg: rgba(240, 185, 90, .1);
  --warn-line: rgba(240, 185, 90, .25);
  --danger-bg: rgba(248, 113, 113, .1);
  --danger-line: rgba(248, 113, 113, .28);
  color-scheme: dark;
}
:root[data-theme="dark"] .link { color: #8EA6FA; }
:root[data-theme="dark"] .set.done .set-check { color: #06210F; }
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Base para parecer app instalado no celular: sem flash ao tocar, sem puxar para recarregar */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
/* Controles: toque imediato (sem atraso de 300ms) e sem selecionar texto ao segurar */
button, a, label, [role="button"] { touch-action: manipulation; }
button, .tab, .day, .chip, .btn, .icon-btn, .ex-row, .menu-row, .slot { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* 16px no mínimo: o iPhone dá zoom em campos com fonte menor */
input, select, textarea { font: inherit; font-size: 16px; }
.icon-btn:active, .tab:active, .day:active, .menu-row:active, .ex-row:active { opacity: .7; }
dialog.sheet { overscroll-behavior: contain; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Estrutura de tela */
.app {
  min-height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
}
.content { flex: 1; padding: 16px 16px 120px; }
.content.no-tabs { padding-bottom: 24px; }

/* Cabeçalho de subtela, com voltar */
.page-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--safe-top)) 16px 12px; background: var(--bg); max-width: 520px; margin: 0 auto; }
.page-top h1 { font-size: 18px; line-height: 28px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.sub { padding-top: 0; }
.app.sub .content { padding-top: 4px; }

/* Barra de abas */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 520px; margin: 0 auto;
  background: var(--bar); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-3); padding: 4px 0; }
.tab i { font-size: 24px; }
.tab.on { color: var(--accent); font-weight: 600; }
.tab.on i { color: var(--accent); }

/* Tipografia */
.eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.title-lg { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.title-md { font-size: 18px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.muted { color: var(--text-2); font-size: 14px; line-height: 20px; }
.small { font-size: 12px; line-height: 16px; }

/* Utilitários */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.gap-8 { gap: 8px; }
.center { text-align: center; }

/* Componentes */
.card { background: var(--surface-1); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3) center/cover; flex: none; display: grid; place-items: center; font-weight: 700; color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border-radius: 6px; padding: 4px 8px; }
.chip i { font-size: 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 48px; padding: 0 16px; border-radius: 12px; font-size: 16px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  transition: transform 300ms var(--ease), opacity 300ms var(--ease);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn i { font-size: 20px; }
.btn.ghost { background: var(--surface-1); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: rgba(220, 38, 38, .08); color: var(--danger); }
.btn.sm { min-height: 40px; font-size: 14px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.icon-btn i { font-size: 20px; }
.link { color: var(--accent); font-size: 14px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.banner { display: flex; gap: 12px; align-items: center; border-radius: 12px; padding: 12px; font-size: 14px; line-height: 20px; }
.banner i { font-size: 20px; flex: none; }
.banner b { font-weight: 600; }
.banner.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.banner.warn > i:first-child { color: var(--warn); }
.banner.info { background: var(--accent-soft); border: 1px solid rgba(59, 99, 224, .25); }
.banner.info > i:first-child { color: var(--accent); }
.banner.error { background: var(--danger-bg); border: 1px solid var(--danger-line); }
.banner.error > i:first-child { color: var(--danger); }
.banner.ok { background: var(--ok-soft); border: 1px solid rgba(22, 163, 74, .25); }
.banner.ok > i:first-child { color: var(--ok); }

/* Formulários */
.field { display: block; margin-top: 16px; }
.field > span { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-2); }
.input { margin-top: 4px; display: flex; align-items: center; min-height: 48px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 0 4px 0 12px; gap: 8px; transition: border-color 300ms var(--ease); }
.input input { flex: 1; background: none; border: 0; color: var(--text); font-size: 16px; outline: none; min-width: 0; height: 46px; }
.input:focus-within { border-color: var(--accent); }
.input > i { color: var(--text-3); font-size: 20px; }
.input .icon-btn { background: none; }

/* Esqueleto de carregamento */
.skel { background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 16px; }
@keyframes skel { to { background-position: -200% 0; } }

/* Estado vazio */
.empty { text-align: center; padding: 48px 16px; }
.empty i { font-size: 48px; color: var(--text-3); }
.empty p { margin-top: 8px; }

/* Aviso flutuante */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + var(--safe-bottom)); z-index: 50;
  max-width: 488px; margin: 0 auto;
  background: var(--contrast); color: #FFFFFF; border-radius: 12px; padding: 12px 16px;
  font-size: 14px; line-height: 20px; font-weight: 500; display: flex; gap: 8px; align-items: center;
  box-shadow: 0 8px 24px rgba(20, 23, 31, .2);
  animation: rise 500ms var(--ease);
}
.toast i { font-size: 20px; }
.toast.ok i { color: #4ADE80; }
.toast.error i { color: #F87171; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* Folha inferior (dialog) */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 520px; max-height: 88dvh;
  background: var(--surface-1); color: var(--text); border: 0; border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(24px + var(--safe-bottom));
}
dialog.sheet[open] { animation: sheet-in 500ms var(--ease); }
dialog.sheet::backdrop { background: rgba(20, 23, 31, .45); }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }

/* Lista */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--surface-3); font-size: 14px; line-height: 20px; }
.list-row b { font-weight: 600; }

/* Abas segmentadas */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-3); border-radius: 12px; padding: 4px; }
.seg button { height: 36px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: background-color 300ms var(--ease), color 300ms var(--ease); }
.seg button.on { background: var(--surface-1); color: var(--text); box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
}
