/* ══════════════════════════════════════════════════════════════
   ERP — Identidade visual (DNA Datify light)
   Sora (display) · DM Sans (texto) · azul #2563c4 · verde #0fa858
   ══════════════════════════════════════════════════════════════ */
:root {
    --erp-blue: #2563c4;
    --erp-blue-dark: #1d4f9e;
    --erp-teal: #1689a0;
    --erp-green: #0fa858;
    --erp-ink: #10203b;
    --erp-slate: #5b6b84;
    --erp-line: #e4e9f2;
    --erp-bg: #f6f8fc;
    --erp-white: #ffffff;
    --erp-danger: #d6455a;
    --erp-warning: #d98a1f;
    --erp-radius: 14px;
    --erp-sidebar-w: 248px;
    --erp-sidebar-w-min: 72px;
    --erp-font-display: 'Sora', sans-serif;
    --erp-font-body: 'DM Sans', sans-serif;
}

* { font-family: var(--erp-font-body); }
h1, h2, h3, h4, h5, .font-display { font-family: var(--erp-font-display); }

body { background: var(--erp-bg); color: var(--erp-ink); }

/* ── Sidebar ── */
.erp-sidebar {
    width: var(--erp-sidebar-w);
    min-height: 100vh;
    background: var(--erp-white);
    border-right: 1px solid var(--erp-line);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: width .2s ease, transform .2s ease;
}
.erp-sidebar .brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--erp-line);
}
.erp-sidebar .brand-mark {
    width: 34px; height: 34px; border-radius: 9px; flex: none;
    background: linear-gradient(135deg, var(--erp-blue), var(--erp-teal) 55%, var(--erp-green));
    display: grid; place-items: center;
    color: #fff; font-family: var(--erp-font-display); font-weight: 700;
}
.erp-sidebar .brand-name {
    font-family: var(--erp-font-display); font-weight: 700; font-size: 1.05rem;
    white-space: nowrap;
}
.erp-sidebar nav { flex: 1; padding: .9rem .75rem; overflow-y: auto; }
.erp-sidebar .nav-label {
    font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
    color: var(--erp-slate); padding: .85rem .6rem .35rem; white-space: nowrap;
}
.erp-sidebar .nav-link {
    display: flex; align-items: center; gap: .7rem;
    color: var(--erp-slate); font-weight: 500; font-size: .92rem;
    padding: .58rem .7rem; border-radius: 10px; white-space: nowrap;
}
.erp-sidebar .nav-link:hover { background: var(--erp-bg); color: var(--erp-ink); }
.erp-sidebar .nav-link.active {
    background: rgba(37, 99, 196, .09);
    color: var(--erp-blue); font-weight: 600;
}
.erp-sidebar .nav-link .bi { font-size: 1.08rem; flex: none; }

/* Sidebar colapsada (desktop) */
body.sidebar-min .erp-sidebar { width: var(--erp-sidebar-w-min); }
body.sidebar-min .erp-sidebar .brand-name,
body.sidebar-min .erp-sidebar .nav-label,
body.sidebar-min .erp-sidebar .nav-link span { display: none; }
body.sidebar-min .erp-sidebar .nav-link { justify-content: center; }
body.sidebar-min .erp-main { margin-left: var(--erp-sidebar-w-min); }

/* ── Conteúdo ── */
.erp-main { margin-left: var(--erp-sidebar-w); transition: margin-left .2s ease; min-height: 100vh; }
.erp-topbar {
    background: var(--erp-white);
    border-bottom: 1px solid var(--erp-line);
    padding: .7rem 1.4rem;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 1020;
}
.erp-content { padding: 1.6rem 1.4rem 2.5rem; max-width: 1400px; }

/* ── Componentes ── */
.card { border: 1px solid var(--erp-line); border-radius: var(--erp-radius); box-shadow: 0 1px 2px rgba(16,32,59,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--erp-line); font-family: var(--erp-font-display); font-weight: 600; }

.btn-primary { background: var(--erp-blue); border-color: var(--erp-blue); }
.btn-primary:hover { background: var(--erp-blue-dark); border-color: var(--erp-blue-dark); }
.btn-success { background: var(--erp-green); border-color: var(--erp-green); }
.btn { border-radius: 10px; font-weight: 500; }

.form-control, .form-select { border-radius: 10px; border-color: var(--erp-line); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--erp-blue); box-shadow: 0 0 0 .2rem rgba(37,99,196,.12); }
.form-label { font-weight: 600; font-size: .86rem; color: var(--erp-ink); }

.table { --bs-table-hover-bg: #f2f6fd; }
.table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--erp-slate); border-bottom-width: 1px; font-weight: 600;
}
.table td { vertical-align: middle; font-size: .92rem; }

.badge-soft-green { background: rgba(15,168,88,.12); color: #0b7a41; }
.badge-soft-red { background: rgba(214,69,90,.12); color: #a92e40; }
.badge-soft-blue { background: rgba(37,99,196,.12); color: var(--erp-blue-dark); }
.badge-soft-gray { background: rgba(91,107,132,.14); color: var(--erp-slate); }
.badge { font-weight: 600; border-radius: 999px; padding: .38em .8em; }

.stat-card { display: flex; align-items: center; gap: .95rem; padding: 1.1rem 1.2rem; }
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 1.25rem;
}
.stat-value { font-family: var(--erp-font-display); font-weight: 700; font-size: 1.45rem; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--erp-slate); }

.pagination .page-link { color: var(--erp-blue); border-radius: 8px; margin: 0 2px; border-color: var(--erp-line); }
.pagination .page-item.active .page-link { background: var(--erp-blue); border-color: var(--erp-blue); }

/* ── Auth (telas cheias) ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--erp-bg); padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1.6rem; }

/* ── Páginas de erro ── */
.error-wrap { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-code {
    font-family: var(--erp-font-display); font-weight: 800; font-size: clamp(5rem, 16vw, 9rem);
    line-height: 1;
    background: linear-gradient(135deg, var(--erp-blue), var(--erp-teal) 55%, var(--erp-green));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Mobile ── */
@media (max-width: 991.98px) {
    .erp-sidebar { transform: translateX(-100%); }
    body.sidebar-open .erp-sidebar { transform: translateX(0); }
    .erp-main { margin-left: 0 !important; }
    .erp-backdrop {
        display: none; position: fixed; inset: 0; z-index: 1029;
        background: rgba(16,32,59,.4);
    }
    body.sidebar-open .erp-backdrop { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   ETAPA 2 — Estoque
   ══════════════════════════════════════════════════════════════ */

/* Badges de movimentação */
.badge-mov-entrada    { background: #e3f5eb; color: #0b7a41; }
.badge-mov-saida      { background: #fdeaea; color: #b23342; }
.badge-mov-ajuste     { background: #e8effc; color: #1d4f9e; }
.badge-mov-perda      { background: #fdf1e0; color: #a1660f; }
.badge-mov-inventario { background: #eef0f4; color: #46536b; }

/* Badges de status de compra */
.badge-st-aberta    { background: #e8effc; color: #1d4f9e; }
.badge-st-parcial   { background: #fdf1e0; color: #a1660f; }
.badge-st-recebida  { background: #e3f5eb; color: #0b7a41; }
.badge-st-cancelada { background: #eef0f4; color: #6b7789; }

/* Badges de status de inventário */
.badge-inv-em_contagem { background: #e6f4f7; color: #0f6d80; }
.badge-inv-aplicado    { background: #e3f5eb; color: #0b7a41; }
.badge-inv-cancelado   { background: #eef0f4; color: #6b7789; }

/* Badges Curva ABC */
.badge-abc-a { background: var(--erp-green); color: #fff; min-width: 2rem; }
.badge-abc-b { background: var(--erp-blue);  color: #fff; min-width: 2rem; }
.badge-abc-c { background: #93a1b8;          color: #fff; min-width: 2rem; }

/* Dropdown do picker de produto */
.product-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--erp-white);
    border: 1px solid var(--erp-line);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(16, 32, 59, .14);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}
.product-dropdown .pd-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--erp-line);
    padding: .6rem .9rem;
    cursor: pointer;
}
.product-dropdown .pd-item:last-child { border-bottom: 0; }
.product-dropdown .pd-item:hover { background: var(--erp-bg); }
.product-dropdown .pd-name { display: block; font-weight: 600; font-size: .9rem; color: var(--erp-ink); }
.product-dropdown .pd-meta { display: block; font-size: .76rem; color: var(--erp-slate); }
.product-dropdown .pd-empty { padding: .8rem .9rem; font-size: .85rem; color: var(--erp-slate); }

/* Impressão de relatórios e inventário */
@media print {
    .erp-sidebar, .erp-topbar, .erp-backdrop, .no-print, .alert, form.no-print { display: none !important; }
    .erp-main { margin-left: 0 !important; }
    .erp-content { padding: 0 !important; }
    .card { border: none !important; box-shadow: none !important; }
    .card-header { background: none !important; border-bottom: 2px solid #000 !important; }
    body { background: #fff !important; }
    a { text-decoration: none !important; color: inherit !important; }
    input.form-control { border: none !important; text-align: right; }
}
