/* =========================================================
   Consult Juris - Design system
   Paleta derivada da marca (azul petroleo + grafite), tipografia
   Inter (UI) + Lora (titulos, para um ar mais "editorial/juridico").
   Carregar DEPOIS do bootstrap.min.css: as variaveis abaixo
   sobrescrevem as do Bootstrap 5.3 via cascata.
   ========================================================= */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;

  --ink: #1b2027;
  --ink-soft: #4a5568;
  --muted: #6b7280;
  --surface: #ffffff;
  --bg: #f7f8fa;
  --border: #e6e8ec;

  /* Tinta profunda no lugar do azul-SaaS generico: e a cor de marca
     (botoes, links, foco, estado ativo). Nada de azul vivo dominando a tela. */
  --primary: #16213e;
  --primary-rgb: 22, 33, 62;
  --primary-dark: #0b1220;
  --primary-soft: rgba(22, 33, 62, .06);

  --radius-btn: .5rem;

  /* Dourado: reservado como detalhe pontual de marca, nao mais uma cor funcional
     usada em navbar/bordas/estados. */
  --gold: #b8863b;
  --gold-dark: #8f6526;

  --ok: #2f7a4d;
  --ok-soft: #e6f2ea;
  --warn: #a86616;
  --warn-soft: #faf0e1;
  --off: #6b7280;
  --off-soft: #eef0f2;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 10px 28px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .12);

  /* Sobrescreve tokens do Bootstrap 5.3 (cascata: este arquivo carrega por ultimo) */
  --bs-body-font-family: var(--font-sans);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-primary: var(--primary);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: var(--primary-rgb);
  --bs-link-hover-color: var(--primary-dark);
  --bs-focus-ring-color: rgba(var(--primary-rgb), .25);
  --bs-border-radius-sm: .625rem;
  --bs-border-radius: 1rem;
  --bs-border-radius-lg: 1.25rem;
  --bs-border-radius-xl: 1.5rem;
}

html, body {
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: .975rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Titulos com toque editorial/juridico, sem tocar em cada pagina:
   cobre H1-H3 soltos e os titulos que ja vivem dentro de .card-body
   (padrao usado em praticamente toda tela do sistema). */
h1, h2, h3, h4, h5, h6,
.card-title,
.card-header,
.modal-title {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}

a { text-decoration-thickness: 1px; }

/* =========================================================
   Layout / espacamento geral
   ========================================================= */
.app-content {
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
  padding-block: clamp(1.25rem, 3vw, 2.25rem);
}

.no-auth-main {
  min-height: 100vh;
}

.no-auth-main .alert {
  margin: 1rem 1rem 0;
}

/* =========================================================
   Tela de login (split screen)
   ========================================================= */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
}

.auth-brand {
  flex: 1 1 460px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: linear-gradient(155deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: clamp(2.5rem, 6vw, 5rem);
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.auth-brand::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  right: -180px;
  bottom: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .08), transparent 70%);
  pointer-events: none;
}

.auth-brand-inner {
  position: relative;
  max-width: 440px;
  color: #fff;
}

.auth-brand-logo {
  height: 34px;
  width: auto;
  display: block;
  margin-bottom: 2.25rem;
}

.auth-brand-inner h1 {
  font-family: var(--font-serif);
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.25;
  margin-bottom: .9rem;
  letter-spacing: -.01em;
}

.auth-brand-inner .lead {
  color: rgba(255, 255, 255, .78);
  font-size: .98rem;
  line-height: 1.6;
  margin-bottom: 2.25rem;
}

.auth-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: #fff;
  border-left: 3px solid var(--gold);
  padding-left: 1.1rem;
  margin: 0;
}

.auth-form-side {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 3rem);
  background: var(--bg);
}

.auth-form-card {
  width: 100%;
  max-width: 380px;
}

.auth-form-card h2 {
  margin-bottom: .35rem;
}

.auth-form-card .lead {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: .92rem;
}

@media (max-width: 860px) {
  .auth-brand-inner .lead,
  .auth-tagline {
    display: none;
  }

  .auth-brand {
    flex: none;
    padding: 2rem 1.5rem;
  }

  .auth-logo-badge {
    margin-bottom: 1rem;
  }

  .auth-form-side {
    flex: none;
  }
}

.nav-inner {
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
}

.card-body {
  padding: 1.5rem;
}

.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* Botoes com radius proprio, menor que o dos cards: contraste deliberado
   (cards/badges = acolhedores e arredondados; botoes = precisos, "de acao"). */
.btn {
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .045em;
  padding: .62rem 1.15rem;
  border-radius: var(--radius-btn);
  border-width: 1.5px;
}

.btn-sm {
  padding: .38rem .75rem;
  font-size: .7rem;
  border-radius: calc(var(--radius-btn) - .1rem);
}

.btn-link {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: .875rem;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(11, 18, 32, .35);
}

/* Degrade sutil (gloss) sobre qualquer botao solido, sem depender da cor de base:
   fica por cima do background-color de cada variante (primary/success). */
.btn-primary, .btn-success {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, .1) 100%);
  background-blend-mode: overlay;
}

.btn-primary:hover, .btn-primary:active,
.btn-success:hover, .btn-success:active {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, .16) 100%);
}

.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-bg: var(--ink);
  --bs-btn-hover-border-color: var(--ink);
  --bs-btn-hover-color: #fff;
}

.btn-outline-danger {
  --bs-btn-border-color: #c0392b;
}

.badge { border-radius: 999px; font-weight: 500; }

.status-badge {
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .78rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}

.status-badge.status-ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(47, 122, 77, .2); }
.status-badge.status-warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(168, 102, 22, .2); }
.status-badge.status-off { color: var(--off); background: var(--off-soft); border-color: rgba(107, 114, 128, .2); }
.status-badge.status-danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(179, 38, 30, .2); }

.table > :not(caption) > * > * {
  padding-top: .7rem;
  padding-bottom: .7rem;
}

/* =========================================================
   Dashboard (hero de boas-vindas)
   ========================================================= */
.dash-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  color: #fff;
}

.dash-hero h2, .dash-hero .text-muted {
  color: #fff !important;
}

.dash-hero .text-muted {
  opacity: .78;
}

.dash-hero-icon {
  width: 46px;
  height: 46px;
  border-radius: .8rem;
  background: rgba(255, 255, 255, .12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--gold);
  flex: none;
}

/* =========================================================
   Cards de estatistica (KPI)
   ========================================================= */
.stat-card {
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
}

.stat-icon.icon-info { background: var(--primary-soft); color: var(--primary); }
.stat-icon.icon-ok { background: var(--ok-soft); color: var(--ok); }
.stat-icon.icon-warn { background: var(--warn-soft); color: var(--warn); }

.stat-card .stat-value {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: .82rem;
  margin-top: .3rem;
}

/* So aparece quando o numero realmente pede atencao (evita alarme falso em zero) */
.stat-card.is-alert {
  border-color: rgba(168, 102, 22, .3);
}

.stat-card.is-alert::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--warn);
}

/* =========================================================
   Estado vazio
   ========================================================= */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state-icon {
  font-size: 2.75rem;
  color: var(--border);
  margin-bottom: 1rem;
  display: block;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.empty-state .btn + .btn {
  margin-left: .5rem;
}

/* =========================================================
   Lista em "linhas-cartao" (substitui tabela densa em listagens)
   ========================================================= */
.list-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem .25rem;
}

.list-row + .list-row {
  border-top: 1px solid var(--border);
}

.list-row .lr-title {
  font-weight: 600;
  color: var(--ink);
}

.list-row .lr-sub {
  color: var(--muted);
  font-size: .84rem;
}

.list-pagination {
  margin-top: .5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.list-pagination .btn.disabled {
  pointer-events: none;
  opacity: .45;
}

.kebab-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--ink);
  background: #fff;
  color: var(--ink);
}

.kebab-btn:hover {
  background: var(--ink);
  color: #fff;
}

/* =========================================================
   Navbar (dark)
   ========================================================= */
.navbar-juris {
  background: linear-gradient(180deg, #1a2036 0%, #10131c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  padding-block: .6rem;
}

.nav-divider {
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: rgba(255, 255, 255, .12);
  margin: 0 .35rem;
}

.navbar-juris .navbar-brand img {
  height: 30px;
  width: auto;
  display: block;
}

.navbar-juris .navbar-toggler {
  border-color: rgba(255, 255, 255, .25);
}

.navbar-juris .navbar-toggler-icon {
  filter: invert(1);
}

.navbar-juris .nav-link {
  padding: .5rem .85rem;
  border-radius: .6rem;
  color: rgba(255, 255, 255, .62);
  font-weight: 600;
  font-size: .86rem;
  border-bottom: none;
  transition: color .15s ease, background-color .15s ease;
}

.navbar-juris .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.navbar-juris .nav-link.active {
  background: rgba(184, 134, 59, .16);
  color: var(--gold);
  font-weight: 700;
}

.navbar-juris .nav-link.active:hover {
  background: rgba(184, 134, 59, .22);
  color: var(--gold);
}

.navbar-juris .dropdown-toggle::after {
  opacity: .55;
}

.dropdown-menu {
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.modal-content {
  background-color: var(--surface);
}

.navbar-juris .meta-chip {
  font-size: .78rem;
  padding: .4rem .75rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .65rem;
  color: rgba(255, 255, 255, .78);
  background: rgba(255, 255, 255, .04);
}

.navbar-juris .meta-chip i {
  color: var(--gold);
}

.navbar-juris .meta-chip.meta-chip-office {
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

.navbar-juris .btn-logout {
  padding: .36rem .8rem;
}

/* =========================================================
   Formularios
   ========================================================= */
.form-control, .form-select {
  border-color: var(--border);
  padding: .6rem .9rem;
  min-height: 44px;
  border-radius: .7rem;
  font-size: .93rem;
}

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

.form-control::placeholder {
  color: #9aa1ac;
}

textarea.form-control {
  padding: .7rem .85rem;
}

.form-label {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}

.form-check-input {
  border-color: #c7ccd4;
}

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

.form-check-label {
  font-size: .9rem;
  color: var(--ink-soft);
}

.card > h4:first-child, .card > h5:first-child, .card > h6:first-child {
  padding-bottom: .85rem;
  margin-bottom: 1.1rem !important;
  border-bottom: 1px solid var(--border);
}

/* =========================================================
   DataTables (Bootstrap 5) - visual clean
   ========================================================= */
.dataTables_wrapper {
  --dt-gap: .75rem;
  font-size: .95rem;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin: 0;
  padding: 0;
}

.dataTables_wrapper .row.dt-row:first-child {
  padding-bottom: .9rem;
  margin-bottom: .9rem;
  border-bottom: 1px solid var(--border);
}

.dataTables_wrapper .row.dt-row:last-child {
  padding-top: .9rem;
  margin-top: .9rem;
  border-top: 1px solid var(--border);
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.dataTables_wrapper select,
.dataTables_wrapper input[type="search"] {
  height: 36px;
  border-radius: .6rem !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

.dataTables_wrapper input[type="search"] {
  min-width: 220px;
}

table.dataTable {
  border-collapse: separate !important;
  border-spacing: 0;
}

table.dataTable thead th {
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}

table.dataTable tbody td {
  vertical-align: middle;
}

table.dataTable.table-hover tbody tr:hover {
  background-color: var(--primary-soft);
}

.dataTables_wrapper .pagination {
  margin: 0;
  gap: .35rem;
}

.dataTables_wrapper .page-link {
  border-radius: .6rem !important;
  color: var(--primary);
}

.dataTables_wrapper .page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dataTables_wrapper .dataTables_info {
  color: var(--muted);
  font-size: .9rem;
}

/* =========================================================
   FAQ (accordion)
   ========================================================= */
.faq-item .accordion-button:not(.collapsed) {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
}

.faq-item .accordion-button:focus {
  box-shadow: none;
  border-color: var(--border);
}

.faq-item .accordion-body {
  color: var(--ink-soft);
  line-height: 1.6;
}

/* =========================================================
   Widget flutuante de ajuda
   ========================================================= */
.faq-widget {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1080;
}

.faq-widget-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(155deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}

.faq-widget-btn:hover {
  transform: translateY(-2px);
}

.faq-widget-btn.is-active {
  background: linear-gradient(155deg, var(--primary-dark) 0%, #05070c 100%);
}

.faq-widget-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(340px, calc(100vw - 3rem));
  max-height: 60vh;
  background: var(--surface);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.faq-widget-header {
  background: linear-gradient(155deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: .75rem 1rem;
  font-weight: 700;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-widget-body {
  padding: .85rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.faq-widget-results {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.faq-widget-item {
  border: 1px solid var(--border);
  border-radius: .6rem;
  overflow: hidden;
}

.faq-widget-q {
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: none;
  padding: .55rem .7rem;
  font-size: .83rem;
  font-weight: 600;
  color: var(--ink);
}

.faq-widget-q:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.faq-widget-a {
  padding: .6rem .7rem;
  font-size: .82rem;
  color: var(--ink-soft);
  line-height: 1.55;
  border-top: 1px solid var(--border);
}

.faq-widget-footer {
  padding: .6rem .85rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.faq-widget-footer a {
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
}

/* =========================================================
   Editor rico (Quill), quando presente
   ========================================================= */
.ql-toolbar.ql-snow {
  border-top-left-radius: var(--bs-border-radius);
  border-top-right-radius: var(--bs-border-radius);
}

.ql-container.ql-snow {
  border-bottom-left-radius: var(--bs-border-radius);
  border-bottom-right-radius: var(--bs-border-radius);
  min-height: 220px;
  font-family: var(--font-sans);
  font-size: 14px;
}
