/* liion-modern.css — modernização preservando a identidade FiscoAzul.
   Carregada por último: refina o visual legado (cores, header, menu) sem trocá-lo. */

/* ---------- Layout: rodapé grudado no fim (corrige "footer muito alto") ---------- */
html { height: 100%; }
.liion-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #cde9ff;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.liion-header, .liion-pagehead, .liion-footer { flex: 0 0 auto; }
.liion-main { flex: 1 0 auto; }

/* ---------- Header: logo | menu | usuário ---------- */
.liion-header {
  background: #fff;
  border-bottom: 1px solid #e4ecf5;
  box-shadow: 0 1px 8px rgba(21, 101, 192, .08);
  min-height: 56px;
  padding: 0 16px 0 20px;
  gap: 8px;
  position: relative;
  z-index: 50;
}
.liion-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  padding: 8px 0;
}
.liion-logo {
  height: 38px;
  width: auto;
  display: block;
}
.liion-header-user {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: #4a5a70;
  flex-shrink: 0;
  padding-left: 8px;
}
.liion-header-user-name { font-weight: 600; color: #2b3a4f; }
.liion-btn-header {
  padding: 6px 12px !important;
  font-size: 12px !important;
  background: #1E88E5;
  box-shadow: none;
}
.liion-btn-header:hover { background: #1565C0; }

/* cabeçalho da tela: título à esquerda, trilha à direita */
.liion-pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px) 10px;
  background: #cde9ff;
}
.liion-page-title {
  margin: 0;
  color: #0D47A1;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .2px;
  flex: 0 1 auto;
  min-width: 0;
}
.liion-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  line-height: 1.3;
  color: #5a6b82;
  margin-left: auto;
  text-align: right;
}
.liion-breadcrumb-root {
  color: #1565C0;
  font-weight: 600;
}

/* ---------- Área de conteúdo (mais respiro) ---------- */
.liion-main {
  padding: 8px clamp(16px, 4vw, 40px) 24px;
  /* azul claro do legado — combina com o header branco / menu moderno */
  background: #cde9ff;
}

/* ---------- Rodapé ---------- */
.liion-footer {
  padding: 16px 20px;
  color: #33415a;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, .06);
}

/* ---------- Menu ao lado do logo (mesma estrutura #cssmenu) ---------- */
.liion-nav {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  position: relative;
  z-index: 50;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

#cssmenu {
  height: 56px;
  background: transparent;
  border-bottom: none;
  border-radius: 0;
  width: auto;
}
#cssmenu > ul {
  float: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  height: 100%;
}
#cssmenu > ul > li {
  float: none;
  height: 100%;
}
#cssmenu a {
  background: transparent;
  color: #2b3a4f;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 56px;
  padding: 0 14px;
  letter-spacing: .2px;
  transition: background .15s ease, color .15s ease;
}
#cssmenu > ul > li > a { color: #2b3a4f; font-size: 13px; }
#cssmenu > ul > li:first-child > a { border-radius: 0; }
#cssmenu > ul > li:hover > a,
#cssmenu > ul > li.active > a {
  background: #f0f7ff;
  color: #1565C0;
  box-shadow: none;
}
/* indicador inferior em vez do triângulo legado */
#cssmenu > ul > li:hover:after,
#cssmenu > ul > li.active:after {
  border: none;
  width: 60%;
  height: 3px;
  left: 20%;
  margin-left: 0;
  bottom: 0;
  background: #1E88E5;
  border-radius: 3px 3px 0 0;
}

/* dropdown colado no item (sem vão) — hover CSS estável */
#cssmenu .has-sub {
  position: relative;
}
#cssmenu .has-sub:hover > ul,
#cssmenu .has-sub .has-sub:hover > ul {
  display: block;
}
#cssmenu .has-sub > ul {
  border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 28px rgba(15, 55, 120, .16);
  overflow: visible;
  padding: 4px 0;
  z-index: 80;
  width: 220px;
  top: 100%;
  left: 0;
  margin: 0;
  background: #fff;
  border: 1px solid #e4ecf5;
  border-top: none;
}
#cssmenu .has-sub ul li { margin-bottom: 0; position: relative; }
#cssmenu .has-sub ul li a {
  background: transparent;
  border-bottom: none;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  padding: 10px 16px;
  color: #2b3a4f;
  transition: background .12s ease, color .12s ease;
}
/* anula o hover em cascata do CSS legado (pintava todos os filhos) */
#cssmenu .has-sub ul li:hover a,
#cssmenu .has-sub .has-sub ul li a,
#cssmenu .has-sub .has-sub ul li a:hover {
  background: transparent;
  color: #2b3a4f;
  border-bottom: none;
}
#cssmenu .has-sub ul li:hover > a,
#cssmenu .has-sub .has-sub ul li:hover > a {
  background: #eef6ff;
  color: #1565C0;
}
/* 3º nível: flyout colado à direita */
#cssmenu .has-sub .has-sub > ul {
  top: 0;
  left: 100%;
  margin: 0;
  border-radius: 10px;
  border-top: 1px solid #e4ecf5;
  z-index: 90;
}

.menu-toggle {
  background: #1E88E5;
  font-weight: 600;
  letter-spacing: .3px;
}

/* ---------- Superfícies: grid e formulário como cartões ---------- */
.liion-grid-wrap {
  border-radius: 12px;
  box-shadow: 0 3px 14px rgba(21, 101, 192, .08);
  overflow: hidden;
  background: #fff;
  border: 1px solid #e6eef7;
}
.liion-grid { font-size: 13px; }
.liion-grid th {
  padding: 12px 14px;
  font-weight: 600;
  letter-spacing: .3px;
}
.liion-grid td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; }
.liion-grid tbody tr { transition: background .12s ease; }
.liion-grid tbody tr:nth-child(even) td { background: #f7fafe; }
.liion-grid tbody tr:hover td { background: #e8f2ff; }
.liion-grid tbody tr:last-child td { border-bottom: none; }

.liion-form {
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(21, 101, 192, .08);
  border: 1px solid #e6eef7;
  padding: 22px 24px;
}
.liion-fieldset {
  border: 1px solid #e4ecf5;
  border-radius: 10px;
  padding: 16px 16px 8px;
  margin-bottom: 16px;
}
.liion-fieldset legend { padding: 0 8px; font-size: 13px; }

/* ---------- Campos modernos ---------- */
.liion-form input[type=text],
.liion-form input[type=email],
.liion-form input[type=password],
.liion-form select,
.liion-searchbar input[type=text] {
  border: 1px solid #cdd9e8;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.liion-form input:focus,
.liion-form select:focus,
.liion-searchbar input:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .15);
}

/* ---------- Login ---------- */
.liion-login-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 16px 40px;
}
.liion-login-form {
  width: 100%;
  max-width: 420px;
  margin: 0;
}
.liion-login-actions {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}
.liion-login-actions .liion-btn {
  min-width: 140px;
}
.liion-form label { font-weight: 600; color: #2b3a4f; margin-bottom: 6px; }

/* ---------- Botões modernos ---------- */
.liion-btn {
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(13, 71, 161, .2);
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
}
.liion-btn:hover { box-shadow: 0 4px 10px rgba(13, 71, 161, .28); }
.liion-btn:active { transform: translateY(1px); }
.liion-link { font-weight: 600; }

/* toolbar: faixa azul arredondada */
.liion-toolbar {
  background: #0D47A1;
  border-radius: 10px;
  padding: 12px 14px;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: space-between;
}

.liion-searchbar { gap: 10px; margin: 0 0 16px; }
.liion-searchbar--inline {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
}
.liion-searchbar--inline input[type=text] {
  flex: 1 1 220px;
  max-width: 420px;
  min-width: 140px;
}
.liion-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}
.liion-toolbar-meta {
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.liion-pager {
  background: #fff;
  border: 1px solid #e6eef7;
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 2px 10px rgba(21, 101, 192, .06);
  width: fit-content;
}

/* mensagens como alertas modernos */
.liion-msg-success,
.liion-msg-error {
  border-radius: 10px;
  padding: 11px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
.liion-msg-success { background: #e7f6ec; color: #1b7a3d; border: 1px solid #b7e2c4; }
.liion-msg-error { background: #fdeaea; color: #b4231b; border: 1px solid #f3c2bf; }

/* ---------- Tela genérica (ainda não migrada) ---------- */
.tela-cab {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.tela-badge {
  font-size: 11px;
  font-weight: 600;
  color: #8a6d1f;
  background: #fff6e0;
  border: 1px solid #f0dca6;
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: .2px;
}
.tela-vazia { color: #51607a; font-size: 14px; }
.tela-vazia p { margin: 0; }
.replica-vazia { text-align: center; color: #8a94a6; padding: 18px; font-style: italic; }
.liion-btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ---------- Barra de filtros dos cadastros ---------- */
.liion-filtrobar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  background: #fff;
  border: 1px solid #e6eef7;
  border-radius: 12px;
  box-shadow: 0 3px 14px rgba(21, 101, 192, .06);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.liion-filtro { display: flex; flex-direction: column; gap: 4px; min-width: 165px; }
.liion-filtro--busca { min-width: 240px; }
.liion-filtro > span { font-size: 11px; font-weight: 600; color: #5a6b86; letter-spacing: .2px; }
.liion-filtrobar input[type=text],
.liion-filtrobar input[type=date],
.liion-filtrobar select {
  border: 1px solid #cdd9e8;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  min-width: 140px;
}
.liion-filtro--busca input { min-width: 230px; }
.liion-filtrobar input:focus,
.liion-filtrobar select:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .15);
}
.liion-filtro-acoes { display: flex; gap: 8px; align-items: center; margin-left: auto; }

.liion-barra-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.liion-barra-meta .liion-toolbar-meta { color: #45526b; font-size: 13px; font-weight: 600; }

/* ---------- Tom Select (selects com busca) — harmoniza com o visual ---------- */
.ts-wrapper { min-width: 150px; }
.liion-filtro .ts-wrapper,
.liion-form .ts-wrapper { width: 100%; min-width: 0; }
.ts-control {
  border: 1px solid #cdd9e8 !important;
  border-radius: 8px !important;
  min-height: 38px;
  padding: 3px 8px !important;
  font-size: 13px;
  box-shadow: none !important;
  font-family: inherit;
}
.ts-wrapper.focus .ts-control {
  border-color: #1565C0 !important;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .15) !important;
}
.ts-dropdown {
  border: 1px solid #cdd9e8;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 55, 120, .16);
  font-size: 13px;
  margin-top: 4px;
}
.ts-dropdown .option.active { background: #eef6ff; color: #1565C0; }
.ts-dropdown .no-results { color: #8a94a6; }

@media (max-width: 560px) {
  .liion-filtro,
  .liion-filtro--busca input,
  .liion-filtrobar input,
  .liion-filtrobar select { width: 100%; min-width: 0; }
  .liion-filtro-acoes { margin-left: 0; width: 100%; }
}

/* ---------- Responsividade refinada ---------- */
@media (max-width: 1080px) {
  .liion-main { padding: 16px; }
  .liion-grid th, .liion-grid td { padding: 10px; }
  .liion-form { padding: 16px; border-radius: 12px; }
  .liion-btn { padding: 11px 16px; } /* alvo de toque maior */
  .liion-header {
    flex-wrap: wrap;
    padding: 8px 12px;
    min-height: auto;
  }
  .liion-logo { height: 34px; }
  .liion-nav {
    order: 3;
    flex: 1 1 100%;
    border-top: 1px solid #eef2f7;
    margin-top: 4px;
  }
  .menu-toggle { display: block; border-radius: 8px; margin: 6px 0; }
  #cssmenu { height: auto; background: #fff; }
  #cssmenu a {
    background: #fff;
    line-height: normal;
    padding: 13px 16px;
    border-bottom: 1px solid #eef2f7;
  }
  #cssmenu > ul > li:hover:after,
  #cssmenu > ul > li.active:after { display: none; }
  #cssmenu .has-sub ul {
    box-shadow: none;
    border: none;
    border-radius: 0;
    width: 100%;
    top: auto;
    padding: 0;
    background: #f7fafc;
  }
  #cssmenu .has-sub .has-sub ul {
    left: auto;
    background: #eef4fb;
  }
  .liion-pagehead { padding: 12px 16px 8px; }
  .liion-page-title { font-size: 1.25rem; }
  .liion-breadcrumb { margin-left: 0; text-align: left; width: 100%; }
}
@media (max-width: 420px) {
  .liion-footer { padding: 14px; }
  .liion-header-user-name { display: none; }
}

/* === Correção do header: menu colapsado (hambúrguer) abaixo de 1080px ===
   O menu horizontal não cabe junto com logo + usuário (sobrepunha o nome/Sair).
   Abaixo de 1080px ele vira um menu de hambúrguer de verdade: escondido até clicar,
   empilhado quando aberto; submenus viram acordeão (abrem no toque via .expanded). */
@media (max-width: 1080px) {
  /* botão do hambúrguer em cima, menu embaixo (não lado a lado) */
  .liion-nav { flex-direction: column; align-items: stretch; }
  #cssmenu { height: auto; width: 100%; }
  #cssmenu > ul {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    height: auto;
    width: 100%;
  }
  #cssmenu.open > ul { display: flex; }
  #cssmenu > ul > li { width: 100%; height: auto; }
  #cssmenu a { line-height: normal; padding: 12px 16px; }

  /* submenus: fluem no acordeão (sem posição absoluta), abrem via .expanded */
  #cssmenu .has-sub > ul,
  #cssmenu .has-sub .has-sub > ul {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    background: #f7fafc;
  }
  #cssmenu .has-sub:hover > ul,
  #cssmenu .has-sub .has-sub:hover > ul { display: none; }
  #cssmenu .has-sub > ul { display: none; }
  #cssmenu li.expanded > ul { display: block !important; }
  #cssmenu .has-sub ul li a { padding-left: 30px; }
  #cssmenu .has-sub .has-sub ul li a { padding-left: 46px; }
}
