:root {
  --bg: #0b1220;
  --sidebar: #0e1728;
  --card: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --line: #e2e8f0;
  --green: #1d6bff;
  --green-dark: #1554cc;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  background: #eef1f6;
  color: var(--text);
}

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0b1220 0%, #132033 100%);
  color: #d7deea;
  padding: 22px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: #020617; color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.brand-mark img { width: 26px; height: 26px; object-fit: contain; display: block; }
.brand h1 { font-size: 16px; margin: 0; color: #fff; }
.brand p { margin: 2px 0 0; font-size: 11px; color: #93a0b8; }

.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #c5d0e0; text-decoration: none;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; margin-bottom: 4px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(201, 162, 39, .18); color: #fff; font-weight: 600; }
.sidebar-out { margin-top: auto; padding: 16px 10px 4px; }

.main { flex: 1; padding: 28px 32px 48px; max-width: 1200px; }
.page-title { margin: 0 0 6px; font-size: 26px; }
.page-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.2fr .8fr; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .app { display: block; }
  .sidebar { width: auto; }
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid #e6eaf0;
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.setup-list { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.7; }
.setup-list a { font-weight: 700; margin-left: 6px; }
.more { margin-top: 14px; color: var(--muted); font-size: 13px; }
.more summary { cursor: pointer; font-weight: 700; color: var(--text); }
.more-card { margin-bottom: 16px; }
.more-card summary { cursor: pointer; font-weight: 800; font-size: 16px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.day-head h2 { margin: 0; }
.day-today { border-color: #1d6bff; }
.dias-count { font-size: 20px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }

.btn {
  border: 0; border-radius: 10px; padding: 10px 14px;
  font-weight: 700; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn-green { background: var(--green); color: #fff; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-ghost { background: #f1f5f9; color: #0f172a; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-warn { background: #fef3c7; color: #92400e; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table-actions .btn { padding: 6px 10px; font-size: 12px; }
.table-actions form { margin: 0; }

label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
input[type=text], input[type=number], input[type=datetime-local], input[type=time], input[type=color],
input[type=password], input[type=search], input[type=email], input[type=tel], input[type=date],
select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); font: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s ease;
}
.switch input::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .15s ease;
}
.switch input:checked { background: #1d6bff; }
.switch input:checked::after { transform: translateX(18px); }
.switch-box { margin: 14px 0 8px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.banner-trial, .banner-ended {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}
.banner-trial { background: #e8f0fe; color: #1e3a5f; }
.banner-ended { background: #fef3c7; color: #92400e; }
.banner-ended a { color: #92400e; font-weight: 800; }
.flashes li {
  background: #f8f1d8; color: #5c4a12; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 8px; font-size: 14px;
}

.qr-box {
  min-height: 240px; display: grid; place-items: center;
  background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1;
}
.qr-box img { max-width: 240px; border-radius: 8px; }
.status-ok { color: #15803d; font-weight: 800; }
.status-wait { color: #b45309; font-weight: 800; }
.status-off { color: var(--muted); font-weight: 800; }
.status-err { color: var(--danger); font-weight: 800; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.toolbar .field { min-width: 180px; flex: 1; }
.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.card-lock { border: 1px dashed #f0c48a; background: #fffbeb; }
.menu-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.mode-row {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 12px 0;
}
.mode-row .switch { margin: 0; }
.pick { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pick-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.pick-bar input[type=search] { flex: 1; min-width: 160px; margin: 0; }
.pick-list { max-height: 280px; overflow: auto; }
.pick-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 14px;
}
.pick-item:hover { background: #f8f4e6; }
.pick-item input { margin-top: 4px; width: auto; }
.pick-item .badge { margin-left: 6px; }
.onda {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 12px 0; background: #f8fafc;
}
.onda h3 { margin: 0 0 10px; font-size: 14px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0b1220 0%, #1a2740 100%);
}
.login-card {
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-card-wide { width: min(520px, calc(100% - 32px)); }
.login-card-passo { width: min(760px, calc(100% - 32px)); }
.login-card-apostila { width: min(820px, calc(100% - 32px)); }
.login-body.apostila-body { display: block; padding: 24px 0 40px; }
.login-body.apostila-body .login-card-apostila { margin: 0 auto; }
.apostila-materias { display: grid; gap: 10px; margin-top: 16px; }
.apostila-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
}
.apostila-card:hover { border-color: #16a34a; background: #f0fdf4; }
.apostila-card h2 { margin: 0 0 6px; font-size: 18px; }
.apostila-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}
.apostila-toc a {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  text-decoration: none;
}
.apostila-cap {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 16px;
}
.apostila-cap h2 { margin: 0 0 8px; font-size: 20px; }
.apostila-cap h3 { margin: 14px 0 6px; font-size: 15px; }
.apostila-cai { margin: 0 0 10px; }
.apostila-caixa {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 12px;
}
.apostila-caixa h3 { margin: 0 0 6px; font-size: 14px; }
.apostila-caixa ul { margin: 0; padding-left: 18px; }
.apostila-caixa-erro { background: #fff7ed; }
.apostila-itens { margin: 0 0 12px; padding-left: 18px; }
.apostila-itens li { margin: 4px 0; }
.apostila-exemplo {
  background: #ecfdf5;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0 14px;
}
.apostila-exemplo h3 { margin: 0 0 6px; font-size: 14px; }
.apostila-exemplo p { margin: 0; white-space: pre-wrap; }
.apostila-itens { margin: 0 0 12px; padding-left: 18px; }
.apostila-itens li { margin: 4px 0; }
.apostila-exemplo {
  background: #ecfdf5;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0 14px;
}
.apostila-exemplo h3 { margin: 0 0 6px; font-size: 14px; }
.apostila-exemplo p { margin: 0; white-space: pre-wrap; }
.passo-alunos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.passo-trilha { display: grid; gap: 10px; margin-top: 12px; }
.passo-estagio {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.passo-estagio.on { border-color: #16a34a; background: #f0fdf4; }
.passo-estagio h3 { margin: 0 0 4px; font-size: 16px; }
.passo-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: #64748b; letter-spacing: .04em; text-transform: uppercase; }
.passo-body { align-items: start; padding: 24px 0; }
.passo-folha { padding: 22px 22px 18px; }
.passo-top h1 { margin: 0; }
.passo-top-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.passo-lista { margin: 16px 0 0; padding: 0 0 0 22px; }
.passo-item { margin: 0 0 16px; }
.passo-item.certa { border-left: 3px solid #16a34a; padding-left: 10px; }
.passo-item.errada { border-left: 3px solid #dc2626; padding-left: 10px; }
.passo-item.em_branco { border-left: 3px solid #d97706; padding-left: 10px; }
.passo-enunciado { margin: 0 0 8px; white-space: pre-wrap; font-weight: 600; }
.passo-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.passo-exemplos {
  margin: 16px 0 8px;
  padding: 14px;
  border-radius: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.passo-exemplos h2 { margin: 0 0 12px; font-size: 16px; }
.passo-exemplo {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 10px;
}
.passo-passos { margin: 8px 0; padding-left: 20px; color: #334155; }
.passo-passos li { margin: 4px 0; }
.passo-ex-resp { margin: 8px 0 0; }
.passo-pad {
  margin: 8px 0;
  background: #fffef8;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
}
.passo-canvas {
  display: block;
  width: 100%;
  height: 200px;
  touch-action: none;
  cursor: crosshair;
}
.passo-pad-acoes { display: flex; gap: 8px; padding: 6px 8px 8px; }
.passo-li-label { display: block; font-size: 12px; color: #64748b; margin: 4px 0; }
.passo-lido { margin: 0; }
.passo-item.lendo .passo-pad { border-color: #1d6bff; }
.passo-body { padding-bottom: 40px; }
@media (max-width: 720px) {
  .login-card-passo { width: calc(100% - 16px); border-radius: 12px; padding: 16px 12px; }
  .passo-body { padding: 8px 0 28px; align-items: stretch; }
  .passo-canvas { height: 160px; }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
@media (max-width: 560px) {
  .login-grid { grid-template-columns: 1fr; }
}
.login-card .brand h1 { color: #0b1220; }
.login-card .brand p { color: #64748b; }
.login-note { color: #64748b; font-size: 13px; margin: 14px 0 0; }
.login-switch { margin: 16px 0 0; font-size: 14px; }
.login-switch a { color: #1d6bff; font-weight: 700; }
.otp-input {
  letter-spacing: .35em;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}
.hour-chart { margin-top: 8px; }
.hour-row {
  display: flex; align-items: center; gap: 8px;
  margin: 3px 0; font-size: 12px;
}
.hour-lab { width: 36px; color: var(--muted); flex-shrink: 0; }
.hour-n { width: 72px; text-align: right; color: var(--muted); flex-shrink: 0; }
.hour-bar {
  flex: 1; height: 10px; background: #eef2f7;
  border-radius: 99px; overflow: hidden; display: flex;
}
.hour-bar .seg { display: block; height: 100%; }
.hour-bar .seg.e { background: #1d6bff; }
.hour-bar .seg.r { background: #94a3b8; }
.hour-bar .seg.x { background: #dc2626; }
.event-log { max-height: 420px; overflow: auto; font-size: 13px; }
.event-line {
  display: grid;
  grid-template-columns: 44px 88px 110px 1fr 110px;
  gap: 8px; padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}
@media (max-width: 720px) {
  .event-line { grid-template-columns: 1fr 1fr; }
}

.mkt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 980px) {
  .mkt-grid { grid-template-columns: 1fr; }
}
.mkt-card { padding: 0; overflow: hidden; }
.mkt-thumb {
  background: #0b1220;
  display: grid;
  place-items: center;
}
.mkt-thumb.feed { aspect-ratio: 3 / 4; }
.mkt-thumb.story { aspect-ratio: 9 / 16; max-height: 420px; }
.mkt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.mkt-meta { padding: 14px 16px 16px; }
.mkt-meta h3 { margin: 6px 0 10px; font-size: 16px; }
.mkt-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #1d6bff;
}
.mkt-meta textarea {
  width: 100%;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  margin-bottom: 10px;
}

.simulado-ano {
  margin: 18px 0 0;
  font-size: 15px;
  color: var(--muted);
}
.simulado-ano:first-child { margin-top: 8px; }
.simulado-prova h1 { font-size: 22px; margin: 0 0 12px; }
.simulado-folha {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  max-height: 70vh;
  margin: 12px 0;
}
.simulado-folha img,
.simulado-item img {
  width: 100%;
  display: block;
}
.simulado-letras {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.simulado-letra {
  min-width: 52px;
  font-weight: 800;
}
.simulado-gabarito { padding-left: 18px; }
.simulado-item { margin: 18px 0; }
.simulado-item.certa { border-left: 3px solid #16a34a; padding-left: 10px; }
.simulado-item.errada { border-left: 3px solid #dc2626; padding-left: 10px; }
.simulado-item.em_branco { border-left: 3px solid #d97706; padding-left: 10px; }

.simulado-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #0b1220;
}
.simulado-shell {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.simulado-top {
  flex-shrink: 0;
  padding: 12px 16px 8px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.simulado-top .muted { margin: 0; font-size: 13px; }
.simulado-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.simulado-top h1 { font-size: 20px; margin: 0; }
.simulado-zoom { display: flex; gap: 6px; flex-shrink: 0; }
.simulado-zoom .btn { min-width: 44px; justify-content: center; padding: 8px 10px; }
.simulado-shell .simulado-folha {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  background: #f8fafc;
}
.simulado-shell .simulado-folha img {
  width: 100%;
  height: auto;
  max-width: none;
  vertical-align: top;
}
@media (max-width: 720px) {
  .simulado-shell .simulado-folha img {
    width: 280%;
  }
}
.simulado-acoes {
  flex-shrink: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: #fff;
}
.simulado-dica { margin: 0 0 8px; font-size: 13px; }
.simulado-acoes .simulado-letras {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0;
}
.simulado-acoes .simulado-letra {
  min-width: 0;
  width: 100%;
  justify-content: center;
  min-height: 48px;
  font-size: 18px;
}
.simulado-sair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.login-body.simulado-review {
  display: block;
  padding: 16px 0 32px;
}
.login-body.simulado-review .simulado-prova {
  width: min(960px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 16px 28px;
}
@media (max-width: 720px) {
  .simulado-shell { max-width: none; }
  .simulado-top { padding-top: max(10px, env(safe-area-inset-top)); }
  .simulado-top h1 { font-size: 18px; }
  .login-body.simulado-review { padding: 0; }
  .login-body.simulado-review .simulado-prova {
    width: 100%;
    border-radius: 0;
    min-height: 100vh;
  }
}
