/* Camada visual da Agenda Mobile. Não substitui controles, eventos ou regras de negócio. */
body.agenda-mobile {
    --superficie-agenda: #ffffff;
    --fundo-agenda: #f4f5f7;
    --texto-agenda: #252a34;
    --texto-apoio-agenda: #606975;
    --borda-agenda: #dfe3e8;
    --vermelho-agenda: #AB1414;
    --laranja-agenda: #FF6D00;
    --largura-conteudo-mobile: 84rem;
    background: var(--fundo-agenda) !important;
    color: var(--texto-agenda);
    font-size: 16px !important;
    line-height: 1.55;
    overflow-x: visible;
    text-align: left;
}
.agenda-mobile *, .agenda-mobile input, .agenda-mobile button,
.agenda-mobile select, .agenda-mobile textarea {
    font-family: Calibri, "Segoe UI", Arial, sans-serif !important;
}
.agenda-mobile #wrapper {
    width: calc(100% - 32px) !important;
    max-width: var(--largura-conteudo-mobile) !important;
    margin: 20px auto !important;
    padding: clamp(16px, 2.5vw, 32px) !important;
    border: 0 !important;
    border-radius: 20px;
    box-shadow: 0 4px 24px #252a3408;
}
.agenda-mobile #wrapper > br, .agenda-mobile .agenda-mobile-cabecalho + br { display: none; }
.agenda-mobile #wrapper br + br { display: none; }
.agenda-mobile .agenda-mobile-cabecalho { margin: 0 0 24px; padding: 4px 0 20px; border-bottom: 1px solid var(--borda-agenda); }
.agenda-mobile .agenda-mobile-marca { color: var(--vermelho-agenda); font-size: 12px; letter-spacing: .07em; font-weight: 700; }
.agenda-mobile .agenda-mobile-cabecalho h1 { color: var(--texto-agenda); margin: 8px 0; font-size: clamp(28px, 4vw, 38px); line-height: 1.15; text-align: left; }
.agenda-mobile .agenda-mobile-cabecalho h1::after { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; margin-top: 14px; background: var(--laranja-agenda); }
.agenda-mobile .agenda-mobile-cabecalho p { margin: 12px 0 0; color: var(--texto-apoio-agenda); font-size: 16px; line-height: 1.5; }
.agenda-mobile #header { position: static; min-width: 0 !important; height: auto; min-height: 0; padding: 8px 0 20px; border: 0; background: transparent; }
.agenda-mobile #logo { position: static; }
.agenda-mobile #logo img { width: min(100%, 300px) !important; height: auto !important; }

/* O menu existente mantém a expansão pelo botão original. */
.agenda-mobile ul.topnav { position: relative; top: auto; margin: 0; padding: 8px 12px; background: var(--vermelho-agenda); box-shadow: none; list-style: none; }
.agenda-mobile ul.topnav li a { min-height: 44px; border-radius: 8px; padding: 10px 16px !important; color: #fff; line-height: 24px; text-decoration: none; }
.agenda-mobile ul.topnav li a:hover { background: #ffffff20 !important; }
.agenda-mobile :focus-visible { outline: 3px solid var(--laranja-agenda) !important; outline-offset: 3px; }
.agenda-mobile ul.topnav li a:focus-visible { outline-color: #fff !important; }

/* Seções e formulários, incluindo painéis abertos por postback. */
.agenda-mobile #wrapper .agenda-mobile-cartao { width: 100% !important; min-width: 0; max-width: 100%; padding: 20px; margin: 18px 0; border: 1px solid var(--borda-agenda); border-radius: 14px; background: var(--superficie-agenda); text-align: left; }
.agenda-mobile #wrapper .agenda-mobile-cartao .agenda-mobile-cartao { box-shadow: none; padding: 14px; background: var(--fundo-agenda); }
.agenda-mobile #wrapper fieldset { padding: 18px; border-radius: 14px; }
.agenda-mobile #wrapper .boxshadow, .agenda-mobile #wrapper .boxshadowmobile { box-shadow: 0 4px 18px #252a340a !important; border-radius: 14px; }
.agenda-mobile #wrapper div[style*="border: thin solid"], .agenda-mobile #wrapper fieldset[style*="border: thin solid"] { border: 1px solid var(--borda-agenda) !important; border-radius: 14px; padding: 14px; }
.agenda-mobile #wrapper table:not([id]) { max-width: 100%; }
.agenda-mobile #wrapper div[style*="width"], .agenda-mobile #wrapper span[style*="width"],
.agenda-mobile #wrapper td[width] { max-width: 100% !important; min-width: 0; }
.agenda-mobile #wrapper input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="image"]),
.agenda-mobile #wrapper select, .agenda-mobile #wrapper textarea {
    min-height: 48px; border-radius: 10px; font-size: 16px !important; line-height: 1.4;
}
.agenda-mobile #wrapper input[type="text"], .agenda-mobile #wrapper input[type="password"],
.agenda-mobile #wrapper input[type="email"], .agenda-mobile #wrapper input[type="tel"],
.agenda-mobile #wrapper input[type="date"], .agenda-mobile #wrapper select, .agenda-mobile #wrapper textarea {
    border: 1px solid #aeb6c1 !important; padding: 11px 12px !important; background: #fff !important; color: var(--texto-agenda) !important;
}
.agenda-mobile #wrapper textarea { min-height: 120px; }
.agenda-mobile #wrapper input[type="submit"], .agenda-mobile #wrapper input[type="button"], .agenda-mobile #wrapper button {
    height: auto !important; min-width: 0; padding: 11px 16px !important; margin: 6px 2px;
    border: 1px solid var(--vermelho-agenda) !important; background: var(--vermelho-agenda) !important;
    color: #fff !important; border-radius: 10px; box-shadow: 0 2px 5px #252a3410; white-space: normal;
}
.agenda-mobile #wrapper input[type="submit"]:hover, .agenda-mobile #wrapper button:hover { filter: brightness(.92); }
.agenda-mobile #wrapper input[id*="Cancelar"], .agenda-mobile #wrapper input[id*="Voltar"] { color: var(--vermelho-agenda) !important; background: #fff !important; box-shadow: none; }
.agenda-mobile #wrapper input[type="checkbox"], .agenda-mobile #wrapper input[type="radio"] { accent-color: var(--vermelho-agenda); width: 20px; height: 20px; vertical-align: middle; margin: 8px 6px; }
.agenda-mobile #wrapper label { line-height: 1.5; }
.agenda-mobile #wrapper [id*="LblMensagem"] { display: block; width: 100% !important; max-width: 100%; padding: 12px 14px; margin: 12px 0; border-radius: 10px; background: #fff4e8; color: var(--vermelho-agenda) !important; font-size: 15px !important; overflow-wrap: anywhere; }
.agenda-mobile #wrapper [id*="LblMensagem"]:empty { display: none; }
.agenda-mobile [id$="TxtMensagem"] { display: none !important; }
.agenda-mobile #FileImage[style*="visibility:hidden"], .agenda-mobile #FileImage[style*="visibility: hidden"] { display: none !important; }
.agenda-mobile #wrapper div:has(> #TxtComentario) { display: flex; flex-wrap: wrap; gap: 10px; width: 100% !important; }
.agenda-mobile #wrapper div:has(> #TxtComentario) > div { position: static !important; width: 100% !important; }
.agenda-mobile #wrapper #BtnComentar { width: 100% !important; margin-inline: 0; }
.agenda-mobile #wrapper div:has(> #DdlUF) { white-space: normal !important; }
.agenda-mobile #wrapper [id*="Qr_Code"] { overflow-wrap: anywhere; word-break: break-word; }
.agenda-mobile #wrapper img { object-fit: contain; }
.agenda-mobile #wrapper input[type="image"] { max-width: 100%; }
.agenda-mobile #wrapper input[id*="BtnCalendario"] { width: 44px; height: 44px; padding: 8px; border-radius: 10px; background: var(--fundo-agenda); }

/* Informações do perfil e links sociais permanecem disponíveis. */
.agenda-mobile .sidenavmobile { margin-bottom: 18px; padding: 16px !important; border: 1px solid var(--borda-agenda); border-radius: 14px; background: var(--fundo-agenda) !important; }
.agenda-mobile .sidenavmobile > div:first-child { grid-template-columns: 64px repeat(2, minmax(0, 1fr)); gap: 6px 10px; border-radius: 0 !important; }
.agenda-mobile .sidenavmobile > div:first-child > img { width: 64px !important; height: 64px !important; border: 3px solid #fff; object-fit: cover; }
.agenda-mobile .sidenavmobile > div:first-child > div { min-width: 0; }
.agenda-mobile .sidenavmobile a { min-height: 32px; align-items: center; font-size: 14px !important; overflow-wrap: anywhere; }
.agenda-mobile .sidenavmobile img[id*="AgendaPendente"] { width: 40px !important; height: auto !important; }
.agenda-mobile .sidenavmobile .NotificacaoRow { margin: 0; }
.agenda-mobile .sidenavmobile .NotificacaoBtn { display: flex !important; width: auto !important; min-width: 0; gap: 6px; padding: 6px !important; align-items: center; flex-wrap: wrap; }
.agenda-mobile .sidenavmobile .NotificacaoBtn span { position: static; width: auto; white-space: normal; }
.agenda-mobile .sidenavmobile .NotificacaoBtn .NotificacaoLbl { padding: 2px 6px; border-radius: 8px; }
.agenda-mobile .sidenavmobile #EviarFoto { margin: 12px 0 0; padding: 12px; background: #fff !important; }
.agenda-mobile .sidenavmobile #EviarFoto br { display: none; }

/* Tabelas: cartões já preparados pelo script existente e rolagem contida nas telas maiores. */
.agenda-mobile #wrapper .agenda-mobile-tabela { width: 100%; min-width: 0; max-width: 100%; margin: 16px 0; overflow-x: auto; border: 1px solid var(--borda-agenda); border-radius: 14px; }
.agenda-mobile #wrapper table[id*="Gdv"], .agenda-mobile #wrapper table[id*="gdv"] { margin: 0; font-size: 15px !important; }
.agenda-mobile #wrapper table[id*="Gdv"] th, .agenda-mobile #wrapper table[id*="gdv"] th { padding: 14px; font-weight: 700; border: 0; }
.agenda-mobile #wrapper table[id*="Gdv"] td, .agenda-mobile #wrapper table[id*="gdv"] td { padding: 12px; border-color: var(--borda-agenda); }
.agenda-mobile #wrapper table.grade-mobile td input[type="submit"], .agenda-mobile #wrapper table.grade-mobile td input[type="button"] { background: #fff !important; color: var(--vermelho-agenda) !important; box-shadow: none; }

/* Calendários mantêm seleção, formato de data e eventos originais. */
.agenda-mobile #wrapper .calendario-mobile[id] { width: 100% !important; max-width: 28rem !important; margin: 18px auto !important; padding: 8px; border-radius: 14px; font-size: 15px !important; }
.agenda-mobile #wrapper .calendario-mobile[id] td a { min-width: 30px; min-height: 38px; padding: 4px; font-size: 15px; }
.agenda-mobile #wrapper .calendario-mobile[id] > tbody > tr > td { height: 40px; }
.agenda-mobile #wrapper .calendario-mobile[id] > tbody > tr:first-child > td { background: var(--fundo-agenda) !important; color: var(--vermelho-agenda) !important; border-radius: 8px; }
.agenda-mobile #wrapper .calendario-mobile[id] table { display: table !important; width: 100% !important; table-layout: fixed; }
.agenda-mobile #wrapper .calendario-mobile[id] table tbody { display: table-row-group !important; }
.agenda-mobile #wrapper .calendario-mobile[id] table tr { display: table-row !important; margin: 0; }
.agenda-mobile #wrapper .calendario-mobile[id] table td { display: table-cell !important; padding: 4px 0 !important; text-align: center !important; overflow-wrap: anywhere; }
.agenda-mobile .ajax__calendar_container { width: 280px !important; max-width: calc(100vw - 32px); padding: 12px !important; border: 1px solid #dfe3e8 !important; border-radius: 14px; background: #fff !important; color: #252a34; box-shadow: 0 12px 32px #252a3420; }
.agenda-mobile .ajax__calendar_body { width: 252px !important; height: 210px !important; max-width: 100%; }
.agenda-mobile .ajax__calendar_days, .agenda-mobile .ajax__calendar_months, .agenda-mobile .ajax__calendar_years { width: 252px !important; max-width: 100%; height: 210px !important; }
.agenda-mobile .ajax__calendar_day, .agenda-mobile .ajax__calendar_dayname { width: 36px !important; height: 30px !important; line-height: 30px; }
.agenda-mobile .ajax__calendar_month, .agenda-mobile .ajax__calendar_year { width: 82px !important; height: 48px !important; }
.agenda-mobile .ajax__calendar_header, .agenda-mobile .ajax__calendar_footer { min-height: 32px; }
.agenda-mobile .ajax__calendar_active .ajax__calendar_day { border-radius: 6px; background: #AB1414 !important; color: #fff !important; }

.agenda-mobile #footer.rodape-modulo { border-radius: 14px; margin-top: 24px !important; }
.agenda-mobile #footer.rodape-modulo a { padding: 8px 0; min-height: 44px; }
@media (min-width: 761px) {
    .agenda-mobile #wrapper .recipiente-grade-mobile { overflow-x: auto !important; }
    .agenda-mobile #wrapper .grupo-calendarios-mobile > tbody > tr { display: flex; gap: 20px; }
    .agenda-mobile #wrapper .grupo-calendarios-mobile > tbody > tr > td { flex: 1; min-width: 0; }
}
@media (max-width: 760px) {
    .agenda-mobile #wrapper { width: calc(100% - 16px) !important; margin: 12px auto !important; padding: 16px !important; border-radius: 16px; }
    .agenda-mobile #wrapper .agenda-mobile-cartao { padding: 16px 12px; }
    .agenda-mobile #wrapper table:not([id]):not(.calendario-mobile),
    .agenda-mobile #wrapper table:not([id]):not(.calendario-mobile) > tbody,
    .agenda-mobile #wrapper table:not([id]):not(.calendario-mobile) > tbody > tr,
    .agenda-mobile #wrapper table:not([id]):not(.calendario-mobile) > tbody > tr > td { display: block; width: 100% !important; min-width: 0; max-width: 100%; }
    .agenda-mobile #wrapper table:not([id]) > tbody > tr > td { text-align: left !important; padding: 4px 0; }
    .agenda-mobile #wrapper .agenda-mobile-tabela:has(.grade-mobile) { overflow: visible !important; border: 0; background: transparent; }
    .agenda-mobile #wrapper table.grade-mobile tr { border: 1px solid var(--borda-agenda); border-top: 3px solid var(--vermelho-agenda); border-radius: 12px; box-shadow: 0 3px 12px #252a3408; }
    .agenda-mobile #wrapper table.grade-mobile td { grid-template-columns: minmax(90px, 37%) minmax(0, 1fr); gap: 12px; padding: 12px !important; font-size: 15px !important; }
    .agenda-mobile #wrapper table.grade-mobile td::before { color: var(--texto-apoio-agenda); font-size: 14px; font-weight: 400; }
    .agenda-mobile #wrapper table.grade-mobile td[data-titulo=""], .agenda-mobile #wrapper table.grade-mobile td:not([data-titulo]), .agenda-mobile #wrapper table.grade-mobile td[colspan] { grid-template-columns: minmax(0, 1fr); }
    .agenda-mobile #wrapper table.grade-mobile td input[type="submit"] { min-height: 44px; font-size: 15px !important; }
}
@media (max-width: 380px) {
    .agenda-mobile #wrapper { padding: 12px !important; }
    .agenda-mobile .sidenavmobile { padding: 10px !important; }
    .agenda-mobile .sidenavmobile > div:first-child { grid-template-columns: 48px repeat(2, minmax(0, 1fr)); gap: 6px; }
    .agenda-mobile .sidenavmobile > div:first-child > img { width: 48px !important; height: 48px !important; }
}

/* Login unificado: somente apresentação nas telas móveis, sem alterar o desktop. */
body:has(.agenda-content), .agenda-content *, .agenda-header *, .agenda-footer * { font-family: Calibri, "Segoe UI", Arial, sans-serif !important; }
@media (max-width: 760px) {
    body:has(.agenda-content), .agenda-content *, .agenda-header *, .agenda-footer * { font-family: Calibri, "Segoe UI", Arial, sans-serif !important; }
    body:has(.agenda-content) { background: #f4f5f7; font-size: 16px; }
    .agenda-header { flex-wrap: wrap; padding: 16px; gap: 6px 16px; border-bottom: 4px solid #FF6D00; }
    .agenda-header a { display: inline-flex; align-items: center; min-height: 40px; }
    .agenda-content { padding: 28px 16px 36px; }
    .agenda-hero { text-align: left; margin-bottom: 24px; }
    .agenda-hero h1 { font-size: 30px; line-height: 1.15; color: #252a34; }
    .agenda-hero p { margin-top: 12px; line-height: 1.5; }
    .agenda-card { padding: 24px 18px; border: 1px solid #dfe3e8; border-radius: 18px; box-shadow: 0 8px 24px #252a3408; }
    .agenda-field input, .agenda-field select { min-height: 48px; border-radius: 10px; font-size: 16px; }
    .agenda-grid { grid-template-columns: minmax(0, 1fr); }
    .agenda-button { min-height: 48px; height: auto; white-space: normal; border-radius: 10px; font-size: 16px; }
    .agenda-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .agenda-actions .agenda-button-primary, .agenda-actions .agenda-button-highlight { grid-column: 1 / -1; }
    .agenda-button-secondary { padding: 12px 8px; line-height: 1.35; }
    .agenda-check label { min-width: 0; line-height: 1.5; }
    .agenda-public-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .agenda-public-links a { display: grid; place-items: center; min-height: 48px; padding: 12px; border: 1px solid #dfe3e8; border-radius: 12px; background: #fff; color: #AB1414; }
    .agenda-message { border-radius: 12px; line-height: 1.5; }
    .agenda-footer { padding: 24px 16px; line-height: 1.6; font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: .95rem; }
    .agenda-footer a { display: inline-block; padding: 8px 4px; }
}
