/* A Liga dos Programadores — LMS Prototype */
@import url('https://fonts.googleapis.com/css2?family=Luckiest+Guy&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --navy: #1B2356;
  --blue: #2A78D6;
  --blue-light: #4A92E8;
  --red: #E8483B;
  --yellow: #FFD23F;
  --green: #1EB457;
  --white: #FFFFFF;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #1B2356;
  --muted: #5A638A;
  --border: #E2E6F0;
  --shadow: 0 4px 20px rgba(27, 35, 86, 0.08);
  --surface-2: #EEF1F8;
  --table-head: #1B2356;
  --slot-off: #F7F8FC;
  --slot-hover: #E8ECF5;
  --radius: 14px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3, .font-title {
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  letter-spacing: 0.5px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1rem 1rem 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .logo-mark {
  display: block;
  text-decoration: none;
}

.sidebar-brand .logo-horizontal {
  display: block;
  width: 100%;
  max-width: 228px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  background: #fff;
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18);
}

/* Legacy square icon — unused; keep harmless if referenced */
.sidebar-brand .logo-icon { display: none; }
.sidebar-brand h1,
.sidebar-brand .tagline { display: none; }

.sidebar-role {
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--yellow);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0.75rem;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.85);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 0.25rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--blue);
}

.sidebar-nav .nav-icon { font-size: 1.15rem; width: 1.4rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-weight: 600;
}
.sidebar-footer a:hover { color: var(--white); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  font-size: 1.45rem;
  color: var(--navy);
}

.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg);
  padding: 0.4rem 0.85rem 0.4rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
}

.topbar .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.content { padding: 1.5rem 1.75rem 2.5rem; flex: 1; }

/* ---- Role picker (index) ---- */
.hero-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(42,120,214,0.18), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(232,72,59,0.12), transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(255,210,63,0.1), transparent 60%),
    var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: white;
}

.hero-logo {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-logo .brand-logo {
  display: block;
  width: min(440px, 92vw);
  height: auto;
  margin: 0 auto 1.35rem;
  padding: 0.85rem 1.4rem;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.28);
}

.hero-logo p {
  font-size: 1.05rem;
  opacity: 0.85;
  font-weight: 600;
  max-width: 440px;
  margin: 0 auto;
}

/* Keep legacy badge styles harmless if referenced elsewhere */
.hero-logo .badge {
  display: none;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 900px;
  width: 100%;
}

.role-card {
  background: white;
  color: var(--navy);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 0 rgba(0,0,0,0.15), 0 16px 40px rgba(0,0,0,0.2);
  transition: transform 0.18s, box-shadow 0.18s;
  border: 3px solid transparent;
  display: block;
}

.role-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 0 rgba(0,0,0,0.12), 0 24px 50px rgba(0,0,0,0.25);
  text-decoration: none;
  border-color: var(--yellow);
}

.role-card .role-emoji {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
}

.role-card h3 {
  font-size: 1.55rem;
  margin-bottom: 0.4rem;
}

.role-card p {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 1rem;
}

.role-card .btn {
  width: 100%;
}

.role-card.aluno .role-emoji-bg { background: #E8F4FF; }
.role-card.tutor .role-emoji-bg { background: #FFF5E0; }
.role-card.admin .role-emoji-bg { background: #FFE8E6; }

.demo-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  opacity: 0.55;
  text-align: center;
}

/* ---- Cards & grids ---- */
.grid { display: grid; gap: 1.15rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .sidebar-nav a { margin-bottom: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .content { padding: 1.15rem; }
  .topbar { padding: 1rem; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-body { padding: 1.25rem 1.35rem; }
.card-header {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-header h3 {
  font-size: 1.15rem;
  color: var(--navy);
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-value {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.85rem;
  color: var(--navy);
  line-height: 1.1;
  margin-top: 0.15rem;
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12);
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.12); }

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-light); color: white; }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #c9362d; color: white; border-color: #c9362d; }

.btn-hero { background: var(--red); color: white; }
.btn-hero:hover { background: #F05A4E; color: white; }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #22C963; color: white; }

.btn-warning { background: var(--yellow); color: var(--navy); }
.btn-warning:hover { background: #FFE066; color: var(--navy); }

.btn-outline {
  background: white;
  color: var(--navy);
  border: 2px solid var(--border);
  box-shadow: none;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; box-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.btn-whatsapp { background: var(--green); color: white; }

.btn-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Badges & pills ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.badge-blue { background: #E0EFFF; color: var(--blue); }
.badge-green { background: #D8F5E5; color: #0E8A42; }
.badge-red { background: #FFE0DD; color: var(--red); }
.badge-yellow { background: #FFF3C4; color: #9A7B00; }
.badge-navy { background: #E8EAF4; color: var(--navy); }
.badge-gray { background: #ECEEF4; color: var(--muted); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 800;
  border-bottom: 2px solid var(--border);
  background: #FAFBFE;
}

table.data td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #F8FAFF; }

/* The current lesson row is highlighted in the tutor's turma cronograma. */
table.data tr.lesson-week-current td { background: #F0F7FF; }

table.data .name-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
}

table.data .mini-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

/* ---- Presence toggles ---- */
.presence-toggle {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
}

.presence-toggle button {
  border: none;
  padding: 0.35rem 0.7rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
  background: white;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.presence-toggle button.active-present {
  background: var(--green);
  color: white;
}
.presence-toggle button.active-absent {
  background: var(--red);
  color: white;
}
.presence-toggle button.active-late {
  background: var(--yellow);
  color: var(--navy);
}

/* ---- Lesson / content ---- */
.lesson-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.lesson-hero::after {
  content: '🦸';
  position: absolute;
  right: 1.5rem;
  bottom: -0.3rem;
  font-size: 5rem;
  opacity: 0.2;
}

.tutor-lesson-hero::after {
  content: none;
  display: none;
}

.lesson-hero .eyebrow {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--yellow);
  margin-bottom: 0.4rem;
}

.lesson-hero h3 {
  font-size: 1.7rem;
  margin-bottom: 0.5rem;
}

.lesson-hero p {
  opacity: 0.9;
  font-weight: 600;
  max-width: 520px;
  margin-bottom: 1.1rem;
}

.lesson-room-note {
  color: rgba(255,255,255,0.82);
  font-size: 0.8rem;
  font-weight: 800;
  align-self: center;
}

.resource-list { list-style: none; }
.resource-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.resource-list li:last-child { border-bottom: none; }

.resource-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.resource-meta { flex: 1; min-width: 0; }
.resource-meta strong { display: block; font-size: 0.95rem; }
.resource-meta span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

/* ---- Calendar ---- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.cal-day-head {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 64px;
}

.cal-cell.other { opacity: 0.35; }
.cal-cell.today { border-color: var(--blue); border-width: 2px; background: #F0F7FF; }
.cal-cell.has-class { cursor: pointer; }
.cal-cell.has-class:hover { background: #E8F4FF; }

.cal-dot {
  width: 100%;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-dot.scratch { background: #FFF3C4; color: #9A7B00; }
.cal-dot.python { background: #E0EFFF; color: var(--blue); }

/* ---- School / turma cards ---- */
.entity-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entity-card .entity-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.entity-card h4 {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.15rem;
  color: var(--navy);
}

.entity-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 999px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--navy);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  z-index: 100;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }

/* ---- Misc ---- */
.section-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--navy);
}

.muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.wrap { flex-wrap: wrap; }

.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}
.alert-info { background: #E8F4FF; color: var(--navy); border: 1px solid #B8D8F8; }
.alert-success { background: #D8F5E5; color: #0E5C30; border: 1px solid #A8E4C4; }
.alert-warn { background: #FFF8E0; color: #7A6200; border: 1px solid #F0E0A0; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
}
.empty-state .emoji { font-size: 2.5rem; margin-bottom: 0.75rem; }

.link-fake {
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}
.link-fake:hover { text-decoration: underline; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--navy);
}

@media (max-width: 720px) {
  .mobile-menu-btn { display: block; }
}

/* ---- Tabs (Turma detail) ---- */
.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  padding-bottom: 0;
}
.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--navy); background: #EEF1F8; }
.tab-btn.active {
  color: var(--blue);
  background: #E8F4FF;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -2px;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.turma-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.turma-card-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
}
.turma-card-link:hover .card {
  box-shadow: 0 8px 28px rgba(27, 35, 86, 0.12);
}
.turma-card-link .card { height: 100%; }

/* ---- Tutor weekly availability table ---- */
.avail-wrap {
  max-height: min(68vh, 640px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overscroll-behavior: contain;
}

.avail-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  user-select: none;
  -webkit-user-select: none;
}

.avail-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--navy);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0.7rem 0.35rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.avail-table thead th.avail-corner {
  left: 0;
  z-index: 4;
  width: 76px;
  text-align: left;
  padding-left: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.68rem;
}

.avail-table thead th:last-child {
  border-right: none;
}

.avail-table tbody th.avail-time {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 76px;
  background: var(--surface-2);
  color: var(--navy);
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0 0.75rem 0 0.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 44px;
  white-space: nowrap;
}

.avail-table tbody td {
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 44px;
  vertical-align: stretch;
}

.avail-table tbody td:last-child {
  border-right: none;
}

.avail-slot {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  cursor: pointer;
  background: var(--slot-off);
  font-family: 'Nunito', sans-serif;
  touch-action: none;
  position: relative;
  transition: background 0.12s, box-shadow 0.12s, transform 0.08s;
}

.avail-slot:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  z-index: 1;
}

/* Off — muted */
.avail-slot.is-off {
  background: var(--slot-off);
}

.avail-slot.is-off:hover {
  background: var(--slot-hover);
  box-shadow: inset 0 0 0 2px #C5CAD8;
}

/* Disponível — brand green */
.avail-slot.is-on {
  background: var(--green);
  box-shadow: inset 0 0 0 1px rgba(27, 35, 86, 0.06);
}

.avail-slot.is-on::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(27, 35, 86, 0.2);
}

.avail-slot.is-on:hover {
  background: #22C963;
  filter: none;
  transform: none;
  box-shadow: inset 0 0 0 2px var(--navy);
}

.avail-slot.is-on:active,
.avail-slot.is-off:active {
  transform: scale(0.98);
}

.avail-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
}

.avail-swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.avail-swatch.on {
  background: var(--green);
  border-color: transparent;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.avail-swatch.off {
  background: #F7F8FC;
  border-color: #D8DCE8;
}

/* Assigned class / room — locked booked chip */
.avail-slot.is-class {
  background: linear-gradient(135deg, #1B2356 0%, #2A78D6 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: default;
  font-family: 'Nunito', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  padding: 3px 4px;
  white-space: normal;
  word-break: break-word;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.avail-slot.is-class::after {
  display: none;
  content: none;
}

.avail-slot.is-class:hover {
  background: linear-gradient(135deg, #24306A 0%, #3A88E0 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 215, 63, 0.55);
  transform: none;
}

.avail-slot.is-class:active {
  transform: none;
}

.avail-slot.is-class .avail-class-chip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.avail-swatch.class {
  background: linear-gradient(135deg, #1B2356 0%, #2A78D6 100%);
  border-color: transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

@media (max-width: 720px) {
  .avail-table { min-width: 520px; }
  .avail-table thead th.avail-corner,
  .avail-table tbody th.avail-time { width: 64px; }
  .avail-slot,
  .avail-table tbody th.avail-time,
  .avail-table tbody td { height: 38px; }
  .avail-slot { height: 38px; }
}

/* ---- Financeiro (tutor) — lesson status cells ---- */
.fin-slot {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 3px 4px;
  border: none;
  border-radius: 0;
  cursor: default;
  background: var(--slot-off);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  color: var(--muted);
  position: relative;
  pointer-events: none;
  user-select: none;
}

.fin-slot.is-empty {
  background: var(--slot-off);
  color: transparent;
}

.fin-slot.is-atribuida {
  background: linear-gradient(135deg, #1B2356 0%, #2A78D6 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.fin-slot.is-a-ministrar {
  background: linear-gradient(135deg, #E67E22 0%, #FFD23F 100%);
  color: #1B2356;
  box-shadow: inset 0 0 0 1px rgba(27, 35, 86, 0.12);
}

.fin-slot.is-ministrada {
  background: linear-gradient(135deg, #148F45 0%, #1EB457 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.fin-slot.is-paga {
  background: linear-gradient(135deg, #6C3483 0%, #9B59B6 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.fin-slot .fin-chip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.fin-swatch.atribuida {
  background: linear-gradient(135deg, #1B2356 0%, #2A78D6 100%);
  border-color: transparent;
}
.fin-swatch.a-ministrar {
  background: linear-gradient(135deg, #E67E22 0%, #FFD23F 100%);
  border-color: transparent;
}
.fin-swatch.ministrada {
  background: linear-gradient(135deg, #148F45 0%, #1EB457 100%);
  border-color: transparent;
}
.fin-swatch.paga {
  background: linear-gradient(135deg, #6C3483 0%, #9B59B6 100%);
  border-color: transparent;
}

.fin-week-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.fin-week-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--navy);
  min-width: 220px;
  text-align: center;
}

.fin-day-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.75;
  margin-top: 0.15rem;
  text-transform: none;
  letter-spacing: 0;
}

.avail-table thead th.fin-today {
  box-shadow: inset 0 -3px 0 var(--yellow);
}

.fin-report-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.fin-report-item {
  flex: 1 1 140px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
}

.fin-report-item .label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.fin-report-item .value {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.6rem;
  color: var(--navy);
  line-height: 1.1;
}

.fin-report-item .sub {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.15rem;
}

.fin-history {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.fin-history-month h4 {
  margin: 0 0 0.55rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--navy);
}
.fin-history-empty {
  margin: 0;
  font-weight: 700;
}


/* ---- Tutor dashboard (extracted from tutor/index.html) ---- */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #1B2356 0%, #2A78D6 100%);
  color: #fff;
  border-radius: 16px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 28px rgba(27, 35, 86, 0.22);
}
.dash-welcome h3 {
  font-size: 1.55rem;
  color: #fff;
  margin-bottom: 0.35rem;
}
.dash-welcome p {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0.9;
  max-width: 420px;
}
.dash-welcome .brand-logo {
  width: min(220px, 48vw);
  height: auto;
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.next-class {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.next-class-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.9rem;
}
.next-class-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.pay-cycle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem 1.25rem;
}
@media (max-width: 560px) {
  .pay-cycle-grid { grid-template-columns: 1fr; }
}
.pay-kv .k {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.pay-kv .v {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.35rem;
  color: var(--navy);
  line-height: 1.15;
  margin-top: 0.15rem;
}
.pay-kv .v.sm {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}
.meter-row { display: grid; gap: 1rem; }
.meter-item .meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
  gap: 0.5rem;
}
.meter-item .meter-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--navy);
}
.meter-item .meter-val {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--blue);
}
.meter-item .progress-bar { height: 10px; }
.meter-item .progress-bar > span.green {
  background: linear-gradient(90deg, #1EB457, #22C963);
}
.meter-item .progress-bar > span.yellow {
  background: linear-gradient(90deg, #E0A800, #FFD23F);
}
.meter-item .progress-bar > span.blue {
  background: linear-gradient(90deg, #2A78D6, #4A92E8);
}
.pend-list { list-style: none; display: grid; gap: 0.65rem; }
.pend-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: var(--warn-bg, #FFF8E0);
  border: 1px solid var(--warn-border, #F0E0A0);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
}
.pend-list li .pend-icon { font-size: 1.15rem; flex-shrink: 0; }
.pend-list li a { font-weight: 800; }
.week-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (max-width: 560px) {
  .week-pills { grid-template-columns: 1fr; }
}
.week-pill {
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.week-pill .n {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.85rem;
  color: var(--navy);
  line-height: 1;
}
.week-pill .l {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 0.35rem;
}
.week-pill.ok { background: var(--ok-bg, #D8F5E5); border-color: var(--ok-border, #A8E4C4); }
.week-pill.next { background: var(--info-bg, #E8F4FF); border-color: var(--info-border, #B8D8F8); }
.week-pill.cancel { background: var(--danger-bg, #FFE8E6); border-color: var(--danger-border, #F5C4C0); }

/* Financeiro swatch base + mobile (was inline) */
.avail-swatch,
.fin-swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .fin-slot,
  .avail-table tbody th.avail-time,
  .avail-table tbody td { height: 38px; }
  .fin-slot { height: 38px; }
  .fin-week-label { min-width: 160px; font-size: 0.85rem; }
}

/* ---- Theme button ---- */
.theme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0.42rem 0.72rem;
  border: 1px solid #1F64B8;
  border-radius: var(--radius-sm);
  background: #1F64B8;
  color: #fff;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.theme-toggle:hover {
  background: #1D5EAE;
  border-color: #1D5EAE;
  transform: translateY(-1px);
}
.theme-toggle:focus-visible {
  outline: 3px solid rgba(42, 120, 214, 0.35);
  outline-offset: 2px;
}
.theme-toggle .theme-label { color: inherit; white-space: nowrap; }
.theme-toggle-hero {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.55);
  color: #fff;
  backdrop-filter: blur(6px);
}
.theme-toggle-hero:hover {
  background: rgba(255,255,255,0.22);
  border-color: #fff;
}

/* ---- Dark mode ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1228;
  --card: #171D3A;
  --text: #E8EBF7;
  --muted: #9AA3C7;
  --border: #2A3358;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --surface-2: #121833;
  --slot-off: #121833;
  --slot-hover: #1E2748;
  /* Keep brand --navy / --blue / accents; only surfaces flip */
  --warn-bg: #3A3210;
  --warn-border: #6A5A18;
  --ok-bg: #123528;
  --ok-border: #1E5C40;
  --info-bg: #12283F;
  --info-border: #1E4A6E;
  --danger-bg: #3A1C1A;
  --danger-border: #6A3330;
}

/* Sidebar stays brand navy even in dark mode */
html[data-theme="dark"] .sidebar {
  background: #121833;
  color: #fff;
}
html[data-theme="dark"] .sidebar-brand .logo-horizontal,
html[data-theme="dark"] .dash-welcome .brand-logo,
html[data-theme="dark"] .hero-logo .brand-logo {
  background: #fff;
}
html[data-theme="dark"] .topbar h2,
html[data-theme="dark"] .card-header h3,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .pay-kv .v,
html[data-theme="dark"] .meter-item .meter-label,
html[data-theme="dark"] .week-pill .n,
html[data-theme="dark"] .fin-week-label,
html[data-theme="dark"] .fin-history-month h4,
html[data-theme="dark"] .fin-report-item .value,
html[data-theme="dark"] .name-cell,
html[data-theme="dark"] table td,
html[data-theme="dark"] .user-chip {
  color: var(--text);
}
html[data-theme="dark"] .btn-warning { color: #1B2356; }
html[data-theme="dark"] .btn-outline { color: var(--text); }
html[data-theme="dark"] .tab-btn:hover { background: var(--surface-2); color: var(--text); }
html[data-theme="dark"] .tab-btn.active { color: var(--blue); }
html[data-theme="dark"] .avail-table thead th { background: #0B1024; }
html[data-theme="dark"] .sidebar { background: #121833; }

html[data-theme="dark"] .avail-table thead th {
  background: #0B1024;
  color: #fff;
}
html[data-theme="dark"] .avail-table tbody th.avail-time {
  color: #E8EBF7;
  border-color: var(--border);
}
html[data-theme="dark"] .avail-table tbody td {
  border-color: var(--border);
}
html[data-theme="dark"] .avail-legend {
  color: var(--muted);
}
html[data-theme="dark"] .badge-gray {
  background: #2A3358;
  color: var(--muted);
}
html[data-theme="dark"] .alert-success {
  background: var(--ok-bg);
  color: #A8E4C4;
  border-color: var(--ok-border);
}
html[data-theme="dark"] .alert-warn {
  background: var(--warn-bg);
  color: #F0E0A0;
  border-color: var(--warn-border);
}
html[data-theme="dark"] .role-card {
  background: var(--card);
  color: var(--text);
}
html[data-theme="dark"] .role-card p { color: var(--muted); }
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .table thead th {
  color: var(--muted);
}
html[data-theme="dark"] .pend-list li {
  color: var(--text);
}
html[data-theme="dark"] .stat-card {
  background: var(--card);
}
html[data-theme="dark"] .tabs {
  border-color: var(--border);
}

/* ---- Dark mode contrast refinements ---- */
html[data-theme="dark"] {
  --border: #3D4B75;
}

/* Links and controls use a brighter blue against dark surfaces. */
html[data-theme="dark"] .main a:not(.btn),
html[data-theme="dark"] .content a:not(.btn),
html[data-theme="dark"] .link-fake {
  color: #78BAFF;
}
html[data-theme="dark"] .sidebar-nav a.active {
  background: #1F64B8;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .theme-toggle {
  background: #1F64B8;
  border-color: #1F64B8;
  color: #fff;
}
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .theme-toggle:hover {
  background: #1D5EAE;
  border-color: #1D5EAE;
  color: #fff;
}
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-whatsapp {
  background: #0E7A3B;
  color: #fff;
}
html[data-theme="dark"] .btn-hero {
  background: #C9362D;
  color: #fff;
}
html[data-theme="dark"] .toast.success { background: #0E7A3B; }

/* Keep labels and status badges readable without losing their meanings. */
html[data-theme="dark"] .badge-blue,
html[data-theme="dark"] .cal-dot.python {
  background: #153A66;
  color: #9DCEFF;
}
html[data-theme="dark"] .badge-green {
  background: #123D2B;
  color: #91E3B1;
}
html[data-theme="dark"] .badge-red {
  background: #4A2425;
  color: #FFADA7;
}
html[data-theme="dark"] .badge-yellow,
html[data-theme="dark"] .cal-dot.scratch {
  background: #4A3D12;
  color: #FFE38A;
}
html[data-theme="dark"] .badge-navy {
  background: #29345D;
  color: #E8EBF7;
}
html[data-theme="dark"] .badge-gray {
  background: #2A3358;
  color: #C4CCE6;
}

/* Cards, tables, calendar cells, and controls must not retain light surfaces. */
html[data-theme="dark"] .entity-card h4,
html[data-theme="dark"] .mobile-menu-btn {
  color: var(--text);
}
html[data-theme="dark"] table.data th {
  background: #11172F;
  color: #C4CCE6;
  border-color: var(--border);
}
html[data-theme="dark"] table.data tr:hover td {
  background: #1E2748;
}
html[data-theme="dark"] table.data tr.lesson-week-current td,
html[data-theme="dark"] table.data tr.lesson-week-current:hover td {
  background: #1E2748;
  color: var(--text);
}
html[data-theme="dark"] table.data tr.lesson-week-current td.muted {
  color: #C4CCE6;
}
html[data-theme="dark"] .presence-toggle {
  border-color: var(--border);
}
html[data-theme="dark"] .presence-toggle button {
  background: var(--card);
  color: #C4CCE6;
}
html[data-theme="dark"] .cal-cell {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .cal-cell.other {
  opacity: 0.62;
  color: #AAB5D5;
}
html[data-theme="dark"] .cal-cell.today {
  background: #182D4A;
  border-color: #78BAFF;
}
html[data-theme="dark"] .cal-cell.has-class:hover {
  background: #1A3450;
}
html[data-theme="dark"] .avail-swatch.off {
  background: #1B2444;
  border-color: #53618F;
}
html[data-theme="dark"] .avail-slot.is-class,
html[data-theme="dark"] .fin-slot.is-atribuida {
  background: linear-gradient(135deg, #182D59 0%, #215FAE 100%);
}
html[data-theme="dark"] .fin-slot.is-a-ministrar {
  background: linear-gradient(135deg, #8F5410 0%, #9F5E12 100%);
  color: #fff;
}
html[data-theme="dark"] .fin-slot.is-ministrada {
  background: linear-gradient(135deg, #0E6B35 0%, #0F7C3D 100%);
}
html[data-theme="dark"] .fin-slot.is-paga {
  background: linear-gradient(135deg, #5A2874 0%, #7B3FA0 100%);
}
html[data-theme="dark"] .fin-swatch.atribuida {
  background: linear-gradient(135deg, #182D59 0%, #215FAE 100%);
}
html[data-theme="dark"] .fin-swatch.a-ministrar {
  background: linear-gradient(135deg, #B66D12 0%, #D9A51D 100%);
}
html[data-theme="dark"] .fin-swatch.ministrada {
  background: linear-gradient(135deg, #0E6B35 0%, #0F7C3D 100%);
}
html[data-theme="dark"] .fin-swatch.paga {
  background: linear-gradient(135deg, #5A2874 0%, #7B3FA0 100%);
}

/* Improve muted text, borders, tabs, and information panels on dark surfaces. */
html[data-theme="dark"] .btn-outline {
  border-color: #53618F;
}
html[data-theme="dark"] .btn-outline:hover {
  border-color: #78BAFF;
  color: #78BAFF;
}
html[data-theme="dark"] .tab-btn.active {
  color: #78BAFF;
  background: #153A66;
}
html[data-theme="dark"] .alert-info {
  background: #12283F;
  color: #C9E2FF;
  border-color: #2A5A85;
}
html[data-theme="dark"] .alert-info .muted,
html[data-theme="dark"] .alert-info .text-sm {
  color: #C9E2FF;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #AAB5D5;
}

@media (max-width: 560px) {
  .topbar .user-chip {
    gap: 0.45rem;
    padding-right: 0.55rem;
    font-size: 0.8rem;
  }
  .theme-toggle {
    min-height: 32px;
    padding: 0.36rem 0.55rem;
    font-size: 0.72rem;
  }
}

/* ---- Forms (Substituições etc.) ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: -0.15rem;
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.input:focus,
select.input:focus,
textarea.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.18);
}
textarea.input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  background: white;
  color: var(--navy);
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.radio-chip input {
  accent-color: var(--blue);
  width: 1rem;
  height: 1rem;
}
.radio-chip:has(input:checked),
.radio-chip.is-checked {
  border-color: var(--blue);
  background: #E8F4FF;
  color: var(--blue);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* Substitution request list */
.sub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}
.sub-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  background: #FAFBFE;
}
.sub-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.sub-item h4 {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.05rem;
  color: var(--navy);
  margin: 0;
}
.sub-item .meta {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}
.sub-item .meta strong { color: var(--navy); }
.sub-notified {
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #E8F4FF;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}
.sub-notified ul {
  margin: 0.35rem 0 0 1.1rem;
  padding: 0;
}
.hidden { display: none !important; }

html[data-theme="dark"] .field-label { color: var(--text); }
html[data-theme="dark"] .input,
html[data-theme="dark"] select.input,
html[data-theme="dark"] textarea.input {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .radio-chip {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .radio-chip:has(input:checked),
html[data-theme="dark"] .radio-chip.is-checked {
  background: #153A66;
  border-color: #78BAFF;
  color: #78BAFF;
}
html[data-theme="dark"] .sub-item {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="dark"] .sub-item h4 { color: var(--text); }
html[data-theme="dark"] .sub-item .meta strong { color: var(--text); }
html[data-theme="dark"] .sub-notified {
  background: #12283F;
  color: #C9E2FF;
}

/* ---- Avatar photo / picker ---- */
.avatar.avatar-photo,
.avatar.avatar-editable {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.avatar.avatar-editable:hover {
  box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.35);
}
.avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.avatar .avatar-emoji {
  font-size: 1.15em;
  line-height: 1;
}
.avatar-lg {
  width: 72px !important;
  height: 72px !important;
  font-size: 1.6rem !important;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.avatar-xl {
  width: 88px !important;
  height: 88px !important;
  font-size: 2rem !important;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.avatar-picker {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.avatar-modal[hidden] {
  display: none !important;
}
.avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.avatar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.avatar-modal-panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.avatar-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.avatar-modal-head h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--navy);
}
.avatar-modal-x {
  border: none;
  background: var(--bg);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}
.avatar-modal-preview {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 0.75rem;
}
.avatar-modal-hint { text-align: center; font-weight: 600; margin: 0 0 0.85rem; }
.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.avatar-preset-btn {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.45rem;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.avatar-preset-btn:hover {
  transform: scale(1.06);
  border-color: var(--blue);
}
.avatar-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.avatar-file-label { cursor: pointer; margin: 0; }

html[data-theme="dark"] .avatar-modal-panel {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="dark"] .avatar-modal-head h3 { color: var(--text); }
html[data-theme="dark"] .avatar-modal-x {
  background: #1a2744;
  color: var(--text);
}
html[data-theme="dark"] .avatar-preset-btn {
  border-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .avatar.avatar-editable:hover {
  box-shadow: 0 0 0 3px rgba(120, 186, 255, 0.4);
}

/* ---- Ranking (kids-friendly) ---- */
.ranking-blurb { font-weight: 600; margin: 0 0 0.85rem; }
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.rank-item {
  display: grid;
  grid-template-columns: 42px 36px 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.rank-item.is-podium {
  background: linear-gradient(135deg, rgba(255,210,63,0.22), rgba(42,120,214,0.08));
  border-color: rgba(255,210,63,0.45);
}
.rank-item.is-you {
  box-shadow: 0 0 0 2px var(--blue);
  border-color: var(--blue);
}
.rank-pos {
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  color: var(--navy);
}
.rank-name {
  font-weight: 800;
  color: var(--navy);
  font-size: 0.95rem;
}
.rank-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}
.rank-xp {
  font-weight: 900;
  color: var(--blue);
  font-size: 0.95rem;
}
.rank-detail {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.rank-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50% !important;
  overflow: hidden;
  display: grid;
  place-items: center;
  line-height: 1;
}
.rank-avatar .rank-avatar-img,
.rank-avatar-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.rank-compact .rank-item {
  grid-template-columns: 36px 32px 1fr auto;
  padding: 0.45rem 0.6rem;
}
.rank-compact .rank-avatar {
  width: 32px;
  height: 32px;
}

html[data-theme="dark"] .rank-item {
  background: #152238;
  border-color: var(--border);
}
html[data-theme="dark"] .rank-item.is-podium {
  background: linear-gradient(135deg, rgba(255,210,63,0.16), rgba(42,120,214,0.12));
}
html[data-theme="dark"] .rank-pos,
html[data-theme="dark"] .rank-name { color: var(--text); }
html[data-theme="dark"] .rank-xp { color: #78BAFF; }

@media (max-width: 560px) {
  .avatar-preset-grid { grid-template-columns: repeat(4, 1fr); }
  .rank-item {
    grid-template-columns: 36px 1fr auto;
  }
  .rank-item .rank-avatar { display: none; }
}


/* ---- Admin cursos / course tints ---- */
.curso-card.is-selected {
  outline: 2px solid var(--blue);
  box-shadow: 0 0 0 4px rgba(42, 120, 214, 0.18);
}
.course-tint-scratch { background: #FFFEF5; }
.course-tint-python { background: #F5FAFF; }
html[data-theme="dark"] .course-tint-scratch {
  background: rgba(255, 210, 63, 0.08);
}
html[data-theme="dark"] .course-tint-python {
  background: rgba(42, 120, 214, 0.12);
}
html[data-theme="dark"] .curso-card.is-selected {
  box-shadow: 0 0 0 4px rgba(120, 186, 255, 0.22);
}


/* ---- Admin form modal (Criar turma etc.) ---- */
.form-modal-panel {
  max-width: min(1120px, calc(100vw - 2rem));
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  text-align: left;
}
.form-modal-panel .avail-wrap { max-height: min(52vh, 500px); }
.form-modal-panel .avail-table tbody th.avail-time,
.form-modal-panel .avail-table tbody td,
.form-modal-panel .avail-slot { height: 34px; }
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.form-stack .input {
  font-weight: 600;
}
.form-modal .avatar-modal-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}


/* ---- Login pages ---- */
.login-page {
  padding: 2rem 1.25rem;
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  color: var(--text);
  border-radius: 22px;
  padding: 1.85rem 1.65rem 1.5rem;
  box-shadow: 0 12px 0 rgba(0,0,0,0.14), 0 28px 56px rgba(0,0,0,0.28);
  border: 3px solid rgba(255,210,63,0.55);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.35rem;
}

.login-brand .brand-logo {
  display: block;
  width: min(300px, 88%);
  height: auto;
  margin: 0 auto 1rem;
  padding: 0.65rem 1rem;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(27, 35, 86, 0.12);
}

.login-portal-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 0.45rem;
}

.login-title {
  font-size: 1.85rem;
  color: var(--navy);
  margin-bottom: 0.4rem;
  line-height: 1.15;
}

.login-subtitle {
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  border: 2px solid #dadce0;
  background: #fff;
  color: #3c4043;
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.06);
  transition: background 0.15s, box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #c2c5ca;
  box-shadow: 0 4px 12px rgba(27, 35, 86, 0.12);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.btn-google:focus-visible {
  outline: 3px solid rgba(66, 133, 244, 0.45);
  outline-offset: 2px;
}

.btn-google:disabled,
.btn-google.is-loading {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.btn-google-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.btn-google-label {
  letter-spacing: 0.01em;
}

.login-oauth-note {
  margin-top: 1.1rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
}

.login-oauth-note strong {
  color: var(--text);
}

.login-footer-links {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 700;
}

.login-footer-links a {
  color: var(--blue);
}

.login-stub-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.login-stub-form .form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  text-align: left;
}

.login-stub-form .input:disabled,
.login-stub-form .btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

html[data-theme="dark"] .login-card {
  background: var(--card);
  border-color: rgba(255, 210, 63, 0.35);
  box-shadow: 0 12px 0 rgba(0,0,0,0.35), 0 28px 56px rgba(0,0,0,0.45);
}

html[data-theme="dark"] .login-title {
  color: var(--text);
}

html[data-theme="dark"] .login-brand .brand-logo {
  background: #fff;
}

html[data-theme="dark"] .btn-google {
  background: #fff;
  color: #3c4043;
  border-color: #dadce0;
}

html[data-theme="dark"] .btn-google:hover {
  background: #f1f3f4;
}

html[data-theme="dark"] .login-oauth-note {
  background: var(--surface-2);
}

.login-alt-details {
  margin-top: 1rem;
  text-align: left;
  border-radius: 10px;
  border: 1px dashed var(--border, #dadce0);
  padding: 0.55rem 0.75rem 0.65rem;
  background: var(--surface-2);
}

.login-alt-details summary {
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--muted);
  list-style: none;
}

.login-alt-details summary::-webkit-details-marker { display: none; }

.login-alt-details summary::before {
  content: '▸ ';
  color: var(--blue);
}

.login-alt-details[open] summary::before {
  content: '▾ ';
}

.google-picker {
  margin-top: 0.85rem;
  border: 2px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem;
  text-align: left;
  box-shadow: 0 8px 24px rgba(27, 35, 86, 0.12);
}

.google-picker-title {
  margin: 0 0 0.55rem;
  font-weight: 800;
  font-size: 0.92rem;
  color: #3c4043;
}

.google-picker-title .muted {
  font-weight: 600;
  color: #80868b;
  font-size: 0.82rem;
}

.google-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.google-picker-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.12s;
}

.google-picker-item:hover,
.google-picker-item:focus-visible {
  background: #f1f3f4;
  outline: none;
}

.google-picker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1B2356;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.google-picker-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.google-picker-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: #202124;
}

.google-picker-email {
  font-weight: 600;
  font-size: 0.78rem;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-picker-hint,
.google-picker-empty {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #80868b;
}

html[data-theme="dark"] .google-picker {
  background: #fff;
  border-color: #dadce0;
}

html[data-theme="dark"] .login-alt-details {
  border-color: rgba(255,255,255,0.18);
}


/* ---- Tutor cadastro (login) ---- */
.login-card-wide {
  width: min(480px, 100%);
}

.login-secret-hint {
  margin: 0 0 1.1rem;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.45;
}

.login-secret-hint strong {
  font-weight: 800;
}

.login-stub-form .field-error {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red);
}

.login-stub-form .field-error[hidden] {
  display: none;
}

.login-stub-form .input.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(232, 72, 59, 0.18);
}

.form-banner-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: #FFE0DD;
  color: #8B1E14;
  border: 1px solid #F5B4AC;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.form-banner-error[hidden] {
  display: none;
}

.login-stub-form code,
.login-oauth-note code,
.field-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  font-weight: 800;
  padding: 0.05em 0.35em;
  border-radius: 6px;
  background: rgba(42, 120, 214, 0.12);
  color: var(--blue);
}

.login-stub-form .btn.is-loading {
  opacity: 0.72;
  cursor: wait;
}

html[data-theme="dark"] .form-banner-error {
  background: rgba(232, 72, 59, 0.18);
  color: #FFB4AC;
  border-color: rgba(232, 72, 59, 0.4);
}

html[data-theme="dark"] .login-stub-form .field-error {
  color: #FF8A7A;
}

html[data-theme="dark"] .login-stub-form code,
html[data-theme="dark"] .login-oauth-note code,
html[data-theme="dark"] .field-hint code {
  background: rgba(42, 120, 214, 0.22);
  color: #8EC5FF;
}
