/* ============================================================
   WebIOS — Folha de Estilos Principal
   Paleta: Azul (#2563eb) · Escuro (#0f172a) · Teal (#0f766e)
   ============================================================ */

/* ----------------------------------------------------------
   1. RESET & BASE
   ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Inter", "Poppins", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.09), transparent 28%),
        radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.07), transparent 24%),
        #f0f4fb;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.5;
}

/* ----------------------------------------------------------
   2. TOPBAR
   ---------------------------------------------------------- */
.topbar {
    height: 68px;
    min-height: 68px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(209, 213, 219, 0.7);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.topbar h2 { margin: 0; font-size: 22px; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: #4b5563;
}

.perfil-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: #e0ecff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.03em;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-block strong {
    display: block;
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}

.brand-block span {
    color: #64748b;
    font-size: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d4ed8, #0f766e);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-mark:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 28px rgba(29, 78, 216, 0.32);
}

/* ----------------------------------------------------------
   3. LAYOUT (sidebar + content)
   ---------------------------------------------------------- */
.layout {
    display: flex;
    min-height: calc(100vh - 68px);
}

/* ----------------------------------------------------------
   4. SIDEBAR
   ---------------------------------------------------------- */
.sidebar {
    width: 256px;
    min-width: 256px;
    background: rgba(255, 255, 255, 0.94);
    border-right: 1px solid rgba(226, 232, 240, 0.9);
    padding: 18px 12px 28px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-section-title {
    padding: 0 12px 4px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #94a3b8;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-radius: 12px;
    color: #334155;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
    position: relative;
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
    color: #64748b;
    transition: color 0.16s ease;
    flex-shrink: 0;
}

.nav-link span { flex: 1; }

.nav-link .nav-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

.nav-link:hover {
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateX(3px);
}

.nav-link:hover i { color: #2563eb; }

.nav-link.ativo,
.nav-link.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
}

.nav-link.ativo i,
.nav-link.active i { color: #2563eb; }

.nav-link.destaque {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
    font-weight: 700;
}

.nav-link.destaque i { color: #fff; }

.nav-link.destaque:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    transform: translateX(2px);
    color: #fff;
}

.nav-link.nav-sair {
    color: #dc2626;
}

.nav-link.nav-sair i { color: #dc2626; }

.nav-link.nav-sair:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.nav-section-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

/* ----------------------------------------------------------
   5. CONTENT AREA
   ---------------------------------------------------------- */
.content {
    flex: 1;
    padding: 28px 32px 48px;
    min-width: 0;
}

/* ----------------------------------------------------------
   6. CARDS
   ---------------------------------------------------------- */
.card,
.table-card,
.card-resumo,
.form-card,
.venda-form-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.07);
    border: 1px solid rgba(226, 232, 240, 0.7);
}

.card {
    padding: 24px;
}

.table-card {
    padding: 24px;
}

.table-card h2 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #0f172a;
}

/* Cards de resumo (métricas) */
.grid-resumo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.card-resumo {
    padding: 18px 20px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: default;
}

.card-resumo:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

.card-resumo h3 {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-resumo p {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.card-resumo .card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 17px;
    margin-bottom: 10px;
}

.card-resumo .card-icon.azul   { background: #eff6ff; color: #2563eb; }
.card-resumo .card-icon.verde  { background: #f0fdf4; color: #16a34a; }
.card-resumo .card-icon.amarelo{ background: #fffbeb; color: #d97706; }
.card-resumo .card-icon.vermelho{ background: #fef2f2; color: #dc2626; }
.card-resumo .card-icon.roxo   { background: #faf5ff; color: #7c3aed; }
.card-resumo .card-icon.teal   { background: #f0fdfa; color: #0d9488; }

/* ----------------------------------------------------------
   7. PAGE HEADER
   ---------------------------------------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

/* ----------------------------------------------------------
   8. HERO PANEL
   ---------------------------------------------------------- */
.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 24px 28px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    pointer-events: none;
}

.hero-panel h2 {
    margin: 10px 0 6px;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
}

.hero-panel-compact { padding: 20px 24px; }
.hero-panel-compact h2 { font-size: 24px; }

.hero-panel p {
    margin: 0;
    max-width: 680px;
    color: rgba(255, 255, 255, 0.80);
    font-size: 14px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.13);
    border: 1px solid rgba(255,255,255,0.18);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.hero-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.13);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    transition: background 0.16s ease, transform 0.16s ease;
}

.hero-action:hover {
    background: rgba(255,255,255,0.20);
    transform: translateY(-1px);
}

/* ----------------------------------------------------------
   9. BOTÕES
   ---------------------------------------------------------- */
button,
.btn-link,
.btn-secundario,
.btn-perigo,
.btn-aviso {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    min-width: 80px;
    padding: 0 14px;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.btn-link:hover,
.btn-secundario:hover,
.btn-perigo:hover,
.btn-aviso:hover {
    opacity: 0.90;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

button:active,
.btn-link:active,
.btn-secundario:active {
    transform: translateY(0);
    box-shadow: none;
}

button {
    background: #2563eb;
    color: #fff;
}

form button[type="submit"] {
    margin-top: 18px;
}

/* Links-botão ao lado de um submit (Voltar/Cancelar) recebem o mesmo
   espaçamento — sem isso ficavam desalinhados em todas as telas. */
form button[type="submit"] + a,
form button[type="submit"] + button,
form a.btn-secundario,
form a.btn-link,
form a.btn-perigo {
    margin-top: 18px;
}

button,
.btn-link,
.btn-secundario,
.btn-perigo,
.btn-aviso {
    vertical-align: middle;
}

.btn-link {
    background: #ef4444;
    color: #fff;
}

.btn-secundario {
    background: #2563eb;
    color: #fff;
}

.btn-perigo {
    background: #dc2626;
    color: #fff;
}

.btn-aviso {
    background: #d97706;
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid #2563eb;
    color: #2563eb;
}

.btn-outline:hover {
    background: #eff6ff;
}

/* Botão de tabela (compacto) */
.btn-tabela {
    min-width: auto;
    width: auto;
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    border-radius: 8px;
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 50;
    text-decoration: none;
}

.fab:hover {
    transform: scale(1.10) translateY(-2px);
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.46);
    opacity: 1;
    color: #fff;
}

.fab-tooltip {
    position: fixed;
    bottom: 30px;
    right: 96px;
    background: #0f172a;
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 49;
}

.fab:hover ~ .fab-tooltip,
.fab-tooltip.visivel {
    opacity: 1;
}

/* ----------------------------------------------------------
   10. FORMULÁRIOS
   ---------------------------------------------------------- */
form {
    display: flex;
    flex-direction: column;
}

.form-card {
    max-width: 540px;
    width: 100%;
    padding: 28px;
}

.form-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 240px);
    padding-top: 20px;
}

label {
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    display: block;
}

input,
select,
textarea {
    padding: 10px 13px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: #1f2937;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

/* Checkboxes e radios não devem esticar (o width:100% acima quebrava o
   alinhamento de toda linha "checkbox + label"). */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    flex: 0 0 auto;
}

/* Linha de botões lado a lado dentro de formulários (alinhados entre si) */
.linha-botoes {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
}

.linha-botoes button {
    margin-top: 0 !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ----------------------------------------------------------
   11. TABELAS
   ---------------------------------------------------------- */
.tabela-produtos {
    width: 100%;
    border-collapse: collapse;
}

.tabela-produtos th {
    text-align: left;
    padding: 11px 13px;
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid #f1f5f9;
    background: #f8fafc;
}

.tabela-produtos th:first-child { border-radius: 8px 0 0 8px; }
.tabela-produtos th:last-child  { border-radius: 0 8px 8px 0; }

.tabela-produtos td {
    text-align: left;
    padding: 13px 13px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.tabela-produtos tbody tr {
    transition: background 0.12s ease;
}

.tabela-produtos tbody tr:hover td {
    background: #f8faff;
}

.tabela-produtos tbody tr:last-child td {
    border-bottom: none;
}

.sem-registro {
    text-align: center !important;
    color: #94a3b8;
    padding: 32px !important;
    font-size: 14px;
}

.coluna-acoes {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.coluna-acoes form {
    margin: 0;
    display: inline-block;
}

/* ----------------------------------------------------------
   12. BADGES / STATUS
   ---------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-ok      { background: #dcfce7; color: #166534; }
.badge-alerta  { background: #fef3c7; color: #92400e; }
.badge-erro    { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-roxo    { background: #f3e8ff; color: #6b21a8; }
.badge-neutro  { background: #f1f5f9; color: #475569; }

/* ----------------------------------------------------------
   13. ALERTAS / FLASH MESSAGES
   ---------------------------------------------------------- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 14px;
    animation: slideDown 0.22s ease;
}

.alert.sucesso {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.erro {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   14. PAGINAÇÃO
   ---------------------------------------------------------- */
.paginacao {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.paginacao-info {
    font-size: 13px;
    color: #64748b;
}

.paginacao-acoes {
    display: flex;
    gap: 8px;
}

.paginacao-link {
    min-width: auto;
}

/* ----------------------------------------------------------
   15. FILTROS
   ---------------------------------------------------------- */
.grid-filtros {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.grid-filtros input,
.grid-filtros select {
    width: 100%;
}

.filtro-acoes {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filtro-acoes button,
.filtro-acoes .btn-secundario {
    margin-top: 0 !important;
}

.filtro-dashboard {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.filtro-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    text-decoration: none;
    border: 1.5px solid #d1d5db;
    font-size: 13px;
    font-weight: 600;
    transition: 0.15s ease;
}

.filtro-pill:hover { background: #f9fafb; border-color: #9ca3af; }

.filtro-pill.ativo {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* ----------------------------------------------------------
   16. ATALHOS / CARDS DE AÇÃO
   ---------------------------------------------------------- */
.atalhos-dashboard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.atalho-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #fff;
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    text-decoration: none;
    color: #1f2937;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
}

.atalho-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    border-color: #bfdbfe;
}

.atalho-card .atalho-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.atalho-card h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.atalho-card p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.atalho-kbd {
    position: absolute;
    top: 10px;
    right: 12px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    font-family: monospace;
    letter-spacing: 0.05em;
}

/* card-link legado */
.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    position: relative;
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.09);
    border-color: #bfdbfe;
}

/* ----------------------------------------------------------
   17. AÇÕES INLINE (links de tabela)
   ---------------------------------------------------------- */
.acao-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    margin-right: 5px;
    margin-bottom: 4px;
    transition: background 0.15s ease;
}

.acao-link:hover { background: #dbeafe; }

.acao-link-perigo {
    background: #fef2f2;
    color: #b91c1c;
}

.acao-link-perigo:hover { background: #fee2e2; }

.acao-link-aviso {
    background: #fffbeb;
    color: #92400e;
}

.acao-link-aviso:hover { background: #fef3c7; }

.acao-link-verde {
    background: #f0fdf4;
    color: #166534;
}

.acao-link-verde:hover { background: #dcfce7; }

/* ----------------------------------------------------------
   18. PILLS / TEXTOS DE APOIO
   ---------------------------------------------------------- */
.pill-info {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 700;
}

.texto-suave { color: #94a3b8; font-size: 13px; }
.texto-erro  { color: #b91c1c; font-weight: 700; }

/* ----------------------------------------------------------
   19. LINHAS DE TABELA COM STATUS
   ---------------------------------------------------------- */
.linha-inativa td { background: #f8fafc; opacity: 0.76; }
.linha-alerta td  { background: #fffbeb; }
.linha-vencida td { background: #fff7ed; }
.linha-ok td      { background: #f0fdf4; }

/* ----------------------------------------------------------
   20. FORMULÁRIO DE VENDA
   ---------------------------------------------------------- */
.venda-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 22px;
    align-items: start;
}

.venda-form-card { max-width: none; }

.venda-topo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.venda-item-grid {
    display: grid;
    grid-template-columns: 2fr 0.7fr 1fr 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: end;
}

/* Célula do produto: busca incremental em cima, select embaixo */
.produto-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.busca-produto {
    padding: 6px 9px !important;
    font-size: 12.5px !important;
    border-radius: 8px !important;
}

.venda-resumo-card {
    position: sticky;
    top: 24px;
    padding: 22px;
}

.venda-resumo-lista { display: grid; gap: 10px; }

.venda-resumo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    gap: 12px;
    transition: border-color 0.15s;
}

.venda-resumo-item span  { color: #64748b; font-size: 14px; }
.venda-resumo-item strong{ font-size: 15px; color: #0f172a; font-weight: 800; }

.venda-resumo-item.destaque {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.venda-resumo-item.destaque strong { color: #1d4ed8; font-size: 18px; }

/* ----------------------------------------------------------
   21. GRÁFICOS (Chart.js)
   ---------------------------------------------------------- */
.grid-graficos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.grid-graficos .table-card { height: 360px; }

.grafico-box {
    position: relative;
    height: 260px;
}

.grid-graficos canvas {
    width: 100% !important;
    height: 260px !important;
    max-height: 260px;
}

/* ----------------------------------------------------------
   22. SUBMENU RELATÓRIOS
   ---------------------------------------------------------- */
.submenu-relatorios { margin-top: 4px; }

.submenu-relatorios summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 13px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 11px;
    transition: background 0.15s ease;
}

.submenu-relatorios summary:hover { background: #eff6ff; color: #1d4ed8; }
.submenu-relatorios summary::-webkit-details-marker { display: none; }

.submenu-relatorios[open] summary { color: #1d4ed8; }

.submenu-relatorios summary i {
    width: 18px;
    text-align: center;
    font-size: 15px;
    color: #64748b;
}

.submenu-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    padding-left: 14px;
}

.submenu-links a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 13px;
    border-radius: 10px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.13s ease, color 0.13s ease;
}

.submenu-links a i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

.submenu-links a:hover { background: #eff6ff; color: #1d4ed8; }
.submenu-links a:hover i { color: #2563eb; }

/* ----------------------------------------------------------
   23. AUTENTICAÇÃO (login/register)
   ---------------------------------------------------------- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 420px);
    gap: 24px;
    align-items: stretch;
}

.auth-showcase,
.auth-card { border-radius: 22px; }

.auth-showcase {
    padding: 36px;
    background: linear-gradient(140deg, #0f172a, #1e3a8a 60%, #0f766e);
    color: #fff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.auth-showcase h1 {
    font-size: 40px;
    font-weight: 900;
    line-height: 1.08;
    margin: 14px 0;
}

.auth-showcase p { color: rgba(255,255,255,0.80); max-width: 600px; font-size: 15px; }

.auth-features {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.auth-features div {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 13px;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.14);
    font-size: 14px;
    font-weight: 600;
}

.auth-card { padding: 30px; }

/* ----------------------------------------------------------
   24. TOOLTIP (via data-tooltip)
   ---------------------------------------------------------- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.16s ease;
    z-index: 200;
}

[data-tooltip]:hover::after { opacity: 1; }

/* Na topbar o tooltip abriria para cima e seria cortado pelo topo da janela:
   nesses casos ele desce. Vale tambem para quem marcar data-tooltip-pos="baixo". */
.topbar [data-tooltip]::after,
[data-tooltip][data-tooltip-pos="baixo"]::after {
    bottom: auto;
    top: calc(100% + 7px);
}

/* ----------------------------------------------------------
   25. MODAL DE ATALHOS DE TECLADO
   ---------------------------------------------------------- */
.atalhos-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 900;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.18s ease;
}

.atalhos-modal-overlay.aberto { display: flex; }

.atalhos-modal {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    width: 460px;
    max-width: 94vw;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.atalhos-modal h3 {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.atalhos-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    align-items: center;
}

.atalhos-grid .kbd {
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    font-family: monospace;
    font-weight: 700;
    color: #334155;
    text-align: center;
    white-space: nowrap;
}

.atalhos-grid .desc {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ----------------------------------------------------------
   26. MÓDULO MULTI-LOJA — Seletor de Loja & Macro Dashboard
   ---------------------------------------------------------- */

/* ── Seletor de loja na topbar ────────────────────────── */
.loja-seletor {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.loja-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--loja-cor, #2563eb) 12%, white);
    color: var(--loja-cor, #2563eb);
    font-size: 12px;
    font-weight: 700;
    border: 1.5px solid color-mix(in srgb, var(--loja-cor, #2563eb) 28%, white);
    white-space: nowrap;
    letter-spacing: 0.02em;
    transition: background 0.15s;
}

.loja-dropdown-wrap {
    position: relative;
}

.loja-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11px;
    transition: background 0.13s, color 0.13s;
    height: 30px;
    display: inline-flex;
    align-items: center;
}

.loja-dropdown-btn:hover {
    background: #f3f4f6;
    color: #374151;
    transform: none;
    box-shadow: none;
    opacity: 1;
}

.loja-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.14);
    min-width: 210px;
    z-index: 300;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    animation: slideDown 0.15s ease;
}

.loja-dropdown-menu.aberto { display: flex; }

.loja-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background 0.12s;
    font-family: inherit;
}

.loja-dropdown-item:hover  { background: #f8fafc; }
.loja-dropdown-item.ativo  { background: #eff6ff; color: #1d4ed8; font-weight: 700; }

.loja-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--loja-cor, #2563eb);
    flex-shrink: 0;
}

/* ── Macro Dashboard ──────────────────────────────────── */
.macro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.macro-card {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    border-top: 4px solid var(--loja-cor, #2563eb);
    padding: 20px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.macro-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

.macro-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.macro-loja-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--loja-cor, #2563eb) 14%, white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--loja-cor, #2563eb);
    font-size: 17px;
    flex-shrink: 0;
}

.macro-card-nome {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    flex: 1;
}

.macro-kpi-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
}

.macro-kpi-row:last-child { border-bottom: none; }

.macro-kpi-valor {
    font-weight: 800;
    color: #0f172a;
    font-size: 14px;
}

.macro-total-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.macro-total-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 14px;
}

.macro-total-card .t-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.macro-total-card strong {
    display: block;
    font-size: 24px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
}

.macro-total-card span {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-top: 3px;
    display: block;
}

/* ── Tabela de transferências ─────────────────────────── */
.badge-transferencia-pendente  { background: #fef3c7; color: #92400e; }
.badge-transferencia-aprovado  { background: #e0f2fe; color: #075985; }
.badge-transferencia-enviado   { background: #ede9fe; color: #5b21b6; }
.badge-transferencia-recebido  { background: #dcfce7; color: #166534; }
.badge-transferencia-cancelado { background: #f1f5f9; color: #475569; }

/* ----------------------------------------------------------
   27. MÓDULO GPS / RASTREAMENTO
   ---------------------------------------------------------- */

/* Mapa principal */
#mapa-rastreamento {
    width: 100%;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.10);
    border: 1px solid #e5e7eb;
}

/* Mini-mapa (detalhe do atendimento) */
#mini-mapa {
    width: 100%;
    height: 280px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin-top: 12px;
}

/* Cards de motoristas ativos */
.grid-motoristas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.card-motorista {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.card-motorista:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.10);
}

.card-motorista.ativo  { border-color: #86efac; }
.card-motorista.inativo{ opacity: 0.6; }

.motorista-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.motorista-dot.ativo   { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.20); }
.motorista-dot.inativo { background: #94a3b8; }

.motorista-info strong { display: block; font-size: 14px; font-weight: 700; color: #0f172a; }
.motorista-info span   { font-size: 12px; color: #64748b; }

/* Interface motoboy (mobile) */
.motoboy-shell {
    min-height: 100vh;
    background: linear-gradient(160deg, #0f172a, #1d4ed8 70%, #0f766e);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #fff;
}

.motoboy-card {
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.motoboy-card h1 {
    font-size: 26px;
    font-weight: 900;
    margin: 0 0 8px;
}

.motoboy-card p {
    color: rgba(255,255,255,0.78);
    margin: 0 0 28px;
    font-size: 15px;
}

.btn-gps-on {
    width: 100%;
    height: 64px;
    border-radius: 18px;
    background: #22c55e;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    gap: 12px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

.btn-gps-on:hover  { transform: scale(1.03); box-shadow: 0 12px 30px rgba(34, 197, 94, 0.44); }
.btn-gps-on.ativo  { background: #ef4444; box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35); }
.btn-gps-on.ativo:hover { box-shadow: 0 12px 30px rgba(239, 68, 68, 0.44); }

.gps-status-txt {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.70);
    margin-top: 14px;
    min-height: 20px;
}

.gps-pulso {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    margin-right: 7px;
    animation: pulso 1.2s ease-in-out infinite;
}

@keyframes pulso {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.5); opacity: 0.6; }
}

/* Popup do mapa Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(15,23,42,0.14) !important;
}

.popup-motoboy strong { display: block; font-size: 15px; margin-bottom: 4px; }
.popup-motoboy span   { font-size: 13px; color: #64748b; }

/* ----------------------------------------------------------
   27. LINKS DE TEXTOS
   ---------------------------------------------------------- */
.links-acoes a { margin-right: 10px; }

.auth-container {
    max-width: 420px;
    margin: 40px auto;
}

/* ----------------------------------------------------------
   28. RESPONSIVO
   ---------------------------------------------------------- */
@media (max-width: 1100px) {
    .atalhos-dashboard        { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .venda-layout             { grid-template-columns: 1fr; }
    .venda-resumo-card        { position: static; }
    .hero-panel,
    .auth-shell               { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .grid-resumo              { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-graficos            { grid-template-columns: 1fr; }
    .grid-graficos .table-card{ height: auto; }
    .grid-graficos canvas     { height: 220px !important; }
    .grid-filtros             { grid-template-columns: 1fr 1fr; }
    .venda-topo-grid,
    .venda-item-grid          { grid-template-columns: 1fr; }
    .sidebar                  { width: 220px; min-width: 220px; }
    .hero-actions             { justify-content: flex-start; }
    .page-header              { flex-direction: column; align-items: flex-start; gap: 10px; }
    #mapa-rastreamento        { height: 380px; }
}

@media (max-width: 700px) {
    .atalhos-dashboard        { grid-template-columns: 1fr; }
    .grid-resumo              { grid-template-columns: 1fr; }
    .grid-filtros             { grid-template-columns: 1fr; }
    .content                  { padding: 18px 16px 40px; }
    .sidebar                  { display: none; }
    .fab                      { bottom: 20px; right: 20px; width: 52px; height: 52px; font-size: 20px; }
}
