/* Tema "Bling": menu superior com Meu Negócio / Cadastros / Vendas / Estoque / Financeiro, páginas em cartões,
   formulários com campos de busca + cadastro rápido (+) e dashboards com comparação de períodos. */

:root {
  --brand: #1fa35a;
  --brand-dark: #178a4a;
  --brand-light: #5cc58a;
  --brand-tint: #e8f6ee;
  --brand-tint-2: #cdeedd;
  --bg: #f1f3f5;
  --border: #e3e7eb;
  --border-strong: #cfd6dc;
  --text: #2b3440;
  --text-2: #5d6875;
  --text-3: #8a95a1;
  --radius-lg: 16px;
  --topnav-h: 64px;
}

body { background: var(--bg); color: var(--text); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ── Estrutura ────────────────────────────────────────── */
.app { display: block; min-height: 100vh; }
.topnav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; height: var(--topnav-h); padding: 0 22px;
  background: #fff; border-bottom: 1px solid var(--border); border-radius: 0 0 22px 22px; box-shadow: 0 3px 14px rgba(43, 52, 64, 0.06);
}
.topnav .brand { height: auto; padding: 0; border: 0; gap: 9px; }
.topnav .brand img { width: 40px; height: 40px; }
.nav-main { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.nav-menu { position: relative; }
.nav-top {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: none;
  color: var(--text); font: 600 14.5px inherit; cursor: pointer; position: relative;
}
.nav-top .ico { color: var(--text-3); transition: transform 0.15s; }
.nav-top:hover, .nav-menu.open .nav-top { background: var(--brand-tint); }
.nav-menu.active .nav-top { color: var(--brand-dark); }
.nav-menu.active .nav-top::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--brand); }
.nav-menu.open .nav-top .ico { transform: rotate(180deg); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); position: absolute; top: 8px; right: 6px; }
.nav-panel {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); min-width: 270px; padding: 8px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(43, 52, 64, 0.16); z-index: 60;
}
.nav-menu.open .nav-panel { display: block; }
@media (hover: hover) { .nav-menu:hover .nav-panel { display: block; } }
.nav-panel hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: 14px; font-weight: 550; }
.nav-link .ico { color: var(--text-3); }
.nav-link span { flex: 1; }
.nav-link:hover { background: var(--brand-tint); }
.nav-link:hover .ico { color: var(--brand-dark); }
.nav-link.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; }
.nav-link.active .ico { color: var(--brand); }
.nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; }

.topnav .search-trigger { flex: 1; max-width: 440px; margin-left: auto; height: 40px; width: auto; background: #f1f3f5; border: 1px solid transparent; border-radius: 12px; }
.topnav .search-trigger:hover { background: #e9edf0; border-color: var(--border); }
.topnav-actions { display: flex; align-items: center; gap: 6px; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--text-2); }
.round-btn:hover { background: var(--brand-tint); color: var(--brand-dark); }
.round-btn.accent { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-tint); }
.round-btn.accent:hover { background: var(--brand-dark); color: #fff; }
.topnav .bell { color: var(--text-2); }
.user-btn strong { font-size: 14px; }
.new-menu { right: 0; left: auto; }

.page { display: flex; gap: 20px; align-items: flex-start; max-width: 1700px; margin: 0 auto; padding: 16px 22px 40px; }
.subnav { display: none; width: 260px; flex: none; position: sticky; top: calc(var(--topnav-h) + 16px); }
.page.has-subnav .subnav { display: block; }
.page.has-subnav.subnav-collapsed .subnav { width: 56px; }
.page.has-subnav.subnav-collapsed .subnav-card { display: none; }
.subnav-toggle { position: absolute; right: -14px; top: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(43, 52, 64, 0.12); }
.page.has-subnav.subnav-collapsed .subnav-toggle { right: 0; }
.subnav-card { background: #fff; border-radius: 16px; padding: 14px; border: 1px solid var(--border); display: grid; gap: 4px; }
.sub-group { display: grid; gap: 2px; margin-bottom: 4px; }
.sub-title, .sub-link { display: flex; align-items: center; gap: 12px; padding: 10px 10px; font-weight: 700; font-size: 15px; color: var(--text); border-radius: 10px; }
.sub-title .ico, .sub-link .ico { color: var(--text-2); }
.sub-link:hover { background: var(--brand-tint); }
.sub-item { display: flex; align-items: center; gap: 8px; margin-left: 38px; padding: 8px 12px; border-radius: 9px; font-size: 14px; color: var(--text-2); font-weight: 550; }
.sub-item:hover { background: var(--bg); }
.sub-item.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; margin-left: 10px; padding-left: 14px; }
.view { flex: 1; min-width: 0; padding: 0; max-width: none; margin: 0; }

/* ── Cabeçalho da página ──────────────────────────────── */
.page-head { margin-bottom: 14px; align-items: center; }
.crumb { display: flex; align-items: center; gap: 6px; color: var(--text-3); }
.crumb-dots { font-size: 22px; font-weight: 700; color: var(--brand); line-height: 1; }
.crumb h1 { font-size: 28px; font-weight: 700; color: #3a4350; letter-spacing: -0.02em; }
.page-head p { margin-top: 2px; color: var(--text-2); }
.btn.ghost-green { background: #fff; border: 1.5px solid var(--brand); color: var(--brand-dark); }
.btn.ghost-green:hover:not(:disabled) { background: var(--brand-tint); }
.btn.primary { background: var(--brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn { border-radius: 10px; font-weight: 700; }
.bl-howto { border-color: var(--brand); color: var(--brand-dark); }

/* ── Cartões e listas ─────────────────────────────────── */
.bl-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; }
.bl-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bl-card h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #3a4350; }
.bl-card h3 .ico { color: var(--brand); }
.list-card { padding: 0; overflow: hidden; }
.bl-listbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); background: #fcfdfd; }
.bl-listbar .search-box { flex: 1; min-width: 220px; }
.bl-inline-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.bl-inline-date input { height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 8px; background: #fff; }
.bl-table th { background: #f7f9fa; font-size: 12px; color: var(--text-2); text-transform: none; letter-spacing: 0; font-weight: 700; }
.bl-table td, .bl-table th { padding: 12px 16px; }
.bl-table tfoot td { background: #f7f9fa; border-top: 1px solid var(--border); }
.table .num { text-align: right; white-space: nowrap; }
.num-link { color: var(--brand-dark); }
.num-link:hover strong { text-decoration: underline; }
.table tr.dim { opacity: 0.6; }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 #d6544a; }
.ok-text { color: var(--ok); display: inline-flex; gap: 5px; align-items: center; }
.qimg { width: 64px; }
.qimg img { width: 52px; height: 42px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 2px; display: block; }
.card-grid.inner { padding: 16px; margin: 0; }

/* ── KPIs, metas e gráficos ───────────────────────────── */
.bl-grid-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bl-grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.bl-grid-2.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.bl-grid-2 > .bl-card, .bl-grid-main > .bl-card { margin-bottom: 0; }
.bl-grid-2 { margin-bottom: 16px; }
.bl-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.bl-grid-main .bl-kpis { margin-bottom: 0; }
.bl-kpis.small { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.bl-kpi { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px 20px; }
.bl-kpi-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.bl-kpi-main { display: flex; flex-direction: column; min-width: 0; }
.bl-kpi-main strong { font-size: 28px; line-height: 1.1; letter-spacing: -0.02em; color: #2b3440; white-space: nowrap; }
.bl-kpi-main small { color: var(--text-2); font-size: 14px; }
.bl-kpi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.bl-kpi-side em { font-style: normal; color: var(--text-2); }
.bl-delta { font-weight: 800; }
.bl-delta.up { color: var(--ok); }
.bl-delta.down { color: var(--bad); }
.bl-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #e8ecef; overflow: hidden; margin-top: 8px; }
.bl-bar b { display: block; height: 100%; background: var(--brand-light); border-radius: 4px; }
.bl-goal { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); position: relative; }
.bl-goal:last-child { border-bottom: 0; }
.bl-goal small { display: block; color: var(--text-3); }
.bl-goal-bar { height: 10px; background: #e8ecef; border-radius: 5px; overflow: hidden; }
.bl-goal-bar i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.bl-goal > .btn { position: absolute; right: 0; top: 8px; }
.bl-empty-goal { display: grid; justify-items: center; gap: 10px; padding: 28px 10px; text-align: center; color: var(--text-2); }
.bl-empty-goal .ico { color: var(--brand); }
.bl-empty-chart { display: grid; justify-items: center; gap: 6px; padding: 50px 10px; color: var(--text-2); text-align: center; }
.bl-empty-chart .ico { color: var(--brand); }
.bl-empty-chart strong { color: var(--text); font-size: 17px; }
.bl-legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.bl-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; }
.bl-legend i.prev { background: #a8dfc0; }
.bl-legend i.cur { background: var(--brand); }
.bl-line { width: 100%; height: auto; }
.bl-line text { font-size: 11px; fill: var(--text-3); }
.bl-line .grid { stroke: #e8ecef; stroke-width: 1; }
.bl-line .cur { fill: none; stroke: var(--brand); stroke-width: 2.6; stroke-linejoin: round; }
.bl-line .prev { fill: none; stroke: #a8dfc0; stroke-width: 2.4; stroke-dasharray: 5 4; }
.bl-line .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.bl-donut { display: grid; justify-items: center; gap: 16px; }
.bl-donut svg { width: 180px; height: 180px; }
.bl-donut .total { font-size: 26px; font-weight: 800; fill: #2b3440; }
.bl-donut ul { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.bl-donut li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; font-size: 14px; }
.bl-donut li i { width: 12px; height: 12px; border-radius: 50%; }
.bl-donut li em { font-style: normal; color: var(--text-3); min-width: 110px; text-align: right; }
.bl-map { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; align-items: start; }
.uf-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.uf { aspect-ratio: 1 / 0.82; border-radius: 8px; background: #eef2f4; color: var(--text-3); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.uf.has { background: rgba(31, 163, 90, calc(0.18 + var(--lvl, 0) * 0.82)); color: #fff; }
.uf-list { display: grid; gap: 8px; font-size: 13.5px; }
.uf-list div { display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.uf-list strong { grid-column: 2; }
.uf-list span { color: var(--text-3); }
.bl-share { position: relative; height: 22px; background: #eef2f4; border-radius: 6px; overflow: hidden; min-width: 120px; }
.bl-share i { position: absolute; inset: 0 auto 0 0; background: var(--brand-tint-2); }
.bl-share span { position: relative; padding-left: 8px; font-size: 12px; font-weight: 700; line-height: 22px; }

/* ── Filtros do dashboard ─────────────────────────────── */
.bl-filters { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.bl-field { display: grid; gap: 5px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.bl-field.grow { flex: 1; min-width: 280px; }
.bl-chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 42px; padding: 6px 8px; background: #fff; border: 1px solid var(--border-strong); border-radius: 10px; align-items: center; }
.bl-chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 6px; border: 0; background: #eef1f3; color: var(--text-3); font: 600 13px inherit; cursor: pointer; }
.bl-chip.on { background: var(--brand-tint); color: var(--brand-dark); }
.bl-range { display: flex; align-items: center; gap: 8px; }
.bl-range em { font-style: normal; color: var(--text-3); }
.bl-field input[type=date] { height: 42px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 12px; background: #fff; font: inherit; color: var(--text); }
.bl-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border-strong); margin: 14px 0 16px; overflow-x: auto; }
.bl-tabs button { height: 44px; border: 0; background: none; font: 600 15px inherit; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.bl-tabs button.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.bl-tabs.strong { border-bottom: 1px solid var(--border); margin: 0; padding: 0 8px; }

/* ── Formulário (pedido de venda e cadastros) ─────────── */
.field { display: grid; gap: 6px; position: relative; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.req { color: #d6403a; }
.info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #29a3e0; color: #fff; font: 700 10px/1 inherit; font-style: normal; cursor: help; }
.field input:not([type=checkbox]):not([type=hidden]), .field select, .field textarea, .static-input {
  width: 100%; min-height: 42px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: #fff; padding: 8px 12px; font: 400 14px inherit; color: var(--text); outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 163, 90, 0.14); }
.static-input { background: #f4f6f8 !important; color: var(--text-2) !important; }
.form-card { padding: 20px 22px; }
.section-title { font-size: 18px; font-weight: 700; margin: 0 0 14px; color: #3a4350; }
.grid-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.grid-fields > .span-3 { grid-column: span 3; }
.terms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 10px; }
.terms-grid .field-label { justify-content: space-between; }
.pedido-head .page-actions { align-items: center; }
.req-note { color: var(--text-2); font-size: 13px; flex-basis: 100%; text-align: right; }
.tabs-card { padding: 0; }
.tabs-card .tab-pane { padding: 20px 22px 24px; }
.item-add { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.item-add .lookup { flex: 1; min-width: 280px; max-width: 560px; }
.qtable input { width: 100%; min-height: 38px; border: 1.5px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; font: inherit; background: #fff; }
.qtable input[readonly] { background: #f4f6f8; border-color: transparent; text-align: right; font-weight: 700; }
.qtable .qnum { width: 140px; }
.qtable .qnum input { text-align: right; }
.qtable .qdesc small { color: var(--text-3); }
.qtable td { vertical-align: middle; }
.qact { width: 52px; text-align: right; }
.item-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 14px; flex-wrap: wrap; }
.field.narrow { width: 200px; }
.qtotals { display: grid; gap: 4px; text-align: right; font-size: 14px; }
.qtotals .grand { font-size: 16px; }
.qtotals .grand strong { font-size: 24px; color: var(--brand-dark); margin-left: 10px; }
.qtotals .neg { color: var(--bad); }
.commission-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 12px; }
.commission-box > div { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fafbfc; display: grid; gap: 4px; }
.commission-box small { color: var(--text-3); }
.commission-box strong { font-size: 22px; }
.form-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0 24px; }
.form-footer .left, .form-footer .right { display: flex; gap: 8px; flex-wrap: wrap; }
.form-footer .wa-ico { width: 17px; height: 17px; }

/* campo de busca com + */
.lookup-box { display: flex; align-items: stretch; border: 1.5px solid var(--border-strong); border-radius: 10px; background: #fff; overflow: hidden; }
.lookup:focus-within .lookup-box { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 163, 90, 0.14); }
.field .lookup-input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; border-radius: 0 !important; }
.lookup-add, .lookup-icon, .lookup-clear { border: 0; background: none; display: inline-flex; align-items: center; gap: 2px; padding: 0 12px; color: var(--brand); cursor: pointer; }
.lookup-icon { color: var(--text-3); cursor: default; }
.lookup-add { border-left: 1px solid var(--border); }
.lookup-add b { font-size: 18px; line-height: 1; margin-left: -2px; }
.lookup-add:hover { background: var(--brand-tint); }
.lookup-clear { padding: 0 8px; color: var(--text-3); }
.lookup-clear:hover { color: var(--bad); }
.lookup-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 80; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 34px rgba(43, 52, 64, 0.18); max-height: 320px; overflow-y: auto; padding: 6px; }
.lookup-menu[hidden] { display: none; }
.lookup-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; }
.lookup-item small { color: var(--text-3); }
.lookup-item:hover { background: var(--brand-tint); }
.lookup-item.is-dim { opacity: 0.6; }
.lookup-item.add { flex-direction: row; align-items: center; gap: 8px; color: var(--brand-dark); font-weight: 700; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px; }
.lookup-empty { margin: 0; padding: 12px; color: var(--text-3); font-size: 13.5px; }

/* modal em pilha e listas */
.modal-backdrop { z-index: 70; }
.seg-list { list-style: none; margin: 0; padding: 0; }
.seg-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.seg-list li:last-child { border-bottom: 0; }
.seg-list small { display: block; color: var(--text-3); }
.seg-actions { display: flex; gap: 2px; }

/* destaques no tom verde */
.nav-item.active { background: var(--brand-tint); }
.kpi-ico.tone-blue { background: var(--brand-tint); color: var(--brand-dark); }
.tone-green { background: var(--brand-tint); color: var(--brand-dark); }
.bl-kpi-ico.tone-blue { background: #e4f1fb; color: #2b7bb9; }
.bl-kpi-ico.tone-green { background: var(--brand-tint); color: var(--brand-dark); }
.bl-kpi-ico.tone-amber { background: #fdf3df; color: #b8791a; }
.bl-kpi-ico.tone-violet { background: #eeeaf8; color: #6b5fa8; }

/* ── Responsivo ───────────────────────────────────────── */
@media (max-width: 1280px) {
  .bl-grid-main, .bl-grid-2, .bl-grid-2.wide-left { grid-template-columns: 1fr; }
  .grid-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-fields > .span-3 { grid-column: span 2; }
  .terms-grid { grid-template-columns: 1fr; }
  .nav-top { padding: 0 10px; font-size: 14px; }
}
@media (max-width: 980px) {
  .topnav { padding: 0 12px; border-radius: 0 0 16px 16px; }
  .nav-main {
    display: none; position: fixed; left: 8px; right: 8px; top: calc(var(--topnav-h) + 8px); z-index: 70; flex-direction: column; align-items: stretch;
    background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 8px; box-shadow: 0 20px 50px rgba(43, 52, 64, 0.25); max-height: 75vh; overflow-y: auto;
  }
  .app.nav-open .nav-main { display: flex; }
  .nav-menu .nav-panel { position: static; display: none; box-shadow: none; border: 0; padding: 0 0 6px 10px; }
  .nav-menu.open .nav-panel { display: block; }
  .nav-top { width: 100%; justify-content: space-between; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(43, 52, 64, 0.4); z-index: 55; }
  .topnav .btn.menu-btn { display: inline-flex; }
  .topnav .brand-text { display: none; }
  .topnav .search-trigger { max-width: none; }
  .page { padding: 12px; flex-direction: column; }
  .subnav { position: static; width: 100% !important; }
  .page.has-subnav .subnav-card { display: flex; flex-wrap: wrap; }
  .subnav-toggle { display: none; }
  .bl-map { grid-template-columns: 1fr; }
  .bl-kpis { grid-template-columns: 1fr; }
  .commission-box { grid-template-columns: 1fr; }
  .crumb h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  .grid-fields { grid-template-columns: 1fr; }
  .grid-fields > .span-3 { grid-column: auto; }
  .topnav-actions .round-btn.flat { display: none; }
  .bl-kpi { grid-template-columns: auto 1fr; }
  .bl-kpi-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
}

/* ── Ajustes para celular ─────────────────────────────── */
@media (max-width: 980px) {
  .app, .page, .view { min-width: 0; width: 100%; }
  .page.has-subnav .subnav-card {
    display: flex; flex-wrap: nowrap; gap: 6px; max-width: 100%; padding: 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .subnav-card .sub-group { display: contents; }
  .subnav-card .sub-title { display: none; }
  .subnav-card .sub-link, .subnav-card .sub-item {
    flex: none; min-height: 40px; margin: 0; padding: 8px 12px; white-space: nowrap;
  }
  .subnav-card .sub-item.active { margin: 0; padding: 8px 12px; }
  .table-wrap { max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .bl-listbar > * { min-width: 0; }
}

@media (max-width: 640px) {
  .topnav { gap: 6px; height: 58px; padding: 0 8px; }
  .topnav .brand img { width: 34px; height: 34px; }
  .topnav .btn.menu-btn, .topnav-actions .round-btn, .topnav-actions .user-btn { min-width: 40px; min-height: 40px; }
  .topnav .search-trigger { min-width: 38px; justify-content: center; padding: 0 9px; }
  .topnav .search-trigger span { display: none; }
  .form input, .form select, .form textarea { font-size: 16px; }
  .topnav-actions { gap: 2px; }
  .topnav-actions .menu-wrap { flex: none; }
  .nav-main { top: calc(58px + 8px); max-height: min(75dvh, 620px); }
  .nav-top, .nav-link { min-height: 44px; }
  .page { gap: 10px; padding: 8px 10px 28px; }
  .view { padding: 12px 2px 24px; }
  .page-head { align-items: stretch; gap: 10px; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions > .btn { flex: 1 1 auto; }
  .bl-card { padding: 14px; }
  .bl-listbar { align-items: stretch; padding: 12px; }
  .bl-listbar .search-box { flex: 1 1 100%; min-width: 100%; }
  .bl-inline-date { flex-wrap: wrap; }
  .bl-inline-date input { min-width: 0; max-width: 100%; }
  .bl-kpi { padding: 14px; }
  .bl-kpi-main strong { font-size: clamp(21px, 7vw, 28px); overflow-wrap: anywhere; }
  .modal-backdrop { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .modal { max-height: calc(100dvh - 16px); overflow-y: auto; border-radius: 14px; }
  .modal-body { overflow-x: auto; }
  .form-actions, .modal .form-actions { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
  .pager { justify-content: center; flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .topnav .btn.menu-btn { padding: 0 8px; }
  .page { padding-inline: 8px; }
  .bl-card { padding: 12px; }
  .bl-table td, .bl-table th { padding: 10px; }
}

/* células de ações em tabelas (mantêm o layout de tabela) */
.table td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
.table td.row-actions > * { vertical-align: middle; margin-left: 4px; }
.table td.row-actions .btn.icon { display: inline-grid; }

/* Sistema: alertas, backups e auditoria */
.bl-card-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.bl-listbar .spacer { flex: 1; }
.bl-card .hint.pad { padding: 14px 16px; line-height: 1.55; }
.sys-warnings { padding: 14px 18px; margin-bottom: 14px; border-left: 4px solid #e0a100; background: #fffaf0; }
.sys-warnings h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; color: #8a5a00; }
.sys-warnings ul { margin: 0; padding-left: 20px; color: #5c4a1c; font-size: 13px; line-height: 1.6; }

/* Contrato: assinatura eletrônica e validação */
.signer-rows { display: grid; gap: 8px; margin: 10px 0; }
.signer-row { display: grid; grid-template-columns: 170px 1.4fr 1.2fr 1fr auto; gap: 8px; align-items: center; }
.signer-row input, .signer-row select { min-width: 0; }
.sign-list { list-style: none; margin: 10px 0 16px; padding: 0; display: grid; gap: 8px; }
.sign-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; flex-wrap: wrap; }
.sign-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sign-modal code, .validate-box code { font-size: 11.5px; word-break: break-all; }
.check-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.check-list li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check-list li.ok svg { color: #1fa35a; }
.check-list li.bad svg { color: #c0392b; }
.form-actions .spacer { flex: 1; }
@media (max-width: 760px) { .signer-row { grid-template-columns: 1fr 1fr; } }

/* Financeiro e estoque */
.flow-chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 12px 6px 4px; overflow-x: auto; }
.flow-col { flex: 1 0 44px; display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; text-align: center; }
.flow-bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 100%; }
.flow-bar { width: 16px; border-radius: 4px 4px 0 0; min-height: 0; }
.flow-bar.in { background: var(--green, #1fa35a); }
.flow-bar.out { background: #e0653f; }
.flow-col small { color: var(--text-2, #5a6b61); font-size: 11.5px; }
.flow-legend { display: flex; gap: 16px; padding: 6px 8px 12px; font-size: 12.5px; color: var(--text-2, #5a6b61); }
.flow-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.flow-legend i.in { background: var(--green, #1fa35a); }
.flow-legend i.out { background: #e0653f; }
.flow-overdue { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.num.neg, td.neg { color: #c0392b; }
.pix-box { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.pix-qr svg { width: 100%; height: auto; background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 6px; }
.pix-info textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.form-section { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2, #5a6b61); }
.seg.tabs { margin: 6px 0 12px; }
.sys-env { color: #8a5a00; }
@media (max-width: 760px) { .pix-box { grid-template-columns: 1fr; } }
