/* Inter, vendorizada localmente (sem CDN em tempo de execução — regra do projeto) */
@font-face {
  font-family: "Inter";
  src: url("/static/vendor/fonts/inter/Inter-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --azul-escuro: #1E2761;
  --azul-claro: #CADCFC;
  --azul-vivo: #3355d8;
  --superficie: #fff;
  --fundo: #f5f7fc;
  --borda: #e6e9f4;
  --texto-suave: #6b7390;
  --sombra-card: 0 1px 2px rgba(21, 27, 68, .04), 0 6px 20px rgba(21, 27, 68, .06);
  --sombra-card-hover: 0 4px 10px rgba(21, 27, 68, .06), 0 14px 32px rgba(21, 27, 68, .1);
  --raio: .85rem;
  --fonte: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { min-width: 0; }
html { min-width: 320px; overflow-x: hidden; }
body {
  background: var(--fundo);
  font-family: var(--fonte);
  font-size: clamp(.9rem, .86rem + .15vw, .98rem);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas, video, iframe { max-width: 100%; height: auto; }
button, input, select, textarea { max-width: 100%; }
textarea { min-height: 6.5rem; resize: vertical; }

.sidebar {
  width: 280px; height: 100dvh;
  background: linear-gradient(180deg, #212c6e 0%, var(--azul-escuro) 55%, #171f52 100%);
  position: sticky; top: 0; align-self: flex-start; flex-shrink: 0;
  z-index: 1040; overflow: hidden; box-shadow: 2px 0 18px rgba(10, 14, 40, .1);
}
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.08rem; line-height: 1.2; display: flex; align-items: center; gap: .55rem; letter-spacing: -.01em; }
.sidebar .brand > i { flex: 0 0 auto; font-size: 1.5rem; background: rgba(255,255,255,.12); padding: .4rem; border-radius: .6rem; }
.sidebar .brand small { font-weight: 400; color: var(--azul-claro); font-size: .72rem; letter-spacing: 0; }
.sidebar .nav-link { color: var(--azul-claro); padding: .55rem .7rem; font-size: .91rem; border-radius: .6rem; display: flex; align-items: center; gap: .65rem; line-height: 1.22; transition: background .12s, color .12s; }
.sidebar .nav-link > i { flex: 0 0 1.1rem; margin: 0 !important; text-align: center; font-size: 1rem; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar .nav-link.active { background: linear-gradient(90deg, rgba(255,255,255,.18), rgba(255,255,255,.09)); color: #fff; box-shadow: inset 2px 0 0 #fff; }
.sidebar-scroll { flex: 1 1 auto; min-height: 0; width: 100%; flex-wrap: nowrap !important; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; padding-right: .15rem; }
.sidebar-scroll > li { flex: 0 0 auto; width: 100%; }
.sidebar-section { color: #91a3db; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .7rem .72rem .18rem; }
.sidebar .nav hr { opacity: .26; }
.sidebar-user { flex: 0 0 auto; }
.sidebar-user .usuario-nome { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conteudo { min-width: 0; max-width: 1920px; width: 100%; margin-inline: auto; }
.quick-logout { display: none; }

.card { border: 1px solid var(--borda); box-shadow: var(--sombra-card); border-radius: var(--raio); overflow: clip; transition: box-shadow .15s, transform .15s; }
.card-header { background: var(--superficie); border-bottom: 1px solid var(--borda); font-weight: 600; }
.card-body { min-width: 0; }
h1.pagina, h2, h3, .card-header, legend.secao, .brand, .btn { letter-spacing: -.01em; }
.table { margin-bottom: 0; }
.table th { font-size: .78rem; text-transform: uppercase; color: #6b7390; letter-spacing: .02em; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-scroll, .table-responsive { max-width: 100%; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.table-scroll > .table, .table-responsive > .table { min-width: 620px; }
.table-scroll::-webkit-scrollbar, .table-responsive::-webkit-scrollbar { height: .55rem; }
.table-scroll::-webkit-scrollbar-thumb, .table-responsive::-webkit-scrollbar-thumb { background: #c4cae0; border-radius: 1rem; }

.stat-card .valor { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); font-weight: 700; color: var(--azul-escuro); overflow-wrap: anywhere; }
.stat-card .rotulo { font-size: .78rem; color: #6b7390; text-transform: uppercase; letter-spacing: .03em; }
.badge.status-Pago, .badge.status-Recebido, .badge.status-Ativo, .badge.status-Ativa { background: #198754; }
.badge.status-Em.Aberto, .badge.status-EmAberto { background: #0d6efd; }
.badge.status-Vencido, .badge.status-Demitido, .badge.status-Inativo, .badge.status-Inativa { background: #dc3545; }
.badge.status-Parcialmente.Pago { background: #fd7e14; }
.badge.status-Cancelado, .badge.status-Suspenso { background: #6c757d; }
h1.pagina { font-size: clamp(1.3rem, 1.12rem + .8vw, 1.55rem); font-weight: 700; color: var(--azul-escuro); overflow-wrap: anywhere; }
.form-label { font-weight: 600; font-size: .82rem; color: #444d6e; margin-bottom: .25rem; }
.form-control, .form-select { min-height: 2.5rem; }
legend.secao { font-size: .95rem; font-weight: 700; color: var(--azul-escuro); border-bottom: 2px solid var(--azul-claro); padding-bottom: .3rem; margin: 1.1rem 0 .8rem; }
.btn { min-height: 2.45rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .55rem; font-weight: 600; transition: transform .08s, box-shadow .12s, filter .12s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--azul-vivo); border-color: var(--azul-vivo); box-shadow: 0 2px 8px rgba(51, 85, 216, .25); }
.btn-primary:hover, .btn-primary:focus { background: #2947c2; border-color: #2947c2; box-shadow: 0 4px 14px rgba(51, 85, 216, .32); }
.btn-sm { min-height: 2rem; }
.btn-close { min-height: auto; }
.dropdown-menu { max-width: min(92vw, 22rem); }
.modal-dialog { margin: .75rem auto; }
.modal-body { overflow-wrap: anywhere; }

.aging-bar { cursor: pointer; transition: opacity .15s; }
.aging-bar:hover { opacity: .8; }
.contador-card { cursor: pointer; transition: transform .1s, box-shadow .1s; text-decoration: none; }
.contador-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(30,39,97,.15); }
.chat-caixa { height: min(55dvh, 42rem); overflow-y: auto; background: #fff; border-radius: .6rem; }
.msg-usuario { background: #1E2761; color: #fff; border-radius: 1rem 1rem 0 1rem; max-width: min(75%, 46rem); overflow-wrap: anywhere; }
.msg-bot { background: #eef1f9; border-radius: 1rem 1rem 1rem 0; max-width: min(85%, 52rem); white-space: pre-wrap; overflow-wrap: anywhere; }
.pix-codigo { font-size: .75rem; word-break: break-all; background: #f4f6fb; padding: .5rem; border-radius: .4rem; }

.auth-page {
  min-height: 100dvh; padding: 1rem; flex-direction: column; gap: 1.25rem;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(50rem 35rem at 100% 110%, rgba(51,85,216,.35), transparent 55%),
    linear-gradient(160deg, #171f52 0%, var(--azul-escuro) 55%, #232e78 100%);
}
.auth-card { width: min(100%, 26rem); border-radius: 1.1rem; box-shadow: 0 20px 60px rgba(10, 14, 40, .35); }
.auth-brand { font-size: 2.4rem; color: var(--azul-vivo); }
.auth-title { color: var(--azul-escuro); font-weight: 800; letter-spacing: -.02em; }
.auth-submit { background: var(--azul-vivo); border: none; box-shadow: 0 4px 14px rgba(51, 85, 216, .32); }
.ajuda-busca { position: relative; max-width: 42rem; }
.ajuda-busca > i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--texto-suave); }
.ajuda-busca input { padding-left: 2.6rem; border-radius: 2rem; border-color: var(--borda); }
.ajuda-busca input:focus { border-color: var(--azul-vivo); box-shadow: 0 0 0 .2rem rgba(51,85,216,.15); }
.ajuda-toc { display: flex; flex-wrap: wrap; gap: .5rem; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem; }
.ajuda-toc a { font-size: .82rem; font-weight: 600; color: var(--azul-vivo); background: #eef1fb; padding: .35rem .75rem; border-radius: 2rem; text-decoration: none; transition: background .12s; }
.ajuda-toc a:hover { background: var(--azul-vivo); color: #fff; }
.ajuda-secao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra-card); padding: 1.5rem 1.75rem; margin-bottom: 1rem; scroll-margin-top: 1rem; }
.ajuda-secao h2 { font-size: 1.15rem; font-weight: 700; color: var(--azul-escuro); margin-bottom: .7rem; }
.ajuda-secao h3 { font-size: .95rem; font-weight: 700; color: var(--azul-escuro); margin: 1.1rem 0 .5rem; }
.ajuda-secao p, .ajuda-secao li { color: #333c5c; line-height: 1.55; }
.ajuda-secao code { background: #eef1fb; color: var(--azul-vivo); padding: .1rem .4rem; border-radius: .3rem; font-size: .85em; }
.rodape-marca { text-align: center; font-size: .76rem; color: var(--texto-suave); padding: 1.5rem 0 .5rem; opacity: .85; }
.rodape-marca strong { color: inherit; font-weight: 700; }
.rodape-marca--auth { color: rgba(255,255,255,.55); }
.rodape-marca--auth strong { color: rgba(255,255,255,.85); }

.portal-public { background: var(--fundo); }
.portal-public .container { width: min(100% - 2rem, 1140px); }

@media (max-width: 1199.98px) {
  .sidebar { width: 248px; }
  .conteudo { padding: 1.5rem !important; }
}

@media (max-width: 991.98px) {
  /* Menu lateral fica sempre visível (sem botão de abrir/fechar) — só um atalho
     de Sair flutuante, direto, sem menu escondido pra confundir. */
  .quick-logout { display: inline-flex; position: fixed; z-index: 1035; top: .75rem; left: .75rem; min-height: 2.75rem; min-width: 2.75rem; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
  .sidebar { width: min(82vw, 20rem); position: fixed; inset: 0 auto 0 0; box-shadow: 8px 0 24px rgba(0,0,0,.22); }
  .conteudo { padding: 4.25rem 1rem 1.25rem !important; margin-left: min(82vw, 20rem); width: calc(100% - min(82vw, 20rem)); }
  .sidebar-scroll { max-height: none; }
  .modal-dialog { width: calc(100% - 1rem); max-width: none; margin: .5rem auto; }
  .modal-content { max-height: calc(100dvh - 1rem); }
  .modal-body { overflow-y: auto; }
}

@media (max-width: 767.98px) {
  body { font-size: .93rem; }
  .conteudo { padding-inline: .75rem !important; }
  .card { border-radius: .55rem; }
  .card-header, .card-body { padding: .9rem; }
  .card-body.p-0 { padding: 0; }
  .table-scroll > .table, .table-responsive > .table { min-width: 560px; }
  .table th { font-size: .7rem; }
  .table td { font-size: .84rem; }
  .btn:not(.btn-sm) { width: 100%; }
  .btn-group, .btn-group .btn { width: 100%; }
  .btn-group { display: grid; grid-template-columns: 1fr 1fr; }
  .d-flex.gap-2:not(.sidebar *) { gap: .5rem !important; }
  .conteudo form.d-flex:not(.d-inline) { flex-wrap: wrap; }
  .conteudo form.d-flex:not(.d-inline) > .form-control,
  .conteudo form.d-flex:not(.d-inline) > .form-select { flex: 1 1 100%; max-width: none !important; }
  .conteudo form.d-flex:not(.d-inline) > .btn { flex: 1 1 100%; }
  .modal-footer { gap: .5rem; }
  .modal-footer .btn { flex: 1 1 100%; }
  .chat-caixa { height: 50dvh; }
  .msg-usuario, .msg-bot { max-width: 92%; }
  .portal-public .container { width: min(100% - 1rem, 1140px); }
}

@media (max-width: 479.98px) {
  .conteudo { padding-inline: .5rem !important; }
  h1.pagina { font-size: 1.22rem; }
  .card-header, .card-body { padding: .75rem; }
  .table-scroll > .table, .table-responsive > .table { min-width: 520px; }
  .auth-page { padding: .75rem; }
  .auth-card .card-body { padding: 1.25rem !important; }
  .modal-header, .modal-body, .modal-footer { padding: .85rem; }
}
