#qrbox-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    border: 2px solid limegreen;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    pointer-events: none; /* permite clicar no botão abaixo */
}
#mensagens {
    margin-top: 5px;
}

.obs-mobile {
    word-break: break-word;
}

.valor-mobile,
.anexo-mobile {
    word-break: break-word;
}

.edit-manual-btn {
    margin-right: 0;
}

.icone-acao {
    margin: 0 2px;
    padding: 0;
    border-radius: 0;
    min-width: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

.detalhes-mobile-wrapper {
    display: inline-flex;
    align-items: center;
}

.detalhes-mobile-icon,
.detalhes-desktop-icon {
    line-height: 1;
    font-size: 1rem;
}

.mic-button {
    border-radius: 999px;
    padding: 1.25rem 2rem;
    min-width: 220px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.mic-button .mic-icon {
    font-size: 2.2rem;
}

.mic-button.recording {
    background: #dc3545;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(220, 53, 69, 0.4);
}

.mic-button.recording .mic-icon {
    animation: mic-pulse 1s infinite ease-in-out;
}

@keyframes mic-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

/* Destaca despesas pendentes vencidas */
.badge-pendente-blink {
    animation: badge-pendente-blink 1.2s ease-in-out infinite;
}

@keyframes badge-pendente-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* ========================= */
/* Navegação e Drawer Mobile */
/* ========================= */
:root {
    --drawer-bg-start: #6A0F25;
    --drawer-bg-end: #2B0A18;
    --drawer-solid: #4D0E1E;
    --drawer-overlay: rgba(0, 0, 0, 0.45);
    --card-entry: #E4F8ED;
    --card-manual: #E5EEFF;
    --card-future: #FFF7D1;
    --card-default: #FFFFFF;
    --card-valor: #1C7C3E;
    --card-text: #1a1a1a;
}

.app-shell {
    position: relative;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, var(--drawer-bg-start), var(--drawer-bg-end));
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
}

.topbar-user {
    margin-left: 0.75rem;
    align-items: center;
}

.topbar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.topbar-nav {
    margin-left: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-nav-link {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.topbar-nav-link i {
    font-size: 1.1rem;
}

.topbar-nav-link:hover,
.topbar-nav-link.active {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.18);
}

.brand-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.menu-toggle {
    border: none;
    background: transparent;
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.menu-toggle-bar {
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 999px;
}

.topbar-actions .btn {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: var(--drawer-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1040;
}

.drawer-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 78vw;
    max-width: 360px;
    height: 100vh;
    background: linear-gradient(180deg, var(--drawer-bg-start), var(--drawer-bg-end));
    color: #fff;
    transform: translateX(-105%);
    transition: transform 0.35s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    padding: 0 1.25rem 1.5rem;
}

.app-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0 0.1rem;
    min-height: 120px;
}

.drawer-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.1);
}

.drawer-user-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.drawer-user-email {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.drawer-plan-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
}

.drawer-plan-label img {
    width: 32px;
    height: 32px;
    transition: transform 0.6s ease;
    backface-visibility: hidden;
}

.drawer-plan-label.premium span {
    color: #ffd966;
    font-weight: 600;
}

.drawer-plan-label img.plan-flip {
    animation: drawerPlanFlip 0.8s ease;
}

@keyframes drawerPlanFlip {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.35rem 0;
}

.drawer-section-title {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.05rem 0.1rem;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.drawer-link i {
    font-size: 1.35rem;
    color: #fff;
}

.drawer-link.active,
.drawer-link:hover {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.12);
}

.drawer-link.active span,
.drawer-link:hover span {
    font-weight: 600;
}

.drawer-link.active i,
.drawer-link:hover i {
    color: #fff;
}

.drawer-divider {
    border-color: rgba(255, 255, 255, 0.2);
    margin: 0;
}

.drawer-section-account {
    margin-top: 0.5rem;
}

.drawer-link-button {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 0.6rem 1rem;
    background: transparent;
    width: 100%;
    text-align: left;
}

.drawer-link-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--drawer-solid, var(--drawer-bg-start));
    display: flex;
    justify-content: space-around;
    padding: 0.35rem 0;
    z-index: 1030;
}

/* ========================= */
/* Configurações / Temas     */
/* ========================= */
.config-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

.theme-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.theme-option {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
    padding: 1rem;
}

.theme-option.active {
    border-color: var(--drawer-bg-start);
    transform: translateY(-2px);
}

.theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-preview {
    height: 110px;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.theme-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.theme-meta strong {
    font-size: 1.05rem;
}

.theme-meta span {
    color: #6c757d;
    font-size: 0.9rem;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    font-size: 0.75rem;
    gap: 0.2rem;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: #fff;
    font-weight: 600;
}

body.drawer-open {
    overflow: hidden;
}

body.has-bottom-nav {
    padding-bottom: 70px;
}

@media (min-width: 992px) {
    body.has-bottom-nav {
        padding-bottom: 0;
    }
}

@media (min-width: 992px) {
    .menu-toggle {
        display: none;
    }
    .drawer-overlay,
    .app-drawer {
        display: none;
    }
    .bottom-nav {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .obs-mobile {
        font-size: 0.85rem;
    }
    .anexo-mobile,
    .valor-mobile {
        font-size: 0.8rem;
    }
    #paginacao .page-item {
        margin: 0;
    }
    #paginacao .page-link {
        padding: 0.25rem 0.45rem;
        min-width: 28px;
        text-align: center;
        border-radius: 0.25rem;
    }
}

/* ========================= */
/* Página: Lançamentos       */
/* ========================= */
body.pagina-lancamentos {
    margin: 0;
    background: #f5f5f7;
    color: var(--card-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.lancamentos-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 96px;
}

.lancamentos-header {
    margin: 12px 0 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lancamentos-header h1 {
    margin: 0;
    font-size: 2rem;
    color: #111;
    font-weight: 700;
}

.future-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #333;
}

.future-toggle input {
    width: 18px;
    height: 18px;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.data-group {
    margin-bottom: 28px;
}

.data-titulo {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--drawer-bg-start);
    margin-bottom: 12px;
    letter-spacing: 0.03em;
}

.flip-card {
    perspective: 1300px;
    margin-bottom: 12px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    min-height: 170px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.flip-card-inner.flipped {
    transform: rotateY(180deg);
}

.flip-card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.flip-card-front {
    color: var(--card-text);
}

.flip-card-back {
    transform: rotateY(180deg);
    color: #f4f4f6;
    background: #1C1E22;
}

.card-face-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.flip-card-back .card-top-row .estabelecimento {
    color: #fff;
}

.flip-card-back .card-top-row .valor {
    color: #76ffaf;
}

.estabelecimento {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.lancamento-categoria {
    font-size: 0.85rem;
    color: #666;
}

.flip-card-back .lancamento-categoria {
    color: rgba(255, 255, 255, 0.65);
}

.valor {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--card-valor);
    white-space: nowrap;
}

.observacao {
    color: #777;
    font-size: 0.95rem;
    margin: 0;
}

.flip-card-back .observacao {
    color: rgba(255, 255, 255, 0.75);
}

.card-flags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 32px;
}

.flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.flag-anexo {
    background: rgba(122, 16, 37, 0.14);
    color: var(--drawer-bg-start);
}

.flag-pendente {
    background: rgba(247, 211, 69, 0.2);
    color: #a27a00;
}

.flag-atrasado {
    background: rgba(217, 83, 79, 0.2);
    color: #b02a23;
    font-weight: 600;
}

.acoes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    flex-wrap: nowrap;
}

.acao-btn {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #f4f4f6;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 2px;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.85rem;
    line-height: 1.1;
}

.acao-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.acao-icone {
    font-size: 0.95rem;
}

.acao-btn.editar .acao-icone { color: #F7D345; }
.acao-btn.excluir .acao-icone { color: #D9534F; }
.acao-btn.cancelar .acao-icone { color: #E74C3C; }

.card-face-default { background: var(--card-default); }
.card-face-entry { background: var(--card-entry); }
.card-face-manual { background: var(--card-manual); }
.card-face-future { background: var(--card-future); }

.status-message {
    text-align: center;
    padding: 32px 0;
    color: #666;
    font-size: 1rem;
}

.pagination-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pagination-info {
    font-size: 0.95rem;
    color: #555;
}

.pagination-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.page-btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 40px;
}

.page-btn.active {
    background: var(--drawer-bg-start);
    color: #fff;
    border-color: var(--drawer-bg-start);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.card-tip {
    font-size: 0.78rem;
    color: #888;
    margin-top: auto;
    display: block;
}

.flip-card-attachment .card-tip {
    color: #6750A4;
    font-weight: 600;
}

/* ========================= */
/* Bottom Sheet de Anexos    */
/* ========================= */
body.sheet-open,
body.viewer-open {
    overflow: hidden;
}

.attachment-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 900;
}

.attachment-sheet-overlay.visible {
    opacity: 1;
}

.attachment-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 70vh;
    background: #F6F2FF;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.15);
    padding: 24px 24px 32px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 950;
    color: #1C1B1F;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.attachment-bottom-sheet.open {
    transform: translateY(0);
}

.attachment-bottom-sheet .sheet-handle {
    width: 48px;
    height: 6px;
    border-radius: 999px;
    background: #CCCCCC;
    margin: 0 auto;
}

.attachment-bottom-sheet .sheet-close {
    position: absolute;
    top: 18px;
    right: 18px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    color: #6750A4;
    cursor: pointer;
}

.sheet-header {
    text-align: left;
    margin-top: 16px;
}

.sheet-title {
    font-size: 1.35rem;
    color: #6750A4;
    font-weight: 600;
    margin-bottom: 8px;
}

.sheet-date {
    display: inline-flex;
    align-items: center;
    padding: 4px 16px;
    border-radius: 999px;
    background: #E8DEF8;
    color: #6750A4;
    font-weight: 600;
    margin-bottom: 10px;
}

.sheet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sheet-meta-item {
    font-size: 0.95rem;
    color: #1C1B1F;
}

.sheet-meta-item[data-sheet-categoria] {
    border-radius: 999px;
    padding: 4px 12px;
    font-weight: 600;
    background: #E9E1FF;
    color: #6750A4;
}

.sheet-meta-item[data-variant="entrada"] {
    background: #E4F8ED;
    color: #1C7C3E;
}

.sheet-meta-item[data-variant="manual"] {
    background: #FEE4EA;
    color: #A61B4A;
}

.sheet-divider {
    border: none;
    border-top: 1px solid #D4C7F0;
    margin: 0;
}

.sheet-observacao h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    color: #6750A4;
}

.sheet-observacao p {
    margin: 0;
    color: #1C1B1F;
    word-break: break-word;
}

.sheet-anexos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet-anexos-title {
    font-weight: 600;
    color: #6750A4;
}

.sheet-anexos-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.sheet-anexos-empty {
    margin: 0;
    color: #666;
    font-size: 0.92rem;
}

.sheet-anexo-thumb {
    min-width: 120px;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #1C1B1F;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-align: left;
}

.sheet-anexo-thumb:hover {
    transform: translateY(-4px);
}

.thumb-preview {
    width: 100%;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FAF9FF;
}

.thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-preview.thumb-preview-file {
    font-size: 1.7rem;
    color: #6750A4;
    border: 1px dashed #D4C7F0;
}

.thumb-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1C1B1F;
    word-break: break-word;
}

.sheet-actions {
    margin-top: auto;
    display: flex;
    gap: 12px;
}

.sheet-actions button {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6A0F25, #2B0A18);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.sheet-actions button:hover {
    opacity: 0.93;
}

/* ========================= */
/* Viewer Fullscreen         */
/* ========================= */
.attachment-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1050;
    padding: 16px;
}

.attachment-viewer.open {
    opacity: 1;
    pointer-events: auto;
}

.viewer-panel {
    width: 100%;
    max-width: 960px;
    height: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #fff;
}

.viewer-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.viewer-back {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 8px 16px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.viewer-file-name {
    flex: 1;
    font-weight: 600;
    min-width: 160px;
    word-break: break-word;
}

.viewer-header-actions {
    display: flex;
    gap: 8px;
}

.viewer-btn {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.viewer-body {
    flex: 1;
    min-height: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
}

.viewer-body img,
.viewer-body iframe {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    border: none;
    background: #000;
}

.attachment-viewer [data-viewer-image],
.attachment-viewer [data-viewer-frame],
.attachment-viewer [data-viewer-fallback] {
    display: none;
}

.viewer-body iframe {
    width: 100%;
    height: 100%;
}

.viewer-fallback {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    text-align: center;
}

.viewer-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    overflow-x: auto;
}

.viewer-thumb {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
}

.viewer-thumb.active {
    border-color: #F6F2FF;
    background: rgba(255, 255, 255, 0.2);
}

.viewer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .attachment-bottom-sheet {
        padding: 18px 18px 28px;
    }
    .sheet-actions {
        flex-direction: column;
    }
    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .viewer-panel {
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .flip-card-face {
        padding: 18px;
    }

    .card-top-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .acoes {
        flex-direction: row;
    }
}

/* ========================= */
/* Página: Login             */
/* ========================= */
body.pagina-login {
    margin: 0;
    min-height: 100vh;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    background: #000;
}

.login-background {
    position: fixed;
    inset: 0;
    background-image: url('https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1600&q=80');
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.login-card {
    width: 85%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 32px;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-logo img {
    width: 84px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.login-logo-text {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.login-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.google-btn {
    width: 100%;
    height: 50px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #fff;
    color: #333;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 15px 32px rgba(0, 0, 0, 0.25);
}

.google-btn img {
    width: 20px;
    height: 20px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.35);
}

.login-field {
    position: relative;
}

.login-field input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    padding: 12px 12px 12px 42px;
    font-size: 0.95rem;
}

.login-field input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-field svg {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: rgba(255, 255, 255, 0.75);
}

.login-primary-btn {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: none;
    background: #7A0026;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.2s ease;
}

.login-primary-btn:hover {
    background: #8d1236;
}

.login-msg {
    min-height: 32px;
    font-size: 0.85rem;
}

.login-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 2;
}

/* ========================= */
/* Página: Ler QRCode        */
/* ========================= */
body.pagina-ler-qr {
    background: #fff;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

.qr-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 80px;
}

.qr-hero {
    margin-bottom: 12px;
}

.qr-hero h1 {
    font-size: 2rem;
    color: #5a0a18;
    font-weight: 600;
    margin-bottom: 8px;
}

.qr-hero p {
    color: #6c757d;
    margin-bottom: 24px;
}

.qr-reader-card {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.08);
    text-align: center;
    position: relative;
    overflow: visible;
}

.qr-frame {
    border: 2px solid #21c451;
    border-radius: 24px;
    max-width: 360px;
    width: 100%;
    aspect-ratio: 1;
    margin: 0 auto 16px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.qr-frame:focus-visible {
    outline: 3px solid #5a0a18;
}

.qr-frame:hover {
    transform: translateY(-2px);
}

.qr-reader,
#reader,
#reader > div {
    position: absolute !important;
    inset: 12px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    width: calc(100% - 24px) !important;
    height: calc(100% - 24px) !important;
}

#reader video,
#reader canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.qr-placeholder {
    width: 120px;
    opacity: 0.8;
    pointer-events: none;
    transition: opacity 0.2s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.qr-placeholder.hidden {
    opacity: 0;
}

.qr-status {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 16px;
}

.ia-status-badge {
    display: inline-flex;
    align-items: left;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(90, 10, 24, 0.12);
    color: #5a0a18;
    font-weight: 500;
    font-size: 0.78rem;
    margin-bottom: 10px;
}

.mini-loader {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--drawer-bg-start);
    animation: mini-spin 0.8s linear infinite;
    margin: 8px auto;
}

@keyframes mini-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ia-status-badge.online {
    background: rgba(33, 196, 81, 0.15);
    color: #13833a;
}

.ia-status-badge.offline {
    background: rgba(240, 173, 78, 0.2);
    color: #b06b00;
}

.qr-settings-toggle {
    background: transparent;
    border: none;
    color: #5a0a18;
    font-size: 1.4rem;
    cursor: pointer;
    margin-bottom: 16px;
}

.qr-settings-card {
    background: #5a0a18;
    color: #fff;
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(90, 10, 24, 0.3);
    width: 100%;
    max-width: 420px;
    margin: 0 auto 20px;
    display: none;
}

.qr-settings-card.open {
    display: block;
}

.qr-settings-card label {
    font-weight: 500;
}

.ai-provider-label {
    font-weight: 500;
}

.qr-settings-card .ai-provider-label {
    color: rgba(255, 255, 255, 0.92);
}

.xml-card .ai-provider-label {
    color: #5a0a18;
}

.qr-primary-btn {
    background: #1f6feb;
    border: none;
    color: #fff;
    padding: 12px 32px;
    border-radius: 999px;
    font-weight: 600;
    min-width: 200px;
    box-shadow: 0 15px 30px rgba(31, 111, 235, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qr-primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(31, 111, 235, 0.35);
}

.qr-feedback {
    margin-top: 32px;
}

.qr-feedback > div {
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .qr-reader-card {
        padding: 24px 16px;
    }
}

/* ========================= */
/* Página: Leitura de XML    */
/* ========================= */
body.pagina-ler-xml {
    background: #f9f7f8;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

.xml-shell {
    max-width: 840px;
    margin: 0 auto;
    padding: 32px 16px 80px;
}

.xml-shell h1 {
    color: #5a0a18;
    font-size: 1.9rem;
    font-weight: 600;
}

.xml-shell p {
    color: #6c757d;
}

.xml-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.xml-card .form-group label {
    font-weight: 500;
    color: #5a0a18;
}

.xml-primary-btn {
    background: #7A0026;
    border: none;
    color: #fff;
    border-radius: 12px;
    padding: 12px 28px;
    font-weight: 600;
    box-shadow: 0 15px 40px rgba(122, 0, 38, 0.25);
}

.xml-result,
#xml-result {
    margin-top: 24px;
}

.push-permission-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.drawer-link-button.push-permission-cta {
    width: 100%;
    justify-content: flex-start;
}

.push-activate-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    .push-activate-grid {
        flex-direction: row;
        align-items: flex-end;
    }
    .push-activate-grid .form-group {
        flex: 1;
        margin-bottom: 0;
    }
}

.push-subscriptions-list .alert {
    border-radius: 12px;
}

.push-subscription {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
}

.push-subscription-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 768px) {
    .push-subscription-body {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.push-subscription-main {
    flex: 1;
}

.push-subscription-label-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.push-subscription-meta small {
    display: block;
}

.push-subscription-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.push-check-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    .push-check-grid {
        flex-direction: row;
        align-items: flex-end;
        gap: 24px;
    }
    .push-check-grid .flex-grow-1 {
        flex: 1;
    }
}
