/* GestorAppMI - FICHA COM MENU LATERAL [FICHA-LATERAL-2110] (Nicholas, 21/10: "eu gosto do menu lateral, estilo DigiSat")
   CADASTROS > CLIENTES / FORNECEDORES e PRODUTOS / SERVIÇOS: o menu à esquerda escolhe a parte e só ela aparece à direita.
   (21/10, Nicholas) "campos de cada aba alinhados à esquerda, um embaixo do outro" e "tela sempre do mesmo tamanho (que se ajuste ao
   monitor)": UM CAMPO POR LINHA — rótulo numa coluna fixa à esquerda, o campo logo depois, na largura do que ele guarda — e a JANELA
   com tamanho fixo pela tela; o que não couber rola por dentro (a janela não cresce nem encolhe ao trocar de parte). Só o PC do Nicholas. */

/* ---- a JANELA: tamanho fixo, proporcional ao monitor ---- */
:is(#gp-host, #gq-host) .gk-ficha.gk-ficha-larga { width: min(1180px, calc(100 * var(--vw, 1vw) - 32px)) !important;
  height: min(760px, calc(100 * var(--vh, 1vh) - 24px)) !important; max-height: none !important; }
:is(#gp-host, #gq-host) .gk-ficha > .g-lateral { flex: 1 1 auto !important; min-height: 0 !important; overflow-y: auto !important; }

/* ---- o MENU à esquerda ---- */
:is(#gp-host, #gq-host) .g-lateral { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 18px; row-gap: 0; align-items: start; padding: 14px 16px !important; background: #fff !important; }
:is(#gp-host, #gq-host) .g-lateral > :not(.g-lat-menu) { grid-column: 2; min-width: 0; margin: 0 0 10px !important; }
:is(#gp-host, #gq-host) .g-lateral > .g-lat-menu { grid-column: 1; grid-row: 1 / span 12; position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column; gap: 4px; padding: 8px; margin: 0; border-radius: 14px; background: var(--p-50, #f3f6fb); border: 1px solid var(--p-borda, #dbe3ef); }
:is(#gp-host, #gq-host) .g-lat-menu button { position: relative; display: flex !important; align-items: center; gap: 10px; width: 100% !important; height: 44px !important; padding: 0 12px !important;
  border-radius: 10px !important; border: 0 !important; background: transparent !important; color: var(--p-texto, #16233d) !important; box-shadow: none !important; transform: none !important;
  font-size: 12.5px !important; font-weight: 800 !important; letter-spacing: .3px; text-align: left !important; cursor: pointer; }
:is(#gp-host, #gq-host) .g-lat-menu button[hidden] { display: none !important; }
:is(#gp-host, #gq-host) .g-lat-menu button::before { content: none !important; }
:is(#gp-host, #gq-host) .g-lat-menu button i { font-style: normal; width: 22px; text-align: center; font-size: 17px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
:is(#gp-host, #gq-host) .g-lat-menu button:hover { background: var(--p-100, #e3ecfb) !important; }
:is(#gp-host, #gq-host) .g-lat-menu button.ativo { background: var(--p-500, #1668e3) !important; color: var(--p-sobre, #fff) !important; }
:is(#gp-host, #gq-host) .g-lat-menu button.ativo * { color: var(--p-sobre, #fff) !important; }
:is(#gp-host, #gq-host) .g-lat-menu button.gq-tav-aba::after { content: '⚠'; margin-left: auto; color: #f0a500; }
:is(#gp-host, #gq-host) .g-lateral fieldset.g-fs { border: 0 !important; padding: 0 !important; margin: 0 !important; min-width: 0; }
#gq-host .g-lateral .gq-tav { margin: 0 0 10px !important; }

/* ---- a PARTE escolhida: título e UM CAMPO POR LINHA ---- */
:is(#gp-host, #gq-host) .g-lateral [data-aba]:not([hidden]) { display: flex !important; flex-direction: column; align-items: stretch; gap: 10px !important;
  padding: 16px 20px 20px !important; border-radius: 14px; background: #fff; border: 1px solid var(--p-borda, #dbe3ef); --rot: 210px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba]::before { content: attr(data-tit); font-size: 13px; font-weight: 900; letter-spacing: 1px; color: var(--p-800, #0d2b5c);
  padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--p-borda, #dbe3ef); }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > [hidden], :is(#gp-host, #gq-host) .g-lateral [data-aba] > span:empty { display: none !important; }
/* a linha: rótulo (coluna fixa) + campo (largura do que ele guarda) */
:is(#gp-host, #gq-host) .g-lateral [data-aba] > label:not(.g-marca):not([hidden]), :is(#gp-host, #gq-host) .g-lateral [data-aba] > .gq-trib-linha:not([hidden]) {
  display: grid !important; grid-template-columns: var(--rot) minmax(0, var(--w, 460px)); align-items: center; column-gap: 12px; margin: 0 !important; text-align: left !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > :is(label, .gq-trib-linha) > span:first-child { text-align: left !important; font-size: 11.5px !important; font-weight: 800; letter-spacing: .3px; opacity: .9; padding: 0 !important; white-space: normal; line-height: 1.2; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > :is(label:not(.g-marca), .gq-trib-linha) > :not(span:first-child) { width: 100%; min-width: 0; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > .s1 { --w: 140px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > .s2 { --w: 200px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > .s3 { --w: 260px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > .s4 { --w: 340px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > :is(.s5, .s6) { --w: 460px; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > :is(.s7, .s8, .s9, .s10, .s11, .s12, .gq-trib-linha) { --w: 640px; }
/* marcações (CLIENTE, FORNECEDOR…): uma por linha, alinhadas com os campos */
:is(#gp-host, #gq-host) .g-lateral [data-aba] > label.g-marca:not([hidden]) { display: flex !important; align-items: center; gap: 10px; width: auto !important; max-width: 640px;
  margin: 0 0 0 calc(var(--rot) + 12px) !important; padding: 0 !important; min-height: 32px; border: 0 !important; background: none !important; justify-content: flex-start !important; text-align: left !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > label.g-marca > span { font-size: 12.5px !important; }
/* títulos de grupo, cartões e blocos que ocupam a linha inteira */
:is(#gp-host, #gq-host) .g-lateral [data-aba] > :is(.gq-nut-tit, .gq-lojas, .gp-parc, .gq-fotos, .gq-foto-add, .gq-foto-dica, .gq-regra-dica, .gq-srv-desc, div[id^="gq-dica"]) { width: 100%; max-width: calc(var(--rot) + 652px); }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > .gq-nut-tit { margin-top: 8px !important; }
/* texto à esquerda; dinheiro, quantidade e percentual à direita */
:is(#gp-host, #gq-host) .g-lateral [data-aba] :is(input, select, textarea) { text-align: left !important; text-align-last: auto !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] :is(input[data-din], input[data-qtd], input[data-pct], #gq-margem, #gq-fator_conversao, #gp-limite_centavos) { text-align: right !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] :is(.g-lupa, .g-zap) input:not([type=checkbox]) { text-align: left !important; }

/* ---- tela estreita (celular): menu numa faixa em cima, rótulo em cima do campo ---- */
@media (max-width: 860px) {
  :is(#gp-host, #gq-host) .g-lateral { grid-template-columns: minmax(0, 1fr); }
  :is(#gp-host, #gq-host) .g-lateral > :not(.g-lat-menu) { grid-column: 1; }
  :is(#gp-host, #gq-host) .g-lateral > .g-lat-menu { grid-column: 1; grid-row: auto; position: static; flex-direction: row; overflow-x: auto; margin: 0 0 10px; }
  :is(#gp-host, #gq-host) .g-lat-menu button { width: auto !important; flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 640px) {
  :is(#gp-host, #gq-host) .g-lateral [data-aba] > label:not(.g-marca):not([hidden]), :is(#gp-host, #gq-host) .g-lateral [data-aba] > .gq-trib-linha:not([hidden]) { grid-template-columns: minmax(0, 1fr); row-gap: 3px; }
  :is(#gp-host, #gq-host) .g-lateral [data-aba] > label.g-marca:not([hidden]) { margin-left: 0 !important; }
  :is(#gp-host, #gq-host) .gk-ficha.gk-ficha-larga { width: 100% !important; height: 100% !important; }
}
:is(#gp-host, #gq-host) .g-lateral [data-aba] > label.g-marca > input[type=checkbox] { width: 20px !important; height: 20px !important; flex: 0 0 20px; margin: 0 !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] > label.g-marca > span { flex: 0 1 auto; width: auto !important; }
:is(#gp-host, #gq-host) .g-lateral [data-aba] .g-lupa input:not([type=checkbox]) { padding-left: 12px !important; }
/* as partes não rolam sozinhas (quem rola é a janela): bloco com rolagem própria na grade conta altura zero e o próximo cai por cima */
:is(#gp-host, #gq-host) .g-lateral > :is(fieldset, div):not(.g-lat-menu) { overflow: visible !important; max-height: none !important; }
/* o botão CALCULAR PELA FÓRMULA na coluna dos campos */
#gq-host .g-lateral [data-aba] > label.gq-formula-l { --w: 260px; }
#gq-host .g-lateral [data-aba] > label.gq-formula-l > button { width: auto !important; justify-self: start; }
