/* App de estudos — design system enxuto, sem dependencia externa. */

:root {
  --bg: #eef2f9;
  --card: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e3e8f2;
  --navy: #0e1a3a;
  --navy2: #16244d;
  --accent: #2b59d6;
  --accent2: #1d43ad;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --r: 14px;
  --sh: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------------- layout ---------------- */
.app { min-height: 100vh; }
.shell {
  display: flex; min-height: 100vh;
  /* a faixa da esquerda continua navy mesmo quando a pagina e mais alta que a dobra */
  background: linear-gradient(90deg, var(--navy) 0 232px, var(--bg) 232px);
}

.side {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, var(--navy), var(--navy2));
  color: #c9d4ee;
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(145deg, #3b6bf0, #1b3fa0);
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; color: #fff; letter-spacing: .5px;
  box-shadow: 0 4px 12px rgba(43, 89, 214, .45);
  flex: 0 0 auto;
}
.brand strong { display: block; color: #fff; font-size: 13.5px; }
.brand span { display: block; font-size: 11px; color: #8fa2cc; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: #b9c6e4; font-size: 13.5px; text-align: left; width: 100%;
}
.nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav button.ativo { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; }
.nav .ico { width: 18px; text-align: center; opacity: .85; }

.side-foot { margin-top: auto; font-size: 11.5px; color: #7c8db5; padding: 0 8px; display: grid; gap: 6px; }
.side-foot .quem { color: #c9d4ee; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; padding: 22px 26px 48px; }
.topo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topo .sub { color: var(--muted); font-size: 12.5px; }
.topo .espaco { flex: 1; }

/* ---------------- componentes ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh); padding: 16px;
}
.grade { display: grid; gap: 14px; }
.grade.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grade.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grade.k2, .grade.k4 { grid-template-columns: 1fr; } }

.metrica .rotulo { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.metrica .valor { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.metrica .dica { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  transition: background .15s ease;
}
.btn:hover { background: var(--accent2); }
.btn.sec { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.sec:hover { background: #f7f9fd; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: rgba(43, 89, 214, .08); }
.btn.perigo { background: #fff; color: var(--bad); border-color: #fbd5d5; }
.btn.perigo:hover { background: #fef2f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.bloco { width: 100%; }
.btn.grande { padding: 13px 18px; font-size: 15px; }

.campo { display: grid; gap: 6px; }
.campo label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.campo input, .campo select, .campo textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: 2px solid rgba(43, 89, 214, .25); border-color: var(--accent); outline-offset: 0;
}
.campo .erro { color: var(--bad); font-size: 12px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--muted);
}
.chip.ativo { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.barra { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.barra-caixa { width: 160px; flex: 0 0 auto; }

.lista { display: grid; gap: 0; }
.linha {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.linha:last-child { border-bottom: 0; }
.linha .t { flex: 1; min-width: 0; }
.linha .t small { color: var(--muted); display: block; font-size: 11.5px; }
.pill {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #eef2fb; color: var(--accent2); white-space: nowrap;
}
.pill.ok { background: #e8f8f0; color: #067647; }
.pill.warn { background: #fef4e6; color: #b54708; }
.pill.bad { background: #fdecec; color: #b42318; }

.vazio { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }

/* ---------------- login ---------------- */
.tela-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2b57 0%, var(--navy) 45%, #0a1229 100%);
}
.caixa-login { width: 100%; max-width: 380px; }
.caixa-login .marca { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; color: #fff; }
.caixa-login .marca .logo { width: 44px; height: 44px; font-size: 14px; }
.caixa-login .marca strong { font-size: 16px; display: block; }
.caixa-login .marca span { font-size: 12px; color: #9fb0d6; }
.caixa-login .card { padding: 22px; }
.caixa-login h1 { font-size: 18px; margin-bottom: 4px; }
.caixa-login .dica { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.caixa-login form { display: grid; gap: 12px; }
.caixa-login .troca { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ---------------- treino ---------------- */
.questao { display: grid; gap: 14px; }
.questao .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.questao .comando { font-size: 13px; color: var(--muted); font-style: italic; }
.questao .enunciado { font-size: 15.5px; line-height: 1.55; }
.questao .apoio {
  background: #f8fafd; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; max-height: 260px; overflow: auto; white-space: pre-wrap;
}
.questao .apoio h3 { margin-bottom: 6px; }

.resposta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resposta .btn { padding: 16px; font-size: 16px; }
.resposta .btn.c { background: #0f9d58; }
.resposta .btn.e { background: #d93025; }
.resposta .btn.c:hover { background: #0b8043; }
.resposta .btn.e:hover { background: #b3261e; }

.veredito { padding: 12px 14px; border-radius: 10px; font-size: 13.5px; display: grid; gap: 4px; }
.veredito.ok { background: #e8f8f0; border: 1px solid #b7e4cd; color: #05603a; }
.veredito.bad { background: #fdecec; border: 1px solid #f5c2c0; color: #912018; }
.veredito.neutro { background: #f4f6fb; border: 1px solid var(--line); color: var(--muted); }

.notas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.notas button {
  padding: 11px 6px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-weight: 600; font-size: 12.5px; display: grid; gap: 2px;
}
.notas button small { font-weight: 400; color: var(--muted); font-size: 10.5px; }
.notas button:hover { border-color: var(--accent); }
.notas button.n1 { color: #b42318; }
.notas button.n2 { color: #b54708; }
.notas button.n3 { color: #067647; }
.notas button.n4 { color: #175cd3; }

/* ---------------- simulados ---------------- */
.navegador { display: flex; gap: 6px; flex-wrap: wrap; }
.navegador button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 12px; color: var(--muted);
}
.navegador button.atual { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.navegador button.respondido { background: #eef2fb; color: var(--accent2); }

.agulha { display: grid; gap: 10px; }
.agulha .agulha-barra { display: flex; gap: 3px; height: 26px; align-items: flex-end; }
.agulha .agulha-barra i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .8; }

table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tabela th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.tabela td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
table.tabela tr:last-child td { border-bottom: 0; }
table.tabela td.num, table.tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- avisos ---------------- */
.aviso {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #101828; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 10px 24px rgba(16, 24, 40, .25); z-index: 50; max-width: 90vw;
}
.carregando { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.carregando .logo { width: 44px; height: 44px; font-size: 14px; }

.selo-sync { font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.selo-sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.selo-sync .dot.off { background: var(--warn); }
.selo-sync .dot.err { background: var(--bad); }

@media (max-width: 860px) {
  .shell { flex-direction: column; background: var(--bg); }
  .side {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: column; gap: 12px; padding: 12px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; padding-bottom: 2px; }
  .nav button { width: auto; white-space: nowrap; padding: 8px 11px; }
  .linha { flex-wrap: wrap; }
  .barra-caixa { width: 100%; order: 3; }
  .side-foot { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
  .main { padding: 16px 14px 40px; }
  .resposta { grid-template-columns: 1fr; }
  .notas { grid-template-columns: repeat(2, 1fr); }
}
