/* Estilos adicionais do Licitech */

/* Dashboard cards — hover sóbrio: realce de borda, sem deslocamento/sombra forte */
.dashboard .card {
  transition: border-color 0.15s ease;
}

.dashboard .card:hover {
  border-color: var(--licitech-primary) !important;
}

/* Dashboard executivo: trilha de macroetapas em linha única (sem wrap do 5º passo) */
.dashboard-executive .dashboard-phase-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.dashboard-executive .dashboard-phase-step {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

.dashboard-executive .dashboard-phase-step > .fa-solid {
  display: block;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.dashboard-executive .dashboard-phase-step__label {
  display: none;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 992px) {
  .dashboard-executive .dashboard-phase-step__label {
    display: block;
  }
}

/* Animações e transições */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--licitech-bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--licitech-neutral);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--licitech-primary);
}

/* Helpers */
.min-vh-80 {
  min-height: 80vh;
}

.cursor-pointer {
  cursor: pointer;
}

.help-popover {
  color: var(--bs-secondary-color);
}

.help-popover:hover,
.help-popover:focus {
  color: var(--bs-primary);
}

.help-toast-container {
  z-index: 1080;
}

.help-toast .toast-header {
  background-color: rgba(13, 110, 253, 0.1);
}

.help-toast .toast-body {
  color: var(--bs-body-color);
}

.required-indicator {
  color: var(--bs-danger);
  font-weight: 600;
  margin-left: 0.25rem;
}

/* Dashboard tabs + lazy-load skeletons */
.dashboard-tabs-row {
  border-bottom: 1px solid var(--bs-border-color);
}

.dashboard-tabs-row .dashboard-tabs {
  border-bottom: 0 !important;
  margin-bottom: -1px;
}

.dashboard-tabs {
  border-bottom: 1px solid var(--bs-border-color);
  gap: 0.25rem;
  flex-wrap: wrap;
}

.dashboard-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--bs-secondary-color);
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: 0;
  background: transparent;
}

.dashboard-tabs .nav-link:hover {
  color: var(--bs-primary);
  border-bottom-color: rgba(13, 110, 253, 0.35);
}

.dashboard-tabs .nav-link.active {
  color: var(--bs-primary);
  background: transparent;
  border-bottom-color: var(--bs-primary);
}

.dashboard-skeleton {
  animation: dashboardSkeletonFade 0.4s ease-in;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--r-card);
  background: linear-gradient(
    100deg,
    rgba(148, 163, 184, 0.12) 20%,
    rgba(148, 163, 184, 0.22) 40%,
    rgba(148, 163, 184, 0.12) 60%
  );
  background-size: 200% 100%;
  animation: dashboardSkeletonShimmer 1.4s ease-in-out infinite;
}

.skeleton-card-lg {
  height: 220px;
}

@keyframes dashboardSkeletonShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes dashboardSkeletonFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Navegação principal */
.utility-navbar {
  border-bottom: 1px solid var(--navbar-border);
  padding: 0.2rem 0 !important;
}

.main-navbar {
  padding: 0.2rem 0 !important;
}

.utility-navbar .brand-mark {
  font-size: 0.95rem;
}

.utility-actions {
  gap: 0.35rem !important;
}

.utility-actions .btn {
  border-radius: var(--r-ctl-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.utility-actions .btn.btn-outline-secondary {
  border-color: var(--navbar-border);
  color: var(--navbar-text);
}

.utility-actions .btn.btn-outline-secondary:hover,
.utility-actions .btn.btn-outline-secondary:focus {
  color: var(--navbar-hover);
  border-color: var(--navbar-hover);
  background-color: rgba(30, 58, 138, 0.08);
}

.utility-actions .badge {
  font-size: 0.7rem;
  padding: 0.25em 0.55em;
}

.utility-actions .theme-toggle {
  width: 30px;
  height: 30px;
  padding: 0.2rem;
  border-radius: var(--r-ctl-sm);
}

.utility-actions .theme-toggle i {
  font-size: 0.9rem;
}

.utility-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-ctl-sm);
  background: transparent;
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.45);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.utility-whatsapp:hover,
.utility-whatsapp:focus {
  background: rgba(37, 211, 102, 0.12);
  color: #1eb855;
  border-color: #1eb855;
  text-decoration: none;
}

.utility-whatsapp i {
  font-size: 0.95rem;
}

@media (max-width: 991.98px) {
  .utility-whatsapp-label {
    display: none;
  }
  .utility-whatsapp {
    padding: 0.25rem 0.45rem;
  }
}

.navbar-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-ctl);
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  background-color: rgba(30, 58, 138, 0.08);
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.12);
}

.nav-link-text {
  display: inline-flex;
  align-items: center;
}

.mega-menu .dropdown-menu {
  width: min(720px, calc(100vw - 2rem));
  border-radius: var(--r-modal);
  background: var(--licitech-bg-secondary);
  border: 1px solid var(--navbar-border);
}

.mega-menu-panel {
  padding: 1rem;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.mega-menu-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mega-menu-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--r-ctl);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

.mega-menu-item.active {
  background-color: rgba(30, 58, 138, 0.12);
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.25);
}

.mega-menu-item:hover {
  background-color: rgba(30, 58, 138, 0.08);
}

.mega-menu-item.active .mega-menu-icon {
  box-shadow: inset 0 0 0 1px currentColor;
}

.mega-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.mega-menu-label {
  font-weight: 600;
  display: block;
}

.mega-menu-copy small {
  font-size: 0.75rem;
  line-height: 1.3;
}

@media (max-width: 991.98px) {
  .utility-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .main-navbar .navbar-nav {
    padding-top: 0.25rem;
  }

  .navbar-nav .nav-link {
    width: 100%;
    border-radius: var(--r-ctl);
  }

  .mega-menu .dropdown-menu {
    position: static;
    box-shadow: none !important;
    border-radius: var(--r-modal);
    margin-top: 0.5rem;
  }

  .mega-menu-panel {
    padding: 1rem;
  }

  .mega-menu-grid {
    grid-template-columns: 1fr;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* Minimal shell (tela de login) — apenas theme toggle e WhatsApp flutuantes */
.minimal-shell-actions {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 1050;
}

.minimal-shell-actions .minimal-shell-theme {
  width: 36px;
  height: 36px;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.minimal-shell-actions .minimal-shell-theme:hover {
  opacity: 1;
}

.minimal-shell-whatsapp {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
  transition: background 0.2s ease;
}

.minimal-shell-whatsapp:hover,
.minimal-shell-whatsapp:focus {
  background: #1ebe5d;
  color: #fff;
}

/* Utilitários UI (consumidos pelas ondas 2+) */
.min-w-0 {
  min-width: 0;
}

.flex-icon {
  flex-shrink: 0;
}

.text-clamp-2,
.text-clamp-3,
.text-clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.text-clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.text-clamp-3 {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.text-clamp-4 {
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

/* Tabela do acervo PNCP — usa colgroup pra distribuir as larguras e
   liberar espaço pro Objeto. Sem table-layout:fixed o navegador volta
   ao auto-sizing e ignora os widths das col. */
.table-compras-pncp {
  table-layout: fixed;
}

.table-compras-pncp td,
.table-compras-pncp th {
  vertical-align: top;
}

.table-compras-pncp .row-link {
  color: inherit;
  text-decoration: none;
}

.table-compras-pncp .row-link:hover,
.table-compras-pncp .row-link:focus {
  color: var(--licitech-primary, #177dff);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pncp-docs-overview {
  padding: 0.85rem;
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0))
    ,
    var(--licitech-bg-tertiary);
}

.pncp-docs-overview__chip {
  width: 38px;
  height: 38px;
  font-size: 1rem;
  border-radius: var(--r-ctl);
}

.pncp-docs-overview__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.pncp-docs-stat {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-card);
  background: var(--card-bg);
}

.pncp-docs-stat__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-ctl);
  font-size: 1rem;
}

.pncp-docs-stat__value {
  font-size: 1.25rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--licitech-text);
}

.pncp-docs-stat__label {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--licitech-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pncp-docs-stat__meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--licitech-text-muted);
}

.pncp-docs-table th,
.pncp-docs-table td {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  vertical-align: top;
}

.pncp-docs-cell-title {
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--licitech-text);
}

.pncp-docs-cell-subtitle {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--licitech-text-muted);
}

.pncp-docs-cell-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
}

.pncp-docs-actions {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .pncp-docs-overview__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .pncp-docs-overview {
    padding: 0.85rem;
  }

  .pncp-docs-overview__grid {
    grid-template-columns: 1fr;
  }

  .pncp-docs-actions {
    justify-content: flex-start !important;
  }
}

/* Tabelas dentro de .table-responsive ganham scroll horizontal real em mobile
   (< md). Sem isso, Bootstrap comprime colunas e quebra palavras, truncando
   valores como "EDIT-2026-0001" em 3 linhas. Em >= md o default Bootstrap
   volta, já que a tabela cabe no container. */
@media (max-width: 767.98px) {
  .table-responsive > .table,
  .table-responsive > table {
    white-space: nowrap;
  }
  .table-responsive > .table td.wrap,
  .table-responsive > table td.wrap,
  .table-responsive > .table th.wrap,
  .table-responsive > table th.wrap {
    white-space: normal;
  }
}

/* ================================================
   Workspace persistente — shell React + módulos EJS isolados
   ================================================ */
.workspace-root {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--licitech-text);
  background: var(--licitech-bg);
}

.workspace-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 100vh;
  color: var(--licitech-text-muted);
  background: var(--licitech-bg);
}

.workspace-sidebar {
  z-index: 1040;
  display: flex;
  flex: 0 0 var(--licitech-sidebar-width);
  flex-direction: column;
  width: var(--licitech-sidebar-width);
  min-width: 0;
  height: 100%;
  color: var(--licitech-sidebar-item-ink);
  background: var(--licitech-sidebar-bg);
  border-right: 1px solid var(--licitech-sidebar-border);
}

.workspace-sidebar-brand {
  display: flex;
  flex: 0 0 54px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  color: var(--licitech-text);
  border-bottom: 1px solid var(--licitech-sidebar-border);
}

.workspace-sidebar-brand .brand-logo {
  display: inline-grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
}

.workspace-sidebar-close {
  width: 32px;
  height: 32px;
  margin-left: auto;
  color: var(--licitech-sidebar-item-ink);
  background: transparent;
  border: 0;
  border-radius: var(--r-ctl);
}

.workspace-sidebar-close:hover,
.workspace-sidebar-close:focus-visible {
  color: var(--licitech-sidebar-item-hover-ink);
  background: var(--licitech-sidebar-item-hover-bg);
}

.workspace-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.workspace-sidebar-group {
  margin: 0 0 0.6rem;
}

.workspace-sidebar-group-title {
  margin: 0.55rem 0.55rem 0.25rem;
  color: var(--licitech-sidebar-group-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workspace-sidebar-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  gap: 0.65rem;
  padding: 0.4rem 0.6rem;
  color: var(--licitech-sidebar-item-ink);
  font-size: 0.82rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-ctl);
}

.workspace-sidebar-item i {
  width: 1.1rem;
  color: inherit;
  text-align: center;
}

.workspace-sidebar-item:hover,
.workspace-sidebar-item:focus-visible {
  color: var(--licitech-sidebar-item-hover-ink);
  background: var(--licitech-sidebar-item-hover-bg);
}

.workspace-sidebar-item.active {
  color: var(--licitech-sidebar-item-active-ink);
  background: var(--licitech-sidebar-item-active-bg);
}

.workspace-sidebar-backdrop {
  position: fixed;
  z-index: 1035;
  inset: 0;
  background: color-mix(in srgb, var(--licitech-text) 45%, transparent);
  border: 0;
}

.workspace-stage {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.workspace-topbar {
  z-index: 20;
  display: flex;
  flex: 0 0 54px;
  align-items: center;
  min-width: 0;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  color: var(--licitech-topbar-ink);
  background: var(--licitech-topbar-bg);
  border-bottom: 1px solid var(--licitech-border);
}

.workspace-topbar-secondary {
  color: color-mix(in srgb, var(--licitech-topbar-ink) 72%, transparent);
}

.workspace-user-link {
  display: inline-flex;
  align-items: center;
  max-width: 14rem;
  min-width: 32px;
  min-height: 32px;
  gap: 0.45rem;
  padding: 0.2rem 0.4rem;
  color: var(--licitech-topbar-ink);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--licitech-topbar-ink) 45%, transparent);
  border-radius: var(--r-ctl);
}

.workspace-user-link:hover,
.workspace-user-link:focus-visible {
  background: color-mix(in srgb, var(--licitech-topbar-ink) 12%, transparent);
}

.workspace-avatar {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  object-fit: cover;
  border-radius: 50%;
}

.workspace-avatar--fallback {
  color: var(--licitech-primary-ink);
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--licitech-primary);
}

.workspace-tabbar {
  display: flex;
  flex: 0 0 40px;
  align-items: stretch;
  min-width: 0;
  padding: 0.3rem 0.4rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--licitech-bg-secondary);
  border-bottom: 1px solid var(--licitech-border);
  scrollbar-width: thin;
}

.workspace-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-width: 8rem;
  max-width: 15rem;
  height: 35px;
  margin-right: 0.25rem;
  color: var(--licitech-text-muted);
  background: var(--licitech-bg-tertiary);
  border: 1px solid var(--licitech-border);
  border-bottom: 0;
  border-radius: var(--r-ctl-sm);
}

.workspace-tab:hover,
.workspace-tab:focus-within {
  color: var(--licitech-text);
  border-color: var(--licitech-border);
}

.workspace-tab.active {
  color: var(--licitech-primary);
  background: var(--licitech-bg);
  border-color: var(--licitech-border);
}

.workspace-tab--dashboard {
  justify-content: center;
  min-width: 7.4rem;
  gap: 0.4rem;
  padding: 0 0.65rem;
}

.workspace-tab-select {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  height: 100%;
  gap: 0.4rem;
  padding: 0 0.35rem 0 0.65rem;
  color: inherit;
  background: transparent;
  border: 0;
}

.workspace-tab-close {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-right: 0.2rem;
  place-items: center;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--r-ctl-sm);
}

.workspace-tab-close:hover,
.workspace-tab-close:focus-visible {
  color: var(--bs-danger);
  background: var(--bs-danger-bg-subtle);
}

.workspace-dirty-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  background: var(--bs-warning);
  border-radius: 50%;
}

.workspace-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--licitech-bg);
}

.workspace-frame {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--licitech-bg);
  border: 0;
}

.workspace-frame[hidden] {
  display: none;
}

.workspace-operation-error {
  z-index: 30;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  border-right: 0;
  border-left: 0;
  border-radius: var(--r-ctl);
}

html.workspace-embedded-frame body > header,
html.workspace-embedded-frame body > .minimal-shell-actions {
  display: none !important;
}

html.workspace-embedded-frame body .licitech-main {
  width: 100%;
  margin-left: 0 !important;
}

@media (max-width: 991.98px) {
  .workspace-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  .workspace-sidebar.is-open {
    transform: translateX(0);
  }

  .workspace-tab {
    max-width: 11rem;
  }
}

@media (max-width: 575.98px) {
  .workspace-sidebar-close,
  .workspace-sidebar-item {
    min-height: 44px;
  }

  .workspace-sidebar-close {
    width: 44px;
    height: 44px;
  }

  .workspace-topbar {
    flex-basis: 60px;
    gap: 0.35rem;
    padding-inline: 0.5rem;
  }

  .workspace-topbar .btn-sm,
  .workspace-user-link {
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .workspace-user-link {
    max-width: 44px;
    padding: 0;
  }

  .workspace-tabbar {
    flex-basis: 50px;
  }

  .workspace-tab,
  .workspace-tab-select {
    height: 44px;
  }

  .workspace-tab-close {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-sidebar {
    transition: none;
  }
}

@media (max-width: 767.98px) {
  .table-responsive > .pncp-docs-table {
    white-space: normal;
  }

  .pncp-docs-table thead {
    display: none;
  }

  .pncp-docs-table,
  .pncp-docs-table tbody,
  .pncp-docs-table tr,
  .pncp-docs-table td {
    display: block;
    width: 100%;
  }

  .pncp-docs-table tbody tr {
    padding: 0.9rem 0;
    border-top: 1px solid var(--licitech-border);
  }

  .pncp-docs-table tbody tr:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .pncp-docs-table td {
    padding: 0.35rem 0;
    border: 0;
  }

  .pncp-docs-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--licitech-text-muted);
  }

  .pncp-docs-table td.text-end {
    text-align: left !important;
  }

  .pncp-docs-table .pncp-docs-actions {
    justify-content: flex-start !important;
  }
}

/* Chip colorido com ink explícito (categoria de risco, eixo PCA etc.) */
.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-badge);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  background: var(--chip-bg, var(--licitech-chip-bg));
  color: var(--chip-ink, var(--licitech-chip-ink));
}

/* ================================================
   Shell autenticado — sidebar + topbar slim (paleta Campanha)
   ================================================ */

:root {
  --licitech-sidebar-width: 240px;
}

.licitech-sidebar {
  background: var(--licitech-sidebar-bg);
  border-right: 1px solid var(--licitech-sidebar-border);
  width: var(--licitech-sidebar-width);
  max-width: 100%;
}

@media (min-width: 992px) {
  .licitech-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    display: flex !important;
    flex-direction: column;
    transform: none !important;
    visibility: visible !important;
  }

  .licitech-topbar-slim {
    margin-left: var(--licitech-sidebar-width);
    /* margin-left sozinho com width:auto estoura o documento (100% + sidebar) */
    width: calc(100% - var(--licitech-sidebar-width));
    max-width: calc(100% - var(--licitech-sidebar-width));
  }

  .licitech-main {
    margin-left: var(--licitech-sidebar-width);
  }
}

.licitech-sidebar .offcanvas-body {
  overflow: hidden;
}

.licitech-sidebar-header {
  height: 56px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--licitech-sidebar-border);
  flex-shrink: 0;
}

.licitech-sidebar-header .brand-logo {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

.licitech-sidebar-nav {
  overflow-y: auto;
  padding: 0.5rem 0 0.75rem;
  flex: 1 1 auto;
}

.licitech-sidebar-group {
  padding: 0.75rem 0 0.25rem;
}

.licitech-sidebar-group:first-child {
  padding-top: 0.5rem;
}

.licitech-sidebar-group-title {
  margin: 0 0 0.35rem;
  padding: 0 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--licitech-sidebar-group-ink);
}

.licitech-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem 0.45rem 0.875rem;
  color: var(--licitech-sidebar-item-ink);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.25;
  border-left: 3px solid transparent;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.licitech-sidebar-item:hover,
.licitech-sidebar-item:focus-visible {
  background: var(--licitech-sidebar-item-hover-bg);
  color: var(--licitech-sidebar-item-hover-ink);
  outline: none;
}

.licitech-sidebar-item.active {
  background: var(--licitech-sidebar-item-active-bg);
  color: var(--licitech-sidebar-item-active-ink);
  border-left-color: var(--licitech-primary);
  font-weight: 600;
}

.licitech-sidebar-item.nav-alert-warning {
  border-left-color: var(--bs-warning);
}

.licitech-sidebar-item.nav-alert-warning .licitech-sidebar-item-icon {
  color: var(--bs-warning);
}

.licitech-sidebar-item.nav-alert-danger {
  border-left-color: var(--bs-danger);
}

.licitech-sidebar-item.nav-alert-danger .licitech-sidebar-item-icon {
  color: var(--bs-danger);
}

.licitech-sidebar-item-icon {
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  color: inherit;
}

.licitech-sidebar-item-label {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.licitech-nav-stats {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.licitech-nav-stats .badge {
  min-width: 1.85rem;
  padding-inline: 0.45rem;
  font-size: 0.68rem;
}

.licitech-sidebar-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--licitech-sidebar-border);
  color: var(--licitech-sidebar-group-ink);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* Topbar slim */
.licitech-topbar-slim {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--licitech-bg-secondary);
  border-bottom: 1px solid var(--licitech-border);
  min-height: 56px;
  min-width: 0;
  box-sizing: border-box;
}

.licitech-topbar-menu-btn {
  border: 1px solid var(--licitech-border);
  background: transparent;
  color: var(--licitech-text);
  border-radius: var(--r-ctl);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.licitech-topbar-menu-btn:hover {
  background: var(--licitech-bg-tertiary);
  color: var(--licitech-primary);
}

.licitech-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--licitech-primary);
  text-decoration: none;
  font-size: 1rem;
}

.licitech-topbar-brand .brand-logo {
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
}

.licitech-topbar-actions {
  gap: 0.35rem !important;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.licitech-topbar-actions > .dropdown,
.licitech-topbar-actions > .licitech-user-menu {
  flex-shrink: 0;
  min-width: 0;
}

/* Nome da org / usuário: truncam em vez de empurrar o documento */
.licitech-org-name {
  max-width: 9rem;
}

.licitech-user-name {
  max-width: 8rem;
}

@media (min-width: 1600px) {
  .licitech-org-name {
    max-width: 14rem;
  }

  .licitech-user-name {
    max-width: 12rem;
  }
}

/* Chip de geo: tipografia e truncagem sem inline style */
.licitech-geo-chip {
  font-family: var(--bs-font-sans-serif);
  font-size: 0.7rem;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Uniformiza a altura dos controles da topbar (org, sino, foguete, lua, usuário) */
.licitech-topbar-btn {
  height: 36px;
  min-height: 36px;
  padding: 0 0.65rem;
  font-size: 0.8125rem;
  line-height: 1;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.licitech-topbar-btn-icon {
  width: 36px;
  padding: 0;
}

/* Força os theme-toggle da topbar a casarem com os demais botões */
.licitech-topbar-actions .theme-toggle.licitech-topbar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
}

.licitech-topbar-actions .theme-toggle.licitech-topbar-btn i {
  font-size: 1rem;
}

.licitech-user-menu .dropdown-menu {
  max-height: calc(100vh - 4rem);
  min-width: 17rem;
  overflow-y: auto;
}

.licitech-user-menu > .dropdown-toggle::after {
  transition: transform 0.12s ease;
}

.licitech-user-menu > .dropdown-toggle.show::after {
  transform: rotate(180deg);
}

/* Avatar reutilizável (topbar, seletor multi-conta, /perfil): foto circular com
   fallback de iniciais. Fundo azul escuro acessível (contraste AA com branco em
   ambos os temas, já que o chip tem cor própria). */
.licitech-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--licitech-avatar-bg, #155bb5);
  color: #fff;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}
.licitech-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.licitech-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Chip com hash da versão antes do seletor de organização */
.licitech-version-chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.65rem;
  font-family:
    ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--licitech-text-muted);
  background: var(--licitech-bg-tertiary);
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-ctl-sm);
  text-transform: uppercase;
  user-select: all;
}

/* Densidade progressiva: em desktop estreito (com sidebar) prioriza ícones */
@media (max-width: 1399.98px) {
  /* versão + geo somem; ficam no foguete/changelog e no tooltip do seletor */
  .licitech-topbar-actions > .licitech-version-chip {
    display: none;
  }
}

/* Trial/expired badge também comprime o trilho */
@media (max-width: 1199.98px) {
  .licitech-topbar-actions > .badge {
    display: none !important;
  }
}

@media (max-width: 575.98px) {
  .licitech-topbar-slim {
    padding-inline: 0.5rem;
    gap: 0.35rem;
  }

  .licitech-topbar-actions {
    min-width: 0;
    gap: 0.25rem !important;
  }

  .licitech-version-chip {
    display: none;
  }

  .licitech-topbar-menu-btn,
  .licitech-topbar-brand,
  .licitech-topbar-btn,
  .licitech-topbar-btn-icon,
  .licitech-topbar-actions .theme-toggle.licitech-topbar-btn,
  #orgSelectorMenu,
  #userMenu {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .licitech-topbar-brand > .fw-bold,
  #orgSelectorMenu > span {
    display: none;
  }

  .licitech-topbar-actions [data-bs-target='#changelogModal'] {
    display: none;
  }

  #userMenu::after {
    display: none;
  }

  .dashboard-executive .btn,
  .dashboard-executive .form-control,
  .dashboard-executive .form-select,
  .dashboard-executive .input-group-text {
    min-height: 44px;
  }
}

/* Brand à esquerda no shell autenticado (desktop) */
.licitech-topbar-brand-desktop {
  height: 36px;
  padding: 0 0.25rem;
}

.licitech-main {
  padding: 0;
}

/* ================================================
   Compactação de cabeçalhos de página (padrão UI.md)
   ================================================ */

/* Reduz padding vertical das section wrappers */
section.py-4,
section.py-5 {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

/* Breadcrumb inline em vez de bloco */
nav[aria-label='breadcrumb'] {
  margin-bottom: 0.5rem !important;
}

nav[aria-label='breadcrumb'] .breadcrumb {
  margin-bottom: 0 !important;
  font-size: 0.75rem;
}

/* Título de seção — menor e com menos margin */
.section-heading {
  font-size: 1.25rem !important;
  line-height: 1.3 !important;
  margin-bottom: 0.25rem !important;
}

/* Subtítulo logo abaixo do heading (inline no fluxo mas compactado) */
.section-heading + p,
.section-heading ~ p.text-secondary,
.section-heading ~ p.text-muted {
  font-size: 0.825rem !important;
  margin-bottom: 0.5rem !important;
}

/* Badge-pill (eyebrow) mais discreto */
.badge-pill.text-uppercase {
  font-size: 0.7rem !important;
  padding: 0.25rem 0.7rem !important;
  margin-bottom: 0.35rem !important;
}

/* Wrapper do header (.d-flex com h1 dentro) reduz gap/margin */
.container-fluid > .d-flex.flex-column.flex-lg-row.mb-3,
.container-fluid > .d-flex.flex-column.flex-lg-row.mb-4 {
  margin-bottom: 0.75rem !important;
  gap: 0.5rem !important;
}

.licitech-rich-editor {
  --rich-editor-border: var(--licitech-border);
  --rich-editor-bg: var(--licitech-bg-secondary);
  --rich-editor-muted-bg: var(--licitech-bg-tertiary);
}

.licitech-rich-editor .btn-toolbar {
  align-items: center;
}

.licitech-rich-editor__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.licitech-rich-editor__meta [data-editor-status] {
  overflow-wrap: anywhere;
}

.licitech-rich-editor__toolbar > .btn-toolbar:last-child {
  margin-left: auto;
}

.licitech-rich-editor .btn.active {
  background: var(--licitech-primary);
  border-color: var(--licitech-primary);
  color: #fff;
}

.licitech-rich-editor__surface {
  border: 1px solid var(--rich-editor-border);
  border-radius: var(--r-card);
  background: var(--rich-editor-bg);
  box-shadow: var(--card-shadow);
}

.licitech-rich-editor.is-focused .licitech-rich-editor__surface {
  border-color: var(--licitech-primary);
  box-shadow: 0 0 0 0.2rem var(--licitech-primary-light);
}

.licitech-rich-editor__canvas .ProseMirror {
  min-height: 16rem;
  padding: 1rem 1rem 1.25rem;
  color: var(--licitech-text);
  background: transparent;
  outline: none;
  white-space: pre-wrap;
}

.licitech-rich-editor__canvas .ProseMirror > * + * {
  margin-top: 0.85rem;
}

.licitech-rich-editor__canvas .ProseMirror h2,
.licitech-rich-editor__canvas .ProseMirror h3 {
  color: var(--licitech-text);
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.licitech-rich-editor__canvas .ProseMirror h2 {
  font-size: 1.15rem;
}

.licitech-rich-editor__canvas .ProseMirror h3 {
  font-size: 1rem;
}

.licitech-rich-editor__canvas .ProseMirror blockquote {
  border-left: 4px solid var(--licitech-primary);
  padding-left: 0.85rem;
  color: var(--licitech-text-muted);
  margin: 0;
}

.licitech-rich-editor__canvas .ProseMirror ul,
.licitech-rich-editor__canvas .ProseMirror ol {
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.licitech-rich-editor__canvas .ProseMirror p {
  margin-bottom: 0;
}

.licitech-rich-editor__canvas .tableWrapper {
  overflow-x: auto;
  margin: 0.25rem 0;
}

.licitech-rich-editor__canvas .ProseMirror table {
  width: 100%;
  border-collapse: collapse;
  min-width: 32rem;
}

.licitech-rich-editor__canvas .ProseMirror th,
.licitech-rich-editor__canvas .ProseMirror td {
  border: 1px solid var(--licitech-border);
  padding: 0.6rem 0.75rem;
  vertical-align: top;
  background: var(--licitech-bg-secondary);
}

.licitech-rich-editor__canvas .ProseMirror th {
  background: var(--licitech-bg-tertiary);
  font-weight: 600;
}

.licitech-rich-editor__panel {
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-card);
  background: var(--rich-editor-muted-bg);
}

.licitech-rich-editor__panel summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--licitech-text);
  display: flex;
  align-items: center;
}

.licitech-rich-editor__panel summary::-webkit-details-marker {
  display: none;
}

.licitech-rich-editor__panel-body {
  padding: 0 1rem 1rem;
}

.licitech-rich-editor__messages,
.licitech-rich-editor__history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.licitech-rich-editor__messages {
  max-height: 14rem;
  overflow-y: auto;
}

.licitech-rich-editor__history {
  max-height: 24rem;
  overflow-y: auto;
}

.licitech-rich-editor__message,
.licitech-rich-editor__history-item {
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-card);
  background: var(--licitech-bg-secondary);
  padding: 0.75rem 0.85rem;
  color: var(--licitech-text);
}

.licitech-rich-editor__message.is-user {
  border-color: var(--licitech-primary);
}

.licitech-rich-editor__message.is-system {
  background: var(--licitech-bg-tertiary);
  color: var(--licitech-text-muted);
}

.licitech-rich-editor__history-details {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--licitech-border-light);
  display: grid;
  gap: 0.85rem;
}

.licitech-rich-editor__history-detail-preview,
.licitech-rich-editor__artifact-preview {
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--r-card);
  border: 1px solid var(--licitech-border);
  background: var(--licitech-bg-primary);
  color: var(--licitech-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  max-height: 14rem;
  overflow-y: auto;
}

.licitech-rich-editor [data-editor-ai-modal] .modal-content {
  min-height: 100vh;
}

.licitech-rich-editor [data-editor-ai-modal] .modal-body {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 7rem);
}

.licitech-rich-editor [data-editor-ai-modal] .tab-content {
  flex: 1 1 auto;
  min-height: 0;
}

.licitech-rich-editor [data-editor-ai-modal] .licitech-rich-editor__messages {
  flex: 1 1 auto;
  max-height: none;
  min-height: 20rem;
}

.licitech-rich-editor [data-editor-ai-modal] [data-editor-ai-prompt] {
  min-height: 9rem;
}

.licitech-rich-editor__variables {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 18rem);
  overflow-y: auto;
}

.licitech-rich-editor--workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.licitech-rich-editor__workspace-tabs {
  flex: 0 0 auto;
  margin-bottom: 0.5rem;
}

.licitech-rich-editor__workspace-tab-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.licitech-rich-editor__workspace-pane.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.licitech-rich-editor--workspace .licitech-rich-editor__surface {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.licitech-rich-editor--workspace .licitech-rich-editor__canvas {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.licitech-rich-editor--workspace .licitech-rich-editor__canvas .ProseMirror {
  flex: 1 1 auto;
  min-height: 100%;
}

.licitech-rich-editor__variable-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.licitech-rich-editor__variables--inline {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.licitech-rich-editor__variable-group {
  border: 1px solid var(--licitech-border);
  border-radius: var(--r-card);
  background: var(--licitech-bg-secondary);
  padding: 0.85rem;
}

.licitech-rich-editor__variable-item {
  border-top: 1px solid var(--licitech-border-light);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.licitech-rich-editor__variable-item:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.licitech-rich-editor__variable-preview {
  margin: 0.65rem 0 0;
  padding: 0.75rem;
  border-radius: var(--r-card);
  border: 1px solid var(--licitech-border);
  background: var(--licitech-bg-tertiary);
  color: var(--licitech-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  max-height: 11rem;
  overflow-y: auto;
}

.tor-rich-document-table .btn-group .btn,
.tor-rich-title-actions .btn {
  min-width: 2rem;
  padding-inline: 0.48rem;
}

.tor-rich-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tor-rich-title-actions .btn {
  line-height: 1;
}

.tor-rich-document-table table {
  table-layout: fixed;
  width: 100%;
  min-width: 68rem;
}

.tor-rich-document-table th,
.tor-rich-document-table td {
  overflow: hidden;
}

.tor-rich-title-col {
  width: auto;
}

.tor-rich-document-open,
.tor-rich-fragment-open {
  max-width: 100%;
}

.tor-rich-fragment-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.tor-rich-fragment-heading .tor-rich-fragment-open {
  flex: 1 1 auto;
  min-width: 0;
}

.tor-rich-fragment-heading-meta {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
  min-width: 0;
  max-width: 50%;
}

.tor-rich-fragment-path-inline {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(18rem, 100%);
}

.tor-rich-fragment-actions {
  flex: 0 0 auto;
}

.tor-rich-mini-col {
  width: 3.25rem;
  white-space: nowrap;
}

.tor-rich-pages-col {
  width: 6.75rem;
  white-space: nowrap;
}

.tor-rich-size-col {
  width: 5rem;
  white-space: nowrap;
}

.tor-rich-date-col {
  width: 6.25rem;
  white-space: nowrap;
}

.tor-rich-document-table tbody tr[data-document-row].is-expanded {
  background: var(--licitech-bg-tertiary);
}

.tor-rich-toggle-icon {
  width: 0.8rem;
  flex: 0 0 auto;
  color: var(--licitech-text-muted);
}

.tor-rich-document-type-icon {
  color: var(--licitech-text-muted);
}

.tor-rich-fragment-row td {
  background: var(--licitech-bg-secondary);
  border-top-color: var(--licitech-border-light);
}

.tor-rich-fragment-row td:first-child {
  padding-left: 2.25rem;
  border-left: 3px solid var(--licitech-border);
}

.tor-rich-document-form {
  min-height: calc(100vh - 9rem);
}

#torRichDocumentModal .modal-header {
  padding-block: 0.55rem;
}

#torRichDocumentModal .modal-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding-block: 0.75rem;
}

#torRichDocumentModal [data-rich-fragment-form] {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.tor-rich-fragment-editor-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.tor-rich-fragment-editor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 30rem);
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tor-rich-fragment-editor-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  min-width: 0;
}

.tor-rich-fragment-editor-context > span {
  min-width: 0;
}

.tor-rich-fragment-editor-context .text-truncate {
  max-width: min(34rem, 100%);
}

.tor-rich-fragment-editor-header .tor-rich-fragment-path {
  min-width: 0;
}

.tor-rich-fragment-editor-form > .licitech-rich-editor {
  flex: 1 1 auto;
  min-height: 0;
}

.tor-rich-document-type {
  min-width: 14rem;
}

.tor-rich-fragment-path {
  min-width: min(30rem, 100%);
}

.tor-rich-fragment .licitech-rich-editor__canvas .ProseMirror {
  min-height: min(52vh, 34rem);
}

.tor-rich-fragment-advanced {
  position: relative;
}

.tor-rich-fragment-advanced summary {
  list-style: none;
}

.tor-rich-fragment-advanced summary::-webkit-details-marker {
  display: none;
}

.tor-rich-fragment-advanced-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  width: min(42rem, calc(100vw - 2rem));
  box-shadow: var(--card-shadow);
}

.tor-rich-document-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--card-bg);
}

.tor-rich-preview-frame {
  /* Modal ampla (.modal-xl), não fullscreen: caixa alta e definida pro visor
     de PDF preencher sem depender de h-100 do pai. */
  height: 78vh;
  background: var(--licitech-bg-secondary);
}

@media (max-width: 575.98px) {
  .tor-rich-preview-frame {
    height: 82vh;
  }
}

@media (max-width: 991.98px) {
  .licitech-rich-editor__meta {
    justify-content: flex-start;
  }

  .licitech-rich-editor__toolbar > .btn-toolbar:last-child {
    margin-left: 0;
  }

  .licitech-rich-editor__canvas .ProseMirror {
    min-height: 14rem;
    padding: 0.85rem;
  }

  .licitech-rich-editor__canvas .ProseMirror table {
    min-width: 26rem;
  }

  .licitech-rich-editor [data-editor-ai-modal] .licitech-rich-editor__messages {
    min-height: 14rem;
  }

  .licitech-rich-editor__variables {
    max-height: none;
  }

  #torRichDocumentModal .modal-body {
    overflow-y: auto;
  }

  .tor-rich-fragment-editor-header {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .tor-rich-fragment-editor-context {
    gap: 0.25rem 0.5rem;
  }

  .tor-rich-fragment-editor-context .text-muted {
    display: none;
  }

  .tor-rich-fragment-editor-header .input-group-text {
    padding-inline: 0.45rem;
  }

  .tor-rich-fragment-advanced {
    position: static;
  }

  .tor-rich-fragment-advanced-panel {
    position: static;
    width: 100%;
    box-shadow: none;
  }

  .tor-rich-document-type {
    min-width: 100%;
  }

  .tor-rich-document-table table {
    min-width: 62rem;
  }

  .tor-rich-date-col {
    width: 5.75rem;
  }

  .tor-rich-pages-col {
    width: 5.75rem;
  }

  .tor-rich-fragment-row td:first-child {
    padding-left: 1.25rem;
  }
}

@media (max-width: 575.98px) {
  .tor-rich-fragment-heading {
    gap: 0.45rem;
  }

  .tor-rich-fragment-heading .tor-rich-fragment-open {
    flex: 0 1 auto;
  }

  .tor-rich-fragment-heading-meta {
    margin-left: 0;
    max-width: 65%;
  }

  .tor-rich-fragment-path-inline {
    max-width: 9.5rem;
  }
}

/* ================================================
   Densidade formal — área autenticada (UI.md §Densidade)
   Corpo 14px, controles e tabelas compactos. Aplica só dentro de
   .licitech-main pra não mexer em landing/login públicos.
   ================================================ */
.licitech-main {
  font-size: 0.875rem;
}

.licitech-main .btn {
  --bs-btn-font-size: 0.875rem;
}

.licitech-main .btn-sm {
  --bs-btn-font-size: 0.8125rem;
}

.licitech-main .btn-lg {
  --bs-btn-font-size: 1rem;
}

.licitech-main .form-control,
.licitech-main .form-select,
.licitech-main .input-group-text {
  font-size: 0.875rem;
}

.licitech-main .form-label {
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}

.licitech-main .card {
  --bs-card-spacer-y: 0.85rem;
  --bs-card-spacer-x: 0.85rem;
  --bs-card-cap-padding-y: 0.6rem;
}

.licitech-main .table > :not(caption) > * > * {
  padding: 0.45rem 0.5rem;
}

.licitech-main .modal-header {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

/* Secretarias/UX — abas roláveis no mobile (app-wide). Em telas estreitas, módulos
   com muitas abas (ETP, edital, etc.) transbordavam o container e quebravam feio.
   Agora a faixa de abas rola horizontalmente, com afordância de scroll fina. */
@media (max-width: 767.98px) {
  .nav-tabs,
  .nav-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .nav-tabs > .nav-item,
  .nav-pills > .nav-item,
  .nav-tabs > .nav-link,
  .nav-pills > .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-tabs::-webkit-scrollbar,
  .nav-pills::-webkit-scrollbar {
    height: 4px;
  }
}
