/* ===================== CELULAR (≤ 700px): barra de baixo, menu em tela cheia, cartões ===================== */
.mob-nav { display: none; }
.cel-card { display: flex; align-items: center; gap: 14px; margin: 0 auto 18px; max-width: 620px; padding: 14px 16px; border: 1px solid rgba(201,162,76,.45); border-radius: 14px; background: rgba(201,162,76,.08); }
.cel-card-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: #0c0b0d; color: var(--gold-bright); font-size: 20px; }
.cel-card-txt { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-muted); min-width: 0; flex: 1; }
.cel-card-txt strong { color: var(--ink); font-size: 14px; }
.cel-card-acoes { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cel-inst-texto ol { margin: 6px 0 10px; padding-left: 20px; line-height: 1.6; font-size: 14px; }
.cel-inst-texto li { margin-bottom: 6px; }
.chat-avisos svg { width: 16px; height: 16px; }
.chat-avisos .chat-avisos-ponto { opacity: 0; }
.chat-avisos.on { border-color: var(--gold); color: var(--gold-bright); }
.chat-avisos.on .chat-avisos-ponto { opacity: 1; }

@media (max-width: 700px) {
  /* letras de 16px nos campos: o iPhone não dá zoom ao tocar */
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .mob-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 960; background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(0,0,0,.18); }
  .mob-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; background: none; border: 0; border-radius: 12px; color: var(--ink-muted); font: inherit; font-size: 11px; cursor: pointer; }
  .mob-nav button[hidden] { display: none; }
  .mob-nav svg { width: 23px; height: 23px; }
  .mob-nav button.on { color: var(--gold-bright); }
  .mob-nav button.on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--gold); }
  .mob-nav button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
  .mob-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red, #e2664a); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
  .mob-badge[hidden] { display: none; }

  /* topo enxuto: só logo, empresa e as telas do módulo aberto; os módulos ficam no Menu */
  body:not(.mob-menu) .sidebar-modules > .tab { display: none; }
  .sidebar-modules { padding-bottom: 4px; }
  .sidebar-submenu { padding: 4px 10px 8px; }
  .subtab { padding: 8px 12px; }
  #novaAbaBtn, #chatBtn { display: none !important; }
  .content-topbar { gap: 8px; flex-wrap: wrap; }
  body.mob-menu { overflow: hidden; }
  body.mob-menu .sidebar { position: fixed; inset: 0 0 calc(66px + env(safe-area-inset-bottom)) 0; z-index: 950; overflow-y: auto; background: var(--surface); padding-bottom: 20px; }
  body.mob-menu .sidebar-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px 12px 12px; }
  body.mob-menu .sidebar-modules > .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 14px; text-align: center; font-size: 12.5px; white-space: normal; line-height: 1.25; }
  body.mob-menu .sidebar-modules > .sidebar-submenu { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
  body.mob-menu .sidebar-modules > .sidebar-submenu[hidden] { display: none; }
  body.mob-menu .sidebar-modules > .sidebar-submenu .subtab { border: 1px solid var(--border); border-radius: 999px; }

  /* cartões de resumo: dois por linha, mais baixos */
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
  .cards-grid .card { padding: 12px 14px; }
  .cards-grid .card h2 { font-size: 10.5px; margin-bottom: 6px; }
  .cards-grid .card-value { font-size: 20px; }
  .cards-grid .card-sub, .cards-grid .card p:not(.card-value) { font-size: 11.5px; }

  /* tabelas de listas viram cartões (um por linha, rótulo à esquerda e valor à direita) */
  table.mob-cards, table.mob-cards tbody { display: block; width: 100% !important; min-width: 0 !important; max-width: 100%; }
  table.mob-cards td > * { max-width: 100%; }
  table.mob-cards td { overflow-wrap: anywhere; }
  table.mob-cards td.mob-vazio { display: none; }
  table.mob-cards thead { display: none; }
  table.mob-cards tr { display: block; padding: 10px 14px 8px; margin: 0 0 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  table.mob-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0 !important; border: 0 !important; text-align: right; min-height: 0; white-space: normal; }
  table.mob-cards td::before { content: attr(data-label); flex: 0 0 auto; max-width: 42%; text-align: left; color: var(--ink-muted); font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; }
  table.mob-cards td[data-label=""]::before { display: none; }
  table.mob-cards td[data-label=""] { justify-content: center; text-align: center; }
  table.mob-cards td:first-child { font-weight: 600; }
  table.mob-cards td.col-acoes { justify-content: flex-end; margin-top: 6px; padding-top: 10px !important; border-top: 1px dashed var(--border) !important; }
  table.mob-cards td.col-acoes::before { display: none; }
  table.mob-cards .row-actions, table.mob-cards .li-acoes { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  table.mob-cards .row-action-btn { min-width: 40px; min-height: 40px; }
  table.mob-cards tr.empty-row td, table.mob-cards td.empty-state { justify-content: center; }
  .lancamentos-panel, .table-scroll { overflow-x: visible; }
  .lancamentos-panel:has(table.mob-cards) { padding: 0; border: 0; background: none; box-shadow: none; }

  /* filtros dobrados */
  .filtros-row.mob-dobra { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
  .filtros-row.mob-dobra > .mob-sempre { flex: 1 1 60%; min-width: 0; }
  .filtros-row.mob-dobra > .mob-sempre input { width: 100%; }
  .filtros-row.mob-dobra:not(.mob-filtros-aberto) > :not(.mob-sempre):not(.mob-filtros-btn) { display: none !important; }
  .filtros-row.mob-dobra.mob-filtros-aberto > :not(.mob-sempre):not(.mob-filtros-btn) { flex: 1 1 45%; min-width: 0; }
  .filtros-row.mob-dobra.mob-filtros-aberto > :not(.mob-sempre):not(.mob-filtros-btn) select, .filtros-row.mob-dobra.mob-filtros-aberto > :not(.mob-sempre):not(.mob-filtros-btn) input { width: 100%; }
  .mob-filtros-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
  .mob-filtros-btn svg { width: 16px; height: 16px; }
  .mob-filtros-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold-bright); }
  body:has(.modal-overlay.open) .mob-nav { display: none; }
  body:has(.modal-overlay.open) { padding-bottom: 0; }

  /* botões maiores para o dedo */
  .btn-primary, .btn-secondary, .btn-danger { min-height: 42px; }
  .row-action-btn { min-width: 38px; min-height: 38px; }

  /* janelas (modais) em tela cheia, com os botões sempre à vista */
  .modal-overlay.open { align-items: stretch; padding: 0; }
  .modal-overlay .modal { width: 100% !important; max-width: none !important; max-height: none; min-height: 100dvh; border-radius: 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-overlay .modal .modal-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--surface); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-bottom: calc(-16px - env(safe-area-inset-bottom)); border-top: 1px solid var(--border); flex-wrap: wrap; z-index: 2; }

  /* chat ocupa a tela toda, acima da barra de baixo */
  .chat-drawer { bottom: calc(66px + env(safe-area-inset-bottom)) !important; }
  .chat-pops { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .cel-card { flex-wrap: wrap; }
  .cel-card-acoes { flex-direction: row; width: 100%; justify-content: flex-end; gap: 12px; }
}

/* retirada dos sócios */
.ret-card { margin: 18px 0 24px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius, 14px); background: var(--surface); }
.ret-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ret-cab h2 { margin: 0 0 4px; font-size: 17px; }
.ret-cab p { margin: 0; font-size: 12.5px; }
.ret-numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0 10px; }
.ret-n { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ret-n span { font-size: 12px; color: var(--ink-muted); }
.ret-n strong { font-family: var(--font-display); font-size: 22px; color: var(--ink); }
.ret-n small { font-size: 11.5px; color: var(--ink-muted); }
.ret-n.ret-ideal { border-color: rgba(124,191,143,.55); }
.ret-n.ret-ideal strong { color: var(--green, #7cbf8f); }
.ret-n.ret-max strong { color: var(--gold-bright); }
.ret-det { font-size: 13px; margin: 4px 0 12px; }
.ret-det summary { cursor: pointer; color: var(--gold-bright); }
.ret-det ul, .ret-oque ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.55; font-size: 13px; }
.ret-cenario, .ret-oque { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.ret-cenario h3, .ret-oque h3 { margin: 0 0 4px; font-size: 14px; }
.ret-cenario p { margin: 0; font-size: 13px; line-height: 1.55; }
.ret-cfg { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.ret-cfg label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-muted); }
.ret-cfg input { width: 150px; }

.saldo-zeradas { margin: 6px 0 0; font-size: 12px; }

/* receita dos sócios (V67) */
.socios-visao { margin: 4px 0 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.socios-visao-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.socios-visao-rot { font-weight: 600; font-size: 13.5px; }
.socios-visao-dica { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.socios-visao-resumo { margin: 4px 0 0; font-size: 12.5px; }
.saldo-socios { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; }

.cat-toolbar { margin-top: 14px; }
#categoriasForm.cfg-editando { outline: 2px solid var(--accent, #b8860b); outline-offset: 4px; border-radius: 10px; }

/* baixa rápida (marcar pago/recebido na lista) */
.baixa-pop { position: fixed; z-index: 1200; width: 330px; max-width: calc(100vw - 24px); background: var(--surface, #fff); color: inherit; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px 16px; }
.baixa-pop[hidden] { display: none; }
.baixa-form { display: flex; flex-direction: column; gap: 10px; }
.baixa-cab { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.baixa-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-muted); padding: 2px 6px; }
.baixa-desc { margin: -4px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.baixa-campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.baixa-pop, .baixa-pop * { box-sizing: border-box; }
.baixa-pop { overflow: hidden; }
.baixa-campo select, .baixa-campo input { width: 100%; max-width: 100%; min-width: 0; height: 38px; padding: 6px 10px; font: inherit; font-size: 14px; color: inherit; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; }
.baixa-campo select:focus, .baixa-campo input:focus { outline: 2px solid var(--accent, #9a7417); outline-offset: 1px; }
.baixa-desc { overflow-wrap: anywhere; }
.baixa-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.baixa-enc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.baixa-enc[hidden] { display: none; }
.baixa-total { margin: 0; font-size: 13px; }
.baixa-erro { margin: 0; font-size: 12.5px; color: var(--danger, #b42318); }
.baixa-ok { width: 100%; }

/* lista com pesquisa (categoria no lançamento) */
.combo-busca { position: relative; }
.combo-busca .combo-input { width: 100%; box-sizing: border-box; }
.combo-busca .combo-select { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.combo-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; margin: 0; padding: 4px; list-style: none; max-height: 260px; overflow-y: auto; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.combo-lista[hidden] { display: none; }
.combo-lista li { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.combo-lista li.ativo, .combo-lista li[data-i]:hover { background: var(--surface-2, rgba(0,0,0,.06)); }
.combo-lista li[aria-selected="true"] { font-weight: 600; }
.combo-lista .combo-vazio { color: var(--ink-muted); cursor: default; }

.baixa-campo textarea { width: 100%; max-width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px; color: inherit; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; resize: vertical; }


/* v206: Controladoria — quanto pode retirar pelo balanço gerencial e alerta de retiradas acima do lucro */
.ret-bal { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
.ret-bal h3 { margin: 0 0 2px; font-size: 14px; }
.ret-bal-falta { font-size: 12.5px; margin: 2px 0 10px; }
.ret-alerta { margin: 4px 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--red); background: rgba(226,102,74,.10); font-size: 13px; line-height: 1.5; }
.ret-alerta strong:first-child { color: var(--red); }
.kpi-acao { color: var(--ink); }
