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

:root {
    --verde:    #22c55e;
    --amarelo:  #eab308;
    --vermelho: #ef4444;
    --cinza:    #6b7280;
    --bg:       #f1f5f9;
    --card-bg:  #ffffff;
    --text:     #1e293b;
    --border:   #e2e8f0;
    --shadow:   0 1px 4px rgba(0,0,0,.08);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── LOGIN ─────────────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow);
}

.login-box h1 { font-size: 1.4rem; margin-bottom: 24px; text-align: center; }

.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; }
.campo input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
}
.campo input:focus { outline: none; border-color: #94a3b8; }

.btn-primary {
    width: 100%;
    padding: 10px;
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 8px;
}
.btn-primary:hover { background: #334155; }

.erro { color: var(--vermelho); font-size: .85rem; margin-top: 12px; text-align: center; }

/* ── HEADER ─────────────────────────────────────── */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 0;
    height: 58px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 var(--border);
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    margin-right: 36px;
    flex-shrink: 0;
}
.site-logo-img {
    height: 30px;
    max-height: 30px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
    display: block;
}
.site-logo-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
    line-height: 1;
}
.site-logo-text span {
    font-weight: 400;
    color: var(--cinza);
}

/* Nav links */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--cinza);
    text-decoration: none;
    transition: background .14s, color .14s;
    white-space: nowrap;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.nav-ativo {
    background: var(--text);
    color: #fff;
}
.nav-link.nav-ativo:hover { background: #334155; }
.nav-icon { font-size: .85rem; }

/* Lado direito */
.site-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.btn-sair {
    font-size: .82rem;
    color: var(--cinza);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all .14s;
}
.btn-sair:hover { background: var(--bg); color: var(--text); }

.btn-config {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px 9px;
    border-radius: 8px;
    color: var(--cinza);
    transition: all .14s;
}
.btn-config:hover { background: var(--bg); color: var(--text); }

/* ── CONTAINER ──────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── RESUMO BAR ─────────────────────────────────── */
.resumo-bar {
    display: flex;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 0;
}

.resumo-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    box-shadow: var(--shadow);
}

.resumo-num { font-size: 1.5rem; font-weight: 700; }
.resumo-label { font-size: .75rem; color: var(--cinza); margin-top: 2px; }

.resumo-card.critico .resumo-num { color: var(--vermelho); }
.resumo-card.atencao .resumo-num { color: var(--amarelo); }
.resumo-card.ok      .resumo-num { color: var(--verde); }

/* ── TOOLBAR ────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 0;
    flex-wrap: wrap;
}

.toolbar input {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    width: 220px;
}
.toolbar input:focus { outline: none; border-color: #94a3b8; }

.toolbar button {
    padding: 9px 16px;
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
    white-space: nowrap;
}
.toolbar button:hover:not(:disabled) { background: #334155; }
.toolbar button:disabled { opacity: .5; cursor: default; }

.busca-msg {
    width: 100%;
    font-size: .85rem;
    color: var(--cinza);
    min-height: 20px;
    padding: 4px 0 0;
}

/* ── TABS ───────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px 0;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: .9rem;
    color: var(--cinza);
    margin-bottom: -1px;
}
.tab.ativo { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.tab:hover:not(.ativo) { color: var(--text); }

/* ── TABELA ─────────────────────────────────────── */
.table-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 32px;
    overflow-x: auto;
}

#tabelaProdutos {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 12px;
}

#tabelaProdutos thead th {
    padding: 12px 14px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--cinza);
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

#tabelaProdutos tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
#tabelaProdutos tbody tr:last-child { border-bottom: none; }
#tabelaProdutos tbody tr:hover { background: #f8fafc; }

#tabelaProdutos td {
    padding: 10px 14px;
    font-size: .9rem;
    vertical-align: middle;
}

.linha-vermelho { border-left: 3px solid var(--vermelho); background: #fff5f5; }
.linha-amarelo  { border-left: 3px solid var(--amarelo); background: #fefce8; }
.linha-verde    { border-left: 3px solid transparent; }

.linha-vermelho:hover { background: #fee2e2 !important; }
.linha-amarelo:hover  { background: #fef9c3 !important; }

.col-img     { width: 52px; }
.col-sku     { width: 140px; color: var(--cinza); font-size: .82rem; }
.col-estoque { width: 90px; }
.col-inicial { width: 130px; }
.col-vendas  { width: 90px; }
.col-minimo  { width: 130px; }
.col-status  { width: 100px; }
.col-menu    { width: 48px; }

.vendas-num  { color: var(--cinza); font-size: .88rem; }

.thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8fafc;
}

.thumb-placeholder {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: #f1f5f9;
    border-radius: 6px;
}

.num { font-weight: 600; }

.num-estoque {
    display: inline-block;
    font-size: .95rem;
    font-weight: 700;
    color: #0369a1;
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 4px 12px;
    min-width: 52px;
    text-align: center;
    letter-spacing: .02em;
    box-shadow: 0 1px 3px rgba(14,165,233,.1);
}

.estrela-icon { font-size: .85rem; }

.tag-sem-venda {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #6b7280;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── BADGE ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.badge.verde   { background: #dcfce7; color: #15803d; }
.badge.amarelo { background: #fef9c3; color: #a16207; }
.badge.vermelho { background: #fee2e2; color: #b91c1c; }

/* ── MINIMO WRAP ────────────────────────────────── */
.minimo-wrap { display: flex; align-items: center; gap: 4px; }

.input-minimo, .input-inicial {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    text-align: center;
}
.input-minimo:focus, .input-inicial:focus { outline: none; border-color: #94a3b8; }

.btn-salvar-min, .btn-salvar-ini {
    padding: 4px 8px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .78rem;
    cursor: pointer;
}
.btn-salvar-min:hover, .btn-salvar-ini:hover { background: #e2e8f0; }

/* ── MENU 3 PONTOS ──────────────────────────────── */
.menu-wrap { position: relative; }

.btn-menu {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--cinza);
    padding: 4px 8px;
    border-radius: 6px;
}
.btn-menu:hover { background: #f1f5f9; }

.dropdown {
    display: none;
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 100;
    min-width: 170px;
    overflow: hidden;
}

.menu-wrap.aberto .dropdown { display: block; }

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: .88rem;
    cursor: pointer;
    color: var(--text);
}
.dropdown-item:hover { background: #f1f5f9; }
.item-excluir { color: var(--vermelho) !important; }

/* ── MODAL ──────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal {
    background: var(--card-bg);
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-produto-info { display: flex; gap: 14px; align-items: center; }

.modal-img img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
}

.modal-nome { font-weight: 600; font-size: .95rem; }
.modal-sku  { font-size: .8rem; color: var(--cinza); margin-top: 2px; }

.modal-fechar {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--cinza);
    padding: 4px;
}
.modal-fechar:hover { color: var(--text); }

.modal-estoque-atual {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.modal-label { font-size: .85rem; color: var(--cinza); }
.modal-estoque-num { font-size: 1.4rem; font-weight: 700; }
.modal-hint { font-size: .75rem; color: var(--cinza); margin-left: 6px; }

.modal-campos { margin-bottom: 16px; }

.modal-campo { margin-bottom: 12px; }
.modal-campo label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.modal-campo input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
}
.modal-campo input:focus { outline: none; border-color: #94a3b8; }

.modal-estrela-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    cursor: pointer;
    margin-bottom: 20px;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn-cancelar {
    padding: 9px 18px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
}
.btn-cancelar:hover { background: #e2e8f0; }

.btn-confirmar {
    padding: 9px 18px;
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
}
.btn-confirmar:hover { background: #334155; }

/* ── VAZIO ──────────────────────────────────────── */
.vazio {
    text-align: center;
    color: var(--cinza);
    padding: 48px;
    font-size: .95rem;
}

/* ── SPINNER ────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVO ─────────────────────────────────── */
@media (max-width: 600px) {
    .resumo-bar { gap: 8px; padding: 12px 12px 0; }
    .resumo-card { padding: 10px 14px; min-width: 64px; }
    .toolbar { padding: 12px 12px 0; }
    .toolbar input { width: 100%; }
    .tabs { padding: 10px 12px 0; }
    .table-wrap { padding: 0 12px 24px; }
    header { padding: 0 12px; }
}
