:root {
    --ml-yellow: #fff159;
    --ml-bg: #ebebeb;
    --ml-blue: #3483fa;
    --ml-blue-hover: #2968c8;
    --ml-text: #333333;
    --ml-text-muted: #999999;
    --ml-border: #e6e6e6;
    --ml-card: #ffffff;
    --font: 'Inter', sans-serif;
    --danger: #ff5a5f;
}

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

body {
    font-family: var(--font);
    background-color: var(--ml-bg);
    color: var(--ml-text);
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ────────────────────────────────────────── */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────── */
.sidebar {
    width: 260px;
    background-color: var(--ml-yellow);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
    font-size: 1.4rem;
    color: #2d3277;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    flex: 1;
}

.nav-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: #000;
}

.nav-item.active {
    background-color: rgba(0, 0, 0, 0.06);
    color: #000;
    font-weight: 700;
    border-left: 4px solid var(--ml-blue);
    padding-left: 20px;
}

.spacer {
    flex: 1;
}

.text-danger {
    color: #d00000;
}

.text-danger:hover {
    color: #fe0000;
    background: rgba(200, 0, 0, 0.05);
}

/* ── MAIN CONTENT ──────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn .3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
}

/* ── CARDS & FORMS ─────────────────────────────────── */
.card {
    background: var(--ml-card);
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .12);
    padding: 24px;
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ml-border);
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: .85rem;
    color: var(--ml-text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.form-control {
    font-family: var(--font);
    border: 1px solid var(--ml-border);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 1rem;
    color: var(--ml-text);
    outline: none;
    transition: border-color .2s;
}

.form-control:focus {
    border-color: var(--ml-blue);
    box-shadow: 0 0 0 2px rgba(52, 131, 250, .2);
}

.form-lg {
    font-size: 1.1rem;
    padding: 14px 16px;
}

.row {
    display: flex;
    gap: 16px;
}

.flex-1 {
    flex: 1;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.ml-2 {
    margin-left: 8px;
}

.flex-row {
    flex-direction: row;
}

.align-center {
    align-items: center;
}

.pointer {
    cursor: pointer;
}

.color-mute {
    color: var(--ml-text-muted);
    font-size: 0.85rem;
}

/* ── BUTTONS ───────────────────────────────────────── */
.btn-primary,
.btn-secondary {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: .95rem;
    font-weight: 600;
    transition: all .2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--ml-blue);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--ml-blue-hover);
}

.btn-secondary {
    background-color: rgba(65, 137, 230, .15);
    color: var(--ml-blue);
}

.btn-secondary:hover {
    background-color: rgba(65, 137, 230, .25);
}

.btn-danger {
    background: none;
    color: var(--ml-blue);
    font-size: .85rem;
    cursor: pointer;
    border: none;
    padding: 8px;
}

.btn-danger:hover {
    color: var(--ml-blue-hover);
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-lg {
    padding: 16px;
    font-size: 1.05rem;
}

/* ── IMAGE UPLOAD ──────────────────────────────────── */
.upload-area {
    border: 2px dashed #b0c4de;
    border-radius: 6px;
    height: 200px;
    background-color: #f5f8fb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    position: relative;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.dragover {
    background-color: #e5edf4;
    border-color: var(--ml-blue);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-text {
    color: var(--ml-blue);
    font-weight: 600;
    font-size: .95rem;
}

#previewImage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.btn-remove-img {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── TABLE VIEW ────────────────────────────────────── */
.table-controls {
    margin-bottom: 20px;
}

.input-search {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 1px solid var(--ml-border);
    border-radius: 20px;
    font-family: var(--font);
    font-size: .95rem;
    outline: none;
}

.input-search:focus {
    border-color: var(--ml-blue);
}

/* Busca por texto + filtro de estoque lado a lado (quebram linha no celular). */
.ads-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.select-filtro {
    padding: 12px 16px;
    border: 1px solid var(--ml-border);
    border-radius: 20px;
    font-family: var(--font);
    font-size: .95rem;
    color: var(--ml-text);
    background: #fff;
    cursor: pointer;
    outline: none;
}

.select-filtro:focus {
    border-color: var(--ml-blue);
}

/* Barra "N selecionados / Excluir selecionados", junto do campo de busca. So
   aparece quando pelo menos um anuncio esta marcado (ver #adsBulkBar[hidden]). */
.ads-bulkbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 90, 95, .08);
    border: 1px solid rgba(255, 90, 95, .35);
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ml-text);
}

.ads-bulkbar[hidden] {
    display: none;
}

.btn-bulk-delete {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .85rem;
    font-weight: 700;
    background: var(--danger);
    color: #fff;
}

.btn-bulk-delete:hover {
    background: #e33338;
}

.btn-bulk-clear {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    background: none;
    color: var(--ml-text-muted);
    font-weight: 600;
    font-size: .85rem;
    text-decoration: underline;
}

.ads-table {
    width: 100%;
    border-collapse: collapse;
}

.ads-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--ml-text-muted);
    font-weight: 500;
    font-size: .85rem;
    border-bottom: 1px solid var(--ml-border);
}

.ads-table td {
    padding: 16px;
    border-bottom: 1px solid var(--ml-border);
    vertical-align: middle;
}

.ads-table th:first-child,
.ads-table td:first-child {
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
}

.ads-row-check,
#selectAllAds {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--ml-blue);
}

.ads-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Fica parado no canto enquanto a lista de anuncios rola (quem rola e o
   .main-content, nao a pagina). So fica visivel depois de descer um pouco. */
.btn-voltar-topo {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--ml-blue);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .2s, transform .2s, background .2s;
    z-index: 40;
}

.btn-voltar-topo.visivel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-voltar-topo:hover {
    background: var(--ml-blue-hover);
}

.td-img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    border: 1px solid var(--ml-border);
    object-fit: cover;
}

.td-title {
    font-weight: 500;
    color: #333;
}

.td-desc {
    font-size: .75rem;
    color: var(--ml-text-muted);
    margin-top: 4px;
}

.badge-stock {
    background: #e6f3eb;
    color: #00a650;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-out {
    background: #ffe6e6;
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ml-text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
}

/* ── LOGIN OVERLAY ─────────────────────────────────── */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ml-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-overlay.hidden {
    display: none;
}

.login-box {
    background: var(--ml-card);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    color: #2d3277;
    margin-bottom: 8px;
}

.login-box p {
    color: var(--ml-text-muted);
    margin-bottom: 24px;
    font-size: .95rem;
}

.login-box input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--ml-border);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 1rem;
    text-align: center;
    outline: none;
}

.login-box input:focus {
    border-color: var(--ml-blue);
}

/* ── PASSWORD TOGGLE ───────────────────────────────── */
.password-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

.password-wrapper input {
    margin-bottom: 0 !important;
    padding-right: 46px !important;
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-toggle-pass:hover {
    opacity: 1;
}

/* ── LOGOS ─────────────────────────────────────────── */
.logo-img-login {
    height: 80px;
    margin-bottom: 15px;
    object-fit: contain;
}

.logo-img-sidebar {
    height: 40px;
    object-fit: contain;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 14px 24px;
    border-radius: 24px;
    font-size: .9rem;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: bottom 0.3s ease;
    z-index: 10000;
}

.toast.show {
    bottom: 30px;
}

/* ── MULTI PHOTOS GRID ────────────────────────────── */
.photos-grid-admin {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.photo-slot {
    aspect-ratio: 1;
    border: 2px dashed #d0dbe5;
    border-radius: 8px;
    background: #fcfdfe;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all .2s;
}

.photo-slot:hover {
    border-color: var(--ml-blue);
    background: #f0f7ff;
}

.photo-slot.has-image {
    border-style: solid;
    border-color: var(--ml-border);
}

.photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.photo-slot .slot-placeholder {
    font-size: 1.5rem;
    color: #cbd5e0;
}

.photo-slot .slot-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: .65rem;
    text-align: center;
    padding: 2px 0;
    text-transform: uppercase;
}

.photo-slot.btn-remove-slot {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #ff5a5f;
    border: 1px solid #ff5a5f;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.photo-slot.drag-over {
    border-color: var(--ml-blue);
    background: #e5f2ff;
    transform: scale(1.02);
}

.btn-url-slot {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ml-blue);
    border: 1px solid var(--ml-blue);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.btn-url-slot:hover {
    background: var(--ml-blue);
    color: #fff;
}


/* ── VARIATIONS ────────────────────────────────────── */
.variation-row {
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    position: relative;
    animation: fadeIn .2s ease;
}

.variation-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.variation-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-remove-var {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
}

.mb-2 {
    margin-bottom: 8px;
}

/* ── MODALS ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn .2s ease;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #999;
    transition: color .2s;
}

.modal-close-btn:hover {
    color: #333;
}

/* ── CONTACT BADGES ───────────────────────────────── */
.contact-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e6f3eb;
    color: #00a650;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 500;
    margin: 4px;
}

.contact-badge .remove-badge {
    cursor: pointer;
    font-weight: 700;
    margin-left: 4px;
    color: #ff5a5f;
}

.contact-badge .remove-badge:hover {
    color: #d00;
}

/* ── CONTACTS TABLE ───────────────────────────────── */
.btn-delete-contact {
    background: none;
    border: none;
    color: #ff5a5f;
    cursor: pointer;
    font-size: .85rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background .2s;
}

.btn-delete-contact:hover {
    background: #fff0f0;
}

.btn-whatsapp-contact {
    background: none;
    border: none;
    color: #25d366;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .2s;
}

.btn-whatsapp-contact:hover {
    background: #e6f9ee;
}

.mt-2 {
    margin-top: 8px;
}

/* ── RESPONSIVIDADE (MOBILE & TABLET) ───────────────── */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 16px;
        background-color: var(--ml-yellow);
        padding: 12px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        z-index: 999;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .btn-menu-toggle {
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(0, 0, 0, 0.7);
    }

    .mobile-title {
        font-weight: 800;
        font-size: 1.2rem;
        color: #2d3277;
    }

    .dashboard {
        flex-direction: column;
    }

    /* Sidebar drawer style */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Sidebar Backdrop */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(2px);
        z-index: 1000;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

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

    /* Main Content adjustments */
    .main-content {
        padding: 16px;
        margin-top: 60px;
        overflow-x: hidden;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .row {
        flex-direction: column;
        gap: 12px;
    }

    .col-side {
        margin-top: 8px;
    }

    /* Card padding */
    .card {
        padding: 16px;
    }

    /* Headers */
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }

    .view-header h1 {
        font-size: 1.4rem;
    }

    .view-header div, 
    .view-header button, 
    .view-header .btn-primary, 
    .view-header .btn-secondary {
        width: 100%;
        margin-left: 0 !important;
    }

    /* Tables */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ads-table th,
    .ads-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .btn-voltar-topo {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }

    /* Hide description subtext in table on small screens to save space */
    .td-desc {
        display: none;
    }

    /* Photo Slot grid on mobile */
    .photos-grid-admin {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── SALES REPORT STYLING ──────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 8px;
    background: var(--ml-card);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .12);
}

.stat-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--ml-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ml-text);
    margin-top: 4px;
}

/* Badges Status */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.badge-approved {
    background: #e6f3eb;
    color: #00a650;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-rejected {
    background: #ffe6e6;
    color: #ff5a5f;
}

.badge-neutral {
    background: #eee;
    color: #666;
}

.action-buttons-group {
    display: flex;
    gap: 10px;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.filter-group .input-search {
    flex: 1;
}

/* Invoice Modal details styling */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.invoice-title h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3277;
}

.invoice-title span {
    font-size: 0.8rem;
    color: #999;
}

.invoice-content {
    font-size: 0.95rem;
}

.invoice-section {
    margin-bottom: 15px;
}

.invoice-section h4 {
    font-size: 0.9rem;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.invoice-section p {
    margin-bottom: 6px;
    color: #333;
}

.invoice-divider {
    border: 0;
    border-top: 1px dashed #eee;
    margin: 15px 0;
}

.modal-box.modal-lg {
    max-width: 600px;
}

/* Fullscreen modal styling */
.modal-maximize-btn {
    position: absolute;
    top: 16px;
    right: 46px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    transition: color .2s, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.modal-maximize-btn:hover {
    color: #333;
    transform: scale(1.1);
}

.modal-maximize-btn:active {
    transform: scale(0.95);
}

.modal-overlay.modal-fullscreen .modal-box {
    max-width: 96vw;
    width: 96vw;
    height: 96vh;
    max-height: 96vh;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.modal-overlay.modal-fullscreen .modal-box .table-responsive {
    max-height: calc(96vh - 120px) !important;
    height: calc(96vh - 120px);
    flex-grow: 1;
    overflow-y: auto;
}

@media print {
    /* Regras normais para impressão do relatório geral */
    body:not(.printing-invoice) * {
        visibility: hidden;
    }
    body:not(.printing-invoice) #view-reports,
    body:not(.printing-invoice) #view-reports * {
        visibility: visible;
    }
    body:not(.printing-invoice) #view-reports {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white;
        color: black;
    }
    body:not(.printing-invoice) #view-reports .view-header button,
    body:not(.printing-invoice) #view-reports .view-header .action-buttons-group,
    body:not(.printing-invoice) #view-reports .table-controls,
    body:not(.printing-invoice) #view-reports .ads-table th:last-child,
    body:not(.printing-invoice) #view-reports .ads-table td:last-child {
        display: none !important;
    }

    /* Regras extremas para impressão do comprovante individual */
    body.printing-invoice > * {
        display: none !important;
    }
    body.printing-invoice > #dashboard {
        display: block !important;
        position: relative !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }
    body.printing-invoice > #dashboard > * {
        display: none !important;
    }
    body.printing-invoice > #dashboard > #saleDetailsModal {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }
    body.printing-invoice #saleDetailsModal,
    body.printing-invoice #saleDetailsModal * {
        visibility: visible !important;
    }
    body.printing-invoice #saleDetailsModal .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 10px !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        overflow: visible !important;
    }
    body.printing-invoice .modal-close-btn,
    body.printing-invoice .btn-print-invoice {
        display: none !important;
    }
}

/* ── SHARE BUILDER (WhatsApp Preview) ─────────────── */
.share-builder-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.share-builder-editor {
    min-width: 0;
}

.share-builder-preview {
    position: sticky;
    top: 20px;
}

.share-preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--ml-text-muted);
    text-align: center;
    margin-bottom: 12px;
}

/* Phone Frame */
.wpp-phone-frame {
    background: #e5ddd5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #d0d0d0;
    max-width: 340px;
    margin: 0 auto;
}

.wpp-phone-header {
    background: #075e54;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpp-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25d366, #128c7e);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.wpp-header-info {
    display: flex;
    flex-direction: column;
}

.wpp-header-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.wpp-header-status {
    color: rgba(255,255,255,0.7);
    font-size: 0.7rem;
}

/* Chat Body */
.wpp-chat-body {
    padding: 16px 12px 20px;
    min-height: 260px;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h80v80H0z' fill='none'/%3E%3Cpath d='M40 10a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM10 40a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM70 40a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM40 70a2 2 0 1 1 0-4 2 2 0 0 1 0 4z' fill='rgba(0,0,0,0.03)'/%3E%3C/svg%3E");
}

/* Bubble */
.wpp-bubble {
    background: #dcf8c6;
    border-radius: 8px 0 8px 8px;
    padding: 4px 6px 6px;
    max-width: 95%;
    margin-left: auto;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wpp-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    border-width: 0 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent transparent #dcf8c6;
}

/* OG Card inside bubble */
.wpp-og-card {
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 4px;
}

.wpp-og-image {
    width: 100%;
    height: 130px;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #bbb;
    overflow: hidden;
}

.wpp-og-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpp-og-meta {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpp-og-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wpp-og-desc {
    font-size: 0.72rem;
    color: #888;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wpp-og-url {
    font-size: 0.65rem;
    color: #aaa;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Bubble text */
.wpp-bubble-text {
    font-size: 0.82rem;
    color: #303030;
    padding: 6px 4px 2px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.wpp-bubble-time {
    display: block;
    text-align: right;
    font-size: 0.62rem;
    color: rgba(0,0,0,0.4);
    padding-right: 2px;
    margin-top: 2px;
}

/* Variable Chips */
.share-variables-help {
    background: #f8f9fb;
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.share-variables-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ml-text-muted);
    margin-bottom: 8px;
}

.share-variable-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.share-chip {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--ml-blue);
    color: var(--ml-blue);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}

.share-chip:hover {
    background: var(--ml-blue);
    color: #fff;
    transform: translateY(-1px);
}

/* Template info box */
.template-info-box {
    background: #f0f7ff;
    border-left: 3px solid var(--ml-blue);
    padding: 12px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

.template-info-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ml-blue);
}

.template-info-box p {
    color: #666;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .share-builder-layout {
        grid-template-columns: 1fr;
    }
    .share-builder-preview {
        position: static;
    }
}
/* ══════════════════════════════════════════════════════════════════
   DICAS (tooltips)

   Um "?" ao lado do rotulo que explica o campo ao passar o mouse.
   Uso:  <span class="dica" data-dica="texto da explicacao">?</span>

   Feito so em CSS, sem JavaScript: assim funciona em qualquer tela do
   painel sem precisar registrar nada, e nao quebra se o script falhar.

   No celular nao existe "passar o mouse", entao o toque tambem abre —
   o :focus cobre isso, e o tabindex no HTML torna o "?" focavel.
   ══════════════════════════════════════════════════════════════════ */

.dica {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ml-text-muted);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    position: relative;
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    user-select: none;
    transition: background .15s;
}

.dica:hover,
.dica:focus {
    background: var(--ml-blue);
    outline: none;
}

/* A bolha. Fica escondida por padrao e aparece no hover/foco. */
.dica::after {
    content: attr(data-dica);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #1d1f27;
    color: #eceef4;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: left;
    padding: 9px 12px;
    border-radius: 8px;
    /* Largura fixa: sem isso um texto longo vira uma linha unica gigante
       que sai da tela. */
    width: max-content;
    max-width: 260px;
    white-space: normal;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s, transform .15s;
    z-index: 999;
    pointer-events: none;
}

/* A setinha apontando para o "?" */
.dica::before {
    content: "";
    position: absolute;
    top: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1d1f27;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
    z-index: 999;
    pointer-events: none;
}

.dica:hover::after,
.dica:focus::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dica:hover::before,
.dica:focus::before {
    opacity: 1;
    visibility: visible;
}

/* Perto da borda direita a bolha centralizada sairia da tela.
   Com .dica-esq ela alinha pela direita e fica visivel. */
.dica-esq::after {
    left: auto;
    right: -4px;
    transform: translateX(0) translateY(-4px);
}

.dica-esq:hover::after,
.dica-esq:focus::after {
    transform: translateX(0) translateY(0);
}

/* Em tela estreita a bolha ocupa quase a largura toda, ancorada a direita,
   para nunca vazar para fora do visor. */
@media (max-width: 640px) {
    .dica::after {
        max-width: min(260px, calc(100vw - 40px));
        left: auto;
        right: -4px;
        transform: translateX(0) translateY(-4px);
    }
    .dica:hover::after,
    .dica:focus::after {
        transform: translateX(0) translateY(0);
    }
}
