:root {
  --brand-green: #0d5c3d;
  --brand-green-soft: #14724c;
  --brand-gold: #d6a420;
  --brand-blue: #0d3b66;
  --brand-ink: #12303f;
  --brand-ink-soft: #45606f;
  --brand-sand: #f3f5ef;
  --brand-white: #ffffff;
  --font-display: "Manrope", sans-serif;
  --font-body: "Source Sans 3", sans-serif;
}

body {
  font-family: var(--font-body);
  min-height: 100vh;
  color: var(--brand-ink);
  font-size: 1.03rem;
  line-height: 1.45;
  background:
    radial-gradient(circle at top left, rgba(214, 164, 32, 0.20), transparent 35%),
    linear-gradient(160deg, #f8faf7 0%, #eef4f0 48%, #f5f7fb 100%);
}

body.loading-locked {
  overflow: hidden;
}

.flash-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2100;
  width: min(92vw, 420px);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(244, 248, 246, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 2000;
}

.loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.loading-overlay-card {
  min-width: min(92vw, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.6rem 1.75rem;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(13, 59, 102, 0.1);
  box-shadow: 0 24px 60px rgba(18, 48, 63, 0.18);
  text-align: center;
}

.loading-overlay-card strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.loading-overlay-card span {
  max-width: 280px;
  color: var(--brand-ink-soft);
  font-size: 0.98rem;
  line-height: 1.35;
}

.loading-gif-shell {
  position: relative;
  width: 86px;
  height: 86px;
}

.loading-gif-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  animation: loading-ring-spin 1.2s linear infinite;
}

.loading-gif-ring-outer {
  border-top-color: #1f7bb6;
  border-right-color: rgba(31, 123, 182, 0.38);
}

.loading-gif-ring-middle {
  inset: 10px;
  border-top-color: #d6a420;
  border-left-color: rgba(214, 164, 32, 0.36);
  animation-duration: 0.95s;
  animation-direction: reverse;
}

.loading-gif-ring-inner {
  inset: 22px;
  border-top-color: #0d5c3d;
  border-bottom-color: rgba(13, 92, 61, 0.35);
  animation-duration: 0.8s;
}

@keyframes loading-ring-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.landing-shell,
.app-shell {
  min-height: 100vh;
  padding: 0.75rem 2rem 0.75rem;
}

.app-shell {
  display: flex;
  flex-direction: column;
}

.hero-panel,
.content-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(13, 59, 102, 0.08);
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(18, 48, 63, 0.12);
}

.hero-panel {
  min-height: calc(100vh - 4rem);
  display: grid;
  place-items: center;
}

.landing-login-shell {
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(100%, 560px);
  min-height: auto;
  padding: 2.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.login-logo {
  width: 116px;
  height: 116px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.login-copy h1 {
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.login-copy p {
  margin-bottom: 1.5rem;
  color: var(--brand-ink-soft);
  font-size: 1.05rem;
}

.login-form {
  text-align: left;
}

.hero-copy {
  max-width: 720px;
  text-align: center;
}

.hero-copy h1,
.topbar h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--brand-green-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: center;
  padding: 1rem 1.6rem;
  margin-bottom: 1rem;
  border-radius: 30px;
  color: var(--brand-white);
  background:
    linear-gradient(135deg, rgba(13, 92, 61, 0.96), rgba(13, 59, 102, 0.96)),
    linear-gradient(180deg, rgba(214, 164, 32, 0.15), transparent);
  box-shadow: 0 22px 44px rgba(18, 48, 63, 0.14);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title h1 {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0;
  font-size: 2.2rem;
  line-height: 0.98;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.2rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 0.95rem 1.05rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(13, 59, 102, 0.08);
  box-shadow: 0 10px 24px rgba(18, 48, 63, 0.05);
}

.stat-card span {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-ink-soft);
  letter-spacing: -0.02em;
}

.stat-card strong {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.content-card {
  padding: 1.35rem 1.5rem 1.5rem;
  min-height: calc(100vh - 15.5rem);
}

.filters-panel {
  margin-bottom: 1.25rem;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.95rem;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem;
  border: 1px solid rgba(13, 59, 102, 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, #f7f9fc, #eef3f9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.filter-pill {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.58rem 0.95rem;
  border-radius: 999px;
  color: #385061;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  background: transparent;
}

.filter-pill-active {
  color: #fff;
  background: linear-gradient(135deg, #3f68dd, #1f7bb6);
  box-shadow: 0 12px 26px rgba(63, 104, 221, 0.24);
}

.items-per-page-box {
  min-width: 150px;
}

.filter-classifier-box {
  min-width: 420px;
  flex: 1 1 420px;
}

.items-per-page-box .form-select {
  background-color: #fff;
}

.filter-unit-box {
  min-width: 360px;
  flex: 1 1 360px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.toolbar-row .btn {
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.62rem 1rem;
}

.table-caption {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-ink);
}

.selected-classifier-banner {
  margin-bottom: 0.9rem;
}

.selected-classifier-banner h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-ink);
}

.form-label {
  margin-bottom: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-ink);
}

.form-select,
.form-control {
  min-height: 2.7rem;
  border-radius: 12px;
  border-color: rgba(13, 59, 102, 0.14);
  font-size: 1rem;
  box-shadow: none;
}

.form-select:focus,
.form-control:focus {
  border-color: rgba(31, 123, 182, 0.5);
  box-shadow: 0 0 0 0.18rem rgba(31, 123, 182, 0.12);
}

.table-shell {
  max-height: 60vh;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(13, 59, 102, 0.08);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.table-shell-fixed {
  max-height: calc(100vh - 26rem);
}

.grouped-process-list-fixed {
  max-height: calc(100vh - 28rem);
  overflow: auto;
  padding-right: 0.2rem;
}

.classifier-group-card + .classifier-group-card {
  margin-top: 1rem;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  position: sticky;
  top: 0;
  padding: 0.8rem 0.55rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #102f43;
  background: linear-gradient(180deg, #f5f8f8, #edf3f2);
  z-index: 1;
}

.table tbody td {
  padding: 0.72rem 0.55rem;
  font-size: 0.98rem;
  vertical-align: middle;
  border-color: rgba(13, 59, 102, 0.12);
}

.table tbody tr:hover {
  background: rgba(13, 59, 102, 0.03);
}

.table tbody td:first-child,
.table thead th:first-child {
  width: 38px;
}

.table thead th:nth-child(2),
.table tbody td:nth-child(2) {
  min-width: 150px;
  width: 150px;
}

.process-number-cell {
  white-space: nowrap;
  min-width: 170px;
}

.table .fw-semibold {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.text-strong {
  color: #112c3c;
  font-size: 0.98rem;
  line-height: 1.32;
}

.text-truncate-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-muted.small {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.82rem !important;
  line-height: 1.25;
  color: #667987 !important;
}

.badge.execution-badge {
  padding: 0.38rem 0.62rem;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.pagination .page-link {
  border-radius: 10px;
  margin-left: 0.25rem;
  border-color: rgba(13, 59, 102, 0.12);
  color: #2a4f73;
  font-family: var(--font-display);
  font-weight: 700;
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #3f68dd, #1f7bb6);
  border-color: transparent;
}

.bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1rem;
}

.bottom-execute-btn {
  width: 100%;
  justify-content: center;
  padding-inline: 1.25rem;
}

.pagination-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.pagination {
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 0.45rem;
}

.prompt-manager-shell {
  min-height: calc(100vh - 17rem);
}

.prompt-manager-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
}

.prompt-catalog-card,
.prompt-editor-card,
.prompt-picker-card,
.prompt-editor-box {
  border: 1px solid rgba(13, 59, 102, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(18, 48, 63, 0.06);
}

.prompt-catalog-card,
.prompt-editor-card {
  padding: 1.1rem;
}

.prompt-catalog-head,
.prompt-form-head,
.prompt-picker-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.prompt-eyebrow {
  display: inline-block;
  margin-bottom: 0.3rem;
  color: var(--brand-green-soft);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.prompt-catalog-head h2,
.prompt-form-head h2,
.prompt-picker-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.prompt-catalog-head p,
.prompt-form-subtitle,
.prompt-picker-head p {
  margin: 0.2rem 0 0;
  color: var(--brand-ink-soft);
}

.prompt-search-row,
.prompt-picker-search {
  display: flex;
  gap: 0.65rem;
  margin-top: 1rem;
}

.prompt-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  margin-top: 1rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.prompt-catalog-item {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(13, 59, 102, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, #fdfefe, #f4f8fb);
  text-align: left;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.prompt-catalog-item:hover,
.prompt-catalog-item.is-active {
  border-color: rgba(31, 123, 182, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(18, 48, 63, 0.08);
}

.prompt-catalog-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.prompt-catalog-item strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.prompt-catalog-meta {
  color: var(--brand-ink-soft);
  font-size: 0.88rem;
}

.prompt-status-badge {
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
}

.prompt-status-badge.is-active {
  background: rgba(13, 92, 61, 0.12);
  color: var(--brand-green);
}

.prompt-status-badge.is-inactive {
  background: rgba(13, 59, 102, 0.08);
  color: var(--brand-ink-soft);
}

.prompt-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: #eef4f7;
  font-family: var(--font-display);
  font-weight: 700;
}

.prompt-switch input {
  margin: 0;
}

.prompt-editor-box {
  padding: 0.95rem;
}

.prompt-editor-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.prompt-editor-toolbar > span {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-ink-soft);
}

.prompt-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prompt-token-chip {
  border: 1px solid rgba(31, 123, 182, 0.18);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  background: #f6fbff;
  color: #1f5c85;
  font-family: "JetBrains Mono", "Source Code Pro", monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.prompt-editor-textarea {
  min-height: 420px;
  resize: vertical;
  border-radius: 18px;
  font-family: "JetBrains Mono", "Source Code Pro", monospace;
  font-size: 0.93rem;
  line-height: 1.5;
}

.prompt-editor-box .note-editor.note-frame {
  border: 1px solid rgba(27, 60, 89, 0.12);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
}

.prompt-editor-box .note-toolbar {
  background: linear-gradient(180deg, rgba(237, 245, 248, 0.95), rgba(232, 240, 245, 0.9));
  border-bottom: 1px solid rgba(27, 60, 89, 0.08);
}

.prompt-editor-box .note-btn {
  border-color: rgba(27, 60, 89, 0.12);
}

.prompt-editor-box .note-editing-area,
.prompt-editor-box .note-editable {
  background: #fff;
  color: var(--brand-ink);
}

.prompt-editor-box .note-editable {
  min-height: 340px;
  font-size: 1rem;
  line-height: 1.7;
}

.prompt-editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  color: var(--brand-ink-soft);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
}

.prompt-picker-card {
  padding: 1rem;
}

.prompt-picker-card + .prompt-picker-card {
  margin-top: 1rem;
}

.prompt-picker-counter {
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: #edf4fb;
  color: #32577a;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
}

.prompt-picker-all,
.prompt-picker-option {
  display: flex;
  align-items: start;
  gap: 0.65rem;
}

.prompt-picker-all {
  margin: 0.9rem 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  background: #f7fafc;
  font-family: var(--font-display);
  font-weight: 700;
}

.prompt-picker-options {
  max-height: 250px;
  overflow: auto;
  padding-right: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.prompt-picker-option {
  padding: 0.6rem 0.7rem;
  border-radius: 14px;
  border: 1px solid rgba(13, 59, 102, 0.08);
  background: #fff;
}

.prompt-picker-option small {
  display: block;
  margin-top: 0.15rem;
  color: var(--brand-ink-soft);
}

.prompt-form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.prompt-empty-state {
  padding: 1rem;
  border-radius: 18px;
  background: #f7fafc;
  color: var(--brand-ink-soft);
  text-align: center;
}

.user-admin-card {
  min-height: calc(100vh - 9rem);
}

.user-admin-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-panel {
  padding: 1.25rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(13, 59, 102, 0.08);
  box-shadow: 0 14px 34px rgba(18, 48, 63, 0.06);
}

.section-heading h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-heading p {
  margin: 0 0 1rem;
  color: var(--brand-ink-soft);
}

.stack-form .form-control,
.stack-form .form-select {
  min-height: 48px;
  border-radius: 14px;
}

.user-table-shell {
  max-height: calc(100vh - 23rem);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
}

.role-admin {
  background: rgba(13, 59, 102, 0.12);
  color: var(--brand-blue);
}

.role-gestor {
  background: rgba(214, 164, 32, 0.18);
  color: #805600;
}

.role-executor {
  background: rgba(13, 92, 61, 0.12);
  color: var(--brand-green-soft);
}

.footer {
  text-align: center;
  padding: 0.45rem 0.25rem 0.1rem;
  color: #5b6f79;
  font-family: var(--font-display);
  font-size: 0.78rem;
  line-height: 1;
}

.detail-box {
  background: #f7f9fb;
  border-radius: 18px;
  padding: 1rem;
  height: 100%;
}

.detail-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-box {
  border: 1px solid rgba(155, 26, 26, 0.15);
}

@media (max-width: 991px) {
  .app-shell,
  .landing-shell {
    padding: 0.5rem 1rem 1rem;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-title h1 {
    font-size: 1.7rem;
  }

  .toolbar-row {
    flex-wrap: wrap;
  }

  .filter-head {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-pills {
    width: 100%;
    flex-wrap: wrap;
  }

  .prompt-manager-grid {
    grid-template-columns: 1fr;
  }

  .user-admin-grid {
    grid-template-columns: 1fr;
  }

  .prompt-form-head,
  .prompt-picker-head,
  .prompt-catalog-head,
  .prompt-form-actions,
  .prompt-editor-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .prompt-editor-textarea {
    min-height: 320px;
  }

  .items-per-page-box,
  .filter-unit-box,
  .filter-classifier-box {
    min-width: 0;
  }

  .grouped-process-list-fixed {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}
