:root {
    --preto-fosco: #171717;
    --preto-escuro: #0B0B0B;
    --laranja: #CD4C00;
    --laranja-hover: #E85D00;
    --laranja-glow: rgba(205, 76, 0, 0.3);
    --cinza: #2E2E2E;
    --cinza-claro: #3A3A3A;
    --branco: #FFFFFF;
    --texto: #E8E8E8;
    --texto-muted: #9A9A9A;
    --glass-bg: rgba(46, 46, 46, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --preto-fosco: #F5F5F5;
    --preto-escuro: #FFFFFF;
    --cinza: #E8E8E8;
    --cinza-claro: #D0D0D0;
    --texto: #1A1A1A;
    --texto-muted: #666666;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--preto-escuro);
    color: var(--texto);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--preto-escuro); }
::-webkit-scrollbar-thumb { background: var(--cinza); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--laranja); }

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Login */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--preto-escuro) 0%, var(--preto-fosco) 50%, #1a0a00 100%);
    z-index: 0;
}

.login-bg::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--laranja-glow) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    margin: 1rem;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--laranja), #FF6B1A);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: white;
    box-shadow: 0 8px 24px var(--laranja-glow);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--preto-fosco);
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--branco);
}

.sidebar-logo i {
    color: var(--laranja);
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--texto-muted);
    padding: 0.75rem 1rem 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    color: var(--texto-muted);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(205, 76, 0, 0.1);
    color: var(--texto);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--laranja), #E85D00);
    color: white;
    box-shadow: 0 4px 12px var(--laranja-glow);
}

.nav-item i { width: 20px; text-align: center; font-size: 0.95rem; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--cinza);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--laranja);
}

.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; color: var(--texto-muted); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    border-radius: 0 !important;
    border-left: none;
    border-right: none;
    border-top: none;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.loja-selector-wrap {
    min-width: 140px;
    max-width: 200px;
}

.loja-selector {
    background: var(--cinza);
    border-color: rgba(255,255,255,0.1);
    color: var(--branco);
    font-size: 0.8rem;
}

.topbar-actions { display: flex; gap: 0.5rem; }

.bi-tabs .nav-link {
    color: var(--text-muted, #999);
    border: none;
    font-size: 0.85rem;
}

.bi-tabs .nav-link.active {
    color: var(--laranja);
    border-bottom: 2px solid var(--laranja);
    background: transparent;
}

.realtime-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    max-width: 42vw;
}

.realtime-pill {
    font-size: 0.7rem;
    white-space: nowrap;
}

.rt-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    margin-right: 4px;
    animation: rt-pulse 1.5s infinite;
}

@keyframes rt-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--texto-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--cinza);
    color: var(--laranja);
}

.badge-notif {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--laranja);
    color: white;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.content-area {
    padding: 1.5rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cards */
.stat-card {
    padding: 1.5rem;
    transition: var(--transition);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--texto-muted);
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--laranja), #E85D00);
    border: none;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--laranja-hover), #FF6B1A);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--laranja-glow);
}

.btn-outline-primary {
    border-color: var(--laranja);
    color: var(--laranja);
    border-radius: 8px;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: var(--laranja);
    border-color: var(--laranja);
}

.btn-whatsapp {
    background: #25D366;
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
}

.btn-whatsapp:hover {
    background: #1ebe57;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.crm-stat-card {
    padding: 1.25rem;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.crm-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--laranja);
}

.crm-stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--texto-muted);
}

.template-vars {
    font-size: 0.8rem;
    color: var(--texto-muted);
}

.template-vars code {
    color: var(--laranja);
    background: rgba(205, 76, 0, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.live-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

.weather-widget {
    border-radius: 10px;
    min-width: 120px;
}

.meta-progress {
    height: 10px;
    background: var(--cinza);
    border-radius: 6px;
    overflow: hidden;
}

.meta-progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    background: var(--laranja);
}

.meta-progress-bar.bg-success { background: #22C55E !important; }
.meta-progress-bar.bg-warning { background: #EAB308 !important; }

.var-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.15rem;
}

.var-up { color: #22C55E; background: rgba(34, 197, 94, 0.15); }
.var-down { color: #EF4444; background: rgba(239, 68, 68, 0.15); }

.rel-card.active {
    border-color: var(--laranja) !important;
    box-shadow: 0 0 0 2px var(--laranja-glow);
}

#map-container .leaflet-container {
    background: var(--preto-escuro);
    font-family: Inter, sans-serif;
}

/* Forms */
.form-control, .form-select {
    background: var(--cinza);
    border: 1px solid var(--glass-border);
    color: var(--texto);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
}

.form-control:focus, .form-select:focus {
    background: var(--cinza-claro);
    border-color: var(--laranja);
    color: var(--texto);
    box-shadow: 0 0 0 3px var(--laranja-glow);
}

.form-control::placeholder { color: var(--texto-muted); }

.input-group-text {
    background: var(--cinza);
    border: 1px solid var(--glass-border);
    color: var(--texto-muted);
}

.form-label { color: var(--texto-muted); font-size: 0.85rem; font-weight: 500; }

/* Tables */
.table-dark-custom {
    --bs-table-bg: transparent;
    color: var(--texto);
}

.table-dark-custom thead th {
    background: var(--cinza);
    border-bottom: 2px solid var(--laranja);
    color: var(--texto-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 0.85rem 1rem;
}

.table-dark-custom tbody td {
    padding: 0.75rem 1rem;
    border-color: var(--glass-border);
    vertical-align: middle;
}

.table-dark-custom tbody tr {
    transition: var(--transition);
}

.table-dark-custom tbody tr:hover {
    background: rgba(205, 76, 0, 0.05);
}

/* Badges */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: #EAB308; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #3B82F6; }
.badge-orange { background: rgba(205, 76, 0, 0.15); color: var(--laranja); }

/* Chart containers */
.chart-container {
    padding: 1.5rem;
    position: relative;
    min-height: 300px;
}

/* PDV */
.pdv-container { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; height: calc(100vh - var(--topbar-height) - 3rem); }

.pdv-produtos {
    overflow-y: auto;
    padding-right: 0.5rem;
}

.pdv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.pdv-produto-card {
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.pdv-produto-card:active {
    transform: scale(0.97);
    border-color: var(--laranja);
}

@media (hover: hover) {
    .pdv-produto-card:hover {
        border-color: var(--laranja);
        transform: scale(1.03);
    }
}

.pdv-produto-card .produto-img {
    width: 100%;
    aspect-ratio: 1;
    max-height: 100px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pdv-produto-card .produto-img img,
.pdv-produto-card .produto-img .pdv-produto-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdv-produto-card .produto-img .produto-thumb-placeholder {
    width: 100%;
    height: 100%;
    font-size: 1.8rem;
    border-radius: 0;
    background: var(--cinza);
}

.pdv-produto-card .produto-nome {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.pdv-produto-card .produto-preco {
    color: var(--laranja);
    font-weight: 700;
    font-size: 0.9rem;
}

.pdv-carrinho {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pdv-carrinho-items {
    flex: 1;
    overflow-y: auto;
}

.pdv-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.pdv-total {
    padding: 1rem;
    border-top: 2px solid var(--laranja);
}

.pdv-total-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--laranja);
}

.pdv-desc-input { width: 90px; text-align: right; }

.pdv-sugestoes {
    position: absolute;
    z-index: 100;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.pdv-sugestao-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.pdv-sugestao-item:hover { background: rgba(205, 76, 0, 0.15); }

.pdv-header .badge-status { font-size: 0.8rem; }

.pdv-carrinho .form-label { margin-bottom: 0.15rem; }

.pdv-cliente-wrap { position: relative; }

/* Product images */
.produto-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.produto-thumb-placeholder {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    color: var(--texto-muted);
    font-size: 1rem;
}

.produto-upload-box { display: flex; justify-content: center; }

.produto-upload-preview {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px dashed rgba(205, 76, 0, 0.4);
}

.produto-upload-preview.produto-thumb-placeholder {
    width: 140px;
    height: 140px;
    font-size: 2rem;
    margin: 0 auto;
}

/* Notifications Panel */
.notif-panel {
    position: fixed;
    top: calc(var(--topbar-height) + 8px);
    right: 1rem;
    width: 360px;
    max-height: 480px;
    z-index: 200;
    overflow: hidden;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
}

.notif-item:hover { background: rgba(205, 76, 0, 0.05); }

.notif-item .notif-tipo {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--laranja);
    font-weight: 600;
}

/* Modal */
.modal-content { background: var(--preto-fosco) !important; color: var(--texto); }
.modal-header, .modal-footer { border-color: var(--glass-border) !important; }

/* Alert cards */
.alert-card {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.alert-card i { font-size: 1.2rem; }

/* Delivery status */
.status-timeline {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.status-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--cinza);
    color: var(--texto-muted);
    transition: var(--transition);
}

.status-step.active {
    background: var(--laranja);
    color: white;
}

.status-step.done {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
}

/* PWA Splash & Install */
.pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0B0B0B 0%, #171717 50%, #1a1008 100%);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.pwa-splash-hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pwa-splash-logo {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--laranja), #F97316);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 40px rgba(205, 76, 0, 0.35);
}

.pwa-splash-title {
    color: white;
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.pwa-splash-sub {
    color: var(--texto-muted);
    margin-bottom: 2rem;
}

.pwa-install-banner {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 9990;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border: 1px solid rgba(205, 76, 0, 0.35);
    animation: slideUp 0.4s ease;
}

.pwa-install-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(205, 76, 0, 0.2);
    color: var(--laranja);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwa-standalone .topbar { padding-top: env(safe-area-inset-top, 0); }
.pwa-standalone .pdv-mobile-bar { padding-bottom: env(safe-area-inset-bottom, 0); }

/* PDV Touch & Mobile */
.pdv-touch-btn {
    min-width: 44px;
    min-height: 44px;
}

.pdv-item {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.pdv-item-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--glass-bg);
    position: relative;
    z-index: 1;
    transition: transform 0.15s ease;
}

.pdv-item-swipe-hint {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.25);
    color: #EF4444;
}

.pdv-mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: rgba(11, 11, 11, 0.95);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}

.pwa-standalone .pdv-mobile-bar { bottom: 0; }

.pdv-mobile-cart-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(205, 76, 0, 0.15);
    color: var(--laranja);
    font-size: 1.1rem;
}

.pdv-mobile-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--laranja);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.pdv-mobile-total-wrap {
    flex: 1;
    line-height: 1.2;
}

.pdv-mobile-total-wrap strong {
    color: var(--laranja);
    font-size: 1.1rem;
}

.pdv-cart-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 250;
}

.pdv-cart-backdrop.show { display: block; }

body.pdv-cart-open { overflow: hidden; }

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .pdv-container { grid-template-columns: 1fr; height: auto; padding-bottom: 72px; }
    .pdv-carrinho-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 300;
        max-height: 85vh;
        transform: translateY(110%);
        transition: transform 0.3s ease;
    }
    .pdv-carrinho-panel.open { transform: translateY(0); }
    .pdv-carrinho-panel .pdv-carrinho {
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }
    .pdv-carrinho-items {
        overflow-y: auto;
        flex: 1;
        max-height: 40vh;
    }
    .pwa-install-banner { bottom: 4.5rem; }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .pdv-container {
        grid-template-columns: 1fr 340px;
        height: calc(100vh - var(--topbar-height) - 2rem);
    }
    .pdv-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 1rem; }
    .pdv-produto-card { padding: 1.15rem; }
    .pdv-produto-card .produto-img { max-height: 120px; }
    .pdv-produto-card .produto-nome { font-size: 0.85rem; }
    .pdv-touch-btn { min-width: 48px; min-height: 48px; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 1rem; }
    .stat-value { font-size: 1.35rem; }
    .pdv-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Loading */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner-custom {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cinza);
    border-top-color: var(--laranja);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--texto-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h4 { font-weight: 700; margin: 0; }

/* Search bar */
.search-bar {
    position: relative;
    max-width: 320px;
}

.search-bar input {
    padding-left: 2.5rem;
}

.search-bar i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-muted);
}

/* Tabs custom */
.nav-tabs-custom {
    border-bottom: 2px solid var(--glass-border);
    gap: 0.25rem;
}

.nav-tabs-custom .nav-link {
    color: var(--texto-muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    transition: var(--transition);
}

.nav-tabs-custom .nav-link:hover { color: var(--texto); }
.nav-tabs-custom .nav-link.active {
    color: var(--laranja);
    border-bottom-color: var(--laranja);
    background: transparent;
}

/* Scanner / Barcode */
.scanner-panel { border: 2px dashed var(--glass-border); }
.scanner-input-wrap { position: relative; }
.scanner-input-wrap .scanner-icon {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    font-size: 1.5rem; color: var(--laranja); z-index: 2;
}
.barcode-input { padding-left: 3rem !important; font-size: 1.1rem; font-weight: 600; letter-spacing: 1px; }
.barcode-input:focus { border-color: var(--laranja) !important; box-shadow: 0 0 0 4px var(--laranja-glow) !important; }

/* ===== Legibilidade — tema escuro + Bootstrap ===== */
html[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-color: #E8E8E8;
    --bs-body-bg: #0B0B0B;
    --bs-secondary-color: #9A9A9A;
    --bs-secondary-color-rgb: 154, 154, 154;
    --bs-tertiary-color: #888888;
    --bs-emphasis-color: #FFFFFF;
    --bs-heading-color: #FFFFFF;
    --bs-link-color: #7CB9FF;
    --bs-link-hover-color: #A8D4FF;
    --bs-border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .text-body-secondary,
html[data-theme="dark"] small.text-muted {
    color: var(--texto-muted) !important;
}

html[data-theme="dark"] .glass-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .crm-stat-card,
html[data-theme="dark"] .weather-widget {
    color: var(--texto);
}

html[data-theme="dark"] .glass-card .text-muted,
html[data-theme="dark"] .glass-card p.text-muted,
html[data-theme="dark"] .glass-card small.text-muted,
html[data-theme="dark"] .glass-card .card-meta {
    color: var(--texto-muted) !important;
}

html[data-theme="dark"] .glass-card .card-meta i,
html[data-theme="dark"] .glass-card p.text-muted i {
    color: var(--laranja);
    opacity: 0.85;
}

html[data-theme="dark"] .glass-card a:not(.btn):not(.badge):not(.btn-whatsapp) {
    color: var(--texto-muted);
    text-decoration: none;
}

html[data-theme="dark"] .alert-warning {
    background-color: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.35);
    color: #FDE047;
}

html[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #FCA5A5;
}

html[data-theme="dark"] .alert-info {
    background-color: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93C5FD;
}

html[data-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86EFAC;
}

.card-meta {
    font-size: 0.875rem;
    color: var(--texto-muted) !important;
    margin-bottom: 0.25rem;
}

.card-meta i {
    color: var(--laranja);
    opacity: 0.85;
    width: 1.1rem;
    text-align: center;
}

code {
    color: var(--laranja);
    background: rgba(205, 76, 0, 0.12);
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    font-size: 0.875em;
}

.empty-state {
    color: var(--texto-muted);
}

.empty-state i {
    color: var(--texto-muted);
    opacity: 0.45;
}

.login-screen .text-muted {
    color: var(--texto-muted) !important;
}

.notif-item .text-muted {
    color: var(--texto-muted) !important;
}

/* Print */
@media print {
    .sidebar, .topbar, .btn { display: none !important; }
    .main-content { margin-left: 0; }
    body { background: white; color: black; }
}
