/* Hora-Aula por Pelotão — layout com sidebar, componentes e impressão A4. */

:root {
    --texto: #172033;
    --texto-suave: #5b6578;
    --fundo: #f3f5f9;
    --superficie: #ffffff;
    --borda: #e2e6ee;
    --borda-forte: #c9d0dc;
    --primaria: #1e4fd8;
    --primaria-hover: #1840b3;
    --primaria-suave: #e8eefc;

    --sidebar: #0e1a33;
    --sidebar-2: #13234a;
    --sidebar-texto: #b8c3dc;
    --sidebar-ativo: #ffffff;

    --sucesso: #15803d;
    --sucesso-fundo: #e7f6ec;
    --andamento: #1e4fd8;
    --andamento-fundo: #e8eefc;
    --aviso: #a16207;
    --aviso-fundo: #fef6e0;
    --erro: #c62828;
    --erro-fundo: #fdecec;
    --neutro: #8a94a6;
    --neutro-fundo: #f0f2f6;

    --raio: 12px;
    --sombra: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    --largura-sidebar: 272px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--texto);
    background: var(--fundo);
}

a { color: var(--primaria); }
code { font-family: var(--mono); font-size: .88em; background: var(--neutro-fundo); padding: .05em .35em; border-radius: 4px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
.icone { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---------- Estrutura ---------- */
.app { display: flex; min-height: 100vh; }

/* Sidebar: expandida (ícone + texto) ou retraída (somente ícones, com dica ao passar o mouse). */
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    width: var(--largura-sidebar);
    display: flex; flex-direction: column;
    padding: 1rem .75rem;
    color: var(--sidebar-texto);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(59, 108, 246, .22) 0%, transparent 60%),
        linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    border-right: 1px solid rgba(255, 255, 255, .06);
    overflow-x: hidden; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
    transition: width .25s ease, transform .25s ease;
}
.sidebar__topo { display: flex; align-items: center; min-height: 48px; margin-bottom: .75rem; }
.sidebar__marca { display: flex; align-items: center; gap: .75rem; padding: .25rem .35rem; color: #fff; text-decoration: none; min-width: 0; border-radius: 10px; }
.sidebar__marca strong { display: block; font-size: 1.05rem; letter-spacing: .01em; line-height: 1.2; }
.sidebar__marca small { display: block; font-size: .75rem; color: var(--sidebar-texto); }
.sidebar__logo {
    display: block; flex: none; width: 42px; height: 42px; object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
}
.sidebar__curso {
    display: flex; gap: .55rem; align-items: flex-start;
    margin: 0 .2rem .5rem; padding: .6rem .7rem;
    font-size: .74rem; line-height: 1.35; color: #c9d3ea;
    border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06);
}
.sidebar__curso .icone { width: 16px; height: 16px; margin-top: 1px; color: #8fb0ff; }
.sidebar__nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar__secao { margin: 1.1rem .75rem .4rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6f7ea3; white-space: nowrap; }
.sidebar__link {
    position: relative;
    display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 42px;
    padding: .55rem .8rem; border-radius: 10px; border: 0;
    font: inherit; font-size: .92rem; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
    color: var(--sidebar-texto); background: transparent;
    transition: background .15s, color .15s;
}
.sidebar__link .icone { width: 20px; height: 20px; color: #8d9bbd; transition: color .15s; }
.sidebar__link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.sidebar__link:hover .icone { color: #fff; }
.sidebar__link.ativo {
    color: #fff; font-weight: 600;
    background: linear-gradient(90deg, rgba(79, 124, 255, .32) 0%, rgba(79, 124, 255, .1) 100%);
    box-shadow: inset 0 0 0 1px rgba(143, 176, 255, .18);
}
.sidebar__link.ativo .icone { color: #a9c1ff; }
.sidebar__link.ativo::before {
    content: ""; position: absolute; left: -.75rem; top: 9px; bottom: 9px; width: 4px;
    border-radius: 0 4px 4px 0; background: #6f97ff; box-shadow: 0 0 12px rgba(111, 151, 255, .8);
}
.sidebar__texto { overflow: hidden; text-overflow: ellipsis; }

.sidebar__rodape { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar__usuario {
    display: flex; align-items: center; gap: .65rem; padding: .5rem .55rem;
    border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06); color: #fff;
}
.sidebar__usuario > span:nth-child(2) { flex: 1; min-width: 0; }
.sidebar__usuario strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__usuario small { display: block; color: var(--sidebar-texto); font-size: .72rem; }
.sidebar__usuario form { margin: 0; }
.sidebar__sair { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; cursor: pointer; color: #b8c3dc; background: transparent; }
.sidebar__sair:hover { color: #fff; background: rgba(239, 68, 68, .25); }
.avatar {
    display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
    font-weight: 700; color: #fff; background: linear-gradient(135deg, #3d5a9e, #26396b);
}

/* Botão de retrair (na borda da sidebar, fora da área com rolagem). */
.sidebar__alternar {
    position: fixed; z-index: 31; top: 30px; left: calc(var(--largura-sidebar) - 14px);
    display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    border-radius: 50%; border: 1px solid var(--borda-forte); cursor: pointer;
    color: var(--texto); background: #fff; box-shadow: 0 2px 8px rgba(16, 24, 40, .18);
    transition: left .25s ease, background .15s, color .15s;
}
.sidebar__alternar:hover { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.sidebar__alternar:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.sidebar__alternar .icone { width: 16px; height: 16px; transition: transform .25s ease; }
.sidebar__fundo { display: none; }

.principal { flex: 1; min-width: 0; margin-left: var(--largura-sidebar); display: flex; flex-direction: column; transition: margin-left .25s ease; }
.topo {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem;
    padding: .7rem 1.75rem; min-height: 56px;
    background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--borda);
}
.topo__menu { display: none; border: 0; background: transparent; padding: .35rem; border-radius: 8px; cursor: pointer; color: var(--texto); }
.topo__titulo { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo__data { display: flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--texto-suave); white-space: nowrap; }
.conteudo { width: 100%; padding: 1.5rem 1.75rem 3rem; }

/* Sidebar retraída (somente desktop). */
@media (min-width: 961px) {
    html.sidebar-retraida { --largura-sidebar: 80px; }
    html.sidebar-retraida .sidebar { overflow: visible; }
    html.sidebar-retraida .sidebar__marca { padding: .25rem 0; margin: 0 auto; position: relative; }
    html.sidebar-retraida :is(.sidebar__marca > span:last-child, .sidebar__curso, .sidebar__texto, .sidebar__usuario > span:nth-child(2)) { display: none; }
    html.sidebar-retraida .sidebar__secao { height: 1px; margin: .9rem .5rem; font-size: 0; background: rgba(255, 255, 255, .1); }
    html.sidebar-retraida .sidebar__link { justify-content: center; padding: .55rem; }
    html.sidebar-retraida .sidebar__usuario { flex-direction: column; padding: .45rem 0; gap: .35rem; }
    html.sidebar-retraida .sidebar__alternar .icone { transform: rotate(180deg); }

    /* Dica com o nome do item ao passar o mouse ou focar pelo teclado. */
    html.sidebar-retraida [data-rotulo]::after {
        content: attr(data-rotulo);
        position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-4px, -50%);
        padding: .35rem .6rem; border-radius: 8px; white-space: nowrap; pointer-events: none;
        font-size: .82rem; font-weight: 500; color: #fff; background: #0b1428;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
        opacity: 0; transition: opacity .12s, transform .12s;
    }
    html.sidebar-retraida [data-rotulo]:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(0, -50%); }
}

@media (max-width: 960px) {
    .sidebar { width: 280px; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    body.menu-aberto .sidebar { transform: none; }
    body.menu-aberto .sidebar__fundo { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 16, 32, .45); backdrop-filter: blur(2px); }
    .sidebar__alternar { display: none; }
    .principal { margin-left: 0; }
    .topo { padding: .6rem 1rem; }
    .topo__menu { display: inline-flex; }
    .topo__data { display: none; }
    .conteudo { padding: 1rem 1rem 2.5rem; }
}

/* Evita animação ao carregar a página já com a sidebar retraída. */
html.sem-transicao :is(.sidebar, .principal, .sidebar__alternar, .sidebar__alternar .icone) { transition: none !important; }

/* ---------- Componentes ---------- */
.cabecalho-pagina { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }
.subtitulo { margin: 0; color: var(--texto-suave); max-width: 72ch; }
.titulo-secao { margin: 1.75rem 0 .75rem; font-size: 1.05rem; }
.titulo-cartao { font-size: 1rem; margin: 0 0 .75rem; }
.subtitulo-cartao { font-size: .85rem; margin: .75rem 0 .35rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .05em; }
.texto-suave { color: var(--texto-suave); }
.texto-erro { color: var(--erro); }
.texto-sucesso { color: var(--sucesso); }
.texto-aviso { display: block; color: var(--aviso); font-size: .82rem; }
.d-bloco { display: block; font-weight: 400; }
.link-discreto { color: var(--texto-suave); font-size: .875rem; text-decoration: none; }
.link-discreto:hover { color: var(--primaria); }

.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1.15rem 1.25rem; margin-bottom: 1rem; }
.cartao--sem-padding { padding: 0; overflow: hidden; }
.cartao__titulo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.cartoes--compactos { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cartao-numero { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: .9rem 1.1rem; }
.cartao-numero__rotulo { display: block; font-size: .8rem; color: var(--texto-suave); }
.cartao-numero strong { display: block; font-size: 1.65rem; line-height: 1.2; margin-top: .2rem; }
.cartao-numero small { font-size: .85rem; font-weight: 500; color: var(--texto-suave); }

.grade-pelotoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.cartao-pelotao { margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.cartao-pelotao header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.cartao-pelotao__numeros { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cartao-pelotao__numeros div { background: var(--fundo); border-radius: 8px; padding: .55rem .7rem; }
.cartao-pelotao__numeros strong { display: block; font-size: 1.35rem; }
.cartao-pelotao__numeros span { font-size: .78rem; color: var(--texto-suave); }
.cartao-pelotao__situacoes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .5rem; font-size: .84rem; }
.cartao-pelotao__proxima { margin: 0; font-size: .84rem; padding-top: .6rem; border-top: 1px dashed var(--borda); }
.cartao-pelotao__proxima span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); }

.grade-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.cartao-mini { margin: 0; display: flex; flex-direction: column; gap: .1rem; text-decoration: none; color: inherit; padding: .85rem 1rem; transition: border-color .15s, transform .15s; }
.cartao-mini:hover { border-color: var(--primaria); transform: translateY(-1px); }
.cartao-mini span { font-size: .85rem; }

.duas-colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.lista-aulas { list-style: none; margin: 0; padding: 0; }
.lista-aulas li { display: flex; gap: .75rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--borda); font-size: .9rem; }
.lista-aulas li:last-child { border-bottom: 0; }
.lista-aulas li span:nth-child(2) { flex: 1; }
.lista-aulas small { display: block; color: var(--texto-suave); font-size: .8rem; }
.lista-aulas__hora { font-variant-numeric: tabular-nums; color: var(--texto-suave); white-space: nowrap; min-width: 6.5em; }
.lista-aulas li.concluida { opacity: .7; }
.alerta-linha { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--borda); font-size: .9rem; }
.alerta-linha small { display: block; color: var(--texto-suave); }
.alerta-linha__valores { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.vazio-estado { text-align: center; padding: 3rem 1rem; color: var(--texto-suave); background: var(--superficie); border: 1px dashed var(--borda-forte); border-radius: var(--raio); }
.vazio-estado > .icone { width: 40px; height: 40px; color: var(--neutro); }
.vazio-estado h2 { color: var(--texto); margin-top: .5rem; }

/* Botões */
.botao {
    display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
    font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
    padding: .55rem .95rem; border-radius: 8px; border: 1px solid var(--borda-forte); background: var(--superficie); color: var(--texto);
    transition: background .15s, border-color .15s;
}
.botao:hover { background: var(--neutro-fundo); }
.botao:disabled { opacity: .5; cursor: not-allowed; }
.botao--primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.botao--primario:hover { background: var(--primaria-hover); }
.botao--perigo { color: var(--erro); border-color: #f0c4c4; }
.botao--perigo:hover:not(:disabled) { background: var(--erro-fundo); }
.botao--discreto { border-color: transparent; background: transparent; color: var(--texto-suave); }
.botao--pequeno { font-size: .82rem; padding: .35rem .65rem; }
.botao--pequeno .icone { width: 15px; height: 15px; }
.botao--largo { width: 100%; padding: .7rem; }
:is(.botao, .sidebar__link, textarea, input, select, summary, .abas a):focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

.acoes, .barra { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
.barra { justify-content: space-between; margin-top: 0; }
.barra__grupo { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.acoes-coluna { white-space: nowrap; text-align: right !important; }
.acoes-coluna form { display: inline; }
.acoes--fixas { position: sticky; bottom: 0; z-index: 5; padding: .75rem 0; background: linear-gradient(to top, var(--fundo) 70%, transparent); }

/* Alertas */
.alerta { display: flex; gap: .65rem; align-items: flex-start; border: 1px solid; border-radius: 10px; padding: .8rem 1rem; margin: 0 0 1rem; }
.alerta > .icone { margin-top: 2px; }
.alerta ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.alerta h2 { font-size: 1rem; }
.alerta p { margin: .25rem 0; }
.alerta--erro { background: var(--erro-fundo); border-color: #f3c2c2; color: #7a1717; }
.alerta--aviso { background: var(--aviso-fundo); border-color: #f1dc9e; color: #6a4a06; }
.alerta--sucesso { background: var(--sucesso-fundo); border-color: #b9e3c6; color: #14532d; }
.alerta--bloco { display: block; color: var(--texto); }
.alerta .opcao { margin-top: .5rem; color: inherit; }

.lista-erros { list-style: none; padding: 0 !important; }
.lista-erros li { padding: .5rem 0; border-top: 1px solid rgba(198, 40, 40, .2); display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.lista-erros li:first-child { border-top: 0; }
.botao-linha { font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; border: 1px solid var(--erro); color: var(--erro); background: #fff; border-radius: 6px; padding: 0 .45rem; }
.erro-local { font-weight: 600; }
.erro-mensagem { flex-basis: 100%; }
.erro-trecho { flex-basis: 100%; margin: .25rem 0 0; padding: .5rem; background: #fff; border: 1px solid var(--borda); border-radius: 6px; font-family: var(--mono); font-size: .82rem; overflow-x: auto; }

/* Selos de situação */
.selo { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.selo--concluida { color: var(--sucesso); background: var(--sucesso-fundo); }
.selo--em_andamento { color: var(--andamento); background: var(--andamento-fundo); }
.selo--excedida { color: var(--erro); background: var(--erro-fundo); }
.selo--nao_iniciada, .selo--sem_carga { color: var(--texto-suave); background: var(--neutro-fundo); }
.selo--alerta { color: var(--aviso); background: var(--aviso-fundo); }
.ponto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; background: var(--neutro); }
.ponto--concluida { background: var(--sucesso); }
.ponto--em_andamento { background: var(--andamento); }
.ponto--excedida { background: var(--erro); }
.ponto--sem_carga { background: #cfd5df; }
.legenda-situacoes { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .82rem; color: var(--texto-suave); margin: 0 0 .75rem; }

.barra-progresso { display: block; height: 6px; border-radius: 99px; background: var(--neutro-fundo); overflow: hidden; min-width: 60px; }
.barra-progresso > span { display: block; height: 100%; border-radius: 99px; background: var(--andamento); }
.barra-progresso--concluida > span { background: var(--sucesso); }
.barra-progresso--excedida > span { background: var(--erro); }

/* Tabelas */
.tabela-rolagem { overflow-x: auto; scrollbar-width: thin; }

/* Rolagem horizontal das tabelas: setas laterais (carrossel), arrastar com o mouse e sombras nas bordas. */
.rolagem-h { position: relative; min-width: 0; }
.rolagem-h__setas {
    position: sticky; top: 50vh; z-index: 6; height: 0;
    display: flex; justify-content: space-between; pointer-events: none;
}
.rolagem-h__seta {
    pointer-events: auto;
    display: grid; place-items: center; width: 38px; height: 38px; margin: 0 6px;
    transform: translateY(32px);
    border: 1px solid var(--borda-forte); border-radius: 50%; cursor: pointer;
    color: var(--texto); background: rgba(255, 255, 255, .95);
    box-shadow: 0 4px 14px rgba(16, 24, 40, .18);
    transition: opacity .15s, background .15s, transform .15s;
}
.rolagem-h__seta:hover { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.rolagem-h__seta:active { transform: translateY(32px) scale(.94); }
.rolagem-h__seta:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.rolagem-h__seta[hidden] { display: grid; opacity: 0; pointer-events: none; }
.rolagem-h__seta .icone { width: 20px; height: 20px; }
.rolagem-h::before, .rolagem-h::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 28px; z-index: 4; pointer-events: none;
    opacity: 0; transition: opacity .15s;
}
.rolagem-h::before { left: 0; background: linear-gradient(to right, rgba(16, 24, 40, .12), transparent); }
.rolagem-h::after { right: 0; background: linear-gradient(to left, rgba(16, 24, 40, .12), transparent); }
.rolagem-h.tem-esquerda::before, .rolagem-h.tem-direita::after { opacity: 1; }
.rolagem-h.rolavel .tabela-rolagem { cursor: grab; }
.rolagem-h.arrastando .tabela-rolagem { cursor: grabbing; user-select: none; }
.rolagem-h__dica { display: none; margin: 0 0 .35rem; font-size: .78rem; color: var(--texto-suave); }
.rolagem-h.rolavel .rolagem-h__dica { display: block; }
.tabela { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela th, .tabela td { padding: .6rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--borda); }
.tabela thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-suave); background: #f8f9fc; font-weight: 600; white-space: nowrap; }
.tabela tbody th { font-weight: 500; }
.tabela tbody tr:hover { background: #fafbfd; }
.tabela tbody tr:last-child > * { border-bottom: 0; }
.numero { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-progresso { min-width: 140px; }
.col-progresso small { color: var(--texto-suave); font-size: .75rem; }

.tabela-matriz thead th a { color: inherit; text-decoration: none; }
.tabela-matriz thead th a:hover { color: var(--primaria); }
.tabela-matriz tbody th { min-width: 240px; }
.tabela-matriz :is(thead th:first-child, tbody th) { position: sticky; left: 0; z-index: 2; background: var(--superficie); box-shadow: 1px 0 0 var(--borda); }
.tabela-matriz thead th:first-child { background: #f8f9fc; z-index: 3; }
.celula-situacao { min-width: 92px; text-align: right; }
.celula-situacao__valor { font-variant-numeric: tabular-nums; font-weight: 600; }
.celula-situacao .icone { width: 14px; height: 14px; margin-left: .2rem; }
.celula-situacao .barra-progresso { margin-top: .3rem; }
.celula-situacao--concluida { background: rgba(21, 128, 61, .06); color: var(--sucesso); }
.celula-situacao--concluida .barra-progresso > span { background: var(--sucesso); }
.celula-situacao--excedida { background: rgba(198, 40, 40, .07); color: var(--erro); }
.celula-situacao--excedida .barra-progresso > span { background: var(--erro); }
.celula-situacao--nao_iniciada, .celula-situacao--sem_carga { color: var(--neutro); }

.tabela-vinculos select { width: 100%; min-width: 280px; }
.linha-pendente { background: var(--aviso-fundo); }
.linha-erro { background: var(--erro-fundo); }

.tabela-contrato { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela-contrato th, .tabela-contrato td { border: 1px solid var(--borda); padding: .4rem .55rem; text-align: left; vertical-align: top; }
.tabela-contrato thead th { background: #f8f9fc; }

/* Formulários */
.rotulo { display: block; font-weight: 600; margin-bottom: .4rem; }
.formulario { display: flex; flex-direction: column; gap: .9rem; }
.formulario--grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 1.25rem; }
.campo { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.campo > span { font-weight: 600; }
.campo--largo { grid-column: 1 / -1; }
.campo__erro { color: var(--erro); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, .campo textarea {
    font: inherit; font-size: .92rem; color: var(--texto);
    padding: .55rem .7rem; border: 1px solid var(--borda-forte); border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, .campo textarea:focus { outline: none; border-color: var(--primaria); box-shadow: 0 0 0 3px rgba(30, 79, 216, .15); }
[aria-invalid="true"] { border-color: var(--erro) !important; }
.opcao { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; color: var(--texto-suave); font-size: .9rem; }

.filtros { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: 0 0 1rem; }
.filtros label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--texto-suave); font-weight: 600; }
.filtros select, .filtros input { min-width: 180px; }

.editor { display: flex; border: 1px solid var(--borda-forte); border-radius: 10px; background: #fff; overflow: hidden; }
.editor__linhas { margin: 0; padding: .75rem .5rem; min-width: 3.2rem; text-align: right; color: #97a0b1; background: #f8f9fc; border-right: 1px solid var(--borda); font-family: var(--mono); font-size: .84rem; line-height: 1.45; overflow: hidden; user-select: none; }
.editor textarea { flex: 1; border: 0; padding: .75rem; font-family: var(--mono); font-size: .84rem; line-height: 1.45; resize: vertical; min-height: 22rem; white-space: pre; overflow: auto; tab-size: 2; color: var(--texto); background: transparent; }
.editor textarea:focus { outline: none; }
.editor:focus-within { border-color: var(--primaria); box-shadow: 0 0 0 3px rgba(30, 79, 216, .15); }

.recolhivel { margin: 1rem 0; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); }
.recolhivel summary { cursor: pointer; padding: .8rem 1.1rem; font-weight: 600; }
.recolhivel__corpo { padding: 0 1.1rem 1.1rem; }
.codigo { font-family: var(--mono); font-size: .82rem; background: #f8f9fc; border: 1px solid var(--borda); border-radius: 8px; padding: .75rem; overflow: auto; max-height: 30rem; white-space: pre; }

.login { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.login__cartao { width: 100%; max-width: 400px; padding: 2rem; }
.login__logo { display: block; width: 72px; height: 72px; margin-bottom: 1rem; filter: drop-shadow(0 6px 14px rgba(14, 26, 51, .25)); }
.login .subtitulo { margin-bottom: 1.25rem; font-size: .9rem; }

/* QTS */
.cartao-semana { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .9rem 1.5rem; align-items: center; }
.cartao-semana--atual { border-color: #b8c9f7; box-shadow: 0 0 0 3px var(--primaria-suave); }
.cartao-semana__info { display: flex; flex-direction: column; gap: .2rem; }
.cartao-semana__periodo { display: flex; gap: .7rem; align-items: center; }
.cartao-semana__periodo > .icone { width: 22px; height: 22px; color: var(--primaria); }
.cartao-semana__periodo small { display: block; color: var(--texto-suave); }
.cartao-semana__acoes { display: flex; flex-wrap: wrap; gap: .4rem; }

.abas { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--borda-forte); margin: 0 0 1rem; }
.abas a { text-decoration: none; color: var(--texto-suave); padding: .55rem 1rem; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.abas a:hover { color: var(--texto); }
.abas a[aria-selected="true"] { color: var(--primaria); border-bottom-color: var(--primaria); }

.pelotao { padding: 0 0 1.5rem; }
.pelotao[hidden] { display: none; }
.pelotao__barra { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; margin-bottom: .6rem; }

.folha { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.5rem; box-shadow: var(--sombra); min-width: 0; }
.folha__cabecalho { border-bottom: 2px solid var(--texto); padding-bottom: .6rem; margin-bottom: .9rem; }
.folha__titulo { margin: 0; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-suave); }
.folha__pelotao { font-size: 1.45rem; margin: .1rem 0 .4rem; }
.folha__dados { display: flex; flex-wrap: wrap; gap: .2rem 2rem; margin: 0; font-size: .9rem; }
.folha__dados div { display: flex; gap: .4rem; }
.folha__dados dt { font-weight: 700; }
.folha__dados dt::after { content: ":"; }
.folha__dados dd { margin: 0; }
.folha__nota { margin: .5rem 0 0; font-size: .75rem; color: var(--texto-suave); }
.folha--relatorio .filtros { margin-top: 1rem; }

.tabela-aulas { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: .84rem; }
.tabela-aulas th, .tabela-aulas td { border: 1px solid #b9c1cf; padding: .38rem .45rem; text-align: left; vertical-align: top; }
.tabela-aulas thead th { background: #eef1f6; font-weight: 700; }
.tabela-aulas tr.novo-dia td { border-top: 2px solid var(--texto); }
.tabela-aulas tr.ministrada td { background: #fafcfa; }
.tabela-aulas .vazio { color: var(--texto-suave); text-align: center; }
.tabela-aulas tr.sem-aula td { color: var(--texto-suave); background: #f8f9fc; font-style: italic; }

/* QTS agrupado por dia: cabeçalho do dia, espaço entre dias e linhas de intervalo. */
.tabela-aulas--por-dia { min-width: 960px; }
.tabela-aulas--por-dia .dia__espaco td { height: 14px; padding: 0; border-left: 0; border-right: 0; background: var(--superficie); }
.tabela-aulas--por-dia .dia__cabecalho th {
    padding: .55rem .75rem; text-align: left;
    color: #fff; background: linear-gradient(90deg, #1e3a8a 0%, #2b4fb5 100%);
    border-color: #1e3a8a;
}
.dia__nome { font-size: .95rem; font-weight: 700; letter-spacing: .01em; }
.dia__data { margin-left: .6rem; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: rgba(255, 255, 255, .18); }
.dia__resumo { float: right; font-size: .8rem; font-weight: 500; opacity: .9; }
.tabela-aulas--por-dia tr.aula td { padding-top: .5rem; padding-bottom: .5rem; }
.aula__disciplina { font-weight: 600; }
.tabela-aulas--por-dia tr.intervalo td {
    padding: .2rem .45rem; font-size: .76rem; color: var(--texto-suave);
    background: repeating-linear-gradient(135deg, #f6f7fa 0 8px, #eef1f6 8px 16px);
    border-top-style: dashed; border-bottom-style: dashed;
}
.intervalo__rotulo { font-weight: 600; letter-spacing: .02em; }
.tabela-aulas--por-dia tr.intervalo--longo td { padding-top: .45rem; padding-bottom: .45rem; color: #8a5a00; background: repeating-linear-gradient(135deg, #fff8e6 0 8px, #fdf0cf 8px 16px); }
.col-data { width: 6.3em; }
.col-dia { width: 7.5em; }
.col-horario { width: 7.3em; }
.col-disciplina { width: 16%; }
.col-instrutor, .col-local { width: 9%; }
.col-obs { width: 11%; }
.col-ha { width: 5.5em; }
.ha { font-weight: 600; }
.ha--concluida { color: var(--sucesso); }
.ha--excedida { color: var(--erro); }
.icone--ministrada { width: 14px; height: 14px; color: var(--sucesso); margin-left: .2rem; }
.sem-quebra { white-space: nowrap; }
.sigla { color: var(--texto-suave); font-size: .85em; white-space: nowrap; }

.tabela-carga { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .8rem; }
.rolagem-h:has(.tabela-carga) { margin-top: 1rem; }
.tabela-carga caption { text-align: left; font-weight: 700; padding-bottom: .3rem; font-size: .85rem; }
.tabela-carga th, .tabela-carga td { border: 1px solid #b9c1cf; padding: .25rem .45rem; text-align: left; }
.tabela-carga thead th { background: #eef1f6; }

/* ---------- Impressão (A4, preto e branco) ---------- */
@page { size: A4 landscape; margin: 12mm 10mm; }

@media print {
    body { background: #fff; color: #000; font-size: 10pt; }
    .nao-imprimir, .sidebar, .sidebar__alternar, .topo, .abas, .filtros, .acoes { display: none !important; }
    .principal { margin: 0; }
    .conteudo { max-width: none; padding: 0; }
    .cartao, .cartao-numero, .folha { box-shadow: none; border: 0; padding: 0; border-radius: 0; }
    .cartoes { gap: 4pt; }
    .cartao-numero { border: 1px solid #000; padding: 4pt 6pt; }
    .cartao-numero strong { font-size: 13pt; }

    .pelotao, .pelotao[hidden] { display: block !important; padding: 0; }
    .pelotao + .pelotao { break-before: page; page-break-before: always; }
    body.imprimir-um .pelotao:not(.alvo-impressao) { display: none !important; }
    body.imprimir-um .pelotao { break-before: auto; page-break-before: auto; }

    .folha { overflow: visible; }
    .folha__cabecalho { border-bottom-color: #000; break-after: avoid; page-break-after: avoid; break-inside: avoid; }
    .folha__titulo, .folha__nota, .sigla, .texto-suave { color: #000; }

    .tabela-aulas { font-size: 8pt; }
    .tabela-aulas, .tabela-carga, .tabela { min-width: 0 !important; }
    .tabela-aulas th, .tabela-aulas td, .tabela-carga th, .tabela-carga td { border-color: #000; padding: 2pt 3pt; }
    .tabela-aulas thead, .tabela thead, .tabela-carga thead { display: table-header-group; }
    .tabela-aulas thead th, .tabela-carga thead th, .tabela thead th { background: #fff; color: #000; }
    .tabela-aulas tr.novo-dia td { border-top: 1.5pt solid #000; }
    .tabela-aulas--por-dia tbody.dia { break-inside: avoid; page-break-inside: avoid; }
    .tabela-aulas--por-dia .dia__espaco td { height: 6pt; border: 0; }
    .tabela-aulas--por-dia .dia__cabecalho th { color: #000; background: #e6e6e6 !important; border: 1px solid #000; border-top: 1.5pt solid #000; padding: 3pt 4pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .dia__data { background: none; padding: 0; }
    .tabela-aulas--por-dia tr.intervalo td, .tabela-aulas--por-dia tr.intervalo--longo td { background: none !important; color: #000; font-size: 7pt; padding: 1pt 3pt; font-style: italic; }
    .tabela-aulas tr.ministrada td, .tabela-aulas tr.sem-aula td { background: none; color: #000; }
    tr, td, th { break-inside: avoid; page-break-inside: avoid; }
    .tabela-carga { break-inside: auto; font-size: 7.5pt; }
    .ha--concluida, .ha--excedida { color: #000; }
    .ha--excedida { text-decoration: underline; }

    .tabela { font-size: 8pt; }
    .tabela th, .tabela td { border: 1px solid #000; padding: 2pt 4pt; }
    .tabela-rolagem { overflow: visible; }
    .rolagem-h__setas, .rolagem-h__dica { display: none !important; }
    .rolagem-h::before, .rolagem-h::after { display: none; }
    .tabela-matriz :is(thead th:first-child, tbody th) { position: static; box-shadow: none; }
    .selo { border: 1px solid #000; color: #000 !important; background: none !important; padding: 0 3pt; }
    .barra-progresso { border: 1px solid #000; background: none; }
    .barra-progresso > span { background: #000 !important; }
    .celula-situacao { background: none !important; color: #000 !important; }

    h1, h2, caption { break-after: avoid; page-break-after: avoid; }
    a { color: #000; text-decoration: none; }
}

/* ---------- Tela do código de acesso (PIN) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pagina-pin {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background:
        radial-gradient(80% 60% at 15% 10%, rgba(79, 124, 255, .35) 0%, transparent 60%),
        radial-gradient(70% 60% at 90% 90%, rgba(242, 183, 5, .14) 0%, transparent 60%),
        linear-gradient(160deg, #0b1630 0%, #13234a 100%);
}
.pin { width: 100%; max-width: 380px; }
.pin__cartao {
    text-align: center; padding: 2.25rem 2rem 2rem; border-radius: 20px;
    background: rgba(255, 255, 255, .97); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.pin__logo { display: block; width: 84px; height: 84px; margin: 0 auto 1rem; filter: drop-shadow(0 8px 18px rgba(14, 26, 51, .3)); }
.pin__cartao h1 { font-size: 1.3rem; }
.pin__texto { margin: .25rem 0 1.5rem; color: var(--texto-suave); font-size: .9rem; }
.pin__form { display: flex; flex-direction: column; gap: .75rem; }
.pin__campo {
    font: inherit; font-size: 1.25rem !important; text-align: center; letter-spacing: .25em;
    padding: .75rem 1rem !important; border-radius: 12px !important;
}
.pin__campo::placeholder { letter-spacing: normal; font-size: 1rem; }
.pin__erro { margin: -.25rem 0 0; color: var(--erro); font-size: .88rem; }

/* ---------- Calendário letivo ---------- */
.ponto--hoje { background: #f2b705; }
.ponto--estimado { background: transparent; border: 2px dashed var(--andamento); width: 11px; height: 11px; }
.barra-progresso--grossa { height: 12px; }
.barra-progresso--grossa > span { background: linear-gradient(90deg, var(--sucesso), #22a355); }
.calendario-progresso { display: flex; flex-direction: column; gap: .5rem; }
.calendario-progresso__texto { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.calendario-progresso__nota { margin: 0; font-size: .82rem; }
.calendario { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.calendario__mes { margin: 0; }
.calendario__titulo { font-size: 1rem; margin: 0 0 .75rem; }
.calendario__grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendario__semana-dia { text-align: center; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--texto-suave); padding-bottom: .2rem; }
.calendario__dia {
    position: relative; aspect-ratio: 1 / 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 9px; font-size: .9rem; text-decoration: none; color: var(--texto);
    border: 1px solid transparent; transition: transform .12s, box-shadow .12s;
}
a.calendario__dia:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(16, 24, 40, .15); z-index: 1; }
.calendario__numero { font-weight: 600; line-height: 1; }
.calendario__tempos { font-size: .62rem; margin-top: 2px; opacity: .85; }
.calendario__dia--outro-mes { visibility: hidden; }
.calendario__dia--fora { color: #c3c9d4; }
.calendario__dia--sem_aula { color: var(--texto-suave); background: #f6f7fa; }
.calendario__dia--concluido { color: #fff; background: var(--sucesso); }
.calendario__dia--sem_qts { color: var(--sucesso); background: var(--sucesso-fundo); border: 1px dashed #7cc795; }
.calendario__dia--a_realizar { color: var(--andamento); background: var(--andamento-fundo); border-color: #c4d3fb; }
.calendario__dia--previsto { color: var(--andamento); background: #fff; border: 1px dashed #9db5f5; }
.calendario__dia--hoje { color: #3d2c00; background: #ffd75a; border-color: #e0ad00; box-shadow: 0 0 0 3px rgba(242, 183, 5, .35); }
@media print {
    .calendario { grid-template-columns: repeat(2, 1fr); }
    .calendario__dia { border: 1px solid #999 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Indicadores (cards dos relatórios) ---------- */
.titulo-grupo { margin: 1.25rem 0 .6rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-suave); }
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.indicador {
    display: flex; gap: .85rem; align-items: flex-start;
    padding: 1rem 1.1rem; border-radius: var(--raio); background: var(--superficie);
    border: 1px solid var(--borda); border-top: 3px solid var(--cor-indicador, var(--neutro)); box-shadow: var(--sombra);
}
.indicador__icone { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; color: var(--cor-indicador, var(--neutro)); background: var(--fundo-indicador, var(--neutro-fundo)); }
.indicador__icone .icone { width: 20px; height: 20px; }
.indicador__corpo { display: flex; flex-direction: column; min-width: 0; }
.indicador__titulo { font-size: .82rem; font-weight: 600; color: var(--texto-suave); }
.indicador__valor { font-size: 1.75rem; line-height: 1.15; margin: .1rem 0; font-variant-numeric: tabular-nums; }
.indicador__valor small { font-size: .85rem; font-weight: 500; color: var(--texto-suave); }
.indicador__detalhe { font-size: .78rem; color: var(--texto-suave); }
.indicador--sucesso { --cor-indicador: var(--sucesso); --fundo-indicador: var(--sucesso-fundo); }
.indicador--andamento { --cor-indicador: var(--andamento); --fundo-indicador: var(--andamento-fundo); }
.indicador--aviso { --cor-indicador: var(--aviso); --fundo-indicador: var(--aviso-fundo); }
.indicador--erro { --cor-indicador: var(--erro); --fundo-indicador: var(--erro-fundo); }
.indicador--neutro { --cor-indicador: #5b6578; --fundo-indicador: var(--neutro-fundo); }

.cartao-pelotao-mini { gap: .35rem; }
.cartao-pelotao-mini__topo { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.cartao-pelotao-mini__pct { font-size: .78rem; font-weight: 700; color: var(--sucesso); }
.cartao-pelotao-mini__principal b { font-size: 1.05rem; }
.cartao-pelotao-mini__numeros { display: flex; flex-wrap: wrap; gap: .15rem .9rem; font-size: .8rem !important; }

@media print {
    .indicador { border: 1px solid #000; box-shadow: none; padding: 4pt 6pt; }
    .indicador__icone { display: none; }
    .indicador__valor { font-size: 13pt; }
}
