/* Paleta Guestus (extraída de guestus.com.br) */
:root {
  --guestus-primary: #29b4ff;
  --guestus-primary-dark: #1e73be;
  --guestus-navy: #003388;
  --guestus-text: #32373c;
  --guestus-bg: #f4f9fd;
  --guestus-white: #ffffff;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: 'Roboto', sans-serif;
  color: var(--guestus-text);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Livvic', sans-serif;
}

a {
  color: var(--guestus-primary-dark);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(41, 180, 255, .45);
}

.form-control:focus {
  border-color: var(--guestus-primary);
}

.form-check-input:checked {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
}

/* Botões */
.btn-guestus {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
  color: var(--guestus-white);
  font-family: 'Livvic', sans-serif;
  font-weight: 600;
}

.btn-guestus:hover, .btn-guestus:focus, .btn-guestus:active {
  background-color: var(--guestus-primary-dark) !important;
  border-color: var(--guestus-primary-dark) !important;
  color: var(--guestus-white) !important;
}

.btn-outline-guestus {
  color: var(--guestus-primary-dark);
  border-color: var(--guestus-primary);
}

.btn-outline-guestus:hover {
  background-color: var(--guestus-primary);
  color: var(--guestus-white);
}

/* Layout autenticado */
:root {
  --sidebar-largura: 250px;
  --sidebar-recolhida: 72px;
  --topbar-altura: 60px;
}

.app-body {
  background-color: var(--guestus-bg);
}

/* Menu lateral */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-largura);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--guestus-navy) 0%, #00256a 100%);
  color: rgba(255, 255, 255, .85);
  z-index: 1040;
  transition: width .2s ease, transform .2s ease;
  overflow-x: hidden;
}

.sidebar-brand {
  height: var(--topbar-altura);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--guestus-white);
  border-bottom: 3px solid var(--guestus-primary);
  flex-shrink: 0;
}

.sidebar-logo img.logo-completo { height: 40px; }
.sidebar-logo img.logo-icone { height: 36px; display: none; }

.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  overflow-y: auto;
}

.sidebar-section {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .45);
  padding: 1rem .75rem .4rem;
  white-space: nowrap;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem .85rem;
  margin-bottom: .2rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}

.sidebar-link i { font-size: 1.2rem; flex-shrink: 0; }

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, .08);
  color: var(--guestus-white);
}

.sidebar-link.active {
  background-color: var(--guestus-primary);
  color: var(--guestus-white);
  box-shadow: 0 4px 12px rgba(41, 180, 255, .35);
}

.sidebar-toggle .seta {
  margin-left: auto;
  font-size: .8rem;
  transition: transform .2s;
}

.sidebar-toggle:not(.collapsed) .seta { transform: rotate(180deg); }
.sidebar-toggle:not(.collapsed) { color: var(--guestus-white); }

.sidebar-sublink {
  display: block;
  padding: .45rem .85rem .45rem 3rem;
  margin-bottom: .1rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, .7);
  text-decoration: none;
  font-size: .925rem;
  white-space: nowrap;
  position: relative;
}

.sidebar-sublink::before {
  content: '';
  position: absolute;
  left: 1.6rem;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  transform: translateY(-50%);
}

.sidebar-sublink:hover { color: var(--guestus-white); background-color: rgba(255, 255, 255, .06); }
.sidebar-sublink.active { color: var(--guestus-primary); font-weight: 600; }
.sidebar-sublink.active::before { background: var(--guestus-primary); }
.sidebar-sublink.em-breve { color: rgba(255, 255, 255, .4); font-style: italic; pointer-events: none; }

/* Subtítulo dentro de um grupo do menu (ex.: Fiscal > Tabelas Fiscais). */
.sidebar-secao {
  display: block;
  padding: .55rem .85rem .2rem 1.6rem;
  color: rgba(255, 255, 255, .45);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar-secao ~ .sidebar-sublink { padding-left: 3.4rem; }
.sidebar-secao ~ .sidebar-sublink::before { left: 2.1rem; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: .9rem;
  white-space: nowrap;
}

.sidebar-footer i { font-size: 1.3rem; color: var(--guestus-primary); }

/* Área principal */
.app-main {
  margin-left: var(--sidebar-largura);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-altura);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  background: var(--guestus-white);
  border-bottom: 3px solid var(--guestus-primary);
  box-shadow: 0 2px 8px rgba(0, 51, 136, .08);
}

.btn-topbar {
  font-size: 1.5rem;
  line-height: 1;
  padding: .25rem .5rem;
  color: var(--guestus-navy);
  border: none;
}

.btn-topbar:hover { color: var(--guestus-primary); }
.btn-tela-cheia { font-size: 1.15rem; }

.topbar-title {
  font-family: 'Livvic', sans-serif;
  font-weight: 600;
  color: var(--guestus-navy);
}

.navbar-user {
  color: var(--guestus-text);
}

/* Menu do usuário logado (barra superior) */
.btn-usuario {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 0;
  border-radius: 999px;
  padding: .25rem .75rem;
  color: var(--guestus-navy);
}
.btn-usuario > .bi { font-size: 1.35rem; line-height: 1; }
.btn-usuario:hover, .btn-usuario[aria-expanded="true"] { background: #e8f6ff; }
.menu-usuario { min-width: 220px; }
.menu-usuario .dropdown-header { display: flex; flex-direction: column; color: var(--guestus-navy); }
.menu-usuario .dropdown-header span { color: #6c7a89; font-size: .8rem; }
.menu-usuario .dropdown-item .bi { margin-right: .35rem; }


.topbar-empresa {
  padding: .25rem .75rem;
  border-radius: 999px;
  background: #e8f6ff;
  color: var(--guestus-navy);
  font-size: .85rem;
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-empresa > span { overflow: hidden; text-overflow: ellipsis; }
/* Lista de empresas na barra superior (banco com matriz e filiais) */
.topbar-empresa-lista {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: 0 .25rem 0 .75rem;
  max-width: none;
  margin: 0;
}
.topbar-empresa-lista:hover, .topbar-empresa-lista:focus-within { background: #d4eeff; }
.topbar-empresa-lista .form-select {
  border: 0;
  background-color: transparent;
  color: var(--guestus-navy);
  font-weight: 500;
  font-size: .85rem;
  max-width: 420px;
  padding-left: .25rem;
  cursor: pointer;
  text-overflow: ellipsis;
  box-shadow: none;
}
@media (max-width: 767.98px) {
  .topbar-empresa-lista .form-select { max-width: 150px; }
}
.topbar-empresa + .btn-topbar { font-size: 1.1rem; }

.app-content {
  flex: 1;
  padding: 1.5rem;
}

.footer-guestus {
  padding: 1rem 1.5rem;
  background-color: var(--guestus-navy);
  color: rgba(255, 255, 255, .8);
  font-size: .875rem;
}

.sidebar-backdrop { display: none; }

/* Menu recolhido (desktop): só ícones */
@media (min-width: 992px) {
  .sidebar-recolhida .sidebar { width: var(--sidebar-recolhida); }
  .sidebar-recolhida .app-main { margin-left: var(--sidebar-recolhida); }
  .sidebar-recolhida .sidebar-logo .logo-completo { display: none; }
  .sidebar-recolhida .sidebar-logo .logo-icone { display: inline; }
  .sidebar-recolhida .sidebar-link span,
  .sidebar-recolhida .sidebar-link .seta,
  .sidebar-recolhida .sidebar-footer span,
  .sidebar-recolhida .sidebar-section { display: none; }
  .sidebar-recolhida .sidebar-link { justify-content: center; padding: .65rem; }
  .sidebar-recolhida .sidebar .collapse { display: none !important; }
  .sidebar-recolhida .sidebar-footer { justify-content: center; padding: 1rem 0; }
}

/* Celular/tablet: menu sobreposto */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  .sidebar-aberta .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .sidebar-aberta .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 1035;
  }
  .app-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

.welcome-card {
  background: var(--guestus-white);
  border-left: 5px solid var(--guestus-primary);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(0, 51, 136, .06);
}

.welcome-title {
  color: var(--guestus-navy);
  font-weight: 700;
}

/* Tela de login: estilos em css/login.css */

/* Páginas internas */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title {
  color: var(--guestus-navy);
  font-weight: 700;
  font-size: 1.75rem;
  margin-bottom: .15rem;
}

.card-guestus {
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 51, 136, .06);
}

.card-guestus .form-label {
  font-weight: 500;
  font-size: .9rem;
}

.table-guestus thead th {
  background-color: var(--guestus-navy);
  color: var(--guestus-white);
  font-weight: 500;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  border: none;
}

.table-guestus thead th:first-child { border-top-left-radius: 10px; }
.table-guestus thead th:last-child { border-top-right-radius: 10px; }

.linha-inativa td { opacity: .55; }

.badge-cli { background-color: var(--guestus-primary); }
.badge-forn { background-color: #ff9800; }
.badge-fun { background-color: var(--guestus-navy); }
.badge-principal { background-color: var(--guestus-navy); }
.badge-ativa { background-color: #2e7d32; }
.badge-servico { background-color: #7b1fa2; }

/* Título de seção dentro de uma aba de formulário */
.secao-form {
  margin: .75rem 0 0;
  padding-bottom: .4rem;
  border-bottom: 1px solid #e3eef8;
  color: var(--guestus-navy);
  font-family: "Livvic", sans-serif;
  font-weight: 700;
}
.secao-form i { color: var(--guestus-primary); margin-right: .25rem; }

.pagination .page-link { color: var(--guestus-primary-dark); }
.pagination .page-item.active .page-link {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
  color: var(--guestus-white);
}

.nav-guestus .nav-link {
  color: var(--guestus-text);
  font-weight: 500;
}

.nav-guestus .nav-link.active {
  color: var(--guestus-primary-dark);
  border-top: 3px solid var(--guestus-primary);
}

.btn-outline-guestus.active,
.btn-check:checked + .btn-outline-guestus {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
  color: var(--guestus-white);
}

/* Logo/foto da pessoa */
.pessoa-foto {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border: 1px dashed var(--guestus-primary);
  border-radius: 10px;
  background: #f5f8fc;
  overflow: hidden;
}
.pessoa-foto img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pessoa-foto i { font-size: 3rem; color: var(--guestus-primary); opacity: .6; }

.papel-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.btn-papel {
  border: 2px solid #dee2e6;
  border-radius: 999px;
  color: var(--guestus-text);
  padding: .4rem 1.1rem;
  background: var(--guestus-white);
}

.btn-papel:hover {
  border-color: var(--guestus-primary);
  color: var(--guestus-primary-dark);
}

.btn-check:checked + .btn-papel {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
  color: var(--guestus-white);
}

.form-switch .form-check-input:checked {
  background-color: var(--guestus-primary);
  border-color: var(--guestus-primary);
}

.atalho-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--guestus-white);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 51, 136, .06);
  text-decoration: none;
  color: var(--guestus-navy);
  font-family: 'Livvic', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  transition: transform .15s, box-shadow .15s;
}

.atalho-card i {
  font-size: 2rem;
  color: var(--guestus-primary);
}

.atalho-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 51, 136, .12);
  color: var(--guestus-primary-dark);
}

.atalho-card { height: 100%; }
.atalho-card span { line-height: 1.2; }
.atalho-card small {
  display: block;
  margin-top: .2rem;
  font-family: 'Roboto', sans-serif;
  font-size: .75rem;
  font-weight: 400;
  color: var(--bs-secondary-color);
}

.atalho-card.em-breve { opacity: .6; cursor: default; }
.atalho-card.em-breve:hover { transform: none; box-shadow: 0 4px 16px rgba(0, 51, 136, .06); color: var(--guestus-navy); }

@media (max-width: 575.98px) {
  .atalho-card { padding: 1rem; gap: .75rem; font-size: 1rem; }
  .atalho-card i { font-size: 1.6rem; }
}

/* Cabeçalhos ordenáveis (tag helper asp-ordenar) */
.table-guestus thead th.ordenavel { padding: 0; }

.table-guestus thead th.ordenavel a {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .5rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.table-guestus thead th.ordenavel a:hover { background-color: rgba(255, 255, 255, .08); }

.table-guestus thead th.ordenavel .icone-ordem {
  font-size: .75rem;
  opacity: .45;
}

.table-guestus thead th.ordenavel a:hover .icone-ordem { opacity: .8; }

.table-guestus thead th.ordenado {
  background-color: var(--guestus-primary-dark);
}

.table-guestus thead th.ordenado .icone-ordem {
  opacity: 1;
  color: var(--guestus-white);
}

/* Modal de exclusão */
.modal-guestus { border: none; border-radius: 12px; }
.modal-guestus .modal-title { font-family: 'Livvic', sans-serif; font-weight: 700; color: var(--guestus-navy); }
.lista-vinculos { padding-left: 1.25rem; columns: 2; column-gap: 1.5rem; }
.lista-vinculos li { break-inside: avoid; }

/* Orçamentos */
.badge-orc-aberto { background-color: var(--guestus-primary); }
.badge-orc-fechado { background-color: #2e7d32; }

.busca-campo { position: relative; }
.busca-lista {
  position: absolute;
  z-index: 1050;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 2px;
  box-shadow: 0 8px 24px rgba(0, 51, 136, .15);
}
.busca-lista .list-group-item.active { background-color: var(--guestus-primary); border-color: var(--guestus-primary); }
.busca-lista .list-group-item.active .text-muted { color: rgba(255, 255, 255, .8) !important; }

.orc-entrada { background-color: #f5f9fd; }

.tabela-itens .col-qtd { width: 9rem; }
.tabela-itens .col-preco { width: 10rem; }
.tabela-itens td input.mask-qtd,
.tabela-itens td input.mask-decimal { min-width: 6.5rem; }
.tabela-itens .item-obs { margin-top: .25rem; border-style: dashed; font-size: .8rem; }
.tabela-itens .item-obs:placeholder-shown:not(:focus) { border-color: transparent; background: transparent; padding-left: 0; }
.tabela-itens tr.item-novo td { animation: item-novo 1.2s ease-out; }
@keyframes item-novo { from { background-color: #e3f2fd; } to { background-color: transparent; } }

.orc-totais { background-color: #f5f9fd; }
.orc-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: .45rem 1rem;
  border-radius: 10px;
  background-color: var(--guestus-navy);
  color: var(--guestus-white);
}
.orc-total span { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; opacity: .85; }
.orc-total strong { font-family: "Livvic", sans-serif; font-size: 1.6rem; line-height: 1.2; }

/* Dashboard (cores validadas: série 1 azul, série 2 laranja; status com ícone + texto) */
:root {
  --dash-serie-1: #2a78d6;
  --dash-serie-2: #eb6834;
  --dash-grade: #e1e0d9;
  --dash-base: #c3c2b7;
  --dash-tinta-sec: #52514e;
  --dash-tinta-muda: #898781;
  --dash-critico: #d03b3b;
  --dash-alerta: #fab219;
  --dash-bom: #006300;
}

.dash-label { font-size: .85rem; color: var(--dash-tinta-sec); }
.dash-valor { font-size: 1.45rem; font-weight: 600; color: var(--guestus-navy); line-height: 1.3; white-space: nowrap; }
.dash-hero-valor { font-size: 2.6rem; font-weight: 700; color: var(--guestus-navy); line-height: 1.15; }
.dash-delta { font-size: .85rem; margin-top: .25rem; }
.dash-delta-bom { color: var(--dash-bom); }
.dash-delta-ruim { color: var(--dash-critico); }
.dash-vencido { color: var(--dash-critico); }

.dash-grafico { width: 100%; min-height: 280px; flex: 1 1 auto; }
.dash-svg { display: block; }
.dash-grade { stroke: var(--dash-grade); stroke-width: 1; }
.dash-base { stroke: var(--dash-base); stroke-width: 1; }
.dash-eixo { fill: var(--dash-tinta-muda); font-size: 11px; font-variant-numeric: tabular-nums; }
.dash-rotulo { fill: var(--dash-tinta-sec); font-size: 11px; font-weight: 600; }
.dash-coluna.serie-1 { fill: var(--dash-serie-1); }
.dash-coluna.serie-2 { fill: var(--dash-serie-2); }
.dash-coluna.vencido { fill: var(--dash-critico); }
.dash-hover { fill: transparent; cursor: default; outline: none; }
.dash-hover:hover, .dash-hover:focus { fill: rgba(11, 11, 11, .04); }

.dash-legenda { display: flex; gap: 1rem; font-size: .8rem; color: var(--dash-tinta-sec); }
.dash-chave { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.dash-chave.serie-1 { background: var(--dash-serie-1); }
.dash-chave.serie-2 { background: var(--dash-serie-2); }
.dash-chave.vencido { background: var(--dash-critico); }

.dash-ranking { list-style: none; margin: 0; padding: 0; counter-reset: ranking; }
.dash-ranking li { padding: .3rem .25rem; border-radius: 6px; outline: none; }
.dash-ranking li:hover, .dash-ranking li:focus { background: rgba(11, 11, 11, .04); }
.dash-ranking-texto { display: flex; justify-content: space-between; gap: .75rem; font-size: .85rem; }
.dash-ranking-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-ranking-nome::before { counter-increment: ranking; content: counter(ranking) ". "; color: var(--dash-tinta-muda); }
.dash-ranking-valor { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-ranking-sub { font-size: .75rem; color: var(--dash-tinta-muda); text-align: right; }
.dash-barra { height: 8px; margin-top: 3px; }
.dash-barra span { display: block; height: 100%; background: var(--dash-serie-1); border-radius: 0 4px 4px 0; }

.dash-tabela td, .dash-tabela th { font-size: .875rem; }
.dash-tabela thead th { color: var(--dash-tinta-sec); font-weight: 600; border-bottom-color: var(--dash-base); }
.dash-tabela td.text-end { font-variant-numeric: tabular-nums; }
.dash-produtos { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dash-status { font-size: .75rem; color: var(--dash-tinta-sec); white-space: nowrap; }
.dash-status-critico { color: var(--dash-critico); font-weight: 600; }
.dash-status-alerta { color: #8a5a00; font-weight: 600; }
.dash-status-alerta i { color: var(--dash-alerta); }

.dash-dica {
  position: absolute;
  z-index: 1080;
  max-width: 280px;
  padding: .45rem .65rem;
  border-radius: 6px;
  background: #0b0b0b;
  color: #fff;
  font-size: .8rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}
.dash-dica-sec { color: #c3c2b7; }

/* NF-e: colunas de NCM e CFOP editáveis na grade de itens. */
.tabela-itens .col-ncm { width: 7.5rem; }
.tabela-itens .col-cfop { width: 5.5rem; }

/* Campo aberto por link de pendência (ex.: SPED): destaque até o usuário mexer nele. */
.campo-destacado {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .25) !important;
}
