:root {
  --fundo: #f6f7f9;
  --superficie: #ffffff;
  --borda: #dfe3e8;
  --borda-forte: #c4cad2;
  --texto: #1c2430;
  --texto-fraco: #5c6773;
  --texto-tenue: #8b95a1;
  --marca: #1f5b8f;
  --marca-clara: #e8f0f7;
  --confirmada: #2e7d4f;
  --confirmada-bg: #e3f2e9;
  --ociosa: #b3701a;
  --ociosa-bg: #fbf0df;
  --nplan: #6b4fa8;
  --nplan-bg: #ede8f7;
  --alerta: #b3261e;
  --alerta-bg: #fbe9e7;
  --vazio: #eef0f3;
  --raio: 8px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #14181d;
    --superficie: #1c2127;
    --borda: #2c333c;
    --borda-forte: #3c454f;
    --texto: #e6e9ed;
    --texto-fraco: #a3adb8;
    --texto-tenue: #78828d;
    --marca: #6aa9dd;
    --marca-clara: #1b2b3a;
    --confirmada: #6ec293;
    --confirmada-bg: #17301f;
    --ociosa: #d8a04a;
    --ociosa-bg: #33270f;
    --nplan: #a58ede;
    --nplan-bg: #241d38;
    --alerta: #e88b83;
    --alerta-bg: #331715;
    --vazio: #232931;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--marca); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Cabecalho ---------------------------------------------------------- */
header.topo {
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
  padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topo-linha { display: flex; align-items: center; gap: 24px; max-width: 1400px; margin: 0 auto; }
.marca {
  font-weight: 650; font-size: 15px; letter-spacing: -.01em;
  padding: 14px 0; color: var(--texto); white-space: nowrap;
}
.marca span { color: var(--texto-tenue); font-weight: 400; }
nav.abas { display: flex; gap: 2px; flex-wrap: wrap; }
nav.abas a {
  padding: 14px 12px; color: var(--texto-fraco); font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.abas a:hover { color: var(--texto); text-decoration: none; }
nav.abas a.ativa { color: var(--marca); border-bottom-color: var(--marca); font-weight: 550; }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 32px 0 12px; }
h2:first-of-type { margin-top: 0; }
.subtitulo { color: var(--texto-fraco); font-size: 14px; margin: 0 0 24px; }

/* --- Avisos -------------------------------------------------------------- */
.aviso {
  background: var(--ociosa-bg); border: 1px solid transparent;
  border-left: 3px solid var(--ociosa);
  padding: 12px 14px; border-radius: var(--raio); margin: 0 0 20px;
  font-size: 13.5px; line-height: 1.55; color: var(--texto);
}
.aviso strong { font-weight: 620; }
.aviso.info { background: var(--marca-clara); border-left-color: var(--marca); }
.aviso p { margin: 0; }
.aviso p + p { margin-top: 8px; }

/* --- Cartoes de indicador ------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi {
  background: var(--superficie); border: 1px solid var(--borda);
  border-radius: var(--raio); padding: 14px 16px; box-shadow: var(--sombra);
}
.kpi .rotulo { font-size: 12px; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .valor { font-size: 26px; font-weight: 660; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .nota { font-size: 12.5px; color: var(--texto-tenue); line-height: 1.4; }
.kpi.destaque .valor { color: var(--marca); }

/* --- Tabelas ------------------------------------------------------------- */
.quadro {
  background: var(--superficie); border: 1px solid var(--borda);
  border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); margin-bottom: 24px;
}
.rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; padding: 10px 12px; background: var(--fundo);
  border-bottom: 1px solid var(--borda); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; color: var(--texto-fraco); white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--fundo); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; font-weight: 600; }
.fraco { color: var(--texto-tenue); }

/* --- Barra de proporcao -------------------------------------------------- */
.barra { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.barra .trilho { flex: 1; height: 6px; background: var(--vazio); border-radius: 3px; overflow: hidden; min-width: 60px; }
.barra .preenche { height: 100%; background: var(--marca); border-radius: 3px; }
.barra .pct { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--texto-fraco); min-width: 42px; text-align: right; }

/* --- Etiquetas ----------------------------------------------------------- */
.etiqueta {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.et-confirmada { background: var(--confirmada-bg); color: var(--confirmada); }
.et-ociosa { background: var(--ociosa-bg); color: var(--ociosa); }
.et-nplan { background: var(--nplan-bg); color: var(--nplan); }
.et-alerta { background: var(--alerta-bg); color: var(--alerta); }
.et-neutra { background: var(--vazio); color: var(--texto-fraco); }

/* --- Grade semanal ------------------------------------------------------- */
.grade { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.grade th { background: transparent; border: 0; padding: 4px 6px; }
.grade th.dia { text-align: center; }
.grade td.rotulo-hora {
  background: transparent; border: 0; padding: 4px 8px 4px 0; text-align: right;
  color: var(--texto-fraco); font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px; white-space: nowrap; width: 1%;
}
.celula {
  border-radius: 5px; padding: 6px 7px; min-height: 46px; border: 1px solid transparent;
  line-height: 1.3; vertical-align: top;
}
.celula.vazia { background: var(--vazio); }
.celula.c-confirmada { background: var(--confirmada-bg); border-color: color-mix(in srgb, var(--confirmada) 25%, transparent); }
.celula.c-ociosa { background: var(--ociosa-bg); border-color: color-mix(in srgb, var(--ociosa) 25%, transparent); }
.celula.c-nplan { background: var(--nplan-bg); border-color: color-mix(in srgb, var(--nplan) 25%, transparent); }
.celula.c-neutra { background: var(--vazio); }
.celula .turma { font-weight: 660; font-size: 11.5px; }
.celula .disc { color: var(--texto-fraco); font-size: 11px; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.celula .taxa { font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .8; }
.celula .grupos { font-size: 10px; font-weight: 700; color: var(--nplan); }

/* --- Legenda ------------------------------------------------------------- */
.legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--texto-fraco); margin: 12px 0 0; }
.legenda span { display: flex; align-items: center; gap: 6px; }
.legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* --- Filtros ------------------------------------------------------------- */
form.filtros {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--superficie); border: 1px solid var(--borda);
  border-radius: var(--raio); padding: 14px 16px; margin-bottom: 20px; box-shadow: var(--sombra);
}
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label { font-size: 11.5px; font-weight: 600; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: .03em; }
select, input[type=text], input[type=date] {
  padding: 6px 9px; border: 1px solid var(--borda-forte); border-radius: 6px;
  background: var(--superficie); color: var(--texto); font-size: 13.5px; font-family: inherit; min-width: 130px;
}
button, .botao {
  padding: 7px 14px; border: 1px solid var(--marca); border-radius: 6px;
  background: var(--marca); color: #fff; font-size: 13.5px; font-weight: 550;
  cursor: pointer; font-family: inherit;
}
button:hover, .botao:hover { filter: brightness(1.08); text-decoration: none; }
.botao.secundario { background: var(--superficie); color: var(--marca); }

.acoes { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.acoes .espaco-flex { flex: 1; }
.contagem { font-size: 13px; color: var(--texto-fraco); }

.vazio-msg { padding: 32px; text-align: center; color: var(--texto-tenue); font-size: 14px; }

footer.rodape {
  max-width: 1400px; margin: 0 auto; padding: 24px; color: var(--texto-tenue);
  font-size: 12.5px; border-top: 1px solid var(--borda); line-height: 1.6;
}
