/* ============================================================================
   DeliveryOn Painel do Lojista (loja.css)
   ============================================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #151d2e;
    --bg-elevated: #1e293b;
    --sidebar-width: 256px;
    --topbar-h: 60px;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --text-primary: #f1f5f9;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.12);
    --radius: 10px;
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    font-size: 26px;
    line-height: 1;
}

.brand-name {
    font-size: 15px;
    font-weight: 800;
    color: #a5b4fc;
    display: block;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
}

.store-selector-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.store-selector-box label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.store-selector-box select,
#store-selector {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 10px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-muted);
    transition: all .15s;
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(99, 102, 241, .1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, .18);
    color: #a5b4fc;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: #fff;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.nav-item-footer {
    color: var(--text-muted);
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 80px 24px 24px;
    min-height: 100vh;
}

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-h);
    max-height: var(--topbar-h);
    background: rgba(10, 14, 23, .9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    gap: 12px;
    overflow: visible;
    flex-wrap: nowrap !important;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap !important;
    overflow: visible;
    height: 100%;
}

.topbar-clock {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.period-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
}

/* ── Views ────────────────────────────────────────────────── */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform .15s;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 2px 2px 0 0;
}

.kpi-card.accent-blue::before {
    background: var(--accent-blue);
}

.kpi-card.accent-green::before {
    background: var(--accent-green);
}

.kpi-card.accent-red::before {
    background: var(--accent-red);
}

.kpi-card.accent-purple::before {
    background: var(--accent-purple);
}

.kpi-card.accent-orange::before {
    background: var(--accent-orange);
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    font-size: 28px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 800;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Charts ───────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--border);
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-muted);
}

.chart-wrap {
    position: relative;
    height: 200px;
}

.chart-wrap canvas {
    max-height: 200px;
}

/* ── Live Feed ────────────────────────────────────────────── */
.live-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delivery-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all .15s;
}

.delivery-card:hover {
    border-color: rgba(99, 102, 241, .4);
    background: var(--bg-elevated);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pending {
    background: rgba(245, 158, 11, .15);
    color: #f59e0b;
}

.status-pending_next {
    background: rgba(245, 158, 11, .15);
    color: #f59e0b;
}

.status-accepted {
    background: rgba(59, 130, 246, .15);
    color: #60a5fa;
}

.status-in_progress,
.status-picked_up,
.status-delivered_to_customer {
    background: rgba(99, 102, 241, .15);
    color: #a5b4fc;
}

.status-returning {
    background: rgba(245, 158, 11, .2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, .4);
}

.status-finished,
.status-finished_return,
.status-delivered,
.status-completed {
    background: rgba(34, 197, 94, .15);
    color: #4ade80;
}

.status-canceled,
.status-cancelled,
.status-canceled_returned,
.status-blocked_by_balance {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
}

.status-scheduled {
    background: rgba(14, 165, 233, .15);
    color: #38bdf8;
}

/* ── Section Header ───────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
}

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    width: 280px;
}

.select-sm {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--bg-elevated);
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(99, 102, 241, .04);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    min-height: 38px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.btn-primary:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-elevated);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
}

.btn-danger {
    background: rgba(239, 68, 68, .15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, .2);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .7);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.modal-overlay.open {
    display: flex !important;
}

/* Login overlay: ALWAYS visible by default, hidden ONLY when authenticated */
#modal-store-login-overlay {
    display: flex;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2147483647 !important;
    align-items: center !important;
    justify-content: center !important;
    background: #0f0f1a !important;
    pointer-events: auto !important;
}

#modal-store-login-overlay.authenticated {
    display: none !important;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    transition: border-color .15s;
    min-height: 42px;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkboxes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 13px;
}

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    min-width: 240px;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
    animation: slideIn .25s ease;
}

.toast.success {
    border-color: #22c55e;
}

.toast.error {
    border-color: #ef4444;
}

.toast.info {
    border-color: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Misc ─────────────────────────────────────────────────── */
.empty-msg {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
}

/* ── Mobile Hamburger ─────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 11px;
    left: 12px;
    z-index: 1200;
    width: 38px;
    height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.2);
}

.mobile-menu-btn.is-open {
    background: var(--bg-elevated);
    color: #a5b4fc;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 1099;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.active {
    display: block;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {

    .mobile-menu-btn {
        display: flex !important;
    }

    #sidebar {
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform .3s ease;
    }

    #sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 68px 14px 14px;
    }

    .topbar {
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 10px 0 54px;
        box-sizing: border-box;
        width: 100%;
        overflow: visible;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .page-title {
        font-size: 15px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 0 1 auto;
        min-width: 0;
    }

    .topbar-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex: 1 1 auto;
        max-width: none;
        min-width: 0;
        overflow: visible;
    }

    .period-selector-container {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 4px 8px !important;
        margin-right: 0 !important;
        flex-shrink: 0 !important;
        min-width: fit-content !important;
    }

    .period-selector-container select,
    #global-period-select {
        padding: 2px 4px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        width: auto !important;
        min-width: 80px !important;
        flex-shrink: 0 !important;
    }

    .store-status-toggle {
        padding: 4px 8px !important;
        gap: 6px !important;
        margin-right: 0 !important;
        flex-shrink: 0 !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 8px 0 48px;
        gap: 6px;
    }

    .page-title {
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-right {
        gap: 6px;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .topbar-right .topbar-clock {
        display: none !important;
    }

    .period-selector-container {
        padding: 4px 6px !important;
        gap: 2px !important;
        flex-shrink: 0 !important;
        min-width: fit-content !important;
    }

    .period-selector-container svg {
        display: none !important;
    }

    .period-selector-container select,
    #global-period-select {
        max-width: 95px !important;
        min-width: 75px !important;
        font-size: 11px !important;
        padding: 2px 2px !important;
        flex-shrink: 0 !important;
    }

    .store-status-toggle {
        padding: 4px 6px !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    .store-status-toggle #store-status-label {
        display: none !important;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        border-radius: 14px 14px 0 0;
        max-height: 95vh;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Select Inputs */
select,
select.select-input,
.select-sm,
.select-input {
    color-scheme: dark !important;
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid rgba(148, 163, 184, 0.12) !important;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}

select:focus,
select.select-input:focus,
.select-sm:focus,
.select-input:focus {
    outline: none;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 10px !important;
}


/* Added for Despachar Force Assign UI */
.driver-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.driver-card:hover {
    border-color: var(--accent-primary);
}

.driver-card.selected {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.05);
}

.driver-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}

.driver-info {
    flex: 1;
    min-width: 0;
}

.driver-name {
    font-size: 13px;
    font-weight: 600;
}

.driver-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.driver-dist {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-green);
    white-space: nowrap;
}

.driver-map-marker,
.delivery-map-marker,
.store-map-marker {
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

.driver-map-marker>div,
.delivery-map-marker>div,
.store-map-marker>div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.driver-map-marker>div:hover,
.delivery-map-marker>div:hover,
.store-map-marker>div:hover {
    transform: scale(1.12);
    z-index: 999999 !important;
}

/* Universal Mobile Responsiveness Fix for Modals, Inputs & Maps in /loja */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 6px !important;
        overflow-x: hidden !important;
    }

    .modal {
        width: 96vw !important;
        max-width: 96vw !important;
        margin: auto !important;
        box-sizing: border-box !important;
        border-radius: 12px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .modal-body {
        padding: 10px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Ensure checkbox labels remain horizontal row alignment */
    label[style*="display:flex"],
    label[style*="display: flex"],
    .form-group label[style*="display:flex"] {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        width: auto !important;
    }

    label input[type="checkbox"],
    input[type="checkbox"] {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        cursor: pointer !important;
    }

    .form-group, .form-input, .select-input, select, input, textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        text-overflow: ellipsis !important;
    }

    /* Fix return fee inputs & custom km inputs on iPhone/mobile */
    .return-fee-item,
    .custom-km-item {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Fix store-return-fee-row layout on mobile: break into 2 lines */
    .store-return-fee-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .store-return-fee-row .return-fee-type-select {
        width: 100% !important;
        min-height: 40px !important;
        font-size: 14px !important;
        padding: 6px 8px !important;
        flex: none !important;
    }

    .store-return-fee-row .return-fee-label-input {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-height: 40px !important;
        font-size: 14px !important;
        padding: 6px 8px !important;
    }

    .store-return-fee-row .return-fee-price-input {
        flex: 1 !important;
        min-width: 80px !important;
        min-height: 40px !important;
        font-size: 14px !important;
        padding: 6px 8px !important;
    }

    .return-fee-label-input,
    .return-fee-cents-input,
    .custom-km-input {
        min-height: 44px !important;
        font-size: 15px !important;
        padding: 8px 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border-radius: 6px !important;
    }

    select option {
        max-width: 100% !important;
        word-break: break-word !important;
    }

    #modal-combo-suggestions-list,
    #new-deliv-combo-suggestions-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        max-height: 260px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .combo-suggestion-item,
    div[class*="combo-suggestion"] {
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px !important;
    }
}

/* Ocultar todo o conteúdo do site até que o usuário esteja autenticado */
body:not(.authenticated) .sidebar,
body:not(.authenticated) .main-content,
body:not(.authenticated) .mobile-menu-btn,
body:not(.authenticated) .sidebar-backdrop {
    display: none !important;
}

body:not(.authenticated) {
    overflow: hidden !important;
    background: #0f0f1a !important;
}


/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #475569; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: #10b981; }
input:focus + .slider { box-shadow: 0 0 1px #10b981; }
input:checked + .slider:before { transform: translateX(14px); }
.slider.round { border-radius: 20px; }
.slider.round:before { border-radius: 50%; }

/* iFood Chips & Filters */
.btn-chip {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border, rgba(148, 163, 184, 0.15));
    color: var(--text-muted, #94a3b8);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-chip:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(99, 102, 241, 0.4);
}

.btn-chip.active {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.chip-count {
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
}

.chip-count.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.chip-count.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.chip-count.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.btn-chip.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.badge-ifood {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.badge-ifood-cfm { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-ifood-rtp { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-ifood-dsp { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-ifood-con { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-ifood-can { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-ifood-plc { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* iFood Integration Panel & Credentials */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.ifood-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #ea1d2c, #c41525);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(234, 29, 44, 0.4);
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.ifood-section {
  background: linear-gradient(135deg, #1a0a0b, #1e1e2e);
  border: 1px solid rgba(234, 29, 44, 0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.ifood-section h3 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ifood-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #fff;
  font-size: 13px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.ifood-input:focus {
  border-color: #ea1d2c;
  outline: none;
}

.btn-ifood-save {
  background: linear-gradient(135deg, #ea1d2c, #c41525);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 8px;
  transition: opacity 0.2s;
}

.btn-ifood-save:hover {
  opacity: 0.85;
}

.btn-ifood-test {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-ifood-test:hover {
  opacity: 0.85;
}

.ifood-blocked-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    background: linear-gradient(135deg, #1e1e2e, #2d1b1b);
    border: 2px solid #ea1d2c;
    border-radius: 16px;
    padding: 20px 24px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(234, 29, 44, 0.4);
    animation: slideInRight 0.3s ease;
}

.ifood-blocked-alert-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ifood-blocked-alert-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.ifood-blocked-alert-title {
    font-weight: 800;
    color: #fff;
    font-size: 15px;
    margin-bottom: 4px;
}

.ifood-blocked-alert-display-id {
    font-weight: 700;
    color: #ea1d2c;
    font-size: 18px;
    margin-bottom: 8px;
}

.ifood-blocked-alert-reason {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.4;
}

.ifood-blocked-alert-btn {
    margin-top: 12px;
    background: #ea1d2c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ifood-blocked-alert-btn:hover {
    opacity: 0.85;
}

.modal-readonly-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.loja-km-rate-row,
.store-km-rate-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary, #1e293b);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.store-return-fee-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary, #0f172a);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.15));
}

.integration-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.integration-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    border-color: rgba(99, 102, 241, 0.4);
}

/* ============================================================================
   Lojista Tables & Integration Views (iFood, Anota AI)
   ============================================================================ */

.view#view-ifood,
.view#view-anotaai,
.view#view-integracoes,
.view#view-pedidos-integrados {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary, #131324);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.data-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    text-align: left;
    font-size: 12.5px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.05));
    vertical-align: middle;
}

.data-table th {
    background: var(--bg-tertiary, #1e1e34);
    color: var(--text-secondary, #94a3b8);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.ifood-filter-chips,
.anotaai-filter-chips,
.integration-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    background: var(--bg-tertiary, #1e1e34);
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.btn-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-chip.active {
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border-color: var(--accent-primary, #6366f1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.chip-count {
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 700;
}

.chip-count.warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

.chip-count.success {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.chip-count.danger {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.chip-count.info {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

.modal-raw-logs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.map-container {
    position: relative;
    width: 100%;
}

.map-overlay-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
}

.map-btn:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* ── Field Error Highlight & Pulse ────────────────────────── */
.field-error-highlight {
    border: 2px solid #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25), 0 0 16px rgba(239, 68, 68, 0.35) !important;
    animation: fieldErrorPulse 1.8s infinite ease-in-out !important;
    outline: none !important;
}

@keyframes fieldErrorPulse {
    0% {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2), 0 0 8px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.4), 0 0 20px rgba(239, 68, 68, 0.55);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2), 0 0 8px rgba(239, 68, 68, 0.3);
    }
}
