.agenda-body {
    margin: 0;
    min-height: 100%;
    background: #f5f7fa;
    color: #1f2b38;
}

.agenda-page {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 38px 0 64px;
}

.agenda-topo {
    margin-bottom: 22px;
}

.agenda-etiqueta {
    display: inline-block;
    margin-bottom: 6px;
    color: #173f6c;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.agenda-topo h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.08;
}

.agenda-topo p {
    max-width: 760px;
    margin: 9px 0 0;
    color: #697687;
    font-size: 14px;
    line-height: 1.6;
}

.agenda-calendario {
    overflow: hidden;
    border: 1px solid #dfe5ec;
    border-radius: 18px;
    background: #fff;
}

.agenda-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #e4e9ef;
}

.agenda-toolbar h2 {
    margin: 0;
    overflow-wrap: anywhere;
    text-align: center;
    font-size: 19px;
    line-height: 1.2;
}

.agenda-navegacao,
.agenda-toolbar-direita,
.agenda-visoes {
    display: flex;
    align-items: center;
    gap: 7px;
}

.agenda-toolbar-direita {
    justify-content: flex-end;
    min-width: 0;
}

.agenda-btn,
.agenda-visao {
    min-height: 38px;
    border: 1px solid #d6dde6;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    padding: 8px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.agenda-btn:hover,
.agenda-visao:hover {
    border-color: #9bacbf;
    background: #f8fafc;
}

.agenda-btn-icone {
    width: 38px;
    padding: 0;
    font-size: 25px;
    line-height: 1;
}

.agenda-visoes {
    overflow: hidden;
    gap: 0;
    border: 1px solid #d6dde6;
    border-radius: 9px;
}

.agenda-visao {
    border: 0;
    border-radius: 0;
}

.agenda-visao + .agenda-visao {
    border-left: 1px solid #d6dde6;
}

.agenda-visao.ativo {
    background: #173f6c;
    color: #fff;
}

.agenda-filtro-ministerio {
    min-width: 200px;
}

.agenda-filtro-ministerio select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d6dde6;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
}

.agenda-contexto {
    padding: 9px 16px;
    border-bottom: 1px solid #edf0f4;
    background: #fbfcfe;
    color: #657386;
    font-size: 11px;
}

.agenda-status,
.agenda-aviso {
    padding: 18px;
    color: #657386;
    font-size: 13px;
    text-align: center;
}

.agenda-status.erro {
    color: #9d2e2e;
}

.agenda-aviso {
    border-top: 1px solid #ead9b8;
    background: #fffaf0;
    color: #79571a;
}

.agenda-conteudo[hidden],
.agenda-aviso[hidden] {
    display: none !important;
}

.agenda-scroll {
    overflow-x: auto;
}

/* =========================================================
   MÊS
========================================================= */

.agenda-mes {
    min-width: 900px;
}

.agenda-dias-semana {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-bottom: 1px solid #dfe5ec;
    background: #f8fafc;
}

.agenda-dias-semana span {
    padding: 9px 10px;
    color: #697687;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

.agenda-grade-mes {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.agenda-dia-mes {
    min-height: 132px;
    padding: 8px;
    border-right: 1px solid #e5e9ee;
    border-bottom: 1px solid #e5e9ee;
    background: #fff;
}

.agenda-dia-mes:nth-child(7n) {
    border-right: 0;
}

.agenda-dia-mes.fora-mes {
    background: #fafbfd;
}

.agenda-dia-mes.hoje {
    background: #f7fbff;
    box-shadow: inset 0 0 0 1px #b9cee5;
}

.agenda-numero-dia {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    margin-bottom: 5px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.agenda-dia-mes.hoje .agenda-numero-dia {
    background: #173f6c;
    color: #fff;
}

.agenda-dia-mes.fora-mes .agenda-numero-dia {
    color: #9aa5b2;
}

.agenda-eventos-dia {
    display: grid;
    gap: 4px;
}

.agenda-evento-chip {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d5e1ee;
    border-left: 3px solid #173f6c;
    border-radius: 6px;
    background: #eef4fa;
    color: #183b62;
    padding: 5px 6px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 750;
}

.agenda-evento-chip.interno {
    border-color: #ead7b3;
    border-left-color: #9b6b18;
    background: #fff8e8;
    color: #765117;
}

.agenda-evento-chip:hover {
    filter: brightness(.98);
}

.agenda-mais-eventos {
    border: 0;
    background: transparent;
    color: #53657a;
    padding: 2px 3px;
    text-align: left;
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

/* =========================================================
   SEMANA
========================================================= */

.agenda-semana {
    min-width: 900px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.agenda-coluna-semana {
    min-height: 390px;
    border-right: 1px solid #e5e9ee;
}

.agenda-coluna-semana:last-child {
    border-right: 0;
}

.agenda-coluna-semana.hoje {
    background: #f7fbff;
}

.agenda-cabecalho-dia-semana {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e9ee;
    text-align: center;
}

.agenda-cabecalho-dia-semana span {
    display: block;
    color: #697687;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.agenda-cabecalho-dia-semana strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    margin-top: 4px;
    border-radius: 50%;
    font-size: 16px;
}

.agenda-coluna-semana.hoje .agenda-cabecalho-dia-semana strong {
    background: #173f6c;
    color: #fff;
}

.agenda-lista-semana {
    display: grid;
    gap: 7px;
    padding: 9px;
}

/* =========================================================
   DIA / CARDS
========================================================= */

.agenda-dia {
    padding: 18px;
}

.agenda-dia-vazio {
    padding: 42px 18px;
    color: #7b8795;
    text-align: center;
}

.agenda-card-evento {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-decoration: none;
}

.agenda-card-evento:last-child {
    margin-bottom: 0;
}

.agenda-card-evento:hover {
    border-color: #b9c8d8;
    background: #fbfdff;
}

.agenda-horario {
    color: #173f6c;
    font-size: 13px;
    font-weight: 900;
}

.agenda-card-evento h3 {
    margin: 0;
    font-size: 15px;
}

.agenda-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    margin-top: 5px;
    color: #697687;
    font-size: 10px;
}

.agenda-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    background: #eef2f6;
    color: #566474;
    padding: 4px 8px;
    font-size: 9px;
    font-weight: 850;
    white-space: nowrap;
}

.agenda-badge.interno {
    background: #fff1d4;
    color: #805b1b;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 980px) {
    .agenda-toolbar {
        grid-template-columns: 1fr;
    }

    .agenda-toolbar h2 {
        order: -1;
        text-align: left;
    }

    .agenda-toolbar-direita {
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .agenda-page {
        width: min(calc(100% - 20px), 1440px);
        padding-top: 24px;
    }

    .agenda-toolbar-direita {
        align-items: stretch;
        flex-direction: column;
    }

    .agenda-filtro-ministerio {
        width: 100%;
    }

    .agenda-visoes {
        width: 100%;
    }

    .agenda-visao {
        flex: 1;
    }

    .agenda-navegacao {
        justify-content: space-between;
    }

    .agenda-card-evento {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   MOBILE — MÊS COMPLETO SEM ROLAGEM HORIZONTAL
========================================================= */

@media (max-width: 640px) {
    .agenda-calendario {
        border-radius: 14px;
    }

    .agenda-scroll-mes {
        width: 100%;
        overflow-x: hidden;
    }

    .agenda-mes {
        width: 100%;
        min-width: 0;
    }

    .agenda-dias-semana {
        width: 100%;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .agenda-dias-semana span {
        min-width: 0;
        padding: 7px 1px;
        overflow: hidden;
        font-size: clamp(7px, 2.1vw, 9px);
        letter-spacing: 0;
        text-overflow: clip;
        white-space: nowrap;
    }

    .agenda-grade-mes {
        width: 100%;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .agenda-dia-mes {
        min-width: 0;
        min-height: 78px;
        padding: 4px 2px;
        overflow: hidden;
    }

    .agenda-numero-dia {
        min-width: 22px;
        width: 22px;
        height: 22px;
        margin-bottom: 2px;
        font-size: 10px;
    }

    .agenda-eventos-dia {
        min-width: 0;
        gap: 2px;
    }

    .agenda-evento-chip {
        width: 100%;
        min-width: 0;
        padding: 3px 2px;
        border-left-width: 2px;
        border-radius: 4px;
        font-size: clamp(6px, 1.8vw, 8px);
        line-height: 1.15;
    }

    .agenda-mais-eventos {
        width: 100%;
        min-width: 0;
        padding: 1px;
        overflow: hidden;
        font-size: clamp(6px, 1.7vw, 8px);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /*
     * Semana permanece como uma visão de detalhe e pode usar
     * rolagem horizontal. O mês, por outro lado, sempre cabe inteiro.
     */
    .agenda-scroll-semana {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 390px) {
    .agenda-page {
        width: calc(100% - 12px);
    }

    .agenda-toolbar,
    .agenda-contexto {
        padding-left: 10px;
        padding-right: 10px;
    }

    .agenda-dia-mes {
        min-height: 72px;
    }

    .agenda-evento-chip {
        padding-left: 1px;
        padding-right: 1px;
    }
}

/* =========================================================
   E7.4C13 — AGENDA / VISÃO DIA NO DARK
   Mantém Mês e Semana homologados e corrige apenas os cards
   da visão diária que ainda herdavam superfícies claras.
========================================================= */
html[data-theme="dark"].iecjs-contexto-interno .agenda-dia {
    background: transparent;
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-card-evento {
    background: var(--bg-surface-elevated, #17354A);
    color: var(--text-primary, #F8F6F0);
    border-color: var(--border-soft, rgba(171,184,196,.16));
    box-shadow: none;
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-card-evento:hover,
html[data-theme="dark"].iecjs-contexto-interno .agenda-card-evento:focus-visible {
    background: color-mix(in srgb, var(--bg-surface-elevated, #17354A) 86%, var(--primary, #38C7FA));
    border-color: color-mix(in srgb, var(--primary, #38C7FA) 48%, transparent);
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-horario,
html[data-theme="dark"].iecjs-contexto-interno .agenda-card-evento h3 {
    color: var(--text-primary, #F8F6F0);
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-horario {
    color: var(--primary, #38C7FA);
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-card-meta {
    color: var(--text-secondary, #ABB8C4);
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-badge {
    background: rgba(171,184,196,.12);
    color: var(--text-secondary, #ABB8C4);
}

html[data-theme="dark"].iecjs-contexto-interno .agenda-badge.interno {
    background: rgba(216,180,120,.14);
    color: #E8C891;
}

/* =========================================================
   2026-10-12 — AGENDA UNIFICADA / TIMELINE DO DIA
========================================================= */
.agenda-evento-chip.fonte-ccpm_aula,
.agenda-timeline-evento.fonte-ccpm_aula {
    border-left-color: #2d8fc1;
    background: #eaf7fc;
    color: #155475;
}
.agenda-evento-chip.fonte-ccpm_atividade,
.agenda-timeline-evento.fonte-ccpm_atividade {
    border-left-color: #7857b5;
    background: #f3effc;
    color: #513983;
}
.agenda-evento-chip.fonte-escala,
.agenda-timeline-evento.fonte-escala {
    border-left-color: #2e9b70;
    background: #eaf8f2;
    color: #176547;
}
.agenda-dia-timeline-wrap { padding: 14px 18px 22px; }
.agenda-dia-resumo {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding: 0 0 14px 64px; color:#334155;
}
.agenda-dia-resumo span { color:#708094; font-size:11px; }
.agenda-timeline {
    position:relative; margin-left:58px; border-left:1px solid #dfe5ec;
    background:repeating-linear-gradient(to bottom,#fff 0,#fff 48px,#f8fafc 49px);
}
.agenda-timeline-hora { position:absolute; left:-58px; right:0; height:1px; display:flex; align-items:center; }
.agenda-timeline-hora span { width:48px; transform:translateY(-50%); color:#7a8796; font-size:10px; text-align:right; }
.agenda-timeline-hora i { flex:1; margin-left:10px; border-top:1px solid #e6ebf0; }
.agenda-timeline-evento {
    position:absolute; left:14px; right:12px; z-index:2; overflow:hidden;
    border:1px solid #d5e1ee; border-left:4px solid #173f6c; border-radius:8px;
    background:#eef4fa; color:#183b62; padding:6px 10px; text-decoration:none;
    box-shadow:0 2px 8px rgba(15,23,42,.06);
}
.agenda-timeline-evento strong,.agenda-timeline-evento span,.agenda-timeline-evento small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agenda-timeline-evento strong { font-size:11px; }
.agenda-timeline-evento span,.agenda-timeline-evento small { margin-top:2px; font-size:9px; opacity:.82; }
.agenda-dia-vazio-timeline { position:absolute; inset:110px 20px auto 80px; }

html[data-theme="dark"].iecjs-contexto-interno .agenda-dia-resumo { color:var(--text-primary,#F8F6F0); }
html[data-theme="dark"].iecjs-contexto-interno .agenda-dia-resumo span,
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-hora span { color:var(--text-secondary,#ABB8C4); }
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline {
    border-left-color:rgba(171,184,196,.18);
    background:var(--bg-surface,#102A3B);
}
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-hora i { border-color:rgba(171,184,196,.13); }
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-evento { background:var(--bg-surface-elevated,#17354A); color:var(--text-primary,#F8F6F0); border-color:rgba(171,184,196,.18); }
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-evento.fonte-ccpm_aula { border-left-color:#38C7FA; }
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-evento.fonte-ccpm_atividade { border-left-color:#B99AF2; }
html[data-theme="dark"].iecjs-contexto-interno .agenda-timeline-evento.fonte-escala { border-left-color:#58C994; }

@media (max-width:640px) {
    .agenda-dia-timeline-wrap { padding:12px 8px 20px; }
    .agenda-dia-resumo { padding-left:48px; align-items:flex-start; flex-direction:column; gap:2px; }
    .agenda-timeline { margin-left:42px; }
    .agenda-timeline-hora { left:-42px; }
    .agenda-timeline-hora span { width:34px; font-size:8px; }
    .agenda-timeline-hora i { margin-left:7px; }
    .agenda-timeline-evento { left:8px; right:4px; padding:5px 7px; }
}
