/* Tokens em shared/theme.css — carregado em paralelo pelo index.html. */

/* ==========================================================================
   A7SYSTEM — estilos da aplicação
   Tudo aqui consome os tokens de shared/theme.css (claro e escuro).
   Seções: base · shell · navegação · página · componentes · formulários ·
   tabelas · modal/toast · estados · PDV · financeiro · registros · login · mídia
   ========================================================================== */

/* ------------------------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-family);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
body.modal-aberto { overflow: hidden; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 9999; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
.num, td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: var(--fs-sm); }
.texto-perigo { color: var(--danger); font-weight: 600; }
.texto-ok { color: var(--success); font-weight: 600; }
.texto-aviso { color: var(--warning); font-weight: 600; }

/* ------------------------------------------------------------ Shell (barra) */
#app-container { min-height: 100vh; display: flex; flex-direction: column; }

.global-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-3);
  background: var(--shell-bg);
  color: var(--shell-fg);
  border-bottom: 1px solid var(--shell-border, rgba(255,255,255,.08));
  box-shadow: inset 0 -2px 0 0 var(--brand-mark);   /* fio vermelho da marca */
}
.gh-left, .gh-right { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.gh-right { margin-left: auto; }
.gh-search { flex: 1; max-width: 560px; min-width: 0; display: none; }

.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding-right: var(--sp-2); }
.brand-mark { display: inline-flex; color: #fff; }
.brand-text { display: none; flex-direction: column; line-height: 1.05; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.18); }
.brand-text strong { font-size: 13px; letter-spacing: .28em; font-weight: 700; }
.brand-text small { font-size: 10.5px; color: var(--shell-muted); letter-spacing: .04em; margin-top: 3px; }

.gh-icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); color: var(--shell-fg);
  transition: background var(--t-fast);
}
.gh-icon-btn:hover { background: var(--shell-hover); }

.global-search { position: relative; display: flex; align-items: center; }
.global-search .gs-icon { position: absolute; left: 11px; color: var(--shell-muted); display: flex; pointer-events: none; }
.global-search input {
  width: 100%; height: 36px; padding: 0 64px 0 34px;
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,.1);
  background: var(--shell-input); color: var(--shell-fg); font-size: var(--fs-sm);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.global-search input::placeholder { color: var(--shell-muted); }
.global-search input:focus { outline: none; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); }
.global-search input::-webkit-search-cancel-button { display: none; }
.gs-kbd { position: absolute; right: 8px; font: 600 10.5px var(--font-family); color: var(--shell-muted); border: 1px solid rgba(255,255,255,.18); border-radius: 4px; padding: 2px 6px; }
.gs-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: var(--z-dropdown);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 6px; max-height: 70vh; overflow-y: auto;
}
.gs-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius); }
.gs-item.active, .gs-item:hover { background: var(--surface-3); }
.gs-item-icon { width: 28px; height: 28px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; background: var(--obj); color: #fff; }
.gs-item-text { display: flex; flex-direction: column; min-width: 0; }
.gs-item-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-text small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 14px; color: var(--muted); text-align: center; }

.empresa-switch {
  display: none; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px;
  border-radius: var(--radius); background: var(--shell-input); border: 1px solid rgba(255,255,255,.1);
  color: var(--shell-muted); cursor: pointer;
}
.empresa-switch select {
  background: transparent; border: 0; color: var(--shell-fg); font-weight: 500; font-size: var(--fs-sm);
  max-width: 180px; height: 34px; cursor: pointer; text-overflow: ellipsis;
}
.empresa-switch select:focus { outline: none; }
.empresa-switch option { color: #18181b; }

.btn-brand-inverse { display: none !important; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px; border-radius: var(--radius); color: var(--shell-fg); }
.user-btn:hover { background: var(--shell-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3f3f46, #18181b); color: #fff; font-size: 12px; font-weight: 700;
  box-shadow: 0 0 0 2px var(--brand-mark);
}
.user-profile-name { display: none; font-weight: 500; font-size: var(--fs-sm); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown); min-width: 240px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 6px;
}
.dropdown-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.dropdown-head small { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); }
.dropdown-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); text-align: left; }
.dropdown-item:hover { background: var(--surface-3); }

/* ------------------------------------------------------------- Navegação */
.app-body { flex: 1; display: flex; min-height: 0; }

.side-nav {
  position: fixed; z-index: var(--z-drawer); top: 0; bottom: 0; left: 0;
  width: min(280px, 86vw);
  background: var(--nav-bg); color: var(--nav-fg);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform var(--t), width var(--t);
  border-right: 1px solid rgba(255,255,255,.06);
}
.side-nav.open { transform: translateX(0); box-shadow: var(--shadow-3); }
.side-nav-scroll { flex: 1; overflow-y: auto; padding: 12px 8px; scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--nav-muted); padding: 4px 12px 6px; white-space: nowrap;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 12px; border-radius: var(--radius);
  color: var(--nav-fg); font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--nav-hover); color: #fff; }
.nav-item .nav-icon { display: inline-flex; color: var(--nav-muted); transition: color var(--t-fast); }
.nav-item:hover .nav-icon { color: #fff; }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-fg); }
.nav-item.active::before {
  content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-mark);
}
.nav-item.active .nav-icon { color: var(--brand-mark); }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.side-nav-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.07); }
.nav-collapse { display: none; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--nav-muted); }
.nav-collapse:hover { background: var(--nav-hover); color: #fff; }
.nav-version { font-size: 11px; color: var(--nav-muted); }

.sidebar-backdrop {
  position: fixed; inset: 0; z-index: var(--z-drawer-backdrop);
  background: rgba(9, 9, 11, .55); opacity: 0; pointer-events: none; transition: opacity var(--t);
}
.sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

/* ----------------------------------------------------------------- Página */
#page-content {
  flex: 1; min-width: 0; width: 100%;
  padding: var(--sp-4) var(--sp-4) var(--sp-10);
  outline: none;
}
.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.page-title-area { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.object-icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--obj, var(--brand)); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.object-icon.lg { width: 48px; height: 48px; border-radius: var(--radius-lg); }
.page-title-text { min-width: 0; }
.page-title-text h1 { font-size: var(--fs-xl); font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-subtitle { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.page-actions .form-control { width: auto; }

/* Registro (Record Home) */
.record-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1); margin-bottom: var(--sp-4); overflow: hidden;
}
.record-top { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between; align-items: flex-start; padding: var(--sp-4); }
.record-object { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.highlights {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.highlight { padding: 12px var(--sp-4); border-right: 1px solid var(--border); min-width: 0; }
.highlight:last-child { border-right: 0; }
.highlight dt { font-size: var(--fs-xs); color: var(--muted); }
.highlight dd { font-size: var(--fs-md); font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.highlight small { color: var(--muted); font-size: var(--fs-xs); }
.record-link { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 45%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.record-link:hover { color: var(--brand); text-decoration-color: var(--brand); }

.layout-registro { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); align-items: start; }
.painel-lateral .card { margin-bottom: var(--sp-4); }
.detalhes { display: grid; grid-template-columns: 1fr; gap: 10px; }
.detalhes div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.detalhes dt { font-size: var(--fs-xs); color: var(--muted); }
.detalhes dd { word-break: break-word; }

/* ------------------------------------------------------------- Componentes */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1); padding: var(--sp-4); margin-bottom: var(--sp-4); min-width: 0;
}
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.card-title { font-size: var(--fs-md); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--muted); }
.card-sub { font-size: var(--fs-xs); color: var(--muted); }
.card.flush { padding: 0; }
.card.flush > .card-header { padding: var(--sp-3) var(--sp-4); margin: 0; border-bottom: 1px solid var(--border); }
.card.flush > .table-responsive { margin: 0; }

.responsive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--sp-4); }
.responsive-grid > .card { margin-bottom: 0; }
.responsive-grid + .card, .responsive-grid + .responsive-grid { margin-top: var(--sp-4); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--brand); color: var(--text-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-secondary { background: var(--text); color: var(--surface); }
.btn-secondary:hover:not(:disabled) { opacity: .9; }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
/* Ação destrutiva: contorno + ícone, para não se confundir com o vermelho da marca */
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { height: 30px; min-width: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-md); }
.btn-block { width: 100%; }

/* Selos */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }

/* Abas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  position: relative; height: 40px; padding: 0 14px; color: var(--muted); font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.tab-count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 1px 7px; border-radius: var(--radius-full); }
.card > .tabs { margin: calc(var(--sp-4) * -1) calc(var(--sp-4) * -1) var(--sp-4); padding: 0 var(--sp-2); }

/* Indicadores */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.kpi-tile {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1); padding: 14px var(--sp-4); min-width: 0;
}
.kpi-tile.is-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.kpi-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.kpi-ico { width: 28px; height: 28px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; color: var(--obj); background: color-mix(in srgb, var(--obj) 12%, transparent); }
.kpi-value { font-size: var(--fs-lg); font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-detail { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.kpi-detail a { position: relative; z-index: 2; color: var(--link); text-decoration: underline; }

/* Resumos antigos (.resumo .item) no mesmo visual */
.resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.resumo .item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.resumo .item span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.resumo .item strong { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; margin-top: 2px; }
.resumo .item small { display: block; margin-top: 2px; }

.totais { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin: var(--sp-3) 0; font-variant-numeric: tabular-nums; }
.totais .total-geral { font-size: var(--fs-xl); font-weight: 700; }

/* Estados */
.state { text-align: center; padding: var(--sp-10) var(--sp-4); max-width: 520px; margin: var(--sp-8) auto; }
.state-icon { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); margin-bottom: var(--sp-3); }
.state-erro .state-icon { background: var(--danger-soft); color: var(--danger); }
.state h2 { font-size: var(--fs-lg); }
.state p { color: var(--muted); margin-top: 6px; }
.state-actions { margin-top: var(--sp-4); display: flex; gap: 8px; justify-content: center; }
.empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--muted); }
.empty-icon { display: inline-flex; width: 48px; height: 48px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-3); margin-bottom: 8px; }

/* Skeleton */
@keyframes sk { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.sk-line, .sk-box, .sk-card {
  display: block; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-3) 0, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 600px 100%; animation: sk 1.2s linear infinite;
}
.skeleton-list { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-2) 0; }
.sk-line { height: 14px; }
.sk-line.w40 { width: 40%; height: 22px; }
.skeleton-page .sk-header { display: flex; gap: 12px; align-items: center; margin-bottom: var(--sp-4); }
.sk-box { width: 40px; height: 40px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.sk-card { height: 86px; border-radius: var(--radius-lg); }
.sk-panel { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-4); }

/* ------------------------------------------------------------ Formulários */
.form-group { margin-bottom: var(--sp-3); min-width: 0; }
.form-label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-control {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.form-control { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; }
select.form-control { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.form-control:hover { border-color: var(--muted); }
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }
.form-control[readonly] { background: var(--surface-2); }
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.form-help { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); }
.form-alert {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius); padding: 10px 12px; font-size: var(--fs-sm); margin-bottom: var(--sp-3);
}
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.checks-grid label.check { margin: 0; }
label.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 var(--sp-3); }
.form-grid > * { grid-column: span 12; }
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: flex-end; margin-bottom: var(--sp-3); }
.filters .form-group { margin-bottom: 0; flex: 1 1 150px; }
.filters .grow { flex: 3 1 240px; }
.filters label.check { margin-bottom: 8px; }
.input-with-action { display: flex; gap: var(--sp-2); }
.input-with-action .form-control { flex: 1; min-width: 0; }
.input-action-btn { padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.input-action-btn:hover { background: var(--surface-3); }

/* Autocompletar */
.ac-wrap { position: relative; width: 100%; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: var(--z-dropdown);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3); max-height: 300px; overflow-y: auto; padding: 4px;
}
.ac-list li { padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; border-radius: var(--radius); }
.ac-list li small { color: var(--muted); font-size: var(--fs-xs); }
.ac-list li.active, .ac-list li:hover { background: var(--surface-3); }
.ac-list li.ac-empty { cursor: default; color: var(--muted); }

/* Product row in autocomplete (PDV) */
.ac-list li:has(.ac-prod-row) { padding: 6px 8px; }
.ac-prod-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.ac-prod-foto { width: 38px; height: 38px; border-radius: var(--radius); border: 1px solid var(--border);
  object-fit: cover; flex-shrink: 0; }
span.ac-prod-foto { display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  background: var(--surface-2); }
.ac-prod-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ac-prod-info strong { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-prod-info small { font-size: var(--fs-xs); }
.ac-prod-un { font-size: var(--fs-xs); flex-shrink: 0; text-align: center; min-width: 28px; }
.ac-prod-preco { font-weight: 600; font-size: var(--fs-sm); flex-shrink: 0; white-space: nowrap; color: var(--text); }

/* ---------------------------------------------------------------- Tabelas */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: var(--sp-3); }
.card.flush .table-responsive { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
th, td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--surface-2); }
td .acoes { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
td .acoes-icones { flex-wrap: nowrap; }
.btn-icone { padding: 0; width: 30px; }
tr.linha-alerta td { background: var(--danger-soft); }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }
.itens-edit input.form-control { min-width: 76px; height: 32px; padding: 0 8px; font-size: var(--fs-sm); text-align: right; }
.itens-edit td { vertical-align: middle; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.pager-info { margin-right: auto; color: var(--muted); font-size: var(--fs-xs); }

/* ------------------------------------------------------------ Modal/toast */
#modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal-backdrop);
  background: rgba(9, 9, 11, .6); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: var(--sp-3);
}
#modal-overlay.active { display: flex; animation: fade var(--t-fast); }
.modal-content {
  width: 100%; max-width: min(96vw, 560px); max-height: 92dvh; overflow-y: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: var(--sp-5);
  animation: sobe var(--t);
}
.modal-content.modal-lg { max-width: min(96vw, 1000px); }
.modal-body h3 { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
.modal-body p { color: var(--text-2); margin-bottom: var(--sp-3); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.modal-head h3 { margin-bottom: var(--sp-3); }
.modal-x { width: 32px; height: 32px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); margin: -6px -6px 0 0; }
.modal-x:hover { background: var(--surface-3); color: var(--text); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding-top: var(--sp-4); margin-top: var(--sp-3); border-top: 1px solid var(--border); }
.modal-confirm { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; align-items: start; }
.modal-confirm .modal-actions { grid-column: 1 / -1; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--warning-soft); color: var(--warning); display: inline-flex; align-items: center; justify-content: center; }
.modal-confirm p { margin-top: 9px; }
.secao { margin-top: var(--sp-4); }
.secao h4 { margin-bottom: var(--sp-2); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

#toast-container { position: fixed; z-index: var(--z-toast); top: calc(var(--header-h) + 12px); right: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 420px; width: 100%;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--info);
  border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 12px 14px; font-size: var(--fs-sm);
  animation: sobe var(--t); transition: opacity var(--t), transform var(--t);
}
.toast.saindo { opacity: 0; transform: translateX(12px); }
.toast-icon { display: inline-flex; color: var(--info); }
.toast.success { border-left-color: var(--success); } .toast.success .toast-icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); } .toast.error .toast-icon { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); } .toast.warning .toast-icon { color: var(--warning); }

#loading-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand); animation: gira .8s linear infinite; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sobe { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes gira { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------- PDV */
.pdv { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); align-items: start; }
.pdv .card { margin-bottom: 0; }
.pdv-main { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.pdv-side { display: flex; flex-direction: column; gap: var(--sp-4); }
.pdv-cliente { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); margin-top: var(--sp-2); }
.pdv-cliente .avatar { box-shadow: none; }
.pdv-cliente-info { flex: 1; min-width: 0; }
.pdv-cliente-info strong { display: block; }
.pdv-busca { position: relative; }
.pdv-busca .form-control { height: 44px; padding-left: 40px; font-size: var(--fs-md); }
.pdv-busca > .icon, .pdv-busca .ac-wrap + .icon { position: absolute; left: 13px; top: 13px; color: var(--muted); pointer-events: none; }
.resumo-venda { font-variant-numeric: tabular-nums; }
.resumo-venda .linha { display: flex; justify-content: space-between; padding: 5px 0; color: var(--text-2); }
.resumo-venda .linha.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; color: var(--text); font-size: var(--fs-xl); font-weight: 700; }
.pag-linhas { display: flex; flex-direction: column; gap: 8px; }
.pag-linha {
  display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.pag-linha .form-control { height: 34px; font-size: var(--fs-sm); }
.pag-linha .extra { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pag-linha .extra .form-label { margin-bottom: 2px; }
.pag-linha .extra .form-group { margin: 0; }
.pag-rapidas { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-3) 0; }
.pag-rapidas .btn { flex: 1 1 auto; }
.pag-status { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: var(--radius); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: var(--sp-3); }
.pag-status.falta { background: var(--warning-soft); color: var(--warning); }
.pag-status.ok { background: var(--success-soft); color: var(--success); }
.pag-status.troco { background: var(--info-soft); color: var(--info); }
.pag-status.erro { background: var(--danger-soft); color: var(--danger); }
.forma-cell { display: inline-flex; align-items: center; gap: 6px; }
.forma-cell .icon { color: var(--muted); }

/* ------------------------------------------------------------ Financeiro */
.demo-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: flex-end; margin-bottom: var(--sp-4); }
.demo-toolbar .form-group { margin: 0; }
.demo-toolbar .form-control { width: auto; }
.demo-table { font-size: var(--fs-sm); }
.demo-table th:first-child, .demo-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 260px; }
.demo-table th:first-child { background: var(--surface-2); z-index: 3; }
.demo-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.demo-table tr.n1 td:first-child { padding-left: 28px; color: var(--text-2); }
.demo-table tr.t-grupo td { font-weight: 600; background: var(--surface-2); }
.demo-table tr.t-subtotal td { font-weight: 700; background: color-mix(in srgb, var(--surface-3) 60%, var(--surface)); }
.demo-table tr.t-resultado td { font-weight: 700; font-size: var(--fs-base); background: var(--surface-3); border-top: 2px solid var(--text); }
.demo-table tr.t-grupo td:first-child, .demo-table tr.t-subtotal td:first-child, .demo-table tr.t-resultado td:first-child { background: inherit; }
.demo-table td.neg { color: var(--danger); }
.demo-table td.av { color: var(--muted); font-size: var(--fs-xs); }
.demo-table a { color: inherit; }
.demo-table a:hover { color: var(--brand); text-decoration: underline; }
.balanco { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.balanco .card { margin: 0; }
.bal-lista .linha { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.bal-lista .linha:last-child { border-bottom: 0; }
.bal-lista .linha.n0 { font-weight: 700; font-size: var(--fs-md); border-bottom: 2px solid var(--text); }
.bal-lista .linha.n1 { font-weight: 600; padding-left: 8px; }
.bal-lista .linha.n2 { padding-left: 24px; color: var(--text-2); }
.bal-lista .linha small { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.bal-total { display: flex; justify-content: space-between; margin-top: var(--sp-3); padding: 12px 14px; border-radius: var(--radius); background: var(--shell-bg); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.equacao { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius); font-weight: 600; margin-bottom: var(--sp-4); }
.equacao.ok { background: var(--success-soft); color: var(--success); }
.nota { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-3); display: flex; gap: 6px; align-items: flex-start; }

/* Gráficos */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .eixo text { fill: var(--muted); font-size: 11px; font-family: var(--font-family); }
.chart .zero { stroke: var(--border-strong); stroke-width: 1; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .linha-s1 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-s1 { fill: var(--series-1); opacity: .1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .ponto { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 8px 10px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
}
.chart-tip strong { display: block; margin-bottom: 4px; font-size: var(--fs-sm); }
.dot-s1 { background: var(--series-1); } .dot-s2 { background: var(--series-2); }
.chart-tip .l { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 8px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ------------------------------------------------------------------ Login */
#login-container { min-height: 100dvh; display: flex; }
.login-split { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 100dvh; background: var(--bg); }
.login-hero {
  display: none; position: relative; overflow: hidden;
  background: #0d0d0f; color: #f4f4f5; padding: 48px;
  flex-direction: column; justify-content: space-between;
}
.login-hero::before {   /* faixas diagonais, eco do itálico da logo */
  content: ''; position: absolute; inset: -20%;
  background: repeating-linear-gradient(115deg, transparent 0 46px, rgba(255,255,255,.025) 46px 48px);
}
.login-hero::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; background: radial-gradient(circle, rgba(227,22,28,.35), transparent 65%); }
.login-hero > * { position: relative; z-index: 1; }
.login-hero .a7-logo { color: #fff; }
.hero-title { font-size: 34px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; max-width: 440px; }
.hero-title em { font-style: italic; color: #e3161c; }
.hero-text { color: #a1a1aa; margin-top: 12px; max-width: 420px; font-size: var(--fs-md); }
.hero-pontos { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; color: #d4d4d8; }
.hero-pontos span { display: flex; align-items: center; gap: 10px; }
.hero-pontos .icon { color: #e3161c; }
.hero-rodape { font-size: var(--fs-xs); color: #71717a; letter-spacing: .08em; text-transform: uppercase; }
.login-painel { display: flex; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-4); }
.login-card { width: 100%; max-width: 380px; }
.login-marca-mobile { display: flex; align-items: center; gap: 12px; margin-bottom: var(--sp-8); padding: 14px 16px; border-radius: var(--radius-lg); background: #111113; color: #fff; }
.login-marca-mobile small { color: #a1a1aa; display: block; font-size: 11px; letter-spacing: .2em; }
.login-header { margin-bottom: var(--sp-6); }
.login-header h1 { font-size: var(--fs-xl); font-weight: 700; }
.login-header p { color: var(--muted); margin-top: 4px; }
.login-alert { display: flex; gap: 8px; background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 10px 12px; font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.login-card .form-control { height: 44px; }
.login-submit { width: 100%; height: 44px; margin-top: var(--sp-2); font-size: var(--fs-base); }
.login-footer { margin-top: var(--sp-4); text-align: center; }
.login-footer a { color: var(--text-2); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; }
.login-footer a:hover { color: var(--brand); }
.login-legal { margin-top: var(--sp-8); font-size: var(--fs-xs); color: var(--muted); text-align: center; }

/* ------------------------------------------------------ Legado de telas */
.kpi { display: flex; align-items: center; justify-content: space-between; }
.kpi-trend { font-size: var(--fs-xs); margin-top: 6px; }
.kpi-icon { opacity: .25; }
.fotos-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fotos-grid figure { position: relative; width: 88px; height: 88px; }
.fotos-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.fotos-grid button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; line-height: 22px; }
a.card.kpi:hover { border-color: var(--border-strong); }
.card-body { min-width: 0; }

/* ------------------------------------------------------------ Responsivo */
@media (min-width: 640px) {
  .form-grid > .col-2 { grid-column: span 2; }
  .form-grid > .col-3 { grid-column: span 3; }
  .form-grid > .col-4 { grid-column: span 4; }
  .form-grid > .col-6 { grid-column: span 6; }
  .form-grid > .col-8 { grid-column: span 8; }
  .form-grid > .col-9 { grid-column: span 9; }
  .form-control { font-size: var(--fs-base); }
  .brand-text { display: flex; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
  .kpi-value { font-size: var(--fs-xl); }
  #page-content { padding: var(--sp-5) var(--sp-6) var(--sp-10); }
  .detalhes { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .gh-search { display: block; }
  .empresa-switch { display: inline-flex; }
  .btn-brand-inverse { display: inline-flex !important; background: var(--brand-mark); color: #fff; height: 34px; }
  .btn-brand-inverse:hover { background: #c01218; }
  .user-profile-name { display: inline; }
  .balanco { grid-template-columns: 1fr 1fr; }
  .login-split { grid-template-columns: 1.1fr 1fr; }
  .login-hero { display: flex; }
  .login-marca-mobile { display: none; }
}
@media (min-width: 1025px) {
  .side-nav { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); transform: none; width: var(--nav-w); flex-shrink: 0; }
  .mobile-menu-btn, .sidebar-backdrop { display: none !important; }
  .nav-collapse { display: inline-flex; }
  html.nav-compacto .side-nav { width: var(--nav-w-collapsed); }
  html.nav-compacto .nav-text, html.nav-compacto .nav-group-label, html.nav-compacto .nav-version { display: none; }
  html.nav-compacto .nav-item { justify-content: center; padding: 0; }
  html.nav-compacto .nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.06); }
  html.nav-compacto .side-nav-footer { justify-content: center; }
}
@media (min-width: 1200px) {
  .layout-registro { grid-template-columns: minmax(0, 1fr) 300px; }
  .pdv { grid-template-columns: minmax(0, 1fr) 370px; }
  .pdv-side { position: sticky; top: calc(var(--header-h) + 16px); }
}
@media (min-width: 1400px) {
  #page-content { padding: var(--sp-6) var(--sp-8) var(--sp-10); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .global-header, .side-nav, .page-actions, .sidebar-backdrop, .no-print, .tabs, .demo-toolbar { display: none !important; }
  body, #page-content { background: #fff; color: #000; padding: 0; }
  .card, .record-header, .kpi-tile { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  th { position: static; }
}

/* ==========================================================================
   Celular (< 700px) — Produtos e Vendas como prioridade
   Tabelas viram cartões; alvos de toque >= 40px; campos com 16px (sem zoom
   automático do iOS); PDV com barra fixa de total e finalizar.
   ========================================================================== */
.so-mobile { display: none; }
.pdv-barra { display: none; }
.busca-mobile-btn { display: none; }

@media (max-width: 699px) {
  .so-mobile { display: inline; }
  #page-content { padding: var(--sp-3) var(--sp-3) var(--sp-8); }
  .card { padding: var(--sp-3); border-radius: var(--radius); }
  .page-header { align-items: flex-start; margin-bottom: var(--sp-3); }
  .page-title-text h1 { font-size: var(--fs-lg); }
  .object-icon { width: 34px; height: 34px; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > a.btn { flex: 1 1 auto; }
  .page-actions .form-control { flex: 1 1 140px; width: auto; }

  /* Alvos de toque */
  .btn { height: 44px; }
  .btn-sm { height: 40px; min-width: 40px; padding: 0 12px; font-size: var(--fs-sm); }
  .btn-icone { width: 40px; }
  .form-control { height: 44px; font-size: 16px; }
  .itens-edit input.form-control, .pag-linha .form-control { height: 42px; font-size: 16px; }
  label.check { min-height: 40px; }
  label.check input { width: 20px; height: 20px; }
  .tabs button { height: 44px; }
  .filters .form-group { flex: 1 1 100%; }

  /* Lista de cartões: ver @container tabela abaixo */
  .table-responsive:has(> .data-table) { border: 0; overflow: visible; }
  .card.flush .table-responsive:has(> .data-table) { padding: var(--sp-3); }
  .pager { justify-content: space-between; }
  .pager .btn { width: 48px; }

  /* Carrinho do PDV em cartões */
  .carrinho, .carrinho tbody { display: block; }
  .carrinho thead { display: none; }
  .table-responsive:has(> .carrinho) { border: 0; overflow: visible; }
  .carrinho tr {
    display: grid; grid-template-columns: repeat(3, 1fr) 44px; gap: 8px;
    padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2);
  }
  .carrinho tr.linha-alerta { background: var(--danger-soft); }
  .carrinho td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  .carrinho td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; margin-bottom: 2px; }
  .carrinho td.m-titulo { grid-column: 1 / -2; }
  .carrinho td.m-titulo::before, .carrinho td.m-remover::before { display: none; }
  .carrinho td.m-remover { grid-column: 4; grid-row: 1; justify-self: end; }
  .carrinho td.m-oculto { display: none; }
  .carrinho td.m-subtotal { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px dashed var(--border-strong); }
  .carrinho td.m-subtotal::before { margin: 0; }
  .carrinho input.form-control { min-width: 0; width: 100%; text-align: left; }

  /* PDV: pagamento e barra fixa */
  .pdv-busca .form-control { height: 48px; }
  .pag-rapidas { display: grid; grid-template-columns: repeat(3, 1fr); }
  .pag-rapidas .btn { height: 44px; padding: 0 6px; }
  .pag-linha { grid-template-columns: 1fr 110px 40px; }
  .pag-linha .extra { grid-template-columns: 1fr 1fr; }
  body.com-pdv #page-content { padding-bottom: 96px; }
  .pdv-barra {
    display: flex; gap: 10px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0, 0, 0, .08);
  }
  .pdv-barra-total { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
  .pdv-barra-total small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .pdv-barra-total strong { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
  .pdv-barra[data-estado="falta"] small { color: var(--warning); }
  .pdv-barra[data-estado="erro"] small { color: var(--danger); }
  .pdv-barra[data-estado="troco"] small { color: var(--info); }
  .pdv-barra .btn-lg { height: 48px; padding: 0 18px; }
  .resumo-venda .linha.total { font-size: var(--fs-lg); }

  /* Registro (ficha) */
  .record-top { padding: var(--sp-3); }
  .highlights { grid-template-columns: 1fr 1fr; }
  .highlight { border-bottom: 1px solid var(--border); padding: 10px var(--sp-3); }
  .highlight:nth-child(2n) { border-right: 0; }

  /* Modais ocupam a tela e mantêm as ações sempre visíveis */
  #modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content, .modal-content.modal-lg {
    max-width: 100%; max-height: 94dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--sp-4) var(--sp-4) 0;
  }
  .modal-actions {
    position: sticky; bottom: 0; z-index: 2; margin: var(--sp-3) calc(var(--sp-4) * -1) 0;
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom)); background: var(--surface);
  }
  .modal-actions .btn { flex: 1 1 auto; }

  /* Busca global no celular */
  .busca-mobile-btn { display: inline-flex; }
  .global-header.busca-aberta .gh-search {
    display: block; position: absolute; left: 0; right: 0; top: var(--header-h);
    padding: 8px 12px; background: var(--shell-bg); border-bottom: 2px solid var(--brand-mark);
  }
  .global-header.busca-aberta .gs-kbd { display: none; }
  .gs-results { max-height: 65dvh; }
  #toast-container { top: auto; bottom: 16px; }
  body.com-pdv #toast-container { bottom: 90px; }
}

/* Tablet (700–1100px): mantém a tabela, mas sem as colunas secundárias; o
   que elas mostravam (código, data, mínimo) aparece junto ao título. */
@media (min-width: 700px) and (max-width: 1100px) {
  .data-table th.m-oculto, .data-table td.m-oculto { display: none; }
  .data-table th { white-space: normal; }
  .data-table .so-mobile { display: inline; }
  .data-table td.m-titulo .so-mobile { display: block; font-size: var(--fs-xs); }
}

/* Listas viram cartões quando o ESPAÇO da tabela é estreito — no celular e
   também em colunas estreitas do tablet/desktop (ex.: ranking do CRM). */
.table-responsive { container: tabela / inline-size; }
@container tabela (max-width: 620px) {
  .data-table, .data-table tbody { display: block; }
  .data-table thead { display: none; }
  .data-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px;
    padding: 14px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
  }
  .data-table tbody tr:hover td { background: none; }
  .data-table td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  .data-table td.num { text-align: left; }
  .data-table td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  }
  .data-table td.m-titulo { grid-column: 1 / -1; font-size: var(--fs-md); font-weight: 600; }
  .data-table .so-mobile { display: inline; }
  .data-table td.m-titulo .so-mobile { display: block; font-size: var(--fs-xs); font-weight: 400; margin-top: 2px; }
  .data-table td.m-titulo::before, .data-table td.m-acoes::before { display: none; }
  .data-table td.m-largo { grid-column: 1 / -1; }
  .data-table td.m-oculto { display: none; }
  .data-table td.m-acoes { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--border); }
  .data-table td.m-acoes .acoes { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .data-table td.m-acoes .btn-icone { width: 44px; height: 44px; }
  .data-table td.m-acoes .btn-sm { height: 40px; }
  .data-table tr.linha-alerta { background: var(--danger-soft); }
  .data-table tr.linha-alerta td { background: none; }
}

/* ==========================================================================
   Relatórios em formato de documento (A4) — previsão de pagamentos
   A folha tem cores próprias de papel (clara também no tema escuro): o que se
   vê na tela é o que sai na impressão / "Salvar como PDF".
   ========================================================================== */
.rel-filtros { margin-bottom: var(--sp-4); }
.rel-filtros .filters { margin-bottom: var(--sp-2); }
.rel-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); }
.rel-presets .check { margin-left: auto; font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 6px; }

.rel-folha {
  --rel-ink: #111827; --rel-ink-2: #4b5563; --rel-muted: #6b7280; --rel-line: #e5e7eb; --rel-soft: #f8fafc;
  --rel-danger: #b42318; --rel-danger-soft: #fdf1f0; --rel-ok: #067647; --rel-ok-soft: #eefaf3;
  --rel-acc: #DC2626;
  page: relatorio;
  max-width: 1060px; margin: 0 auto; padding: 44px 48px 28px;
  background: #fff; color: var(--rel-ink);
  border-radius: 4px; box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 12px 32px -8px rgba(16,24,40,.18);
  border-top: 5px solid var(--rel-acc);
  font-size: 12.5px; line-height: 1.45; font-variant-numeric: tabular-nums;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rel-folha a { color: inherit; }
.rel-folha a:hover { text-decoration: underline; }

/* Título: identificação do documento fica no cabeçalho (.doc-cab) */
.rel-sep { color: var(--rel-muted); margin: 0 4px; }
.rel-filtros-txt { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.rel-filtros-txt li { font-size: 11px; color: var(--rel-ink-2); background: var(--rel-soft); border: 1px solid var(--rel-line); border-radius: 999px; padding: 2px 10px; }

/* Seções */
.rel-secao { margin-top: 26px; }
.rel-secao h3 { display: flex; align-items: baseline; gap: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  padding-bottom: 0; margin-bottom: 12px; border-bottom: 0; color: var(--rel-ink); break-after: avoid; }
.rel-secao h3 span { color: var(--rel-acc); font-size: 11px; letter-spacing: .04em; }
.rel-nota { color: var(--rel-muted); font-size: 11px; margin: -4px 0 10px; }
.rel-secao .rel-nota:last-child { margin: 8px 0 0; }
.rel-duas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }

/* Sumário */
.rel-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; break-inside: avoid; }
.rel-kpi { padding: 14px 16px; min-width: 0; background: var(--rel-soft); border: 1px solid var(--rel-line); border-radius: 6px; }
.rel-kpi span { display: flex; align-items: center; gap: 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--rel-muted); font-weight: 700; }
.rel-kpi span::before { content: ""; width: 3px; height: 11px; background: var(--rel-acc); flex-shrink: 0; }
.rel-kpi.destaque span::before { display: none; }
.rel-kpi strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 6px 0 2px; white-space: nowrap; }
.rel-kpi small { display: block; color: var(--rel-ink-2); font-size: 11px; }
.rel-kpi.destaque { background: var(--rel-acc); border-color: var(--rel-acc); color: #fff; }
.rel-kpi.destaque span, .rel-kpi.destaque small { color: rgba(255,255,255,.85); }
.rel-kpi.alerta strong { color: var(--rel-danger); }
.rel-destaques { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; color: var(--rel-ink-2); font-size: 11.5px; }
.rel-alerta { color: var(--rel-danger); font-weight: 600; }

/* Cobertura de caixa */
.rel-equacao { display: flex; align-items: stretch; gap: 10px; break-inside: avoid; }
.rel-equacao > div { flex: 1; padding: 12px 14px; background: var(--rel-soft); border-radius: 6px; min-width: 0; }
.rel-equacao > i { align-self: center; font-style: normal; font-size: 18px; color: var(--rel-muted); font-weight: 300; }
.rel-equacao span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--rel-muted); font-weight: 600; }
.rel-equacao strong { display: block; font-size: 16px; margin-top: 4px; white-space: nowrap; }
.rel-equacao small { display: block; font-size: 10.5px; margin-top: 2px; font-weight: 600; }
.rel-equacao .pos { background: var(--rel-ok-soft); }
.rel-equacao .pos strong, .rel-equacao .pos small { color: var(--rel-ok); }
.rel-equacao .neg { background: var(--rel-danger-soft); }
.rel-equacao .neg strong, .rel-equacao .neg small { color: var(--rel-danger); }

/* Gráfico */
.rel-grafico { margin: 0 0 14px; break-inside: avoid; }
.rel-grafico svg { width: 100%; height: auto; display: block; }
.rel-grafico .grade { stroke: var(--rel-line); stroke-width: 1; }
.rel-grafico .eixo { stroke: #b9bfca; stroke-width: 1; }
.rel-grafico .tick { font-size: 10px; fill: var(--rel-muted); }
.rel-grafico .tick.venc { fill: var(--rel-danger); font-weight: 600; }
.rel-grafico .valor { font-size: 10.5px; font-weight: 700; fill: var(--rel-ink); }
.rel-grafico .barra { fill: var(--rel-acc); }
.rel-grafico .barra.venc { fill: var(--rel-danger); opacity: .55; }
.rel-grafico .alvo:hover .barra { filter: brightness(.82); }
.rel-grafico .alvo:hover rect { fill: rgba(21,27,40,.04); }

/* Tabelas */
.rel-scroll { overflow-x: auto; }
.rel-tabela { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rel-tabela th { text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: #fff; font-weight: 700;
  padding: 9px 10px; border-bottom: 0; white-space: nowrap; background: var(--rel-ink); position: static; }
.rel-tabela th.num { text-align: right; }
.rel-tabela td { padding: 7px 10px; border-bottom: 1px solid var(--rel-line); vertical-align: top; }
.rel-tabela tbody tr:hover td { background: var(--rel-soft); }
.rel-tabela tfoot td { background: var(--rel-soft); border-top: 1.5px solid var(--rel-ink); border-bottom: 0; font-weight: 700; padding-top: 9px; font-size: 12px; }
.rel-tabela tr { break-inside: avoid; }
.rel-tabela .rel-venc td { color: var(--rel-danger); }
.rel-tabela .rel-demais td { color: var(--rel-ink-2); font-style: italic; }
.rel-tabela.compacta td { padding-top: 5px; padding-bottom: 5px; }
.rel-cap::first-letter { text-transform: uppercase; }
.rel-sub { display: block; color: var(--rel-muted); font-size: 10.5px; }
.rel-barra { display: block; height: 3px; background: var(--rel-soft); border-radius: 2px; margin-top: 4px; }
.rel-barra i { display: block; height: 100%; background: var(--rel-acc); border-radius: 2px; }
.rel-tabela.detalhe td:nth-child(2) { min-width: 160px; }
.rel-grupo td { background: var(--rel-soft); font-weight: 700; padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid #d3d7df; }
.rel-tabela .rel-grupo td:first-child { border-left: 3px solid var(--rel-acc); }
.rel-grupo .rel-data { display: inline-block; }
.rel-grupo .rel-data::first-letter { text-transform: uppercase; }
.rel-grupo td span.rel-qtd { font-weight: 500; color: var(--rel-muted); margin-left: 10px; font-size: 10.5px; }
.rel-grupo.venc td { background: var(--rel-danger-soft); color: var(--rel-danger); }
.rel-tabela .rel-grupo.venc td:first-child { border-left-color: var(--rel-danger); }
.rel-tag { display: inline-block; margin-left: 8px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 3px; vertical-align: 1px; white-space: nowrap; }
.rel-tag.venc { color: var(--rel-danger); background: var(--rel-danger-soft); }
.rel-tag.hoje { color: #93370d; background: #fef6ee; }

/* Vazio, assinaturas e rodapé */
.rel-vazio { display: flex; gap: 14px; align-items: center; padding: 22px; margin-top: 10px; border: 1px dashed #cfd4dc; border-radius: 6px; color: var(--rel-ok); }
.rel-vazio strong { display: block; color: var(--rel-ink); font-size: 14px; }
.rel-vazio span { color: var(--rel-ink-2); }
.rel-assinaturas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 56px; break-inside: avoid; }
.rel-assinaturas div { text-align: center; }
.rel-linha { display: block; border-top: 1px solid var(--rel-ink); margin-bottom: 6px; }
.rel-assinaturas strong { display: block; font-size: 11.5px; }
.rel-assinaturas small { color: var(--rel-muted); font-size: 10.5px; }
.rel-ind td { vertical-align: middle; }
.rel-ind td:nth-child(4) { color: var(--rel-ink-2); min-width: 240px; }
.rel-ind code { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 10.5px; color: var(--rel-ink); background: var(--rel-soft);
  border: 1px solid var(--rel-line); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.rel-notas { padding-left: 18px; color: var(--rel-ink-2); font-size: 11px; display: grid; gap: 5px; list-style: decimal; }
.rel-notas li::marker { color: var(--rel-acc); font-weight: 700; }
.rel-rodape { display: flex; justify-content: space-between; gap: 16px; margin-top: 36px; padding-top: 10px; border-top: 1px solid var(--rel-line); color: var(--rel-muted); font-size: 10px; }

@media screen and (max-width: 899px) {
  .rel-folha { padding: 24px 18px 18px; }
  .rel-kpis { grid-template-columns: 1fr 1fr; }
  .rel-kpi strong { font-size: 17px; }
  .rel-equacao { flex-direction: column; }
  .rel-equacao > i { display: none; }
  .rel-duas { grid-template-columns: 1fr; }
  .rel-assinaturas { grid-template-columns: 1fr; gap: 36px; }
  .rel-presets .check { margin-left: 0; }
  .rel-rodape { flex-direction: column; }
}

@page relatorio {
  size: A4;
  margin: 12mm 11mm 14mm;
  @bottom-left { content: "A7SYSTEM · Relatório financeiro gerencial"; font-size: 8pt; color: #6b7384; }
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font-size: 8pt; color: #6b7384; }
}
@media print {
  .rel-folha { max-width: none; padding: 14px 0 0; border-radius: 0; box-shadow: none; border-top-width: 4px; font-size: 10.5px; }
  .rel-folha a { text-decoration: none; }
  .rel-folha .doc-cab h2 { font-size: 22px; }
  .rel-kpi strong { font-size: 16px; }
  .rel-equacao strong { font-size: 13.5px; }
  .rel-tabela { font-size: 9.5px; }
  .rel-scroll { overflow: visible; }
  .rel-tabela thead { display: table-header-group; }
  .rel-grupo { break-after: avoid; }
}

/* ============================================== Documentos impressos (padrão dos PDFs)
   Mesmo desenho de backend/shared/pdf_layout.py: faixa e monograma na cor da
   empresa, dados cadastrais à esquerda, identificação do documento à direita. */
.doc-cab { --doc-acc: #DC2626; position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #e5e7eb; color: #111827; font-variant-numeric: tabular-nums;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-cab::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 104px; height: 3px; background: var(--doc-acc); }
.doc-emp { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.doc-emp strong { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin-bottom: 3px; }
.doc-emp div > span { display: block; color: #6b7280; font-size: 11.5px; line-height: 1.55; }
.doc-logo { width: 68px; height: 68px; object-fit: contain; border-radius: 10px; flex-shrink: 0; }
.doc-emp .doc-logo-txt { display: inline-flex; align-items: center; justify-content: center; background: var(--doc-acc); color: #fff; font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.doc-emp .doc-logo-txt[hidden] { display: none; }
.doc-id { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex-shrink: 0; max-width: 50%; }
.doc-rotulo { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--doc-acc); }
.doc-id h2 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 3px 0 5px; color: #111827; }
.doc-id p { font-size: 11.5px; color: #6b7280; line-height: 1.55; }
.doc-id p strong { color: #111827; }
.doc-selo { margin-top: 9px; padding: 4px 12px; border-radius: 999px; font-size: 10px; font-weight: 700; background: #f1f5f9; color: #6b7280; white-space: nowrap; }
.doc-selo.ok { background: #dcfce7; color: #15803d; }
.doc-selo.alerta { background: #fef3c7; color: #b45309; }
.doc-selo.perigo { background: #fee2e2; color: #b91c1c; }
.doc-rodape { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 10px; border-top: 1px solid #e5e7eb; color: #6b7280; font-size: 10px; }
.so-impressao { display: none; }

@media screen and (max-width: 899px) {
  .doc-cab { flex-direction: column; gap: 16px; }
  .doc-id { align-items: flex-start; text-align: left; max-width: none; }
  .doc-id h2 { font-size: 22px; }
}

@media print {
  .so-impressao { display: block; }
  .doc-rodape.so-impressao { display: flex; }
  /* Tela impressa direto do app (Visão financeira): vira documento no padrão */
  .doc-impressao { page: relatorio; --doc-acc: #DC2626; color: #111827; font-size: 11px; font-variant-numeric: tabular-nums;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-impressao .doc-cab { border-top: 5px solid var(--doc-acc); padding-top: 16px; }
  .doc-impressao .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .doc-impressao .kpi-tile { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px; padding: 11px 13px; box-shadow: none; }
  .doc-impressao .kpi-ico { display: none; }
  .doc-impressao .kpi-label { display: flex; align-items: center; gap: 6px; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #6b7280; }
  .doc-impressao .kpi-label::before { content: ""; width: 3px; height: 10px; background: var(--doc-acc); flex-shrink: 0; }
  .doc-impressao .kpi-value { font-size: 15px; color: #111827; }
  .doc-impressao .kpi-value.texto-perigo { color: #b91c1c; }
  .doc-impressao .kpi-value.texto-ok { color: #15803d; }
  .doc-impressao .kpi-detail { font-size: 9px; color: #6b7280; }
  .doc-impressao .kpi-grid > .kpi-tile:first-child { background: var(--doc-acc); border-color: var(--doc-acc); }
  .doc-impressao .kpi-grid > .kpi-tile:first-child :is(.kpi-label, .kpi-value, .kpi-detail) { color: #fff; }
  .doc-impressao .kpi-grid > .kpi-tile:first-child .kpi-label::before { display: none; }
  .doc-impressao .card { border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0 0 16px; background: none; break-inside: auto; }
  .doc-impressao .card-header { padding: 0 0 8px; border: 0; background: none; }
  .doc-impressao .card-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #111827; }
  .doc-impressao .card-title .icon { display: none; }
  .doc-impressao .card-sub { font-size: 9.5px; color: #6b7280; }
  .doc-impressao .table-responsive { overflow: visible; border: 0; }
  .doc-impressao :is(.demo-table, .data-table) { font-size: 9.5px; width: 100%; }
  .doc-impressao :is(.demo-table, .data-table) thead { display: table-header-group; }
  .doc-impressao :is(.demo-table, .data-table) th { position: static; background: #111827 !important; color: #fff; font-size: 8.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; padding: 7px 8px; border: 0; }
  .doc-impressao :is(.demo-table, .data-table) td { position: static; padding: 5px 8px; border-bottom: 1px solid #e5e7eb; }
  .doc-impressao :is(.demo-table, .data-table) tr { break-inside: avoid; }
  .doc-impressao .demo-table td:first-child { min-width: 0; }
  .doc-impressao .demo-table tr.t-resultado td { border-top: 1.5px solid #111827; background: #f8fafc; }
  .doc-impressao .demo-table tr:is(.t-grupo, .t-subtotal) td { background: #f8fafc; }
  .doc-impressao .doc-id h2 { font-size: 24px; }
  .doc-impressao .bal-total { background: var(--doc-acc); border-radius: 6px; }
  .doc-impressao .balanco { grid-template-columns: 1fr 1fr; gap: 16px; }
  .doc-impressao .nota { font-size: 9px; color: #6b7280; }
}

/* ===================================================== Tesouraria e patrimônio */
.selecao-lote { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: 10px 14px; margin-bottom: var(--sp-3); border-radius: var(--radius); background: var(--info-soft); color: var(--text); }
.selecao-info { display: inline-flex; align-items: center; gap: 8px; }
.selecao-info .icon { color: var(--info); }

.conc-sug { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.conc-modal { max-width: 860px; }
.conc-linha { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.conc-valor { font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.conc-corpo { min-height: 120px; margin-top: var(--sp-3); }
.conc-lista { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.conc-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s; }
.conc-item.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.conc-item-top { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; margin: 0; }
.conc-item-top input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.conc-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.conc-item-main .muted { font-size: var(--fs-sm); }
.conc-item-valor { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.conc-ajuste { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 12px 12px 44px; }
.conc-ajuste label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); color: var(--muted); }
.conc-ajuste input { text-align: right; }
.conc-rodape { margin-top: var(--sp-3); }
.conc-rodape .resumo { margin-bottom: var(--sp-2); }
.conc-ajustes, .conc-atalhos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.conc-colar { margin-bottom: var(--sp-3); }
.conc-colar summary { cursor: pointer; font-weight: 600; color: var(--link); margin-bottom: 8px; }
.conc-grade td { padding: 4px; vertical-align: middle; }
.conc-grade .form-control { min-width: 0; }
.conc-grade td:nth-child(1) { width: 150px; } .conc-grade td:nth-child(4) { width: 110px; } .conc-grade td:nth-child(5) { width: 130px; }

.cb-cartao, .pt-compra { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 var(--sp-3); background: var(--surface-2); }
.cb-cartao legend { padding: 0 4px; }
/* O atributo hidden sempre vence o display dos componentes (form-group, linhas de tabela...) */
[hidden] { display: none !important; }
.pt-compra .form-grid { margin-top: 8px; }
.pt-previa .resumo { margin-bottom: var(--sp-3); }

.barra-progresso { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-bottom: 4px; min-width: 90px; }
.barra-progresso span { display: block; height: 100%; background: var(--obj-estoque); border-radius: 3px; }

.record-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.dl-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.dl-grid dt { color: var(--muted); font-size: var(--fs-sm); }
.dl-grid dd { margin: 0; word-break: break-word; }
.pt-cronograma .pt-ano td { font-weight: 600; background: var(--surface-2); }
.pt-cronograma .pt-ano .btn { padding-left: 0; }
.pt-cronograma .pt-ano [aria-expanded=true] .icon { transform: rotate(180deg); }

@media (max-width: 860px) {
  .record-grid { grid-template-columns: 1fr; }
  .conc-ajuste { grid-template-columns: 1fr 1fr 1fr; padding-left: 12px; }
  .conc-valor { font-size: var(--fs-xl); }
  .conc-grade thead { display: none; }
  .conc-grade tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .conc-grade td { width: auto !important; }
  .conc-grade td:nth-child(2) { grid-column: 1 / -1; order: -1; }
}

/* ============================================== Saldo mensal do estoque */
.em-tabela .em-ano-cab th { background: var(--surface-2); font-size: var(--fs-sm); border-top: 2px solid var(--border-strong, var(--border)); }
.em-tabela .em-mes { cursor: pointer; }
.em-tabela .em-mes:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.em-tabela .em-mes.ativo td { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.em-notas p { margin: 6px 0; font-size: var(--fs-sm); color: var(--muted); }
.em-notas .texto-aviso { font-weight: 500; }
@container tabela (max-width: 620px) {
  .em-tabela .em-ano-cab { display: block; padding: 8px 12px; box-shadow: none; background: var(--surface-2); }
  .em-tabela .em-ano-cab th { display: none; background: none; border: 0; }
  .em-tabela .em-ano-cab th:first-child { display: block; font-size: var(--fs-md); }
  .em-tabela .em-mes.ativo { border-color: var(--brand); }
}

/* ============================================== Tabela de preços (catálogo) */
.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--sp-3); }
.cat-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.cat-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.cat-foto { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cat-foto img { width: 100%; height: 100%; object-fit: cover; }
.cat-sem { color: var(--muted); opacity: .45; }
.cat-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; flex: 1; }
.cat-desc { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-cod { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-preco { margin-top: auto; padding-top: 8px; font-size: var(--fs-lg); font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums; }
.cat-unidade { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); margin-left: 1px; }
.cat-tag { display: inline-block; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2);
  border-radius: 9999px; padding: 1px 8px; margin-top: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; }
.cat-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cat-ficha { align-self: flex-start; margin-top: 6px; }

/* Ficha técnica: texto livre, uma característica por linha */
.ficha-tecnica { white-space: pre-wrap; word-break: break-word; font-size: var(--fs-sm); line-height: 1.5; }

/* Grupo de botões (alternância grade / lista) */
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn.active, .btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Miniatura de foto na lista de produtos */
.mini-foto { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--border);
  object-fit: cover; background: var(--surface-2); vertical-align: middle; }
span.mini-foto { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); opacity: .55; }

/* ============================================== PWA — Banner offline e install */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 16px; font-size: var(--fs-sm); font-weight: 600;
  background: var(--danger); color: #fff;
  transform: translateY(-100%);
  transition: transform .3s ease;
}
.offline-banner.visivel { transform: translateY(0); }
.offline-banner .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.pwa-install-btn {
  position: fixed; bottom: 20px; right: 20px; z-index: 9998;
  display: none; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transition: transform .2s, opacity .2s;
  font-family: var(--font-family);
}
.pwa-install-btn:hover { transform: translateY(-2px); }
.pwa-install-btn.visivel { display: flex; }

/* iOS standalone: esconder barra de status/notch padding */
@supports (padding-top: env(safe-area-inset-top)) {
  .global-header { padding-top: env(safe-area-inset-top); }
}
