:root {
  --bg-1: #0b1220;
  --bg-2: #0f172a;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-soft: #64748b;
  --brand-1: #2563eb;
  --brand-2: #0f766e;
  --accent: #f97316;
  --accent-2: #10b981;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-1: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 22px 80px rgba(15, 23, 42, 0.18);

  /* Bootstrap theme overrides */
  --bs-body-font-family: "Lexend", sans-serif;
  --bs-body-color: var(--text-main);
  --bs-border-color: rgba(226, 232, 240, 0.9);
  --bs-primary: var(--brand-1);
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: var(--brand-1);
  --bs-link-hover-color: #1d4ed8;
  --bs-border-radius: var(--radius-md);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-box-shadow-sm: var(--shadow-1);
  --bs-box-shadow: 0 16px 50px rgba(15, 23, 42, 0.12);
  --bs-box-shadow-lg: var(--shadow-2);
}

body.app-body {
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.55) 0%, rgba(37, 99, 235, 0) 55%),
    radial-gradient(circle at 85% 0%, rgba(15, 118, 110, 0.35) 0%, rgba(15, 118, 110, 0) 45%),
    radial-gradient(circle at 95% 85%, rgba(249, 115, 22, 0.22) 0%, rgba(249, 115, 22, 0) 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Light mode overrides (default is dark background + light surfaces) */
body.app-body.theme-light {
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.18) 0%, rgba(37, 99, 235, 0) 55%),
    radial-gradient(circle at 85% 0%, rgba(15, 118, 110, 0.12) 0%, rgba(15, 118, 110, 0) 45%),
    radial-gradient(circle at 95% 85%, rgba(249, 115, 22, 0.10) 0%, rgba(249, 115, 22, 0) 55%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  background-attachment: fixed;
}

body.app-body.theme-light .content-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95));
}

body.app-body.theme-light .sidebar-panel {
  background: rgba(255, 255, 255, 0.88);
}

h1,
h2,
h3,
.h1,
.h2,
.h3,
.display-5 {
  letter-spacing: -0.02em;
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}

.btn-success {
  border: 0;
  background: linear-gradient(135deg, #16a34a, #0f766e);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-outline-primary {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--brand-1);
}

.btn-outline-primary:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.45);
  color: #0f172a;
}

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: rgba(226, 232, 240, 0.95);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.15);
}

.card {
  border-radius: var(--radius-lg);
}

.card.border-0.shadow-sm,
.card.border-0.shadow-lg {
  background: rgba(255, 255, 255, 0.96);
}

.table > :not(caption) > * > * {
  border-color: rgba(226, 232, 240, 0.95);
}

.table thead th {
  color: #334155;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom-width: 1px;
}

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

.alert {
  border-radius: var(--radius-lg);
}

.landing-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero-logo {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(2, 6, 23, 0.4);
}

.portal-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  padding: 2rem;
  height: 100%;
  display: block;
  color: var(--text-main);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portal-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.3);
}

.portal-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}

.portal-card p {
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.icon-badge {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

.portal-link {
  font-weight: 600;
  color: var(--brand-1);
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.auth-card {
  border-radius: 24px;
  overflow: hidden;
}

.auth-brand-panel {
  background: linear-gradient(160deg, #1e40af, #0f766e);
}

.auth-logo {
  width: 90px;
  height: 90px;
  border-radius: 18px;
  box-shadow: 0 16px 35px rgba(2, 6, 23, 0.25);
}

.top-nav {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.88), rgba(15, 118, 110, 0.92));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.top-nav .navbar-brand,
.top-nav .navbar-brand span {
  color: #fff;
  font-weight: 600;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
}

.avatar-md {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 18px 45px rgba(2, 6, 23, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 64px);
  align-items: stretch;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.page-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.98), rgba(15, 118, 110, 0.96));
  box-shadow: 0 16px 35px rgba(2, 6, 23, 0.18);
  flex: 0 0 auto;
}

.page-icon .bi {
  font-size: 1.25rem;
}

.page-title {
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-soft);
  max-width: 70ch;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.surface-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.08);
}

.card-header.soft-header {
  background: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.table-card .table {
  margin-bottom: 0;
}

.empty-state {
  border: 1px dashed rgba(15, 23, 42, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  padding: 1.25rem;
  color: var(--text-soft);
}

.empty-state strong {
  color: var(--text-main);
}

.sidebar-offcanvas-header {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(37, 99, 235, 0.9), rgba(15, 118, 110, 0.94));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-panel {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  width: 290px;
  flex: 0 0 290px;
  max-width: 290px;
  min-height: calc(100vh - 64px);
  padding: 1rem 0;
  border-right: 1px solid rgba(226, 232, 240, 0.9);
}

.sidebar-tools .input-group-text {
  border-radius: 10px 0 0 10px;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.82);
  color: #475569;
}

.sidebar-tools .form-control {
  border-radius: 0 10px 10px 0;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
}

.sidebar-tools .form-control::placeholder {
  color: #64748b;
}

.sidebar-tools .form-control:focus {
  background: #fff;
}

.sidebar-search-empty {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: #64748b;
}

.sidebar-panel .list-group-item {
  position: relative;
  border: 0;
  border-radius: var(--radius-sm);
  margin: 0.25rem 0.85rem;
  padding: 0.75rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  color: #0f172a;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-panel .list-group-item i {
  margin-right: 0 !important;
  font-size: 1.05rem;
  opacity: 0.9;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
}

.sidebar-panel .list-group-item:hover {
  background: rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
  color: #020617;
}

.sidebar-panel .list-group-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 1), rgba(15, 118, 110, 1));
  color: #fff;
  border: 0;
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.22);
}

.sidebar-panel .list-group-item.active i {
  opacity: 1;
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-panel .list-group-item.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.content-panel {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92));
  min-height: calc(100vh - 64px);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: hidden;
}

@media (min-width: 992px) {
  .sidebar-panel {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 2;
  }

  .content-panel {
    width: auto;
  }
}

.metric-card {
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  padding: 1.2rem 1.1rem;
  height: 100%;
}

.metric-card strong {
  font-size: 1.9rem;
  line-height: 1;
}

.ops-score-pill {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.75rem;
}

.ops-check-item {
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.75rem 0.8rem;
}

.ops-check-item.ok {
  border-color: rgba(22, 163, 74, 0.35);
}

.ops-check-item.fail {
  border-color: rgba(220, 38, 38, 0.38);
  background: rgba(254, 242, 242, 0.85);
}

.metric-label {
  display: block;
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 0.5rem;
}

.timeline-list {
  display: grid;
  gap: 0.85rem;
}

.timeline-item {
  padding: 0.95rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.mini-card {
  border-radius: var(--radius-md);
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.9));
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.mini-card span {
  display: block;
  color: #475569;
  font-size: 0.9rem;
}

.mini-card strong {
  font-size: 1.05rem;
}

.table > :not(caption) > * > * {
  border-color: #e2e8f0;
}

.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.table tbody tr:hover {
  background: rgba(37, 99, 235, 0.035);
}

@media (min-width: 992px) {
  .sidebar-panel {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content-panel {
    animation: panel-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  @keyframes panel-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .btn-primary:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  }

  .btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
  }
}

pre.audit-json {
  max-height: 240px;
  overflow: auto;
  border-radius: 12px;
  background: #0b1220;
  color: #e2e8f0;
  padding: 0.75rem 0.85rem;
  font-size: 0.85rem;
}

body.certificate-body {
  background: #f1f5f9;
}

.certificate-wrap {
  padding: 2rem 0;
}

.certificate-page {
  background: #fff;
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  position: relative;
  overflow: hidden;
}

.certificate-page::before {
  content: "";
  position: absolute;
  top: -220px;
  right: -240px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, 0.45), rgba(29, 78, 216, 0.12) 62%, rgba(15, 118, 110, 0.08) 100%);
  transform: rotate(14deg);
  pointer-events: none;
}

.certificate-inner {
  padding: 3rem 3rem 2.25rem;
  position: relative;
}

.certificate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.certificate-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
}

.certificate-school {
  font-weight: 700;
  font-size: 1.1rem;
}

.certificate-system {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.certificate-badge {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
}

.certificate-divider {
  height: 3px;
  border-radius: 999px;
  margin: 1.75rem 0;
  background: linear-gradient(90deg, #1d4ed8, #f97316, #0f766e);
}

.certificate-text {
  font-size: 1.15rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.certificate-name {
  font-size: 1.45rem;
  font-weight: 800;
}

.certificate-course,
.certificate-code-inline {
  font-weight: 700;
}

.certificate-modules {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}

.certificate-modules-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.certificate-modules-body {
  color: #334155;
}

.certificate-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  background: #f1f5f9;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}

.certificate-meta-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.certificate-meta-value {
  font-weight: 600;
}

.certificate-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.certificate-sign {
  flex: 1;
  max-width: 420px;
}

.certificate-sign-line {
  border-bottom: 2px solid #0f172a;
  opacity: 0.65;
  margin-bottom: 0.5rem;
}

.certificate-sign-label {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.certificate-qr {
  text-align: center;
}

.certificate-qr-img {
  width: 150px;
  height: 150px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0.5rem;
}

.certificate-verify {
  margin-top: 1.25rem;
  word-break: break-all;
}

.boleto-page {
  border-style: solid;
}

.boleto-inner .certificate-badge {
  letter-spacing: 0.14em;
}

.boleto-line {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  padding: 0.85rem 1rem;
}

.boleto-line-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.boleto-line-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #0f172a;
}

.boleto-cut {
  border-top: 2px dashed #cbd5e1;
  position: relative;
  padding-top: 0.9rem;
}

@media (max-width: 991px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .sidebar-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.8rem;
  }

  .content-panel {
    min-height: auto;
  }
}

@media (max-width: 768px) {
  .certificate-inner {
    padding: 2.1rem 1.35rem 1.75rem;
  }

  .certificate-meta {
    grid-template-columns: 1fr;
  }

  .certificate-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .no-print {
    display: none !important;
  }

  .certificate-wrap {
    padding: 0;
  }

  .certificate-page {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .certificate-page::before {
    display: none;
  }

  .certificate-inner {
    padding: 2cm 2cm 1.6cm;
  }
}
