:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --accent: #111111;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --blue: #2563eb;
  --orange: #ea580c;
  --red: #dc2626;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; }
.container { max-width: 920px; margin: 0 auto; padding: 20px 16px 48px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }

.topbar {
  background: var(--accent);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar img { height: 36px; width: auto; filter: brightness(0) invert(1); }
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar a, .topbar .link {
  color: #fff; text-decoration: none; font-size: .88rem;
  opacity: .85; padding: 6px 10px; border-radius: 8px;
}
.topbar a:hover { opacity: 1; background: rgba(255,255,255,.1); }

.page-title { font-size: 1.45rem; font-weight: 700; margin: 8px 0 4px; }
.page-sub { color: var(--muted); font-size: .92rem; margin-bottom: 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-soft { background: #fafafa; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; border: none;
  font-weight: 600; font-size: .92rem; cursor: pointer;
  text-decoration: none; transition: .15s;
  background: var(--accent); color: #fff;
}
.btn:hover { background: #000; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #15803d; }
.btn-wa { background: #25D366; }
.btn-wa:hover { background: #1da851; }
.btn-sm { padding: 8px 14px; font-size: .82rem; border-radius: 10px; }
.btn-danger { background: var(--red); }
.btn-block { width: 100%; }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; font-size: .95rem; margin-bottom: 14px;
  background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #111; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-green { background: var(--green-soft); color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f4f4f5; color: #52525b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

.stat {
  background: var(--card); border-radius: 14px; padding: 16px; text-align: center;
  border: 1px solid var(--border);
}
.stat .num { font-size: 1.6rem; font-weight: 800; }
.stat .lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--card); border-radius: var(--radius); border: 1px dashed var(--border);
}

.aluno-row, .treino-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid #f0f0f0;
}
.aluno-row:last-child, .treino-row:last-child { border-bottom: none; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: #a1a1aa; }

.timer-box {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: #111; color: #fff; padding: 16px 20px;
  display: none; align-items: center; justify-content: space-between;
  z-index: 50; box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
.timer-box.show { display: flex; }
.timer-num { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-label { font-size: .85rem; opacity: .8; }

.progress-bar {
  height: 6px; background: #e4e4e7; border-radius: 99px; overflow: hidden; margin: 12px 0;
}
.progress-bar > span { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

/* ---- Topbar melhorias ---- */
.topbar {
  background: var(--accent);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar img {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}
.topbar nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.topbar a, .topbar .link {
  color: #fff;
  text-decoration: none;
  font-size: .85rem;
  opacity: .85;
  padding: 7px 11px;
  border-radius: 8px;
  white-space: nowrap;
}
.topbar a:hover, .topbar a.active {
  opacity: 1;
  background: rgba(255,255,255,.12);
}
.topbar-brand strong { font-weight: 600; }

/* Painel aluno: alinhamento nome + sair */
.topbar-aluno {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
.topbar-aluno .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-aluno .user-area span {
  font-size: .9rem;
  opacity: .95;
  white-space: nowrap;
}
.topbar-aluno .user-area a {
  opacity: 1;
  background: rgba(255,255,255,.12);
  padding: 6px 14px;
}

.feedback-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: .88rem;
  color: #92400e;
  line-height: 1.45;
}
.feedback-box .stars { color: #f59e0b; margin-bottom: 4px; }
