.cal-wrap { padding: var(--esp-lg); }

.cal-topo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--esp-md);
    margin-bottom: var(--esp-lg);
}

.cal-topo-acoes {
    display: flex;
    gap: var(--esp-sm);
    align-items: center;
    flex-wrap: wrap;
}

.cal-topo-ano {
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    color: var(--primaria);
}

.cal-sub-aviso,
.cal-sem-aulas {
    color: var(--texto-sutil);
}

.cal-legenda-hoje {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 2px solid var(--primaria);
}

.cal-titulo {
    font-family: var(--fonte-titulo);
    font-size: var(--t-2xl);
    font-weight: 700;
    color: var(--texto);
    letter-spacing: -.02em;
    margin-bottom: 4px;
}
.cal-sub { font-size: var(--t-sm); color: var(--texto-muted); margin-bottom: var(--esp-lg); }

/* Grade */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: var(--esp-lg);
}

/* Card */
.mes-card {
    background: var(--card);
    border: 1px solid var(--borda);
    border-radius: var(--raio-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mes-header {
    background: #111827;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--primaria);
    flex-shrink: 0;
}
.mes-nome {
    font-family: var(--fonte-titulo);
    font-size: var(--t-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #fff;
}
.mes-letivos { font-size: var(--t-xs); color: var(--texto-muted); }

/* Tabela de dias */
.mes-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }

.mes-table thead th {
    padding: 4px 2px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texto-muted);
    background: #0f172a;
    border-bottom: 1px solid var(--borda);
}
.mes-table thead th.th-dom { color: #9ca3af; background: #000; }
.mes-table thead th.th-sab { color: #9ca3af; background: #000; }

.mes-table tbody td {
    padding: 0;
    text-align: center;
    vertical-align: middle;
    height: 27px;
    width: 14.28%;
    font-size: 11px;
    font-weight: 500;
    color: var(--texto);
    cursor: default;
    transition: filter .1s;
}
.mes-table tbody td.dia:hover { filter: brightness(1.3); }
.mes-table tbody td.fds-sab   { background: #000; color: #9ca3af; }
.mes-table tbody td.fds-dom   { background: #000; color: #9ca3af; }
.mes-table tbody td.outro     { background: #000; color: transparent; pointer-events: none; }
.mes-table tbody td.hoje      { outline: 2px solid var(--primaria) !important; outline-offset: -2px; border-radius: 2px; font-weight: 700; }
.mes-table tbody td.trim-1    { background: rgba(56,189,248,.06); }
.mes-table tbody td.trim-2    { background: rgba(74,222,128,.06); }
.mes-table tbody td.trim-3    { background: rgba(251,146,60,.06); }

/* Lista de eventos abaixo do mes */
.mes-eventos {
    border-top: 1px solid var(--borda-sutil);
    background: #0a1020;
    padding: 6px 8px;
    flex: 1;
}

.mes-eventos-vazio {
    font-size: var(--t-xs);
    color: var(--texto-sutil);
    padding: 6px 8px;
    font-style: italic;
    background: #0a1020;
    border-top: 1px solid var(--borda-sutil);
}

.ev-item {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,.04);
    line-height: 1.3;
}
.ev-item:last-child { border-bottom: none; padding-bottom: 0; }
.ev-item:first-child { padding-top: 0; }

.ev-icone {
    font-size: 9px;
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 1;
}

.ev-corpo { flex: 1; min-width: 0; }

.ev-periodo {
    font-size: var(--t-xs);
    font-weight: 700;
    color: var(--texto-muted);
    white-space: nowrap;
    font-family: var(--fonte-mono);
}

.ev-desc {
    font-size: var(--t-xs);
    color: #cbd5e1;
    line-height: 1.3;
    word-break: break-word;
}

/* ── Tooltip ─────────────────────────────────────────────── */
#cal-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1e293b;
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 8px 12px;
    max-width: 280px;
    pointer-events: none;
    box-shadow: var(--sombra-lg);
    display: none;
}
#cal-tooltip .tt-data { font-size: var(--t-xs); color: var(--texto-muted); margin-bottom: 4px; font-family: var(--fonte-mono); }
#cal-tooltip .tt-ev   { display: flex; align-items: flex-start; gap: 6px; font-size: var(--t-sm); color: var(--texto); line-height: 1.4; margin-bottom: 3px; }
#cal-tooltip .tt-ev:last-child { margin-bottom: 0; }
#cal-tooltip .tt-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }

/* ── Legenda ─────────────────────────────────────────────── */
.cal-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: var(--esp-lg); }
.leg-item    { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--texto-muted); }
.leg-icone   { font-size: 10px; }

/* ── Tabela de trimestres ────────────────────────────────── */
.trim-tabela { width: 100%; border-collapse: collapse; font-size: var(--t-sm); border: 1px solid var(--borda); border-radius: var(--raio-lg); overflow: hidden; }
.trim-tabela th { padding: 8px 12px; text-align: center; font-weight: 700; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .07em; }
.trim-tabela td { padding: 7px 12px; border-top: 1px solid var(--borda-sutil); color: var(--texto); text-align: center; }
.trim-tabela td:first-child { text-align: left; }
.trim-tabela .total-row td  { font-weight: 700; border-top: 2px solid var(--borda); background: #111827; }
.trim-head-secundario { background: #111827; color: var(--texto-muted); }
.trim-total-geral { text-align: center; font-size: var(--t-md); }

@media (max-width: 1100px) { .cal-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 680px)  { .cal-grid { grid-template-columns: 1fr; } }

@media print {
    .cal-wrap {
        padding: 0;
        color: #1e293b;
    }

    .mes-card,
    .trim-tabela {
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
        box-shadow: none !important;
    }

    .mes-header,
    .trim-tabela .total-row td {
        background: #f8fafc !important;
        color: #0f172a !important;
    }

    .mes-nome,
    .trim-tabela td,
    .trim-tabela th,
    .ev-desc,
    .leg-item,
    .cal-titulo,
    .section-title {
        color: #1e293b !important;
    }

    .mes-letivos,
    .cal-sub,
    .ev-periodo {
        color: #64748b !important;
    }

    .mes-table thead th {
        background: #e2e8f0 !important;
        color: #475569 !important;
        border-bottom-color: #cbd5e1 !important;
    }

    .mes-table thead th.th-dom,
    .mes-table tbody td.fds-dom {
        color: #9ca3af !important;
        background: #000 !important;
    }

    .mes-table thead th.th-sab,
    .mes-table tbody td.fds-sab {
        background: #000 !important;
        color: #9ca3af !important;
    }

    .mes-eventos,
    .mes-eventos-vazio {
        background: #f8fafc !important;
        color: #64748b !important;
    }

    .mes-table tbody td.outro {
        background: #f8fafc !important;
        color: transparent !important;
    }

    .ev-item {
        border-bottom-color: rgba(148, 163, 184, .35) !important;
    }
}
