/* Cores do TI OS: azul royal (estrutura, links) + laranja (acoes principais).
   Tema claro e escuro: data-theme no <html> ("claro"/"escuro"); sem escolha,
   segue o tema do aparelho. */
:root {
  --royal: #2547d0;
  --royal-escuro: #1a338f;
  --royal-suave: #e6ecfd;
  --laranja: #f97316;
  --laranja-hover: #ea580c;
  --laranja-suave: #fff1e6;

  --bg: #f2f5fb;
  --card: #ffffff;
  --card-2: #f7f9fe;
  --text: #0f172a;
  --muted: #5b6478;
  --border: #dfe5f1;
  --input-border: #c6cfe2;
  --hover: #f0f4fd;
  --primary: var(--royal-escuro);
  --primary-text: #dbe4ff;
  --primary-hover: #2a46b8;
  --accent: var(--laranja);
  --link: var(--royal);
  --focus: rgba(249, 115, 22, 0.35);
  --danger: #dc2626;
  --danger-border: #fecaca;
  --alerta-bg: #fff4e5;
  --alerta-text: #7c3a06;
  --alerta-border: #fdba74;
  --sombra: 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --nav-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) {
    --royal: #7c9cff;
    --royal-suave: #1c2a55;
    --laranja-suave: #3a2213;
    --bg: #0b1020;
    --card: #131a2e;
    --card-2: #182240;
    --text: #e5e9f5;
    --muted: #96a0b8;
    --border: #253256;
    --input-border: #33426b;
    --hover: #1b2643;
    --primary: #0e1736;
    --primary-text: #b9c6ef;
    --primary-hover: #1d2c5e;
    --link: #8ea8ff;
    --danger: #f87171;
    --danger-border: #7f1d1d;
    --alerta-bg: #3a2310;
    --alerta-text: #fed7aa;
    --alerta-border: #9a4a0f;
    color-scheme: dark;
  }
}
:root[data-theme='escuro'] {
  --royal: #7c9cff;
  --royal-suave: #1c2a55;
  --laranja-suave: #3a2213;
  --bg: #0b1020;
  --card: #131a2e;
  --card-2: #182240;
  --text: #e5e9f5;
  --muted: #96a0b8;
  --border: #253256;
  --input-border: #33426b;
  --hover: #1b2643;
  --primary: #0e1736;
  --primary-text: #b9c6ef;
  --primary-hover: #1d2c5e;
  --link: #8ea8ff;
  --danger: #f87171;
  --danger-border: #7f1d1d;
  --alerta-bg: #3a2310;
  --alerta-text: #fed7aa;
  --alerta-border: #9a4a0f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: 0.95rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--primary); color: var(--primary-text); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
  border-right: 3px solid var(--laranja);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; }
.brand img.app-logo { background: transparent; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: var(--primary-text); padding: 10px 12px; border-radius: 8px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--primary-hover); color: #fff; }
.nav a.active { background: var(--primary-hover); color: #fff; border-left-color: var(--laranja); }
.nav .ico { width: 20px; text-align: center; }
.sidebar .user { margin-top: auto; font-size: 0.85rem; padding: 8px; border-top: 1px solid var(--primary-hover); }
.sidebar .user button { margin-top: 8px; width: 100%; }
.main { flex: 1; min-width: 0; padding: 20px 24px 40px; max-width: 1200px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.mobile-header { display: none; }
.alerta { background: var(--alerta-bg); color: var(--alerta-text); border: 1px solid var(--alerta-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.alerta a { color: inherit; font-weight: 600; text-decoration: underline; }
.previa { display: flex; gap: 14px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fff; color: #0f172a; }
.previa img, .previa .sem-logo { width: 90px; height: 60px; object-fit: contain; flex-shrink: 0; }
.previa .sem-logo { display: flex; align-items: center; justify-content: center; border: 1px dashed #cbd5e1; border-radius: 6px; color: #64748b; font-size: 0.75rem; }
.previa .muted { color: #64748b; }
.previa-txt { flex: 1; min-width: 0; }
.previa-nome { font-weight: 700; font-size: 1.1rem; }
.previa-os { text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .previa { flex-wrap: wrap; } .previa-os { width: 100%; text-align: left; } }

@media (max-width: 820px) {
  .sidebar { display: none; }
  .layout { flex-direction: column; }
  .mobile-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--primary); color: #fff;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px; position: sticky; top: 0; z-index: 20;
    border-bottom: 3px solid var(--laranja);
  }
  .mobile-header .brand { padding: 0; font-size: 0.95rem; min-width: 0; }
  .mobile-header .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-header .brand img { width: 28px; height: 28px; }
  .mobile-header button { color: var(--primary-text); }
  .main { padding: 14px 12px calc(var(--nav-h) + 24px); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--primary); z-index: 20;
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--primary-text); opacity: 0.75; font-size: 0.68rem; gap: 2px; border-top: 3px solid transparent;
  }
  .bottom-nav a .ico { font-size: 1.2rem; }
  .bottom-nav a.active { color: #fff; opacity: 1; border-top-color: var(--laranja); }
}

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } }
/* PDV: carrinho e pagamento com mais espaco */
.cols.pdv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
@media (max-width: 1000px) { .cols.pdv { grid-template-columns: minmax(0, 1fr); } }

label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 9px 11px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--card);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); border-color: var(--laranja); }
input[type='checkbox'] { width: auto; accent-color: var(--laranja); }
.field { margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 140px; }

/* Botoes com cor propria (azul claro), para nao sumirem no fundo branco. */
button, .btn {
  font: inherit; border: 1px solid color-mix(in srgb, var(--royal) 35%, transparent); background: var(--royal-suave); color: var(--link); padding: 9px 14px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap; font-weight: 500;
}
button:hover, .btn:hover { background: color-mix(in srgb, var(--royal) 18%, var(--card)); border-color: var(--royal); }
button.primary, .btn.primary { background: var(--laranja); border-color: var(--laranja); color: var(--laranja-texto, #fff); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--laranja-hover); border-color: var(--laranja-hover); }
button.dark, a.btn.dark { background: var(--royal); border-color: var(--royal); color: #fff; }
button.dark:hover { filter: brightness(1.1); background: var(--royal); }
button.danger, .btn.danger { color: var(--danger); border-color: var(--danger-border); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--hover); }
.mobile-header button.ghost:hover { background: var(--primary-hover); }
button.sm { padding: 5px 9px; font-size: 0.85rem; }
button:disabled { opacity: 0.55; cursor: default; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  background: var(--hover); color: var(--muted);
}
.pr-alta { background: #fed7aa; color: #9a3412; }
.pr-urgente { background: #fecaca; color: #991b1b; }

.status-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.status-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; box-shadow: var(--sombra); }
.status-card .n { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.os-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; cursor: pointer; color: inherit;
  box-shadow: var(--sombra);
}
.os-item:hover { border-color: var(--royal); }
.os-item .num { font-weight: 700; font-size: 1.05rem; color: var(--royal); }
.os-item .tit { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item .sub { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item .side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1; min-width: 180px; }
.filters select { width: auto; }

table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.items td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.items input, table.items select { padding: 6px 8px; }
table.items .q { width: 70px; }
table.items .v { width: 110px; }
table.items .d { width: 150px; }
table.items .t { width: 100px; text-align: right; white-space: nowrap; }
@media (max-width: 820px) {
  table.items thead { display: none; }
  table.items tr { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.items td { border: 0; padding: 0; }
  table.items td.desc, table.items td.d { grid-column: 1 / -1; }
  table.items .q, table.items .v, table.items .d { width: auto; }
}
.totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 10px; }
.totals .grand { font-size: 1.2rem; font-weight: 700; color: var(--royal); }
.tipo { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }

.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.fotos .foto { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--hover); }
.fotos img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.fotos .del { position: absolute; top: 4px; right: 4px; padding: 2px 7px; background: rgba(255, 255, 255, 0.9); color: #0f172a; }

.hist { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.hist .quando { color: var(--muted); font-size: 0.78rem; }

.assinatura-img { max-width: 100%; max-height: 120px; border: 1px dashed var(--border); border-radius: 8px; background: #fff; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 12, 30, 0.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: var(--card); color: var(--text); border-radius: 12px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 18px; border: 1px solid var(--border); }
.modal.wide { max-width: 860px; }
/* Visualizacao do PDF (so computador) */
.modal-pdf .modal { max-width: 980px; height: 94vh; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-pdf .modal-head { flex-wrap: wrap; gap: 8px; }
.pdf-preview { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #525659; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pick { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick:hover { background: var(--hover); }
canvas.sign { width: 100%; height: 220px; border: 1px dashed #94a3b8; border-radius: 8px; touch-action: none; background: #fff; }
.viewer img { max-width: 100%; max-height: 80vh; display: block; margin: auto; }

/* ---------- Login ---------- */
.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(160deg, var(--royal-escuro) 0%, var(--royal-escuro) 45%, var(--bg) 45%);
}
.login-card { width: 100%; max-width: 380px; border-top: 4px solid var(--laranja); }
.login-card .logo { text-align: center; margin-bottom: 16px; }
.login-card .logo img { max-height: 72px; max-width: 200px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); background: var(--royal-escuro); color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: 90vw; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--laranja);
}
.toast.erro { background: #b91c1c; border-left-color: #fecaca; }
.toast:not([hidden]) { display: flex; align-items: center; gap: 12px; }
.toast-x {
  background: transparent; border: 0; color: #fff; font-size: 16px; line-height: 1; padding: 2px 4px; margin: -2px -6px -2px 0;
  cursor: pointer; opacity: 0.85; min-height: 0; box-shadow: none;
}
.toast-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.qr { display: flex; gap: 20px; flex-wrap: wrap; }
.qr div { text-align: center; }
.qr img { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 8px; }
.fab {
  display: none; position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); width: 56px; height: 56px; border-radius: 50%;
  font-size: 1.7rem; z-index: 21; box-shadow: 0 6px 16px var(--focus);
}
@media (max-width: 820px) { .fab { display: inline-flex; } .hide-mobile { display: none !important; } }
.equip.varios { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--card-2); }
.equip-cliente { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.vinculo { margin: -2px 0 8px; color: var(--muted); }
.pag-linha { margin: 6px 0; }
.paleta { display: inline-flex; align-items: center; gap: 4px; }
.bolinha { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.15); }
#pag-soma { margin-top: 4px; }

/* Relatorios */
.barras { display: flex; align-items: flex-end; gap: 3px; height: 160px; overflow-x: auto; padding-top: 6px; }
.barra { flex: 1; min-width: 18px; max-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.barra-v { width: 100%; background: var(--royal); border-radius: 3px 3px 0 0; opacity: 0.85; }
.barra.pico .barra-v { background: var(--laranja); opacity: 1; }
.barra:hover .barra-v { opacity: 1; }
.barra.zero { border-bottom: 2px solid var(--border); }
.barras { border-bottom: 1px solid var(--border); }
.graf-topo { display: flex; justify-content: space-between; margin-bottom: 4px; }
.barra-l { font-size: 0.62rem; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.rel-status { padding: 6px 0; cursor: pointer; }
.rel-status:hover { background: var(--hover); }
.trilho { height: 6px; background: var(--hover); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.trilho div { height: 100%; border-radius: 3px; }
table.rel td, table.rel th { font-size: 0.88rem; }
/* Celular: cada linha de relatorio vira um cartao (titulo da coluna a esquerda). */
@media (max-width: 820px) {
  table.rel, table.rel tbody, table.rel tfoot { display: block; width: 100%; }
  table.rel thead { display: none; }
  table.rel tr { display: block; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; background: var(--card); }
  table.rel td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; padding: 3px 0; text-align: right; white-space: normal !important; width: auto !important; }
  table.rel td::before { content: attr(data-l); color: var(--muted); font-size: 0.78rem; text-align: left; flex-shrink: 0; max-width: 45%; }
  table.rel td:first-child { font-weight: 600; text-align: left; justify-content: flex-start; font-size: 0.95rem; }
  table.rel td:first-child::before { content: none; }
  table.rel td:empty { display: none; }
  /* Grades de digitacao largas (XML, gerar precos) continuam tabela, com rolagem. */
  table.xml-grade thead, table.gp-tabela thead { display: table-header-group; }
  table.xml-grade tr, table.gp-tabela tr { display: table-row; }
  table.xml-grade td, table.gp-tabela td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
}
/* Toque: alvos de pelo menos 44 px (botoes, campos, itens de lista). */
@media (pointer: coarse) {
  button, .btn, select, input:not([type='checkbox']):not([type='radio']):not([type='file']) { min-height: 44px; }
  button.sm, .btn.sm { min-height: 38px; padding: 6px 12px; }
  .pick { min-height: 48px; }
  input[type='checkbox'], input[type='radio'] { width: 20px; height: 20px; }
  .bottom-nav a { min-height: 52px; }
}

/* Orcamentos */
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 6px 0; font-weight: 500; color: var(--text); font-size: 0.9rem; }
.tema-btn { font-size: 1rem; }
@media (min-width: 821px) { table.items td.desc { min-width: 220px; } }
input[readonly] { background: var(--hover); color: var(--text); cursor: default; }
table.items input[readonly] { border-color: transparent; font-weight: 600; }
.rodape-acoes { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.rodape-acoes .primary { min-width: 160px; }
@media (max-width: 820px) { .rodape-acoes .primary { flex: 1; } }
.aviso-instalar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--royal-suave); border: 1px solid var(--royal); border-left: 4px solid var(--laranja);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.9rem;
}
/* Zona de perigo */
.zona-perigo { border-color: var(--danger-border); border-left: 4px solid var(--danger); }
/* Parte de Config. travada pelo master: fieldset sem moldura. */
fieldset.trava { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.trava[disabled] { opacity: .55; }
.alerta-perigo { background: rgba(220, 38, 38, 0.08); border: 1px solid var(--danger-border); color: var(--text); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
button.danger-cheio { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 600; }
button.danger-cheio:hover { background: #b91c1c; }
/* Retirada (interno) */
.badge-retirada { background: rgba(180, 83, 9, 0.12); color: #b45309; border: 1px dashed #b45309; }
.badge-retirado { background: rgba(21, 128, 61, 0.1); color: #15803d; border: 1px dashed #15803d; }
:root[data-theme='escuro'] .badge-retirada { color: #fdba74; border-color: #fdba74; }
:root[data-theme='escuro'] .badge-retirado { color: #86efac; border-color: #86efac; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .badge-retirada { color: #fdba74; border-color: #fdba74; }
  :root:not([data-theme='claro']) .badge-retirado { color: #86efac; border-color: #86efac; }
}
.retirada-campo select { border-style: dashed; }
.sidebar .versao { margin-top: 10px; font-size: 0.72rem; opacity: 0.6; text-align: center; letter-spacing: 0.02em; }
/* Pagamento pendente */
.badge-pendente { background: rgba(15, 118, 110, 0.1); color: #0f766e; border: 1px dashed #0f766e; }
.badge-vencido { background: rgba(185, 28, 28, 0.1); color: #b91c1c; border: 1px solid #b91c1c; }
:root[data-theme='escuro'] .badge-pendente { color: #5eead4; border-color: #5eead4; }
:root[data-theme='escuro'] .badge-vencido { color: #fca5a5; border-color: #fca5a5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .badge-pendente { color: #5eead4; border-color: #5eead4; }
  :root:not([data-theme='claro']) .badge-vencido { color: #fca5a5; border-color: #fca5a5; }
}
/* Leitor de codigo pela camera */
.cam-box { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.cam-box video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.cam-mira { position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%; border: 2px solid #f97316; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25); pointer-events: none; }
/* Usuarios > Perfis de acesso */
/* Desbloqueio do aparelho: grade para desenhar o padrao */
.padrao-box { width: 200px; height: 200px; margin: 4px auto; background: var(--card-2); border: 1px solid var(--border); border-radius: 14px; touch-action: none; user-select: none; cursor: crosshair; }
.padrao-box svg { display: block; }
/* Checklist de entrada */
.chk-item { border-style: dashed; }
.chk-item.sim { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chk-item.nao { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
/* Agenda */
.agenda { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ag-cab { text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; padding: 2px 0; }
.ag-dia { min-height: 86px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--card); overflow: hidden; }
.ag-dia.vazio { background: transparent; border-style: dashed; opacity: 0.4; }
.ag-dia.hoje { border: 2px solid var(--laranja); }
.ag-num { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.ag-os { display: block; font-size: 0.72rem; padding: 1px 4px; margin-top: 2px; background: var(--card-2); border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
@media (max-width: 700px) { .ag-dia { min-height: 64px; } .ag-os { font-size: 0.62rem; } }
/* Registro de acoes */
table.acoes td, table.acoes th { text-align: left !important; vertical-align: top; }
tr.alerta-linha td { background: rgba(220, 38, 38, 0.07); }
/* Cadastro de produto: custo, margens e precos */
.precos { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; background: var(--card-2); }
.precos-linha { display: grid; grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; }
.precos-linha .field { margin-bottom: 6px; }
@media (max-width: 700px) { .precos-linha { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .precos-linha > b { grid-column: span 2; } }
/* Relatorios: secoes em cascata e alertas da visao geral */
.rel-secao { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.rel-secao > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.rel-secao > summary::-webkit-details-marker { display: none; }
.rel-secao > summary::before { content: '▸'; color: var(--royal); font-weight: 700; transition: transform 0.15s; }
.rel-secao[open] > summary::before { transform: rotate(90deg); }
.rel-titulo { font-weight: 700; font-size: 1.05rem; flex: 1; }
.rel-resumo { color: var(--muted); font-size: 0.85rem; }
.rel-secao[open] > summary { border-bottom: 1px solid var(--border); }
.rel-corpo { padding: 12px 14px; }
.rel-corpo > .card, .rel-corpo .cols .card { background: var(--card-2); }
.rel-alerta { display: block; padding: 8px 10px; margin: 6px 0; border-left: 4px solid; border-radius: 0; background: var(--card-2); color: var(--text); }
.rel-alerta:hover { background: var(--hover); }
/* ---------- PDV (caixa) ---------- */
.pdv2 { display: flex; flex-direction: column; gap: 10px; }
.pdv-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--primary); color: #fff; border-radius: 12px; padding: 10px 14px; }
.pdv-topo b { font-size: 1.15rem; }
.pdv-sub { margin-left: 10px; opacity: 0.8; font-size: 0.85rem; }
.pdv-topo .btn, .pdv-topo button { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.pdv-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; font-size: 0.85rem; cursor: pointer; }
.pdv-chip input { accent-color: var(--laranja); }
.pdv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 10px; align-items: start; }
.pdv-col { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
.pdv-busca { display: flex; align-items: center; gap: 8px; border: 2px solid var(--royal); border-radius: 10px; padding: 4px 6px 4px 10px; background: var(--card); }
.pdv-busca input { border: 0; outline: none; font-size: 1.05rem; padding: 8px 0; background: transparent; box-shadow: none; }
.pdv-busca:focus-within { border-color: var(--laranja); box-shadow: 0 0 0 3px var(--focus); }
.pdv-lupa { font-size: 1.1rem; opacity: 0.6; }
.pdv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; max-height: calc(100vh - 260px); overflow: auto; }
.pdv-res-tit { grid-column: 1 / -1; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.pdv-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); cursor: pointer; min-height: 96px; font: inherit; color: var(--text); }
.pdv-card:hover { border-color: var(--laranja); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.pdv-card-tipo { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; background: var(--royal-suave); color: var(--royal); font-weight: 700; }
.pdv-card-tipo.servico { background: var(--laranja-suave); color: var(--laranja-hover); }
.pdv-card-nome { font-weight: 600; line-height: 1.2; font-size: 0.9rem; }
.pdv-card-cod { font-size: 0.72rem; color: var(--muted); }
.pdv-card-preco { margin-top: auto; font-weight: 800; font-size: 1.05rem; color: var(--royal); }
.pdv-card-preco small { font-weight: 400; color: var(--muted); font-size: 0.7rem; }
.pdv-card-at { font-size: 0.7rem; color: #15803d; }
.pdv-vazio { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 10px; }
.pdv-cupom-cab { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px dashed var(--border); padding-bottom: 6px; margin-bottom: 4px; }
.pdv-itens { max-height: calc(100vh - 250px); overflow: auto; }
.pdv-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 78px 86px 26px; gap: 6px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.pdv-item.novo { animation: pdvNovo 1.2s ease-out; }
@keyframes pdvNovo { from { background: var(--laranja-suave); } to { background: transparent; } }
.pdv-item-n { font-size: 0.75rem; color: var(--muted); text-align: center; }
.pdv-item-desc { display: flex; flex-direction: column; min-width: 0; }
.pdv-item-desc b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.92rem; }
.pdv-at { color: #15803d; }
.pdv-qtd { display: inline-flex; align-items: center; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.pdv-qtd button { border: 0; border-radius: 0; padding: 4px 9px; background: var(--card-2); font-weight: 700; }
.pdv-qtd input { width: 46px; border: 0; text-align: center; padding: 4px 2px; border-radius: 0; }
.pdv-vu { text-align: right; padding: 5px 6px; }
.pdv-item-t { text-align: right; font-size: 0.95rem; }
.pdv-rm { border: 0; background: transparent; color: var(--muted); padding: 2px; font-size: 0.9rem; }
.pdv-rm:hover { color: var(--danger); }
.pdv-lado { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.pdv-bloco { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--card-2); }
.pdv-rotulo { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.pdv-cli-ok { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pdv-linha { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.pdv-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--primary); color: #fff; }
.pdv-total span { font-weight: 700; letter-spacing: 0.08em; font-size: 0.85rem; opacity: 0.85; }
.pdv-total b { font-size: 1.9rem; }
.pdv-pagar { display: flex; flex-direction: column; gap: 6px; }
.pdv-pagar > input { font-size: 1.15rem; font-weight: 700; text-align: right; }
.pdv-formas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.pdv-formas.pisca { animation: pdvPisca 0.4s 3; }
@keyframes pdvPisca { 50% { box-shadow: 0 0 0 3px var(--danger); border-radius: 8px; } }
.pdv-forma { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: 1.15rem; border-radius: 8px; }
.pdv-forma span { font-size: 0.66rem; font-weight: 600; }
.pdv-forma:hover { border-color: var(--laranja); background: var(--laranja-suave); }
.pdv-extra { display: flex; align-items: flex-end; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.pdv-extra label { width: 100%; margin: 0; }
.pdv-extra input { flex: 1; min-width: 120px; }
.pdv-pag { display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.pdv-falta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; font-weight: 700; }
.pdv-falta b { font-size: 1.3rem; color: var(--danger); }
.pdv-falta b.pdv-troco { color: #15803d; font-size: 1.5rem; }
.pdv-ok { color: #15803d; }
.pdv-obs { font-size: 0.9rem; }
.pdv-finalizar { width: 100%; font-size: 1.15rem; padding: 14px; border-radius: 10px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.pdv-finalizar:disabled { opacity: 0.5; cursor: not-allowed; }
.pdv-tecla, .pdv-atalhos b { font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.15); font-weight: 700; }
.pdv-atalhos { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
/* Atalho clicavel: icone grande azul royal, nome e a tecla. */
.pdv-atalho {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 92px; padding: 8px 12px 7px;
  background: var(--card); border: 1.5px solid var(--royal-suave); border-radius: 12px; color: var(--royal);
  font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.pdv-atalho svg { width: 30px; height: 30px; }
.pdv-atalho span { color: var(--text); }
.pdv-atalhos .pdv-atalho b { background: var(--royal); color: #fff; border: 0; font-size: 0.72rem; padding: 1px 8px; }
.pdv-atalho:hover { background: var(--royal-suave); border-color: var(--royal); transform: translateY(-1px); }
.pdv-atalho:active { transform: translateY(0); }
.pdv-item-desc-v { color: #15803d; font-size: 0.75rem; font-weight: 600; }

/* Tela de descontos do PDV (F6). */
.modal.modal-descontos { max-width: 980px; }
.desc-tabela { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.desc-tabela table { margin: 0; }
.desc-tabela thead th { position: sticky; top: 0; background: var(--card-2); z-index: 1; }
.desc-tabela tr.sel td { background: var(--royal-suave); }
.desc-tabela td input[data-desc] { width: 96px; text-align: right; padding: 4px 6px; }
.desc-aplicar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border: 1.5px solid var(--royal); border-left: 4px solid var(--laranja); border-radius: 10px; background: var(--royal-suave); }
.desc-totais { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.desc-totais > div { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--card); text-align: right; }
.desc-totais label { display: block; text-align: left; font-size: 0.75rem; color: var(--muted); margin: 0 0 2px; }
.desc-totais b { font-size: 1.1rem; }
.desc-totais .liquido { border-color: var(--royal); }
.desc-totais .liquido b { color: var(--royal); font-size: 1.3rem; }
.desc-botoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.desc-b { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.desc-b b { font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.08); }
.desc-b.azul { color: var(--royal); border-color: var(--royal); }
.desc-b.azul:hover { background: var(--royal-suave); }
.desc-b.laranja { color: var(--laranja-hover); border-color: var(--laranja); }
.desc-b.laranja:hover { background: var(--laranja-suave); }
.desc-b.vermelho { color: #fff; background: var(--royal); border-color: var(--royal); }
@media (max-width: 760px) { .desc-totais { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1250px) { .pdv-grid { grid-template-columns: minmax(0, 1fr) 340px; } .pdv-busca-col { grid-column: 1 / -1; } .pdv-cards { max-height: 260px; } }
@media (max-width: 820px) {
  .pdv-grid { grid-template-columns: minmax(0, 1fr); }
  .pdv-item { grid-template-columns: minmax(0, 1fr) auto 70px 24px; }
  .pdv-item-n { display: none; }
  .pdv-item-t { grid-column: 1 / -1; text-align: right; margin-top: -4px; }
  .pdv-sub { display: block; margin: 0; }
  .pdv-itens, .pdv-cards { max-height: none; }
}
/* Item do cupom em duas linhas: nome em cima, quantidade/preco embaixo */
.pdv-item { grid-template-columns: 22px auto minmax(70px, 90px) minmax(0, 1fr) 24px; grid-template-areas: 'n desc desc desc rm' 'n qtd vu tot tot'; row-gap: 4px; }
.pdv-item-n { grid-area: n; align-self: start; padding-top: 2px; }
.pdv-item-desc { grid-area: desc; }
.pdv-item-desc b { white-space: normal; }
.pdv-qtd { grid-area: qtd; }
.pdv-vu { grid-area: vu; }
.pdv-item-t { grid-area: tot; }
.pdv-item .pdv-rm { grid-area: rm; align-self: start; }
@media (max-width: 820px) { .pdv-item { grid-template-columns: auto minmax(70px, 90px) minmax(0, 1fr) 24px; grid-template-areas: 'desc desc desc rm' 'qtd vu tot tot'; } .pdv-item-t { margin-top: 0; } }
/* Menu lateral: submenu em cascata (Relatorios) */
.nav-seta { margin-left: auto; font-size: 0.8rem; opacity: 0.8; }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--primary-hover); }
.nav-sub[hidden] { display: none; }
.nav .nav-sub a { padding: 6px 10px; font-size: 0.86rem; }
.nav .nav-sub .ico { width: 18px; font-size: 0.85rem; }
.pick-sub { padding-left: 30px; font-size: 0.9rem; }
.pick-sub2 { padding-left: 52px; font-size: 0.85rem; }
.mais-seta { font-size: 0.9rem; }
.so-celular { display: none; }
@media (max-width: 820px) { .so-celular { display: block; } }
/* Sub-relatorios */
.nav-sub2 { display: flex; flex-direction: column; margin: 0 0 4px 26px; border-left: 1px dashed var(--primary-hover); }
.nav .nav-sub2 a { padding: 4px 10px; font-size: 0.8rem; opacity: 0.9; }
.sub-rel-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.mini-barra { height: 4px; background: var(--border); border-radius: 2px; margin-top: 3px; }
.mini-barra > div { height: 100%; background: var(--laranja); border-radius: 2px; }
table.sub-tab td, table.sub-tab th { white-space: nowrap; }
table.sub-tab td:not(.right) { white-space: normal; }
/* Menu lateral comprido (submenus abertos): rola por dentro */
.sidebar { overflow-y: auto; scrollbar-width: thin; }
.sidebar .nav, .sidebar .brand, .sidebar .user { flex-shrink: 0; }
tr.linha-total td { font-weight: 700; background: var(--card-2); }
.modo-consulta .fab { display: none; }
.faixa-licenca a { font-weight: 600; }
.badge-erp { font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(37, 99, 235, 0.12); color: #2563eb; vertical-align: middle; }
:root[data-theme='escuro'] .badge-erp { color: #93c5fd; }
/* Cadastro feito no proprio TI SG-OS (laranja; o do ERP e azul). */
.badge-sis { font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(249, 115, 22, 0.14); color: #c2410c; vertical-align: middle; }
:root[data-theme='escuro'] .badge-sis { color: #fdba74; }
/* Faturar OS/orcamento no PDV */
.pdv-fatura { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(124, 58, 237, 0.1); border: 1px solid rgba(124, 58, 237, 0.35); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 0.9rem; }
/* Estoque */
.badge.mov-ent { background: rgba(21, 128, 61, 0.12); color: #15803d; }
.badge.mov-sai { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.mov-tipo { flex: 1; padding: 12px; font-weight: 600; }
.mov-tipo.mov-ent-on { background: #15803d; border-color: #15803d; color: #fff; }
.mov-tipo.mov-sai-on { background: #dc2626; border-color: #dc2626; color: #fff; }
.pdv-linha[hidden] { display: none; }
/* Teclas dos finalizadores e da lista "Mais formas" */
.pdv-forma kbd, .pick kbd { font: 600 0.68rem/1 system-ui, sans-serif; padding: 2px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); background: var(--bg); }
.pdv-forma kbd { margin-top: 2px; }
/* Config. em abas */
.cfg-abas { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.cfg-aba { font-weight: 600; }
.cfg-aba.on { background: var(--primary, #2547d0); border-color: var(--primary, #2547d0); color: #fff; }

/* PDV em duas etapas: 1) itens  2) pagamento */
.pdv2[data-etapa="2"] .pdv-grid, .pdv2[data-etapa="2"] .pdv-atalhos { display: none; }
.pdv2:not([data-etapa="2"]) .pdv-etapa2 { display: none; }
.pdv-etapa2 { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 62vh; }
.pdv-e2-esq { background: var(--primary); color: #fff; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.pdv-e2-rot { font-size: 0.78rem; font-weight: 600; opacity: 0.85; }
.pdv-e2-valor { background: #fff; color: #0f172a; border-radius: 8px; padding: 8px 12px; text-align: right; font-size: 2rem; font-weight: 800; }
.pdv-e2-valor.falta { color: var(--danger); }
.pdv-e2-valor.falta.ok { color: #15803d; }
.pdv-e2-esq .pdv-falta { color: #fff; }
.pdv-e2-esq .pdv-falta b { color: #fff; }
.pdv-e2-cli { font-size: 0.9rem; margin-top: 6px; }
.pdv-confirmar { background: #15803d; border-color: #15803d; color: #fff; font-weight: 800; letter-spacing: 0.02em; }
.pdv-confirmar:hover { background: #166534; }
.pdv-e2-input { font-size: 1.8rem !important; border: 2px solid var(--accent) !important; }
.pdv-formas8 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.pdv-formas8 .pdv-forma { padding: 14px 6px; font-size: 1.5rem; }
.pdv-formas8 .pdv-forma span { font-size: 0.85rem; }
@media (max-width: 760px) { .pdv-etapa2 { grid-template-columns: 1fr; min-height: 0; } .pdv-formas8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Caixa: conferencia e fechamento */
.cx-totais { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.cx-totais > div { background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; font-size: 0.8rem; color: var(--muted); }
.cx-totais b { display: block; font-size: 1.5rem; }
.cx-fechar { background: #15803d; border-color: #15803d; color: #fff; font-weight: 700; }
.cx-fechar:hover { background: #166534; }


/* ---------- Icones (icones.js) ----------
   Nas telas: icone de linha na cor do texto. No menu: quadrado colorido por area. */
.tic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.nav a > .ico, .bottom-nav a > .ico {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: #475569; flex: none; font-size: 1rem;
}
.nav a > .ico .tic { width: 18px; height: 18px; vertical-align: 0; }
.nav a.active > .ico { box-shadow: 0 0 0 2px #fff; }
.nav .nav-sub a > .ico { width: 18px; height: 18px; background: none; box-shadow: none; }
.nav .nav-sub a > .ico .tic { width: 15px; height: 15px; }
.bottom-nav a > .ico { width: 28px; height: 28px; }
.bottom-nav a > .ico .tic { width: 17px; height: 17px; vertical-align: 0; }
.bottom-nav a.active > .ico { box-shadow: 0 0 0 2px #fff; }
.nav a[data-sub="relatorios"] > .ico { background: #db2777; }
.nav a[href="#/"] > .ico, .bottom-nav a[href="#/"] > .ico { background: #3b82f6; }
.nav a[href="#/os"] > .ico, .bottom-nav a[href="#/os"] > .ico { background: #f97316; }
.nav a[href="#/orcamentos"] > .ico, .bottom-nav a[href="#/orcamentos"] > .ico { background: #8b5cf6; }
.nav a[href="#/vendas/nova"] > .ico, .bottom-nav a[href="#/vendas/nova"] > .ico { background: #10b981; }
.nav a[href="#/agenda"] > .ico, .bottom-nav a[href="#/agenda"] > .ico { background: #0ea5e9; }
.nav a[href="#/encomendas"] > .ico, .bottom-nav a[href="#/encomendas"] > .ico { background: #d97706; }
.nav a[href="#/clientes"] > .ico, .bottom-nav a[href="#/clientes"] > .ico { background: #06b6d4; }
.nav a[href="#/produtos"] > .ico, .bottom-nav a[href="#/produtos"] > .ico { background: #b45309; }
.nav a[href="#/relatorios"] > .ico, .bottom-nav a[href="#/relatorios"] > .ico { background: #db2777; }
.nav a[href="#/financeiro"] > .ico, .bottom-nav a[href="#/financeiro"] > .ico { background: #059669; }
.nav a[href="#/usuarios"] > .ico, .bottom-nav a[href="#/usuarios"] > .ico { background: #6366f1; }
.nav a[href="#/config"] > .ico, .bottom-nav a[href="#/config"] > .ico { background: #64748b; }
.nav a[href="#/pmoc"] > .ico, .bottom-nav a[href="#/pmoc"] > .ico { background: #0d9488; }
.nav a[href="#/contratos"] > .ico, .bottom-nav a[href="#/contratos"] > .ico { background: #0d9488; }


/* ---------- Relatorios: periodo, catalogo e busca ---------- */
.seg-periodo { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-periodo button { border: 0; border-right: 1px solid var(--border); border-radius: 0; margin: 0; background: var(--card); }
.seg-periodo button:last-child { border-right: 0; }
.seg-periodo button.on { background: var(--royal); color: #fff; }
.rel-catalogo { margin-bottom: 12px; }
.rel-catalogo > input { max-width: 520px; }
#rel-busca-res { max-width: 520px; }
.rel-grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.rel-grupo { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.rel-grupo h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 0.95rem; }
.rel-grupo h3 i { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.rel-grupo h3 i .tic { width: 17px; height: 17px; vertical-align: 0; }
.rel-grupo a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 2px; border-top: 1px solid var(--border); color: var(--text); font-size: 0.9rem; }
.rel-grupo a:hover { color: var(--royal); }
.rel-grupo a span { color: var(--muted); }
@media print { .no-print { display: none !important; } }

/* ---------- Painel: abas por modulo ---------- */
.painel-abas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.painel-aba { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 0.9rem; }
.painel-aba:hover { border-color: var(--royal); }
.painel-aba.on { background: var(--royal); border-color: var(--royal); color: #fff; }
.painel-fixar { margin-left: auto; }
.painel-sec { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 2px 0 6px; }
a.status-card { color: inherit; }
.painel-alerta { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--border); color: var(--text); }
.painel-alerta:first-of-type { border-top: 0; }
.painel-atalhos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }

/* ---------- PDV: busca no topo dos itens, resultados em lista suspensa ---------- */
.pdv-busca-wrap { position: relative; margin-bottom: 10px; }
.pdv-busca kbd { font-size: 0.7rem; margin-left: 4px; }
.pdv-dropdown { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--sombra); max-height: 62vh; }
.pdv-dropdown:empty { display: none; }

/* ---------- PDV ocupando a tela do computador ---------- */
@media (min-width: 821px) {
  .main:has(.pdv2) { max-width: none; padding-top: 12px; padding-bottom: 12px; }
  .pdv2 { height: calc(100vh - 24px); min-height: 560px; }
  .pdv2 .pdv-grid { flex: 1; min-height: 0; align-items: stretch; }
  .pdv2 .pdv-cupom { display: flex; flex-direction: column; min-height: 0; }
  .pdv2 .pdv-itens { flex: 1; min-height: 0; max-height: none; }
  .pdv2 .pdv-lado { overflow: auto; min-height: 0; }
}
.pdv-atalhos-lado { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-top: 4px; }
.pdv-atalhos-lado .pdv-atalho { min-width: 0; padding: 5px 2px 4px; font-size: 0.66rem; border-radius: 9px; gap: 2px; }
.pdv-atalhos-lado .pdv-atalho svg { width: 22px; height: 22px; }
.pdv-atalhos-lado .pdv-atalho span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Tela cheia do PDV: sem o menu lateral. */
body.pdv-cheia .sidebar, body.pdv-cheia .mobile-header, body.pdv-cheia .bottom-nav { display: none !important; }
body.pdv-cheia .main { padding-left: 12px; padding-right: 12px; }

/* ---------- PDV: finalizadores, em aberto e troco ---------- */
.pdv-e2-lista { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pdv-e2-fin { display: flex; justify-content: space-between; gap: 8px; font-size: 0.95rem; padding: 2px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.25); }
.pdv-e2-fin.muted { opacity: 0.8; font-size: 0.85rem; }
.pdv-e2-aberto { margin-top: 6px; background: #fef3c7; color: #92400e; border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 0.9rem; }
.pdv-e2-troco { margin-top: 8px; background: #facc15; color: #1f2937; border-radius: 10px; padding: 8px 12px; display: flex; justify-content: space-between; align-items: baseline; }
.pdv-e2-troco span { font-weight: 800; font-size: 0.9rem; }
.pdv-e2-troco b { font-size: 1.9rem; font-weight: 800; }
.pdv-extra-troco { font-size: 1.05rem; color: #15803d; }
.pdv-ultimo-troco { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fef9c3; color: #713f12; border: 1px solid #facc15; border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; }
.pdv-ultimo-troco b { font-size: 1.3rem; }
.pdv-e2-esq .pdv-falta:has(.pdv-troco) { display: none; }

/* ---------- PDV: dinheiro no painel da esquerda (valor e troco) ---------- */
.pdv-msg { background: var(--card-2, #f1f5f9); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 1.05rem; margin-bottom: 10px; }
.pdv2.modo-din #pdv-valor-rot, .pdv2.modo-din .pdv-pagar { display: none; }
.pdv-e2-din { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.pdv-e2-din[hidden] { display: none; }
.pdv-din-tit { text-align: center; font-size: 1.5rem; font-weight: 700; margin: 4px 0 6px; }
.pdv-e2-din label { font-size: 0.8rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); margin: 4px 0 0; }
.pdv-e2-din input { background: #fff; color: #0f172a; border-radius: 8px; border: 2px solid #f97316; text-align: right; font-size: 1.8rem; font-weight: 800; padding: 6px 12px; }
.pdv-din-troco { background: #fff; border-radius: 8px; padding: 6px 12px; text-align: right; font-size: 1.8rem; font-weight: 800; color: #94a3b8; }
.pdv-din-troco.tem { color: #dc2626; }
.pdv-din-acoes { display: flex; gap: 6px; margin-top: 6px; }
.pdv-din-acoes button { flex: 1; background: rgba(255, 255, 255, 0.15); color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---------- PDV: valor e dados da forma no painel da esquerda (todas as formas) ---------- */
.pdv2 #pdv-valor-rot, .pdv2 .pdv-pagar { display: none; }
.pdv-forma-extra { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.pdv-forma-extra label { font-size: 0.8rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); margin: 4px 0 0; }
.pdv-forma-extra input, .pdv-forma-extra select { background: #fff; color: #0f172a; border-radius: 8px; font-size: 1rem; }
.pdv-forma-extra .small, .pdv-forma-extra .muted { color: rgba(255, 255, 255, 0.8) !important; }
.pdv-forma-extra .row { flex-wrap: nowrap; }

.pdv-espera-aviso { background: #facc15 !important; color: #1f2937 !important; border-color: #eab308 !important; font-weight: 700; }
/* Cadastro de entidades: cliente (verde), fornecedor (roxo), inativo (cinza). */
.badge-cli, .badge-forn, .badge-ina { font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.badge-cli { background: rgba(22, 163, 74, 0.13); color: #15803d; }
.badge-forn { background: rgba(124, 58, 237, 0.13); color: #6d28d9; }
.badge-ina { background: rgba(100, 116, 139, 0.18); color: #475569; }
:root[data-theme='escuro'] .badge-cli { color: #86efac; }
:root[data-theme='escuro'] .badge-forn { color: #c4b5fd; }
:root[data-theme='escuro'] .badge-ina { color: #cbd5e1; }
/* Etiquetas: sugestoes da busca de produto (abre sobre a lista). */
#et-res { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--card, #fff); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); max-height: 320px; overflow-y: auto; }
#et-res:empty { display: none; }
/* Editor de modelo de etiqueta: palco (etiqueta em escala) + painel lateral. */
.editor-etq { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.editor-etq-palco { background: repeating-conic-gradient(#f1f5f9 0% 25%, #e2e8f0 0% 50%) 50% / 16px 16px; border-radius: 10px; padding: 18px; display: flex; flex-direction: column; align-items: center; min-height: 200px; }
:root[data-theme='escuro'] .editor-etq-palco { background: #1e293b; }
.editor-etq-lado { max-height: 70vh; overflow-y: auto; }
.me-el { cursor: move; outline: 1px dashed rgba(99, 102, 241, 0.55); touch-action: none; user-select: none; }
.me-el.me-sel { outline: 2px solid #6366f1; background: rgba(99, 102, 241, 0.08); }
.me-alca { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; background: #6366f1; cursor: nwse-resize; border-radius: 2px 0 0 0; display: none; }
.me-sel .me-alca { display: block; }
.me-vazio { color: #94a3b8; font-style: italic; font-size: 11px; }
.me-lista { margin-bottom: 10px; max-height: 180px; overflow-y: auto; }
.me-item-sel { background: var(--royal-suave, #e0e7ff); }
@media (max-width: 760px) { .editor-etq { grid-template-columns: 1fr; } }
/* Fiscal: sugestoes da busca de NCM no cadastro do produto. */
.ncm-res { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--card); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); max-height: 300px; overflow-y: auto; }
.ncm-res:empty { display: none; }
/* Alteracao em lote: uma linha por campo (marcar + valor). */
.lote-linha { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 640px) { .lote-linha { grid-template-columns: 1fr; } }

/* Importar XML de NF-e de compra e Gerar precos */
.modal.larga { max-width: min(1400px, 96vw); }
.xml-grade td, .xml-grade th, .gp-tabela td, .gp-tabela th { white-space: nowrap; font-size: 0.82rem; padding: 4px 6px; }
.xml-grade td.desc, .gp-tabela td.desc { white-space: normal; }
.xml-grade tr[data-linha], .gp-tabela tr[data-gp] { cursor: pointer; }
.xml-foco td { background: rgba(37, 99, 235, 0.08); }
.xml-dif { background: #fef3c7; color: #92400e; }
.xml-custo { background: #ffedd5; }
.xml-custo-txt { color: #c2410c; font-weight: 600; }
.xml-acoes { white-space: nowrap; }
.xml-acoes button { padding: 2px 6px; }
.xml-totais { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; }
.xml-totais div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed var(--border); padding: 2px 0; }
.gp-blocos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.gp-bloco { border: 1px solid var(--border); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.gp-in { width: 84px; padding: 3px 6px; }
.gp-pct { width: 64px; text-align: right; }
.gp-abaixo { border-color: var(--danger) !important; color: var(--danger); }
.gp-abaixo-txt { color: var(--danger); font-weight: 700; }
[data-theme='escuro'] .xml-dif { background: #451a03; color: #fde68a; }
[data-theme='escuro'] .xml-custo { background: #431407; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='claro']) .xml-dif { background: #451a03; color: #fde68a; } :root:not([data-theme='claro']) .xml-custo { background: #431407; } }

/* Filtros da lista de produtos */
.filtros-prod { padding: 10px 12px; margin-bottom: 10px; }
.filtros-prod-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-bottom: 6px; }

/* PDV no celular: busca fixa no topo, acoes no "⋯ Mais", barra fixa com total e Pagar. */
.pdv-barra-cel, .so-celular-inline { display: none !important; }
@media (max-width: 820px) {
  .so-celular-inline { display: inline-flex !important; }
  .pdv-topo { padding: 8px 10px; }
  .pdv-topo .row > :not(#pdv-caixa):not(#pdv-mais-cel) { display: none !important; }
  .pdv-busca-wrap { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 15; background: var(--bg); padding: 6px 0; margin: 0 0 6px; }
  .pdv-busca input { font-size: 1.05rem; min-height: 50px; }
  .pdv-dropdown { max-height: 55vh; overflow: auto; }
  .pdv-item { padding: 10px 4px; }
  .pdv-item-desc b { font-size: 1rem; }
  .pdv-lado .pdv-finalizar#pdv-pagar { display: none; }
  .pdv2[data-etapa="1"] .pdv-barra-cel {
    display: flex !important; position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 19;
    justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card);
    border-top: 2px solid var(--laranja); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
  }
  .pdv-barra-cel b { font-size: 1.5rem; color: var(--royal); }
  .pdv-barra-cel button { font-size: 1.1rem; padding: 12px 22px; min-height: 52px; }
  .pdv2[data-etapa="1"] { padding-bottom: 84px; }
  .pdv-formas8 .pdv-forma { min-height: 64px; font-size: 1rem; }
  .pdv-e2-input { font-size: 1.4rem; min-height: 54px; }
  .pdv2[data-etapa="2"] .pdv-etapa2 { display: flex; flex-direction: column; gap: 10px; padding-bottom: 90px; }
  .pdv-e2-esq { gap: 4px; }
  .pdv-e2-valor { font-size: 1.5rem; }
  .pdv-confirmar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); width: auto; z-index: 19; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.15); }
  .pdv-busca kbd, .pdv-formas8 kbd, .pdv-confirmar .pdv-tecla { display: none; }
}

/* Janela propria do PDV (app do PC): so o caixa, sem menu lateral nem barra de baixo. */
.janela-pdv .sidebar, .janela-pdv .mobile-header, .janela-pdv .bottom-nav { display: none !important; }
.janela-pdv .main { padding: 10px 12px; }

/* Botao + do celular: menu de acoes rapidas. */
.fab { transition: transform 0.15s; }
.fab.aberto { transform: rotate(45deg); z-index: 31; }
.fab-fundo { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 30; }
.fab-menu { position: absolute; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.fab-opcao { all: unset; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.fab-rotulo { background: var(--card); color: var(--text); font-size: 0.95rem; font-weight: 500; padding: 7px 12px; border-radius: 8px; box-shadow: var(--sombra); }
.fab-ico { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; box-shadow: var(--sombra); }
/* Mesmas cores do menu (icone branco em fundo solido). */
.fab-ico { color: #fff; border-radius: 14px; }
.fab-ico .tic { width: 24px; height: 24px; vertical-align: 0; }
.fab-venda { background: #10b981; } .fab-os { background: #f97316; } .fab-receber { background: #059669; } .fab-pagar { background: #dc2626; } .fab-estoque { background: #b45309; }

/* Menu lateral: grupos, contadores e submenu que abre por cima (computador). */
.nav-grupo { font-size: 0.72rem; opacity: 0.7; padding: 12px 12px 4px; letter-spacing: 0.02em; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; text-align: center; background: #fff; color: var(--primary); }
.nav-badge[data-badge='vencidos'] { background: #fee2e2; color: #b91c1c; }
.nav-badge + .nav-seta { margin-left: 6px; }
.nav a.fly-aberto { background: var(--primary-hover); color: #fff; }
.nav-fly {
  position: fixed; z-index: 60; display: flex; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18); max-height: calc(100vh - 16px); overflow: hidden;
}
.nav-fly-col { width: 230px; padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.nav-fly-col2 { width: 300px; border-left: 1px solid var(--border); }
.nav-fly-tit { font-size: 0.75rem; color: var(--muted); padding: 4px 10px 6px; }
.nav-fly a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 0.9rem; text-decoration: none; }
.nav-fly a:hover, .nav-fly a:focus-visible, .nav-fly a.sel { background: var(--hover); outline: none; }
.nav-fly .ico { width: 20px; text-align: center; }
.nav-fly-seta { margin-left: auto; color: var(--muted); }
@media (max-width: 820px) { .nav-fly { display: none; } }

/* Janela de cadastro (produto, cliente, pedido): topo, abas, secoes com faixa,
   rotulos a esquerda, painel lateral e rodape fixo. */
.modal.modal-cad { max-width: min(1120px, 96vw); padding: 0; overflow: auto; }
.cad { display: flex; flex-direction: column; min-height: 100%; }
.cad-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cad-tit { display: flex; align-items: center; gap: 10px; }
.cad-tit h2 { margin: 0; font-size: 1.15rem; }
.cad-chip { font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 10px; background: #dcfce7; color: #166534; }
.cad-chip.inativo { background: #fee2e2; color: #991b1b; }
.cad-acoes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cad-abas { display: flex; gap: 2px; padding: 0 12px; background: var(--card-2); border-bottom: 1px solid var(--border); overflow-x: auto; }
.cad-aba { all: unset; cursor: pointer; padding: 9px 14px; font-size: 0.9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.cad-aba kbd { font: inherit; font-size: 0.68rem; opacity: 0.6; margin-left: 6px; }
.cad-aba[aria-selected='true'] { color: var(--primary); border-bottom-color: var(--primary); background: var(--card); font-weight: 600; }
.cad-aba:focus-visible { outline: 2px solid var(--royal); outline-offset: -2px; }
.cad-corpo { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; padding: 14px 18px; flex: 1; }
.cad-corpo.sem-lado { grid-template-columns: minmax(0, 1fr); }
.cad-painel[hidden] { display: none; }
.cad-sec { font-weight: 600; font-size: 0.92rem; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--card)); padding: 5px 10px; border-radius: 6px; margin: 4px 0 10px; }
.cad-lin { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 8px; }
.cad-lin > label { text-align: right; color: var(--muted); font-size: 0.88rem; margin: 0; }
.cad-campo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cad-campo > input, .cad-campo > select, .cad-campo > textarea { flex: 1; min-width: 0; }
.cad-rot2 { color: var(--muted); font-size: 0.88rem; white-space: nowrap; margin: 0 0 0 6px; }
label.cad-ob, b.cad-ob, .cad-rot2.cad-ob { color: #15803d; }
.cad-precos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cad-preco { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cad-preco > input { font-size: 1.25rem; font-weight: 700; text-align: right; }
.cad-preco-venda { border-color: color-mix(in srgb, #15803d 45%, var(--border)); }
.cad-margem { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.cad-margem input { width: 80px; text-align: right; padding: 4px 6px; min-height: 0; }
.cad-lado { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--card-2); align-self: start; }
.cad-lado-tit { font-weight: 600; margin-bottom: 8px; }
.cad-lado-k { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.cad-lado-v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cad-rodape { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px; background: var(--card-2); border-top: 1px solid var(--border); flex-wrap: wrap; z-index: 2; }
.cad-info { color: var(--muted); font-size: 0.85rem; }
.cad-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 820px) {
  .cad-corpo { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  .cad-lado { order: 2; }
  .cad-lin { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .cad-lin > label { text-align: left; }
  .cad-campo { flex-wrap: wrap; }
  .cad-precos { grid-template-columns: minmax(0, 1fr); }
  .cad-aba kbd { display: none; }
  .cad-info, .cad-tecla { display: none; }
  .cad-rodape { padding: 8px 10px; }
  .cad-botoes { width: 100%; flex-wrap: nowrap; }
  .cad-botoes button { flex: 1; padding: 8px 6px; font-size: 0.85rem; white-space: normal; }
}

/* Pedido de venda (tela cheia no padrao de cadastro). */
.cad-pagina { background: var(--card); border: 1px solid var(--border); border-radius: 12px; min-height: calc(100vh - 80px); }
.cad-pagina .cad-topo { border-radius: 12px 12px 0 0; }
.cad-pagina .cad-rodape { border-radius: 0 0 12px 12px; }
.cad-total { font-size: 1rem; color: var(--text); }
.cad-total b { font-size: 1.5rem; margin-left: 10px; color: var(--primary); font-variant-numeric: tabular-nums; }
.ped-totais { max-width: 460px; }
.ped-tot-lin { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px dashed var(--border); }
.ped-tot-lin.forte { font-size: 1.15rem; background: var(--card-2); border-radius: 8px; border-bottom: 0; margin-top: 6px; }
@media (max-width: 820px) { .cad-pagina { min-height: 0; } .cad-total b { font-size: 1.2rem; } }

/* Janela do item do pedido: lista da busca e item escolhido. */
.ip-lista { max-height: 260px; overflow: auto; margin: 4px 0 8px; }
.ip-lista:empty { display: none; }
.ip-card { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 8px 12px; margin: 6px 0 4px; background: var(--card-2); }
.ped-pags select, .ped-pags input { width: 100%; }

/* Etiquetas: filtros e configuracoes da lista de produtos (modelo da loja). */
.et-filtros { margin-bottom: 4px; }
.et-fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
.et-fgrid label { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; color: var(--muted); margin: 0; }
.et-fgrid input, .et-fgrid select { width: 100%; }
.et-rodape { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
#et-itens tr.et-desmarcado td { opacity: 0.5; }

/* Rotas de cobranca. */
.cob-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.cob-resumo > div { display: flex; flex-direction: column; }
.cob-parada { padding: 10px 12px; margin-bottom: 8px; }
.cob-parada.cob-feita { background: var(--card-2); }
.cob-par-topo, .cob-ord { display: flex; gap: 8px; align-items: flex-start; }
.cob-ord { align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cob-pos { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-size: 0.8rem; }
.cob-setas { display: flex; gap: 4px; flex: none; }
.cob-botoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cob-botoes > * { flex: 1 1 auto; text-align: center; }

.cob-doc { padding: 8px 0; border-bottom: 1px solid var(--border); }
.cob-doc-v { display: flex; gap: 8px; margin-top: 4px; }
.cob-doc-v label { flex: 1; margin: 0; font-size: 0.8rem; color: var(--muted); }
.cob-doc-v input { width: 100%; }
.barra-voltar { margin-bottom: 10px; }

/* Contas a pagar e receber: marcacao lateral pela situacao do vencimento. */
.fin-lista { padding: 0; overflow-x: auto; }
.fin-tab { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.fin-tab th { text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fin-tab th:first-child { padding-left: 21px; }
.fin-tab td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.fin-tab td.fin-venc { padding-left: 21px; font-weight: 700; }
.fin-tab td.fin-quem { white-space: normal; width: 100%; min-width: 180px; }
.fin-tab td.fin-quem .btn { margin-top: 4px; }
.fin-tab .n { text-align: right; }
.fin-tab .fin-aberto { font-weight: 700; }
.fin-tab tbody tr { cursor: pointer; }
.fin-tab tbody tr:hover { background: var(--bg); }
.fin-tab tbody tr:last-child td { border-bottom: 0; }
.fin-tab tr.fin-vencida td.fin-venc { color: var(--danger); }
.fin-tab tr.fin-hoje td.fin-venc { color: #d97706; }
.fin-tab tr.fin-avencer td.fin-venc { color: #65a30d; }
.fin-tab td.fin-marca { width: 1%; padding-left: 21px; padding-right: 2px; cursor: default; }
.fin-tab td.fin-marca + td.fin-venc { padding-left: 8px; }
.fin-tab tr.fin-vencida td:first-child { border-left: 12px solid #e24b4a; padding-left: 9px; }
.fin-tab tr.fin-hoje td:first-child { border-left: 12px solid #ef9f27; padding-left: 9px; }
.fin-tab tr.fin-avencer td:first-child { border-left: 12px solid #639922; padding-left: 9px; }
.fin-marca input { width: 20px; height: 20px; margin: 0; cursor: pointer; }
.fin-f, .cc-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 10px; margin-bottom: 12px; align-items: end; }
.fin-f > label, .cc-f > label, .fin-rot { display: block; font-size: 0.78rem; color: var(--muted); min-width: 0; }
.fin-f input, .fin-f select, .cc-f input, .cc-f select { width: 100%; min-width: 0; }
.fin-f-cli, .fin-f-busca, .cc-cli { grid-column: span 2; min-width: 0; }
.fin-f-bts { display: flex; gap: 6px; }
.fin-carne { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.fin-carne .chk { margin: 0; }
.fin-carne-bts { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.fin-legenda { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); }
.fin-k { display: inline-block; width: 12px; height: 14px; vertical-align: -3px; margin-right: 6px; }
.fin-k.fin-vencida { background: #e24b4a; }
.fin-k.fin-hoje { background: #ef9f27; }
.fin-k.fin-avencer { background: #639922; }
@media (max-width: 820px) {
  .fin-lista { background: transparent; border: 0; box-shadow: none; }
  .fin-tab, .fin-tab tbody { display: block; }
  .fin-tab thead { display: none; }
  .fin-tab tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px; padding: 10px 10px 10px 12px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 0; }
  .fin-tab tbody tr:hover { background: var(--card); }
  .fin-tab td, .fin-tab td.fin-venc, .fin-tab td.fin-marca + td.fin-venc, .fin-tab tr.fin-vencida td:first-child, .fin-tab tr.fin-hoje td:first-child, .fin-tab tr.fin-avencer td:first-child { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  .fin-tab tbody tr { position: relative; }
  .fin-tab td.fin-marca, .fin-tab tr.fin-vencida td.fin-marca:first-child, .fin-tab tr.fin-hoje td.fin-marca:first-child, .fin-tab tr.fin-avencer td.fin-marca:first-child { position: absolute; top: 10px; right: 10px; width: auto; padding: 0; }
  .fin-tab:has(.fin-marca) td.fin-quem { padding-right: 34px; }
  .fin-f-cli, .fin-f-busca, .cc-cli { grid-column: 1 / -1; }
  .fin-tab td[data-rot]::before { content: attr(data-rot); display: block; font-size: 0.74rem; font-weight: 400; color: var(--muted); }
  .fin-tab td.fin-quem { grid-column: 1 / -1; grid-row: 1; width: auto; min-width: 0; margin-bottom: 4px; }
  .fin-tab tr.fin-vencida { border-left: 12px solid #e24b4a; }
  .fin-tab tr.fin-hoje { border-left: 12px solid #ef9f27; }
  .fin-tab tr.fin-avencer { border-left: 12px solid #639922; }
}

/* Oficina: nivel do tanque e item fora do total. */
.tanque { display: flex; gap: 4px; }
.tanque button { flex: 1; min-width: 0; padding-left: 2px; padding-right: 2px; }
.tanque button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tanque-barra { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 6px; }
.tanque-barra i { display: block; height: 100%; background: var(--accent); }
.card-interno { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.item-oficina { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0 4px; }
.item-oficina select, .item-oficina input { width: auto; min-width: 0; flex: 1; font-size: 0.8rem; padding-top: 3px; padding-bottom: 3px; }
.item-fora input[data-f="descricao"] { text-decoration: line-through; color: var(--muted); }

/* Cores por significado: mudam de tom com o tema, para dar leitura. */
:root { --c-verde: #3b6d11; --c-azul: #185fa5; --c-roxo: #534ab7; --c-ambar: #b45309; --c-verde-bg: #eaf3de; --c-vermelho-bg: #fcebeb; --c-ambar-bg: #faeeda; --c-vermelho: #a32d2d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) { --c-verde: #97c459; --c-azul: #85b7eb; --c-roxo: #afa9ec; --c-ambar: #fac775; --c-verde-bg: #27500a; --c-vermelho-bg: #791f1f; --c-ambar-bg: #633806; --c-vermelho: #f7c1c1; }
}
:root[data-theme='escuro'] { --c-verde: #97c459; --c-azul: #85b7eb; --c-roxo: #afa9ec; --c-ambar: #fac775; --c-verde-bg: #27500a; --c-vermelho-bg: #791f1f; --c-ambar-bg: #633806; --c-vermelho: #f7c1c1; }

/* Perfil de acesso: permissoes em arvore. Os pais seguem a cor da empresa. */
.pm-topo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; margin-bottom: 8px; }
.pm-topo .field { margin: 0; }
.pm-bts { flex-wrap: nowrap; gap: 6px; }
.pm-arvore { border: 1px solid var(--border); border-radius: 8px; overflow: auto; max-height: 56vh; }
.pm-l { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pm-l:last-child { border-bottom: 0; }
.pm-l:hover { background: var(--bg); }
.pm-l:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.pm-seta { width: 20px; flex: none; text-align: center; color: var(--muted); font-size: 1rem; }
.pm-nome { flex: 1; min-width: 0; }
.pm-nome small { display: block; color: var(--muted); font-size: 0.78rem; }
.pm-n0, .pm-n0:hover { background: color-mix(in srgb, var(--link) 14%, var(--card)); border-left: 6px solid var(--link); padding-top: 9px; padding-bottom: 9px; }
.pm-n0 .pm-nome { font-weight: 700; font-size: 1rem; color: var(--link); }
.pm-n0 .pm-seta { color: var(--link); }
.pm-n1, .pm-n1:hover { background: var(--bg); }
.pm-n1 .pm-nome { font-weight: 600; }
.pm-n1 .pm-seta { color: var(--text); }
.pm-st { flex: none; min-width: 78px; text-align: center; padding: 2px 8px; border-radius: 6px; font-size: 0.76rem; font-weight: 600; }
.pm-sim { background: var(--c-verde-bg); color: var(--c-verde); }
.pm-nao { background: var(--c-vermelho-bg); color: var(--c-vermelho); }
.pm-sen { background: var(--c-ambar-bg); color: var(--c-ambar); }
.pm-mix { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
.pm-pct { width: 78px; flex: none; }
@media (max-width: 820px) {
  .pm-topo { grid-template-columns: minmax(0, 1fr); }
  .pm-bts { flex-wrap: wrap; }
}

/* Operacoes de caixa: mesma lista do financeiro, com marca por tipo. */
.op-tab tr.op-venda td:first-child { border-left: 12px solid #639922; padding-left: 9px; color: var(--c-verde); }
.op-tab tr.op-recebimento td:first-child { border-left: 12px solid #378ADD; padding-left: 9px; color: var(--c-azul); }
.op-tab tr.op-mov td:first-child { border-left: 12px solid #7F77DD; padding-left: 9px; color: var(--c-roxo); }
.op-tab tr.op-desistida td:first-child { border-left: 12px solid #EF9F27; padding-left: 9px; color: var(--c-ambar); }
.op-tab tr.op-cancelada td:first-child { border-left: 12px solid #E24B4A; padding-left: 9px; color: var(--danger); }
.op-tab tr.op-cancelada .fin-aberto { text-decoration: line-through; color: var(--muted); }
.op-tab tr.op-sem-link { cursor: default; }
.fin-k.op-k-venda { background: #639922; }
.fin-k.op-k-recebimento { background: #378ADD; }
.fin-k.op-k-mov { background: #7F77DD; }
.fin-k.op-k-desistida { background: #EF9F27; }
.fin-k.op-k-cancelada { background: #E24B4A; }
@media (max-width: 820px) {
  .op-tab tr[class*="op-"] td:first-child { border: 0; padding: 0; }
  .op-tab tr.op-venda { border-left: 12px solid #639922; }
  .op-tab tr.op-recebimento { border-left: 12px solid #378ADD; }
  .op-tab tr.op-mov { border-left: 12px solid #7F77DD; }
  .op-tab tr.op-desistida { border-left: 12px solid #EF9F27; }
  .op-tab tr.op-cancelada { border-left: 12px solid #E24B4A; }
}

/* Produtos: venda abaixo do custo (vermelho) e margem baixa (amarelo). */
.os-item.prod-abaixo { border-left: 8px solid #e24b4a; background: rgba(226, 75, 74, 0.1); }
.os-item.prod-baixa { border-left: 8px solid #ef9f27; background: rgba(239, 159, 39, 0.13); }
.os-item .prod-margem { color: var(--muted); }
.os-item.prod-abaixo .side b, .os-item.prod-abaixo .prod-margem, .os-item.prod-abaixo .prod-aviso { color: var(--danger); }
.os-item.prod-baixa .side b, .os-item.prod-baixa .prod-margem, .os-item.prod-baixa .prod-aviso { color: var(--c-ambar); }
.prod-aviso { font-weight: 700; }

/* Campos de busca: icone de lupa. */
input[name="busca"], input[id$="busca"], input[placeholder^="Buscar"], #busca-eq, #busca-rc, #bp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 9px center;
  background-size: 16px;
  padding-left: 32px;
}
.filters .cli-linha { flex: 1; min-width: 180px; }

/* Baixa estornada: fica no historico do documento, riscada. */
.baixa-estornada .baixa-valor { text-decoration: line-through; color: var(--muted); }
.baixa-estornada .baixa-aviso { color: var(--danger); }

/* Campo de cliente: lupa, alterar e novo; janela da lupa. */
.cli-linha { display: flex; gap: 6px; align-items: center; }
.cli-linha > input { flex: 1; min-width: 0; }
.cli-linha > .pdv-cli-ok { flex: 1; min-width: 0; }
.cli-bts { display: inline-flex; gap: 4px; flex: none; }
.cli-bt { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cli-bt:hover { filter: brightness(1.15); }
.cli-lupa { background: #534ab7; }
.cli-alterar { background: #0f6e56; }
.cli-novo.cli-novo { background: #185fa5; color: #fff; border-color: #185fa5; }
.lc-f { display: grid; grid-template-columns: minmax(0, 1fr) 130px 130px; gap: 8px; }
.lc-f label { margin: 0; font-size: 0.8rem; color: var(--muted); }
.lc-f input, .lc-f select { width: 100%; }
.lc-lista { max-height: 50vh; overflow: auto; }
.lc-tab { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lc-tab th { position: sticky; top: 0; background: var(--card); text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--border); }
.lc-tab td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lc-tab tbody tr { cursor: pointer; }
.lc-tab tbody tr:hover, .lc-tab tbody tr.sel { background: var(--bg); }
.lc-tab tbody tr.sel { box-shadow: inset 3px 0 0 #534ab7; }
.lc-tab .lc-acao { text-align: right; white-space: nowrap; }
@media (max-width: 820px) {
  .lc-f { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lc-f .lc-busca { grid-column: 1 / -1; }
  .lc-tab thead { display: none; }
  .lc-tab, .lc-tab tbody { display: block; }
  .lc-tab tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 10px; padding: 8px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px; }
  .lc-tab td { display: block; padding: 0; border: 0; }
  .lc-tab td.lc-nome { grid-column: 1 / -1; }
  .lc-tab td[data-rot]::before { content: attr(data-rot); display: block; font-size: 0.74rem; color: var(--muted); }
  .lc-tab .lc-acao { text-align: left; margin-top: 6px; }
}

/* Credito do cliente: barra em aberto x limite, aviso do PDV e janela de liberacao */
.cred-num { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; }
.cred-barra { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 6px 0 4px; }
.cred-barra i { display: block; height: 100%; }
.cred-venc { color: var(--c-vermelho); }
.cred-alerta { border: 1px solid var(--c-vermelho); background: var(--c-vermelho-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.cred-alerta ul { margin: 6px 0 0; padding-left: 18px; }
.cred-contas { margin-bottom: 10px; }
.cred-contas summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
.cred-formas { margin: 4px 0 6px 26px; } .cred-formas > .chk { display: flex; } .cred-formas input[type="radio"] { width: auto; flex: none; margin: 0; }
.cred-formas-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-left: 26px; }
.pdv-cred { margin-top: 6px; padding: 6px 8px; border-radius: 6px; font-size: 0.85rem; border-left: 4px solid var(--c-verde); background: var(--c-verde-bg); }
.pdv-cred.atencao { border-left-color: var(--c-ambar); background: var(--c-ambar-bg); }
.pdv-cred.ruim { border-left-color: var(--c-vermelho); background: var(--c-vermelho-bg); }

/* Incluir item do pedido: resumo dos itens ao lado */
.cad-corpo.ip-com-resumo { grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); }
.ip-resumo-lista { max-height: 330px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.ip-resumo-lista table.items { margin: 0; font-size: 0.85rem; }
.ip-resumo-lista td.right b { color: var(--c-verde); }
.ip-resumo-lista tr.ip-vivo td { background: color-mix(in srgb, var(--c-azul) 14%, transparent); }
.ip-resumo-tot { display: grid; grid-template-columns: 1.6fr 1fr 0.8fr; gap: 8px; margin-top: 8px; }
@media (max-width: 820px) { .cad-corpo.ip-com-resumo { grid-template-columns: minmax(0, 1fr); } }

/* Lista de pedidos (estilo do Financeiro) */
.ped-tab tfoot td { padding: 9px 8px; border-top: 2px solid var(--border); font-size: 0.85rem; }
.ped-tab tfoot td:first-child { padding-left: 21px; }
.ped-tab td.ped-acoes { white-space: nowrap; }
.ped-custo-ruim { color: var(--c-vermelho); font-weight: 700; }
.fin-k.op-k-desistida { background: #EF9F27; }
.fin-k.op-k-cancelada { background: #E24B4A; }
@media (max-width: 820px) { .ped-tab tfoot { display: none; } }

/* Zerar banco: partes para marcar */
.zerar-partes { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.zerar-parte { display: flex; margin: 0; padding: 4px 0; }
.zerar-parte span { flex: 1; }
.zerar-parte b { font-variant-numeric: tabular-nums; }
.zerar-parte input { width: auto; flex: none; }

/* Promocoes */
.pdv-promo { display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--c-roxo); background: color-mix(in srgb, var(--c-roxo) 12%, transparent); border-radius: 6px; padding: 1px 6px; margin-top: 2px; }
.promo-tipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.promo-tipo { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; font-weight: 500; }
.promo-tipo input { width: auto; flex: none; }
.promo-tipo:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.status-card.on { outline: 2px solid var(--accent); }

/* Atalhos do Painel */
.atalhos { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 0 0 14px; }
.atalho { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px; padding: 10px 6px; border: 1px solid var(--border); border-top: 4px solid var(--atalho-cor, var(--accent)); border-radius: 10px; background: var(--card); color: var(--text); text-decoration: none; text-align: center; font: inherit; cursor: pointer; }
.atalho:hover, .atalho:focus-visible { background: var(--hover); }
.atalho-ico { font-size: 1.5rem; line-height: 1; }
.atalho-nome { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.atalho-edit { border-style: dashed; border-top: 1px dashed var(--border); color: var(--muted); }
.at-lin { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.at-lin .at-fx { flex-basis: 100%; }

/* Barra de rolagem sempre visivel (telas, listas e janelas) */
html { overflow-y: scroll; }
* { scrollbar-width: auto; scrollbar-color: color-mix(in srgb, var(--text) 35%, transparent) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: color-mix(in srgb, var(--text) 6%, transparent); }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 32%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 48%, transparent); }

/* Avisos e confirmacoes (no lugar das caixas do Windows/navegador) */
.modal.dlg-modal { max-width: 460px; padding: 20px 22px 16px; border-top: 4px solid var(--accent); }
.dlg { display: flex; gap: 14px; align-items: flex-start; }
.dlg-ico { flex: none; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.dlg-perigo .dlg-ico, .dlg-erro .dlg-ico { background: color-mix(in srgb, var(--c-vermelho) 14%, transparent); }
.dlg-aviso .dlg-ico { background: color-mix(in srgb, var(--c-ambar) 18%, transparent); }
.modal.dlg-modal:has(.dlg-perigo), .modal.dlg-modal:has(.dlg-erro) { border-top-color: var(--c-vermelho); }
.modal.dlg-modal:has(.dlg-aviso) { border-top-color: var(--c-ambar); }
.dlg-corpo { min-width: 0; flex: 1; }
.dlg-tit { font-size: 1.05rem; margin: 2px 0 6px; line-height: 1.35; }
.dlg-msg { color: var(--text); line-height: 1.5; }
.dlg-msg:empty { display: none; }
.dlg-det { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--hover); color: var(--muted); font-size: 0.85rem; word-break: break-word; }
.dlg-botoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* Erros: janela maior, para ler com calma */
.modal.dlg-modal.dlg-grande { max-width: 560px; width: calc(100% - 32px); padding: 26px 28px 20px; border-top-width: 6px; }
.dlg-grande .dlg-ico { width: 56px; height: 56px; font-size: 1.7rem; }
.dlg-grande .dlg-tit { font-size: 1.25rem; margin-top: 4px; }
.dlg-grande .dlg-msg { font-size: 1.02rem; }
.dlg-grande .dlg-botoes { margin-top: 22px; }
.dlg-grande .dlg-botoes button { min-width: 96px; padding: 10px 18px; }

/* Receber contas: atalhos de selecao */
.rc-selecao { justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }

/* Plano de fundo do Painel e do PDV: imagem fixa + veu da cor do tema.
   Cartoes, listas e botoes ja tem fundo proprio e ficam solidos por cima. */
body.com-fundo {
  background-color: var(--bg);
  background-image: linear-gradient(color-mix(in srgb, var(--bg) var(--fundo-veu, 70%), transparent), color-mix(in srgb, var(--bg) var(--fundo-veu, 70%), transparent)), var(--fundo-img);
  background-size: auto, var(--fundo-ajuste, cover);
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
.fundo-cfg { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.fundo-campos { flex: 1; min-width: 260px; }
.fundo-previa { position: relative; width: 220px; height: 132px; border-radius: 10px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; gap: 8px; background-color: var(--bg); background-position: center; background-repeat: no-repeat; overflow: hidden; }
.fundo-previa.tem { border-style: solid; }
.fundo-previa.tem::before { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) var(--veu, 70%), transparent); }
.fundo-previa-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 0.8rem; font-weight: 600; }

/* Observacao de cada item do orcamento/pedido. */
.items td.desc .orc-obs { margin-top: 4px; font-size: 0.82rem; font-style: italic; background: transparent; }

/* ---------- Atualizador de NCM ---------- */
.ncm-fonte { display: flex; gap: 10px; align-items: center; }
.ncm-card { border-top: 4px solid var(--c); }
.ncm-card.on { outline: 2px solid var(--laranja); }
.ncm-tabela { overflow: auto; max-height: calc(100vh - 430px); min-height: 220px; border: 1px solid var(--border); border-radius: 8px; }
.ncm-tabela th { position: sticky; top: 0; background: var(--card-2); z-index: 1; padding: 8px 6px; }
.ncm-tabela td { padding: 6px; vertical-align: top; }
.ncm-cod { font-family: Consolas, monospace; font-weight: 600; white-space: nowrap; }
.ncm-antes { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(220, 38, 38, 0.5); }
.ncm-seta { color: var(--laranja); font-weight: 700; padding-right: 4px; }
.ncm-prod { color: var(--danger); }
.ncm-chk { width: 18px; height: 18px; accent-color: var(--laranja); }
.ncm-input { width: 130px; font-family: Consolas, monospace; }
.ncm-input.erro { border-color: var(--danger); }
.ncm-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.ncm-b-novo { background: #dcfce7; color: #166534; }
.ncm-b-ext { background: #fee2e2; color: #991b1b; }
.ncm-b-reat { background: #dbeafe; color: #1e40af; }
.ncm-b-nome { background: #ffedd5; color: #9a3412; }
.ncm-b-igual { background: var(--card-2); color: var(--muted); }
.ncm-barra { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08); }
.ncm-barra #ncm-resumo { flex: 1; color: var(--muted); }
.ncm-barra #ncm-resumo b { color: var(--text); }
.ncm-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 10px 0; }
.ncm-mini div { background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ncm-mini b { display: block; font-size: 1.2rem; }
.ncm-mini span { font-size: 0.72rem; color: var(--muted); }
.ncm-timer { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: #fee2e2; color: #991b1b; font-weight: 600; }
.ncm-timer-barra { flex: 1; height: 6px; background: rgba(153, 27, 27, 0.15); border-radius: 99px; overflow: hidden; }
.ncm-timer-barra i { display: block; height: 100%; background: #dc2626; transition: width 1s linear; }
:root[data-theme='escuro'] .ncm-b-novo { background: #14321f; color: #86efac; }
:root[data-theme='escuro'] .ncm-b-ext, :root[data-theme='escuro'] .ncm-timer { background: #3b1414; color: #fca5a5; }
:root[data-theme='escuro'] .ncm-b-reat { background: #172a52; color: #93c5fd; }
:root[data-theme='escuro'] .ncm-b-nome { background: #3a2213; color: #fdba74; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .ncm-b-novo { background: #14321f; color: #86efac; }
  :root:not([data-theme='claro']) .ncm-b-ext, :root:not([data-theme='claro']) .ncm-timer { background: #3b1414; color: #fca5a5; }
  :root:not([data-theme='claro']) .ncm-b-reat { background: #172a52; color: #93c5fd; }
  :root:not([data-theme='claro']) .ncm-b-nome { background: #3a2213; color: #fdba74; }
}
@media (max-width: 700px) { .ncm-mini { grid-template-columns: repeat(2, 1fr); } .ncm-barra { flex-wrap: wrap; } }

/* Tela Fiscal: barra do verificador de NCM so depois de verificar. */
.ncm-barra[hidden] { display: none; }

/* Receber contas: valor que abate nas contas (mais antigas ou marcadas). */
.rc-abater { margin-top: 10px; padding: 10px; border: 1px dashed var(--border, #cbd5e1); border-radius: 10px; }
.rc-abater label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.rc-abater #rc-sobra { margin-top: 6px; }
