:root {
  --laranja: #F28C28;
  --laranja-escuro: #d9741a;
  --azul: #1e88e5;
  --texto: #2b2f36;
  --suave: #8a9099;
  --linha: #ececf0;
  --fundo: #ffffff;
  --fundo-2: #f6f7f9;
  --verde: #2e9e55;
  --vermelho: #d64545;
  --roxo: #7b5cd6;
  --abas-h: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(var(--abas-h) + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.topo { position: sticky; top: 0; z-index: 5; background: var(--fundo); display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--linha); }
.topo h1 { flex: 1; font-size: 17px; font-weight: 600; margin: 0; text-align: center; }
.topo .lado { width: 40px; display: flex; justify-content: center; }
.icone-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--texto); }
.icone-btn:active { background: var(--fundo-2); }
.icone-btn svg { width: 22px; height: 22px; fill: currentColor; }

.abas { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--fundo); border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom); max-width: 640px; margin: 0 auto; }
.abas a { flex: 1; height: var(--abas-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--suave); }
.abas a svg { width: 24px; height: 24px; fill: currentColor; }
.abas a.ativa { color: var(--laranja); }

/* semana */
.semana { padding: 8px 4px 4px; border-bottom: 1px solid var(--linha); }
.semana .dias { display: grid; grid-template-columns: 28px repeat(7, 1fr) 28px; align-items: center; text-align: center; }
.semana .dow { font-size: 11px; color: var(--suave); text-transform: uppercase; }
.semana .seta { background: none; border: 0; color: var(--laranja); font-size: 22px; cursor: pointer; padding: 0; }
.semana .dia { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; padding: 4px 0; }
.semana .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.semana .dia.hoje .num { color: var(--laranja); font-weight: 700; }
.semana .dia.sel .num { background: var(--laranja); color: #fff; font-weight: 600; }
.semana .ponto { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.semana .dia.tem .ponto { background: var(--laranja); }
.semana .dia.sel .ponto { background: transparent; }
.data-label { text-align: center; color: var(--suave); padding: 6px 0 8px; font-size: 14px; }
.data-label input { position: absolute; opacity: 0; pointer-events: none; width: 0; }
.data-label button { background: none; border: 0; color: var(--suave); cursor: pointer; font-size: 14px; }
.data-label button::after { content: " ▾"; color: var(--laranja); }

/* linha do tempo */
.timeline { padding: 8px 16px 16px; }
.slot { position: relative; padding-left: 14px; border-left: 2px solid var(--linha); margin-left: 4px; }
.slot .hora { position: relative; color: var(--suave); font-size: 13px; padding: 10px 0 4px; }
.slot .hora::before { content: ""; position: absolute; left: -20px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--suave); }
.aula { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 4px 0 10px; cursor: pointer; }
.aula .linha1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.aula .nome { font-size: 15px; }
.aula .sub { display: flex; justify-content: space-between; gap: 8px; color: var(--suave); font-size: 12px; margin-top: 2px; }
.aula.riscada .nome { text-decoration: line-through; color: var(--suave); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; border: 1px solid; white-space: nowrap; }
.tag.reagendada { color: var(--laranja); border-color: var(--laranja); }
.tag.experimental { color: var(--azul); border-color: var(--azul); }
.tag.faltou { color: var(--vermelho); border-color: var(--vermelho); }
.tag.cancelada { color: var(--suave); border-color: var(--suave); }
.tag.presente { color: var(--verde); border-color: var(--verde); }
.tag.matriculado { color: var(--roxo); border-color: var(--roxo); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.vazio { text-align: center; color: var(--suave); padding: 48px 24px; }
.vazio .grande { font-size: 40px; margin-bottom: 8px; }

/* listas */
.busca { padding: 12px 16px 4px; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li > a, .lista li > button.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linha); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--fundo-2); border: 1px solid var(--linha); display: grid; place-items: center; font-weight: 600; color: var(--laranja); flex: none; }
.item-corpo { flex: 1; min-width: 0; }
.item-corpo .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-corpo .s { color: var(--suave); font-size: 12px; }
.secao-titulo { font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; padding: 16px 16px 6px; }

/* extrato */
.mes-nav { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 12px 0; font-weight: 600; font-size: 16px; }
.mes-nav button { background: none; border: 0; color: var(--laranja); font-size: 22px; cursor: pointer; }
.resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px 12px; }
.resumo div { background: var(--fundo-2); border-radius: 12px; padding: 10px; text-align: center; }
.resumo small { display: block; color: var(--suave); font-size: 11px; }
.resumo b { font-size: 15px; font-variant-numeric: tabular-nums; }
.valor { font-variant-numeric: tabular-nums; white-space: nowrap; }
.valor.ok { color: var(--verde); }
.pago-btn { border: 1px solid var(--linha); background: var(--fundo); border-radius: 18px; padding: 5px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.pago-btn.sim { background: var(--verde); border-color: var(--verde); color: #fff; }
.total { position: sticky; bottom: calc(var(--abas-h) + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; padding: 14px 16px; background: var(--fundo); border-top: 1px solid var(--linha); font-weight: 600; }
.total .valor { color: var(--verde); }

/* formulários */
.form { padding: 12px 16px 24px; display: grid; gap: 14px; }
label.campo { display: grid; gap: 4px; font-size: 12px; color: var(--suave); }
.campo input, .campo select, .campo textarea, .busca input { width: 100%; border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; background: var(--fundo); font-size: 15px; color: var(--texto); }
.campo textarea { min-height: 96px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .busca input:focus { outline: 2px solid var(--laranja); outline-offset: -1px; border-color: transparent; }
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.horario { display: grid; grid-template-columns: 1fr 130px 40px; gap: 8px; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--linha); background: var(--fundo); border-radius: 18px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.chip.on { border-color: var(--laranja); background: var(--laranja); color: #fff; }

.btn { display: block; width: 100%; border: 0; border-radius: 10px; padding: 13px; font-weight: 600; font-size: 15px; cursor: pointer; background: var(--laranja); color: #fff; text-align: center; }
.btn:active { background: var(--laranja-escuro); }
.btn.sec { background: var(--fundo-2); color: var(--texto); }
.btn.perigo { background: none; color: var(--vermelho); }
.btn.link { background: none; color: var(--azul); font-weight: 500; }
.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(var(--abas-h) + 16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--laranja); color: #fff; font-size: 30px; box-shadow: 0 4px 14px rgba(242,140,40,.45); cursor: pointer; z-index: 6; line-height: 1; }

/* detalhe */
.detalhe { padding: 8px 16px; }
.info { display: grid; gap: 8px; padding: 8px 0 14px; border-bottom: 1px solid var(--linha); }
.info div { display: flex; gap: 10px; align-items: center; }
.info svg { width: 18px; height: 18px; fill: var(--azul); flex: none; }
.bloco { padding: 14px 0; border-bottom: 1px solid var(--linha); }
.bloco h3 { font-size: 15px; font-weight: 500; margin: 0 0 8px; }
.material { white-space: pre-wrap; background: var(--fundo-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.status-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-btns button { border: 1px solid var(--linha); background: var(--fundo); border-radius: 10px; padding: 10px 4px; cursor: pointer; font-size: 13px; }
.status-btns button.on[data-s=presente] { background: var(--verde); border-color: var(--verde); color: #fff; }
.status-btns button.on[data-s=faltou] { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.status-btns button.on[data-s=cancelada] { background: var(--suave); border-color: var(--suave); color: #fff; }
.contagem { color: var(--azul); text-align: center; font-size: 13px; padding: 12px 0; border-bottom: 1px solid var(--linha); }
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hist li { background: var(--fundo-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.hist .d { color: var(--suave); font-size: 12px; display: flex; justify-content: space-between; }

/* folha inferior */
.folha { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.folha[hidden] { display: none; }
.folha .caixa { background: var(--fundo); width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; padding: 8px 0 calc(16px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; animation: sobe .18s ease-out; }
.folha .alca { width: 40px; height: 4px; border-radius: 2px; background: var(--linha); margin: 4px auto 8px; }
.folha h2 { font-size: 17px; margin: 0; padding: 4px 16px 0; }
@keyframes sobe { from { transform: translateY(40px); opacity: .5; } }

.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--abas-h) + 20px); background: #2b2f36; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; font-size: 14px; max-width: 90vw; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .caixa { width: 100%; max-width: 340px; display: grid; gap: 16px; text-align: center; }
.login img { width: 84px; margin: 0 auto; }
.login h1 { margin: 0; font-size: 22px; }
.login p { margin: 0; color: var(--suave); }
.erro { color: var(--vermelho); font-size: 13px; min-height: 18px; }
body.sem-abas { padding-bottom: 0; }
body.sem-abas .abas, body.sem-abas .topo { display: none; }
