:root {
  --terracota: #C0704E;
  --terracota-escura: #A25A3C;
  --salvia: #7C8B6F;
  --salvia-clara: #DCE3D4;
  --dourado: #C9A66B;
  --creme: #FAF5EF;
  --creme-alt: #F1E8DC;
  --texto: #3C332B;
  --texto-suave: #6B5F53;
  --linha: rgba(60, 51, 43, 0.12);
  --branco: #FFFFFF;
  --erro: #B4412F;
  --ok: #4F6B45;
  --radius: 18px;
  --sombra: 0 10px 30px rgba(60, 51, 43, 0.08);
  --sombra-forte: 0 16px 40px rgba(60, 51, 43, 0.14);
  --titulo: 'Fraunces', Georgia, serif;
  --corpo: 'Jost', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--creme); }
body { font-family: var(--corpo); color: var(--texto); line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--terracota-escura); }
h1, h2, h3 { font-family: var(--titulo); font-weight: 600; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* topo */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: rgba(250, 245, 239, 0.94); border-bottom: 1px solid var(--linha); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto); }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dourado); }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-family: var(--titulo); font-size: 1.05rem; }
.brand small { font-size: 0.75rem; color: var(--texto-suave); letter-spacing: 0.06em; text-transform: uppercase; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 0.95rem; }
.topnav a { text-decoration: none; color: var(--texto-suave); font-weight: 500; }
.topnav a.active { color: var(--terracota-escura); }
.link-btn { background: none; border: 0; cursor: pointer; color: var(--texto-suave); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

main { width: 100%; max-width: 1140px; margin: 0 auto; padding: 32px 24px 80px; }
.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--creme-alt); border-top-color: var(--terracota); animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow { display: inline-block; font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--terracota-escura); font-weight: 600; margin-bottom: 8px; }
.page-title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 6px; }
.lead { color: var(--texto-suave); max-width: 640px; }
.section { margin-top: 40px; }
.section h2 { font-size: 1.35rem; margin-bottom: 16px; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 26px; border-radius: 100px; font-weight: 500; font-size: 0.97rem; border: 2px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--terracota); color: var(--branco); box-shadow: var(--sombra); }
.btn-primary:hover:not(:disabled) { background: var(--terracota-escura); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--texto); border-color: rgba(60, 51, 43, 0.25); }
.btn-secondary:hover:not(:disabled) { border-color: var(--texto); }
.btn-whats { background: #25A35A; color: #fff; }
.btn-whats:hover { background: #1E8A4B; }
.btn-sm { padding: 8px 16px; font-size: 0.88rem; }
.btn-danger { min-width: 112px; background: transparent; color: var(--erro); border-color: rgba(180, 65, 47, .35); }
.btn-block { width: 100%; }

/* login */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--branco); border-radius: 24px; padding: 36px 30px; box-shadow: var(--sombra-forte); }
.auth-card .avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 14px; border: 3px solid var(--dourado); }
.auth-card h1 { text-align: center; font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--texto-suave); margin-bottom: 24px; font-size: 0.97rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.88rem; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--linha); background: var(--creme); font-size: 1rem; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--terracota); background: var(--branco); }
.field .hint { font-size: 0.8rem; color: var(--texto-suave); }
.pw { position: relative; }
.pw button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--texto-suave); font-size: 0.82rem; cursor: pointer; }
.auth-links { margin-top: 18px; text-align: center; font-size: 0.93rem; color: var(--texto-suave); display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 12px 14px; border-radius: 12px; font-size: 0.92rem; margin-bottom: 16px; }
.msg.err { background: #F7E2DD; color: var(--erro); }
.msg.ok { background: var(--salvia-clara); color: var(--ok); }

/* vitrine */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card { background: var(--branco); border-radius: var(--radius); overflow: hidden; box-shadow: var(--sombra); display: flex; flex-direction: column; text-decoration: none; color: var(--texto); transition: transform .18s ease, box-shadow .18s ease; position: relative; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--sombra-forte); }
.cover { aspect-ratio: 16 / 10; position: relative; display: grid; place-items: center; padding: 18px; text-align: center; color: #fff; overflow: hidden; }
.cover h3 { font-size: 1.3rem; text-shadow: 0 1px 12px rgba(0,0,0,.18); position: relative; }
.cover img.logo { position: absolute; left: 12%; top: 10%; width: 76%; height: 80%; object-fit: contain; z-index: 1; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 10%, rgba(255,255,255,.18), transparent 55%); }
.c0 { background: linear-gradient(135deg, #1B2A45, #0E1626); }
.c1 { background: linear-gradient(135deg, #C0704E, #A25A3C); }
.c2 { background: linear-gradient(135deg, #7C8B6F, #5E6C53); }
.c3 { background: linear-gradient(135deg, #C9A66B, #A88648); }
.c4 { background: linear-gradient(135deg, #8E5A4A, #6A3F33); }
.c5 { background: linear-gradient(135deg, #5E7A78, #3F5958); }
.locked .cover { filter: saturate(.55) brightness(.9); }
.lock-badge { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(255,255,255,.92); color: var(--texto); font-size: 0.75rem; font-weight: 600; padding: 5px 10px; border-radius: 100px; display: inline-flex; align-items: center; gap: 5px; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body h3 { font-size: 1.12rem; }
.card-body p { color: var(--texto-suave); font-size: 0.92rem; }
.card-meta { font-size: 0.82rem; color: var(--texto-suave); }
.card-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.progress { height: 7px; border-radius: 10px; background: var(--creme-alt); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--salvia); border-radius: 10px; transition: width .4s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--texto-suave); }
.empty { background: var(--branco); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--texto-suave); box-shadow: var(--sombra); }
.pending-box { background: var(--creme-alt); border: 1.5px dashed rgba(162, 90, 60, .35); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }

/* curso */
.back { display: inline-flex; gap: 6px; align-items: center; font-size: 0.92rem; text-decoration: none; color: var(--texto-suave); margin-bottom: 18px; }
.course-hero { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: center; }
.course-hero .cover { border-radius: var(--radius); box-shadow: var(--sombra); }
.lessons { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.lesson { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--branco); border-radius: 14px; text-decoration: none; color: var(--texto); box-shadow: 0 2px 10px rgba(60,51,43,.05); border: 1.5px solid transparent; transition: border-color .15s ease; }
.lesson:hover { border-color: rgba(192, 112, 78, .35); }
.lesson.current { border-color: var(--terracota); }
.lesson .num { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--creme-alt); font-weight: 600; font-size: 0.9rem; }
.lesson.done .num { background: var(--salvia); color: #fff; }
.lesson .info { flex: 1; min-width: 0; }
.lesson .info strong { display: block; font-weight: 500; }
.lesson .info small { color: var(--texto-suave); font-size: 0.82rem; }

/* aula */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--sombra-forte); }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .overlay-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 20px; background: rgba(0,0,0,.6); }
.wm { position: absolute; pointer-events: none; color: rgba(255,255,255,.22); font-size: 0.78rem; font-weight: 500; transition: top 2s ease, left 2s ease; user-select: none; z-index: 2; }
.player-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.speeds { display: inline-flex; background: var(--branco); border-radius: 100px; padding: 4px; box-shadow: 0 2px 8px rgba(60,51,43,.06); }
.speeds button { border: 0; background: none; padding: 6px 12px; border-radius: 100px; cursor: pointer; font-size: 0.86rem; color: var(--texto-suave); }
.speeds button.on { background: var(--texto); color: #fff; }
.watch h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 20px 0 8px; }
.watch .desc { color: var(--texto-suave); white-space: pre-line; }
.materials { margin-top: 24px; }
.materials h3 { font-size: 1.08rem; margin-bottom: 10px; }
.mat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--branco); border-radius: 12px; margin-bottom: 8px; box-shadow: 0 2px 8px rgba(60,51,43,.05); }
.side { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; padding-right: 4px; }
.side h3 { font-size: 1.05rem; margin-bottom: 10px; }
.nav-lessons { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* admin */
.tabs { display: flex; gap: 8px; margin: 22px 0; border-bottom: 1px solid var(--linha); }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 500; color: var(--texto-suave); border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--terracota-escura); border-bottom-color: var(--terracota); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 10px 14px; border-radius: 100px; border: 1.5px solid var(--linha); background: var(--branco); min-width: 220px; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 0.78rem; padding: 4px 10px; border-radius: 100px; background: var(--salvia-clara); color: var(--ok); white-space: nowrap; }
.chip.exp { background: #F7E2DD; color: var(--erro); }
.chip.new { background: #FBEBD3; color: #8A5A16; }
.table { width: 100%; border-collapse: collapse; background: var(--branco); border-radius: var(--radius); overflow: hidden; box-shadow: var(--sombra); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--linha); vertical-align: top; font-size: 0.93rem; }
.table th { background: var(--creme-alt); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-suave); }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #FDFAF6; }
.panel { background: var(--branco); border-radius: var(--radius); padding: 24px; box-shadow: var(--sombra); margin-bottom: 20px; }
.panel h3 { font-size: 1.15rem; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row .field { flex: 1; min-width: 180px; margin-bottom: 0; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--linha); }
.list-row:last-child { border-bottom: 0; }
.list-row > .row { flex-wrap: nowrap; }
@media (max-width: 640px) { .list-row > .row { flex-wrap: wrap; } }
.muted { color: var(--texto-suave); font-size: 0.88rem; }
.picker { max-height: 280px; overflow: auto; border: 1.5px solid var(--linha); border-radius: 12px; margin-top: 10px; }
.picker button { display: flex; width: 100%; justify-content: space-between; gap: 10px; text-align: left; background: var(--branco); border: 0; border-bottom: 1px solid var(--linha); padding: 10px 14px; cursor: pointer; font-size: 0.9rem; }
.picker button:hover { background: var(--creme); }
.picker button:disabled { opacity: .45; cursor: default; }
.modal-bg { position: fixed; inset: 0; background: rgba(40, 32, 26, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--creme); border-radius: 22px; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; padding: 26px; box-shadow: var(--sombra-forte); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.modal-head h3 { font-size: 1.3rem; }
.x { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--texto-suave); }
.badge-count { background: var(--terracota); color: #fff; border-radius: 100px; font-size: 0.72rem; padding: 2px 8px; margin-left: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: var(--texto); color: #fff; padding: 12px 20px; border-radius: 100px; font-size: 0.92rem; z-index: 200; transition: transform .25s ease, opacity .25s ease; opacity: 0; visibility: hidden; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.err { background: var(--erro); }

@media (max-width: 900px) {
  .watch { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .course-hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 22px 16px 64px; }
  .topbar { padding: 10px 16px; }
  .brand small { display: none; }
  .topnav { gap: 12px; font-size: 0.88rem; }
  .auth-card { padding: 28px 20px; }
  .player { border-radius: 12px; margin: 0 -16px; border-radius: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--linha); padding: 8px 0; }
  .table td { border: 0; padding: 4px 14px; }
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
}
