/* === ROOT VARS & RESET === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --cyan: #00e5ff;
    --pink: #ff3d7f;
    --blue: #1a8fff;
    --green: #00d084;
    --orange: #ff9f43;
    --surface: rgba(8, 12, 24, 0.96);
    --border: rgba(0, 229, 255, 0.14);
    --text: #e8f4ff;
    --muted: rgba(180, 210, 240, 0.55);
    --bg: #06091a;
}

body {
    margin: 0;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    overflow: hidden;
    background: #020508;
    height: 100dvh;
    display: none;
    color: var(--text);
}

#app-container {
    display: flex;
    height: 100dvh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.25);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.4);
}

/* Esconder reCAPTCHA do Google */
.grecaptcha-badge {
    visibility: hidden !important;
    display: none !important;
}

iframe[src*="recaptcha"] {
    display: none !important;
}

/* === BARRA LATERAL === */
#sidebar {
    position: absolute;
    /* sobrepõe o mapa — mapa sempre ocupa 100% da largura */
    top: 0;
    left: 0;
    width: var(--sidebar-width, 315px);
    overflow: hidden;
    /* filhos mais largos que a largura atual são cortados */
    background: rgba(6, 9, 20, 0.97);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: width 0.3s ease;
    height: 100dvh;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.85),
        4px 0 28px rgba(0, 229, 255, 0.30),
        2px 0 10px rgba(0, 229, 255, 0.20);
}

#sidebar.resizing {
    transition: none;
}

#sidebar.collapsed {
    width: 0px;
    border-right: none;
}

#sidebar.collapsed>* {
    display: none !important;
}

/* Alça de arraste na borda direita da nav-bar — redimensiona #sidebar e
   #sidebar-placeholder juntos via --sidebar-width (ver ui.js). */
#sidebar-resizer {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 2002;
    background: transparent;
}

#sidebar-resizer:hover,
#sidebar-resizer.resizing {
    background: rgba(0, 229, 255, 0.35);
}

/* Placeholder no flex flow: reserva espaço igual ao sidebar sem empurrar o mapa */
#sidebar-placeholder {
    flex-shrink: 0;
    width: var(--sidebar-width, 315px);
    pointer-events: none;
    transition: width 0.3s ease;
}

#sidebar-placeholder.resizing {
    transition: none;
}

#sidebar.collapsed~#sidebar-placeholder {
    width: 0;
}

#toggle-sidebar {
    position: absolute;
    /* relativo ao #app-container (position:relative) */
    left: var(--sidebar-width, 315px);
    /* alinhado com a borda direita do sidebar */
    top: 15px;
    right: auto;
    background: rgba(0, 229, 255, 0.12);
    color: var(--cyan);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    z-index: 2001;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 0 16px rgba(0, 229, 255, 0.08);
    transition: left 0.3s ease, background 0.3s, color 0.3s;
    backdrop-filter: blur(10px);
}

#sidebar.collapsed~#toggle-sidebar {
    left: 0;
}

#sidebar.resizing~#toggle-sidebar {
    transition: none;
}

#toggle-sidebar:hover {
    background: rgba(0, 229, 255, 0.28);
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 4px 0 16px rgba(0, 229, 255, 0.08);
    }

    50% {
        box-shadow: 4px 0 28px rgba(0, 229, 255, 0.45), 0 0 16px rgba(0, 229, 255, 0.22);
    }
}

#sidebar.collapsed~#toggle-sidebar {
    animation: pulse-glow 2.5s ease-in-out infinite;
}

#sidebar-header {
    padding: 18px 16px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.07), rgba(26, 143, 255, 0.04));
    border-bottom: 1px solid var(--border);
    text-align: center;
}

#sidebar-header h4 {
    margin: 0;
    font-family: 'Syne', sans-serif;
    font-size: 0.76rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.04em;
}

#status-frota {
    font-size: 0.56rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* === NAV LINKS (entre header e accordion) === */
#sidebar-nav {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.btn-nav-link {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 8px;
    color: var(--cyan);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-nav-link:hover {
    background: rgba(0, 229, 255, 0.07);
    border-color: rgba(0, 229, 255, 0.35);
}

/* === TOOLTIP MOTOBOY === */
.tooltip-painel-moto {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.tooltip-painel-moto::before {
    display: none !important;
}

/* === TOOLBAR DE FERRAMENTAS (substituiu accordion) === */
#toolbar-ferramentas {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.12);
}

.btn-tool {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    background: transparent;
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-tool .tool-icon {
    font-size: 15px;
    line-height: 1;
}

.btn-tool .tool-label {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-tool:hover {
    background: rgba(0, 229, 255, 0.07);
    border-color: rgba(0, 229, 255, 0.28);
    color: var(--text);
}

.btn-tool.active {
    background: rgba(0, 229, 255, 0.13);
    border-color: rgba(0, 229, 255, 0.45);
    color: var(--cyan);
}

#painel-ferramenta {
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.tool-panel {
    display: none;
    padding: 12px 12px 14px;
}

.tool-panel.active {
    display: block;
}

.tool-panel select,
.tool-panel input[type="number"] {
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    background: rgba(255, 255, 255, 0.07);
    color: #e8f4ff;
    font-weight: 600;
    font-size: 0.64rem;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.tool-panel select:focus,
.tool-panel input:focus {
    border-color: rgba(0, 229, 255, 0.5);
    background: rgba(255, 255, 255, 0.11);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.08);
}

.tool-panel select option {
    background: #131929;
    color: #e8f4ff;
}

.btn-tool-inline {
    flex-shrink: 0;
    width: 34px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 229, 255, 0.08);
    color: var(--cyan);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
}

.btn-tool-inline:hover {
    background: rgba(0, 229, 255, 0.2);
    border-color: rgba(0, 229, 255, 0.5);
}

.btn-ver-tudo {
    background: rgba(255, 159, 67, 0.12);
    border-color: rgba(255, 159, 67, 0.35);
    color: var(--orange);
    min-width: 34px;
}

.btn-ver-tudo:hover {
    background: rgba(255, 159, 67, 0.25);
    border-color: rgba(255, 159, 67, 0.6);
}

.btn-ver-tudo.ativo {
    background: rgba(255, 159, 67, 0.30);
    border-color: var(--orange);
    box-shadow: 0 0 8px rgba(255, 159, 67, 0.35);
}

.btn-action {
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, #007a3d, var(--green));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.62rem;
    cursor: pointer;
    transition: 0.2s;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-action:hover {
    background: linear-gradient(135deg, #009950, #00f09a);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 208, 132, 0.28);
}

/* === LISTA DE PEDIDOS === */
#lista-pedidos-container {
    /* altura definida via JS (_ajustarAlturaLista) — mais confiável que flex em qualquer browser */
    overflow-y: auto;
    padding: 10px 8px;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.40) rgba(255, 255, 255, 0.03);
}


#lista-pedidos-container::-webkit-scrollbar {
    width: 5px;
}

#lista-pedidos-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    margin: 4px 0;
}

#lista-pedidos-container::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.35);
    border-radius: 4px;
}

#lista-pedidos-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.65);
}

/* Tema claro */
body.tema-claro #lista-pedidos-container {
    scrollbar-color: rgba(52, 152, 219, 0.45) rgba(0, 0, 0, 0.04);
}

body.tema-claro #lista-pedidos-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}

body.tema-claro #lista-pedidos-container::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.38);
}

body.tema-claro #lista-pedidos-container::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.68);
}

.titulo-secao {
    font-size: 0.52rem;
    text-transform: uppercase;
    font-weight: 800;
    margin: 10px 2px 6px 2px;
    letter-spacing: 0.10em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.titulo-secao::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    flex-shrink: 0;
}

.card-match {
    background: rgba(231, 76, 60, 0.07);
    border: 1px solid rgba(231, 76, 60, 0.30);
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 10px;
}

.card-match-titulo {
    font-size: 0.52rem;
    font-weight: 800;
    color: #ff6b6b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-match-cliente {
    background: rgba(139, 92, 246, 0.07);
    border-color: rgba(139, 92, 246, 0.30);
}

.pedido-item {
    background: rgba(12, 18, 36, 0.88);
    margin-bottom: 4px;
    padding: 5px 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    cursor: pointer;
    border: 1px solid rgba(0, 229, 255, 0.07);
    font-size: 0.68rem;
    user-select: none;
    transition: all 0.18s ease;
    position: relative;
    overflow: hidden;
}

.pedido-item:hover {
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.2);
}

.pedido-item.selected {
    border-color: var(--green) !important;
    background: rgba(0, 208, 132, 0.08) !important;
}

#barra-selecao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin: 0 10px 8px;
    background: rgba(0, 208, 132, 0.1);
    border: 1px solid rgba(0, 208, 132, 0.35);
    border-radius: 8px;
    font-size: 0.7rem;
    color: #e8f4ff;
}
#barra-selecao-texto { font-weight: 700; }
#btn-limpar-selecao {
    background: none;
    border: 1px solid rgba(232, 244, 255, 0.35);
    color: inherit;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.66rem;
    cursor: pointer;
}
#btn-limpar-selecao:hover { background: rgba(255, 255, 255, 0.1); }
body.tema-claro #barra-selecao { color: #1a1a2e; }
body.tema-claro #btn-limpar-selecao { border-color: rgba(0, 0, 0, 0.2); }

/* Segurar o clique no card (qualquer modelo) localiza/destaca o pino no mapa */
@keyframes pino-localizar-pulse {
    0% { outline: 3px solid rgba(0, 229, 255, 0.9); outline-offset: 2px; transform: scale(1.35); }
    100% { outline: 3px solid rgba(0, 229, 255, 0); outline-offset: 6px; transform: scale(1); }
}
.pino-localizando {
    animation: pino-localizar-pulse 1.1s ease-out;
    z-index: 1000 !important;
}

.pedido-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 8px 8px 0 0;
}

.pedido-item.status-aberto::before,
.pedido-item.status-pendente::before {
    background: #f59e0b;
}

.pedido-item.status-em_preparo::before {
    background: #3b82f6;
}

.pedido-item.status-pronto::before {
    background: #9b59b6;
}

.pedido-item.status-em_rota::before,
.pedido-item.status-despachado::before,
.pedido-item.status-encaminhado::before,
.pedido-item.status-aceito::before {
    background: #ffcc00;
}

.pedido-item.status-a_caminho::before,
.pedido-item.status-coletado::before,
.pedido-item.status-transito::before {
    background: #3498db;
}

/* === BOTOES DE ACAO DO CARD === */
.btn-acao-card {
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.14);
    border-radius: 6px;
    cursor: pointer;
    padding: 4px 7px;
    margin-left: 5px;
    font-size: 10px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.btn-acao-card:hover {
    background: rgba(0, 229, 255, 0.2);
    color: var(--cyan);
    border-color: rgba(0, 229, 255, 0.4);
    transform: scale(1.1);
}

.btn-editar-endereco {
    background: rgba(255, 159, 67, 0.07);
    border: 1px solid rgba(255, 159, 67, 0.14);
    color: var(--orange);
}


.btn-editar-endereco:hover {
    background: rgba(255, 159, 67, 0.2);
    border-color: rgba(255, 159, 67, 0.4);
    color: #fff;
}

/* === TOOLTIP GLOBAL DE ITENS (HOVER) === */
#tooltip-global-itens {
    position: absolute;
    display: none;
    background: rgba(6, 9, 20, 0.772);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 229, 255, 0.22);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 229, 255, 0.04);
    border-radius: 12px;
    padding: 14px;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    pointer-events: none;
    font-size: 13px;
    color: var(--text);
    transition: opacity 0.2s;
}

#tooltip-global-itens h4 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--cyan);
    font-size: 14px;
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.06em;
}

#tooltip-global-itens ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#tooltip-global-itens li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 229, 255, 0.06) !important;
    line-height: 1.4;
}

#tooltip-global-itens li:last-child {
    border-bottom: none;
}

#tooltip-global-itens li span {
    color: var(--text) !important;
}

#tooltip-global-itens li span[style*="#3498db"] {
    color: var(--cyan) !important;
}

#tooltip-global-itens li span[style*="#e74c3c"] {
    color: #ff8080 !important;
}

#tooltip-global-itens li span[style*="font-weight: 600"] {
    font-weight: 300 !important;
    opacity: 0.72;
}

/* === MAPA E PAINEL ROTAS === */
#map {
    flex-grow: 1;
    height: 100dvh;
    position: relative;
}

/* Fix para quadriculado entre tiles do Leaflet:
   o fundo do container só aparece nas frestas/carregamento — precisa combinar com o tema.
   Temas escuros (sem body.tema-claro) → fundo escuro; claros → bege OSM.
   No modo "escuro" (CSS invert no #map) o fundo é claro para FICAR escuro após o invert. */
.leaflet-container {
    background: #101418 !important;
}

body.tema-claro .leaflet-container {
    background: #f2efe9 !important;
}

#map.dark-mode .leaflet-container {
    background: #e8e8e8 !important;
}

.leaflet-tile-container img {
    image-rendering: auto;
    /* Expande o raster do layer em telas com escala fracionária (150%) —
       evita a linha de antialiasing na borda do tile */
    outline: 1px solid transparent;
}

/* DPR fracionário (Windows 125/150%): o resample bilinear deixa a borda de cada
   tile semitransparente e vira linha clara. Nearest-neighbor = borda opaca. */
#map.dpr-frac .leaflet-tile-container img {
    image-rendering: pixelated;
}

#painel-rotas {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(6, 9, 20, 0.92);
    color: var(--text);
    padding: 14px;
    border-radius: 14px;
    min-width: 190px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.04);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
}

#painel-rotas h4 {
    margin: 0 0 10px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    font-size: 0.72rem;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--cyan);
    font-weight: 800;
    font-family: 'Syne', sans-serif;
}

#lista-rotas-ativas {
    transition: 0.3s;
    font-size: 0.74rem;
    color: var(--muted);
}

.rota-ativa-item {
    margin-bottom: 5px;
    font-size: 0.74rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.30);
    padding: 6px 10px;
    border-radius: 8px;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: 0.2s;
}

.rota-ativa-item:hover {
    background: rgba(0, 229, 255, 0.07);
    transform: translateX(-2px);
}

.rota-ativa-item small {
    font-weight: 700;
    background: rgba(0, 229, 255, 0.10);
    color: var(--cyan);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.66rem;
}

.capacete-container {
    position: relative;
    width: 50px;
    height: 55px;
    pointer-events: none;
}

.capacete-img {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
}

.visor-text {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 90%;
    text-align: center;
}

.visor-text .nome {
    font-weight: 700;
    font-size: 10px;
    color: #000;
    line-height: 1;
    margin-left: 3px;
}

.pedido-wrapper {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pedido-box {
    z-index: 5;
    color: #1a1a2e;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 6px rgba(0, 0, 0, 0.3);
    position: relative;
    background-color: #f1c40f;
    font-family: 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.num-pedido {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
    letter-spacing: -0.3px;
}

.num-pedido-4 {
    font-size: 10px;
    letter-spacing: -0.5px;
}

.hora-pedido {
    font-size: 9px;
    line-height: 1;
    margin-top: 1px;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0;
}

.pino-novo-star {
    position: absolute;
    top: -1px;
    right: 0px;
    font-size: 7px;
    line-height: 1;
    color: white;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.pino-aberto {
    background-color: #ff4757 !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(255, 71, 87, 0.65), 0 0 6px rgba(255, 71, 87, 0.35) !important;
}

.pino-pronto {
    background-color: #9b59b6 !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(155, 89, 182, 0.65), 0 0 6px rgba(155, 89, 182, 0.35) !important;
}

.pino-em_rota,
.pino-despachado,
.pino-encaminhado,
.pino-aceito {
    background-color: #f1c40f !important;
    color: #1a1a2e !important;
    box-shadow: 0 4px 14px rgba(241, 196, 15, 0.60), 0 0 6px rgba(241, 196, 15, 0.30) !important;
}

.pino-a_caminho,
.pino-coletado,
.pino-transito {
    background-color: #3498db !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.65), 0 0 6px rgba(52, 152, 219, 0.35) !important;
    outline: 3px solid #3498db !important;
    outline-offset: 2px;
}

.pino-finalizado,
.pino-entregue,
.pino-concluido {
    background-color: #00d084 !important;
    color: #1a1a2e !important;
    box-shadow: 0 4px 14px rgba(0, 208, 132, 0.65), 0 0 6px rgba(0, 208, 132, 0.35) !important;
}

.pino-cancelado,
.pino-rejeitado {
    background-color: #111111 !important;
    color: #ff8080 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.70), 0 0 6px rgba(255, 128, 128, 0.35) !important;
}

/* === Pino Clássico (círculo com haste) === */
.pin-classico-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.pin-classico-head {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 6px rgba(0, 0, 0, 0.3);
    position: relative;
    font-family: 'DM Sans', system-ui, sans-serif;
    z-index: 5;
}

.pin-classico-tail {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 13px solid #f1c40f;
    margin-top: -1px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.pin-classico-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 4px;
    border-radius: 3px;
    margin-top: 2px;
    white-space: nowrap;
    letter-spacing: -0.3px;
    line-height: 1.4;
}

.pin-classico-head.urgente {
    outline: 2px solid var(--orange) !important;
    animation: pulso-urgente 1.3s ease-in-out infinite;
}

.pin-classico-head.atrasado {
    outline: 2px solid #e74c3c !important;
    animation: pulso-atrasado 0.85s ease-in-out infinite;
}

/* === Pino Google Maps (teardrop SVG) === */
.pin-gmaps-outer {
    transform-origin: center bottom;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.pin-gmaps-outer:hover {
    transform: scale(1.45);
    z-index: 10000 !important;
}

.pin-gmaps-svg.pin-gmaps-urgente {
    animation: pulso-gmaps-urg 1.3s ease-in-out infinite;
}

.pin-gmaps-svg.pin-gmaps-atrasado {
    animation: pulso-gmaps-atr 0.85s ease-in-out infinite;
}

@keyframes pulso-gmaps-urg {

    0%,
    100% {
        filter: none;
    }

    50% {
        filter: drop-shadow(0 0 7px var(--orange));
    }
}

@keyframes pulso-gmaps-atr {

    0%,
    100% {
        filter: none;
    }

    50% {
        filter: drop-shadow(0 0 7px #e74c3c);
    }
}

.pedido-item.status-cancelado {
    opacity: 0.72;
    border-left: 3px solid #ff8080 !important;
    background: rgba(255, 128, 128, 0.06) !important;
}

.pedido-item.status-cancelado .info-linha1 {
    color: #ff8080;
    text-decoration: line-through;
}

#modo-ver-tudo-badge {
    display: none;
    font-size: 8px;
    background: var(--orange);
    color: #000;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    font-weight: 900;
    letter-spacing: 0.04em;
    vertical-align: middle;
    pointer-events: none;
}

#modo-ver-tudo-badge.visivel {
    display: inline;
}

#btn-ver-tudo {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--muted);
    border-radius: 4px;
    padding: 1px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
    flex-shrink: 0;
    line-height: 1.4;
    margin-left: 4px;
}

#btn-ver-tudo:hover {
    border-color: var(--orange);
    color: var(--orange);
}

#btn-ver-tudo.ativo {
    background: rgba(255, 159, 67, 0.18);
    color: var(--orange);
    border-color: var(--orange);
}

.pedido-selecionado {
    outline: 3px solid var(--green);
    transform: scale(1.15);
    z-index: 1000 !important;
}

.pop-icone-pagamento {
    position: absolute;
    top: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    border: 1.5px solid #fff;
    opacity: 0;
    animation: sobeEDescePagamento 20s infinite ease-in-out;
}

.pop-dinheiro {
    background: #2ecc71;
    color: white;
}

.pop-cartao {
    background: #e056fd;
    color: white;
}

.pop-online {
    display: none !important;
}

@keyframes sobeEDescePagamento {

    0%,
    70% {
        transform: translateY(0);
        opacity: 0;
    }

    75%,
    95% {
        transform: translateY(-26px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 0;
    }
}

.animacao-borda {
    overflow: visible;
    background: transparent;
}

.animacao-borda::before {
    content: '';
    position: absolute;
    width: 140%;
    height: 140%;
    background: conic-gradient(from 0deg, #ff00ff, #00ffff, #ff9f43, #ff00ff);
    animation: girar-borda 1.2s linear infinite;
    z-index: 0;
    border-radius: 50%;
}

@keyframes girar-borda {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animacao-nascer {
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* === ALERTAS DE PRAZO === */
@keyframes pulso-urgente {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 159, 67, 0.75);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(255, 159, 67, 0);
    }
}

@keyframes pulso-atrasado {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.85);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(231, 76, 60, 0);
    }
}

/* Pin do mapa */
.pedido-box.urgente {
    outline: 2px solid var(--orange) !important;
    animation: pulso-urgente 1.3s ease-in-out infinite;
}

.pedido-box.atrasado {
    outline: 2px solid #e74c3c !important;
    animation: pulso-atrasado 0.85s ease-in-out infinite;
}

/* Card da lista lateral — apenas background, sem borda */
.pedido-item.prazo-urgente {
    background: rgba(255, 159, 67, 0.08) !important;
}

.pedido-item.prazo-atrasado {
    background: rgba(231, 76, 60, 0.08) !important;
}

/* Pronto há tempo demais sem despacho (esfriando no balcão) */
@keyframes pulso-pronto-parado {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.8);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(155, 89, 182, 0);
    }
}

.pedido-box.pronto-parado {
    outline: 2px solid #9b59b6 !important;
    animation: pulso-pronto-parado 1.1s ease-in-out infinite;
}

.pedido-item.pronto-parado {
    background: rgba(155, 89, 182, 0.10) !important;
}

/* Etiqueta do motoboy no card */
.info-linha1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
}

/* Selo de grupo (mesmo endereço/cliente) — mesmo conceito do .k-grp-tag no Kanban:
   classe só cuida do formato, a cor vem inline por grupo (ver _grpBadgesHtml). */
.grp-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    border: 1px solid;
    border-radius: 4px;
    padding: 0 5px;
    margin-left: 5px;
    white-space: nowrap;
}

.info-moto-tag {
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 2px;
    padding: 1px 5px 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.02em;
}

body.tema-claro .info-moto-tag {
    opacity: 0.85;
}

/* Info extra opcional do card (config "🪪 Card" no menu de Notificações) */
.info-extra {
    margin-top: 2px;
}

/* Linha de extras (endereço/pagamento/hora) fora de ".card-linha-principal" —
   ocupa a largura inteira do card em vez de ficar preso na coluna do nome,
   que é estreitada pelos círculos de fidelidade e pelos botões de ação.
   padding-left alinha visualmente com o texto do nome (largura do checkbox + gap). */
.info-extra-full {
    padding-left: 21px;
}

.info-extra-linha {
    font-size: 0.62rem;
    line-height: 1.35;
    color: rgba(232, 244, 255, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tema-claro .info-extra-linha {
    color: rgba(26, 34, 50, 0.6);
}

.info-extra-link {
    color: inherit;
    text-decoration: none;
}

.info-extra-link:hover {
    color: var(--cyan);
    text-decoration: underline;
}

/* Modelo "Atual" — endereço + hora (só HH:MM, sem data) na mesma linha; hora fica fixa
   no fim, endereço pode quebrar em até 2 linhas em vez de truncar no meio (a linha
   agora ocupa o card inteiro, então sobra espaço em vez de precisar de "..."). */
.info-extra-atual {
    margin-top: 2px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.info-extra-atual .info-extra-atual-end {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}
.info-extra-atual .info-extra-atual-hora {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Forma de pagamento inline, junto do nome do cliente (economiza altura do card) */
.info-pag-inline {
    font-size: 0.62rem;
    font-weight: 400;
    color: rgba(232, 244, 255, 0.55);
}

body.tema-claro .info-pag-inline {
    color: rgba(26, 34, 50, 0.6);
}

/* Modelo "Linha de ícones" — só ícones, tooltip no hover, sem texto competindo com o nome */
.info-extra-icones {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    margin-top: 2px;
}

/* Modelo "Bilhete" — endereço+pagamento+hora numa linha compacta só. Endereço
   trunca sozinho (flex:1, ellipsis); pagamento/hora ficam fixos no fim da linha
   (flex-shrink:0) — sem isso, endereço comprido comia o nowrap+ellipsis inteiro
   do container e sumia com pagamento/hora junto. */
.info-extra-bilhete {
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-extra-bilhete .info-bilhete-end {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.info-extra-bilhete .info-bilhete-fixo {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* === Modelo "Grade" — 3 mini-cards por linha, dentro da própria nav-bar (sidebar) === */
#grade-pedidos-container {
    overflow-y: auto;
    box-sizing: border-box;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    align-content: start;
    scrollbar-width: thin;
}

.grade-vazio {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px 0;
    color: rgba(232, 244, 255, 0.45);
    font-size: 0.68rem;
}

/* Bloco "mesmo endereço"/"mesmo cliente" — mesma ideia do .card-match da lista padrão,
   só que ocupando a largura toda do grid (grid-column:1/-1) e com um mini-grid próprio
   dentro pra manter os cards do grupo lado a lado. */
.grade-block {
    grid-column: 1 / -1;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(231, 76, 60, 0.30);
    border-radius: 10px;
    padding: 6px;
}

.grade-block-titulo {
    font-size: 0.58rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grade-block-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.grade-card {
    position: relative;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--grade-cor, rgba(255,255,255,0.16));
    border-radius: 8px;
    padding: 5px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: transform 0.1s ease;
    min-width: 0; /* sem isso, texto sem quebra (endereço) força a coluna do grid a crescer */
    overflow: hidden;
}

/* Faixa superior = status do pedido (mesma cor/critério do ::before em .pedido-item);
   a borda esquerda grossa (inline, ver _gradeCardHtml) = grupo mesmo endereço/cliente —
   dois sinais independentes, igual ao Kanban (cor lateral + cor superior). */
.grade-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 7px 7px 0 0;
}
.grade-card.status-aberto::before,
.grade-card.status-pendente::before { background: #f59e0b; }
.grade-card.status-em_preparo::before { background: #3b82f6; }
.grade-card.status-pronto::before { background: #9b59b6; }
.grade-card.status-em_rota::before,
.grade-card.status-despachado::before,
.grade-card.status-encaminhado::before,
.grade-card.status-aceito::before { background: #ffcc00; }
.grade-card.status-a_caminho::before,
.grade-card.status-coletado::before,
.grade-card.status-transito::before { background: #3498db; }

.grade-card:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
}
body.tema-claro .grade-card {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.tema-claro .grade-card:hover {
    background: #f7f9fb;
}
.grade-card.selected {
    border-color: var(--green) !important;
    background: rgba(0, 208, 132, 0.08) !important;
}
body.tema-claro .grade-card.selected {
    background: rgba(0, 208, 132, 0.12) !important;
}

.grade-card-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.grade-card-logo {
    height: 11px;
    max-width: 46px;
    object-fit: contain;
}
.grade-card-logo-txt {
    font-size: 0.5rem;
    font-weight: 800;
    color: var(--grade-cor, #999);
}
.grade-card-editar {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.6rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.65;
}
.grade-card-editar:hover { opacity: 1; }

.grade-card-num {
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
}
body.tema-claro .grade-card-num { color: #1a1a2e; }
/* Cor por % do prazo de entrega consumido (ver _percentualPrazoConsumido) — verde escuro
   recém-chegado, laranja aos 50%, vermelho aos 90%. Mesma cor nos 2 temas (alto contraste
   em ambos), por isso não precisa de variante body.tema-claro. */
.grade-card-num.grade-num-novo,
body.tema-claro .grade-card-num.grade-num-novo { color: #15803d; }
.grade-card-num.grade-num-alerta,
body.tema-claro .grade-card-num.grade-num-alerta { color: #f59e0b; }
.grade-card-num.grade-num-critico,
body.tema-claro .grade-card-num.grade-num-critico { color: #ef4444; }

.grade-card-nome {
    width: 100%;
    max-width: 100%;
    font-size: 0.52rem;
    color: rgba(232, 244, 255, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
body.tema-claro .grade-card-nome { color: #666; }

.grade-card-endereco {
    width: 100%;
    max-width: 100%;
    font-size: 0.48rem;
    color: rgba(232, 244, 255, 0.5);
    text-decoration: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.15;
}
.grade-card-endereco:hover { text-decoration: underline; }
.grade-card-endereco-pin {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
}
.grade-card-endereco-linhas {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    text-align: left;
}
.grade-card-endereco-bairro,
.grade-card-endereco-resto {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
/* Bairro é curto quase sempre — 1 linha com ellipsis basta. */
.grade-card-endereco-bairro {
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Rua+número costuma ser a parte que estoura — deixa quebrar em até 2 linhas
   (o grid da Grade não tem altura fixa por linha, então sobra espaço embaixo
   dos ícones/pills pra isso sem bagunçar o layout) em vez de cortar sempre. */
.grade-card-endereco-resto {
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
body.tema-claro .grade-card-endereco { color: #888; }

/* Modelo "Compacto" — mesmo topo do Padrão (logo + número + editar), só que sem nome
   nem endereço; número um pouco maior já que sobra mais espaço no card. */
.grade-card-compacto-num {
    font-size: 1.05rem;
}

.grade-card-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    margin-top: 1px;
}
.grade-card-pill {
    font-size: 0.5rem;
    padding: 1px 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: rgba(232, 244, 255, 0.75);
    white-space: nowrap;
}
body.tema-claro .grade-card-pill {
    background: #f0f0f0;
    color: #444;
}

/* === Circulos de Fidelidade + Cancelados, inline na linha principal do card === */
.card-linha-principal {
    display: flex;
    align-items: center;
    width: 100%;
}

.info-circulos {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin: 0 4px;
}

.exp-circulo {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 800;
}

.exp-fidelidade {
    background: rgba(0, 229, 255, 0.14);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--cyan);
}

.exp-cancelados {
    background: rgba(231, 76, 60, 0.16);
    border: 1px solid rgba(231, 76, 60, 0.55);
    color: #e74c3c;
}

.exp-risco {
    background: rgba(220, 38, 38, 0.18);
    border: 1px solid rgba(220, 38, 38, 0.6);
    font-size: 0.72rem;
    cursor: help;
}

/* Clicar numa rota (polyline) não desenha o retângulo de foco do navegador
   em volta do bounding box do path SVG */
path.leaflet-interactive:focus {
    outline: none;
}

/* Contador regressivo do prazo de entrega no card da nav-bar (minutos restantes;
   negativo = estourado). Pílula em vez de círculo pra caber "-12". */
.exp-prazo {
    width: auto;
    min-width: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: rgba(0, 208, 132, 0.14);
    border: 1px solid rgba(0, 208, 132, 0.45);
    color: #00d084;
    cursor: help;
}

.exp-prazo-urgente {
    background: rgba(241, 196, 15, 0.16);
    border-color: rgba(241, 196, 15, 0.55);
    color: #f1c40f;
}

.exp-prazo-atrasado {
    background: rgba(231, 76, 60, 0.18);
    border-color: rgba(231, 76, 60, 0.6);
    color: #e74c3c;
}

/* Prazo ainda não estourou, mas o tempo de rota estimado (ETA) já é maior que o
   tempo restante — avisa ANTES do atraso acontecer, não só depois (item 3 do plano). */
.exp-prazo-alerta {
    background: rgba(255, 159, 67, 0.18);
    border-color: rgba(255, 159, 67, 0.6);
    color: var(--orange);
}

/* Tempo de espera pré-despacho (minutos DECORRIDOS desde a criação do pedido) — pega
   pedido esquecido no preparo antes de virar atraso de entrega de verdade. Neutro
   (cyan) até o limite de alerta, some quando o pedido já foi despachado. */
.exp-espera {
    width: auto;
    min-width: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: rgba(0, 229, 255, 0.10);
    border: 1px solid rgba(0, 229, 255, 0.35);
    color: var(--cyan);
    cursor: help;
}

.exp-espera-alerta {
    background: rgba(255, 159, 67, 0.18);
    border-color: rgba(255, 159, 67, 0.6);
    color: var(--orange);
}

.exp-espera-atrasado {
    background: rgba(231, 76, 60, 0.18);
    border-color: rgba(231, 76, 60, 0.6);
    color: #e74c3c;
}

@keyframes pop-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.3);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* === MODAL DE ROTAS === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.modal-box {
    background: rgba(6, 9, 20, 0.99);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 18px;
    width: 100%;
    max-width: 420px;
    max-height: 95dvh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 229, 255, 0.05);
    box-sizing: border-box;
}

.modal-box h3 {
    margin: 0 0 5px 0;
    font-family: 'Syne', sans-serif;
    color: var(--cyan);
    text-align: center;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
}

.modal-subtitle {
    font-size: 0.72rem;
    text-align: center;
    color: var(--muted);
    margin-bottom: 14px;
}

#area-transferencia {
    background: rgba(0, 0, 0, 0.28);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

#area-transferencia select {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(8, 12, 24, 0.9);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
    outline: none;
}

#area-transferencia select option {
    background: #131929;
    color: #e8f4ff;
}

.btn-transf {
    padding: 7px 14px;
    background: linear-gradient(135deg, #994400, var(--orange));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-transf:hover {
    background: linear-gradient(135deg, #bb5500, #ffb347);
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.28);
}

.input-text-modal {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: rgba(8, 12, 24, 0.85);
    color: var(--text);
    border-radius: 10px;
    font-size: 0.90rem;
    font-weight: 700;
    margin-bottom: 14px;
    box-sizing: border-box;
    outline: none;
    letter-spacing: 0.03em;
}

.input-text-modal:focus {
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.07);
}

#input-rota {
    text-align: center;
    color: var(--cyan);
}

#ordem-lista {
    background: rgba(0, 0, 0, 0.20);
    border-radius: 10px;
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.ordem-item {
    background: rgba(12, 18, 36, 0.92);
    padding: 9px 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 229, 255, 0.09);
    font-size: 0.78rem;
    color: var(--text);
}

.drag-handle {
    cursor: grab;
    font-size: 17px;
    color: var(--muted);
    padding-right: 10px;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.22);
    cursor: pointer;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    transition: 0.2s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.28);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.modal-btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    font-size: 0.80rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: 0.2s;
}

.btn-confirm {
    background: linear-gradient(135deg, #007a3d, var(--green));
    color: white;
}

.btn-confirm:hover {
    box-shadow: 0 4px 14px rgba(0, 208, 132, 0.30);
    transform: translateY(-1px);
}

.btn-cancel {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.26);
}

/* === 🚀 PAINEL DE EDIÇÃO / CRIAÇÃO DE PEDIDO (CRUD COMPLETO) === */
#painel-editar-endereco {
    display: none;
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    background: rgba(6, 9, 20, 0.96);
    border: 2px solid var(--orange);
    border-radius: 16px;
    width: 95%;
    max-width: 650px;
    padding: 24px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.90), 0 0 30px rgba(255, 159, 67, 0.50);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
}

#painel-editar-endereco h3 {
    margin: 0 0 15px 0;
    color: var(--orange);
    text-align: center;
    font-family: 'Syne', sans-serif;
    letter-spacing: 0.05em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.form-grid label {
    font-size: 0.60rem;
    color: var(--cyan);
    font-weight: bold;
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
    letter-spacing: 0.04em;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--border);
    background: rgba(8, 12, 24, 0.85);
    color: var(--text);
    border-radius: 8px;
    font-size: 0.80rem;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.1);
}

.form-grid select option {
    background: #131929;
    color: #e8f4ff;
}

.form-grid .full-width {
    grid-column: span 12;
}

.form-grid textarea {
    resize: vertical;
    min-height: 64px;
}

#cep-status {
    font-size: 0.60rem;
    margin-top: 3px;
    display: block;
    min-height: 14px;
}


/* === TOOLTIP DOS PINOS DE PEDIDO NO MAPA === */
.tooltip-pedido-mapa {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 10px 12px;
    max-width: 430px;
    pointer-events: none;
    opacity: 0.97 !important;
}

.tooltip-pedido-mapa::before {
    display: none;
}

/* Customizando a caixinha do Google Autocomplete para o tema escuro */
.pac-container {
    z-index: 10000 !important;
    background-color: #1e293b;
    color: #fff;
    border: 1px solid var(--orange);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    font-family: 'DM Sans', sans-serif;
}

.pac-item {
    color: #ccc;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px;
    cursor: pointer;
}

.pac-item-query {
    color: #fff;
    font-weight: bold;
}

.pac-item:hover {
    background-color: rgba(255, 159, 67, 0.15);
    color: #fff;
}

.pac-logo::after {
    display: none;
}

/* === BARRA INFERIOR DE ESTATÍSTICAS === */
#bottom-stats-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    transform: translateY(100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#bottom-stats-container.show {
    transform: translateY(0);
}

#bottom-tab-row {
    display: flex;
    gap: 3px;
    margin-top: -28px;
    pointer-events: auto;
}

.tab-btn {
    background: rgba(6, 9, 20, 0.92);
    color: var(--muted);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 6px 16px;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    pointer-events: auto;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -4px 20px rgba(255, 159, 67, 0.05);
    transition: 0.2s;
    font-family: 'Syne', sans-serif;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

#tab-btn-stats.active {
    background: #003d3d;
    color: var(--cyan);
    border-color: var(--cyan);
}

#tab-btn-historico.active {
    background: #3d2200;
    color: var(--orange);
    border-color: var(--orange);
}

.tab-btn-recolher {
    margin-left: 6px;
    opacity: 0.55;
    font-size: 0.70rem;
    padding: 6px 10px;
}

.tab-btn-recolher:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text) !important;
}

#btn-recolher {
    display: none;
}

#bottom-stats-container.show #btn-recolher {
    display: inline-flex;
    align-items: center;
}

#bottom-stats-bar {
    background: rgba(6, 9, 20, 0.90);
    box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.70);
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 28px;
    align-items: center;
    padding: 12px 20px;
    box-sizing: border-box;
    pointer-events: auto;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: none;
    position: relative;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
    flex-wrap: wrap;
}

#bottom-stats-bar::before,
#painel-historico::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    border-radius: 1px;
}

#bottom-stats-bar::before {
    background: linear-gradient(to right, transparent, var(--cyan), transparent);
}

#painel-historico::before {
    background: linear-gradient(to right, transparent, var(--orange), transparent);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-weight: 700;
}

.badge {
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.80rem;
    font-weight: 900;
    color: white;
    min-width: 24px;
    text-align: center;
    letter-spacing: 0.02em;
}

#badge-abertos {
    background: linear-gradient(135deg, #c0392b, #ff4757);
}

#badge-prontos {
    background: linear-gradient(135deg, #6c3483, #9b59b6);
}

#badge-transito {
    background: linear-gradient(135deg, #1a5276, #3498db);
}

#badge-entregues {
    background: linear-gradient(135deg, #1d6a38, var(--green));
}

#badge-cancelados {
    background: linear-gradient(135deg, #922b21, #e74c3c);
}

#grafico-prazos {
    width: 220px;
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

#grafico-labels {
    font-size: 0.60rem;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    letter-spacing: 0.06em;
}

#barra-bg-prazo {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    display: flex;
    overflow: hidden;
}

#barra-noprazo {
    background: linear-gradient(90deg, #007a3d, var(--green));
    transition: width 0.4s ease;
    height: 100%;
}

#barra-atrasado {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    transition: width 0.4s ease;
    height: 100%;
}

/* === PAINEL HISTÓRICO === */
#painel-historico {
    background: rgba(6, 9, 20, 0.90);
    width: 100%;
    box-sizing: border-box;
    padding: 12px 20px 14px;
    pointer-events: auto;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: none;
    position: relative;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
    display: none;
}

#historico-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

#hist-date,
#hist-pedido-select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(8, 12, 24, 0.185);
    color: var(--text);
    font-size: 0.77rem;
    font-weight: 600;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s;
    color-scheme: dark;
}

#hist-date {
    width: 148px;
    flex-shrink: 0;
}

#hist-pedido-select {
    flex: 1;
    min-width: 180px;
}

#hist-date:focus,
#hist-pedido-select:focus {
    border-color: rgba(0, 229, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.07);
}

#hist-pedido-select option {
    background: #131929;
    color: #e8f4ff;
}

#btn-buscar-hist {
    padding: 6px 14px;
    border-radius: 8px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #0055aa, var(--blue));
    color: white;
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Syne', sans-serif;
}

#btn-buscar-hist:hover {
    background: linear-gradient(135deg, #006acc, #1a9fff);
    box-shadow: 0 4px 14px rgba(26, 143, 255, 0.28);
}

#historico-content {
    min-height: 60px;
}

#historico-placeholder {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    padding: 8px 0;
    letter-spacing: 0.04em;
}

/* === TIMELINE === */
.hist-info-row {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.hist-chip {
    font-size: 0.69rem;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.hist-chip strong {
    color: var(--text);
    font-weight: 700;
}

.tl2-outer {
    padding: 14px 20px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.52);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tl2-outer::-webkit-scrollbar {
    height: 3px;
}

.tl2-outer::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 3px;
}

.tl2-track {
    position: relative;
    height: 138px;
    min-width: 420px;
    width: 100%;
}

.tl2-base-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50px;
    height: 2px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 2px;
}

.tl2-seg {
    position: absolute;
    top: 50px;
    height: 3px;
    border-radius: 2px;
}

.tl2-ts {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    font-family: Arial, sans-serif;
    white-space: nowrap;
    z-index: 1;
    letter-spacing: 0.01em;
}

.tl2-ts.stagger {
    top: 24px;
}

.tl2-ts.future {
    opacity: 0.38;
    font-style: italic;
    color: var(--muted);
}

.tl2-tick {
    position: absolute;
    top: 20px;
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-50%);
    z-index: 1;
}

.tl2-tick.stagger {
    top: 42px;
    height: 4px;
}

.tl2-delta-pill {
    position: absolute;
    top: 62px;
    transform: translateX(-50%);
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.50);
    font-family: Arial, sans-serif;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 2px 7px;
    border-radius: 4px;
    z-index: 3;
}

.tl2-delta-pill.late {
    color: #ff4757;
    border-color: rgba(255, 71, 87, 0.40);
    background: rgba(255, 71, 87, 0.12);
}

.tl2-delta-pill.dim {
    opacity: 0.40;
}

.tl2-dot-wrap {
    position: absolute;
    top: 50px;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.tl2-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.tl2-dot.prazo-ring {
    background: transparent !important;
    border-width: 2.5px !important;
    width: 13px;
    height: 13px;
}

.tl2-dot.future {
    background: transparent !important;
    border-style: dashed !important;
    border-width: 1.5px !important;
    box-shadow: none !important;
    opacity: 0.40;
}

.tl2-stage-name {
    position: absolute;
    top: 84px;
    transform: translateX(-50%);
    font-size: 0.60rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.55);
    font-family: Arial, sans-serif;
    white-space: nowrap;
    z-index: 1;
}

.tl2-stage-name.stagger {
    top: 101px;
}

.tl2-stage-extra {
    position: absolute;
    top: 118px;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--cyan);
    font-family: Arial, sans-serif;
    white-space: nowrap;
    z-index: 1;
}

.tl2-mobile-modal {
    width: 100%;
}

.tl2-modal-header {
    display: none;
}

.tl2-close-btn {
    display: none;
}

.tl2-vert {
    display: none;
}

.tl2-vs {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.tl2-vs-spine {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 26px;
}

.tl2-vs-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.tl2-vs-dot.prazo-ring {
    background: transparent !important;
    border-width: 3px !important;
}

.tl2-vs-dot.future {
    background: transparent !important;
    border-style: dashed !important;
    opacity: 0.4;
}

.tl2-vs-seg {
    width: 2px;
    min-height: 56px;
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    margin-top: 5px;
}

.tl2-vs-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 6px;
    flex: 1;
}

.tl2-vs-time {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    font-family: Arial, sans-serif;
    line-height: 1.1;
}

.tl2-vs-time.future {
    opacity: 0.4;
    font-style: italic;
}

.tl2-vs-name {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.50);
    font-family: Arial, sans-serif;
}

.tl2-vs-extra {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--cyan);
    font-family: Arial, sans-serif;
}

.tl2-vs-pill {
    display: inline-block;
    align-self: flex-start;
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 3px 12px;
    border-radius: 4px;
    font-family: Arial, sans-serif;
}

.tl2-vs-pill.late {
    color: #ff4757;
    border-color: rgba(255, 71, 87, 0.35);
    background: rgba(255, 71, 87, 0.10);
}

.tl2-vs-pill.dim {
    opacity: 0.40;
}

/* === BADGE DE ENDEREÇO DUPLO COM TOOLTIP === */
.pedido-wrapper,
.pin-tipo-classico,
.pin-gmaps-outer {
    overflow: visible !important;
}

.pin-badge-duplo {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 20px;
    height: 20px;
    background: #e67e22;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    font-family: 'DM Sans', system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    z-index: 30;
    cursor: pointer; /* clique abre o menu de seleção fina do grupo */
    line-height: 1;
}

.pin-badge-duplo::before {
    content: '';
    position: absolute;
    inset: -5px;
    border: 2px dashed rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    pointer-events: none;
    animation: rodar-radar 2.5s linear infinite;
}

@keyframes rodar-radar {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Botão "Ramificar" dentro do tooltip do badge (não mais um ícone flutuante sobre
   o pino — isso colidia visualmente com pinos vizinhos quando ficam próximos no
   mapa). Mesma cor do raminho/hub (#2979ff) já usados quando o grupo está ramificado. */
.pdt-ramifica-row {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #eef1f5;
    flex-shrink: 0;
}

.pin-ramifica-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: #2979ff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
}

.pin-ramifica-btn:hover {
    background: #1f66d8;
}

.pin-ramifica-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* Ponto de origem do grupo ramificado (endereço real, de onde os pedidos foram
   deslocados pro leque) */
.hub-grupo-duplo {
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
    cursor: pointer;
}

/* Tooltip do hub (endereço + quantidade de pedidos), mesma linguagem visual
   do tooltip do badge duplo */
.leaflet-tooltip.hub-tooltip {
    background: white;
    color: #2c3e50;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
    /* Tooltip de rota (linha do trajeto, ver .pin-ramifica-btn acima) usa o
       mesmo tooltipPane do Leaflet — sem z-index próprio, quem aparece por
       cima é só quem foi inserido no DOM por último, então a linha da rota
       às vezes cobria o tooltip do hub. Força esse aqui sempre à frente. */
    z-index: 10000 !important;
}

.leaflet-tooltip.hub-tooltip::before {
    border-top-color: #dde3ea;
}

/* Tooltip do badge */
.pin-duplo-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: -4px;
    background: white;
    color: #2c3e50;
    border-radius: 8px;
    padding: 9px 12px;
    min-width: 280px;
    max-width: 340px;
    flex-direction: column;
    font-size: 12px;
    line-height: 1.45;
    z-index: 1000;
    pointer-events: auto;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
    border: 1px solid #dde3ea;
    white-space: normal;
}

.pin-badge-duplo:hover .pin-duplo-tooltip,
.pin-badge-duplo.pdt-aberto .pin-duplo-tooltip {
    display: flex;
}

/* Lista de pedidos rola por dentro; o botão "Ramificar" (fora desta div) fica
   sempre fixo no rodapé do tooltip, mesmo com muitos pedidos no mesmo endereço. */
.pdt-lista {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* Flip: mostra abaixo quando o badge está perto do topo da tela */
.pin-badge-duplo.pdt-flip-down .pin-duplo-tooltip {
    bottom: auto;
    top: calc(100% + 8px);
}

@media (max-width: 480px) {
    .pin-duplo-tooltip {
        min-width: 240px;
        max-width: calc(100vw - 24px);
    }
}

.pdt-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 2px;
}

.pdt-num-txt {
    font-size: 12px;
    font-weight: 800;
    color: #1a2535;
    white-space: nowrap;
}

.pdt-status-inline {
    font-size: 10px;
    font-weight: 700;
    color: #555;
    white-space: nowrap;
}

.pdt-cliente {
    color: #6b7684;
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.pdt-end {
    color: #34495e;
    font-size: 11px;
}

.pdt-comp {
    color: #888;
    font-style: italic;
    font-size: 10.5px;
    margin-top: 1px;
}

.pdt-footer {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 10px;
    color: #555;
    flex-wrap: wrap;
}

.pdt-hr {
    border: none;
    border-top: 1px solid #e8ecf0;
    margin: 6px 0;
}

@keyframes pulsar-onda {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
        border-width: 1px;
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
    }
}

@media (max-width: 768px) {
    .tl2-mobile-modal {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: #06091a;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .tl2-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px 10px;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }

    .tl2-modal-title {
        font-size: 0.88rem;
        font-weight: 700;
        color: var(--text);
        font-family: Arial, sans-serif;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 50px);
    }

    .tl2-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--text);
        font-size: 1.1rem;
        cursor: pointer;
    }

    .tl2-mobile-content {
        flex: 1;
        overflow-y: auto;
        padding: 24px 28px 40px;
    }

    .tl2-outer {
        display: none;
    }

    .tl2-vert {
        display: block;
        width: 100%;
    }
}

.tl-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    font-family: Arial, sans-serif;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.25);
}

.tl-badge.noprazo {
    background: rgba(0, 55, 28, 0.92);
    border: 1px solid rgba(0, 208, 132, 0.55);
    color: #4fffba;
}

.tl-badge.atrasado {
    background: rgba(70, 5, 15, 0.92);
    border: 1px solid rgba(255, 71, 87, 0.55);
    color: #ff8080;
}

.tl-badge.pendente {
    background: rgba(55, 42, 0, 0.92);
    border: 1px solid rgba(241, 196, 15, 0.55);
    color: #f1c40f;
}

@media (max-width: 768px) {
    #sidebar {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 3000;
        height: 100dvh;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.7);
    }

    #sidebar:not(.collapsed) {
        width: 175px;
        border-right: none;
    }

    #sidebar-placeholder {
        width: 175px;
    }

    #sidebar.collapsed~#sidebar-placeholder {
        width: 0;
    }

    /* Redimensionar arrastando não faz sentido em tela estreita/touch */
    #sidebar-resizer {
        display: none;
    }

    #sidebar.collapsed~#toggle-sidebar {
        left: 0;
        width: 42px;
        height: 42px;
        font-size: 20px;
        border-radius: 0 10px 10px 0;
        color: white !important;
    }

    #sidebar:not(.collapsed)~#toggle-sidebar {
        left: 175px;
        top: 15px;
        width: 42px;
        height: 42px;
        font-size: 20px;
        border-radius: 0 10px 10px 0;
        background: rgba(255, 61, 127, 0.15);
        color: white !important;
        border-color: rgba(255, 61, 127, 0.3);
    }

    .acc-header {
        padding: 10px 12px;
        font-size: 0.58rem;
    }

    .acc-body select,
    .acc-body input,
    .btn-action {
        font-size: 0.61rem;
        padding: 8px;
    }

    .pedido-item {
        padding: 8px 6px;
        font-size: 0.65rem;
    }

    #painel-rotas {
        display: none !important;
        top: 10px;
        bottom: auto;
        right: 10px;
        left: auto;
        min-width: 120px;
        max-width: 175px;
        padding: 8px 10px;
    }

    #painel-rotas h4 {
        font-size: 0.68rem;
        margin-bottom: 5px;
    }

    .rota-ativa-item {
        font-size: 0.68rem;
        padding: 4px;
        margin-bottom: 4px;
    }

    #zoom-ctrl {
        display: none !important;
    }

    #bottom-stats-bar {
        gap: 10px;
        padding: 10px;
        font-size: 0.66rem;
    }

    #grafico-prazos {
        width: 100%;
        margin-left: 0;
        margin-top: 0;
        margin-bottom: 8px;
        order: -1;
    }

    #historico-filters {
        flex-wrap: wrap;
    }

    #hist-date {
        width: 100%;
    }

    #hist-pedido-select {
        min-width: 0;
    }

    .tl2-mobile-modal .hist-chip {
        font-size: 0.80rem;
        padding: 5px 12px;
    }

    .tl2-mobile-modal .tl-badge {
        font-size: 0.84rem;
        padding: 8px 18px;
        margin-top: 10px;
    }

    .tab-btn {
        padding: 6px 11px;
        font-size: 0.58rem;
    }

    #tooltip-global-itens {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        max-height: 60vh !important;
        pointer-events: auto !important;
    }

    #tema-wrapper {
        top: 10px;
    }

    #select-tema {
        font-size: 0.72rem;
        padding: 4px 20px 4px 8px;
    }
}

/* === TEMA ESCURO DO MAPA === */
#map.dark-mode {
    filter: invert(1) hue-rotate(180deg) brightness(0.85) saturate(0.65);
}

#map.dark-mode .leaflet-marker-pane,
#map.dark-mode .leaflet-overlay-pane,
#map.dark-mode .leaflet-popup-pane,
#map.dark-mode .leaflet-tooltip-pane,
#map.dark-mode .leaflet-control-container,
#map.dark-mode #painel-rotas,
#map.dark-mode #bottom-stats-container,
#map.dark-mode #tema-wrapper {
    filter: invert(1) hue-rotate(180deg) brightness(1.18) saturate(1.54);
}

/* Zoom — dentro do #tema-wrapper, à esquerda do seletor de mapa */
#zoom-ctrl {
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding-right: 6px;
    border-right: 1px solid var(--border);
    margin-right: 2px;
}

#zoom-ctrl button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: #e2e8f0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 10px rgba(0, 229, 255, 0.07);
    user-select: none;
}

#zoom-ctrl button:hover {
    background: rgba(0, 229, 255, 0.13);
    border-color: rgba(0, 229, 255, 0.4);
    color: #00e5ff;
    transform: scale(1.08);
}

#zoom-ctrl button:active {
    transform: scale(0.94);
}

body.tema-claro #zoom-ctrl button {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1e293b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

body.tema-claro #zoom-ctrl button:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #3498db;
    color: #3498db;
}

/* === BUSCA DE CLIENTE NO MAPA === */
#busca-cliente-painel {
    display: none;
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    align-items: center;
    gap: 8px;
    background: rgba(6, 9, 20, 0.97);
    border: 1px solid rgba(0, 229, 255, 0.30);
    border-radius: 24px;
    padding: 8px 12px 8px 18px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 229, 255, 0.10);
    min-width: 270px;
    animation: mini-chat-in 0.22s ease;
}

#busca-cliente-painel.ativo {
    display: flex;
}

#busca-cliente-input {
    background: none;
    border: none;
    color: var(--text);
    font-size: 14px;
    flex: 1;
    outline: none;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    min-width: 120px;
}

#busca-cliente-input::placeholder {
    color: var(--muted);
}

#busca-cliente-resultado {
    font-size: 11px;
    white-space: nowrap;
    color: rgba(0, 229, 255, 0.75);
    font-weight: 600;
}

#busca-cliente-limpar {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 50%;
    line-height: 1;
    transition: color 0.15s;
}

#busca-cliente-limpar:hover {
    color: #ff6b6b;
}

/* Blur dos tiles ao buscar */
#map.mapa-busca-ativa .leaflet-tile-pane {
    filter: blur(4px) brightness(0.28);
    transition: filter 0.35s ease;
}

#map.mapa-busca-ativa .leaflet-shadow-pane {
    opacity: 0;
}

/* Botão de busca — igual ao padrão dos outros botões do tema-wrapper */
#btn-buscar-cliente {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: var(--cyan);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 229, 255, 0.08);
}

#btn-buscar-cliente:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    transform: scale(1.08);
}

#btn-buscar-cliente.active {
    background: rgba(0, 229, 255, 0.18);
    border-color: rgba(0, 229, 255, 0.55);
    color: var(--cyan);
}

#tema-wrapper {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
}

#btn-acoes-rapidas {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: var(--cyan);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 229, 255, 0.08);
}

#btn-acoes-rapidas:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    transform: scale(1.08);
}

#btn-notificacoes {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: var(--cyan);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 229, 255, 0.08);
    position: relative;
}

#btn-notificacoes:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    transform: scale(1.08);
}

/* ===== BOTÃO ALERTAS ===== */
#btn-alertas {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: #f59e0b;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(245, 158, 11, 0.08);
    position: relative;
}

#btn-alertas:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    transform: scale(1.08);
}

#btn-alertas.tem-alertas {
    border-color: rgba(245, 158, 11, 0.5);
    animation: alertas-pulse 2s ease-in-out infinite;
}

@keyframes alertas-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 8px rgba(245, 158, 11, 0.15);
    }

    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(245, 158, 11, 0.45);
    }
}

.alerta-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f59e0b;
    color: #0f172a;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    z-index: 1002;
}

#painel-alertas {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(6, 9, 20, 0.97);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    min-width: 300px;
    max-width: 360px;
    z-index: 1001;
}

#painel-alertas.aberto {
    display: flex;
    flex-direction: column;
}

.alertas-header {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(245, 158, 11, 0.7);
    padding: 10px 14px 7px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.1);
    flex-shrink: 0;
}

#lista-alertas {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.alerta-item {
    font-size: 11.5px;
    color: #e2e8f0;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.5;
}

.alerta-item:last-child {
    border-bottom: none;
}

.alerta-item .alerta-ts {
    color: #f59e0b;
    font-weight: 700;
    margin-right: 6px;
    font-size: 10.5px;
}

.alerta-item.nao-lido {
    background: rgba(245, 158, 11, 0.06);
}

.alertas-vazio {
    padding: 16px 14px;
    font-size: 11.5px;
    color: #64748b;
    text-align: center;
}

.alertas-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 10px;
    flex-shrink: 0;
}

.alertas-footer button {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.alertas-footer button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

/* ===== BOTÃO + PAINEL KDS MSG ===== */
#btn-kds-msg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: #a78bfa;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(167, 139, 250, 0.08);
    position: relative;
}

#btn-kds-msg:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.5);
    transform: scale(1.08);
}

#painel-kds-msg {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: rgba(6, 9, 20, 0.96);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    z-index: 1002;
    overflow: hidden;
}

#painel-kds-msg.aberto {
    display: block;
}

.kds-msg-header {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.7);
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.kds-msg-tipo-row {
    display: flex;
    gap: 14px;
    padding: 8px 12px 0;
}

.kds-tipo-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
}

.kds-tipo-urgente {
    color: #f87171;
}

.kds-tipo-label input[type="radio"] {
    accent-color: #a78bfa;
    cursor: pointer;
}

#kds-msg-texto {
    display: block;
    width: calc(100% - 24px);
    margin: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12.5px;
    padding: 7px 9px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#kds-msg-texto:focus {
    border-color: rgba(167, 139, 250, 0.5);
}

.kds-msg-templates {
    padding: 4px 12px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.kds-msg-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
    width: 100%;
    margin-bottom: 2px;
}

.kds-msg-templates button {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 4px;
    color: #94a3b8;
    font-size: 10px;
    padding: 3px 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.kds-msg-templates button:hover {
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.3);
}

.kds-msg-duracao-row {
    padding: 0 12px 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.kds-dur-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.kds-dur-btn:hover,
.kds-dur-btn.selected {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.45);
    color: #c4b5fd;
}

.kds-msg-footer {
    display: flex;
    gap: 6px;
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.kds-btn-cancelar {
    flex: 1;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #f87171;
    font-size: 10.5px;
    font-weight: 700;
    padding: 6px;
    cursor: pointer;
    transition: background 0.2s;
    letter-spacing: 0.04em;
}

.kds-btn-cancelar:hover {
    background: rgba(239, 68, 68, 0.1);
}

.kds-btn-enviar {
    flex: 2;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 6px;
    color: #c4b5fd;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.kds-btn-enviar:hover {
    background: rgba(167, 139, 250, 0.3);
}

/* historico KDS */
#kds-historico-section {
    border-bottom: 1px solid rgba(167, 139, 250, 0.25);
    padding: 6px 12px 10px;
    background: rgba(124, 58, 237, 0.07);
    border-radius: 0 0 6px 6px;
}

.kds-hist-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.5);
    margin-bottom: 4px;
}

#kds-historico-lista {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kds-hist-row {
    display: flex;
    align-items: center;
    background: rgba(124, 58, 237, 0.09);
    border-radius: 5px;
    padding: 3px 6px;
    gap: 6px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
}

.kds-hist-num {
    font-weight: 800;
    color: #e9d5ff;
    min-width: 38px;
    font-size: 12px;
}

.kds-hist-tag {
    font-size: 9px;
    font-weight: 700;
    background: rgba(167, 139, 250, 0.22);
    border-radius: 3px;
    padding: 1px 5px;
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.kds-hist-tempo {
    margin-left: auto;
    font-weight: 800;
    color: #86efac;
    min-width: 34px;
    text-align: right;
    font-size: 11px;
}

.kds-hist-hora {
    color: #94a3b8;
    font-size: 10px;
    min-width: 34px;
    text-align: right;
}

.kds-hist-vazio {
    font-size: 10px;
    color: #94a3b8;
    padding: 4px 0;
}

.kds-media-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
    border-radius: 4px;
    padding: 2px 6px;
    letter-spacing: 0.04em;
}

.kds-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* tema claro */
body.tema-claro #btn-kds-msg {
    background: rgba(228, 232, 240, 0.95);
    border-color: rgba(0, 0, 0, 0.18);
    color: #7c3aed;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 10px rgba(109, 40, 217, 0.06);
}

body.tema-claro #painel-kds-msg {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(109, 40, 217, 0.25);
}

body.tema-claro .kds-msg-header {
    color: #6d28d9;
    border-color: rgba(109, 40, 217, 0.15);
}

body.tema-claro #kds-msg-texto {
    background: #f8f5ff;
    border-color: rgba(109, 40, 217, 0.2);
    color: #1e293b;
}

body.tema-claro .kds-tipo-label {
    color: #334155;
}

body.tema-claro .kds-media-badge {
    background: rgba(109, 40, 217, 0.12);
    color: #6d28d9;
}

body.tema-claro #kds-historico-section {
    border-color: rgba(109, 40, 217, 0.2);
    background: rgba(109, 40, 217, 0.05);
}

body.tema-claro .kds-hist-label {
    color: rgba(109, 40, 217, 0.75);
}

body.tema-claro .kds-hist-row {
    background: rgba(109, 40, 217, 0.07);
    color: #1e0a40;
}

body.tema-claro .kds-hist-num {
    color: #6d28d9;
}

body.tema-claro .kds-hist-tag {
    background: rgba(109, 40, 217, 0.14);
    color: #7c3aed;
    border-color: rgba(109, 40, 217, 0.25);
}

body.tema-claro .kds-hist-tempo {
    color: #16a34a;
}

body.tema-claro .kds-hist-hora {
    color: #64748b;
}

body.tema-claro .kds-hist-vazio {
    color: #94a3b8;
}

#menu-notificacoes {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(6, 9, 20, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 10px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    min-width: 265px;
    padding-bottom: 4px;
    z-index: 1001;
    -webkit-overflow-scrolling: touch;
}

#menu-notificacoes.aberto {
    display: block;
}

/* --- Notification menu groups --- */
.notif-header {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.5);
    padding: 10px 14px 7px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

.notif-grupo {
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.11);
    border-radius: 7px;
    padding: 6px 10px;
    margin: 0 10px 8px;
}

.notif-grupo.notif-grupo-solo {
    margin-top: 8px;
}

.notif-grupo-titulo {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.6);
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

.notif-grupo-acc .notif-grupo-titulo {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    margin-bottom: 0;
}

.notif-grupo-acc.open .notif-grupo-titulo {
    margin-bottom: 5px;
}

.notif-grupo-chevron {
    font-size: 10px;
    color: rgba(0, 229, 255, 0.5);
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.notif-grupo-acc.open .notif-grupo-chevron {
    transform: rotate(180deg);
}

.notif-grupo-body {
    display: none;
}

.notif-grupo-acc.open .notif-grupo-body {
    display: block;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover .notif-label {
    color: var(--cyan);
}

.notif-item input[type="checkbox"],
.notif-item input[type="radio"] {
    display: none;
}

.notif-check-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid rgba(0, 229, 255, 0.35);
    background: rgba(0, 229, 255, 0.04);
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
}

.notif-item input[type="checkbox"]:checked+.notif-check-box,
.notif-item input[type="radio"]:checked+.notif-radio-box {
    background: var(--cyan);
    border-color: var(--cyan);
}

.notif-item input[type="checkbox"]:checked+.notif-check-box::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 1px;
    font-size: 11px;
    color: #060914;
    font-weight: 900;
    line-height: 1;
}

.notif-radio-box {
    border-radius: 50% !important;
}

.notif-item input[type="radio"]:checked+.notif-radio-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #060914;
}

.notif-radio-subtitulo {
    font-size: 10px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 0.05em;
    padding: 4px 0 2px;
    text-transform: uppercase;
}

.notif-label {
    font-size: 12px;
    color: #e8f4ff;
    flex: 1;
    line-height: 1.3;
    transition: color 0.15s;
}

/* --- Filtros de Rotas Prévias --- */
.rotas-filtros {
    display: flex;
    gap: 5px;
    padding: 8px 10px 8px;
    justify-content: space-between;
    border-top: 1px solid rgba(0, 229, 255, 0.06);
    margin-top: 2px;
}

.rotas-filtro-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.rotas-filtro-label {
    font-size: 8.5px;
    font-weight: 700;
    color: rgba(0, 229, 255, 0.55);
    letter-spacing: 0.2px;
    text-align: center;
}

.rotas-filtro-unidade {
    font-size: 9px;
    color: rgba(0, 229, 255, 0.35);
    margin-top: -2px;
}

.rotas-filtros input[type="number"] {
    width: 40px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 2px;
    outline: none;
    transition: border-color 0.15s;
}

.rotas-filtros input[type="number"]:focus {
    border-color: var(--cyan);
}

.rotas-filtros input[type="number"]::-webkit-inner-spin-button,
.rotas-filtros input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rotas-filtros input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

#menu-acoes-rapidas {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(6, 9, 20, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 10px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    min-width: 190px;
    z-index: 1001;
}

#menu-acoes-rapidas.aberto {
    display: block;
}

#menu-acoes-rapidas button {
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
    color: #e8f4ff;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

#menu-acoes-rapidas button:last-child {
    border-bottom: none;
}

#menu-acoes-rapidas button:hover {
    background: rgba(0, 229, 255, 0.08);
}

#menu-acoes-rapidas button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.menu-atalho {
    font-size: 9px;
    font-weight: 700;
    color: rgba(0, 229, 255, 0.5);
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 3px;
    padding: 2px 5px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

#tema-wrapper::after {
    content: '▾';
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cyan);
    pointer-events: none;
    font-size: 0.65rem;
}

#select-tema {
    background: rgba(6, 9, 20, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--cyan);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 5px 26px 5px 10px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.2s, background 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 229, 255, 0.08);
}

#select-tema:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
}

#select-tema option {
    background: #0a0e1a;
    color: #e8f4ff;
}

/* ============================================================
   TEMA CLARO DA UI — paleta cinza claro neutro
   ============================================================ */
body.tema-claro {
    --cyan: #0070c0;
    --border: rgba(0, 0, 0, 0.12);
    --text: #1a2232;
    --muted: rgba(60, 75, 100, 0.65);
    background: #e4e8ee;
    transition: background 0.4s;
}

/* Sidebar */
body.tema-claro #sidebar {
    background: rgba(245, 247, 250, 0.98);
    border-right-color: rgba(0, 0, 0, 0.10);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.18),
        4px 0 24px rgba(52, 152, 219, 0.22),
        2px 0 8px rgba(52, 152, 219, 0.18);
}

body.tema-claro #toggle-sidebar {
    background: rgba(0, 112, 192, 0.09);
    color: var(--cyan);
    border-color: rgba(0, 112, 192, 0.20);
}

body.tema-claro #toggle-sidebar:hover {
    background: rgba(0, 112, 192, 0.18);
}

body.tema-claro #sidebar-header {
    background: linear-gradient(135deg, rgba(0, 112, 192, 0.06), rgba(0, 150, 220, 0.03));
    border-bottom-color: var(--border);
}

/* Toolbar de ferramentas — tema claro */
body.tema-claro #toolbar-ferramentas {
    background: rgba(0, 0, 0, 0.04);
    border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.tema-claro .btn-tool {
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a2232;
}

body.tema-claro .btn-tool:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #000;
}

body.tema-claro .btn-tool.active {
    background: rgba(0, 112, 192, 0.10);
    border-color: rgba(0, 112, 192, 0.38);
    color: var(--cyan);
}

body.tema-claro #painel-ferramenta {
    background: rgba(0, 0, 0, 0.03);
    border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.tema-claro .tool-panel select,
body.tema-claro .tool-panel input[type="number"] {
    background: rgba(220, 225, 235, 0.85);
    color: #1a2232;
    border-color: rgba(0, 0, 0, 0.14);
}

body.tema-claro .tool-panel select:focus,
body.tema-claro .tool-panel input:focus {
    border-color: rgba(0, 112, 192, 0.45);
    background: rgba(210, 218, 232, 0.95);
}

body.tema-claro .tool-panel select option,
body.tema-claro #area-transferencia select option {
    background: #edf0f5;
    color: #1a2232;
}

body.tema-claro .btn-tool-inline {
    background: rgba(0, 112, 192, 0.08);
    border-color: rgba(0, 112, 192, 0.22);
    color: var(--cyan);
}

body.tema-claro .btn-tool-inline:hover {
    background: rgba(0, 112, 192, 0.18);
    border-color: rgba(0, 112, 192, 0.45);
}

body.tema-claro .btn-nav-link {
    border-color: rgba(0, 112, 192, 0.22);
    color: var(--cyan);
}

body.tema-claro .btn-nav-link:hover {
    background: rgba(0, 112, 192, 0.07);
    border-color: rgba(0, 112, 192, 0.4);
}

body.tema-claro .tool-panel small {
    color: #5a6a82;
}

/* Painel Rotas */
body.tema-claro #painel-rotas {
    background: rgba(245, 247, 250, 0.96);
    color: var(--text);
    border-color: var(--border);
}

/* Abas inferiores */
body.tema-claro .tab-btn {
    background: rgba(228, 232, 240, 0.97);
    color: var(--muted);
    border-color: var(--border);
}

body.tema-claro .tab-btn:hover {
    background: rgba(210, 216, 228, 0.97);
    color: var(--text);
}

body.tema-claro #tab-btn-stats.active {
    background: rgba(0, 90, 180, 0.12);
    color: var(--cyan);
    border-color: var(--cyan);
}

body.tema-claro #tab-btn-historico.active {
    background: rgba(180, 80, 0, 0.09);
    color: var(--orange);
    border-color: var(--orange);
}

/* Barra de stats e histórico */
body.tema-claro #bottom-stats-bar {
    background: rgba(238, 241, 247, 0.97);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

body.tema-claro .stat-item {
    color: #1a1a2e;
}

body.tema-claro #grafico-labels span {
    font-weight: 800;
}

body.tema-claro #painel-historico {
    background: rgba(238, 241, 247, 0.98);
}

/* Seletor de tema */
body.tema-claro #select-tema {
    background: rgba(228, 232, 240, 0.95);
    color: var(--text);
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
}

body.tema-claro #select-tema:hover {
    background: rgba(210, 216, 228, 0.95);
    border-color: rgba(0, 112, 192, 0.40);
}

body.tema-claro #select-tema option {
    background: #edf0f5;
    color: #1a2232;
}

body.tema-claro #tema-wrapper::after {
    color: var(--text);
}

/* Botões flutuantes (+ e 🔔 e 🔍) no tema claro */
body.tema-claro #btn-buscar-cliente {
    background: rgba(228, 232, 240, 0.95);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1e6db5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

body.tema-claro #btn-buscar-cliente:hover {
    background: rgba(210, 216, 228, 0.95);
}

body.tema-claro #btn-buscar-cliente.active {
    background: rgba(52, 152, 219, 0.18);
    border-color: rgba(52, 152, 219, 0.5);
}

body.tema-claro #busca-cliente-painel {
    background: rgba(245, 247, 250, 0.98);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

body.tema-claro #busca-cliente-input {
    color: #1a2232;
}

body.tema-claro #busca-cliente-input::placeholder {
    color: rgba(80, 100, 130, 0.5);
}

body.tema-claro #busca-cliente-resultado {
    color: #1e6db5;
}

body.tema-claro #busca-cliente-limpar {
    color: rgba(80, 100, 130, 0.6);
}

body.tema-claro #btn-acoes-rapidas,
body.tema-claro #btn-notificacoes {
    background: rgba(228, 232, 240, 0.95);
    border-color: rgba(0, 0, 0, 0.18);
    color: #0050b4;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 80, 180, 0.06);
}

body.tema-claro #btn-acoes-rapidas:hover,
body.tema-claro #btn-notificacoes:hover {
    background: rgba(210, 216, 228, 0.95);
    border-color: rgba(0, 112, 192, 0.40);
}

body.tema-claro #btn-alertas {
    background: rgba(228, 232, 240, 0.95);
    border-color: rgba(0, 0, 0, 0.18);
    color: #b45309;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

body.tema-claro #btn-alertas:hover {
    background: rgba(210, 216, 228, 0.95);
    border-color: rgba(180, 83, 9, 0.35);
}

body.tema-claro #painel-alertas {
    background: rgba(235, 238, 245, 0.98);
    border-color: rgba(180, 83, 9, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

body.tema-claro .alertas-header {
    color: rgba(180, 83, 9, 0.7);
}

body.tema-claro .alerta-item {
    color: #1e293b;
}

body.tema-claro .alerta-item .alerta-ts {
    color: #b45309;
}

body.tema-claro .alerta-item.nao-lido {
    background: rgba(180, 83, 9, 0.06);
}

body.tema-claro .alertas-vazio {
    color: #94a3b8;
}

body.tema-claro .alertas-footer button {
    border-color: rgba(0, 0, 0, 0.1);
    color: #94a3b8;
}

body.tema-claro .alertas-footer button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

/* Menu de notificações no tema claro */
body.tema-claro #menu-notificacoes {
    background: rgba(235, 238, 245, 0.98);
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

body.tema-claro .notif-header {
    color: rgba(0, 80, 180, 0.55);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.tema-claro .notif-grupo {
    background: rgba(0, 80, 180, 0.05);
    border-color: rgba(0, 80, 180, 0.14);
}

body.tema-claro .notif-grupo-titulo {
    color: rgba(0, 80, 180, 0.65);
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

body.tema-claro .notif-grupo-chevron {
    color: rgba(0, 80, 180, 0.55);
}

body.tema-claro .notif-label {
    color: #1a2232;
}

body.tema-claro .notif-item:hover .notif-label {
    color: #0050b4;
}

body.tema-claro .notif-check-box {
    border-color: rgba(0, 80, 180, 0.35);
    background: rgba(0, 80, 180, 0.05);
}

body.tema-claro .notif-item:not(:last-child) {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.tema-claro .rotas-filtros {
    border-top-color: rgba(0, 80, 180, 0.08);
}

body.tema-claro .rotas-filtro-label {
    color: rgba(0, 80, 180, 0.6);
}

body.tema-claro .rotas-filtro-unidade {
    color: rgba(0, 80, 180, 0.38);
}

body.tema-claro .rotas-filtros input[type="number"] {
    background: rgba(0, 80, 180, 0.06);
    color: #0050b4;
    border-color: rgba(0, 80, 180, 0.22);
}

body.tema-claro .rotas-filtros input[type="number"]:focus {
    border-color: #0050b4;
}

/* Menu de ações rápidas no tema claro */
body.tema-claro #menu-acoes-rapidas {
    background: rgba(235, 238, 245, 0.98);
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

body.tema-claro #menu-acoes-rapidas button {
    color: #1a2232;
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

body.tema-claro #menu-acoes-rapidas button:hover {
    background: rgba(0, 80, 180, 0.08);
}

body.tema-claro .menu-atalho {
    color: rgba(0, 80, 180, 0.5);
    background: rgba(0, 80, 180, 0.06);
    border-color: rgba(0, 80, 180, 0.18);
}

/* Modal */
body.tema-claro .modal-overlay {
    background: rgba(100, 110, 130, 0.45);
}

body.tema-claro .modal-box {
    background: rgba(245, 247, 250, 0.99);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.20), 0 0 40px rgba(0, 112, 192, 0.04);
}

body.tema-claro .input-text-modal {
    background: rgba(218, 223, 233, 0.85);
    color: var(--text);
}

body.tema-claro .input-text-modal:focus {
    border-color: rgba(0, 112, 192, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 112, 192, 0.07);
}

body.tema-claro #area-transferencia {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--border);
}

body.tema-claro #area-transferencia select {
    background: rgba(218, 223, 233, 0.90);
    color: var(--text);
    border-color: var(--border);
}

body.tema-claro #ordem-lista {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--border);
}

body.tema-claro .ordem-item {
    background: rgba(212, 218, 230, 0.85);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

/* Cards de pedidos na lista */
body.tema-claro .pedido-item {
    background: rgba(210, 218, 232, 0.80);
    border-color: rgba(0, 0, 0, 0.10);
    color: var(--text);
}

body.tema-claro .pedido-item:hover {
    background: rgba(195, 208, 228, 0.90);
    border-color: rgba(0, 112, 192, 0.25);
}

body.tema-claro .pedido-item.selected {
    background: rgba(0, 180, 100, 0.12) !important;
    border-color: var(--green) !important;
}

/* Badges do card mais escuros no tema claro — as cores neon (cyan/verde/amarelo)
   lavavam no fundo claro; fonte e círculo ganham tom fechado. */
body.tema-claro .exp-fidelidade {
    background: rgba(0, 100, 140, 0.14);
    border-color: rgba(0, 100, 140, 0.55);
    color: #00596e;
}

body.tema-claro .exp-cancelados {
    background: rgba(169, 50, 38, 0.14);
    border-color: rgba(169, 50, 38, 0.6);
    color: #a93226;
}

body.tema-claro .exp-risco {
    background: rgba(180, 30, 30, 0.16);
    border-color: rgba(180, 30, 30, 0.6);
}

body.tema-claro .exp-prazo {
    background: rgba(0, 115, 74, 0.14);
    border-color: rgba(0, 115, 74, 0.6);
    color: #00734a;
}

body.tema-claro .exp-prazo-urgente {
    background: rgba(138, 109, 0, 0.16);
    border-color: rgba(138, 109, 0, 0.6);
    color: #8a6d00;
}

body.tema-claro .exp-prazo-atrasado {
    background: rgba(169, 50, 38, 0.18);
    border-color: rgba(169, 50, 38, 0.65);
    color: #a93226;
}

body.tema-claro .exp-prazo-alerta {
    background: rgba(180, 95, 6, 0.16);
    border-color: rgba(180, 95, 6, 0.6);
    color: #b45f06;
}

body.tema-claro .exp-espera {
    background: rgba(0, 100, 140, 0.14);
    border-color: rgba(0, 100, 140, 0.55);
    color: #00596e;
}

body.tema-claro .exp-espera-alerta {
    background: rgba(180, 95, 6, 0.16);
    border-color: rgba(180, 95, 6, 0.6);
    color: #b45f06;
}

body.tema-claro .exp-espera-atrasado {
    background: rgba(169, 50, 38, 0.18);
    border-color: rgba(169, 50, 38, 0.65);
    color: #a93226;
}

body.tema-claro .btn-acao-card {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--muted);
}

body.tema-claro .btn-acao-card:hover {
    background: rgba(0, 112, 192, 0.12);
    border-color: rgba(0, 112, 192, 0.30);
}

/* Filtros do histórico */
body.tema-claro #hist-date,
body.tema-claro #hist-pedido-select {
    background: rgba(218, 223, 233, 0.90);
    color: var(--text);
    border-color: rgba(0, 0, 0, 0.14);
    color-scheme: light;
}

body.tema-claro #hist-date:focus,
body.tema-claro #hist-pedido-select:focus {
    border-color: rgba(0, 112, 192, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 112, 192, 0.07);
}

body.tema-claro #hist-pedido-select option {
    background: #edf0f5;
    color: #1a2232;
}

/* Painel criar/editar pedido manual */
body.tema-claro #painel-editar-endereco {
    background: rgba(245, 247, 250, 0.98);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.20), 0 0 20px rgba(255, 159, 67, 0.20);
}

body.tema-claro .form-grid input,
body.tema-claro .form-grid select,
body.tema-claro .form-grid textarea {
    background: rgba(218, 223, 233, 0.85);
    color: var(--text);
    border-color: rgba(0, 0, 0, 0.14);
}

body.tema-claro .form-grid input:focus,
body.tema-claro .form-grid select:focus,
body.tema-claro .form-grid textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.12);
}

body.tema-claro .form-grid select option {
    background: #edf0f5;
    color: #1a2232;
}

/* === OCR IMPORT PANEL === */
.btn-ocr-import {
    background: rgba(0, 229, 255, 0.10);
    border: 1px solid rgba(0, 229, 255, 0.30);
    color: var(--cyan);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-ocr-import:hover {
    background: rgba(0, 229, 255, 0.22);
    border-color: rgba(0, 229, 255, 0.55);
}

#ocr-panel {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}

.ocr-providers {
    display: flex;
    gap: 18px;
    margin-bottom: 12px;
}

.ocr-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--text);
    user-select: none;
}

.ocr-radio-label em {
    color: var(--muted);
    font-style: normal;
    font-size: 0.68rem;
    margin-left: 2px;
}

#ocr-dropzone {
    border: 2px dashed rgba(0, 229, 255, 0.25);
    border-radius: 10px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.76rem;
    min-height: 72px;
}

#ocr-dropzone:hover,
#ocr-dropzone.drag-over {
    border-color: rgba(0, 229, 255, 0.55);
    background: rgba(0, 229, 255, 0.05);
    color: var(--text);
}

#ocr-status {
    font-size: 0.74rem;
    text-align: center;
    padding: 7px 0 2px;
    min-height: 24px;
    color: var(--cyan);
    font-weight: 600;
}

.ocr-footer {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* tema claro */
body.tema-claro .btn-ocr-import {
    background: rgba(0, 112, 192, 0.08);
    border-color: rgba(0, 112, 192, 0.28);
    color: var(--cyan);
}

body.tema-claro #ocr-panel {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

/* Abas OCR */
.ocr-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.ocr-tab {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    background: transparent;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.ocr-tab:hover {
    background: rgba(0, 229, 255, 0.07);
    color: var(--text);
}

.ocr-tab.active {
    background: rgba(0, 229, 255, 0.14);
    border-color: rgba(0, 229, 255, 0.45);
    color: var(--cyan);
}

#ocr-textarea {
    width: 100%;
    height: 160px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 229, 255, 0.20);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    font-size: 0.74rem;
    font-family: 'DM Sans', sans-serif;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    line-height: 1.5;
    transition: border-color 0.2s;
}

#ocr-textarea:focus {
    border-color: rgba(0, 229, 255, 0.50);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.07);
}

#ocr-textarea::placeholder {
    color: var(--muted);
}

body.tema-claro .ocr-tab {
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--muted);
}

body.tema-claro .ocr-tab.active {
    background: rgba(0, 112, 192, 0.10);
    border-color: rgba(0, 112, 192, 0.40);
    color: var(--cyan);
}

body.tema-claro #ocr-textarea {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.14);
}

body.tema-claro #ocr-dropzone {
    border-color: rgba(0, 112, 192, 0.25);
    color: var(--muted);
}

body.tema-claro #ocr-dropzone:hover,
body.tema-claro #ocr-dropzone.drag-over {
    border-color: rgba(0, 112, 192, 0.55);
    background: rgba(0, 112, 192, 0.04);
}

/* Tooltip de itens — tema claro */
body.tema-claro #tooltip-global-itens {
    background: rgba(245, 247, 250, 0.97);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
    color: var(--text);
}

body.tema-claro #tooltip-global-itens h4 {
    border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.tema-claro #tooltip-global-itens li {
    border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

body.tema-claro #tooltip-global-itens li span {
    color: var(--text) !important;
}

body.tema-claro #tooltip-global-itens li span[style*="#3498db"] {
    color: var(--cyan) !important;
}

body.tema-claro #tooltip-global-itens li span[style*="#e74c3c"] {
    color: #c0392b !important;
}

/* =========================================================
   🛡️ SNIPER ANTI-GRID (Sem explodir o mapa)
   Estica apenas a imagem do azulejo milimetricamente
========================================================= */
.leaflet-tile-container img {
    /* A propriedade 'scale' independente não sobrescreve o transform inline do Leaflet */
    scale: 1.0 !important;
}

/* ============================================================
   CHAT COM MOTOBOYS
   ============================================================ */
#btn-chat {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(6, 9, 20, 0.92);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 229, 255, 0.08);
}

#btn-chat:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    transform: scale(1.08);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    z-index: 1002;
}

#painel-chat {
    position: fixed;
    right: -360px;
    top: 0;
    width: 340px;
    height: 100vh;
    background: #0b1220;
    border-left: 1px solid #1e3a5f;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
}

#painel-chat.aberto {
    right: 0;
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #1e3a5f;
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    flex-shrink: 0;
}

.chat-fechar {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.chat-fechar:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Ajuda com o Pedido: assuntos configuráveis ── */
.ajuda-cfg-hint {
    padding: 10px 14px;
    font-size: 11px;
    line-height: 1.5;
    color: #94a3b8;
    background: rgba(59, 130, 246, 0.08);
    border-bottom: 1px solid #1e3a5f;
    flex-shrink: 0;
}

.ajuda-cfg-hint b {
    color: #f59e0b;
}

.ajuda-topicos-lista {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.ajuda-topico-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ajuda-topico-item.inativo .ajuda-topico-txt,
.ajuda-topico-item.inativo .ajuda-topico-icon {
    opacity: 0.35;
    text-decoration: line-through;
}

.ajuda-topico-icon {
    font-size: 17px;
    flex-shrink: 0;
}

.ajuda-topico-txt {
    flex: 1;
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.35;
    word-break: break-word;
}

.ajuda-topico-acoes {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.ajuda-topico-acoes button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    padding: 3px 4px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}

.ajuda-topico-acoes button:hover:not(:disabled) {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.ajuda-topico-acoes button:disabled {
    opacity: 0.25;
    cursor: default;
}

.ajuda-topico-acoes button.ajuda-del:hover {
    color: #ff6b6b;
    background: rgba(220, 50, 50, 0.15);
}

.ajuda-topico-item.editando input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2a4a7f;
    border-radius: 8px;
    color: #e2e8f0;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
}

.ajuda-topico-item.editando input:focus {
    border-color: #3b82f6;
}

.ajuda-topico-item.editando input#ajuda-edit-icon {
    width: 44px;
    text-align: center;
    flex-shrink: 0;
}

.ajuda-topico-item.editando input#ajuda-edit-txt {
    flex: 1;
}

.ajuda-topico-item.editando button {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 6px;
}

.ajuda-topico-item.editando button:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.ajuda-cfg-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #1e3a5f;
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.ajuda-cfg-form input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2a4a7f;
    border-radius: 20px;
    color: #e2e8f0;
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
}

.ajuda-cfg-form input:focus {
    border-color: #3b82f6;
}

.ajuda-cfg-form input::placeholder {
    color: #475569;
}

.ajuda-cfg-form input#ajuda-novo-icon {
    width: 52px;
    text-align: center;
    flex-shrink: 0;
}

.ajuda-cfg-form input#ajuda-novo-txt {
    flex: 1;
}

.ajuda-cfg-form button {
    background: #3b82f6;
    border: none;
    border-radius: 20px;
    color: white;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.ajuda-cfg-form button:hover {
    background: #2563eb;
}

.chat-broadcast-wrap {
    padding: 10px 12px 6px;
    border-bottom: 1px solid #1e3a5f;
    flex-shrink: 0;
}

.chat-broadcast-btn {
    width: 100%;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}

.chat-broadcast-btn:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.55);
}

.chat-broadcast-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.chat-broadcast-form {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.chat-broadcast-form input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 16px;
    color: #e2e8f0;
    padding: 7px 12px;
    font-size: 12px;
    outline: none;
}

.chat-broadcast-form input:focus {
    border-color: #fbbf24;
}

.chat-broadcast-form input::placeholder {
    color: #64748b;
}

#chat-lista-items {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.chat-lista-vazio {
    text-align: center;
    color: #475569;
    padding: 24px 16px;
    font-size: 12px;
}

.chat-lista-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}

.chat-lista-item:hover {
    background: rgba(0, 229, 255, 0.06);
}

.chat-lista-item-nome {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-lista-item-ultima {
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-badge-item {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.chat-conversa-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #1e3a5f;
    flex-shrink: 0;
}

.chat-voltar {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s;
    white-space: nowrap;
}

.chat-voltar:hover {
    color: #e2e8f0;
}

.chat-nome-atual {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-msgs-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-emoji-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s;
}

.chat-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-emoji-panel {
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid #1e3a5f;
    flex-shrink: 0;
    max-height: 140px;
    overflow-y: auto;
}

.chat-emoji-item {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.12s;
    text-align: center;
}

.chat-emoji-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.tema-claro .chat-emoji-panel {
    background: rgba(0, 0, 0, 0.05);
    border-top-color: #cbd5e1;
}

body.tema-claro .chat-emoji-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.tema-claro .chat-emoji-item:hover {
    background: rgba(0, 0, 0, 0.08);
}

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg-motoboy {
    align-self: flex-end;
    background: #ea580c;
    color: #fff7ed;
    border-bottom-right-radius: 3px;
}

.chat-msg-loja {
    align-self: flex-start;
    background: #1e3a5f;
    color: #e2e8f0;
    border-bottom-left-radius: 3px;
}

.chat-msg-ajuda {
    align-self: flex-end;
    background: #7f1d1d;
    color: #fecaca;
    border-left: 3px solid #ef4444;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 12px;
    max-width: 88%;
}

.chat-ajuda-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    opacity: 0.85;
}

.chat-msg-hora {
    font-size: 9px;
    opacity: 0.55;
    text-align: right;
    margin-top: 3px;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #1e3a5f;
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2a4a7f;
    border-radius: 20px;
    color: #e2e8f0;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: #3b82f6;
}

.chat-input-area input::placeholder {
    color: #475569;
}

.chat-btn-enviar {
    background: #3b82f6;
    border: none;
    border-radius: 20px;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-btn-enviar:hover {
    background: #2563eb;
}

/* Tema claro */
body.tema-claro .chat-broadcast-wrap {
    border-bottom-color: #cbd5e1;
}

body.tema-claro .chat-broadcast-btn {
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.3);
    color: #b45309;
}

body.tema-claro .chat-broadcast-form input {
    background: white;
    border-color: rgba(217, 119, 6, 0.4);
    color: #1e293b;
}

body.tema-claro #painel-chat {
    background: #f8fafc;
    border-left-color: #cbd5e1;
}

body.tema-claro .chat-panel-header {
    background: rgba(0, 0, 0, 0.04);
    border-bottom-color: #cbd5e1;
    color: #1e293b;
}

body.tema-claro .chat-lista-item {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.tema-claro .chat-lista-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.tema-claro .chat-lista-item-nome {
    color: #1e293b;
}

body.tema-claro .chat-lista-item-ultima {
    color: #94a3b8;
}

body.tema-claro .chat-conversa-header {
    background: rgba(0, 0, 0, 0.04);
    border-bottom-color: #cbd5e1;
}

body.tema-claro .chat-nome-atual {
    color: #1e293b;
}

body.tema-claro .chat-msg-loja {
    background: #dbeafe;
    color: #1e3a5f;
}

body.tema-claro .chat-input-area {
    background: rgba(0, 0, 0, 0.03);
    border-top-color: #cbd5e1;
}

body.tema-claro .chat-input-area input {
    background: white;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.tema-claro .chat-input-area input::placeholder {
    color: #94a3b8;
}

body.tema-claro .chat-btn-enviar {
    background: #2563eb;
}

body.tema-claro #btn-chat {
    background: rgba(255, 255, 255, 0.9);
}

/* ── Mini-chat flutuante ─────────────────────────────── */
#mini-chat {
    position: fixed;
    bottom: 24px;
    right: 16px;
    width: 300px;
    background: #0b1220;
    border: 1px solid #1e3a5f;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 229, 255, 0.07);
    z-index: 1100;
    overflow: hidden;
    animation: mini-chat-in 0.22s ease;
}

@keyframes mini-chat-in {
    from {
        transform: translateY(16px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.mini-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: rgba(0, 229, 255, 0.07);
    border-bottom: 1px solid #1e3a5f;
}

.mini-chat-nome {
    font-size: 12.5px;
    font-weight: 700;
    color: #00e5ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.mini-chat-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.mini-chat-expand {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 6px;
    color: #00e5ff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.mini-chat-expand:hover {
    background: rgba(0, 229, 255, 0.2);
}

.mini-chat-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.mini-chat-close:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.mini-chat-msg {
    padding: 10px 12px;
    font-size: 12.5px;
    color: #cbd5e1;
    min-height: 38px;
    max-height: 76px;
    overflow-y: auto;
    line-height: 1.55;
    word-break: break-word;
}

.mini-chat-ajuda {
    color: #fca5a5;
    font-weight: 700;
}

.mini-chat-input-area {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid #1e3a5f;
}

.mini-chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #e2e8f0;
    padding: 6px 12px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.mini-chat-input-area input:focus {
    border-color: #3b82f6;
}

.mini-chat-input-area input::placeholder {
    color: #475569;
}

.mini-chat-enviar {
    background: #3b82f6;
    border: none;
    border-radius: 50%;
    color: white;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mini-chat-enviar:hover {
    background: #2563eb;
}

/* Light theme */
body.tema-claro #mini-chat {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.tema-claro .mini-chat-header {
    background: rgba(0, 0, 0, 0.04);
    border-bottom-color: #cbd5e1;
}

body.tema-claro .mini-chat-nome {
    color: #0891b2;
}

body.tema-claro .mini-chat-expand {
    background: rgba(8, 145, 178, 0.1);
    border-color: rgba(8, 145, 178, 0.3);
    color: #0891b2;
}

body.tema-claro .mini-chat-close {
    color: #94a3b8;
}

body.tema-claro .mini-chat-msg {
    color: #334155;
}

body.tema-claro .mini-chat-input-area {
    background: rgba(0, 0, 0, 0.03);
    border-top-color: #cbd5e1;
}

body.tema-claro .mini-chat-input-area input {
    background: white;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.tema-claro .mini-chat-input-area input::placeholder {
    color: #94a3b8;
}

/* ── Gravação de áudio no chat ───────────────────────────── */
.chat-mic-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.chat-mic-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-mic-btn.gravando {
    animation: mic-pulso 0.9s ease-in-out infinite;
    background: rgba(239, 68, 68, 0.18);
    border-radius: 50%;
}

@keyframes mic-pulso {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    }

    50% {
        transform: scale(1.12);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.chat-rec-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 4px;
    font-size: 12px;
    color: #f87171;
    font-weight: 700;
}

.chat-rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    animation: rec-blink 1s step-start infinite;
    flex-shrink: 0;
}

@keyframes rec-blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.15
    }
}

.chat-rec-progress-wrap {
    flex: 1;
    height: 4px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.chat-rec-progress {
    height: 100%;
    background: #ef4444;
    width: 0%;
    transition: width 1s linear;
    border-radius: 2px;
}

/* Bolha de áudio */
.chat-audio-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.chat-audio-play {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-audio-play:hover {
    background: rgba(255, 255, 255, 0.28);
}

.chat-audio-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-audio-label {
    font-size: 12.5px;
    font-weight: 600;
}

.chat-audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 18px;
}

.chat-audio-waveform span {
    width: 3px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.55;
    animation: wave-idle 1.4s ease-in-out infinite;
}

.chat-audio-waveform span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-audio-waveform span:nth-child(3) {
    animation-delay: 0.3s;
}

.chat-audio-waveform span:nth-child(4) {
    animation-delay: 0.45s;
}

.chat-audio-waveform span:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes wave-idle {

    0%,
    100% {
        height: 5px;
    }

    50% {
        height: 14px;
    }
}

body.tema-claro .chat-mic-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.tema-claro .chat-rec-bar {
    color: #dc2626;
}

body.tema-claro .chat-audio-play {
    background: rgba(0, 0, 0, 0.1);
}

body.tema-claro .chat-audio-play:hover {
    background: rgba(0, 0, 0, 0.18);
}

/* ============================================================
   MOBILE BOTTOM NAV + BOTTOM SHEET
   ============================================================ */

/* Oculto no desktop — só aparece em mobile via media query */
#mobile-nav,
#mobile-bottom-sheet,
#mobile-sheet-backdrop,
#mobile-pin-sheet,
#mobile-pin-sheet-backdrop {
    display: none;
}

@media (max-width: 768px) {

    /* Oculta sidebar completamente no mobile — bottom sheet assume */
    #sidebar,
    #toggle-sidebar,
    #sidebar-placeholder {
        display: none !important;
    }

    /* Mapa precisa de espaço para a barra inferior */
    #map {
        padding-bottom: 58px;
    }

    /* Stats container sobe acima do nav */
    #bottom-stats-container {
        bottom: 58px;
    }

    /* Posição do tema-wrapper */
    #tema-wrapper {
        top: 8px;
    }

    /* ── Bottom Nav ─────────────────────────────── */
    #mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: rgba(6, 9, 20, 0.98);
        border-top: 1px solid rgba(0, 229, 255, 0.15);
        z-index: 2500;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
    }

    .mnav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        color: var(--muted);
        cursor: pointer;
        position: relative;
        padding: 6px 0 4px;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.18s;
    }

    .mnav-btn.active {
        color: var(--cyan);
    }

    .mnav-btn.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 22%;
        right: 22%;
        height: 2px;
        background: var(--cyan);
        border-radius: 0 0 3px 3px;
    }

    .mnav-icon {
        font-size: 20px;
        line-height: 1;
    }

    .mnav-label {
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        font-family: 'Syne', sans-serif;
    }

    .mnav-badge {
        position: absolute;
        top: 5px;
        right: calc(50% - 20px);
        background: #ef4444;
        color: white;
        font-size: 9px;
        font-weight: 800;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
        pointer-events: none;
    }

    /* ── Bottom Sheet (pedidos / ações) ──────────── */
    #mobile-bottom-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 58px;
        left: 0;
        right: 0;
        height: 64vh;
        background: rgba(6, 9, 20, 0.98);
        border-top: 1px solid rgba(0, 229, 255, 0.18);
        border-radius: 18px 18px 0 0;
        z-index: 2400;
        transform: translateY(105%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.65);
    }

    #mobile-bottom-sheet.aberto {
        transform: translateY(0);
    }

    .mobile-sheet-handle-area {
        display: flex;
        justify-content: center;
        padding: 10px 0 5px;
        flex-shrink: 0;
    }

    .mobile-sheet-handle-pill {
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.18);
        border-radius: 2px;
    }

    .mobile-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px 8px;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(0, 229, 255, 0.08);
    }

    #mobile-sheet-titulo {
        font-family: 'Syne', sans-serif;
        font-size: 0.76rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.10em;
        color: var(--cyan);
    }

    .mobile-sheet-fechar {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.10);
        color: var(--muted);
        font-size: 12px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        line-height: 1;
    }

    .mobile-sheet-page {
        display: none;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        min-height: 0;
    }

    .mobile-sheet-page.active {
        display: flex;
        flex-direction: column;
    }

    /* Override JS-set height for order list inside the sheet */
    #lista-pedidos-container {
        height: auto !important;
        flex: 1;
        overflow-y: auto;
        padding: 8px;
        min-height: 0;
    }

    /* Ações page padding */
    #mobile-sheet-page-acoes.active {
        padding: 10px 10px 4px;
        gap: 0;
    }

    /* Toolbar inside sheet */
    #mobile-sheet-page-acoes #toolbar-ferramentas {
        border-radius: 10px;
        margin-bottom: 4px;
    }

    #mobile-sheet-page-acoes #painel-ferramenta {
        border-radius: 10px;
    }

    #mobile-sheet-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 2399;
    }

    #mobile-sheet-backdrop.visivel {
        display: block;
    }

    /* ── Pin Detail Sheet ───────────────────────── */
    #mobile-pin-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 58px;
        left: 0;
        right: 0;
        max-height: 72vh;
        background: rgba(6, 9, 20, 0.98);
        border-top: 1px solid rgba(0, 229, 255, 0.18);
        border-radius: 18px 18px 0 0;
        z-index: 2450;
        transform: translateY(105%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.65);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mobile-pin-sheet.aberto {
        transform: translateY(0);
    }

    #mobile-pin-sheet-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 2449;
    }

    #mobile-pin-sheet-backdrop.visivel {
        display: block;
    }

    /* Pin sheet content */
    .pin-sheet-handle-wrap {
        display: flex;
        justify-content: center;
        padding: 10px 0 5px;
        flex-shrink: 0;
    }

    .pin-sheet-top {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 6px 16px 12px;
        border-bottom: 1px solid rgba(0, 229, 255, 0.08);
        flex-shrink: 0;
    }

    .pin-sheet-num {
        font-family: 'Syne', sans-serif;
        font-size: 1.6rem;
        font-weight: 800;
        color: var(--cyan);
        flex-shrink: 0;
        line-height: 1;
    }

    .pin-sheet-info {
        flex: 1;
        overflow: hidden;
    }

    .pin-sheet-cliente {
        font-size: 0.88rem;
        font-weight: 700;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pin-sheet-status {
        font-size: 0.70rem;
        font-weight: 600;
        color: var(--muted);
        margin-top: 3px;
    }

    .pin-sheet-fechar-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.10);
        color: var(--muted);
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        line-height: 1;
    }

    .pin-sheet-body {
        padding: 10px 16px 6px;
    }

    .pin-sheet-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        padding: 6px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        font-size: 0.78rem;
        color: var(--muted);
        line-height: 1.4;
    }

    .pin-sheet-row:last-child {
        border-bottom: none;
    }

    .pin-sheet-row strong {
        color: var(--text);
    }

    .pin-sheet-obs {
        margin-top: 6px;
        padding: 7px 10px;
        background: rgba(231, 76, 60, 0.12);
        border-left: 3px solid #e74c3c;
        border-radius: 4px;
        font-size: 0.75rem;
        color: #ffb8b8;
        line-height: 1.4;
    }

    .pin-sheet-actions {
        padding: 10px 16px 14px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        border-top: 1px solid rgba(0, 229, 255, 0.08);
        flex-shrink: 0;
    }

    .pin-sheet-select {
        flex: 1;
        min-width: 140px;
        padding: 10px 10px;
        border-radius: 8px;
        border: 1px solid rgba(0, 229, 255, 0.22);
        background: rgba(255, 255, 255, 0.07);
        color: var(--text);
        font-size: 0.78rem;
        font-weight: 600;
        outline: none;
    }

    .pin-sheet-select option {
        background: #131929;
        color: #e8f4ff;
    }

    .pin-sheet-btn-apply {
        padding: 10px 18px;
        border-radius: 8px;
        border: none;
        background: linear-gradient(135deg, #007a3d, var(--green));
        color: white;
        font-size: 0.78rem;
        font-weight: 700;
        cursor: pointer;
        flex-shrink: 0;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .pin-sheet-btn-despachar {
        width: 100%;
        padding: 10px;
        border-radius: 8px;
        border: none;
        background: linear-gradient(135deg, #994400, var(--orange));
        color: white;
        font-size: 0.78rem;
        font-weight: 700;
        cursor: pointer;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    /* Tema claro — mobile nav */
    body.tema-claro #mobile-nav {
        background: rgba(245, 247, 250, 0.98);
        border-top-color: rgba(0, 0, 0, 0.10);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    }

    body.tema-claro .mnav-btn {
        color: rgba(60, 75, 100, 0.55);
    }

    body.tema-claro .mnav-btn.active {
        color: #0070c0;
    }

    body.tema-claro .mnav-btn.active::before {
        background: #0070c0;
    }

    body.tema-claro #mobile-bottom-sheet,
    body.tema-claro #mobile-pin-sheet {
        background: rgba(245, 247, 250, 0.98);
        border-top-color: rgba(0, 0, 0, 0.10);
        box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.15);
    }

    body.tema-claro .mobile-sheet-handle-pill {
        background: rgba(0, 0, 0, 0.14);
    }

    body.tema-claro #mobile-sheet-titulo {
        color: #0070c0;
    }

    body.tema-claro .mobile-sheet-header {
        border-bottom-color: rgba(0, 0, 0, 0.08);
    }

    body.tema-claro .mobile-sheet-fechar {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.10);
        color: rgba(60, 75, 100, 0.55);
    }

    body.tema-claro .mobile-sheet-page {
        background: transparent;
    }

    body.tema-claro .pin-sheet-num {
        color: #0070c0;
    }

    body.tema-claro .pin-sheet-cliente {
        color: #1a2232;
    }

    body.tema-claro .pin-sheet-row {
        color: rgba(60, 75, 100, 0.65);
        border-bottom-color: rgba(0, 0, 0, 0.05);
    }

    body.tema-claro .pin-sheet-row strong {
        color: #1a2232;
    }

    body.tema-claro .pin-sheet-select {
        background: rgba(210, 218, 232, 0.85);
        color: #1a2232;
        border-color: rgba(0, 0, 0, 0.14);
    }

    body.tema-claro .pin-sheet-select option {
        background: #edf0f5;
        color: #1a2232;
    }

    /* Menu notificações — deixa espaço para o nav bar inferior */
    #menu-notificacoes {
        max-height: calc(100dvh - 80px - 58px) !important;
    }
}

/* ═══════════════════════════════════════════════════════
   PIN CONTEXT MENU — botão direito no pino (desktop)
══════════════════════════════════════════════════════════ */
#pin-context-menu {
    display: none;
    position: fixed;
    z-index: 3500;
    width: 300px;
    background: rgba(13, 20, 40, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(0, 229, 255, 0.20);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 10px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: pinCmIn 0.14s ease;
    pointer-events: auto;
}

@keyframes pinCmIn {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(-4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pin-cm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px 10px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.10);
}

.pin-cm-num {
    font-family: 'Syne', sans-serif;
    font-size: 1.45rem;
    font-weight: 800;
    color: #00e5ff;
    line-height: 1;
    flex-shrink: 0;
}

.pin-cm-info {
    flex: 1;
    min-width: 0;
}

.pin-cm-cliente {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e8f4ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pin-cm-status {
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(232, 244, 255, 0.55);
    margin-top: 2px;
}

.pin-cm-fechar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(232, 244, 255, 0.55);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.pin-cm-fechar:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #e8f4ff;
}

.pin-cm-actions {
    display: flex;
    gap: 6px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

.pin-cm-btn {
    flex: 1;
    padding: 7px 5px;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.16);
    background: rgba(0, 229, 255, 0.06);
    color: #a0d8ef;
    font-size: 0.70rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.3;
}

.pin-cm-btn:hover {
    background: rgba(0, 229, 255, 0.16);
    color: #e8f4ff;
}

.pin-cm-btn.copiado {
    background: rgba(39, 174, 96, 0.25);
    color: #2ecc71;
    border-color: rgba(39, 174, 96, 0.3);
}

.pin-cm-itens {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
    max-height: 130px;
    overflow-y: auto;
}

.pin-cm-itens-titulo {
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(0, 229, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.pin-cm-item-li {
    font-size: 0.76rem;
    color: #c8dff0;
    padding: 2px 0;
    line-height: 1.4;
}

.pin-cm-item-li .qtd {
    color: #3498db;
    font-weight: 700;
}

.rota-cm-eta {
    font-size: 0.70rem;
    color: rgba(200, 223, 240, 0.65);
    white-space: nowrap;
}

body.tema-claro .rota-cm-eta {
    color: rgba(44, 62, 80, 0.6);
}

.pin-cm-item-sub {
    font-size: 0.70rem;
    color: rgba(200, 223, 240, 0.55);
    padding: 1px 0 1px 12px;
}

.pin-cm-desp-row {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

.pin-cm-desp-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #994400, var(--orange, #e67e22));
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.pin-cm-desp-btn:hover {
    opacity: 0.85;
}

body.tema-claro .pin-cm-desp-btn {
    background: linear-gradient(135deg, #c0501c, #e67e22);
}

.pin-cm-status-row {
    display: flex;
    gap: 6px;
    padding: 9px 12px 12px;
}

.pin-cm-select {
    flex: 1;
    padding: 8px 9px;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.20);
    background: rgba(0, 0, 0, 0.35);
    color: #e8f4ff;
    font-size: 0.76rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.pin-cm-select option {
    background: #131929;
    color: #e8f4ff;
}

.pin-cm-apply {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #007a3d, #27ae60);
    color: white;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.pin-cm-apply:hover {
    opacity: 0.85;
}

/* Tema claro */
/* ═══════════════════════════════════════════════════════
   MODAIS DE MOTIVO (cancelamento / recuperação)
══════════════════════════════════════════════════════════ */
.motivo-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pinCmIn 0.15s ease;
}

.motivo-modal {
    background: rgba(13, 20, 40, 0.98);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
}

.motivo-modal-titulo {
    font-size: 1rem;
    font-weight: 800;
    color: #e8f4ff;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.motivo-modal-opcoes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.motivo-opt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
    font-size: 0.82rem;
    color: #c8dff0;
    transition: background 0.12s;
}

.motivo-opt:hover {
    background: rgba(0, 229, 255, 0.08);
}

.motivo-opt input[type=radio] {
    margin-top: 2px;
    accent-color: #00e5ff;
    flex-shrink: 0;
}

.motivo-opt.outro {
    border-color: rgba(255, 255, 255, 0.07);
}

.motivo-outro-txt {
    display: none;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    background: rgba(0, 0, 0, 0.35);
    color: #e8f4ff;
    font-size: 0.82rem;
    resize: none;
    outline: none;
    margin-top: 2px;
}

.motivo-outro-txt.visivel {
    display: block;
}

.motivo-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.motivo-btn-cancel {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    color: rgba(232, 244, 255, 0.7);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.12s;
}

.motivo-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.07);
}

.motivo-btn-ok {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #991b1b, #dc2626);
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.12s;
}

.motivo-btn-ok:hover {
    opacity: 0.87;
}

.motivo-btn-ok.verde {
    background: linear-gradient(135deg, #007a3d, #27ae60);
}

/* Tema claro */
body.tema-claro .motivo-modal {
    background: rgba(240, 244, 252, 0.99);
    border-color: rgba(0, 80, 180, 0.2);
}

body.tema-claro .motivo-modal-titulo {
    color: #1a2232;
}

body.tema-claro .motivo-opt {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #2c3e50;
}

body.tema-claro .motivo-opt:hover {
    background: rgba(0, 80, 160, 0.08);
}

body.tema-claro .motivo-outro-txt {
    background: #f0f4fc;
    color: #1a2232;
    border-color: rgba(0, 0, 0, 0.15);
}

body.tema-claro .motivo-btn-cancel {
    color: rgba(30, 50, 80, 0.65);
    border-color: rgba(0, 0, 0, 0.15);
}

body.tema-claro #pin-context-menu {
    background: rgba(240, 244, 252, 0.97);
    border-color: rgba(0, 100, 180, 0.18);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.10);
}

body.tema-claro .pin-cm-num {
    color: #0070c0;
}

body.tema-claro .pin-cm-cliente {
    color: #1a2232;
}

body.tema-claro .pin-cm-status {
    color: rgba(30, 50, 80, 0.5);
}

body.tema-claro .pin-cm-fechar {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(30, 50, 80, 0.5);
}

body.tema-claro .pin-cm-fechar:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #1a2232;
}

body.tema-claro .pin-cm-btn {
    background: rgba(0, 80, 160, 0.07);
    border-color: rgba(0, 80, 160, 0.18);
    color: #1a6ea8;
}

body.tema-claro .pin-cm-btn:hover {
    background: rgba(0, 80, 160, 0.15);
    color: #0050a0;
}

body.tema-claro .pin-cm-itens-titulo {
    color: rgba(0, 100, 180, 0.7);
}

body.tema-claro .pin-cm-item-li {
    color: #2c3e50;
}

body.tema-claro .pin-cm-item-sub {
    color: rgba(44, 62, 80, 0.55);
}

body.tema-claro .pin-cm-select {
    background: rgba(210, 218, 232, 0.85);
    color: #1a2232;
    border-color: rgba(0, 0, 0, 0.14);
}

body.tema-claro .pin-cm-select option {
    background: #edf0f5;
    color: #1a2232;
}