/* =========================================================
   X DELIVERY — Painel da Loja (layout estrutural)
   Sobrescreve conflitos do comerciante.css e alinha abas
========================================================= */

:root {
    --header-h: 72px;
    --loja-sidebar-w: 0px;
    --loja-content-x: clamp(14px, 2.5vw, 28px);
}

.xd-sales-wallet[hidden] {
    display: none !important;
}

/* ——— Shell principal ——— */
.loja-layout {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

.loja-main.loja-main,
main.loja-main {
    flex: 1 1 auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: var(--loja-sidebar-w) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transition: padding-left 0.2s ease;
}

/* ——— Header / menu superior ——— */
.painel-header-nav.painel-header-nav,
.loja-main > .painel-header-nav {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: var(--header-h) !important;
    margin: 0 !important;
    padding: 10px var(--loja-content-x) !important;
    padding-top: calc(10px + env(safe-area-inset-top)) !important;
    border-radius: 0 !important;
    z-index: 1500 !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    gap: 10px !important;
    align-items: center !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06) !important;
}

.painel-header-nav .header-brand-loja {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.painel-header-nav .header-brand-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.painel-header-nav .header-brand-text .topbar-nome,
.painel-header-nav .header-brand-text #nomeFantasia {
    max-width: 100% !important;
}

.painel-header-nav .topbar-relogio {
    margin: 0 auto;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.painel-header-nav .loja-nav {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    margin: 0 auto !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    z-index: 1 !important;
    position: relative !important;
    justify-content: center;
}

.painel-header-nav .loja-nav button {
    flex-shrink: 0;
}

.painel-header-nav .loja-nav button .loja-nav-label {
    display: inline;
    white-space: nowrap;
}

.painel-header-nav .loja-nav::-webkit-scrollbar {
    display: none;
}

.painel-header-nav .topbar-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.painel-header-nav .loja-perfil-media-top {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    max-width: 46px;
    max-height: 46px;
    overflow: hidden;
    flex-shrink: 0;
}

.painel-header-nav .loja-perfil-media-top img,
.painel-header-nav #fotoPerfil {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    border-radius: 9px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: block !important;
}

/* Chat flutuante — só na aba Pedidos */
.loja-chat-fab,
#btnAbaChat.loja-chat-fab {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    left: calc(var(--loja-sidebar-w, 0px) + 16px) !important;
    margin: 0 !important;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    background: #0f1724;
    color: #39ff14;
    border: 2px solid rgba(57, 255, 20, 0.35);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 10001;
    transition: left 0.2s ease, bottom 0.2s ease, transform 0.18s ease;
}

body.loja-aba-pedidos .loja-chat-fab,
body.loja-aba-pedidos-central .loja-chat-fab,
body.loja-aba-pedidos #btnAbaChat.loja-chat-fab,
body.loja-aba-pedidos-central #btnAbaChat.loja-chat-fab {
    display: flex !important;
}

body:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat,
body:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat.active {
    display: none !important;
}

.loja-chat-fab:hover {
    transform: scale(1.05);
    color: #4ade80;
}

body.loja-painel #aba-chat.wa-chat-section {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    left: calc(var(--loja-sidebar-w, 0px) + 16px) !important;
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    z-index: 10002 !important;
    margin: 0 !important;
    order: unset !important;
    flex: none !important;
}

/* Com menu Caixa aberto: oculta chat exceto no Radar */
body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) .loja-chat-fab {
    display: none !important;
}

body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat,
body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat.active {
    display: none !important;
}

#btnCaixa {
    display: none;
    align-items: center;
    gap: 6px;
}

/* ——— Mapa (aba Início) ——— */
.mapa-wrapper.global-map {
    position: absolute !important;
    top: var(--header-h) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2 !important;
}

.global-map #map,
#map {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
}

.leaflet-top.leaflet-left,
.leaflet-top.leaflet-right {
    margin-top: 12px !important;
}

.badge-motos-online {
    position: absolute;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 1200;
    background: #0f1724;
    color: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.25);
}

#btnResetarMapa {
    top: 12px !important;
    right: 12px !important;
}

.mapa-pino-status {
    position: absolute;
    left: calc(12px + env(safe-area-inset-left));
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 1200;
    max-width: min(420px, calc(100% - 24px));
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* ——— Abas / seções de conteúdo ——— */
.painel-section.painel-section {
    display: none !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 20px var(--loja-content-x) 28px !important;
    background: #f4f7f9 !important;
    z-index: 5 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

.painel-section.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

#aba-operacional.painel-section {
    padding: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
    position: absolute !important;
    top: var(--header-h) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 3 !important;
}

#aba-operacional.painel-section > * {
    pointer-events: auto;
}

/* Títulos e ações no topo de cada aba */
.section-title-loja {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
    margin: 0 0 18px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
}

.section-title-loja > div:first-child {
    flex: 1 1 240px;
    min-width: 0;
}

.section-title-loja h3 {
    margin: 0;
    line-height: 1.2;
}

.section-title-loja p {
    margin: 6px 0 0;
}

.acoes-topo-gestao-entregas {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex: 0 1 auto !important;
    flex-wrap: wrap !important;
    margin-left: auto !important;
}

.acoes-topo-gestao-entregas .btn-acao {
    flex-shrink: 0;
}

/* Drawer lateral da loja */
.drawer-loja {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: none;
}

.drawer-loja.aberto {
    display: block;
}

/* Drawer fixed: não clipar por overflow dos painéis pais */
.loja-main:has(.drawer-loja.aberto),
.painel-section:has(.drawer-loja.aberto) {
    overflow: visible !important;
}

.drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.drawer-content {
    position: absolute;
    top: 0;
    right: -400px;
    width: min(400px, 100vw);
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.drawer-loja.aberto .drawer-content {
    right: 0;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}

.btn-fechar-drawer {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
}

.drawer-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.drawer-footer {
    padding: 24px;
    border-top: 1px solid #f1f5f9;
}

.form-group-loja label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.form-group-loja input,
.form-group-loja select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    background: #fff;
    outline: none;
}

.table-extrato-loja tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.table-extrato-loja td {
    padding: 16px !important;
    font-size: 14px !important;
    color: #334155 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.val-positivo {
    color: #10b981 !important;
    font-weight: 700 !important;
}

.val-negativo {
    color: #ef4444 !important;
    font-weight: 700 !important;
}

.btn-pag-loja {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-pag-loja.active {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}

.btn-pag-loja:hover:not(:disabled):not(.active) {
    background: #f1f5f9;
}

.btn-pag-loja:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loja-nav button {
    background: transparent;
    border: none;
    color: #475569;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.loja-nav button.active,
.loja-nav button:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

/* Header claro: contraste legível (comerciante.css usa cores de sidebar escura) */
.painel-header-nav .loja-nav button {
    color: #334155 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    font-weight: 700 !important;
}

.painel-header-nav .loja-nav button i {
    color: #64748b !important;
}

.painel-header-nav .loja-nav button:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

.painel-header-nav .loja-nav button:hover i {
    color: #0f172a !important;
}

.painel-header-nav .loja-nav button.active {
    background: #0f172a !important;
    color: #ffffff !important;
    border-color: #0f172a !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18) !important;
}

.painel-header-nav .loja-nav button.active i {
    color: #ffffff !important;
}

/* Blocos internos das abas */
.box-branca,
.gestao-entregas-lista,
.table-container,
.pedidos-unified-grid,
.config-grid,
.financeiro-box-abas {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Caixa visível: respeita sidebar via variável CSS */
body.caixa-visible .mapa-wrapper.global-map {
    left: var(--caixa-sidebar-w) !important;
}

@media (max-width: 420px) {
    body.caixa-visible {
        --loja-sidebar-w: 0px;
    }

    body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) .loja-chat-fab {
        display: none !important;
    }

    body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat,
    body.caixa-visible:not(.loja-aba-pedidos):not(.loja-aba-pedidos-central) #aba-chat.active {
        display: none !important;
    }
}

/* ——— Responsivo ——— */
@media (max-width: 1100px) {
    .painel-header-nav {
        flex-wrap: wrap !important;
        align-items: stretch !important;
    }

    .painel-header-nav .header-brand-loja {
        flex: 1 1 200px;
        max-width: none;
        border-right: none;
        padding-right: 0;
        margin-right: 0;
    }

    .painel-header-nav .topbar-actions {
        order: 2;
    }

    .painel-header-nav .loja-nav {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        justify-content: flex-start !important;
        margin: 0 !important;
    }
}

@media (max-width: 900px) {
    :root {
        --header-h: 64px;
    }

    .loja-main.loja-main {
        padding-left: var(--loja-sidebar-w) !important;
    }

    .section-title-loja {
        flex-direction: column;
        align-items: stretch !important;
    }

    .acoes-topo-gestao-entregas {
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: stretch !important;
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .acoes-topo-gestao-entregas .btn-acao {
        width: 100% !important;
        justify-content: center;
    }

    .pedido-grid {
        grid-template-columns: 1fr !important;
    }

    .campo-inline {
        width: 100%;
    }

    .actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row .btn-acao {
        width: 100%;
    }

    .drawer-content {
        width: 100%;
        right: 0;
    }
}

@media (max-width: 768px) {
    .painel-section.painel-section {
        padding: 16px 14px 24px !important;
    }

    .painel-header-nav .loja-nav button {
        font-size: 11px;
        padding: 8px 10px !important;
    }
}

@media (max-width: 520px) {
    :root {
        --header-h: 58px;
    }

    .painel-header-nav .header-brand-text .topbar-nome,
    .painel-header-nav .header-brand-text #nomeFantasia {
        max-width: 100% !important;
        font-size: 12px !important;
    }

    .painel-header-nav .loja-status-toggle-header label {
        height: 34px;
        padding: 0 10px;
        font-size: 10px;
    }

    .painel-header-nav .btn-sair-loja-top {
        height: 34px;
        padding: 0 10px;
        font-size: 12px;
    }

    .topbar-relogio {
        font-size: 13px !important;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .loja-main {
        overflow-y: auto;
    }
}

/* ——— Abas específicas ——— */
.tela-central-despacho-final .section-title-loja,
#aba-financeiro .section-title-loja,
#aba-historico .section-title-loja,
#aba-pedidos .section-title-loja,
#aba-configuracoes .section-title-loja,
#aba-caixa .section-title-loja {
    align-items: flex-start;
}

.tela-central-despacho-final .gestao-entregas-lista,
.tela-central-despacho-final .gestao-entregas-layout {
    width: 100%;
}

.tela-central-despacho-final #contadorPedidosSelecionadosLoja {
    margin: 0 0 16px !important;
}

#aba-caixa.painel-section {
    padding-top: 12px !important;
}

#caixaActionBar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.subtabs-loja {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.financeiro-box-abas,
.config-grid {
    display: grid;
    gap: 16px;
}

@media (max-width: 900px) {
    #caixaActionBar {
        justify-content: stretch;
    }

    #caixaActionBar .caixa-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   RESET FINAL — anula layout legado (comerciante.css)
   Corrige distância enorme entre menu e conteúdo das abas
========================================================= */

html body .loja-layout.loja-layout {
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh !important;
    width: 100% !important;
}

html body main.loja-main.loja-main {
    padding: 0 !important;
    padding-left: var(--loja-sidebar-w) !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    overflow: hidden !important;
}

html body .loja-main > .painel-header-nav {
    order: 0 !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    z-index: 1500 !important;
}

/* Mapa fora do fluxo — nunca empurra o conteúdo para baixo */
html body .loja-main > .mapa-wrapper.global-map {
    position: fixed !important;
    top: var(--header-h) !important;
    left: var(--loja-sidebar-w) !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    order: 99 !important;
    z-index: 2 !important;
    pointer-events: auto;
}

html body:not(.loja-aba-operacional) .loja-main > .mapa-wrapper.global-map {
    display: none !important;
    pointer-events: none !important;
}

html body.loja-aba-operacional .loja-main > .mapa-wrapper.global-map {
    display: block !important;
}

html body.loja-aba-pedidos-central .loja-main {
    display: flex !important;
    flex-direction: column !important;
}

html body.loja-aba-pedidos-central .loja-main > .mapa-wrapper.global-map {
    display: none !important;
    pointer-events: none !important;
}

html body.loja-aba-pedidos-central .loja-main > .painel-section#aba-pedidos.active {
    order: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

html body .loja-main > .painel-section {
    order: 1 !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    display: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 5 !important;
}

html body .loja-main > .painel-section.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

html body .loja-main > #aba-operacional.painel-section {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    padding: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
}

html body .loja-main > .section-title-loja {
    flex-shrink: 0 !important;
}

html body #tabelaPedidosMontadosWrapLoja,
html body #tabelaPedidosMontadosWrapLoja.painel-branco {
    min-height: 0 !important;
}

/* =========================================================
   FIX ABAS — conteúdo colado ao menu (todas as abas)
========================================================= */

html,
html body {
    height: 100% !important;
    overflow: hidden !important;
}

html body .loja-layout.loja-layout {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

html body main.loja-main.loja-main {
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

html body .loja-main .painel-section,
html body .loja-main > .painel-section {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    order: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    display: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    align-content: flex-start !important;
    justify-content: flex-start !important;
}

html body .loja-main .painel-section.active,
html body .loja-main > .painel-section.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

html body .loja-main > .painel-section.active > .section-title-loja:first-child {
    margin-top: 0 !important;
    flex-shrink: 0 !important;
}

/* Configurações: abas internas visíveis e endereço com mapa */
#aba-configuracoes.painel-section.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

#aba-configuracoes .configuracoes-topo {
    flex: 0 0 auto;
    width: 100%;
    position: relative;
    z-index: 6;
    overflow: visible;
    margin-bottom: 4px;
}

#aba-configuracoes .config-subtabs.subtabs-loja {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    margin: 0 0 14px !important;
    padding: 6px !important;
    box-sizing: border-box;
    position: relative;
    z-index: 6;
}

#aba-configuracoes .config-subtabs button {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
}

#aba-configuracoes .config-grid {
    display: block !important;
    width: 100% !important;
    grid-template-columns: none !important;
}

#aba-configuracoes .subtab-config-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

#aba-configuracoes .conf-mapa-preview {
    width: 100%;
    height: clamp(180px, 28vh, 260px);
    margin: 0 0 12px;
    border-radius: 14px;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid #dbe4ec;
}

#mapConfigEnderecoLoja {
    width: 100%;
    height: 100%;
    min-height: 180px;
}

#aba-configuracoes .conf-campo-auto {
    background: #f8fafc;
    color: #334155;
    cursor: default;
}

#aba-configuracoes .conf-campo-auto:focus {
    outline: none;
    box-shadow: none;
}

#aba-configuracoes .conf-status-pino {
    margin: 0 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

#aba-configuracoes .conf-endereco-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#aba-configuracoes .campo-busca-endereco {
    position: relative;
    z-index: 20;
}

#aba-configuracoes .autocomplete-endereco-lista.aberto {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
}

html body .loja-main > #aba-pedidos.painel-section.active,
html body .loja-main > #aba-historico.painel-section.active,
html body .loja-main > #aba-financeiro.painel-section.active,
html body .loja-main > #aba-configuracoes.painel-section.active,
html body .loja-main > #aba-montar-entrega.painel-section.active,
html body .loja-main > #aba-caixa.painel-section.active {
    padding-top: 20px !important;
}

/* PWA instalado — tela cheia sem barra de endereco do navegador */
@media all and (display-mode: standalone), all and (display-mode: fullscreen), all and (display-mode: minimal-ui) {
    html,
    body {
        overscroll-behavior: none;
    }

    .loja-main.loja-main,
    main.loja-main {
        min-height: 100dvh !important;
    }

    .painel-header-nav.painel-header-nav,
    .loja-main > .painel-header-nav {
        padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    }
}

/* =========================================================
   Fundo do painel — marca d'água adaptativa
========================================================= */

.loja-painel-watermark {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    transition: opacity 0.45s ease;
}

.loja-painel-watermark.is-active {
    opacity: 0.065;
}

.loja-painel-scrim {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: background 0.45s ease, opacity 0.45s ease;
}

body.loja-painel--has-fundo .loja-painel-scrim {
    opacity: 1;
}

body.loja-painel--has-fundo.loja-painel--fundo-claro {
    --loja-fundo-scrim: rgba(248, 250, 252, 0.9);
    --loja-card-bg: rgba(255, 255, 255, 0.94);
    --loja-card-border: rgba(226, 232, 240, 0.92);
    --loja-header-bg: rgba(255, 255, 255, 0.94);
    --loja-mini-kpi-bg: rgba(248, 250, 252, 0.92);
}

body.loja-painel--has-fundo.loja-painel--fundo-escuro {
    --loja-fundo-scrim: rgba(255, 255, 255, 0.93);
    --loja-card-bg: rgba(255, 255, 255, 0.97);
    --loja-card-border: rgba(203, 213, 225, 0.95);
    --loja-header-bg: rgba(255, 255, 255, 0.96);
    --loja-mini-kpi-bg: rgba(241, 245, 249, 0.95);
}

body.loja-painel--has-fundo .loja-painel-scrim {
    background: var(--loja-fundo-scrim, rgba(248, 250, 252, 0.9));
}

html body .loja-layout.loja-layout {
    position: relative;
    z-index: 1;
}

body.loja-painel--has-fundo .box-branca,
body.loja-painel--has-fundo .card-hero,
body.loja-painel--has-fundo .card-mini-info {
    background: var(--loja-card-bg, rgba(255, 255, 255, 0.94)) !important;
    border-color: var(--loja-card-border, rgba(226, 232, 240, 0.92)) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.loja-painel--has-fundo .mini-kpi {
    background: var(--loja-mini-kpi-bg, rgba(248, 250, 252, 0.92)) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.loja-painel--has-fundo .painel-header-nav.painel-header-nav,
body.loja-painel--has-fundo .loja-main > .painel-header-nav {
    background: var(--loja-header-bg, rgba(255, 255, 255, 0.94)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.loja-painel--has-fundo .caixa-placeholder-card,
body.loja-painel--has-fundo .caixa-garcons-card {
    background: var(--loja-card-bg, rgba(255, 255, 255, 0.94)) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.loja-painel-fundo-preview {
    margin-top: 12px;
    min-height: 140px;
    border-radius: 16px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.loja-painel-fundo-preview img {
    display: none;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.loja-painel-fundo-preview.has-image img {
    display: block;
}

.loja-painel-fundo-preview span {
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.loja-painel-fundo-preview.has-image span {
    display: none;
}

.loja-cardapio-img-preview {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.loja-cardapio-img-preview--perfil {
    width: 120px;
    height: 120px;
}

.loja-cardapio-img-preview--capa {
    width: 100%;
    min-height: 120px;
    max-height: 160px;
}

.loja-cardapio-img-preview img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.loja-cardapio-img-preview--perfil img {
    border-radius: 16px;
}

.loja-cardapio-img-preview.has-image img {
    display: block;
}

.loja-cardapio-img-preview span {
    padding: 12px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.loja-cardapio-img-preview.has-image span {
    display: none;
}

.loja-painel-fundo-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
}

.loja-painel-fundo-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.loja-painel-fundo-upload input {
    display: none;
}

.loja-painel-fundo-remover.hidden {
    display: none !important;
}

.loja-fundo-painel-campo label {
    font-weight: 700;
}

.xd-bloqueio-moto-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.xd-bloqueio-moto-foto {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
    border: 2px solid #e2e8f0;
}
.xd-bloqueio-moto-info {
    min-width: 0;
    flex: 1;
}
.xd-bloqueio-moto-btn {
    margin-top: 10px;
}

/* LOCK 401: drawer financeiro/filtros não pode ser clipado pelo overflow do painel */
html body main.loja-main.loja-main:has(.drawer-loja.aberto),
html body main.loja-main:has(.drawer-loja.aberto) {
    overflow: visible !important;
}
html body .loja-main > .painel-section:has(.drawer-loja.aberto),
html body .loja-main .painel-section:has(.drawer-loja.aberto) {
    overflow: visible !important;
}
html body .drawer-loja.aberto {
    z-index: 12050 !important;
    pointer-events: auto !important;
}

.xd-pedido-feedback {
    position: fixed;
    inset: 0;
    z-index: 130000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    animation: xd-pedido-feedback-in 160ms ease-out;
}

.xd-pedido-feedback__card {
    position: relative;
    width: min(100%, 460px);
    padding: 30px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.3);
    color: #0f172a;
    text-align: center;
}

.xd-pedido-feedback__card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #10b981, #34d399);
    content: "";
}

.xd-pedido-feedback.is-error .xd-pedido-feedback__card::before {
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

.xd-pedido-feedback__close {
    position: absolute;
    top: 13px;
    right: 15px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.xd-pedido-feedback__icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 4px auto 14px;
    place-items: center;
    border: 7px solid #ecfdf5;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-size: 24px;
    box-shadow: 0 8px 22px rgba(16, 185, 129, 0.23);
}

.xd-pedido-feedback.is-error .xd-pedido-feedback__icon {
    border-color: #fff7ed;
    background: #f59e0b;
    box-shadow: 0 8px 22px rgba(245, 158, 11, 0.2);
}

.xd-pedido-feedback__eyebrow {
    color: #059669;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.16em;
}

.xd-pedido-feedback.is-error .xd-pedido-feedback__eyebrow {
    color: #c2410c;
}

.xd-pedido-feedback__card h2 {
    margin: 7px 0 8px;
    font-size: clamp(22px, 5vw, 28px);
    font-weight: 850;
    letter-spacing: -0.035em;
}

.xd-pedido-feedback__card > p {
    max-width: 370px;
    margin: 0 auto 18px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.55;
}

.xd-pedido-feedback__details {
    display: grid;
    gap: 0;
    margin: 16px 0 20px;
    padding: 4px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
    text-align: left;
}

.xd-pedido-feedback__details[hidden] {
    display: none;
}

.xd-pedido-feedback__detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 39px;
    border-bottom: 1px solid #e8edf3;
    font-size: 12px;
}

.xd-pedido-feedback__detail:last-child {
    border-bottom: 0;
}

.xd-pedido-feedback__detail span {
    flex: 0 0 auto;
    color: #64748b;
}

.xd-pedido-feedback__detail strong {
    min-width: 0;
    color: #0f172a;
    font-size: 12px;
    text-align: right;
    overflow-wrap: anywhere;
}

.xd-pedido-feedback__action {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.2);
}

.xd-pedido-feedback.is-error .xd-pedido-feedback__action {
    background: linear-gradient(135deg, #ea580c, #f59e0b);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.2);
}

.xd-pedido-feedback__action:focus-visible,
.xd-pedido-feedback__close:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

@keyframes xd-pedido-feedback-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 520px) {
    .xd-pedido-feedback { padding: 14px; }
    .xd-pedido-feedback__card { padding: 27px 19px 20px; border-radius: 20px; }
    .xd-pedido-feedback__details { padding-inline: 11px; }
}
