/* Booknando Cursos — componentes.
   As medidas vêm do handoff (design/README.md) e são finais.
   Tokens em tokens.css; nada de cor solta aqui. */

/* ---------- Reset e base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; text-wrap: pretty; }
p { margin: 0; text-wrap: pretty; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; }

/* Foco visível obrigatório — o handoff pede anel de 2px em todos os controles. */
:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
  border-radius: 4px;
}
.on-dark :focus-visible { outline-color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--wine); color: #fff; padding: 12px 18px; font-weight: 700;
  border-radius: 0 0 var(--r-btn) 0;
}
.skip-link:focus { left: 0; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* ---------- Tipografia utilitária ---------- */
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-btn); border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  padding: 12px 18px; transition: background .14s, border-color .14s, color .14s;
  text-align: center;
}
.btn--primary {
  background: var(--wine); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover { background: var(--wine-dk); }
.btn--secondary {
  background: var(--surface); border-color: var(--line); color: var(--ink);
}
.btn--secondary:hover { background: var(--surface-2); }
.btn--ok { background: var(--ok); color: #fff; font-weight: 700; }
.btn--ok:hover { filter: brightness(.93); }
.btn--block { width: 100%; }
.btn--lg { font-size: 16px; padding: 15px 26px; font-weight: 700; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--on-dark {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff;
}
.btn--on-dark:hover { background: rgba(255,255,255,.2); }
.btn--logo { background: var(--logo-red); color: #fff; font-weight: 700; }
.btn--logo:hover { filter: brightness(1.08); }

/* ---------- Superfícies ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel);
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.inset {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-card);
}

/* ---------- Pílulas de estado ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 11px;
  border-radius: var(--r-pill); white-space: nowrap;
}
.pill--ok   { background: var(--ok-bg);   color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--err  { background: var(--err-bg);  color: var(--err); }
.pill--info { background: var(--info-bg); color: var(--info); }

/* ---------- Barra de progresso ---------- */
.track { background: var(--line-2); border-radius: 99px; overflow: hidden; }
.track__fill { background: var(--wine); height: 100%; border-radius: 99px; transition: width .3s; }
.track--dark { background: rgba(255,255,255,.18); }
.track--dark .track__fill { background: var(--logo-red); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--wine-soft); color: var(--wine);
  font-weight: 800; flex: none;
}

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand__mark { flex: none; display: block; }
.wordmark { font-family: var(--font-logo); font-weight: 800; letter-spacing: -.01em; }
.wordmark .w-book { color: var(--logo-dark); }
.wordmark .w-nando { color: var(--logo-red); }
.wordmark .w-cursos { color: var(--muted); font-weight: 600; }
.on-dark .wordmark .w-book { color: #fff; }
.on-dark .wordmark .w-nando { color: #e46a6a; }
.on-dark .wordmark .w-cursos { color: #fff; opacity: .6; }

/* ---------- Superfícies escuras ---------- */
.on-dark { background: var(--logo-dark); color: #fff; }
.on-dark .t-2 { color: #e2cfcf; }
.on-dark .t-3 { color: #c9aaaa; }
.on-dark .eyebrow { color: #e0a5a5; }

/* =======================================================================
   1. LOGIN
   ======================================================================= */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login__brandcol {
  background: var(--logo-dark); color: #fff; padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.login__h1 {
  font-size: 52px; font-weight: 800; letter-spacing: -.03em; line-height: 1.04;
  margin-bottom: 18px;
}
.login__lede { font-size: 17px; line-height: 1.6; color: #e7d3d3; max-width: 440px; }
.login__stats { display: flex; gap: 38px; }
.login__stat-n { font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.login__stat-l { font-size: 13px; color: #c9aaaa; }
.login__formcol {
  display: flex; align-items: center; justify-content: center; padding: 40px 28px;
}
.login__form { width: 100%; max-width: 388px; }
.login__form h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }

.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; }
.input {
  width: 100%; padding: 13px 15px; font-size: 15px; font-family: var(--font-body);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); color: var(--ink);
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--wine); }
.input[aria-invalid="true"] { border-color: var(--err); background: var(--err-bg); }

.form-error {
  background: var(--err-bg); color: var(--err); border: 1px solid #eecccc;
  border-radius: var(--r-input); padding: 11px 14px; font-size: 14px;
  font-weight: 600; margin-bottom: 16px;
}

.checkline { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 18px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--wine); border-radius: 5px; }
.link-wine { color: var(--wine); font-weight: 600; font-size: 14px; }
.link-wine:hover { text-decoration: underline; }

/* =======================================================================
   2. HEADER
   ======================================================================= */
.appheader {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.appheader__in {
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.appnav { display: flex; align-items: center; gap: 2px; }
.appnav a {
  font-size: 15px; font-weight: 600; color: var(--muted);
  padding: 8px 14px; border-radius: var(--r-pill);
}
.appnav a:hover { background: var(--surface-2); }
.appnav a[aria-current="page"] { color: var(--wine); background: var(--wine-soft); }
.appheader__right { display: flex; align-items: center; gap: 14px; }
.xp-pill {
  background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 13px;
  padding: 7px 13px; border-radius: var(--r-pill); white-space: nowrap;
}
.appheader .avatar { width: 34px; height: 34px; font-size: 13px; }
.logout { font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 0; }
.logout:hover { color: var(--ink); }

/* =======================================================================
   3. CATÁLOGO
   ======================================================================= */
.hero { background: var(--logo-dark); color: #fff; }
.hero__in {
  padding: 52px 28px 46px; display: grid; grid-template-columns: 1.25fr .75fr;
  gap: 48px; align-items: center;
}
.hero__badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; background: rgba(255,255,255,.12);
  padding: 6px 13px; border-radius: var(--r-pill); margin-bottom: 18px;
}
.hero__h1 {
  font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  max-width: 640px; margin-bottom: 14px;
}
.hero__desc { font-size: 16px; line-height: 1.6; color: #e2cfcf; max-width: 560px; }
.hero__meta { font-size: 14px; font-weight: 600; color: #c9aaaa; margin-top: 14px; }
.hero__progress { max-width: 460px; margin: 22px 0 24px; }
.hero__progress-top {
  display: flex; justify-content: space-between; font-size: 13.5px;
  color: #c9aaaa; margin-bottom: 9px;
}
.hero__progress .track { height: 7px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.week {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-panel); padding: 26px;
}
.week__label { font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #e0a5a5; }
.week__streak { display: flex; align-items: baseline; gap: 12px; margin: 12px 0 20px; }
.week__n { font-family: var(--font-head); font-size: 44px; font-weight: 800; line-height: 1; }
.week__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week__day { text-align: center; }
.week__bar { height: 38px; border-radius: 8px; background: rgba(255,255,255,.14); }
.week__bar--full { background: var(--logo-red); }
.week__bar--half { background: rgba(192,0,0,.5); }
.week__d { font-size: 11px; color: #c9aaaa; margin-top: 6px; display: block; }
.week__goal {
  display: flex; justify-content: space-between; font-size: 13px; color: #c9aaaa;
  border-top: 1px solid rgba(255,255,255,.14); margin-top: 18px; padding-top: 14px;
}

.rails { padding: 34px 28px 90px; display: flex; flex-direction: column; gap: 38px; }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.rail__head h2 { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.rail__strip {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.rail__strip::-webkit-scrollbar { height: 8px; }
.rail__strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.rail__strip::-webkit-scrollbar-track { background: transparent; }

.ccard {
  flex: 0 0 288px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); overflow: hidden; display: block;
  transition: box-shadow .16s, transform .16s; text-align: left;
}
.ccard:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.ccard__cover {
  height: 152px; padding: 18px; display: flex; flex-direction: column;
  justify-content: space-between; color: #fff;
}
.ccard__cat {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.75);
}
.ccard__kinds { display: flex; gap: 5px; }
.ccard__kind {
  font-size: 11px; font-weight: 700; background: rgba(0,0,0,.28);
  padding: 3px 9px; border-radius: var(--r-pill);
}
.ccard__title { font-family: var(--font-head); font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.ccard__foot { padding: 14px 18px 16px; }
.ccard__row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 9px; }
.ccard__prog { font-weight: 700; color: var(--wine); }
.ccard__prog--new { color: var(--ok); }
.ccard__foot .track { height: 5px; }

/* =======================================================================
   4. CURSO
   ======================================================================= */
.coursebar { background: var(--logo-dark); color: #fff; }
.coursebar__in {
  padding: 22px 28px 24px; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 30px; flex-wrap: wrap;
}
.coursebar__back { font-size: 14px; font-weight: 600; color: #e0a5a5; display: inline-block; margin-bottom: 10px; }
.coursebar__back:hover { color: #fff; }
.coursebar h1 { font-size: 32px; font-weight: 800; letter-spacing: -.025em; }
.coursebar__meta { font-size: 14px; color: #c9aaaa; margin-top: 7px; }
.coursebar__prog { text-align: right; }
.coursebar__prog-l { font-size: 12.5px; color: #c9aaaa; }
.coursebar__prog-n { font-family: var(--font-head); font-size: 26px; font-weight: 800; }
.coursebar__prog .track { width: 190px; height: 7px; margin-top: 6px; }

.courselayout {
  padding: 26px 28px 90px; display: grid; grid-template-columns: 1fr 336px;
  gap: 26px; align-items: start;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; font-size: 14.5px; font-weight: 600;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--wine); color: #fff; border-color: var(--wine); }

.lesson { overflow: hidden; }
.lesson__head { padding: 22px 26px 0; }
.lesson__head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.lesson__body { padding: 20px 26px 24px; }

.mediatabs { display: flex; gap: 8px; margin-bottom: 18px; }
.mediatab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-btn); font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.mediatab:hover { color: var(--ink); }
.mediatab[aria-pressed="true"] {
  background: var(--wine-soft); color: var(--wine); border-color: var(--wine);
}

/* Player de vídeo */
.videowrap {
  position: relative; aspect-ratio: 16/9; background: #1a0606;
  border-radius: var(--r-card); overflow: hidden;
}
.videowrap video { width: 100%; height: 100%; display: block; }
.videowrap--empty {
  display: flex; align-items: center; justify-content: center; color: #e2cfcf;
  text-align: center; padding: 30px; font-size: 15px;
}
.videowrap--empty::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, rgba(192,0,0,.28), transparent 70%);
}

/* Player de áudio */
.audioplayer { padding: 22px; }
.audioplayer__top { display: flex; align-items: center; gap: 20px; }
.wave { display: flex; align-items: flex-end; gap: 3px; height: 44px; flex: 1; }
.wave span { flex: 1; border-radius: 2px; background: var(--line); }
.wave span.on { background: var(--wine); }
.audioplayer audio { width: 100%; margin-top: 16px; }
.audioplayer__meta { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* Leitura HTML paginada */
.reader { padding: 34px 40px; }
.reader__col { max-width: 640px; margin: 0 auto; }
.reader__col h3 { font-size: 22px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.015em; }
.reader__col h4 { font-family: var(--font-head); font-size: 17.5px; font-weight: 700; margin: 24px 0 10px; }
.reader__col p { font-size: 16.5px; line-height: 1.75; margin-bottom: 16px; }
.reader__col ul, .reader__col ol { font-size: 16.5px; line-height: 1.75; margin: 0 0 16px; padding-left: 22px; }
.reader__col li { margin-bottom: 7px; }
.reader__col code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: var(--wine-soft); color: var(--wine); padding: 1px 5px; border-radius: 5px;
}
.reader__col pre {
  background: var(--logo-dark); color: #f3e5e3; padding: 16px 18px;
  border-radius: var(--r-input); overflow-x: auto; font-size: 13.5px; line-height: 1.6;
  margin-bottom: 16px;
}
.reader__col pre code { background: none; color: inherit; padding: 0; }
.reader__col img { border-radius: var(--r-input); border: 1px solid var(--line); margin-bottom: 16px; }
.reader__col figure { margin: 0 0 20px; }
.reader__col figcaption { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.reader__col table { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 18px; }
.reader__col th, .reader__col td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2);
}
.reader__col th { background: var(--surface); font-weight: 700; font-size: 13px; }
.callout {
  border-left: 3px solid var(--wine); background: var(--wine-soft);
  padding: 16px 20px; border-radius: 0 var(--r-input) var(--r-input) 0; margin-bottom: 18px;
}
.callout__label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--wine); display: block; margin-bottom: 6px;
}
.callout p:last-child { margin-bottom: 0; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 26px; }
.pager__mid { text-align: center; }
.pager__label { font-size: 13.5px; color: var(--muted); }
.dots { display: flex; gap: 7px; justify-content: center; margin-top: 9px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--line);
  border: 0; padding: 0; flex: none;
}
.dot[aria-current="true"] { background: var(--wine); }

.lesson__foot {
  border-top: 1px solid var(--line-2); background: var(--surface-2);
  padding: 22px 26px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.lesson__xp { font-size: 14px; color: var(--muted); }
.lesson__xp b { color: var(--warn); }
.lesson__foot-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Sidebar de conteúdo */
.toc { position: sticky; top: 88px; overflow: hidden; }
.toc__head {
  padding: 18px 20px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: baseline; justify-content: space-between;
}
.toc__head h2 { font-family: var(--font-body); font-size: 17px; font-weight: 700; }
.toc__body { max-height: 640px; overflow-y: auto; }
.toc__mod { background: var(--surface-2); padding: 14px 20px 8px; }
.toc__mod-l { font-size: 12px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.toc__mod-t { font-size: 14.5px; font-weight: 700; margin-top: 3px; }
.toc__item {
  display: flex; gap: 12px; padding: 12px 20px; width: 100%;
  border: 0; border-bottom: 1px solid var(--line-2); background: none;
  text-align: left; align-items: flex-start;
}
.toc__item:hover { background: var(--surface-2); }
.toc__item[aria-current="true"] { background: var(--wine-soft); }
.toc__dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.toc__dot--done { background: var(--ok); border-color: var(--ok); color: #fff; }
.toc__dot--active { background: var(--wine); border-color: var(--wine); color: #fff; }
.toc__t { font-size: 14.5px; font-weight: 500; }
.toc__item[aria-current="true"] .toc__t { font-weight: 700; color: var(--wine); }
.toc__m { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.toc__foot { border-top: 1px solid var(--line-2); background: var(--surface-2); padding: 16px 20px; }

/* =======================================================================
   4b. QUIZ
   ======================================================================= */
.quiz { padding: 28px; }
.quiz__head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.quiz__head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.quiz__sub { font-size: 14px; color: var(--muted); margin-top: 7px; }
.quiz__xp {
  background: var(--warn-bg); color: var(--warn); border-radius: var(--r-card);
  padding: 13px 18px; text-align: center; flex: none;
}
.quiz__xp b { font-family: var(--font-head); font-size: 22px; font-weight: 800; display: block; }
.quiz__list { display: flex; flex-direction: column; gap: 16px; }
.q { border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
.q__head { display: flex; gap: 12px; align-items: flex-start; }
.q__n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--wine-soft);
  color: var(--wine); font-weight: 800; font-size: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.q__prompt { font-size: 17px; font-weight: 700; line-height: 1.45; }
.q__opts { display: flex; flex-direction: column; gap: 9px; margin: 16px 0 0 38px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px;
  border-radius: var(--r-input); border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 15px; line-height: 1.5;
}
.opt:hover { background: var(--surface-2); }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt__radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line);
  flex: none; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center;
}
.opt__radio::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.opt--sel { background: var(--wine-soft); border-color: var(--wine); }
.opt--sel .opt__radio { border-color: var(--wine); }
.opt--sel .opt__radio::after { background: var(--wine); }
.opt--right { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.opt--right .opt__radio { border-color: var(--ok); }
.opt--right .opt__radio::after { background: var(--ok); }
.opt--wrong { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.opt--wrong .opt__radio { border-color: var(--err); }
.opt--wrong .opt__radio::after { background: var(--err); }
.opt__mark { margin-left: auto; font-size: 12px; font-weight: 700; white-space: nowrap; }
.opt:focus-within { outline: 2px solid var(--wine); outline-offset: 2px; }
.q__feedback {
  background: var(--surface-2); border-radius: var(--r-input);
  padding: 14px 16px; font-size: 14.5px; line-height: 1.6; margin: 14px 0 0 38px;
}
.q__feedback b { color: var(--wine); }
.quiz__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 22px; flex-wrap: wrap;
}
.quiz__result { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.quiz__result--ok { color: var(--ok); }
.quiz__result--err { color: var(--err); }

/* =======================================================================
   4c. PERGUNTAS
   ======================================================================= */
.ask { padding: 24px; margin-bottom: 16px; }
.ask h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ask__sub { font-size: 14px; color: var(--muted); margin: 6px 0 14px; }
.textarea {
  width: 100%; min-height: 88px; padding: 14px 15px; font-size: 15px; line-height: 1.6;
  font-family: var(--font-body); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-input); color: var(--ink); resize: vertical;
}
.ask__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.ask__note { font-size: 13.5px; color: var(--faint); }

.qa { padding: 22px; margin-bottom: 12px; }
.qa__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.qa .avatar { width: 36px; height: 36px; font-size: 13px; }
.qa__name { font-size: 15px; font-weight: 700; }
.qa__time { font-size: 13px; color: var(--faint); }
.qa__text { font-size: 16px; line-height: 1.6; }
.qa__answer {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-card); padding: 15px 17px; margin-top: 14px;
}
.qa__author { font-size: 13px; font-weight: 700; color: var(--wine); margin-bottom: 5px; }
.qa__answer p { font-size: 15px; line-height: 1.65; }
.qa__actions { display: flex; gap: 18px; margin-top: 14px; }
.qa__action {
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  background: none; border: 0; padding: 0;
}
.qa__action:hover { color: var(--wine); }
.qa__action[disabled] { color: var(--wine); opacity: 1; cursor: default; }
.qa__reply { margin-top: 12px; }

/* =======================================================================
   4d. MATERIAIS
   ======================================================================= */
.materials { padding: 26px; }
.materials__list { display: flex; flex-direction: column; gap: 10px; }
.mat {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--r-card); padding: 15px 18px;
}
.mat__ext {
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  background: var(--wine-soft); color: var(--wine);
  padding: 6px 9px; border-radius: 6px; flex: none;
}
.mat__name { font-size: 15.5px; font-weight: 700; }
.mat__meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.mat__dl { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--wine); white-space: nowrap; }

/* =======================================================================
   5. PROGRESSO
   ======================================================================= */
.page { padding: 38px 28px 90px; }
.page__h1 { font-size: 38px; font-weight: 800; letter-spacing: -.025em; }
.page__sub { font-size: 15.5px; color: var(--muted); margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 26px 0 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
.stat__l { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat__v { font-family: var(--font-head); font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 4px; }
.stat__v--warn { color: var(--warn); }
.stat__v--ok { color: var(--ok); }
.stat__s { font-size: 13.5px; color: var(--faint); }

.split { display: grid; grid-template-columns: 1.35fr .65fr; gap: 20px; }
.split__panel { padding: 26px; }
.split__panel h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.inprog { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.inprog:last-child { border-bottom: 0; }
.inprog__sq { width: 46px; height: 46px; border-radius: 11px; flex: none; }
.inprog__body { flex: 1; min-width: 0; }
.inprog__top { display: flex; justify-content: space-between; gap: 12px; }
.inprog__t { font-size: 15.5px; font-weight: 700; }
.inprog__p { font-size: 14px; font-weight: 700; color: var(--wine); }
.inprog__media { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.inprog .track { height: 6px; }

.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.badge {
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 15px; text-align: center;
}
.badge--locked { background: var(--surface-2); opacity: .45; }
.badge__disc {
  width: 38px; height: 38px; border-radius: 50%; margin: 0 auto 9px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.badge__n { font-size: 13.5px; font-weight: 700; }
.badge__d { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* =======================================================================
   6. CERTIFICADO
   ======================================================================= */
.certpage { max-width: 1060px; margin: 0 auto; padding: 38px 28px 90px; }
.certpage__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.certpage__head h1 { font-size: 34px; font-weight: 800; letter-spacing: -.025em; }
.certframe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px; }
.cert {
  border: 2px solid var(--wine-soft); border-radius: var(--r-card);
  padding: 52px 60px; text-align: center;
  background: linear-gradient(180deg, #fff, #fdfbf7);
}
.cert__brand { display: flex; justify-content: center; margin-bottom: 30px; }
.cert__label { font-size: 12.5px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.cert__name { font-family: var(--font-head); font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 18px 0 12px; }
.cert__verb { font-size: 16px; color: var(--muted); }
.cert__course { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--wine); max-width: 660px; margin: 12px auto; }
.cert__hours { font-size: 15px; color: var(--muted); margin-top: 10px; }
.cert__signs { display: flex; justify-content: center; gap: 80px; margin: 44px 0 26px; flex-wrap: wrap; }
.cert__sign { width: 190px; border-top: 1px solid var(--line); padding-top: 9px; }
.cert__sign-n { font-size: 13.5px; font-weight: 700; }
.cert__sign-r { font-size: 12.5px; color: var(--muted); }
.cert__code { font-size: 12.5px; color: var(--faint); }
.certlist { display: flex; flex-direction: column; gap: 12px; }
.certrow { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
.certrow__body { flex: 1; min-width: 0; }

/* =======================================================================
   7. ADMIN
   ======================================================================= */
.admin__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.admin__tools { display: flex; gap: 10px; align-items: center; }
.admin__search { width: 280px; padding: 12px 15px; }
.utable { overflow: hidden; margin-top: 22px; }
.utable__head, .utable__row {
  display: grid; grid-template-columns: 2.1fr 1fr 1fr 1.3fr .9fr 90px;
  gap: 16px; align-items: center;
}
.utable__head {
  background: var(--surface-2); padding: 14px 22px;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.utable__row { padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.utable__row:last-child { border-bottom: 0; }
.ucell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ucell .avatar { width: 36px; height: 36px; font-size: 13px; }
.uname { font-size: 14.5px; font-weight: 700; }
.uemail { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urole { font-size: 14px; }
.ulast { font-size: 13.5px; color: var(--muted); }
.uprog__top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.uprog .track { height: 5px; }
.uactions { display: flex; gap: 8px; justify-content: flex-end; }
.iconbtn {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); padding: 0;
}
.iconbtn:hover { color: var(--ink); }
.iconbtn--danger { background: var(--err-bg); border-color: #eecccc; color: var(--err); }
.utable__foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; gap: 16px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; }
.pagination a, .pagination span {
  padding: 6px 11px; border-radius: 7px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.pagination .is-current { background: var(--wine); color: #fff; border-color: var(--wine); }
.empty { padding: 40px 22px; text-align: center; color: var(--muted); font-size: 15px; }

/* Modal (novo/editar usuário) */
.modal__backdrop {
  position: fixed; inset: 0; background: rgba(31,27,23,.45); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--surface); border-radius: var(--r-panel); width: 100%;
  max-width: 460px; padding: 28px; max-height: calc(100vh - 48px); overflow-y: auto;
}
.modal h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 18px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.select {
  width: 100%; padding: 12px 15px; font-size: 15px; font-family: var(--font-body);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); color: var(--ink);
}

/* =======================================================================
   8. TUTOR
   ======================================================================= */
.tutorfab {
  position: fixed; right: 22px; bottom: 22px; z-index: 61;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--wine); color: #fff; border: 0;
  padding: 14px 20px 14px 15px; border-radius: var(--r-pill);
  box-shadow: 0 10px 26px rgba(142,27,27,.34); font-size: 15px; font-weight: 700;
}
.tutorfab:hover { background: var(--wine-dk); }
.tutorfab__disc {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex: none;
}
.tutor {
  position: fixed; right: 22px; bottom: 96px; width: 384px; z-index: 60;
  max-height: calc(100vh - 140px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: 0 18px 48px rgba(60,20,20,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.tutor[hidden] { display: none; }
.tutor__head {
  background: var(--logo-dark); color: #fff; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.tutor__disc {
  width: 32px; height: 32px; border-radius: 50%; background: var(--logo-red);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex: none;
}
.tutor__name { font-size: 15px; font-weight: 700; }
.tutor__sub { font-size: 12.5px; color: #c9aaaa; }
.tutor__close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 18px; line-height: 1; padding: 4px; }
.tutor__body {
  background: var(--surface-2); padding: 18px; display: flex; flex-direction: column;
  gap: 12px; overflow-y: auto; flex: 1; min-height: 200px;
}
.bubble { max-width: 86%; padding: 12px 15px; font-size: 14.5px; line-height: 1.6; }
.bubble--me { align-self: flex-end; background: var(--wine); color: #fff; border-radius: 14px 14px 4px 14px; }
.bubble--bot { align-self: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; }
.bubble p { margin-bottom: 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble--typing { color: var(--muted); font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; font-weight: 600; color: var(--wine); background: var(--wine-soft);
  border: 0; padding: 8px 13px; border-radius: var(--r-pill);
}
.chip:hover { background: #ecd8d6; }
.tutor__composer { border-top: 1px solid var(--line); padding: 14px; display: flex; gap: 9px; }
.tutor__composer .input { padding: 11px 13px; font-size: 14.5px; }
.tutor__send {
  width: 42px; flex: none; background: var(--wine); color: #fff; border: 0;
  border-radius: var(--r-btn); font-size: 17px; font-weight: 700;
}
.tutor__send:hover { background: var(--wine-dk); }
.tutor__note { font-size: 12px; color: var(--faint); padding: 0 14px 12px; }

/* ---------- HTMX ---------- */
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .hide-on-load { opacity: .45; }

/* =======================================================================
   RESPONSIVO — o protótipo é desktop-only; o handoff define os colapsos.
   ======================================================================= */
@media (max-width: 1100px) {
  .courselayout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; order: -1; }
  .toc__body { max-height: 420px; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login__brandcol { padding: 40px 28px; gap: 28px; }
  .login__h1 { font-size: 36px; }
  .login__formcol { padding: 36px 24px 56px; }
  .hero__in { grid-template-columns: 1fr; gap: 30px; padding: 40px 28px 36px; }
  .hero__h1 { font-size: 34px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .utable__head { display: none; }
  .utable__row { grid-template-columns: 1fr auto; gap: 10px; padding: 16px; }
  .utable__row > .urole, .utable__row > .ustatus { justify-self: start; }
  .uprog { grid-column: 1 / -1; }
  .ulast { grid-column: 1 / -1; }
  .cert { padding: 34px 24px; }
  .cert__name { font-size: 28px; }
  .cert__course { font-size: 20px; }
  .cert__signs { gap: 32px; }
}

@media (max-width: 640px) {
  .container, .page, .rails { padding-left: 18px; padding-right: 18px; }
  .page__h1 { font-size: 28px; }
  .coursebar h1 { font-size: 24px; }
  .appnav { display: none; }
  .appnav--mobile { display: flex; overflow-x: auto; padding: 8px 18px; gap: 4px; border-top: 1px solid var(--line); }
  .lesson__head, .lesson__body, .quiz, .materials, .ask { padding-left: 18px; padding-right: 18px; }
  .reader { padding: 24px 18px; }
  .stats { grid-template-columns: 1fr; }
  .q__opts, .q__feedback { margin-left: 0; }
  .tutor {
    right: 0; left: 0; bottom: 0; top: 0; width: auto;
    max-height: none; border-radius: 0; border: 0;
  }
  .tutorfab { right: 14px; bottom: 14px; }
}

@media print {
  .appheader, .tutorfab, .tutor, .certpage__head, .skip-link { display: none !important; }
  body { background: #fff; }
  .certframe { border: 0; padding: 0; }
}
