/* Sicofe Financeiro — visual executivo, limpo e sóbrio. */
:root {
  --navy-900: #0c1f33;
  --navy-800: #13304d;
  --navy-700: #1b3f63;
  --accent: #1f5fa8;
  --accent-hover: #184e8c;
  --accent-soft: #e8f0fa;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;

  --text: #18212b;
  --text-2: #475467;
  --text-3: #8a94a3;

  --ok: #0e7a4e;      --ok-soft: #e7f5ee;
  --warn: #b54708;    --warn-soft: #fef4e6;
  --crit: #b42318;    --crit-soft: #fdecea;

  --serie-receber: #2a78d6;
  --serie-pagar: #eb6834;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; color: var(--text-3); }

/* ------------------------------------------------ estrutura */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy-900);
  color: #c9d3df;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: linear-gradient(135deg, #2f74c4, #1b3f63);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.brand-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #8ea0b5; letter-spacing: .06em; text-transform: uppercase; }
.nav-section { margin: 18px 10px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6f8399; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; color: #c9d3df; font-weight: 500;
}
.nav a:hover { background: var(--navy-800); color: #fff; }
.nav a.ativo { background: var(--navy-700); color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }
.empresa-select { display: flex; align-items: center; gap: 8px; }
.empresa-select label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.empresa-select select { min-width: 230px; }
.user { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.content { padding: 28px; max-width: 1440px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-2); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------ componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.card-head h2 { font-size: 15px; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

.kpi { padding: 18px 20px; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 26px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-foot { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.kpi-foot .crit { color: var(--crit); font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--crit); }
.btn-danger:hover { background: var(--crit-soft); color: var(--crit); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; cursor: pointer; font: inherit; }
.btn svg { width: 16px; height: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.critico { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.badge.aberto { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.aviso { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.contador { background: #e5484d; color: #fff; border: 0; padding: 0 7px; }
.badge.contador::before { display: none; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .04em; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); }
.table .principal { font-weight: 500; color: var(--text); }
.table .sec { font-size: 12px; color: var(--text-3); }
.valor-pos { color: var(--ok); }
.valor-neg { color: var(--crit); }
.vazio { padding: 48px 20px; text-align: center; color: var(--text-3); }

/* formulários */
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea.input { height: auto; padding: 10px 12px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 168, .15); }
input[type=file].input { padding: 7px 10px; }
.check { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.campo label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.campo.check-campo { display: flex; align-items: center; gap: 8px; }
.campo.check-campo label { margin: 0; }
.campo.full { grid-column: 1 / -1; }
.campo .ajuda { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.campo .erro { font-size: 12px; color: var(--crit); margin-top: 4px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.form-actions .esq { margin-right: auto; }

.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input { width: auto; height: 34px; }
.toolbar .busca { min-width: 260px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.segmented a { padding: 6px 12px; color: var(--text-2); font-weight: 500; font-size: 13px; border-right: 1px solid var(--border-strong); }
.segmented a:last-child { border-right: 0; }
.segmented a.ativo { background: var(--navy-900); color: #fff; }

.alerts { margin-bottom: 18px; }
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 8px; border: 1px solid; font-weight: 500; }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: #b7e2cc; }
.alert.error { background: var(--crit-soft); color: var(--crit); border-color: #f5c2bd; }
.alert.warning { background: var(--warn-soft); color: var(--warn); border-color: #f7d7a8; }
.alert.info { background: var(--accent-soft); color: var(--accent); border-color: #c4d8f0; }

.paginacao { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; }

/* gráfico de fluxo */
.chart-legend { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.chart { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; height: 200px; align-items: end; padding: 8px 4px 0; border-bottom: 1px solid var(--border-strong);
  background-image: linear-gradient(to top, var(--border) 1px, transparent 1px); background-size: 100% 25%; }
.chart-col { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; position: relative; }
.bar { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 1px; position: relative; }
.bar.receber { background: var(--serie-receber); }
.bar.pagar { background: var(--serie-pagar); }
.chart-col .tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--navy-900); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 3;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.chart-col:hover .tip { display: block; }
.chart-col:hover .bar { opacity: .85; }
.chart-labels { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; font-size: 12px; color: var(--text-3); text-align: center; margin-top: 8px; }

/* conciliação */
.mov { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); border-bottom: 1px solid var(--border); }
.mov:last-child { border-bottom: 0; }
.mov-lado { padding: 16px 20px; }
.mov-lado + .mov-lado { border-left: 1px solid var(--border); background: var(--surface-2); }
.mov-topo { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.mov-valor { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-hist { font-weight: 500; margin-top: 4px; word-break: break-word; }
.sugestao { border: 1px solid #c4d8f0; background: var(--surface); border-radius: 6px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sugestao.forte { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,95,168,.08); }
.sugestao + .sugestao { margin-top: 8px; }
.rotulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.mov-acoes { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
details.painel summary { cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; }
details.painel summary::-webkit-details-marker { display: none; }
details.painel[open] { width: 100%; }
details.painel .painel-corpo { margin-top: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { height: 32px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; }
.tabs a { padding: 12px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.ativo { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { color: var(--text-3); font-weight: 400; margin-left: 4px; }

.resumo-conta { display: flex; gap: 32px; flex-wrap: wrap; }
.resumo-conta div span { display: block; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.resumo-conta div strong { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* hierarquia e demonstrativos */
.nivel-2 .recuo { padding-left: 36px; }
.nivel-3 .recuo { padding-left: 56px; }
.nivel-4 .recuo { padding-left: 76px; }
.nivel-5 .recuo { padding-left: 96px; }
tr.sintetica td { font-weight: 600; }
tr.nivel-1.sintetica td { background: var(--surface-2); }

.demo { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.demo th { position: sticky; top: 0; background: var(--surface-2); text-align: right; font-size: 12px; font-weight: 500; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.demo th:first-child { text-align: left; }
.demo td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.demo td:first-child { text-align: left; white-space: normal; min-width: 260px; }
.demo td a { color: inherit; }
.demo td a:hover { color: var(--accent); text-decoration: underline; }
.demo .nivel-1 td { font-weight: 600; background: var(--surface-2); }
.demo .nivel-2 td { font-weight: 500; }
.demo .nivel-2 td:first-child { padding-left: 32px; }
.demo .nivel-3 td { color: var(--text-2); }
.demo .nivel-3 td:first-child { padding-left: 52px; }
.demo .nivel-4 td, .demo .nivel-5 td { color: var(--text-3); }
.demo .nivel-4 td:first-child { padding-left: 72px; }
.demo .nivel-5 td:first-child { padding-left: 92px; }
.demo .codigo { color: var(--text-3); font-size: 12px; margin-right: 8px; font-weight: 400; }
.demo tr.total td { font-weight: 700; background: var(--navy-900); color: #fff; border-bottom: 0; }
.demo tr.total td a { color: #fff; }
.demo tr.subtotal td { font-weight: 600; border-top: 2px solid var(--border-strong); }
.demo .av { color: var(--text-3); font-size: 12px; }
.demo tr.total .av { color: #b9c6d6; }
.demo .neg { color: var(--crit); }
.demo tr.total .neg { color: #ffb4ab; }

.filtros { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filtros .campo label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.filtros .input { height: 34px; width: auto; }

.bp { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .bp { grid-template-columns: 1fr; } }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--navy-900); color: #c9d3df; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background-image: radial-gradient(circle at 80% 20%, rgba(47,116,196,.35), transparent 50%); }
.login-art h2 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 420px; }
.login-art p { max-width: 420px; color: #9fb0c3; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.grade tr.travada td { background: var(--bg); color: var(--muted, #667085); }
a.link-card { color: inherit; display: block; }
a.link-card:hover { border-color: var(--accent); color: inherit; }
.segmented.abas { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented.abas a { white-space: nowrap; }

/* ------------------------------------------------ visual corporativo */
.sidebar { background: linear-gradient(180deg, #0a1a2b 0%, #0c1f33 100%); border-right: 1px solid #08131f; }
.nav a { position: relative; font-size: 13.5px; padding: 7px 10px; }
.nav a.ativo { background: rgba(255,255,255,.08); color: #fff; }
.nav a.ativo::before { content: ""; position: absolute; left: -14px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: #4d9bf0; }
.nav-section { font-size: 10.5px; font-weight: 600; color: #5d7189; margin-top: 20px; }
.topbar { height: 56px; box-shadow: 0 1px 0 rgba(16,24,40,.03); }
.page-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: 21px; font-weight: 650; color: var(--navy-900); }
.card-head h2 { font-size: 14px; font-weight: 650; color: var(--navy-900); }
table.table thead th, table.demo thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); background: var(--surface-2); }
table.demo tr.secao td { background: var(--navy-900); color: #fff; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
table.demo th.proj, table.demo td.proj { background: #f3f7fc; font-style: italic; }
table.demo thead th.proj { color: var(--accent); }
tr.sub-pessoa td { background: var(--surface-2); font-size: 13px; }
table.regras td { vertical-align: top; font-size: 13px; }
.barra-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-2); cursor: pointer; flex: none; }
.barra-btn:hover { color: var(--navy-900); border-color: var(--border-strong); }
.barra-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------ tema corporativo compacto
   Tipografia menor (13px), cantos retos, sem sombras, cinzas neutros e azul-marinho como cor de marca.
   O celular mantém campos de 16px (regras do bloco mobile, mais abaixo). */
:root {
  --navy-900: #0b1e33;
  --navy-800: #12304f;
  --navy-700: #1a3d63;
  --accent: #1d4f86;
  --accent-hover: #163f6c;
  --accent-soft: #eaf0f7;
  --bg: #f2f4f7;
  --surface-2: #f7f8fa;
  --border: #e1e5eb;
  --border-strong: #c9d0da;
  --text: #1b2430;
  --text-2: #4a5566;
  --text-3: #7d8899;
  --radius: 4px;
  --shadow: none;
  --sidebar: 232px;
}
body { font: 13px/1.45 "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; letter-spacing: 0; }
h1, h2, h3 { letter-spacing: 0; }

.sidebar { padding: 16px 12px; background: var(--navy-900); border-right: 0; }
.brand { padding: 2px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 28px; height: 28px; border-radius: 3px; font-size: 13px; background: #24568f; }
.brand-name { font-size: 14px; letter-spacing: .01em; }
.brand-sub { font-size: 10px; }
.nav-section { margin: 16px 8px 4px; font-size: 10px; letter-spacing: .1em; color: #6a7f96; }
.nav a { font-size: 12.5px; padding: 6px 8px; border-radius: 3px; gap: 9px; color: #b9c5d3; font-weight: 400; }
.nav a:hover { background: rgba(255,255,255,.05); }
.nav a.ativo { background: rgba(255,255,255,.09); font-weight: 500; }
.nav a.ativo::before { left: -12px; top: 5px; bottom: 5px; width: 3px; border-radius: 0; background: #5b9be0; }
.nav svg { width: 15px; height: 15px; opacity: .75; }
.nav .badge.contador { font-size: 10.5px; padding: 0 6px; line-height: 16px; }

.topbar { height: 48px; padding: 0 20px; gap: 12px; }
.empresa-select label { font-size: 10.5px; }
.empresa-select select { min-width: 220px; height: 30px; }
.user { font-size: 12.5px; }
.avatar { width: 26px; height: 26px; font-size: 11px; border-radius: 3px; }
.barra-btn { width: 30px; height: 30px; border-radius: 3px; }
.barra-btn svg { width: 16px; height: 16px; }

.content { padding: 20px 24px 32px; max-width: 1600px; }
.page-head { margin-bottom: 16px; padding-bottom: 12px; align-items: center; }
.page-head h1 { font-size: 18px; font-weight: 600; }
.page-head .sub { font-size: 12.5px; color: var(--text-3); }
.page-head .tiny { margin-bottom: 2px; }

.card-head { padding: 10px 16px; min-height: 44px; }
.card-head h2 { font-size: 13px; font-weight: 600; }
.card-body { padding: 16px; }
.grid { gap: 12px; }
.stack > * + * { margin-top: 12px; }

.kpi { padding: 14px 16px; border-top: 3px solid var(--navy-700); }
.kpi-label { font-size: 10.5px; letter-spacing: .07em; color: var(--text-3); font-weight: 600; }
.kpi-value { font-size: 21px; margin-top: 4px; letter-spacing: -.01em; color: var(--navy-900); }
.kpi-foot { font-size: 12px; margin-top: 4px; }

.btn { height: 30px; padding: 0 12px; border-radius: 3px; font-size: 12.5px; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-primary { background: var(--navy-700); border-color: var(--navy-700); }
.btn-primary:hover { background: var(--navy-800); border-color: var(--navy-800); }

.badge { font-size: 11px; padding: 1px 7px; border-radius: 3px; gap: 4px; }
.badge::before { width: 5px; height: 5px; }

.input, select.input, textarea.input { height: 32px; padding: 0 10px; border-radius: 3px; font-size: 13px; }
textarea.input { padding: 8px 10px; }
.input:focus { box-shadow: 0 0 0 2px rgba(29, 79, 134, .18); }
.form-grid { gap: 12px 16px; }
.campo label { font-size: 12px; margin-bottom: 4px; color: var(--text-2); }
.campo .ajuda, .campo .erro { font-size: 11.5px; }
.form-actions { padding: 12px 16px; }

.toolbar, .filtros { padding: 10px 14px; gap: 8px; }
.toolbar .input, .filtros .input { height: 30px; }
.filtros .campo label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.segmented { border-radius: 3px; }
.segmented a { padding: 5px 11px; font-size: 12px; }
.exportar { height: 30px; border-radius: 3px; }
.exportar span { line-height: 28px; font-size: 10px; padding: 0 8px; }
.exportar a { line-height: 28px; font-size: 12px; padding: 0 10px; }

.alert { padding: 9px 14px; border-radius: 3px; font-size: 12.5px; }

.table th { font-size: 10.5px; padding: 8px 12px; font-weight: 600; letter-spacing: .06em; }
.table td { padding: 8px 12px; font-size: 13px; }
.table .sec { font-size: 11.5px; }
.demo th { font-size: 10.5px; padding: 8px 12px; font-weight: 600; }
.demo td { padding: 6px 12px; font-size: 12.5px; }
.demo td:first-child { min-width: 240px; }
.demo .codigo, .demo .av { font-size: 11px; }
.demo tr.total td { background: var(--navy-800); }
.vazio { padding: 32px 16px; }
.paginacao { padding: 8px 14px; font-size: 12px; }
.tabs a { padding: 9px 10px; font-size: 12.5px; }
.resumo-conta div strong { font-size: 16px; }
.mov-valor { font-size: 14px; }

/* orçamento */
table.grade td { padding: 3px 4px; }
table.grade td:first-child { padding-left: 12px; min-width: 220px; }
.grade-input { width: 86px; height: 26px; border: 1px solid var(--border); border-radius: 2px; background: #fff;
  text-align: right; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 6px; color: var(--text); }
.grade-input:hover { border-color: var(--border); background: #fff; }
.grade-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px rgba(29,79,134,.15); }
table.grade .total-linha { font-weight: 600; padding-right: 12px; }
table.demo th.grupo { text-align: center; border-left: 1px solid var(--border); }
table.demo td.real { background: #f6f9fc; }
.kpi-value.crit { color: var(--crit); }

/* menu recolhido (só ícones) e tela cheia */
body.menu-recolhido { --sidebar: 64px; }
body.menu-recolhido .sidebar { padding: 20px 8px; overflow-x: hidden; }
body.menu-recolhido .brand { padding: 4px 8px 22px; }
body.menu-recolhido .brand > div:last-child,
body.menu-recolhido .nav-section,
body.menu-recolhido .nav .badge { display: none; }
body.menu-recolhido .nav a { font-size: 0; justify-content: center; padding: 9px 0; }
body.menu-recolhido .nav a.ativo::before { left: -8px; }
body.menu-recolhido .nav svg { width: 19px; height: 19px; }
body.menu-recolhido .nav-section + a { margin-top: 10px; }
body.menu-recolhido .content, body.tela-cheia .content { max-width: none; }

/* exportação */
.exportar { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; height: 36px; background: var(--surface); }
.exportar span { padding: 0 10px; color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-right: 1px solid var(--border-strong); line-height: 34px; }
.exportar a { padding: 0 12px; line-height: 34px; color: var(--text); font-weight: 500; font-size: 13px; border-right: 1px solid var(--border); }
.exportar a:last-child { border-right: 0; }
.exportar a:hover { background: var(--surface-2); }

/* lançamento de despesa */
.rateio-linha { display: grid; grid-template-columns: minmax(0, 1fr) 84px 30px; gap: 4px 8px; align-items: center; margin-bottom: 10px; }
.rateio-linha .valor-calc { grid-column: 1 / 3; grid-row: 2; text-align: right; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rateio-linha .remover { padding: 0; width: 30px; }
.rateio-total { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; padding-top: 8px; border-top: 1px solid var(--border); }
.rateio-total.erro { color: var(--crit); }
.parcelas-previa { font-size: 13px; color: var(--text-2); margin: 0; padding-left: 18px; }

/* régua de cobrança */
.crit { color: var(--crit); }
.regua { list-style: none; margin: 0; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.regua li { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.regua li.dia { border-left-color: var(--warn); }
.regua li.depois { border-left-color: var(--crit); }
.regua-dia { font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mensagem { white-space: normal; margin-top: 6px; padding: 8px 10px; background: var(--surface-2, #f5f7fa); border-radius: 6px; color: var(--text-2); max-width: 520px; }
.acoes-envio { white-space: nowrap; }
.acoes-envio form { display: inline-block; margin: 2px 0 2px 4px; }

/* menu do celular: escondido fora do celular */
.menu-btn { display: none; }
.menu-fundo { display: none; }

/* ------------------------------------------------ celular e tablet */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .barra-btn { display: none; }
  body.menu-recolhido { --sidebar: 248px; }
  body.menu-recolhido .nav a { font-size: 13.5px; justify-content: flex-start; padding: 11px 10px; }
  body.menu-recolhido .nav-section, body.menu-recolhido .brand > div:last-child { display: block; }
  /* menu lateral vira gaveta, aberta pelo botão no topo */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); height: 100%; z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0,0,0,.25);
  }
  body.menu-aberto .sidebar { transform: none; }
  body.menu-aberto .menu-fundo { display: block; position: fixed; inset: 0; background: rgba(12,31,51,.45); z-index: 25; }
  body.menu-aberto { overflow: hidden; }
  .nav a { padding: 11px 10px; }
  .menu-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--border-strong);
    border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; flex: none;
  }
  .menu-btn svg { width: 20px; height: 20px; }

  .topbar { padding: 8px 12px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 10px; }
  .topbar .spacer { display: none; }
  .empresa-select { order: 3; width: 100%; }
  .empresa-select label { display: none; }
  .empresa-select select { min-width: 0; width: 100%; }
  .user { margin-left: auto; }
  .user > span { display: none; }

  .content { padding: 14px 12px 32px; }
  .page-head { margin-bottom: 16px; align-items: stretch; }
  .page-head h1 { font-size: 19px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; justify-content: center; }
  .grid-2, .form-grid, .bp { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 19px; word-break: break-word; }
  .kpi-foot { font-size: 12px; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; }
  .card-body { padding: 16px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; justify-content: center; }

  /* toque: alvos maiores e sem zoom automático do iPhone nos campos */
  .input, select.input, textarea.input { font-size: 16px; height: 42px; }
  textarea.input { height: auto; }
  .acoes-envio { white-space: normal; }
  .acoes-envio form { display: block; margin: 4px 0; }
  .acoes-envio .btn { width: 100%; justify-content: center; }
  .btn { height: 40px; }
  .btn-sm { height: 34px; }
  .toolbar, .filtros { padding: 12px; }
  .toolbar .busca { min-width: 0; flex: 1 1 100%; }
  .toolbar .input, .filtros .input, .filtros .campo { width: 100%; flex: 1 1 140px; }
  .segmented { max-width: 100%; min-width: 0; overflow-x: auto; }
  .actions { max-width: 100%; min-width: 0; }
  .card-head .actions { width: 100%; }
  .segmented a { white-space: nowrap; padding: 8px 12px; }

  /* tabelas: colunas secundárias somem; o resto rola de lado */
  .table th, .table td { padding: 10px 12px; }
  .table .opc { display: none; }
  .demo td:first-child { min-width: 170px; }
  .demo th, .demo td { padding: 8px 10px; }

  .chart { gap: 4px; height: 160px; }
  .chart-labels { gap: 4px; font-size: 10px; }
  .mov { grid-template-columns: 1fr; }
  .mov-lado + .mov-lado { border-left: 0; border-top: 1px solid var(--border); }
  .inline-form { flex-wrap: wrap; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

/* Despesa por foto do cupom fiscal */
.visualmente-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cupom-envio { max-width: 560px; }
.cupom-camera {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent);
}
.cupom-camera:hover { border-color: var(--accent); }
.cupom-camera svg { width: 44px; height: 44px; }
.cupom-camera strong { font-size: 15px; }
.cupom-camera.ocupado { opacity: .5; pointer-events: none; }
.cupom-lendo { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; }
.cupom-lendo[hidden] { display: none; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.cupom-dicas { margin: 12px 0 0; padding-left: 18px; }
.cupom-painel { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; padding: 12px; }
.cupom-painel img { width: 100%; max-height: 320px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.cupom-painel h2 { margin: 0 0 2px; font-size: 14px; }
.cupom-info { min-width: 0; overflow-wrap: anywhere; }
.cupom-itens { margin-top: 8px; }
.cupom-itens td { padding: 3px 6px; font-size: 12px; }
@media (max-width: 720px) {
  .cupom-painel { grid-template-columns: 1fr; }
  .cupom-painel img { max-height: 260px; }
}

/* Listas longas pesquisáveis (static/js/busca_select.js) */
.busca-select { position: relative; min-width: 0; }
.busca-select .busca-original { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.busca-lista { display: none; position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 2px); max-height: 280px;
  overflow-y: auto; background: var(--surface, #fff); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(11, 30, 51, .14); }
.busca-lista.aberta { display: block; }
.busca-item { padding: 6px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-item:hover, .busca-item.marcado { background: var(--accent-soft); }
.busca-item.atual { font-weight: 600; }
.busca-item.vazio { color: var(--text-3); }
.toolbar .busca-select { flex: 0 1 260px; }

/* Lançamento da folha: valor digitado que substitui o calculado */
.grade-input.ajustado { background: #fff4d6; border-color: #e0b44a; }
