/* =====================================================================
 * MAKER SYSTEM · Portal do contador
 * ---------------------------------------------------------------------
 * Folha PROPRIA, e nao a app.css do lojista, por tres razoes:
 *
 *   1. a app.css tem 139 KB para desenhar PDV, grade de tamanho, editor
 *      de etiqueta e mais quarenta telas. O portal tem sete, e todas sao
 *      tabela com filtro. Carregar 139 KB para isso seria fazer o
 *      contador pagar o preco de um sistema que ele nunca vai abrir;
 *   2. copiar a app.css criaria um terceiro arquivo gemeo para manter em
 *      sincronia — o projeto ja tem tres (net.js, ui.js, seed.js) e o
 *      release.php precisa conferir cada um;
 *   3. as duas telas nao devem se parecer. Quem esta no portal esta no
 *      sistema DE OUTRA EMPRESA olhando o livro fiscal de um cliente. A
 *      cor diferente e a primeira coisa que diz isso.
 *
 * Os TOKENS sao os mesmos do design system (a escala de tinta, o raio, a
 * sombra, a Inter): a identidade e a mesma casa. O que muda e o acento —
 * ardosia e ceu, contra o indigo do lojista e o verde-azulado do painel
 * do dono.
 * ===================================================================== */

:root {
  --brand-900: #0b1220; --brand-800: #14203a; --brand-700: #1e3a5f;
  --brand-600: #0369a1; --brand-500: #0284c7; --brand-300: #7dd3fc;
  --brand-100: #e0f2fe; --brand-50: #f0f9ff;

  --green-700: #047857; --green-600: #059669; --green-100: #d1fae5;
  --amber-700: #b45309; --amber-600: #d97706; --amber-100: #fef3c7;
  --red-700: #b91c1c; --red-600: #dc2626; --red-100: #fee2e2;

  --ink-900: #0f172a; --ink-700: #334155; --ink-500: #64748b; --ink-400: #94a3b8;
  --ink-300: #cbd5e1; --ink-200: #e2e8f0; --ink-100: #f1f5f9; --ink-50: #f8fafc;

  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --shadow-lg: 0 14px 38px rgba(15,23,42,.16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--ink-50); color: var(--ink-900); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }

/* ===== MARCA ===== */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-700)); color: #fff; font-size: 13px; font-weight: 800; flex: 0 0 34px; }
.brand-name { font-size: 17px; white-space: nowrap; }
.brand-sub { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-400); font-weight: 600; }

/* ===== BOTOES / CAMPOS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--brand-600); color: #fff;
  font-weight: 600; font-size: 13.5px; cursor: pointer; transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn.ghost { background: #fff; color: var(--ink-700); border-color: var(--ink-200); }
.btn.ghost:hover { background: var(--ink-100); filter: none; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.lg { padding: 12px 18px; font-size: 15px; }
.btn.block { width: 100%; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 5px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--ink-200); border-radius: var(--radius-sm); background: #fff; color: var(--ink-900); }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.field .dica { font-size: 11.5px; color: var(--ink-500); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.codigo-campo input { font-family: var(--mono); font-size: 20px; letter-spacing: .14em; text-align: center; text-transform: uppercase; }

/* ===== ENTRADA ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: linear-gradient(155deg, var(--brand-900), var(--brand-700) 58%, var(--brand-600));
  color: #fff; padding: 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -150px; bottom: -190px; width: 480px; height: 480px; border-radius: 50%; background: rgba(255,255,255,.06); }
.auth-art h1 { font-size: 32px; line-height: 1.18; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; position: relative; z-index: 1; }
.auth-art p { color: rgba(255,255,255,.82); font-size: 15px; max-width: 430px; position: relative; z-index: 1; }
.auth-feats { list-style: none; margin-top: 28px; display: grid; gap: 11px; position: relative; z-index: 1; }
.auth-feats li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.9); font-size: 14px; }
.auth-feats li b { color: #fff; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.auth-card .sub { color: var(--ink-500); margin: 6px 0 22px; }
.hint { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 18px; }
.hint.amarelo { background: var(--amber-100); border-color: #fcd34d; color: var(--amber-700); }
@media (max-width: 940px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ===== SHELL ===== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 244px; flex: 0 0 244px; background: var(--brand-900); color: #fff;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 45; }
.sidebar-top { padding: 16px 16px 10px; display: flex; align-items: center; gap: 10px; }
.sidebar-top .brand-name { color: #fff; }
.emp-chip { margin: 4px 12px 10px; padding: 10px 11px; background: rgba(255,255,255,.08); border-radius: 10px;
  display: flex; align-items: center; gap: 9px; cursor: pointer; border: none; width: calc(100% - 24px); text-align: left; color: #fff; }
.emp-chip:hover { background: rgba(255,255,255,.15); }
.emp-chip .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-600); display: grid; place-items: center; flex: 0 0 28px; font-size: 11px; font-weight: 700; }
.emp-chip .b { min-width: 0; flex: 1; }
.emp-chip .n { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-chip .s { font-size: 10.5px; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 18px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: rgba(255,255,255,.76); font-weight: 500; font-size: 13.5px; margin-bottom: 2px; border: none; background: none; cursor: pointer; text-align: left; }
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.on { background: var(--brand-600); color: #fff; font-weight: 600; }
.nav .grupo { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 14px 11px 5px; font-weight: 700; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; color: rgba(255,255,255,.6); }
.sidebar-foot b { color: #fff; display: block; font-size: 12.5px; }

.main { flex: 1; margin-left: 244px; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--ink-200); padding: 12px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar .crumb { font-size: 12px; color: var(--ink-500); }
.topbar .dir { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view { padding: 22px 24px 60px; flex: 1; }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.aberta { transform: none; }
  .main { margin-left: 0; }
}

/* ===== CARTOES / TABELAS ===== */
.cartao { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.cartao-topo { padding: 14px 16px; border-bottom: 1px solid var(--ink-200); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cartao-topo h2 { font-size: 15px; font-weight: 700; }
.cartao-topo .sub { font-size: 12px; color: var(--ink-500); }
.cartao-corpo { padding: 16px; }
.cartao-corpo.limpo { padding: 0; }

.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 18px; }
.numero { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.numero .r { font-size: 11.5px; color: var(--ink-500); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.numero .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; }
.numero .o { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.numero.alerta { border-color: #fcd34d; background: #fffbeb; }
.numero.alerta .v { color: var(--amber-700); }

.rolagem { overflow-x: auto; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tab th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500);
  padding: 9px 12px; border-bottom: 1px solid var(--ink-200); white-space: nowrap; background: var(--ink-50); position: sticky; top: 0; }
table.tab td { padding: 9px 12px; border-bottom: 1px solid var(--ink-100); white-space: nowrap; }
table.tab tr:hover td { background: var(--ink-50); }
table.tab td.num, table.tab th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tab td.mono { font-family: var(--mono); font-size: 11.5px; color: var(--ink-700); }
table.tab tfoot td { font-weight: 700; background: var(--ink-100); border-top: 2px solid var(--ink-300); border-bottom: none; }
table.tab .vazio { text-align: center; color: var(--ink-500); padding: 30px 12px; white-space: normal; }

.marca { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.marca.ok { background: var(--green-100); color: var(--green-700); }
.marca.aviso { background: var(--amber-100); color: var(--amber-700); }
.marca.ruim { background: var(--red-100); color: var(--red-700); }
.marca.neutra { background: var(--ink-200); color: var(--ink-700); }

.filtros { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filtros .field { margin-bottom: 0; }
.filtros .field input, .filtros .field select { min-width: 130px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-700); cursor: pointer; }

/* O rodape de responsabilidade. Ele nao e enfeite: e a linha que separa
   "copiei o que saiu na nota" de "apurei o seu imposto". Vem do servidor
   junto com todo relatorio para que nenhuma tela nova nasca sem ele. */
.rodape-legal { margin-top: 10px; padding: 10px 14px; background: var(--ink-100); border-left: 3px solid var(--ink-400);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 12px; color: var(--ink-700); }

.cabecalho-rel { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 26px; flex-wrap: wrap; }
.cabecalho-rel div span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); font-weight: 700; }
.cabecalho-rel div b { font-size: 13.5px; }

.aviso { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.aviso.amarelo { background: var(--amber-100); border: 1px solid #fcd34d; color: var(--amber-700); }
.aviso.vermelho { background: var(--red-100); border: 1px solid #fca5a5; color: var(--red-700); }
.aviso.azul { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink-900); color: #fff;
  padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 90; max-width: 90vw; }
.toast.err { background: var(--red-600); }
.toast.ok { background: var(--green-600); }

.lista-empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card-empresa { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm); cursor: pointer; text-align: left; width: 100%; }
.card-empresa:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); }
.card-empresa .n { font-weight: 700; font-size: 15px; }
.card-empresa .d { font-size: 12.5px; color: var(--ink-500); margin-top: 3px; }

.carregando { padding: 40px; text-align: center; color: var(--ink-500); }

/* E08 · a faixa de paginação dos relatórios. Ela só existe quando há mais
   de uma página — num mês normal, com trinta notas, não aparece. */
.paginacao-rel { display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 12px 0 4px; flex-wrap: wrap; }
.paginacao-rel .conta { font-size: 13px; color: var(--ink-500); }

/* =====================================================================
   DRE GERENCIAL  ·  v170 (18/09/2026)
   ---------------------------------------------------------------------
   Só três classes, e todas dentro da tabela que o portal já tem. A DRE
   aqui é SOMENTE LEITURA: não há filtro, coluna escondida nem ordenação
   — a ordem das linhas É a fórmula, e mexer nela seria mudar a conta.
   ===================================================================== */
table.tab tr.linha-total td { font-weight: 700; background: var(--ink-50);
  border-top: 1px solid var(--ink-300); }
table.tab tr.linha-sub td { font-size: 12px; color: var(--ink-500); }
table.tab tr.linha-sub:hover td { background: transparent; }
.lista-simples { list-style: none; display: grid; gap: 10px; }
.lista-simples li { padding-left: 11px; border-left: 3px solid var(--amber-700); font-size: 13px; }
.lista-periodos { display: flex; flex-wrap: wrap; gap: 6px; }
