/* =========================================================
   Grupo SBChemicals — WMS Controle de Estoque
   Paleta: azul marinho da marca (extraído da logo, #152e53)
   + variante mais clara/saturada da mesma matiz como destaque.
   Tipografia: Inter (UI) + JetBrains Mono (códigos, quantidades).
   ========================================================= */

:root {
    --graphite-950: #0c1c33;
    --graphite-900: #152e53;
    --graphite-800: #1e3d68;
    --graphite-700: #2c4d7a;
    --graphite-200: #d7dce3;
    --paper: #f5f6f8;
    --paper-card: #ffffff;
    --ink: #152e53;
    --ink-soft: #5b6b83;
    --amber: #266ed8;
    --amber-dark: #1f57ab;
    --green: #2f8f5b;
    --red: #c0432f;
    --blue: #266ed8;
    --radius: 6px;
    --border: #e1e4ea;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--paper);
    color: var(--ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

code, .mono, .qtd {
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--graphite-900);
    color: var(--graphite-200);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    transition: width .18s ease, padding .18s ease;
}

.sidebar.is-collapsed {
    width: 64px;
    padding: 20px 10px;
}

.sidebar.is-collapsed .brand-name,
.sidebar.is-collapsed .sidebar-label,
.sidebar.is-collapsed .sidebar-select,
.sidebar.is-collapsed .nav-list,
.sidebar.is-collapsed .sidebar-footer .user-line,
.sidebar.is-collapsed .btn-sair span {
    display: none;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .01em;
    font-size: 15px;
    color: #fff;
    line-height: 1.15;
}

.brand-mark {
    color: var(--amber);
    font-size: 18px;
}

.brand-logo-chip {
    background: #fff;
    border-radius: 6px;
    padding: 3px 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-logo-chip img {
    display: block;
    height: 18px;
    width: auto;
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--graphite-700);
    color: var(--graphite-200);
    border-radius: var(--radius);
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 12px;
}

.sidebar-block { margin-bottom: 22px; }

.sidebar-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8891a0;
    margin-bottom: 8px;
}

.sidebar-select {
    width: 100%;
    background: var(--graphite-800);
    border: 1px solid var(--graphite-700);
    color: #fff;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 14px;
}

.sidebar-select--fixed {
    color: #cfd5df;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 10px;
}
.nav-list[hidden] { display: none; }

.nav-item {
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    color: #c4cbd6;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--graphite-800);
    color: #fff;
}

.nav-item.is-active {
    background: var(--graphite-800);
    color: #fff;
    border-left-color: var(--amber);
    font-weight: 600;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
    border-top: 1px solid var(--graphite-700);
    padding-top: 14px;
    font-size: 13px;
}

.user-line { color: #aab2bf; margin-bottom: 4px; }
.user-label { color: #6f7889; margin-right: 6px; }

.btn-sair {
    display: block;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid var(--graphite-700);
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
}
.btn-sair:hover { background: var(--graphite-800); }

/* ---------------------------------------------------------
   CONTEÚDO
   --------------------------------------------------------- */
.content {
    flex: 1;
    padding: 32px 40px;
    max-width: 100%;
}

h1.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 26px;
    margin: 0 0 20px;
    color: var(--graphite-900);
}

.card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 16px;
}

.badge-etapa {
    display: inline-block;
    background: var(--amber);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 999px;
    margin-left: 10px;
    vertical-align: middle;
}

/* ---------------------------------------------------------
   FLASH / ALERTAS
   --------------------------------------------------------- */
.flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid transparent;
}

.flash--success { background: #e9f6ef; color: var(--green); border-color: #bfe4cf; }
.flash--error   { background: #fbeae6; color: var(--red);   border-color: #f0c3b8; }
.flash--info    { background: #e9f1f9; color: var(--blue);  border-color: #c3d9ec; }

.notice {
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    background: #e9f1f9;
    color: var(--blue);
    border: 1px solid #c3d9ec;
    margin-bottom: 14px;
}

.notice--success { background: #e9f6ef; color: var(--green); border-color: #bfe4cf; }

/* ---------------------------------------------------------
   LOGIN
   --------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(224,138,44,.10), transparent 45%),
        var(--graphite-950);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--paper-card);
    border-radius: 10px;
    padding: 34px 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,.35);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--graphite-900);
}
.auth-brand .brand-mark { color: var(--amber); }
.auth-brand img { height: 34px; width: auto; display: block; }

.auth-sub {
    color: var(--ink-soft);
    font-size: 13px;
    margin-bottom: 24px;
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: #fdfdfc;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(224,138,44,.15);
}
.field select:disabled { color: var(--ink-soft); background: var(--paper); }

.linha-estoque:hover { background: var(--paper); }
.linha-estoque.is-selecionada {
    background: #fdf1e0;
    border-left: 3px solid var(--amber);
    padding-left: 6px !important;
}

.btn-primary {
    width: 100%;
    background: var(--amber);
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { background: var(--amber-dark); }

.auth-links {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
}
.auth-links a { color: var(--blue); }
.auth-links a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .content { padding: 20px; }
    .sidebar { position: fixed; z-index: 10; height: 100vh; }
}

/* ---------------------------------------------------------
   MOBILE — menu gaveta (off-canvas)
   Abaixo de 768px a sidebar sai da tela por padrão e vira
   uma gaveta que abre por cima do conteúdo, com um botão
   hambúrguer fixo no topo e um backdrop pra fechar tocando fora.
   --------------------------------------------------------- */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
    .shell {
        flex-direction: column;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 14px;
        background: var(--graphite-900);
        color: #fff;
        padding: 14px 16px;
        position: sticky;
        top: 0;
        z-index: 30;
    }

    .mobile-topbar .brand { color: #fff; font-size: 16px; }

    .hamburger {
        width: 34px;
        height: 34px;
        background: transparent;
        border: 1px solid var(--graphite-700);
        border-radius: var(--radius);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .hamburger span {
        display: block;
        width: 16px;
        height: 2px;
        background: #fff;
        border-radius: 1px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 78vw;
        max-width: 300px;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform .22s ease;
        padding-top: 20px;
    }

    .sidebar.is-open { transform: translateX(0); }

    /* No mobile o botão de recolher da sidebar não faz sentido
       (a gaveta inteira já recolhe sozinha) — some ele. */
    .sidebar .sidebar-toggle { display: none; }
    .sidebar.is-collapsed { width: 78vw; max-width: 300px; padding: 20px 16px; }
    .sidebar.is-collapsed .brand-name,
    .sidebar.is-collapsed .sidebar-label,
    .sidebar.is-collapsed .sidebar-select,
    .sidebar.is-collapsed .nav-list,
    .sidebar.is-collapsed .sidebar-footer .user-line,
    .sidebar.is-collapsed .btn-sair span {
        display: revert;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(10, 12, 16, .45);
        z-index: 35;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .sidebar-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .content { padding: 18px 16px 32px; max-width: 100%; }

    /* Alvo de toque mínimo confortável nos itens de menu e botões */
    .nav-item { padding: 12px 12px; font-size: 15px; }
    .btn-primary, .btn-sair, .sidebar-select, .field input { min-height: 44px; }
}
