/* ============================================================
   Minhas Vendas — estilos do painel e catálogo
   Onions Corporations
   ============================================================ */

:root {
    --bg: #f2f4fa;
    --bg-soft: #e9edf6;
    --card: #ffffff;
    --border: #e4e8f2;
    --text: #1b2233;
    --muted: #667085;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --violet: #7c3aed;
    --grad: linear-gradient(135deg, #4f46e5, #7c3aed);
    --success: #10b981;
    --success-soft: #d1fae5;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --info: #3b82f6;
    --sidebar-bg: #ffffff;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px -12px rgba(16, 24, 40, .12);
    --shadow-lg: 0 24px 60px -12px rgba(16, 24, 40, .25);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --sidebar-w: 264px;
}

[data-theme="dark"] {
    --bg: #0b0f1a;
    --bg-soft: #101524;
    --card: #141b2c;
    --border: #232c42;
    --text: #e8ecf6;
    --muted: #93a0b8;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success-soft: rgba(16, 185, 129, .16);
    --danger-soft: rgba(239, 68, 68, .16);
    --warning-soft: rgba(245, 158, 11, .16);
    --sidebar-bg: #101624;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .65);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120, 130, 160, .35); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.icon { vertical-align: -4px; }

/* ============ Layout do painel ============ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 60;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 44px; height: 44px; border-radius: 12px; overflow: hidden;
    flex: none; background: var(--bg-soft);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 12px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 3px;
    border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 600; font-size: 14px;
    transition: background .15s, color .15s;
    position: relative;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55); }
.nav-item.active .icon { color: #fff; }

.nav-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #f59e0b; margin-left: auto;
}

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { color: var(--muted); font-size: 12px; }

.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--grad); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; flex: none;
}
.avatar.lg { width: 54px; height: 54px; font-size: 22px; }

.app-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 26px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 19px; font-weight: 700; }

.plan-alert {
    font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
}
.plan-alert.warning { background: var(--warning-soft); color: #b45309; }
.plan-alert.danger { background: var(--danger-soft); color: var(--danger); }
[data-theme="dark"] .plan-alert.warning { color: #fbbf24; }

.page-content { padding: 26px; flex: 1; max-width: 1280px; width: 100%; margin: 0 auto; }

.app-footer {
    text-align: center; color: var(--muted); font-size: 12.5px;
    padding: 18px; border-top: 1px solid var(--border); margin-top: auto;
}

.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }

/* ============ Componentes ============ */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head .icon { color: var(--primary); }

.mt { margin-top: 20px; }
.muted { color: var(--muted); }
.muted.small, small.muted { font-size: 12.5px; }
.small { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.input, select.input {
    background: var(--card); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 9px 13px; font-size: 14px; outline: none;
    width: 100%; transition: border .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }

.search-box { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 36px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.field small { display: block; margin-top: 5px; }
textarea.input { resize: vertical; min-height: 60px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .field:last-child:nth-child(odd) { grid-column: 1 / -1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 9px 16px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: filter .15s, background .15s, transform .05s;
    white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 38px; height: 38px; }

.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .5); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { filter: brightness(1.06); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.link { color: var(--primary); cursor: pointer; }
.link.strong { font-weight: 700; }
.link:hover { text-decoration: underline; }

code { background: var(--bg-soft); border: 1px solid var(--border); padding: 2px 7px; border-radius: 6px; font-size: 12.5px; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: #047857; }
.badge-red { background: var(--danger-soft); color: #dc2626; }
.badge-orange { background: var(--warning-soft); color: #b45309; }
.badge-purple { background: rgba(124, 58, 237, .14); color: var(--violet); }
.badge-gray { background: var(--bg-soft); color: var(--muted); }
[data-theme="dark"] .badge-green { color: #34d399; }
[data-theme="dark"] .badge-red { color: #f87171; }
[data-theme="dark"] .badge-orange { color: #fbbf24; }
[data-theme="dark"] .badge-purple { color: #a78bfa; }

/* ============ Tabelas ============ */

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border);
    background: var(--bg-soft); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-soft); }
.td-actions, .th-actions { text-align: right; white-space: nowrap; }
.td-actions .btn { margin-left: 2px; }
.empty-cell { text-align: center; color: var(--muted); padding: 26px !important; }

/* ============ Cards de estatística ============ */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px;
    display: flex; align-items: center; gap: 14px;
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
    width: 48px; height: 48px; border-radius: 13px; flex: none;
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.grad-a { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.grad-b { background: linear-gradient(135deg, #10b981, #34d399); }
.grad-c { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.grad-d { background: linear-gradient(135deg, #ef4444, #f97316); }

.stat-info span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-info strong { display: block; font-size: 20px; margin: 2px 0; }
.stat-info small { color: var(--muted); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { height: 240px; position: relative; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

.donut-legend { display: flex; gap: 18px; justify-content: center; padding: 8px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.list-plain { list-style: none; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px dashed var(--border); }
.row-item:last-child { border-bottom: none; }
.rank { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; color: var(--muted); flex: none; }
.mini-thumb { width: 38px; height: 38px; border-radius: 9px; overflow: hidden; background: var(--bg-soft); flex: none; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.mini-stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.mini-stat span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-stat strong { font-size: 16px; }
.mini-stat.ok strong { color: var(--success); }
.mini-stat.warn strong { color: var(--warning); }

/* ============ Modais ============ */

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(8, 12, 24, .55);
    z-index: 100; display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
    animation: fadeIn .18s ease;
}
/* CRÍTICO: o modal oculto (hidden) NÃO pode aparecer — sem esta regra
   o display:flex acima vence o atributo hidden e o formulário abre sozinho. */
.modal-backdrop[hidden], [hidden].modal-backdrop { display: none !important; }
.modal {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; animation: slideUp .22s ease;
}
.modal.sm { max-width: 420px; }
.modal.md { max-width: 620px; }
.modal.lg { max-width: 860px; }

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16.5px; display: flex; align-items: center; gap: 9px; }
.modal-body { padding: 22px; }
.modal-body.no-padding { padding: 0; }
.modal-body.no-padding > * { padding: 0 22px; }
.modal-body.no-padding > .table-wrap { padding: 0; border-radius: 0; border: none; border-top: 1px solid var(--border); }
.modal-body.no-padding > .detail-head, .modal-body.no-padding > .mini-stats { margin-top: 18px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 16px 22px; border-top: 1px solid var(--border);
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } }

/* ============ Toasts ============ */

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }

.toast {
    background: var(--card); color: var(--text);
    border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    padding: 13px 18px; font-weight: 600; font-size: 13.5px;
    max-width: 360px; animation: slideIn .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }

/* ============ Alertas ============ */

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; margin-bottom: 16px; font-size: 13.5px; }
.alert-danger { background: var(--danger-soft); color: #dc2626; }
[data-theme="dark"] .alert-danger { color: #f87171; }

/* ============ Produtos ============ */

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

.product-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
    display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.product-photo { position: relative; aspect-ratio: 1 / .85; background: var(--bg-soft); }
/* contain mostra a imagem INTEIRA (sem cortar), centralizada no fundo */
.product-photo img { width: 100%; height: 100%; object-fit: contain; }
.product-cat {
    position: absolute; top: 10px; left: 10px;
    background: rgba(10, 14, 26, .65); color: #fff; backdrop-filter: blur(4px);
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.product-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-body h4 { font-size: 14.5px; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-price { font-size: 17px; font-weight: 800; color: var(--primary); }
.product-actions { display: flex; gap: 4px; justify-content: flex-end; border-top: 1px dashed var(--border); padding-top: 10px; margin-top: auto; }

.form-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.form-photo img { width: 84px; height: 84px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); background: var(--bg-soft); }

/* ============ Categorias ============ */

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

.category-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; text-align: center;
    transition: transform .15s;
}
.category-card:hover { transform: translateY(-3px); }
.category-icon {
    width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px;
    background: var(--bg-soft); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}
.category-card h4 { margin-bottom: 2px; }
.category-card small { color: var(--muted); }
.category-actions { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }

/* ============ Cobranças ============ */

.segmented { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg {
    border: none; background: transparent; color: var(--muted);
    padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.seg.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.cob-card { padding: 16px 20px; }
.cob-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cob-customer { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.cob-customer small { display: block; color: var(--muted); }
.cob-total { text-align: right; }
.cob-total span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.cob-total strong { font-size: 18px; color: var(--danger); }
.cob-actions { display: flex; gap: 6px; }

.cob-parcelas { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 8px; }
.cob-parcela {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.cob-parcela:hover { background: var(--bg-soft); }
.cob-parcela input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.cob-parc-info { flex: 1; min-width: 0; }
.cob-parc-info strong { display: block; font-size: 13.5px; }
.cob-parc-info small { color: var(--muted); }

/* ============ Detalhes ============ */

.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.detail-head h4 { font-size: 16px; }

.stock-form p { margin-bottom: 16px; }

/* ============ Catálogo (painel) ============ */

.copy-row { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.copy-row input { flex: 1; min-width: 220px; }

.hint-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 9px; color: var(--muted); font-size: 13.5px; }

.catalog-preview {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden; height: 520px; background: #fff;
}
.catalog-preview iframe { width: 100%; height: 100%; border: none; }

/* ============ Relatórios ============ */

.extrato-box { margin-top: 14px; }
.extrato-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.extrato-head h4 { font-size: 16px; }
.extrato-text {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 16px; font-family: Consolas, "Courier New", monospace; font-size: 13px;
    white-space: pre-wrap; word-break: break-word; margin-top: 12px;
}

/* ============ Configurações ============ */

.form-logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.cfg-logo { width: 88px; height: 88px; border-radius: var(--radius); border: 1px solid var(--border); object-fit: cover; background: var(--bg-soft); }

.about-card { display: flex; gap: 18px; align-items: flex-start; }
.about-logo img { width: 64px; height: 64px; border-radius: 16px; }
.about-sign { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.about-sign strong { color: var(--violet); }

/* ============ Login ============ */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; position: relative; overflow: hidden; }
.login-bg {
    position: fixed; inset: -40px; z-index: -1;
    background: linear-gradient(135deg, #1e1b4b, #4f46e5 45%, #7c3aed 80%);
}
.login-bg::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.14), transparent 42%),
                radial-gradient(circle at 85% 75%, rgba(255,255,255,.1), transparent 45%);
}

.login-card {
    background: #fff; color: #1b2233;
    border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
    width: 100%; max-width: 470px; padding: 44px 42px 34px;
    animation: slideUp .35s ease;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { width: 96px; height: 96px; border-radius: 24px; margin: 0 auto 16px; box-shadow: 0 14px 34px -8px rgba(79, 70, 229, .55); }
.login-logo-custom { object-fit: contain; background: #f4f6fb; padding: 10px; }
.login-brand h1 { font-size: 26px; }
.login-brand p { color: #667085; font-size: 14.5px; margin-top: 4px; }

.login-card .field { margin-bottom: 18px; }
.login-card .field > span { font-size: 13.5px; }
.login-card .field input {
    background: #f4f6fb; border: 1px solid #e4e8f2;
    border-radius: 12px; padding: 15px 16px;
    font-size: 16px; outline: none; width: 100%;
    transition: border .15s, box-shadow .15s;
}
.login-card .field input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }

.checkbox-row {
    display: flex; align-items: center; gap: 10px;
    margin: 2px 0 20px; font-size: 14px; color: #4b5563;
    cursor: pointer; user-select: none;
}
.checkbox-row input {
    width: 18px; height: 18px; accent-color: #4f46e5; cursor: pointer; flex: none;
}

.login-card .btn-lg { padding: 15px 20px; font-size: 16px; border-radius: 12px; }

.login-footer { text-align: center; color: #98a2b3; font-size: 12.5px; margin-top: 26px; }

@media (max-width: 520px) {
    .login-card { padding: 34px 24px 26px; }
}

/* ============ Catálogo público ============ */

.catalog-page { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.catalog-header {
    background: var(--card); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.catalog-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; width: 100%; }
.catalog-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.catalog-logo { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; flex: none; }
.catalog-brand h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catalog-brand p { font-size: 12.5px; color: var(--muted); }

.catalog-main { padding-top: 22px; padding-bottom: 60px; flex: 1; }
.catalog-search { margin-bottom: 20px; }
.catalog-search .search-box { max-width: 420px; }

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

.catalog-product {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .15s;
}
.catalog-product:hover { transform: translateY(-3px); }
.catalog-product .product-photo { aspect-ratio: 1 / .9; }
.catalog-product-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.catalog-product-body h3 { font-size: 14.5px; }
.catalog-product-body p { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-product-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.catalog-price { font-size: 17px; font-weight: 800; color: var(--primary); }

.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.qty-stepper button {
    width: 32px; height: 34px; border: none; background: var(--bg-soft);
    color: var(--text); font-size: 16px; font-weight: 700; cursor: pointer;
}
.qty-stepper button:hover { background: var(--border); }
.qty-stepper span { min-width: 32px; text-align: center; font-weight: 700; }

.catalog-empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.catalog-empty h2 { margin: 14px 0 6px; color: var(--text); font-size: 18px; }
.empty-icon { font-size: 52px; }

.empty-box { text-align: center; padding: 44px 16px; color: var(--muted); font-size: 14.5px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--card); }

.catalog-footer { text-align: center; padding: 20px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

/* Carrinho flutuante */
.cart-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 80;
    width: 60px; height: 60px; border-radius: 50%; border: none;
    background: var(--grad); color: #fff; font-size: 24px;
    cursor: pointer; box-shadow: 0 14px 34px -8px rgba(79, 70, 229, .65);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
}
.cart-fab:hover { transform: scale(1.06); }
.cart-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff;
    min-width: 24px; height: 24px; border-radius: 999px;
    font-size: 12.5px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; padding: 0 6px;
}

.cart-overlay { position: fixed; inset: 0; background: rgba(8, 12, 24, .5); z-index: 90; animation: fadeIn .18s ease; }

.cart-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
    width: 400px; max-width: 94vw;
    background: var(--card); border-left: 1px solid var(--border);
    display: none; flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.cart-drawer.open { display: flex; animation: drawerIn .25s ease; }
@keyframes drawerIn { from { transform: translateX(100%); } }

.cart-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.cart-drawer-head h2 { font-size: 17px; }
.cart-items { flex: 1; overflow-y: auto; padding: 14px 20px; }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); align-items: center; }
.cart-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-info small { color: var(--muted); }
.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-item-actions strong { color: var(--primary); }
.cart-remove { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.cart-remove:hover { color: var(--danger); }

.cart-drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.cart-total span { color: var(--muted); font-weight: 600; }
.cart-total strong { font-size: 22px; color: var(--primary); }
.cart-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ============ Responsivo ============ */

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    #sidebar-toggle { display: inline-flex !important; }
    .catalog-preview { height: 380px; }
}

@media (max-width: 640px) {
    .page-content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { justify-content: flex-end; }
    .search-box { max-width: none; }
}

#sidebar-toggle { display: none; }

/* ============ Form de nova venda ============ */

.sale-search { position: relative; }
.sale-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.sale-result {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 12px; border: none; background: none; cursor: pointer;
    color: var(--text); text-align: left; font-size: 13.5px;
}
.sale-result:hover { background: var(--bg-soft); }
.sale-result img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; }
.sale-result-empty { padding: 12px; color: var(--muted); font-size: 13px; }

.sale-total-row {
    display: flex; justify-content: flex-end; align-items: baseline; gap: 14px;
    padding: 10px 4px 4px; flex-wrap: wrap;
}
.sale-total-row span { color: var(--muted); font-weight: 600; }
.sale-total-row strong { font-size: 24px; color: var(--primary); }

.sim-box { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 4px; }
.sim-box > strong { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sim-list { display: flex; flex-direction: column; gap: 4px; }
.sim-row { display: flex; align-items: center; gap: 14px; font-size: 13.5px; }
.sim-row span:first-child { flex: 1; }
.sim-row span:nth-child(2) { color: var(--muted); }
.sim-row strong { color: var(--primary); }

/* ============ Pedido especial (catálogo público) ============ */

.order-special-banner {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: var(--card); border: 1px dashed var(--violet); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 20px;
    cursor: pointer; color: var(--text); text-align: left;
    transition: transform .15s, box-shadow .15s;
}
.order-special-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.order-special-icon { font-size: 30px; }
.order-special-banner small, .order-special-banner .muted { color: var(--muted); }

.order-modal-card { max-width: 480px; }

/* honeypot anti-spam — invisível para humanos */
.hp-field {
    position: absolute; left: -9999px; top: -9999px;
    width: 1px; height: 1px; opacity: 0; pointer-events: none;
}

/* linhas de pedidos no painel */
.row-pendente { background: var(--warning-soft); }
.row-atendido { opacity: .72; }

/* ============ Accordion de detalhes do cliente ============ */

.cli-detail-box { padding: 6px 2px; }
.chev { color: var(--primary); font-weight: 700; }

/* ============ Chips de categoria (catálogo e venda) ============ */

.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-chip {
    border: 1px solid var(--border); background: var(--card); color: var(--muted);
    padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer;
    transition: all .15s;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--grad); border-color: transparent; color: #fff; }

/* badge do tamanho/volume no produto */
.size-badge {
    display: inline-block; background: var(--bg-soft); border: 1px solid var(--border);
    color: var(--muted); font-size: 11.5px; font-weight: 700;
    padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}

/* ============ Menu suspenso de categorias (catálogo) ============ */

.cat-dropdown { position: relative; }
.cat-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); min-width: 230px; max-height: 320px; overflow-y: auto;
    padding: 6px; animation: fadeIn .15s ease;
}
.cat-menu-item {
    display: block; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; color: var(--text);
    padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
    transition: background .15s;
}
.cat-menu-item:hover { background: var(--bg-soft); }
.cat-menu-item.active { color: var(--primary); font-weight: 800; }
.cat-menu-item.active::before { content: "✔ "; color: var(--success); }

/* ============ Animação hover dos produtos do catálogo ============ */

.catalog-product {
    transition: transform .25s ease, box-shadow .25s ease;
}
.catalog-product:hover { transform: translateY(-7px); box-shadow: var(--shadow-lg); }
.catalog-product .product-photo { overflow: hidden; }
.catalog-product .product-photo img { transition: transform .35s ease; }
.catalog-product:hover .product-photo img { transform: scale(1.08); }

/* ============ Promoções ============ */

.old-price { color: var(--muted); font-size: .78em; font-weight: 600; text-decoration: line-through; margin-left: 4px; }
.promo-flag { background: linear-gradient(135deg, #ef4444, #f97316) !important; }

/* ============ Vitrine (carrossel do catálogo) ============ */

.showcase {
    position: relative; border-radius: var(--radius); overflow: hidden;
    margin-bottom: 20px; background: var(--card);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.showcase-track { display: flex; transition: transform .55s ease; }
.showcase-slide {
    min-width: 100%; display: flex; align-items: center; gap: 10px;
    background: var(--grad); color: #fff; position: relative; overflow: hidden;
    padding: 28px 70px;
}
/* brilho decorativo atrás da imagem */
.showcase-slide::before {
    content: ""; position: absolute; top: -60%; left: -8%;
    width: 55%; height: 220%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%);
    pointer-events: none;
}
.showcase-circle {
    width: 230px; height: 230px; flex: none; border-radius: 50%;
    overflow: hidden; cursor: zoom-in; position: relative; z-index: 1;
    border: 6px solid rgba(255, 255, 255, .28);
    box-shadow: 0 18px 45px -12px rgba(0, 0, 0, .55);
    transition: transform .25s ease;
}
.showcase-circle:hover { transform: scale(1.05); }
.showcase-circle img { width: 100%; height: 100%; object-fit: cover; }
.showcase-info {
    flex: 1; padding: 10px 10px 10px 30px; display: flex; flex-direction: column;
    justify-content: center; gap: 10px; min-width: 0; position: relative; z-index: 1;
}
.showcase-info h3 { font-size: 26px; line-height: 1.25; }
.showcase-flag {
    display: inline-block; background: #ef4444; color: #fff;
    font-weight: 800; font-size: 12px; letter-spacing: .06em;
    padding: 4px 12px; border-radius: 999px; width: fit-content;
}
.showcase-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.showcase-price s { opacity: .75; font-size: 16px; }
.showcase-price strong { font-size: 34px; }
.showcase-info .size-badge { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: #fff; }
.showcase-info .btn { align-self: flex-start; margin-top: 6px; }

.showcase-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(10, 14, 26, .45); color: #fff; font-size: 26px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.showcase-arrow:hover { background: rgba(10, 14, 26, .7); }
.showcase-arrow.prev { left: 12px; }
.showcase-arrow.next { right: 12px; }

.showcase-dots {
    position: absolute; bottom: 12px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 8px;
}
.showcase-dot {
    width: 10px; height: 10px; border-radius: 999px; border: none; cursor: pointer;
    background: rgba(255, 255, 255, .45); transition: all .2s; padding: 0;
}
.showcase-dot.active { width: 26px; background: #fff; }

@media (max-width: 640px) {
    .showcase-slide { flex-direction: column; padding: 22px 18px; text-align: center; }
    .showcase-circle { width: 160px; height: 160px; }
    .showcase-info { padding: 8px 0 0; align-items: center; }
    .showcase-info h3 { font-size: 19px; }
    .showcase-info .btn { align-self: center; }
    .showcase-slide::before { top: -40%; left: -20%; width: 80%; height: 160%; }
    .showcase-arrow { width: 36px; height: 36px; font-size: 20px; }
}

/* lista de seleção da vitrine no painel */
.vitrine-lista {
    max-height: 300px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card);
}
.vitrine-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-bottom: 1px dashed var(--border); cursor: pointer;
}
.vitrine-item:hover { background: var(--bg-soft); }
.vitrine-item:last-child { border-bottom: none; }
.vitrine-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.vitrine-item input { width: 17px; height: 17px; accent-color: var(--primary); flex: none; }

/* produto clicável para ver a imagem inteira */
.catalog-product .product-photo { cursor: zoom-in; }

/* ============ Lightbox (imagem em tela cheia) ============ */

.lightbox {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(5, 8, 18, .92);
    display: flex; align-items: center; justify-content: center;
    padding: 30px; animation: fadeIn .18s ease;
}
.lightbox[hidden] { display: none !important; }
.lightbox img {
    max-width: 92vw; max-height: 88vh;
    object-fit: contain; border-radius: 14px;
    background: #fff; padding: 10px;
    box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .8);
    animation: slideUp .2s ease;
}
/* lightbox com detalhes do produto */
.lightbox-card {
    display: flex; gap: 22px; align-items: stretch;
    background: #fff; border-radius: 18px; overflow: hidden;
    max-width: 860px; width: 100%; box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .8);
    animation: slideUp .22s ease;
}
.lightbox-card img {
    width: 52%; max-height: 70vh; object-fit: contain; background: #f2f4fa;
    border-radius: 0; box-shadow: none; padding: 26px; margin: 0;
}
.lightbox-info {
    flex: 1; padding: 28px 26px 28px 6px; color: #1b2233;
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.lightbox-info h3 { font-size: 22px; }
.lightbox-info .muted { color: #667085; }
.lightbox-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lightbox-price strong { font-size: 30px; color: #4f46e5; }
.lightbox-price s { color: #98a2b3; font-size: 17px; }
.lightbox-info .btn { align-self: flex-start; margin-top: 6px; }
@media (max-width: 640px) {
    .lightbox-card { flex-direction: column; }
    .lightbox-card img { width: 100%; max-height: 44vh; padding: 14px; }
    .lightbox-info { padding: 18px 22px 22px; }
}
.lightbox-close {
    position: absolute; top: 20px; right: 22px;
    width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255, 255, 255, .14); color: #fff; font-size: 20px;
    transition: background .15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }

/* ============ Menu lateral de categorias (catálogo) ============ */

.catalog-layout { display: flex; gap: 20px; align-items: flex-start; }
.catalog-content { flex: 1; min-width: 0; }

.catalog-sidebar {
    width: 230px; flex: none; position: sticky; top: 84px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px;
}
.catalog-sidebar .sidebar-title {
    font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin-bottom: 10px; padding: 0 8px;
}
.side-cat-item {
    display: block; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; color: var(--muted);
    padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
    margin-bottom: 2px; transition: all .15s;
}
.side-cat-item:hover { background: var(--bg-soft); color: var(--text); }
.side-cat-item.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55); }

@media (max-width: 900px) {
    .catalog-sidebar { display: none; } /* no celular usa o menu ☰ Categorias do topo */
}
@media (min-width: 901px) {
    .cat-dropdown { display: none; } /* no desktop usa o menu lateral esquerdo */
}

/* código de pareamento do WhatsApp (Evolution API) */
.pairing-code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 17px; font-weight: 700; letter-spacing: 1px; line-height: 1.9;
    color: var(--primary); background: var(--bg-soft);
    border: 1px dashed var(--border); border-radius: 10px;
    padding: 14px; word-break: break-all; text-align: center;
}

/* Impressão (fallback do PDF) */
@media print {
    .sidebar, .topbar, .app-footer, .toasts, .toolbar { display: none !important; }
    .app-main { margin: 0 !important; }
    .page-content { padding: 0 !important; max-width: none !important; }
    body { background: #fff !important; }
}
