:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --navy: #1a2332;
  --navy2: #243044;
  --blue: #060AD8;
  --blue2: #0508b0;
  --text: #1a2332;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #10b981;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(26,35,50,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }

/* Top bar professor */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: .02em;
}
.topbar .brand img { height: 28px; }
.topbar .back {
  position: absolute;
  left: 16px;
  color: #fff;
  font-size: .95rem;
  opacity: .9;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
.wrap-wide { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }

.hello {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.hello .avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: #dbe4f5; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}
.hello h1 { font-size: 1.25rem; font-weight: 700; }

/* Tabs */
.tabs {
  display: flex;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tabs a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: #f8faff;
}

/* Cards grid */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 560px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card-btn {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 14px;
  text-align: center;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid transparent;
  transition: .15s;
}
.card-btn:hover { border-color: var(--blue); color: var(--blue); }
.card-btn .ico {
  width: 42px; height: 42px; border-radius: 12px;
  background: #eef3ff; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.card-btn.primary {
  background: var(--blue);
  color: #fff;
}
.card-btn.primary .ico { background: rgba(255,255,255,.2); color: #fff; }
.card-btn.dark {
  background: var(--navy);
  color: #fff;
}
.card-btn.dark .ico { background: rgba(255,255,255,.12); color: #fff; }

.section-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 0 10px;
  font-weight: 700;
}

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=tel], input[type=date], input[type=email],
input[type=number], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { min-height: 90px; resize: vertical; }
.err-field { border-color: var(--danger) !important; }
.hint-err { color: var(--danger); font-size: .8rem; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
}
.btn:hover { background: var(--blue2); }
.btn-block { width: 100%; }
.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger); }

.radio-row { display: flex; gap: 16px; margin-top: 6px; }
.radio-row label { font-weight: 500; display: flex; align-items: center; gap: 6px; margin: 0; }

/* Aluno list */
.aluno-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  color: inherit;
}
.aluno-row .av {
  width: 44px; height: 44px; border-radius: 50%;
  background: #e8eef8; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy);
}
.aluno-row .info { flex: 1; }
.aluno-row .info strong { display: block; }
.aluno-row .info span { font-size: .85rem; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-off { background: #fee2e2; color: #991b1b; }

/* Rotina card */
.rotina-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.rotina-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.rotina-letter {
  width: 48px; height: 48px; border-radius: 50%;
  background: #eef3ff; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem;
}
.meta { font-size: .85rem; color: var(--muted); }
.meta strong { color: var(--text); }

.treino-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
  background: #fafbfc;
}
.treino-item h4 { margin-bottom: 4px; }

/* Exercise picker */
.muscle-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.muscle-chip {
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: .85rem;
}
.muscle-chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.ex-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.ex-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: #fff;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: .9rem;
}
.ex-list button:hover { background: #f0f5ff; }
.ex-list button img {
  width: 72px; height: 72px; object-fit: contain; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); flex-shrink: 0;
}
.ex-list button span { flex: 1; line-height: 1.3; }
.aluno-row .av {
  width: 48px; height: 48px; border-radius: 50%;
  background: #e8eef8; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy); overflow: hidden; flex-shrink: 0;
}
.aluno-row .av img { width: 100%; height: 100%; object-fit: cover; }
.hello .avatar { overflow: hidden; }
.hello .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }


.ex-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border-radius: 12px; padding: 12px;
  border: 1px solid var(--border); margin-bottom: 10px;
}
.ex-card img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; background: #f5f5f5; }
.ex-card .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 1; }
.ex-card input { padding: 8px; font-size: .85rem; }

/* Aluno mobile */
.aluno-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #0f1419; color: #fff; }
.aluno-shell .top {
  padding: 16px; display: flex; justify-content: space-between; align-items: center;
}
.aluno-shell .content { padding: 0 16px 90px; }
.aluno-shell .card-a {
  background: #1a222d; border-radius: 16px; padding: 16px; margin-bottom: 12px;
}
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  background: #1a222d; display: flex;
  border-top: 1px solid #2a3340;
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 12px 4px;
  color: #8b95a5; font-size: .75rem; font-weight: 600;
}
.bottom-nav a.active { color: #060AD8; }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .9rem; }
.alert-ok { background: #d1fae5; color: #065f46; }
.alert-err { background: #fee2e2; color: #991b1b; }

.login-box {
  max-width: 400px; margin: 60px auto; padding: 28px;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow);
}
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 1.3rem; }
.login-box p { text-align: center; color: var(--muted); margin-bottom: 20px; font-size: .9rem; }

.landing {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a2332 0%, #2a3a55 100%);
  color: #fff; padding: 24px; text-align: center;
}
.landing h1 { font-size: 1.6rem; margin: 16px 0 8px; }
.landing p { opacity: .8; margin-bottom: 28px; }
.landing .btns { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.landing .btns a {
  padding: 14px; border-radius: 14px; font-weight: 700;
  background: #fff; color: var(--navy);
}
.landing .btns a.sec { background: transparent; border: 2px solid rgba(255,255,255,.4); color: #fff; }


/* Aluno app polish */
.aluno-shell .card-a a, .aluno-shell a.card-a { color: inherit; }
.aluno-shell .btn { border-radius: 12px; }
body:has(.aluno-shell) { background: #0f1419; }

/* Logo personal arredondada */
.topbar .brand img,
.top img,
.header-treino img,
.aluno-top img,
.logo-prof,
img.logo-prof {
  border-radius: 12px;
  object-fit: contain;
}
.marca-slash { color: #060AD8 !important; }

/* Exercise picker */
.ex-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.ex-pick {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.ex-pick img {
  width: 64px; height: 64px; object-fit: contain; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); flex-shrink: 0;
}
.ex-pick-name { flex: 1; font-size: .88rem; line-height: 1.3; text-align: left; }
.ex-pick-view, .ex-pick-add {
  border: 0; border-radius: 10px; width: 36px; height: 36px; cursor: pointer;
  font-size: 1rem; flex-shrink: 0;
}
.ex-pick-view { background: #f3f4f6; }
.ex-pick-add { background: var(--blue); color: #fff; font-weight: 700; font-size: 1.2rem; }
.ex-pick:hover { background: #f8faff; }

/* Avatars nítidos */
.aluno-row .av, .hello .avatar {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: #e8eef8; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy);
}
.aluno-row .av img, .hello .avatar img {
  width: 100%; height: 100%; object-fit: cover;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.ex-list button.ex-pick-btn, .ex-list .ex-pick-btn {
  display: flex !important; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 8px 12px;
  border: none; background: #fff; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: .9rem;
}
.ex-list button.ex-pick-btn img {
  width: 72px; height: 72px; object-fit: contain; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); flex-shrink: 0;
}
.ex-list button.ex-pick-btn span { flex: 1; line-height: 1.3; }


/* Logo oficial KivoFIT */
.topbar .brand img.marca-kivofit-img,
.topbar .brand img {
  height: 32px !important;
  width: auto !important;
  max-width: 180px;
}

/* Ajuda professor — apenas canto superior direito */
.topbar {
  position: relative !important;
  padding-right: 56px !important;
}
a.help-top {
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  left: auto !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 70 !important;
  width: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  border-radius: 50% !important;
  background: #060AD8 !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 1.05rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  border: 2px solid rgba(255,255,255,.4) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
  line-height: 1 !important;
  flex: none !important;
}
a.help-top:hover { background: #0508b0 !important; color: #fff !important; }
