/* ============================================================
   Mentoria Scale — área de membros
   Tokens primeiro. Nenhum valor solto no meio do CSS.
   ============================================================ */
:root {
  --canvas: #08080a;
  --surface: #101014;
  --surface-2: #16161c;
  --surface-3: #1d1d25;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  --text: #f3f3f7;
  --muted: #9a9aab;
  --dim: #6e6e80;

  --accent: #7c5cff;
  --accent-hover: #8f74ff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-line: rgba(124, 92, 255, 0.35);
  --success: #46d18a;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.9);
  --shadow-soft: 0 8px 24px -12px rgba(0, 0, 0, 0.7);

  --topbar: 64px;
  --rail: 372px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.boot { display: grid; place-items: center; height: 100vh; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute;
  width: 900px; height: 900px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.16), transparent 62%);
  top: -420px; right: -280px;
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
  position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), #5638e0);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(124, 92, 255, 0.7);
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }

.login-card h1 { font-size: 24px; letter-spacing: -0.03em; margin-bottom: 6px; text-wrap: balance; }
.login-card .lead { color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.02em; }
.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.field input::placeholder { color: var(--dim); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 14.5px;
  transition: transform 0.12s var(--ease), background 0.16s, border-color 0.16s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 26px -12px rgba(124, 92, 255, 0.9); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

.form-error {
  display: none;
  background: rgba(255, 92, 92, 0.1);
  border: 1px solid rgba(255, 92, 92, 0.28);
  color: #ff9d9d;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
}
.form-error.show { display: block; }

.login-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--dim); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-rows: var(--topbar) 1fr; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(8, 8, 10, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { margin: 0; gap: 9px; }
.topbar .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.topbar .brand-mark svg { width: 13px; height: 13px; }
.topbar .brand-name { font-size: 14.5px; }

.crumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--dim); font-size: 13px; min-width: 0;
}
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--muted); font-weight: 500; }

.top-progress { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-progress .bar { width: 120px; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.top-progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.5s var(--ease); }
.top-progress .pct { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(140deg, #2b2b36, #1b1b23);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase;
}
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; min-width: 210px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 6px; display: none; z-index: 50;
}
.menu.open { display: block; }
.menu-head { padding: 9px 11px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 13.5px; font-weight: 600; }
.menu-head span { font-size: 12px; color: var(--dim); }
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--muted); text-align: left;
}
.menu button:hover { background: var(--surface-3); color: var(--text); }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--muted);
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-toggle { display: none; }

/* ---------- dashboard ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 34px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.035em; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.hero-media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.72; transition: opacity 0.4s, transform 0.7s var(--ease); }
.hero:hover .hero-media img { opacity: 0.85; transform: scale(1.02); }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(16,16,20,0.10) 0%, rgba(16,16,20,0.45) 55%, rgba(16,16,20,0.92) 84%, var(--surface) 100%);
}
.hero-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  z-index: 2;
}
.hero-play span {
  width: 66px; height: 66px; border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  box-shadow: 0 14px 40px -12px rgba(124, 92, 255, 0.9);
  transition: transform 0.2s var(--ease), background 0.2s;
}
.hero:hover .hero-play span { transform: scale(1.06); background: var(--accent-hover); }
.hero-body { position: relative; z-index: 3; padding: 28px 30px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.kicker { font-size: 12.5px; color: var(--dim); font-weight: 500; margin-bottom: 5px; }
.hero-body h2 { font-size: clamp(19px, 2.2vw, 25px); line-height: 1.22; letter-spacing: -0.025em; text-wrap: balance; }
.hero-meta { font-size: 13px; color: var(--dim); }
.hero-bar { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.hero-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 22px;
}
.stat { background: var(--surface); padding: 20px 22px; }
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--dim); margin-top: 2px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 40px 0 16px; }
.section-title h3 { font-size: 16px; letter-spacing: -0.01em; }
.section-title span { font-size: 12.5px; color: var(--dim); }

.grid-sec { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card-sec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.18s, transform 0.18s var(--ease), background 0.18s;
}
.card-sec:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }
.card-sec h4 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; min-height: 38px; }
.card-sec .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); }
.mini-bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.5s var(--ease); }
.card-sec.done { border-color: rgba(70, 209, 138, 0.28); }
.card-sec.done .mini-bar i { background: var(--success); }

/* ---------- player ---------- */
.watch { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: calc(100vh - var(--topbar)); }

.rail {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.rail-head h2 { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.rail-head .rail-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rail-head .rail-sub .mini-bar { flex: 1; }
.rail-head .rail-sub span { font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }

.search { position: relative; margin-top: 12px; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 13px;
}
.search input::placeholder { color: var(--dim); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--dim); }

.rail-scroll { overflow-y: auto; flex: 1; padding: 8px 8px 40px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.rail-scroll::-webkit-scrollbar { width: 8px; }
.rail-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.sec { margin-bottom: 2px; }
.sec-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 11px 10px; border-radius: var(--r-sm);
  text-align: left; color: var(--muted);
}
.sec-btn:hover { background: var(--surface-2); color: var(--text); }
.sec-btn .caret { transition: transform 0.2s var(--ease); color: var(--dim); flex: none; }
.sec.open .sec-btn .caret { transform: rotate(90deg); }
.sec-btn .t { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
.sec-btn .c { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sec-body { display: none; padding-left: 6px; }
.sec.open .sec-body { display: block; }

.mod { margin: 2px 0 6px; }
.mod-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm);
  text-align: left; color: var(--dim);
}
.mod-btn:hover { color: var(--text); background: var(--surface-2); }
.mod-btn .t { flex: 1; font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.mod-btn .c { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.mod-body { display: none; }
.mod.open .mod-body { display: block; }
.mod.open > .mod-btn { color: var(--text); }

.lesson {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px 9px 12px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 13px; line-height: 1.4;
  position: relative;
}
.lesson:hover { background: var(--surface-2); color: var(--text); }
.lesson.active { background: var(--accent-soft); color: var(--text); }
.lesson.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 99px; background: var(--accent);
}
.lesson .lp {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  color: var(--dim); margin-top: 1px;
}
.lesson.done .lp { background: rgba(70, 209, 138, 0.12); border-color: rgba(70, 209, 138, 0.35); color: var(--success); }
.lesson.active .lp { border-color: var(--accent); color: var(--accent); background: transparent; }
.lesson .lt { flex: 1; min-width: 0; }
.lesson .lt b { font-weight: 500; display: block; }
.lesson .lt small { display: block; font-size: 11px; color: var(--dim); margin-top: 3px; }
.lesson .lt .resume { display: block; height: 3px; border-radius: 99px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.lesson .lt .resume i { display: block; height: 100%; background: var(--accent-line); }

.stage { overflow-y: auto; min-width: 0; }
.stage-inner { max-width: 1080px; margin: 0 auto; padding: 26px 32px 80px; }

.player-wrap {
  position: relative; background: #000;
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.player-wrap video { width: 100%; display: block; aspect-ratio: 16 / 9; background: #000; }

.player-empty {
  aspect-ratio: 16 / 9; display: grid; place-items: center;
  text-align: center; padding: 30px; color: var(--muted);
  background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--canvas));
}

.watch-head { margin-top: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.watch-head .crumbs { font-size: 12px; color: var(--dim); margin-bottom: 8px; display: flex; gap: 7px; flex-wrap: wrap; }
.watch-head h1 { font-size: clamp(19px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -0.03em; text-wrap: balance; }
.watch-actions { display: flex; gap: 9px; flex: none; padding-top: 24px; }

.playbar { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.playbar .track {
  flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3);
  cursor: pointer; position: relative; overflow: hidden;
}
.playbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; width: 0; }
.playbar .time { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }

.info-row { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 11px; border-radius: 99px;
}
.chip.ok { color: var(--success); border-color: rgba(70, 209, 138, 0.3); background: rgba(70, 209, 138, 0.07); }

.next-card {
  margin-top: 34px; display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: border-color 0.18s, background 0.18s;
}
.next-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.next-card .nc-thumb { width: 92px; aspect-ratio: 16/9; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-3); flex: none; }
.next-card .nc-body { flex: 1; min-width: 0; }
.next-card .nc-body small { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.next-card .nc-body b { display: block; font-size: 14.5px; font-weight: 600; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- mobile ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 45; display: none; }

@media (max-width: 1024px) {
  :root { --rail: 340px; }
  .rail-toggle { display: grid; }
  .watch { grid-template-columns: 1fr; height: auto; }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 360px);
    z-index: 46; transform: translateX(-104%);
    transition: transform 0.28s var(--ease);
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
  }
  .rail.open { transform: none; }
  .scrim.show { display: block; }
  .stage-inner { padding: 18px 18px 70px; }
  .hero { grid-template-columns: 1fr; }
  .hero-media::after { background: linear-gradient(0deg, rgba(16,16,20,.95), transparent 70%); }
  .hero-body { padding: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .top-progress .bar { width: 70px; }
  .watch-head { flex-direction: column; gap: 14px; }
  .watch-actions { padding-top: 0; }
}

@media (max-width: 560px) {
  .page { padding: 22px 16px 70px; }
  .stats { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
  .crumb { display: none; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 13.5px; padding: 11px 16px;
  border-radius: var(--r-md); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.25s var(--ease);
  z-index: 80; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}