/* ================================================================
   VENDAS NUTRIMAX — CSS MOBILE-FIRST RESPONSIVO
   Breakpoints: mobile < 600px | tablet 600-1024px | desktop > 1024px
   ================================================================ */

/* ==================== RESET E VARIÁVEIS ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary:        #2d6a2d;
    --primary-light:  #4CAF50;
    --primary-dark:   #1b4d1b;
    --secondary:      #8B6914;
    --success:        #4CAF50;
    --warning:        #FF9800;
    --danger:         #F44336;
    --info:           #2196F3;
    --dark:           #212121;
    --gray:           #757575;
    --gray-light:     #BDBDBD;
    --gray-lighter:   #F5F5F5;
    --white:          #FFFFFF;
    --border:         #E0E0E0;
    --shadow:         0 2px 8px rgba(0,0,0,0.10);
    --shadow-lg:      0 4px 20px rgba(0,0,0,0.15);
    --radius:         8px;
    --radius-lg:      12px;

    /* Layout */
    --sidebar-w:      260px;
    --header-h:       60px;
    --nav-bottom-h:   60px;   /* barra inferior mobile */
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Roboto', sans-serif;
    background: var(--gray-lighter);
    color: var(--dark);
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
}

/* ==================== TELA DE LOGIN ==================== */
.login-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity:0; transform:translateY(24px); }
    to   { opacity:1; transform:translateY(0); }
}

.login-logo { text-align:center; margin-bottom:28px; }
.login-logo i { font-size:56px; color:var(--primary); display:block; margin-bottom:10px; }
.login-logo h1 { color:var(--primary); font-size:26px; font-weight:700; }
.login-logo p  { color:var(--gray); font-size:14px; margin-top:4px; }

.login-hint {
    margin-top:18px;
    padding:14px;
    background:var(--gray-lighter);
    border-radius:var(--radius);
    font-size:13px;
    color:var(--gray);
}
.login-hint code {
    background:var(--white);
    padding:1px 5px;
    border-radius:3px;
    font-family:'Courier New',monospace;
    color:var(--primary);
}

/* ==================== APP SCREEN ==================== */
.app-screen { display:flex; min-height:100vh; min-height:100dvh; }

/* ==================== SIDEBAR (desktop) ==================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: var(--white);
    position: fixed;
    top: 0; left: 0;
    height: 100vh; height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 18px 16px;
    background: rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo i { font-size: 24px; flex-shrink: 0; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: none;               /* visível só no mobile via media query */
    transition: background 0.2s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.15); }

.sidebar-nav {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 13px 18px;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    transition: all 0.25s;
    cursor: pointer;
    gap: 12px;
    white-space: nowrap;
    border-left: 3px solid transparent;
    font-size: 14px;
}
.nav-item:hover { background:rgba(255,255,255,0.1); color:var(--white); }
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    border-left-color: var(--white);
    font-weight: 600;
}
.nav-item i { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 16px;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== HEADER ==================== */
.app-header {
    background: var(--white);
    padding: 0 24px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 900;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}
.header-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info { display:flex; align-items:center; gap:10px; flex-shrink:0; }

.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: 20px;
    flex-shrink: 0;
}

.user-details { display:flex; flex-direction:column; line-height:1.3; }
.user-name  { font-weight:600; font-size:14px; color:var(--dark); }
.user-role  { font-size:12px; color:var(--gray); }

/* ==================== CONTENT WRAPPER ==================== */
.content-wrapper { padding: 20px 24px; flex: 1; }

.tab-content { display:none; animation:fadeIn 0.25s ease; }
.tab-content.active { display:block; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ==================== SECTION HEADER ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.section-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}
.section-header > div {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card h3, .card h4 { color:var(--primary); margin-bottom:16px; }
.card h4 { font-size:16px; }

/* ==================== STAT CARDS (Dashboard) ==================== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: 22px;
    flex-shrink: 0;
}
.stat-details h3 { font-size:22px; font-weight:700; margin:0 0 2px; color:var(--dark); }
.stat-details p  { font-size:12px; color:var(--gray); margin:0; }

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

/* ==================== DASHBOARD CHARTS ==================== */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.chart-card { padding: 16px; }

/* ==================== BOTÕES ==================== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:hover  { filter: brightness(0.93); }

.btn-primary   { background:var(--primary);   color:var(--white); }
.btn-secondary { background:var(--secondary); color:var(--white); }
.btn-success   { background:var(--success);   color:var(--white); }
.btn-danger    { background:var(--danger);     color:var(--white); }
.btn-warning   { background:var(--warning);    color:var(--white); }
.btn-info      { background:var(--info);       color:var(--white); }

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover { background:var(--primary); color:var(--white); }

.btn-block  { width:100%; }
.btn-lg     { padding:13px 24px; font-size:16px; }
.btn-sm     { padding:6px 12px;  font-size:13px; }
.btn-xs     { padding:4px 8px;   font-size:12px; }

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 16px;
    flex: 1;
    min-width: 0;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--dark);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.2s;
    background: var(--white);
    -webkit-appearance: none;
    appearance: none;
}
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23757575' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45,106,45,0.12);
}
input[readonly] { background:#f5f5f5 !important; cursor:default; }

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
    flex-wrap: wrap;
}
.form-row > .form-group { min-width: 140px; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ==================== FILTERS ==================== */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filters input,
.filters select {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    flex: 1;
    min-width: 140px;
    background: var(--white);
    -webkit-appearance: none;
}
.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== TABLES ==================== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    min-width: 480px;
}
.table thead { background:var(--primary); color:var(--white); }
.table th, .table td {
    padding: 11px 13px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.table th { font-weight:600; font-size:13px; white-space:nowrap; }
.table tbody tr:hover    { background:var(--gray-lighter); }
.table tbody tr:nth-child(even) { background:#FAFAFA; }
.table tfoot { background:var(--gray-lighter); font-weight:700; }

/* ==================== GRIDS DE CARDS ==================== */
.clientes-grid,
.gestores-grid,
.portfolio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.localizacoes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

/* Cards base */
.cliente-card,
.gestor-card,
.produto-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.25s;
}
.cliente-card:hover,
.gestor-card:hover,
.produto-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.cliente-card-header,
.gestor-card-header,
.produto-card-header {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.cliente-avatar,
.gestor-avatar,
.produto-avatar {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: 24px;
    flex-shrink: 0;
}
.produto-avatar { border-radius: var(--radius); }

.cliente-info h4,
.gestor-info h4,
.produto-info h4 {
    margin: 0 0 4px;
    color: var(--dark);
    font-size: 16px;
    line-height: 1.3;
}
.cliente-info p,
.gestor-info p,
.produto-info p {
    margin: 2px 0;
    color: var(--gray);
    font-size: 13px;
}

.cliente-card-body,
.gestor-card-body,
.produto-card-body { margin-bottom: 12px; font-size:14px; }

.cliente-card-footer,
.gestor-card-footer,
.produto-card-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success   { background:#E8F5E9; color:#2E7D32; }
.badge-warning   { background:#FFF3E0; color:#F57C00; }
.badge-danger    { background:#FFEBEE; color:#C62828; }
.badge-info      { background:#E3F2FD; color:#1565C0; }
.badge-secondary { background:var(--gray-lighter); color:var(--gray); }

/* Status Tags (NF) */
.tag { padding:5px 11px; border-radius:var(--radius); font-size:12px; font-weight:600; display:inline-block; }
.tag-meta        { background:#FFF9C4; color:#F57F17; }
.tag-realizado   { background:#C8E6C9; color:#2E7D32; }
.tag-recebido    { background:#BBDEFB; color:#1565C0; }
.tag-inadimplente{ background:#FFCDD2; color:#C62828; }

/* ==================== LOCALIZAÇÕES ==================== */
.localizacao-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.localizacao-card h4 { color:var(--primary); margin-bottom:8px; }
.localizacao-card p  { margin:4px 0; color:var(--gray); font-size:13px; }
.localizacao-card .btn { margin-top:8px; }

/* ==================== PRÉ-PEDIDO — TABELA DE PRODUTOS ==================== */
.produtos-pedido {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.produtos-pedido table { min-width: 700px; }
.produtos-pedido .form-control {
    padding: 7px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--white);
    width: 100%;
}
.produtos-pedido .form-control:focus { outline:none; border-color:var(--primary); }

/* ==================== ASSINATURA DIGITAL ==================== */
.assinatura-container {
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 12px;
    background: #fafafa;
    text-align: center;
    position: relative;
}
.assinatura-container::before {
    content: '✍️ Assine aqui';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    color: #bdbdbd;
    font-size: 14px;
    pointer-events: none;
    z-index: 0;
}

#canvasAssinatura {
    display: block;
    width: 100% !important;
    height: 180px !important;
    border: 1.5px solid #c8e6c9;
    border-radius: var(--radius);
    cursor: crosshair;
    background: var(--white);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.assinatura-actions { margin-top: 10px; }

/* ==================== VOICE RECOGNITION ==================== */
.voice-recognition { text-align:center; padding:16px; }
.status-gravacao {
    margin: 16px 0;
    padding: 12px;
    background: var(--gray-lighter);
    border-radius: var(--radius);
    font-weight: 500;
    min-height: 46px;
}
.status-gravacao.recording { background:#FFEBEE; color:var(--danger); animation:pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* ==================== METAS ==================== */
.metas-container { display:grid; gap:16px; }
.meta-card { background:var(--white); border-radius:var(--radius-lg); padding:20px; box-shadow:var(--shadow); }
.meta-card h4 { margin-bottom:16px; color:var(--primary); }
.meta-item { margin-bottom:16px; }
.meta-item-header { display:flex; justify-content:space-between; margin-bottom:6px; font-weight:500; font-size:14px; }
.progress-bar { height:22px; background:var(--border); border-radius:20px; overflow:hidden; }
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.5s ease;
    display: flex; align-items: center; justify-content: center;
    color: var(--white); font-weight:500; font-size:12px;
}

/* ==================== FOTOS GALLERY ==================== */
.fotos-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.foto-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
}
.foto-card:hover { border-color:var(--primary); box-shadow:var(--shadow); }
.foto-card-img {
    width: 100%;
    height: 140px;
    background: var(--gray-lighter);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; color: var(--gray-light);
}
.foto-card-body { padding:10px; }
.foto-card-body h5 { margin:0 0 4px; font-size:13px; color:var(--dark); }
.foto-card-body p  { margin:2px 0; font-size:11px; color:var(--gray); }

/* ==================== ATIVIDADES / RELATÓRIOS LIST ==================== */
.atividades-list,
.relatorios-list,
.arquivos-list {
    max-height: 380px;
    overflow-y: auto;
}
.atividade-item,
.relatorio-item,
.arquivo-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.atividade-item:last-child,
.relatorio-item:last-child,
.arquivo-item:last-child { border-bottom: none; }
.atividade-item:hover,
.relatorio-item:hover,
.arquivo-item:hover { background:var(--gray-lighter); }
.atividade-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

/* ==================== ALERT CARD ==================== */
.alert-card { background:#FFF3E0; border-left:4px solid var(--warning); }
.alert-card h3 { color:var(--warning); }

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: none;
}
.modal-overlay.active { display: block; }
.modal-overlay:not(.active) { pointer-events: none !important; }

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    overflow-y: auto;
}
.modal.active { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
    margin: auto;
}
.modal-lg .modal-content { max-width: 860px; }
.modal-sm .modal-content { max-width: 400px; }

@keyframes modalIn {
    from { opacity:0; transform:translateY(-30px) scale(0.97); }
    to   { opacity:1; transform:translateY(0)   scale(1); }
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { margin:0; color:var(--primary); font-size:18px; }

.modal-close {
    background: none; border: none;
    font-size: 22px; color: var(--gray);
    cursor: pointer; padding: 0;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}
.modal-close:hover { background:var(--gray-lighter); color:var(--dark); }

.modal-body { padding: 20px; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Lightbox */
.modal-lightbox { background:rgba(0,0,0,0.92); }
.modal-lightbox-content { max-width:90%; background:transparent; box-shadow:none; }
.modal-lightbox-content .modal-close {
    position:absolute; top:16px; right:16px;
    color:var(--white); font-size:32px;
    background:rgba(0,0,0,0.5);
    width:46px; height:46px;
}
#lightboxImg { max-width:100%; max-height:85vh; border-radius:var(--radius); }

/* Modal overlay z-index correction */
.modal-overlay.active { z-index: 9998 !important; }
.modal.active         { z-index: 9999 !important; }

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 72px; right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}
.toast {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 360px;
    animation: toastIn 0.3s ease;
    word-break: break-word;
}
@keyframes toastIn {
    from { opacity:0; transform:translateX(60px); }
    to   { opacity:1; transform:translateX(0); }
}
.toast-success { border-left:4px solid var(--success); }
.toast-error   { border-left:4px solid var(--danger); }
.toast-warning { border-left:4px solid var(--warning); }
.toast-info    { border-left:4px solid var(--info); }
.toast-icon { font-size:20px; }
.toast-success .toast-icon { color:var(--success); }
.toast-error   .toast-icon { color:var(--danger); }
.toast-warning .toast-icon { color:var(--warning); }
.toast-info    .toast-icon { color:var(--info); }
.toast-message { flex:1; font-weight:500; font-size:14px; }

/* ==================== CURVA ABC ==================== */
.abc-controls { margin-bottom:20px; }
.tabela-abc { margin-top:20px; }
.tabela-abc table { width:100%; }
.classe-a { background:#E8F5E9 !important; color:#2E7D32; font-weight:700; }
.classe-b { background:#FFF9C4 !important; color:#F57F17; font-weight:700; }
.classe-c { background:#FFEBEE !important; color:#C62828; font-weight:700; }

/* ==================== UPLOAD ==================== */
.upload-section {
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 16px;
}
.upload-section input[type="file"] { margin-bottom:12px; }

/* ==================== INSTALL BANNER ==================== */
#installBanner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--primary);
    color: var(--white);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 8000;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}

/* ==================== UPDATE BANNER ==================== */
#updateBanner {
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    background: var(--info);
    color: var(--white);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 8500;
    font-size: 14px;
}

/* ==================== MISC ==================== */
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    background: var(--white);
    -webkit-appearance: none;
}
.form-control:focus { outline:none; border-color:var(--primary); }

.select-embalagem { min-width:120px; font-size:13px; }

.gestor-card-footer {
    padding: 10px 16px;
    border-top: 1px solid #e8f5e9;
    display: flex; gap:8px; flex-wrap:wrap;
}

.btn-warning { background:var(--warning); color:var(--white); border:none; }
.btn-warning:hover { background:#F57C00; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:var(--gray-lighter); }
::-webkit-scrollbar-thumb { background:var(--gray-light); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--gray); }

/* ==================== PRINT ==================== */
@media print {
    .sidebar, .app-header, .filters, .btn,
    .modal-overlay, .modal, .toast-container,
    #installBanner, #updateBanner, .mobile-nav-bottom { display:none !important; }
    .main-content { margin-left:0; width:100%; }
    .content-wrapper { padding:0; }
    .card { box-shadow:none; border:1px solid var(--border); page-break-inside:avoid; }
}

/* ================================================================
   RESPONSIVE — TABLET  ≥ 600px
   ================================================================ */
@media (min-width: 600px) {
    .dashboard-cards  { grid-template-columns: repeat(2, 1fr); }
    .stats-grid       { grid-template-columns: repeat(2, 1fr); }
    .clientes-grid,
    .gestores-grid,
    .portfolio-grid   { grid-template-columns: repeat(2, 1fr); }
    .fotos-gallery    { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .localizacoes-grid{ grid-template-columns: repeat(2, 1fr); }
    .form-row > .form-group { min-width: 180px; }
}

/* ================================================================
   RESPONSIVE — DESKTOP  ≥ 1024px
   ================================================================ */
@media (min-width: 1024px) {
    :root { --header-h: 66px; }

    /* Sidebar sempre visível */
    .sidebar { transform: translateX(0) !important; }
    .sidebar-toggle { display: none !important; }
    .mobile-nav-bottom { display: none !important; }
    .sidebar-logo span, .nav-item span { display: inline !important; }

    .main-content { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); padding-bottom: 0; }
    .content-wrapper { padding: 28px 32px; }
    .app-header { padding: 0 32px; height: var(--header-h); }
    .header-left h2 { font-size: 22px; }
    .user-details { display: flex; }

    .dashboard-cards   { grid-template-columns: repeat(4, 1fr); gap:20px; }
    .stats-grid        { grid-template-columns: repeat(4, 1fr); }
    .dashboard-charts  { grid-template-columns: repeat(2, 1fr); }
    .clientes-grid,
    .gestores-grid,
    .portfolio-grid    { grid-template-columns: repeat(3, 1fr); gap:20px; }
    .fotos-gallery     { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap:20px; }
    .localizacoes-grid { grid-template-columns: repeat(3, 1fr); }
    .form-row          { flex-wrap: nowrap; }
}

/* ================================================================
   MOBILE  < 600px  — Ajustes específicos
   ================================================================ */
@media (max-width: 599px) {

    /* Sidebar: oculto por padrão, desliza da esquerda */
    .sidebar {
        transform: translateX(-100%);
        width: 80vw;
        max-width: 280px;
        z-index: 2000;
    }
    .sidebar.active { transform: translateX(0); }

    /* Overlay escuro ao abrir sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
    }
    .sidebar-overlay.active { display: block; }

    /* Mostrar texto da sidebar quando aberta */
    .sidebar-logo span,
    .nav-item span { display: inline !important; }

    /* Toggle visível */
    .sidebar-toggle { display: flex !important; }

    /* Main ocupa 100% */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px));
    }

    /* Header menor */
    .app-header { padding: 0 14px; height: 56px; }
    .header-left h2 { font-size: 16px; }
    .user-details { display: none; }
    .user-avatar  { width:34px; height:34px; font-size:17px; }

    /* Conteúdo */
    .content-wrapper { padding: 14px; }
    .card { padding: 14px; }
    .section-header h3 { font-size: 17px; }

    /* Stat cards em coluna única quando muito pequeno */
    .dashboard-cards { grid-template-columns: repeat(2,1fr); gap:10px; }
    .stat-card { padding:12px; gap:10px; }
    .stat-icon { width:42px; height:42px; font-size:18px; }
    .stat-details h3 { font-size:18px; }
    .stat-details p  { font-size:11px; }

    /* Botões menores */
    .btn    { padding:9px 14px; font-size:13px; }
    .btn-sm { padding:6px 10px; font-size:12px; }
    .btn-lg { padding:12px 20px; font-size:15px; }

    /* Tabela: scroll horizontal */
    .table th, .table td { padding:9px 10px; font-size:13px; }

    /* Section header em coluna */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .section-header > div { width: 100%; }
    .section-header .btn  { flex: 1; justify-content:center; }

    /* Filters em coluna */
    .filters { flex-direction: column; }
    .filters input,
    .filters select { min-width: 100%; }

    /* Form row em coluna */
    .form-row { flex-direction: column; gap:0; }

    /* Modal full-bottom-sheet em mobile */
    .modal { align-items: flex-end; padding: 0; }
    .modal-content {
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 94vh;
        max-height: 94dvh;
        animation: sheetIn 0.3s ease;
    }
    @keyframes sheetIn {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .modal-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

    /* Toast full width */
    .toast-container { top: auto; bottom: calc(var(--nav-bottom-h) + 12px); right:12px; left:12px; }
    .toast { min-width: auto; max-width: 100%; width: 100%; }

    /* Modals lg viram bottom-sheet também */
    .modal-lg .modal-content { max-width: 100%; }

    /* Grids coluna única */
    .clientes-grid,
    .gestores-grid,
    .portfolio-grid,
    .localizacoes-grid { grid-template-columns: 1fr; }

    /* Fotos grid 2 colunas */
    .fotos-gallery { grid-template-columns: repeat(2, 1fr); gap:10px; }
    .foto-card-img { height:110px; font-size:32px; }

    /* Canvas assinatura */
    #canvasAssinatura { height: 150px !important; }
}

/* ================================================================
   BARRA DE NAVEGAÇÃO INFERIOR — MOBILE ONLY
   Aparece apenas quando sidebar está fechado (< 1024px)
   ================================================================ */
.mobile-nav-bottom {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-bottom-h);
    background: var(--primary);
    z-index: 1100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 1023px) {
    .mobile-nav-bottom { display: flex; }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px));
    }
    /* Sidebar sempre visível em tablet com toggle */
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .sidebar-toggle { display: flex !important; }
    .sidebar-logo span, .nav-item span { display: inline !important; }
    .user-details { display: none; }
}

.mobile-nav-bottom .nav-bottom-items {
    display: flex;
    width: 100%;
    height: 100%;
}

.nav-bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    font-size: 10px;
    gap: 3px;
    cursor: pointer;
    padding: 6px 4px 4px;
    border: none;
    background: none;
    transition: all 0.2s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.nav-bottom-item i { font-size: 20px; }
.nav-bottom-item span { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58px; }
.nav-bottom-item.active { color: var(--white); }
.nav-bottom-item.active i { transform: scale(1.15); }
.nav-bottom-item:hover { background: rgba(255,255,255,0.1); }

/* Botão "+" central para mais abas */
.nav-bottom-more {
    background: rgba(255,255,255,0.15) !important;
    border-radius: 12px;
    margin: 8px 4px;
}

/* sidebarOverlay — definição consolidada abaixo em v10 */

/* ================================================================
   UTILITÁRIOS
   ================================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-10 { margin-top:10px; }
.mt-20 { margin-top:20px; }
.mb-10 { margin-bottom:10px; }
.mb-20 { margin-bottom:20px; }
.hidden { display:none !important; }
.w-100  { width:100%; }

/* ================================================================
   VENDAS NUTRIMAX v10 — MELHORIAS MOBILE ADICIONAIS
   ================================================================ */

/* ---- Garantir que todas as tabelas tenham scroll horizontal ---- */
.table-responsive,
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* ---- Tabela de produtos pre-pedido ---- */
.produtos-pedido {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
}
.produtos-pedido table { min-width: 680px; }

/* ---- Inputs dentro de tabela: tamanho mínimo ---- */
.produtos-pedido select.form-control,
.produtos-pedido input.form-control {
    min-width: 80px;
}
.produtos-pedido select[id*="produto"] { min-width: 140px; }
.produtos-pedido select[id*="embalagem"] { min-width: 120px; }

/* ---- Touch targets maiores em mobile ---- */
@media (max-width: 768px) {
    .btn { min-height: 44px; }
    input, select, textarea { min-height: 44px; }
    .nav-item { min-height: 48px; padding: 14px 18px; }
    
    /* Form row sempre em coluna no mobile */
    .form-row { flex-direction: column !important; }
    
    /* Cards no pre-pedido */
    .section-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .section-header > div { display: flex; flex-wrap: wrap; gap: 8px; }
    .section-header .btn { flex: 1; min-width: 120px; }
    
    /* Filtros em coluna */
    .filters { flex-direction: column; }
    .filters > * { width: 100%; }
    
    /* Tabelas com tamanho menor de fonte */
    .table th, .table td { font-size: 12px; padding: 8px 6px; }
    
    /* Modal full height em mobile */
    .modal-content { max-height: 95vh; max-height: 95dvh; overflow-y: auto; }
    .modal-body { overflow-y: auto; }
    
    /* Toast para baixo da tela */
    .toast-container { 
        bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px) + 10px);
        top: auto;
        left: 10px;
        right: 10px;
    }
    .toast { width: 100%; max-width: 100%; }
    
    /* Badges wrap */
    .badge { white-space: normal; }
    
    /* Tabela de pedidos */
    #pedidosTable th, #pedidosTable td { font-size: 12px; }
    
    /* Portfólio e clientes em coluna única */
    .portfolio-grid,
    .clientes-grid { grid-template-columns: 1fr; }
    
    /* Produto card no portfólio menor */
    .produto-card { padding: 12px; }
    
    /* Assinatura menor em mobile */
    #canvasAssinatura { height: 140px !important; }
    
    /* Preços tabela mais compacta */
    #precosTable .table th,
    #precosTable .table td { padding: 6px 4px; font-size: 11px; }
}

/* ---- iPhone X safe area ---- */
@supports (padding: max(0px)) {
    .mobile-nav-bottom {
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
        height: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px));
    }
    .main-content {
        padding-bottom: calc(var(--nav-bottom-h) + max(env(safe-area-inset-bottom, 0px), 0px));
    }
}

/* ---- Melhoria visual dos cards de dashboard em mobile ---- */
@media (max-width: 480px) {
    .dashboard-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 10px; gap: 8px; flex-direction: column; align-items: center; text-align: center; }
    .stat-icon { width: 38px; height: 38px; font-size: 16px; }
    .stat-details h3 { font-size: 16px; }
    .stat-details p { font-size: 10px; }
}

/* ---- Spinner de carregamento para mobile ---- */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Scroll suave global ---- */
* { scroll-behavior: smooth; }
html { -webkit-text-size-adjust: 100%; }

/* ---- Sidebar overlay melhorado ---- */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(2px);
}
#sidebarOverlay.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* sidebar transition — já definida no bloco principal */

/* ---- Bottom nav active indicator ---- */
.nav-bottom-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: rgba(255,255,255,0.9);
    border-radius: 3px 3px 0 0;
}
.nav-bottom-item { position: relative; }

/* ---- Botões de ação em tabelas para mobile ---- */
@media (max-width: 768px) {
    .btn-actions-group {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .btn-actions-group .btn { 
        width: 100%;
        justify-content: center;
    }
}

/* ---- Formulários mais espaçosos em mobile ---- */
@media (max-width: 600px) {
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
    .form-group input,
    .form-group select,
    .form-group textarea { font-size: 16px; } /* previne zoom automático no iOS */
    
    /* Botão de submit maior */
    .btn-block { 
        padding: 14px;
        font-size: 16px;
        border-radius: var(--radius-lg);
    }
}

/* ---- Evitar zoom em inputs iOS ---- */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select, textarea, input[type="text"],
    input[type="number"], input[type="email"],
    input[type="date"], input[type="tel"],
    input[type="search"] {
        font-size: 16px !important;
    }
}

/* ---- Print ---- */
@media print {
    .mobile-nav-bottom { display: none !important; }
    #sidebarOverlay { display: none !important; }
}

/* ---- Botão de menu hamburguer no header (mobile) ---- */
.header-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--dark);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    margin-right: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.header-menu-btn:hover { background: rgba(0,0,0,0.08); }

@media (max-width: 1023px) {
    .header-menu-btn { display: flex !important; }
}
