:root {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --brand: #0ea5e9;
    --brand-dark: #0369a1;
    --line: #e2e8f0;
    /* Mesmos tokens do os.css: largura fluida com teto em 1800px e margem
       lateral que encolhe junto com a janela. Assim as telas antigas e as do
       ERP terminam com a mesma caixa útil. */
    --sys-largura: 1800px;
    --sys-gutter: clamp(16px, 2.2vw, 32px);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f1f5f9;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: linear-gradient(120deg, #0b1220, #16324f);
    padding: 12px var(--sys-gutter);
    box-shadow: 0 2px 12px rgba(2, 32, 71, .25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.nav { display: inline-flex; align-items: center; gap: 18px; }
.nav a { color: #cbe6f7; text-decoration: none; font-size: 15px; }
.nav a:hover { color: #fff; text-decoration: underline; }
.nav .nav-logout { font-weight: 700; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 20px;
}
.brand-logo {
    display: block;
    height: 52px;
    width: auto;
}

/* O container é fluido: ocupa a janela toda no notebook e só para de crescer no
   teto, centrado. Páginas de formulário não ficam largas por causa disso — quem
   segura a largura delas é o `.form` (max-width: 480px). */
.container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px var(--sys-gutter);
}
/* Páginas com tabelas largas (ex.: Comissões) vão até o teto do sistema. */
.container-wide,
.container-comissao { max-width: var(--sys-largura); }
/* Os formulários de admin (grupos/vendedores/cupons) usam .form, que tem
   max-width: 480px — isso limitava as tabelas dentro deles. Nesta página os
   liberamos para a largura total, deixando as tabelas ocuparem o container. */
.container-comissao .form { max-width: none; }

.hero h1 { margin: 0 0 6px; font-size: 28px; }
.hero p { margin: 0 0 24px; color: var(--muted); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    text-decoration: none;
    color: var(--ink);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(2, 32, 71, .12);
    border-color: var(--brand);
}
.card-icon { font-size: 34px; }
.card-body h2 { margin: 0 0 4px; font-size: 18px; }
.card-body p { margin: 0; color: var(--muted); font-size: 14px; }
.card-arrow { margin-left: auto; color: var(--brand); font-size: 22px; }

.breadcrumb { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.breadcrumb a { color: var(--brand-dark); text-decoration: none; }

.form {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    max-width: 480px;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 15px;
}
.field input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 15px;
    background: #fff;
    color: inherit;
}
.field select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.field small { display: block; color: var(--muted); margin-top: 5px; }

.advanced {
    border: 1px dashed var(--line);
    border-radius: 9px;
    padding: 12px 14px;
    margin-bottom: 18px;
}
.advanced summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.advanced .field:first-of-type { margin-top: 14px; }

.btn {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 22px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.btn:hover { background: var(--brand-dark); }
.btn-sm { width: auto; padding: 9px 16px; font-size: 14px; }
.btn-ghost { background: #fff; color: var(--brand-dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #b91c1c; }

.link { color: var(--brand-dark); }

/* Alertas */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-erro { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Login */
.login-page {
    background: radial-gradient(120% 120% at 50% 0%, #16324f 0%, #0b1220 55%, #060a12 100%);
}
/* No login, a barra superior é redundante (a logo já aparece no card) e empurra
   o formulário para baixo, forçando rolagem — escondemos topbar e rodapé. */
.login-page .topbar,
.login-page .footer { display: none; }
.login-page .container { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-wrap { width: 100%; max-width: 380px; margin: 0 auto; }
.login-logo {
    display: block;
    width: 240px;
    max-width: 82%;
    height: auto;
    margin: 0 auto 26px;
}
.login-form h1 { margin: 0 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 18px; }

/* Checkboxes / permissões */
.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

/* Lista de usuários */
.users-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    margin: 28px 0 10px;
}
.users-head h2 { margin: 0; }
.users-total {
    display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px;
    background: var(--line); color: var(--muted); font-size: 12px; font-weight: 700;
    vertical-align: middle;
}
.users-busca {
    display: flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 11px;
    padding: 4px 12px; margin-bottom: 16px;
}
.users-busca-ic { font-size: 15px; opacity: .65; }
.users-busca input {
    flex: 1; min-width: 0; border: 0; background: none;
    padding: 11px 0; font-size: 15px; color: inherit;
}
.users-busca input:focus { outline: none; }
.users-busca:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.users-busca-cont { color: var(--muted); font-size: 13px; white-space: nowrap; }
.users { display: flex; flex-direction: column; gap: 16px; }
.user-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
}
.user-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.user-head strong { font-size: 17px; }
.badge {
    display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle;
}
.badge-you { background: #64748b; }
.user-perms { border-top: 1px dashed var(--line); padding-top: 14px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input {
    padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
}

/* Campo de senha com botão de "olho" (ver a senha em claro) */
.senha-wrap { position: relative; display: block; }
.senha-wrap input { width: 100%; padding-right: 44px; }
.senha-wrap-sm { display: inline-block; width: auto; }
.senha-olho {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    background: none; border: 0; cursor: pointer; padding: 4px 6px;
    font-size: 16px; line-height: 1; opacity: .7;
}
.senha-olho:hover { opacity: 1; }

/* Permissões agrupadas pelos módulos do ERP */
.form-largo { max-width: 780px; }
.perm-grupos {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px; margin-bottom: 12px;
}
.perm-grupo {
    border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.perm-grupo legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.perm-todos { color: var(--muted); font-size: 13px; }

/* Permissões recolhidas na lista de usuários (abre pela seta) */
.perm-det > summary {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; list-style: none; padding: 4px 0; user-select: none;
}
.perm-det > summary::-webkit-details-marker { display: none; }
.perm-det > summary .field-label { margin-bottom: 0; }
.perm-det-seta { color: var(--brand); font-size: 13px; transition: transform .15s; }
.perm-det[open] .perm-det-seta { transform: rotate(90deg); }
.perm-det-cont { color: var(--muted); font-size: 13px; margin-left: auto; }
.perm-det[open] > summary { margin-bottom: 10px; }
.perm-soon {
    margin-left: 4px; padding: 1px 6px; border-radius: 999px;
    background: var(--line); color: var(--muted); font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}

/* Calculadora de Precificação */
.precif { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 18px; align-items: start; }
.precif > .form { margin: 0; }
.precif-result {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
}
.precif-placeholder { color: var(--muted); margin: 0; }
.precif-hero {
    display: flex; flex-direction: column; gap: 4px;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff; border-radius: 16px; padding: 22px 24px;
    box-shadow: 0 12px 28px -12px rgba(3, 105, 161, .55);
}
.precif-hero-label {
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: rgba(255, 255, 255, .82);
}
.precif-hero-value { font-size: 42px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.precif-hero-foot { font-size: 12.5px; color: rgba(255, 255, 255, .82); margin-top: 2px; }
.precif-code {
    align-self: flex-start; font-size: 12px; font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: rgba(255, 255, 255, .18); color: #fff;
    padding: 2px 9px; border-radius: 999px; margin-bottom: 4px;
}
.precif-codigo-row { display: flex; gap: 8px; align-items: stretch; }
.precif-codigo-row input { flex: 1 1 auto; min-width: 0; }
.precif-codigo-row .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }
.precif-busca-status { margin-top: 6px; }
.precif-busca-ok { color: var(--brand-dark); }
.precif-busca-erro { color: #b91c1c; }
.precif-table { margin-top: 18px; }
.precif-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.precif-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.precif-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.precif-table tr:last-child td { border-bottom: none; }
.precif-pct { color: var(--muted); font-weight: 400; font-size: 13px; }
/* Margem de lucro por peça (recuada) e a margem final (destacada). */
.precif-margem-item td:first-child { padding-left: 14px; color: var(--muted); }
.precif-margem-final td { font-weight: 700; border-top: 1px solid var(--line); }
.precif-market { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.precif-market .hint { margin: 10px 0 0; }
.precif-market-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.precif-market-avg {
    font-size: 13px; font-weight: 600; color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.precif-badge {
    display: inline-block; padding: 4px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 700;
}
.precif-badge-ok { background: #dcfce7; color: #166534; }
.precif-badge-high { background: #fee2e2; color: #991b1b; }
.precif-badge-low { background: #fef9c3; color: #854d0e; }
.precif-desconto {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 12px; padding: 12px 16px;
    background: #dcfce7; border: 1px solid #86efac; border-radius: 12px;
}
.precif-desconto-label { display: block; font-weight: 700; color: #166534; font-size: 14px; }
.precif-desconto-info { display: block; color: #15803d; font-size: 12.5px; margin-top: 2px; }
.precif-desconto-value { font-size: 22px; font-weight: 800; color: #166534; white-space: nowrap; }
.precif-itens {
    margin-top: 14px; padding: 12px 16px;
    border: 1px solid var(--line); border-radius: 12px; background: #f8fafc;
}
.precif-itens-head {
    font-size: 12.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); margin-bottom: 6px;
}
.precif-itens-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 5px 0; font-size: 15px; font-variant-numeric: tabular-nums;
}
.precif-itens-row > span:last-child { font-weight: 600; white-space: nowrap; }
.precif-itens-cod {
    display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
    background: #e2e8f0; color: var(--muted); font-size: 12px; font-weight: 600;
}
.precif-itens-total {
    margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line);
    font-weight: 800;
}
.precif-adic-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px;
}
.precif-adic-row .adic-codigo { flex: 1 1 40%; text-transform: uppercase; }
.precif-adic-row .adic-custo { flex: 1 1 45%; }
.precif-adic-row .adic-del { flex: 0 0 auto; white-space: nowrap; }
.precif-adic-row .adic-status { flex: 1 1 100%; margin: 2px 0 0; }
/* Selo compacto de comparação com o mercado, por peça, na composição do resultado. */
.precif-item-mkt {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; vertical-align: middle;
}
.precif-compare {
    margin-top: 18px; padding: 18px;
    border: 1px solid var(--line); border-radius: 14px; background: #f8fafc;
}
.precif-compare-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.precif-compare-pct { font-size: 34px; font-weight: 800; line-height: 1; }
.precif-compare-cap { color: var(--muted); font-size: 14px; font-weight: 600; }
.precif-compare-bar {
    margin: 12px 0 10px; height: 10px; border-radius: 999px;
    background: #e2e8f0; overflow: hidden;
}
.precif-compare-bar > span { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }
.precif-compare-sub { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.precif-compare-msg { margin: 0; font-size: 14px; font-weight: 600; }
.precif-compare-ok .precif-compare-pct { color: #166534; }
.precif-compare-ok .precif-compare-bar > span { background: #22c55e; }
.precif-compare-ok .precif-compare-msg { color: #166534; }
.precif-compare-mid .precif-compare-pct { color: #854d0e; }
.precif-compare-mid .precif-compare-bar > span { background: #f59e0b; }
.precif-compare-mid .precif-compare-msg { color: #854d0e; }
.precif-compare-high .precif-compare-pct { color: #991b1b; }
.precif-compare-high .precif-compare-bar > span { background: #ef4444; }
.precif-compare-high .precif-compare-msg { color: #991b1b; }
.precif-error { margin: 16px 0 0; }
.precif-admin { max-width: 480px; margin-top: 24px; }
.precif-admin .form { margin-top: 14px; max-width: none; }
@media (max-width: 760px) { .precif { grid-template-columns: 1fr; } }

/* Controle de Estoque */
.est-resumo { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.est-chip {
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 14px; font-size: 13px; color: var(--muted);
}
.est-chip strong { color: var(--ink); }
.est-chip-estoque { border-color: #86efac; }
.est-chip-vendido { border-color: #cbd5e1; }

.est-form { max-width: none; }
.est-form-titulo { margin: 0 0 16px; font-size: 18px; }
.est-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px;
}
.est-grid .field { margin-bottom: 0; }
.est-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.est-actions .btn { width: auto; }

.est-market {
    margin-top: 16px; padding: 16px 18px;
    border: 1px solid var(--line); border-radius: 14px; background: #f8fafc;
    font-size: 14px; color: var(--muted);
}
.est-market-erro { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.est-market-ok { color: var(--ink); }
.est-market-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.est-market-label {
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted);
}
.est-market-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.est-market-nota { margin: 10px 0 0; font-size: 13.5px; }
.est-market-fonte { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.est-filtros { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 14px; }
.est-filtros input, .est-filtros select {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
}
.est-filtros input { flex: 1 1 240px; }

.est-tabela-wrap { overflow-x: auto; }
.est-tabela { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.est-tabela th, .est-tabela td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top;
}
.est-tabela th {
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    background: #f8fafc; white-space: nowrap;
}
.est-preco { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Atribuição do vendedor linha a linha (Comissões SMB). */
.linha-cancelada td { color: var(--muted); text-decoration: line-through; }
.linha-cancelada .cel-vend { text-decoration: none; }
.linha-pendente { background: #fef9c3; }
.linha-ignorada td { opacity: .55; }
.linha-ignorada .cel-ign { opacity: 1; }
.cel-ign { white-space: nowrap; }
.cel-ign label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.est-nota { font-size: 11px; color: var(--muted); }
.cel-vend select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; max-width: 220px; }
.est-obs { color: var(--muted); max-width: 260px; }
.est-row-actions { white-space: nowrap; }
.est-row-actions form { display: inline; }
.est-link {
    background: none; border: none; padding: 0; margin-right: 12px; cursor: pointer;
    color: var(--brand-dark); font-size: 14px; text-decoration: underline;
}
.est-link-danger { color: #b91c1c; margin-right: 0; }
.est-vazio { color: var(--muted); text-align: center; padding: 28px; }

.est-badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.est-badge-estoque { background: #dcfce7; color: #166534; }
.est-badge-vendido { background: #e2e8f0; color: #475569; }
.est-badge-amber { background: #fef9c3; color: #854d0e; }
.est-badge-cond { background: #e0e7ff; color: #3730a3; }

/* Dashboard do Controle de Produtos */
.est-dash {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.est-card {
    display: flex; flex-direction: column; gap: 4px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.est-card-label {
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted);
}
.est-card-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.est-card-sub { font-size: 12.5px; color: var(--muted); }

.est-dash-cols {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px; margin-bottom: 26px;
}
.est-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.est-panel-titulo { margin: 0 0 14px; font-size: 14px; }
.est-panel-titulo span { color: var(--muted); font-weight: 400; }

.est-bars { display: flex; flex-direction: column; gap: 10px; }
.est-bar-row {
    display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 10px;
    font-size: 13px;
}
.est-bar-nome { color: var(--ink); }
.est-bar-nome small { color: var(--muted); }
.est-bar-track { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.est-bar-fill { display: block; height: 100%; background: var(--brand-dark); border-radius: 999px; min-width: 2px; }
.est-bar-valor { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

.est-cond-list { display: flex; flex-direction: column; gap: 10px; }
.est-cond-row { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.est-cond-qtd { color: var(--muted); }
.est-cond-valor { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Consulta de preço de mercado por produto (linha de detalhe na tabela) */
.est-mkt-detail > td { background: #fff; padding: 0 12px 14px; border-bottom: 1px solid var(--line); }
.est-mkt-detail .est-market { margin-top: 0; }

/* Tabela de Acessórios e Serviços — cards de consulta (nome + preço de venda) e gestão do admin */
/* Item = uma linha: nome à esquerda, preço à direita. */
.acess-cards { display: flex; flex-direction: column; margin-bottom: 24px; }
.acess-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-top: 1px solid var(--line);
}
.acess-card:first-child { border-top: none; }
.acess-card-nome {
    margin: 0; font-size: 13.5px; line-height: 1.3; font-weight: 500;
    flex: 1; min-width: 0;
}
.acess-card-valor {
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-dark);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
    white-space: nowrap;
}

/* Grupos por produto: um card maior envolvendo as linhas dos itens.
   Os grupos ficam lado a lado numa grade — empilhados, sete itens já exigiam
   rolar, e esta é uma tela consultada com o cliente esperando. */
.acess-grupos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-items: start;
    margin-bottom: 24px;
}
.acess-grupo {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 13px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.acess-grupo .acess-cards { margin-bottom: 0; }
.acess-grupo-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.acess-grupo-nome { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.acess-grupo-conta { color: var(--muted); font-size: 11.5px; }
.acess-grupo-acoes { margin-left: auto; display: flex; gap: 4px; align-self: center; }
.acess-grupo-acoes form { margin: 0; }
.acess-grupo-aviso { margin: -2px 0 8px; font-size: 12px; }
/* Grupo dos não classificados: tracejado, para parecer pendência e não seção. */
.acess-grupo-vago { border-style: dashed; background: transparent; }
/* Durante o arrasto, os grupos ficam visíveis como alvos — inclusive os vazios. */
.acess-arrastando .acess-grupo { border-color: var(--brand-dark); }
.acess-arrastando .acess-grupo .acess-cards { min-height: 60px; }
/* Grupo sem item continua sendo alvo de arrasto: precisa de área para receber. */
.acess-cards-ordenavel:empty { min-height: 34px; }

/* Reordenação dos cards (só admin): pegador de arrasto + setas de teclado/toque */
.acess-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.acess-novo-grupo { display: flex; gap: 6px; margin: 0; }
.acess-novo-grupo input {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; width: 160px;
}
.acess-grupo-vazio { margin: 2px 0 0; font-size: 12px; }
.acess-barra .btn { width: auto; flex: none; }
.acess-novo-btn { cursor: pointer; }
.acess-ordem-dica { margin: 0; flex: 1; min-width: 260px; }
.acess-ordem-status { margin-left: 8px; font-weight: 600; }
.acess-ordem-ok { color: var(--brand-dark); }
.acess-ordem-erro { color: #c0392b; }
.acess-cards-ordenavel .acess-card { cursor: grab; }
.acess-cards-ordenavel .acess-card:active { cursor: grabbing; }
.acess-cards-ordenavel .acess-card:hover { background: #f8fafc; }
.acess-card-arrastando { opacity: .4; }
.acess-card-pegador { font-size: 13px; letter-spacing: -2px; cursor: grab; color: var(--muted); }
/* Botões dos grupos (mover o bloco inteiro, renomear). */
.acess-mover {
    border: 1px solid var(--line); background: transparent;
    color: inherit; border-radius: 6px; width: 20px; height: 20px;
    font-size: 9px; line-height: 1; cursor: pointer; font-family: inherit;
    padding: 0;
}
.acess-mover:hover { background: var(--line); }
/* O card inteiro é arrastável; sem isto o texto vira seleção no meio do arrasto. */
.acess-cards-ordenavel .acess-card-nome { user-select: none; }

.acess-admin .form { max-width: none; margin-bottom: 18px; }
.acess-admin .acess-novo .btn { width: auto; }
.acess-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.acess-table th {
    text-align: left; padding: 8px 10px 8px 0; color: var(--muted);
    font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--line);
}
.acess-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.acess-table input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--line);
    border-radius: 8px; font-size: 14px; font-family: inherit;
}
.acess-table td:nth-child(2) { width: 170px; }
.acess-table-acoes { display: flex; gap: 8px; white-space: nowrap; }
.acess-table-acoes form { margin: 0; }

@media (max-width: 640px) {
    .acess-table, .acess-table thead, .acess-table tbody,
    .acess-table tr, .acess-table td { display: block; width: 100%; }
    .acess-table thead { display: none; }
    .acess-table tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
    .acess-table td { border-bottom: none; padding: 4px 0; }
    .acess-table td:nth-child(2) { width: 100%; }
}

.footer {
    text-align: center;
    padding: 18px;
    color: var(--muted);
    font-size: 13px;
}
