:root {
    --bg-color: #f6f3f5;
    --text-dark: #222222;
    --text-gray: #8e8e93;
    --border-color: #d1d1d6;
    --active-blue: #1c2b4c;

    /* Layout global do aplicativo */
    --top-nav-height: 104px;
    --tabs-height: 64px;
    --bottom-nav-height: 84px;
    --top-title-size: 17px;
    --top-title-x: 16px;
    --top-title-y: -8px;
    --tab-frente-size: 14px;
    --tab-frente-x: 0px;
    --tab-frente-y: 0px;
    --tab-verso-size: 14px;
    --tab-verso-x: 0px;
    --tab-verso-y: 0px;
    --tab-qr-size: 14px;
    --tab-qr-x: 0px;
    --tab-qr-y: 0px;
    --bottom-label-size: 12px;
    --update-font-size: 13px;
    --update-offset-x: 0px;
    --update-offset-y: 0px;

    /* Aliases usados pelas duas telas */
    --wallet-top-nav-height: var(--top-nav-height);
    --wallet-title-size: var(--top-title-size);
    --wallet-title-x: 0px;
    --wallet-title-y: var(--top-title-y);
    --wallet-bottom-nav-height: var(--bottom-nav-height);
    --wallet-bottom-label-size: var(--bottom-label-size);
    --wallet-bottom-padding-top: 14px;
    --wallet-bottom-padding-bottom: 26px;
    --wallet-wallet-font-size: 12px;
    --wallet-services-font-size: 12px;
    --wallet-options-font-size: 12px;
    --wallet-wallet-icon-size: 24px;
    --wallet-services-icon-size: 24px;
    --wallet-options-icon-size: 24px;
    --wallet-wallet-gap: 6px;
    --wallet-services-gap: 6px;
    --wallet-options-gap: 6px;
    --document-top-nav-height: 112px;
    --document-title-size: var(--top-title-size);
    --document-title-x: var(--top-title-x);
    --document-title-y: var(--top-title-y);
    --document-tabs-height: var(--tabs-height);
    --document-tabs-font-size: var(--tab-frente-size);
    --document-tab-frente-size: var(--tab-frente-size);
    --document-tab-frente-x: var(--tab-frente-x);
    --document-tab-frente-y: var(--tab-frente-y);
    --document-tab-verso-size: var(--tab-verso-size);
    --document-tab-verso-x: var(--tab-verso-x);
    --document-tab-verso-y: var(--tab-verso-y);
    --document-tab-qr-size: var(--tab-qr-size);
    --document-tab-qr-x: var(--tab-qr-x);
    --document-tab-qr-y: var(--tab-qr-y);
    --document-bottom-nav-height: var(--bottom-nav-height);
    --document-bottom-label-size: var(--bottom-label-size);
    --document-bottom-padding-top: 14px;
    --document-bottom-padding-bottom: 26px;
    --document-wallet-font-size: 12px;
    --document-services-font-size: 12px;
    --document-options-font-size: 12px;
    --document-wallet-icon-size: 24px;
    --document-services-icon-size: 24px;
    --document-options-icon-size: 24px;
    --document-wallet-gap: 6px;
    --document-services-gap: 6px;
    --document-options-gap: 6px;
    --document-update-font-size: var(--update-font-size);
    --document-update-offset-x: var(--update-offset-x);
    --document-update-offset-y: var(--update-offset-y);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #ffffff;
    color-scheme: light;
}

body {
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    overscroll-behavior: none;
}

/* Launch screen exibida ao abrir a carteira no navegador ou como PWA instalado. */
.launch-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100dvh;
    background: #ffffff;
    opacity: 1;
    pointer-events: all;
    transition: opacity 150ms ease-out;
}

.launch-screen img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 414px;
    object-fit: contain;
    background: #ffffff;
}

.launch-screen.is-leaving {
    opacity: 0;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .launch-screen {
        transition: none;
    }
}

.app-container {
    width: 100%;
    max-width: 414px;
    height: 100vh;
    height: 100dvh; /* Suporte para navegadores modernos */
    background-color: #ffffff;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Respeita a área da barra de status no iPhone */
    padding-top: env(safe-area-inset-top);
}

/* Top Bar & Tabs */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--document-top-nav-height);
    min-height: var(--document-top-nav-height);
    padding: 18px 20px 12px;
    background-color: #ffffff;
    flex-shrink: 0;
}

.top-bar .title {
    font-size: var(--document-title-size);
    font-weight: 500;
    color: var(--text-dark);
    transform: translate(var(--document-title-x), var(--document-title-y));
}
.right-icons { display: flex; gap: 16px; }

.icon-btn {
    background: none; border: none; color: var(--text-dark);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: opacity 0.1s ease;
}
.icon-btn:active, .nav-item:active, .tab:active { opacity: 0.5; }

.tabs {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    height: var(--document-tabs-height);
    min-height: var(--document-tabs-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tab {
    height: 100%;
    background: none;
    border: none;
    color: var(--text-gray);
    padding: 0 4px 12px;
    cursor: pointer;
    flex: 1;
    text-align: center;
    font-size: var(--document-tabs-font-size);
    font-weight: 500;
    transition: opacity 0.1s ease;
    border-bottom: 2px solid transparent;
}
.tab:nth-child(1) { font-size: var(--document-tab-frente-size); transform: translate(var(--document-tab-frente-x), var(--document-tab-frente-y)); }
.tab:nth-child(2) { font-size: var(--document-tab-verso-size); transform: translate(var(--document-tab-verso-x), var(--document-tab-verso-y)); }
.tab:nth-child(3) { font-size: var(--document-tab-qr-size); transform: translate(var(--document-tab-qr-x), var(--document-tab-qr-y)); }
.tab.active { color: var(--active-blue); border-bottom: 2px solid var(--active-blue); }

/* Main Content Area */
.content {
    flex: 1; 
    width: 100%;
    min-height: 0; /* Essencial para que o flex-item encolha se necessário */
    position: relative;
}

.swiper {
    width: 100%;
    height: 100%;
}

.swiper-wrapper {
    height: 100%;
}

.swiper-slide {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Gestão das Telas (Views) */
.view-section {
    display: flex; 
    width: 100%;
    height: 100%; 
    flex-direction: column;
    padding: 12px 16px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Garante que a imagem caiba sem distorcer */
    border-radius: 0;
    box-shadow: none;
}

/* --- VIEW: QR Code --- */
#qr-view {
    justify-content: flex-start; /* QR Code costuma ficar melhor no topo */
}

.qr-card {
    background: #ffffff;
    width: 100%;
    flex: 1; 
    border-radius: 12px;
    padding: 24px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); 
    min-height: 0; 
}

.qr-image {
    width: 100%; 
    flex: 1; 
    min-height: 0; 
    object-fit: contain; 
    margin-bottom: 24px;
}

.progress-container {
    width: 100%;
    height: 4px;
    background-color: #eadae6; 
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background-color: #403954; 
    width: 100%;
    transition: width 1s linear;
}

.timer-text {
    font-size: 13px;
    color: #8c8c8c;
    font-weight: 500;
    flex-shrink: 0;
}

.info-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #eeefff; 
    border: 1px solid #d4d7ef; 
    border-radius: 10px;
    padding: 16px;
    width: 100%;
    flex-shrink: 0;
}

.info-box span {
    font-size: 13px;
    color: #4c4c70; 
    line-height: 1.4;
    font-weight: 400;
}

/* Update Info */
.update-info {
    background-color: var(--bg-color);
    flex-shrink: 0;
    height: 42px;
    min-height: 42px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--document-update-font-size);
    color: var(--text-gray);
    position: relative;
    transform: translate(var(--document-update-offset-x), var(--document-update-offset-y));
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    height: var(--document-bottom-nav-height);
    min-height: var(--document-bottom-nav-height);
    background-color: #ffffff;
    padding: var(--document-bottom-padding-top) 30px calc(var(--document-bottom-padding-bottom) + env(safe-area-inset-bottom));
    border-top: 0;
    border-radius: 0;
    flex-shrink: 0;
}

.nav-item {
    min-width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--document-wallet-gap);
    color: var(--text-gray);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: opacity 0.1s ease;
}
.nav-item svg { width: var(--document-wallet-icon-size); height: var(--document-wallet-icon-size); }
.nav-item:nth-child(2) { gap: var(--document-services-gap); }
.nav-item:nth-child(2) svg { width: var(--document-services-icon-size); height: var(--document-services-icon-size); }
.nav-item:nth-child(3) { gap: var(--document-options-gap); }
.nav-item:nth-child(3) svg { width: var(--document-options-icon-size); height: var(--document-options-icon-size); }
.nav-item.active { color: var(--active-blue); }
.nav-item.active svg { stroke: var(--active-blue); }
.bottom-nav .nav-item[data-document-nav="wallet"].active,
.bottom-nav .nav-item[data-document-nav="wallet"].active svg { color: var(--active-blue); stroke: var(--active-blue); }
.nav-item span { position: relative; top: 8px; font-size: var(--document-wallet-font-size); font-weight: 500; }
.nav-item:nth-child(2) span { font-size: var(--document-services-font-size); }
.nav-item:nth-child(3) span { font-size: var(--document-options-font-size); }


/* Modo carteira — cliente de teste t99. Usa a paleta e a tipografia da base RG. */
.wallet-home {
    width: 100%;
    max-width: 414px;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    background: #ffffff;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    /* A wallet permanece íntegra sob o documento; apenas o detalhe desliza. */
    transition: none;
}
.wallet-home[hidden] { display: none; }
.wallet-home.is-exiting,
.wallet-home.is-returning {
    transform: none;
    opacity: 1;
}

.wallet-header {
    display: flex;
    justify-content: center;
    align-items: center;
    height: var(--wallet-top-nav-height);
    min-height: var(--wallet-top-nav-height);
    padding: 18px 20px 12px;
    background: #ffffff;
    border-bottom: 0;
    flex-shrink: 0;
}

.wallet-header h1 {
    font-size: var(--wallet-title-size);
    transform: translate(var(--wallet-title-x), var(--wallet-title-y));
    line-height: 1;
    font-weight: 500;
    letter-spacing: -0.035em;
}

.wallet-content {
    flex: 1;
    min-height: 0;
    touch-action: pan-y;
    padding: 24px 20px 20px;
    background: var(--bg-color);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.wallet-content h2 {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.wallet-card {
    position: relative;
    width: 100%;
    min-height: 118px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    border: 1px solid rgba(34, 34, 34, 0.055);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text-dark);
    text-align: left;
    box-shadow: 0 4px 12px rgba(34, 34, 34, 0.035);
    cursor: pointer;
    transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1), background-color 180ms ease, box-shadow 180ms ease;
}

.wallet-card:hover { background: rgba(255, 255, 255, 0.82); box-shadow: 0 6px 16px rgba(34, 34, 34, 0.055); }
.wallet-card:active { transform: scale(0.985); }
.wallet-card.is-opening { pointer-events: none; }
.wallet-card:focus-visible, .wallet-add:focus-visible { outline: none; }

/* Em telas sensíveis ao toque, o realce do navegador não deve aparecer como seleção. */
.wallet-mode button {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    user-select: none;
}
.wallet-mode .wallet-card:focus,
.wallet-mode .wallet-add:focus,
.wallet-mode .tab:focus,
.wallet-mode .icon-btn:focus,
.wallet-mode .nav-item:focus,
.wallet-mode .wallet-nav-item:focus {
    outline: none;
    box-shadow: none;
}

.wallet-card-badge {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    border-radius: 50%;
    background: #ececef;
    color: #72727b;
}

.wallet-card-badge svg { width: 22px; height: 22px; }
.wallet-card-badge .sao-paulo-flag { width: 24px; height: 16px; }

.wallet-card-copy {
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
}

.wallet-card-title {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.wallet-card-copy strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 400;
    letter-spacing: -0.025em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.wallet-card-number {
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: -0.015em;
}

.wallet-card-number b { font-weight: 400; }
.wallet-card-arrow { width: 19px; height: 19px; flex: 0 0 19px; color: var(--active-blue); }

.wallet-add {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 21px;
    border: 1px solid rgba(28, 43, 76, 0.72);
    border-radius: 7px;
    background: transparent;
    color: var(--active-blue);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.wallet-add { cursor: pointer; }
.wallet-add:active { transform: scale(0.985); }
.wallet-add-plus { font-size: 28px; line-height: 0.7; font-weight: 400; color: var(--active-blue); }

.wallet-bottom-nav {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    height: var(--wallet-bottom-nav-height);
    min-height: var(--wallet-bottom-nav-height);
    padding: var(--wallet-bottom-padding-top) 30px calc(var(--wallet-bottom-padding-bottom) + env(safe-area-inset-bottom));
    border-top: 0;
    background: #ffffff;
    flex-shrink: 0;
}

.wallet-nav-item {
    min-width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--wallet-wallet-gap);
    border: 0;
    background: transparent;
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.wallet-nav-item svg { width: var(--wallet-wallet-icon-size); height: var(--wallet-wallet-icon-size); }
.wallet-nav-item:nth-child(2) { gap: var(--wallet-services-gap); }
.wallet-nav-item:nth-child(2) svg { width: var(--wallet-services-icon-size); height: var(--wallet-services-icon-size); }
.wallet-nav-item:nth-child(3) { gap: var(--wallet-options-gap); }
.wallet-nav-item:nth-child(3) svg { width: var(--wallet-options-icon-size); height: var(--wallet-options-icon-size); }
.wallet-nav-item span { position: relative; top: 8px; font-size: var(--wallet-wallet-font-size); }
.wallet-nav-item:nth-child(2) span { font-size: var(--wallet-services-font-size); }
.wallet-nav-item:nth-child(3) span { font-size: var(--wallet-options-font-size); }
.wallet-nav-item.is-active { color: var(--active-blue); }
.wallet-nav-item.is-active svg { stroke: var(--active-blue); }
.wallet-nav-item:not(.is-active) { cursor: pointer; }
.wallet-nav-item:active { transform: scale(0.97); }

.wallet-toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 50;
    max-width: calc(100% - 40px);
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--active-blue);
    color: #ffffff;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    box-shadow: 0 5px 16px rgba(28, 43, 76, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 180ms ease-out, transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wallet-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.qr-scanner-view {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    background: #11131a;
    color: var(--text-dark);
}
.qr-scanner-view[hidden] { display: none; }
.qr-scanner-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    min-height: calc(var(--wallet-top-nav-height) + env(safe-area-inset-top));
    padding: calc(env(safe-area-inset-top) + 18px) 22px 14px 54px;
    background: #ffffff;
}
.qr-scanner-header p {
    max-width: 300px;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
}
.qr-scanner-close {
    position: absolute;
    left: 16px;
    bottom: 13px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-dark);
}
.qr-scanner-close svg { width: 21px; height: 21px; }
.qr-scanner-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #11131a;
}
.qr-scanner-stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.qr-scanner-frame {
    position: relative;
    z-index: 2;
    width: min(72vw, 300px);
    aspect-ratio: 1;
    border: 2px solid #ffffff;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(17, 19, 26, 0.58);
}
.qr-scanner-frame::before,
.qr-scanner-frame::after,
.qr-scanner-frame span::before,
.qr-scanner-frame span::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: var(--active-blue);
    border-style: solid;
}
.qr-scanner-frame::before { left: -3px; top: -3px; border-width: 4px 0 0 4px; border-radius: 10px 0 0; }
.qr-scanner-frame::after { right: -3px; top: -3px; border-width: 4px 4px 0 0; border-radius: 0 10px 0 0; }
.qr-scanner-frame span::before { left: -3px; bottom: -3px; border-width: 0 0 4px 4px; border-radius: 0 0 0 10px; }
.qr-scanner-frame span::after { right: -3px; bottom: -3px; border-width: 0 4px 4px 0; border-radius: 0 0 10px; }
.qr-scanner-status {
    position: absolute;
    z-index: 3;
    left: 20px;
    right: 20px;
    bottom: 28px;
    margin: 0;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

@media (max-width: 360px) {
    .wallet-content { padding-inline: 18px; }
    .wallet-card { gap: 10px; padding-inline: 12px; min-height: 112px; }
    .wallet-card-badge { width: 38px; height: 38px; flex-basis: 38px; }
    .wallet-card-title { font-size: 14px; }
        .wallet-card-copy strong { font-size: 15px; }
    .wallet-card-number { font-size: 12px; }
}

/* O documento desliza sobre a carteira, sem mudar a URL nem sair da página. */
.app-container.is-inline-document {
    position: fixed;
    inset: 0;
    z-index: 30;
    width: 100%;
    max-width: 414px;
    margin: 0 auto;
    transform: translate3d(100%, 0, 0);
    opacity: 1;
    visibility: hidden;
    will-change: transform;
    backface-visibility: hidden;
    transition: transform 320ms cubic-bezier(0.23, 1, 0.32, 1), visibility 0s linear 320ms;
}
.app-container.is-inline-document.is-entering {
    transform: translate3d(100%, 0, 0);
    opacity: 1;
    visibility: visible;
    transition: none;
}
.app-container.is-inline-document.is-visible {
    transform: translate3d(0, 0, 0);
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}
.app-container.is-inline-document.is-leaving {
    transform: translate3d(100%, 0, 0);
    opacity: 1;
    visibility: visible;
}

/* Troca direta do documento para uma seção do bottom nav. */
.wallet-home.is-document-transitioning {
    overflow: hidden;
}
.app-container.is-document-to-section-leaving {
    transform: translateX(-100%);
    visibility: visible;
}
.wallet-subview.is-document-target-enter {
    transform: translateX(100%);
    opacity: 0;
}
.wallet-subview.is-document-target-visible {
    transform: translateX(0);
    opacity: 1;
    transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 220ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .wallet-card,
    .wallet-home,
    .wallet-add,
    .wallet-nav-item,
    .app-container.is-inline-document,
    .wallet-toast,
    .wallet-content,
    .wallet-subview {
        transition: none;
    }
}
/* A regra nativa [hidden] perde para o display flex do layout legado; manter o modo isolado. */
.app-container[hidden],
#legacy-document-view[hidden] {
    display: none !important;
}


/* Editor visual opcional: aparece apenas nas URLs de preview com ?editor=1. */
.layout-editor[hidden],
.layout-editor-open[hidden] {
    display: none !important;
}

.layout-editor {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(28, 43, 76, 0.2);
    padding: 16px;
}

.layout-editor-panel {
    width: min(100%, 393px);
    max-height: min(88dvh, 760px);
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 8px 8px;
    background: #ffffff;
    color: var(--text-dark);
    box-shadow: 0 14px 44px rgba(28, 43, 76, 0.22);
}

.layout-editor-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.layout-editor-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--active-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.layout-editor-heading h2 {
    font-size: 20px;
    line-height: 1.1;
    font-weight: 600;
}

.layout-editor-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f2f4;
    color: var(--text-dark);
    font-size: 24px;
    line-height: 1;
}

.layout-editor-help {
    margin: 10px 0 14px;
    color: var(--text-gray);
    font-size: 12px;
    line-height: 1.35;
}

.layout-editor fieldset {
    margin: 0 0 12px;
    padding: 11px 12px 8px;
    border: 1px solid #e4e5e8;
    border-radius: 10px;
}

.layout-editor legend {
    padding: 0 5px;
    color: var(--active-blue);
    font-size: 13px;
    font-weight: 700;
}

.layout-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    align-items: center;
    margin: 10px 0;
    color: var(--text-dark);
    font-size: 12px;
    line-height: 1.2;
}

.layout-control output {
    color: var(--active-blue);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.layout-control input[type='range'] {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--active-blue);
}

.layout-editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.layout-editor-actions button {
    min-height: 40px;
    border: 1px solid rgba(28, 43, 76, 0.72);
    border-radius: 8px;
    background: #ffffff;
    color: var(--active-blue);
    font-size: 12px;
    font-weight: 600;
}

.layout-editor-actions button:last-child {
    background: var(--active-blue);
    color: #ffffff;
}

.layout-editor-status {
    display: block;
    min-height: 18px;
    margin-top: 9px;
    color: var(--text-gray);
    font-size: 11px;
    text-align: center;
}

.layout-editor-open {
    position: fixed;
    right: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 90;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid rgba(28, 43, 76, 0.2);
    border-radius: 8px;
    background: #ffffff;
    color: var(--active-blue);
    box-shadow: 0 4px 14px rgba(28, 43, 76, 0.12);
    font-size: 11px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .layout-editor-panel,
    .layout-editor-open {
        transition: none;
    }
}

/* Telas de Serviços e Opções — mesmo enquadramento visual da Wallet. */
.wallet-subview {
    flex: 1;
    min-height: 0;
    touch-action: pan-y;
    overflow-y: auto;
    background: var(--bg-color);
    -webkit-overflow-scrolling: touch;
    transform: translateX(0);
    opacity: 1;
    transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1), opacity 220ms ease-out;
}
.wallet-content {
    transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1), opacity 220ms ease-out;
}
.wallet-subview[hidden], .wallet-subview-panel[hidden] { display: none; }
.wallet-subview.is-entering, .wallet-content.is-entering { transform: translateX(100%); opacity: 0; }
.wallet-subview.is-entering-back, .wallet-content.is-entering-back { transform: translateX(-100%); opacity: 0; }
.wallet-subview.is-visible, .wallet-content.is-visible { transform: translateX(0); opacity: 1; }
.wallet-subview.is-leaving, .wallet-content.is-leaving { transform: translateX(-100%); opacity: 0; }
.wallet-subview.is-leaving-back, .wallet-content.is-leaving-back { transform: translateX(100%); opacity: 0; }
.wallet-subview-panel {
    min-height: 100%;
    padding: 27px 20px 24px;
}
.wallet-list-row {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--text-dark);
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.wallet-list-row:active { opacity: 0.58; }
.wallet-list-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 43, 76, 0.055);
    color: var(--active-blue);
}
.wallet-list-icon svg { width: 21px; height: 21px; }
.wallet-list-icon img {
    width: 25px;
    height: 25px;
    display: block;
    object-fit: contain;
    object-position: center;
}
#options-view .wallet-list-icon img {
    width: 28px;
    height: 28px;
}
.wallet-list-row[data-service-action="second-copy"] .wallet-list-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 43, 76, 0.055);
}
.wallet-list-row[data-service-action="second-copy"] .wallet-list-icon img {
    width: 25px;
    height: 25px;
    object-fit: contain;
}
#services-list-view {
    min-height: 0;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(28, 43, 76, 0.10);
}
.wallet-list-label {
    flex: 1;
    min-width: 0;
    color: var(--text-dark);
    font-size: 13px;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: -0.015em;
}
.wallet-list-chevron { width: 17px; height: 17px; flex: 0 0 17px; color: var(--active-blue); }
.service-detail-panel { padding-top: 8px; display: flex; flex-direction: column; }
.service-detail-illustration {
    width: 142px;
    height: 128px;
    margin: 4px auto 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.service-detail-illustration img {
    width: 142px;
    height: 128px;
    display: block;
    object-fit: contain;
    mix-blend-mode: multiply;
}
.service-detail-message { margin: 0 auto 8px; max-width: 300px; color: var(--text-dark); font-size: 13px; line-height: 1.35; font-weight: 500; text-align: left; }
.service-detail-help { margin: 0 auto; max-width: 300px; color: var(--text-gray); font-size: 11px; line-height: 1.35; font-weight: 400; text-align: left; }
.service-detail-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 28px; }
.service-primary-button, .service-secondary-button { width: 100%; min-height: 42px; border-radius: 5px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.service-primary-button { border: 1px solid var(--active-blue); background: var(--active-blue); color: #ffffff; }
.service-secondary-button { border: 1px solid rgba(28, 43, 76, 0.45); background: transparent; color: var(--active-blue); }
.wallet-options-list { margin-top: 0; }
#options-view .wallet-subview-panel {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}
#options-view .wallet-options-list {
    padding: 8px 12px 9px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(28, 43, 76, 0.10);
}
#options-view .wallet-list-row { min-height: 70px; }
#options-view .wallet-options-version {
    margin-top: 0;
    padding: 9px 0 0;
    border-top: 0;
    background: transparent;
}
.wallet-options-version { margin-top: 0; padding: 9px 0 0; border-top: 1px solid rgba(209, 209, 214, 0.46); color: var(--active-blue); font-size: 10px; line-height: 1.45; font-weight: 400; }
.wallet-options-version span { color: var(--active-blue); }
.options-detail-panel[hidden] { display: none !important; }
.options-detail-panel { min-height: calc(100% - 4px); display: flex; flex-direction: column; color: var(--text-dark); }
.options-detail-illustration { margin-top: 0; }
.options-detail-illustration img { max-width: 100%; }
.options-detail-lead { margin: 8px 0 8px; color: var(--text-dark); font-size: 13px; line-height: 1.35; font-weight: 600; }
.options-detail-copy { margin: 0 0 12px; color: var(--text-gray); font-size: 12px; line-height: 1.45; font-weight: 400; }
.options-detail-action { margin-top: auto; }
.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;
}
.password-detail-panel {
    padding: 0 16px 36px;
}
.password-detail-panel .options-detail-copy {
    margin-bottom: 18px;
    max-width: 315px;
    font-size: 14px;
    line-height: 1.55;
}
.password-field {
    width: 100%;
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 12px;
    border: 1px solid rgba(28, 43, 76, 0.08);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.34);
}
.password-field input {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
}
.password-field input::placeholder { color: var(--text-gray); opacity: 1; }
.password-field button {
    width: 24px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-gray);
    cursor: pointer;
}
.password-field button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.password-detail-panel .options-detail-action { margin-top: auto; }
.wallet-password-bottom-action { display: none; }
.wallet-home.is-password-detail > .wallet-bottom-nav {
    align-items: center;
    justify-content: center;
}
.wallet-home.is-password-detail > .wallet-bottom-nav .wallet-nav-item { display: none; }
.wallet-home.is-password-detail > .wallet-bottom-nav .wallet-password-bottom-action {
    display: flex;
    width: calc(100% - 40px);
    min-height: 42px;
    align-items: center;
    justify-content: center;
    margin: 0;
}
.biometry-detail-panel {
    min-height: 100%;
    padding: 0 16px 24px;
    background: var(--bg-color);
}
.biometry-detail-illustration { width: 150px; height: 178px; margin: 0 auto 38px; display: grid; place-items: center; overflow: hidden; background: transparent; }
.biometry-detail-illustration img { width: 150px; height: 178px; display: block; object-fit: contain; background: transparent; }
.biometry-toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 42px; color: var(--text-dark); font-size: 13px; line-height: 1.2; }
.biometry-toggle { width: 38px; height: 22px; padding: 2px; border: 0; border-radius: 999px; background: #b8b8bd; cursor: pointer; transition: background-color 160ms ease; }
.biometry-toggle span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; transform: translateX(0); transition: transform 160ms ease; }
.biometry-toggle.is-on { background: var(--active-blue); }
.biometry-toggle.is-on span { transform: translateX(16px); }
.biometry-detail-panel .options-detail-copy { margin-top: 13px; max-width: 315px; }
.legal-detail-panel { overflow-y: auto; }
.legal-copy { color: var(--text-dark); font-size: 10px; line-height: 1.25; }
.legal-copy h2 { margin: 0 0 7px; font-size: 10px; line-height: 1.2; font-weight: 700; text-transform: uppercase; }
.legal-copy h3 { margin: 9px 0 3px; font-size: 10px; line-height: 1.2; font-weight: 700; }
.legal-copy p { margin: 0 0 7px; }
.wallet-nav-item.is-active[data-feature="services"], .wallet-nav-item.is-active[data-feature="options"] { color: var(--active-blue); }

.wallet-header { position: relative; }
.wallet-header-back {
    position: absolute;
    left: 16px;
    top: 50%;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--text-dark);
    transform: translateY(-50%);
    z-index: 2;
    cursor: pointer;
}
.wallet-header-back svg { width: 21px; height: 21px; }
.wallet-header-back:active { opacity: 0.55; }

.service-detail-panel[hidden] { display: none; }
#services-list-view,
#service-detail-view { transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1), opacity 220ms ease-out; }
#services-list-view.subpanel-back-enter { transform: translateX(-24%); opacity: 0; }
#services-list-view.subpanel-visible { transform: translateX(0); opacity: 1; }
#service-detail-view.subpanel-back-leave { transform: translateX(100%); opacity: 0; }
#service-detail-view.subpanel-hidden { transform: translateX(100%); opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    #services-list-view, #service-detail-view { transition: none; }
}

/* O swipe move somente o painel de conteúdo; header, tabs e bottom nav permanecem fixos. */
.wallet-home {
    position: relative;
    isolation: isolate;
}

.wallet-home > .wallet-header {
    position: relative;
    z-index: 30;
}

.wallet-home > .wallet-content,
.wallet-home > .wallet-subview {
    position: absolute;
    z-index: 10;
    inset-inline: 0;
    inset-block-start: calc(env(safe-area-inset-top) + var(--wallet-top-nav-height));
    inset-block-end: calc(var(--wallet-bottom-nav-height) + env(safe-area-inset-bottom));
    width: 100%;
    height: auto;
    min-height: 0;
    flex: none;
    box-sizing: border-box;
    will-change: transform, opacity;
    overscroll-behavior-x: none;
}

.wallet-home > .wallet-bottom-nav {
    position: relative;
    z-index: 30;
}

.wallet-home > .wallet-subview[hidden],
.wallet-home > .wallet-content[hidden] {
    display: none;
}

.wallet-home > .wallet-bottom-nav {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Shell do documento: mesma superfície branca da Wallet, sem mistura com o fundo do conteúdo. */
#legacy-document-view,
#legacy-document-view .top-bar,
#legacy-document-view .tabs,
#legacy-document-view .bottom-nav {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

#legacy-document-view .top-bar,
#legacy-document-view .tabs,
#legacy-document-view .bottom-nav {
    position: relative;
    z-index: 20;
}

#legacy-document-view .top-bar {
    border-bottom: 0;
}

#legacy-document-view .bottom-nav {
    border-top: 0;
}

/* O conteúdo do documento compartilha o cinza interno da Wallet; o shell continua branco. */
#legacy-document-view .content,
#legacy-document-view .swiper,
#legacy-document-view .swiper-wrapper,
#legacy-document-view .swiper-slide,
#legacy-document-view .view-section {
    background: var(--bg-color);
}

/* Não mostrar outlines de foco gerados pelo toque ou pelo primeiro carregamento. */
#legacy-document-view button:focus:not(:focus-visible),
#wallet-home button:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Geometria única para o PWA instalado: as duas barras inferiores usam a
   mesma caixa visual e encostam no mesmo limite inferior do viewport. */
.wallet-home > .wallet-bottom-nav,
#legacy-document-view > .bottom-nav {
    height: var(--bottom-nav-height);
    min-height: var(--bottom-nav-height);
    box-sizing: border-box;
    padding: 14px 30px calc(26px + env(safe-area-inset-bottom));
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    width: 100%;
}

/* O documento usa a mesma composição absoluta da Wallet; assim a altura não
   depende do flex-flow ou de como o iOS calcula o modo standalone. */
#legacy-document-view {
    position: fixed;
    inset: 0;
    isolation: isolate;
}

#legacy-document-view > .content {
    position: absolute;
    inset-inline: 0;
    inset-block-start: calc(env(safe-area-inset-top) + var(--document-top-nav-height) + var(--document-tabs-height));
    inset-block-end: calc(var(--bottom-nav-height) + 42px);
    width: 100%;
    height: auto;
    min-height: 0;
    flex: none;
}

#legacy-document-view > #last-update {
    position: absolute;
    inset-inline: 0;
    inset-block-end: var(--bottom-nav-height);
    width: 100%;
    height: 42px;
    min-height: 42px;
    transform: translate(var(--document-update-offset-x), var(--document-update-offset-y));
    z-index: 20;
}

#legacy-document-view > .bottom-nav {
    z-index: 30;
}


/* PWA: a Wallet e o documento compartilham exatamente a mesma geometria da barra inferior. */
.wallet-home > .wallet-bottom-nav,
#legacy-document-view > .bottom-nav {
    height: var(--document-bottom-nav-height);
    min-height: var(--document-bottom-nav-height);
    box-sizing: border-box;
    padding: 14px 30px calc(26px + env(safe-area-inset-bottom));
}

.wallet-home > .wallet-content,
.wallet-home > .wallet-subview {
    inset-block-end: calc(var(--document-bottom-nav-height) + env(safe-area-inset-bottom));
}

#legacy-document-view > .content {
    inset-block-end: calc(var(--document-bottom-nav-height) + 42px);
}

#legacy-document-view > #last-update {
    inset-block-end: var(--document-bottom-nav-height);
}
