:root {
  --gp-border: #d9e1ea;
  --gp-text: #1f2d3d;
  --gp-primary: #2d7ecb;
  --gp-warning: #f39c12;
  --gp-secondary: #8c8c8c;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--gp-text);
}

.gp-bg {
  background: #ecf0f5;
  min-height: 100vh;
}

.gp-login-card {
  background: #fff;
  border: 1px solid var(--gp-border);
  border-radius: 8px;
  padding: 28px;
  width: min(420px, 94vw);
}

.gp-logo {
  max-width: 360px;
  width: 100%;
  height: auto;
}

.gp-input {
  height: 46px;
}

.gp-btn-primary {
  height: 46px;
}

/* -------------------------------------
 * ESTRUTURA PRINCIPAL E SIDEBAR
 * ------------------------------------- */
.gp-shell {
  display: flex;
  min-height: 100vh;
}

.gp-sidebar {
  width: 260px;
  background: #f3f7fb;
  border-right: 1px solid var(--gp-border);
}

.gp-sidebar > .p-3.border-bottom {
  /* AJUSTE MANUAL - RESPIRO LATERAL DO TOPO DO MENU:
     diminua o padding horizontal para a logo e o card do usuário ficarem mais largos. */
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.gp-brand-logo {
  /* AJUSTE MANUAL - LARGURA DA LOGO DO MENU LATERAL:
     aumente/diminua width e height para aproximar ou afastar a logo das bordas laterais. */
  width: 100%;
  max-width: 100%;
  height: 78px;
  object-fit: contain;
}

.gp-user-card {
  /* AJUSTE MANUAL - BOX DO USUÁRIO:
     mantém o bloco do usuário alinhado com a largura da logo acima. */
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  padding: 10px;
}

.gp-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gp-border);
  background: #f8fbff;
}

.gp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: var(--gp-text);
  text-decoration: none;
  border-radius: 10px;
  margin-bottom: 6px;
}

.gp-nav-item.active,
.gp-nav-item:hover {
  background: #fff;
  border: 1px solid var(--gp-border);
}

.gp-main {
  flex: 1;
  min-width: 0;
}

.gp-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8fbff;
  border-bottom: 1px solid var(--gp-border);
}

.gp-user-pill {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--gp-border);
  border-radius: 999px;
  padding: 8px 12px;
}

.gp-icon-btn {
  border: 1px solid var(--gp-border);
  background: #fff;
}

.gp-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  background: #e45757;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 6px;
}

.gp-content {
  padding: 18px;
  background: linear-gradient(180deg, #eef7ff 0%, #f7e2a5 100%);
  min-height: calc(100vh - 70px);
}

.gp-card {
  border: 1px solid var(--gp-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
}

.gp-card-title {
  font-size: 18px;
  font-weight: 700;
}

/* -------------------------------------
 * CAIXAS E BOTÕES
 * ------------------------------------- */
.gp-caixa-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
  color: var(--gp-text);
}

.gp-caixa-item.active {
  background: #3b82c4;
  color: #fff;
  border-color: #3b82c4;
}

.gp-caixa-item.active .badge {
  background: #2b6fa9 !important;
}

.gp-tool-btn {
  border: 1px solid var(--gp-border);
  background: #fff;
}


.gp-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0 8px 0 0;
}

.gp-icon-link:hover {
  opacity: 0.88;
}

.gp-action-icon {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.gp-toolbar-icons .gp-action-icon {
  width: 15px;
  height: 15px;
}

.gp-actions .gp-action-icon {
  width: 15px;
  height: 15px;
}

.text-warning {
  color: var(--gp-warning) !important;
}

.text-primary {
  color: var(--gp-primary) !important;
}

.text-secondary {
  color: var(--gp-secondary) !important;
}

/* -------------------------------------
 * TABELAS E LISTAGENS
 * ------------------------------------- */
.gp-table thead th {
  font-size: 13px;
  white-space: nowrap;
}

.gp-table tbody td {
  font-size: 13px;
}

.gp-actions {
  white-space: nowrap;
}

.gp-actions i,
.gp-actions button {
  font-size: 14px;
  margin-right: 6px;
  cursor: pointer;
}

.gp-actions .gp-icon-link i {
  margin-right: 0;
}

.user-table-scroll {
  max-height: 540px;
  overflow: auto;
}

/* -------------------------------------
 * FORMULÁRIOS E EDITOR VISUAL
 * ------------------------------------- */
.gp-card-form .form-control,
.gp-card-form .form-select {
  height: 42px;
}

.gp-card-form textarea.form-control {
  height: auto;
  min-height: 120px;
}

.gp-field-title {
  display: block;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
}

.gp-form-actions {
  border-top: 1px solid var(--gp-border);
}

.gp-editor-wrap {
  border: 1px solid var(--gp-border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.gp-editor-menu {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--gp-border);
  display: flex;
  gap: 18px;
  color: #666;
  flex-wrap: wrap;
}

.gp-editor-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gp-border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.gp-editor-btn {
  border: 1px solid var(--gp-border);
  background: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}

.gp-corpo-editor {
  min-height: 180px;
  max-height: 280px; /* evita que texto longo estique a tela; cria rolagem no editor */
  overflow-y: auto;
  padding: 12px;
  outline: none;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap; /* preserva quebras de linha digitadas/coladas */
  overflow-wrap: anywhere;
}

/* -------------------------------------
 * ANEXOS
 * ------------------------------------- */
.clickable-upload {
  cursor: pointer;
}

.gp-attachments-wrap {
  border: 1px solid var(--gp-border);
  min-height: 220px;
  border-radius: 6px;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.gp-attachment-card {
  width: 110px;
  min-height: 110px;
  padding: 12px 8px;
  border-radius: 14px;
  background: #f1f1f1;
  border: 1px solid #e4e4e4;
  text-align: center;
  position: relative;
}

.gp-attachment-x {
  color: red;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
}

.gp-attachment-size {
  font-weight: 700;
  font-size: 12px;
  margin-top: 4px;
}

/* -------------------------------------
 * MODAL DE PROCESSO
 * ------------------------------------- */
#processModal .modal-dialog {
  max-width: 1100px;
}

.gp-modal-compact {
  font-size: 12px;
}

.gp-modal-compact strong {
  font-size: 12px;
}

.gp-modal-compact .table td,
.gp-modal-compact .table th {
  padding: 0.35rem;
}

.gp-modal-corpo {
  max-height: none;
  white-space: normal;
  background-color: #f8fafc;
}

/* -------------------------------------
 * VISUALIZADOR DE AUTOS (ESTILO SEI)
 * ------------------------------------- */
.gp-viewer-container {
  display: flex;
  height: calc(100vh - 56px);
  /* Altura total menos o header do modal */
  width: 100%;
  background-color: #e9ecef;
}

/* Árvore do Processo (Lateral Esquerda) */
.gp-viewer-tree {
  width: 320px;
  background-color: #f8f9fa;
  border-right: 1px solid #ced4da;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.gp-viewer-tree-header {
  padding: 15px;
  background-color: #fff;
  border-bottom: 2px solid #0d6efd;
  font-weight: bold;
  font-size: 14px;
}

.gp-viewer-tree-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.gp-tree-item {
  padding: 8px 15px 8px 30px;
  cursor: pointer;
  border-bottom: 1px solid #f1f1f1;
  font-size: 13px;
  display: flex;
  align-items: center;
  color: #495057;
  transition: all 0.2s ease;
}

.gp-tree-item:hover {
  background-color: #e9ecef;
}

.gp-tree-item.active {
  background-color: #e7f1ff;
  color: #0d6efd;
  font-weight: 600;
  border-left: 4px solid #0d6efd;
  padding-left: 26px;
  /* Compensa a borda */
}

.gp-tree-item i {
  margin-right: 10px;
  font-size: 16px;
  width: 16px;
  text-align: center;
}

.gp-tree-item.root-node {
  padding-left: 15px;
  font-weight: bold;
  color: #212529;
  background-color: #f8f9fa;
}

/* Área de Leitura (Lateral Direita) */
.gp-viewer-reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #525659;
  /* Cor típica de fundo de leitor de PDF */
  position: relative;
}

.gp-viewer-toolbar {
  height: 40px;
  background-color: #323639;
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: white;
  justify-content: space-between;
}

.gp-viewer-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-viewer-frame {
  flex: 1;
  width: 100%;
  border: none;
  background-color: white;
}

.gp-viewer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
}


/* -------------------------------------
 * RESPONSIVIDADE
 * ------------------------------------- */
@media(max-width: 991px) {
  .gp-shell {
    display: block;
  }

  .gp-sidebar {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--gp-border);
  }

  .gp-content {
    padding: 12px;
  }

  /* Ajuste do visualizador no mobile */
  .gp-viewer-container {
    flex-direction: column;
  }

  .gp-viewer-tree {
    width: 100%;
    height: 30vh;
    border-right: none;
    border-bottom: 2px solid #dee2e6;
  }

  .gp-viewer-reader {
    height: 70vh;
    flex: none;
  }
}

/* -------------------------------------
 * ÍCONES E MODAIS DO FLUXO DE CAIXAS
 * ------------------------------------- */
.gp-tool-btn,
.gp-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.12);
  padding: 0;
  overflow: hidden;
}

.gp-tool-btn i,
.gp-icon-link i {
  color: #fff !important;
  font-size: 14px;
}

.gp-tool-btn {
  background: linear-gradient(180deg, #bfc6d4 0%, #8e96a8 100%);
}

.gp-icon-link {
  text-decoration: none;
}

.gp-tool-btn-blue,
.gp-icon-link.action-blue {
  background: linear-gradient(180deg, #2993ff 0%, #0f68cc 100%);
}

.gp-tool-btn-red,
.gp-icon-link.action-red {
  background: linear-gradient(180deg, #ff4a4a 0%, #d72828 100%);
}

.gp-tool-btn-yellow,
.gp-icon-link.action-yellow {
  background: linear-gradient(180deg, #ffd748 0%, #e5b800 100%);
}

.gp-tool-btn-green,
.gp-icon-link.action-green {
  background: linear-gradient(180deg, #5fd48d 0%, #249d58 100%);
}

.gp-tool-btn-gray,
.gp-icon-link.action-gray {
  background: linear-gradient(180deg, #bcc2cf 0%, #9199aa 100%);
}

.gp-icon-link.static-icon {
  cursor: default;
}

.gp-icon-link:hover,
.gp-tool-btn:hover {
  filter: brightness(0.97);
  opacity: 1;
}

.gp-alerta-tramite {
  background: linear-gradient(180deg, #ffffff 0%, #f3f3f3 100%);
  border-radius: 18px;
  overflow: hidden;
}

.gp-alerta-icone-wrap {
  display: flex;
  justify-content: center;
}

.gp-alerta-triangulo {
  width: 76px;
  height: 67px;
  background: #ffd322;
  border: 4px solid #323232;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.gp-alerta-triangulo i {
  color: #222;
  font-size: 30px;
  margin-top: 9px;
}

.gp-alerta-titulo {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #333;
}

.gp-alerta-subtitulo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
}

.gp-alerta-texto {
  font-size: 1rem;
  color: #333;
  line-height: 1.48;
  max-width: 620px;
  margin: 0 auto;
}

.gp-big-btn {
  min-width: 138px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 0.96rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gp-big-btn:hover {
  color: #fff;
  filter: brightness(0.98);
}

.gp-big-btn-gray {
  background: linear-gradient(180deg, #bfc6d4 0%, #8e96a8 100%);
}

.gp-big-btn-yellow {
  background: linear-gradient(180deg, #ffd748 0%, #e5b800 100%);
  color: #fff;
}

.gp-big-btn-red {
  background: linear-gradient(180deg, #ff4a4a 0%, #d72828 100%);
}

.gp-big-btn-blue {
  background: linear-gradient(180deg, #2993ff 0%, #0f68cc 100%);
}

.gp-upload-box {
  border: 1px dashed #c9ced8;
  border-radius: 8px;
  padding: 18px;
  background: #fafafa;
}

#encaminharModal .modal-dialog,
#devolverModal .modal-dialog {
  max-width: 700px;
}

#encaminharModal .modal-content,
#devolverModal .modal-content {
  border-radius: 14px;
  overflow: hidden;
}


/* -------------------------------------
 * RESPONSIVIDADE MOBILE AJUSTADA
 * ------------------------------------- */
.gp-main {
  overflow-x: hidden;
}

.gp-card,
.modal-content {
  max-width: 100%;
}

.table-responsive-mobile {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
  body.gp-sidebar-open {
    overflow: hidden;
  }

  .gp-shell {
    display: block;
    min-height: 100vh;
  }

  .gp-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    max-width: 100%;
    z-index: 1050;
    transform: translateX(-102%);
    transition: transform .28s ease;
    border-right: 1px solid var(--gp-border);
    border-bottom: none;
    overflow-y: auto;
    box-shadow: 10px 0 24px rgba(0, 0, 0, .14);
  }

  body.gp-sidebar-open .gp-sidebar {
    transform: translateX(0);
  }

  .gp-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .34);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
  }

  body.gp-sidebar-open .gp-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .gp-topbar {
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 1020;
  }

  .gp-topbar>.d-flex {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .gp-user-pill {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    border-radius: 14px;
  }

  .gp-content {
    padding: 12px;
    min-height: calc(100vh - 116px);
  }

  .gp-card {
    border-radius: 10px;
  }

  .gp-card .card-body {
    padding: 14px;
  }

  .gp-caixa-item {
    padding: 10px 12px;
  }

  .gp-tool-btn,
  .gp-icon-link {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .gp-action-icon,
  .gp-toolbar-icons .gp-action-icon,
  .gp-actions .gp-action-icon {
    width: 20px;
    height: 20px;
  }

  .gp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .gp-table,
  .gp-table thead,
  .gp-table tbody,
  .gp-table tr,
  .gp-table th,
  .gp-table td {
    white-space: nowrap;
  }

  .user-table-scroll {
    max-height: none;
    overflow: auto;
  }

  .gp-card-form .form-control,
  .gp-card-form .form-select {
    height: 44px;
    font-size: 16px;
  }

  .gp-card-form textarea.form-control,
  .gp-corpo-editor {
    min-height: 140px;
  }

  .gp-editor-menu,
  .gp-editor-toolbar {
    gap: 8px;
    padding: 8px;
  }

  .gp-editor-btn {
    min-height: 38px;
  }

  .gp-attachments-wrap {
    min-height: 150px;
    padding: 14px;
    gap: 12px;
  }

  .gp-attachment-card {
    width: 92px;
    min-height: 96px;
    border-radius: 12px;
  }

  #processModal .modal-dialog,
  #encaminharModal .modal-dialog,
  #devolverModal .modal-dialog,
  #anexosModal .modal-dialog {
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
  }

  #processModal .modal-content,
  #encaminharModal .modal-content,
  #devolverModal .modal-content,
  #anexosModal .modal-content {
    min-height: 100vh;
    border-radius: 0;
  }

  .gp-alerta-titulo {
    font-size: 1.85rem;
  }

  .gp-alerta-subtitulo {
    font-size: 1rem;
  }

  .gp-alerta-texto {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .gp-big-btn {
    width: 100%;
    min-width: 0;
    height: 48px;
  }

  .gp-viewer-container {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 56px);
  }

  .gp-viewer-tree {
    width: 100%;
    height: 34vh;
    min-height: 220px;
    border-right: none;
    border-bottom: 1px solid #ced4da;
  }

  .gp-viewer-reader {
    height: 56vh;
    min-height: 320px;
    flex: none;
  }
}

@media (max-width: 767.98px) {
  .gp-content {
    padding: 10px;
  }

  .gp-card .card-body {
    padding: 12px;
  }

  .gp-card-title {
    font-size: 16px;
  }

  .gp-topbar .gp-icon-btn {
    min-width: 40px;
    height: 40px;
  }

  .gp-topbar>.d-flex {
    gap: 8px;
  }

  .gp-user-pill {
    padding: 8px 10px;
    font-size: 13px;
  }

  .gp-tool-btn,
  .gp-icon-link {
    width: 36px;
    height: 36px;
  }

  .gp-action-icon,
  .gp-toolbar-icons .gp-action-icon,
  .gp-actions .gp-action-icon {
    width: 18px;
    height: 18px;
  }

  .gp-modal-compact,
  .gp-modal-compact strong,
  .gp-table thead th,
  .gp-table tbody td {
    font-size: 12px;
  }

  .gp-viewer-toolbar {
    padding: 0 10px;
  }

  .gp-viewer-title {
    font-size: 12px;
  }


}
/* Ajuste do botão Editar Processo Devolvido */
.gp-edit-return-pencil {
  color: #f39c12 !important;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
}

.gp-editar-retorno-pulse {
  border-color: rgba(243, 156, 18, 0.55) !important;
  animation: gpRetornoPulse 1.35s infinite;
}

@keyframes gpRetornoPulse {
  0% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(243, 156, 18, 0); }
  100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0); }
}

/* Ajuste de rolagem do modal Editar Processo Devolvido */
#editarRetornoModal .modal-dialog {
  max-height: calc(100vh - 1.5rem);
}

#editarRetornoModal .modal-content {
  max-height: calc(100vh - 1.5rem);
  display: flex;
  flex-direction: column;
}

#editarRetornoModal .modal-body {
  overflow-y: auto;
  max-height: calc(100vh - 170px);
}

#editarRetornoModal .gp-corpo-editor {
  min-height: 170px;
  max-height: 260px;
  overflow-y: auto;
}

@media (max-width: 991.98px) {
  #editarRetornoModal .modal-dialog {
    max-height: 100vh;
  }
  #editarRetornoModal .modal-content {
    max-height: 100vh;
  }
  #editarRetornoModal .modal-body {
    max-height: calc(100vh - 145px);
  }
}

/* Ajuste fino do ícone de arquivar/desarquivar: ligeiramente maior,
   mantendo a proporção original e o alinhamento com a barra de ações. */
.gp-toolbar-icons .gp-archive-action-icon {
  width: 20px;
  height: 20px;
}


/* GP-FAV-STAR: estrela de favoritos sempre dourada e visivel */
.gp-fav-btn .fa-star{color:#e6a200 !important;}
