/* ============ Portal do Aluno — visual premium ============ */
:root {
  --wine-900: #3a0d1f;
  --wine-800: #5b1530;
  --wine-700: #7a1d40;
  --wine-600: #9b2850;
  --rose-200: #f6d7e0;
  --rose-100: #fbecf0;
  --gold: #c9a35c;
  --gold-soft: #f3e7cf;
  --bg: #faf6f1;
  --card: #ffffff;
  --ink: #241a1f;
  --muted: #7a6d73;
  --line: #ece4dd;
  --ok: #1f8a5b;
  --ok-bg: #e3f4eb;
  --warn: #b7791f;
  --warn-bg: #fdf1dc;
  --bad: #c0392b;
  --bad-bg: #fbe5e2;
  --info-bg: #eef2fb;
  --info: #3557a8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(58, 13, 31, .04), 0 8px 24px rgba(58, 13, 31, .06);
  --shadow-lg: 0 20px 60px rgba(58, 13, 31, .18);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--wine-700); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
small, .muted { color: var(--muted); }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ---------------- botões ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  background: var(--wine-800); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--wine-700); }
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(135deg, #d8b673, #b88d3e); color: #2b1a05; }
.btn.ghost { background: transparent; color: var(--wine-800); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--rose-100); }
.btn.light { background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(6px); }
.btn.light:hover { background: rgba(255,255,255,.26); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  border: 0; background: transparent; width: 38px; height: 38px; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--rose-100); color: var(--wine-800); }

/* ---------------- formulários ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: var(--radius-sm);
  padding: 11px 14px; font: inherit; color: var(--ink); outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus { border-color: var(--wine-600); box-shadow: 0 0 0 4px var(--rose-100); }
textarea.input { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row, .row3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--wine-700); }

/* ---------------- login ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px;
  background:
    radial-gradient(1200px 500px at 110% -10%, rgba(201,163,92,.35), transparent 60%),
    radial-gradient(800px 400px at -20% 120%, rgba(232,160,180,.25), transparent 60%),
    linear-gradient(160deg, var(--wine-700), var(--wine-900));
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero h1 { font-size: 46px; max-width: 520px; margin-top: 18px; }
.login-hero p { opacity: .85; max-width: 440px; margin-top: 14px; font-size: 16px; }
.login-hero .perks { display: grid; gap: 12px; margin-top: 36px; }
.login-hero .perk { display: flex; align-items: center; gap: 12px; opacity: .92; }
.login-hero .perk span:first-child {
  width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.12);
  display: grid; place-items: center; font-size: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #d8b673, #b88d3e); color: var(--wine-900); font-size: 20px;
}
.brand small { display: block; font-weight: 500; opacity: .75; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 32px 22px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 30px; margin-bottom: 6px; }
.login-card .muted { margin-bottom: 26px; }
.tabs { display: flex; background: #f1ebe5; border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 999px; font-weight: 600;
  color: var(--muted); cursor: pointer; font-size: 14px;
}
.tabs button.active { background: #fff; color: var(--wine-800); box-shadow: var(--shadow); }
.demo-box {
  margin-top: 22px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--gold-soft);
  font-size: 13px; color: #6b5427;
}
.demo-box code { background: rgba(255,255,255,.6); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 880px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px 40px; min-height: auto; }
  .login-hero h1 { font-size: 32px; }
  .login-hero .perks { display: none; }
}

/* ---------------- layout com menu ---------------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--wine-800), var(--wine-900)); color: #fff;
}
.sidebar .brand { padding: 4px 8px 26px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: rgba(255,255,255,.75); font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.nav a .ico { width: 22px; text-align: center; font-size: 17px; }
.nav a .count {
  margin-left: auto; background: var(--gold); color: var(--wine-900); font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
}
.sidebar .me {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px;
  background: rgba(255,255,255,.07); border-radius: 14px;
}
.sidebar .me .who { flex: 1; min-width: 0; }
.sidebar .me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me .who small { color: rgba(255,255,255,.6); font-size: 12px; }
.sidebar .me .icon-btn { color: rgba(255,255,255,.7); }
.sidebar .me .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #d8b673, #b88d3e); color: var(--wine-900); font-weight: 700; font-size: 15px;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.main { padding: 30px 36px 60px; max-width: 1180px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.topbar h1 { font-size: 30px; }
.topbar p { color: var(--muted); margin-top: 4px; }

/* barra inferior no celular */
.mobile-head, .bottom-nav { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px 16px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); }
  .topbar h1 { font-size: 24px; }
  .mobile-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(250,246,241,.88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
  }
  .mobile-head .brand-mark { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255,255,255,.95); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto;
  }
  .bottom-nav a {
    flex: 1; min-width: 62px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 12px;
  }
  .bottom-nav a .ico { font-size: 20px; }
  .bottom-nav a.active { color: var(--wine-800); background: var(--rose-100); }
}

/* ---------------- cards ---------------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
  border: 1px solid rgba(236,228,221,.7);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.section-title { font-family: var(--serif); font-size: 21px; margin: 30px 0 14px; }

/* destaque da próxima aula */
.hero-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 28px;
  background:
    radial-gradient(600px 260px at 100% 0%, rgba(201,163,92,.45), transparent 60%),
    linear-gradient(135deg, var(--wine-700), var(--wine-900));
  box-shadow: var(--shadow-lg);
}
.hero-card .eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 700; color: var(--gold); }
.hero-card h2 { font-size: 30px; margin: 8px 0 6px; }
.hero-card p { opacity: .85; }
.hero-card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-card::after {
  content: '♥'; position: absolute; right: -10px; bottom: -60px; font-size: 220px; opacity: .06; line-height: 1;
}

/* status */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.open { background: var(--info-bg); color: var(--info); }
.badge.due { background: var(--warn-bg); color: var(--warn); }
.badge.overdue { background: var(--bad-bg); color: var(--bad); }
.badge.premium { background: var(--gold-soft); color: #8a6a26; }
.badge.premium::before { content: '★'; width: auto; height: auto; background: none; font-size: 11px; }
.badge.plain::before { display: none; }
.badge.plain { background: #f3eeea; color: var(--muted); }

.pay-card .amount { font-family: var(--serif); font-size: 34px; font-weight: 700; margin: 6px 0 2px; }
.pay-card.overdue { box-shadow: inset 0 0 0 2px var(--bad-bg), var(--shadow); }
.pay-card.due { box-shadow: inset 0 0 0 2px var(--warn-bg), var(--shadow); }
.pix-box {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: #faf6f1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px;
}
.pix-box code { font-weight: 700; word-break: break-all; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-family: var(--serif); font-size: 32px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .ico {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
  background: var(--rose-100); margin-bottom: 8px;
}

/* listas */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; }
.list-item .thumb {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 20px; background: var(--rose-100);
}
.list-item .thumb.gold { background: var(--gold-soft); }

/* avisos */
.announce { padding: 16px 18px; border-radius: 16px; background: #fff; border-left: 4px solid var(--info); box-shadow: var(--shadow); }
.announce + .announce { margin-top: 12px; }
.announce.important { border-left-color: var(--bad); }
.announce.premium { border-left-color: var(--gold); background: linear-gradient(90deg, #fffaf0, #fff); }
.announce h4 { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.announce p { color: #4d4247; margin-top: 6px; white-space: pre-line; }
.announce small { display: block; margin-top: 8px; font-size: 12px; }

/* gravações */
.video-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .15s; }
.video-card:hover { transform: translateY(-3px); }
.video-card .cover {
  aspect-ratio: 16/9; display: grid; place-items: center; position: relative;
  background: linear-gradient(135deg, var(--wine-700), var(--wine-900)); color: #fff;
}
.video-card .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .8; }
.video-card .play {
  position: relative; width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.92);
  color: var(--wine-800); display: grid; place-items: center; font-size: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.video-card .body { padding: 16px 18px 18px; }
.video-card .body p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.player { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: 14px; background: #000; }

/* materiais */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.chip.active { background: var(--wine-800); border-color: var(--wine-800); color: #fff; }

/* atividades */
.activity-card { display: flex; flex-direction: column; gap: 10px; }
.activity-card .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.progress { height: 8px; background: #f1ebe5; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--wine-600), var(--gold)); border-radius: 999px; transition: width .4s; }

.quiz { max-width: 760px; }
.question { padding: 22px; margin-bottom: 16px; }
.question .qnum { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--wine-600); }
.question .prompt { font-size: 17px; font-weight: 600; margin: 6px 0 16px; }
.option {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer; margin-bottom: 10px; transition: all .15s; background: #fff;
}
.option:hover { border-color: var(--wine-600); background: var(--rose-100); }
.option input { display: none; }
.option .letter {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: #f3eeea; font-weight: 700; font-size: 13px; color: var(--muted);
}
.option.selected { border-color: var(--wine-700); background: var(--rose-100); }
.option.selected .letter { background: var(--wine-700); color: #fff; }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.correct .letter { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.wrong .letter { background: var(--bad); color: #fff; }
.result-hero { text-align: center; padding: 34px 22px; }
.result-hero .score { font-family: var(--serif); font-size: 64px; font-weight: 700; color: var(--wine-800); line-height: 1; }
.feedback { font-size: 13px; margin-top: 8px; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

/* tabelas (admin) */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fdfaf7; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input { max-width: 260px; }

/* builder de perguntas */
.q-builder { border: 1.5px dashed var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; background: #fdfbf9; }
.q-builder .q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-row input[type=radio] { width: 18px; height: 18px; accent-color: var(--ok); flex-shrink: 0; }

/* seletor de público */
.audience { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; max-height: 220px; overflow: auto; background: #fff; }
.audience .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 10px 0 6px; }
.audience .check { padding: 4px 0; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(36, 10, 22, .45); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 18px; animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 22px; width: 100%; max-width: 640px; max-height: calc(100vh - 36px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .2s ease;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.modal-head h3 { font-family: var(--serif); font-size: 22px; }
.modal-body { padding: 8px 24px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* toast */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--wine-900); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: pop .2s ease;
}
@media (max-width: 900px) { #toast-root { bottom: calc(var(--nav-h) + 20px); } }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* banner de instalação */
.install-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; margin-bottom: 18px;
  background: var(--gold-soft); color: #5c4519;
}
.install-banner .grow { flex: 1; font-size: 14px; }
.lock { filter: grayscale(1); opacity: .55; }
