.app-page {
  min-height: 100vh;
}

.migration-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 67, 199, 0.16);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 67, 199, 0.06), rgba(9, 226, 253, 0.08));
  color: #1f3f82;
  font-size: 0.95rem;
  line-height: 1.5;
}

.migration-banner::before {
  content: "i";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0043c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.8rem;
}

.compat-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2200;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.96);
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.compat-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.global-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(1px);
}

.global-busy-overlay.is-visible {
  display: flex;
}

.global-busy-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.95);
  color: #f8fafc;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.36);
  font-weight: 600;
}

.global-busy-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(248, 250, 252, 0.28);
  border-top-color: #f8fafc;
  animation: globalBusySpin 0.8s linear infinite;
}

@keyframes globalBusySpin {
  to {
    transform: rotate(360deg);
  }
}

.auth-page {
  background: #f3f4f6;
}

.auth-shell {
  min-height: 100vh;
  width: 100%;
  padding: 0;
  position: relative;
}

.auth-shell-single {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 104px;
  z-index: 5;
}

.auth-grid {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-image-panel {
  min-height: 100vh;
  background-color: #132aa0;
  background-image: linear-gradient(145deg, rgba(19, 42, 160, 0.8), rgba(41, 71, 217, 0.74));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-card-django {
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 28px;
  box-sizing: border-box;
}

.login-card-django form {
  margin-top: 10px;
}

.login-card-django h1 {
  margin: 0 0 6px;
  color: #0f2d62;
  font-size: 2rem;
}

.login-card-django p {
  margin: 0 0 18px;
  color: #334155;
}

.auth-login-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: block;
  gap: 6px;
}

.auth-field label,
.login-card-django label {
  display: block;
  font-weight: 600;
  color: #1f2937;
}

.login-card-django input,
.login-card-django .password-input-wrap input,
.login-card-django .password-field > input {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 0 14px;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  margin-top: 6px;
}

.login-card-django .login-actions {
  margin-top: 8px;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-actions .btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
}

.login-card-django .password-field {
  width: 100%;
  display: block;
}

.login-card-django .password-toggle {
  right: 8px;
  width: 34px;
  height: 34px;
}

.error-visible,
.field-error,
.reset-help {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.error-visible,
.field-error {
  color: #8d0f0f;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.18);
}

.reset-help {
  display: none;
}

.reset-help.is-info {
  color: #5b4a16;
  background: rgba(241, 196, 15, 0.14);
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.reset-help.is-success {
  color: #0f5132;
  background: rgba(25, 135, 84, 0.12);
  border: 1px solid rgba(25, 135, 84, 0.28);
}

.reset-help.is-error {
  color: #842029;
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.28);
}

.reset-help:not([hidden]) {
  display: block;
}

.sidebar-logo {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
}

.settings-visual-card {
  background: #ffffff;
  border: 1px solid #dbe4f3;
  border-radius: 16px;
  padding: 20px;
}

.settings-visual-multi {
  display: grid;
  gap: 16px;
}

.settings-visual-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #1f2937;
}

.first-access-card {
  max-width: 460px;
}

.settings-visual-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: flex-start;
}

.settings-visual-preview-wrap {
  width: 100%;
}

.settings-visual-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 1px solid #d6dfef;
  background-color: #eff4ff;
  background-image: linear-gradient(145deg, rgba(19, 42, 160, 0.72), rgba(41, 71, 217, 0.7));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.settings-visual-preview-simulator {
  aspect-ratio: 16 / 9;
}

.settings-visual-controls {
  display: grid;
  gap: 12px;
}

.settings-visual-label {
  font-weight: 700;
  color: #1f2937;
}

.settings-visual-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-visual-status {
  min-height: 22px;
  font-size: 0.9rem;
  color: #1f3f82;
}

.dashboard-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f3f7ff);
  border: 1px solid #dbe4f3;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(0, 39, 156, 0.08);
}

.dashboard-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 67, 199, 0.08);
  color: #0043c7;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-hero-card h3 {
  margin: 16px 0 10px;
  font-size: 1.75rem;
  line-height: 1.1;
  color: #1f2937;
}

.dashboard-hero-card p {
  margin: 0;
  color: #5f6b7a;
  line-height: 1.6;
}

.dashboard-hero-actions {
  display: grid;
  gap: 10px;
}

.dashboard-hero-actions .btn {
  text-align: center;
}

html[data-theme="dark"] .auth-page {
  background: #0b1220;
}

html[data-theme="dark"] .migration-banner {
  border-color: rgba(96, 165, 250, 0.18);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(14, 165, 233, 0.1));
  color: #dbeafe;
}

html[data-theme="dark"] .auth-image-panel {
  background-image: linear-gradient(145deg, rgba(8, 21, 47, 0.84), rgba(0, 22, 59, 0.74));
}

html[data-theme="dark"] .login-card-django {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] .login-card-django h1,
html[data-theme="dark"] .dashboard-hero-card h3 {
  color: #f8fafc;
}

html[data-theme="dark"] .login-card-django p,
html[data-theme="dark"] .dashboard-hero-card p {
  color: #94a3b8;
}

html[data-theme="dark"] .login-card-django label {
  color: #e2e8f0;
}

html[data-theme="dark"] .login-card-django input {
  background: #0f172a;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .dashboard-hero-card {
  background: linear-gradient(135deg, #0f172a, #13213d);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .dashboard-chip {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

@media (max-width: 920px) {
  .auth-shell {
    min-height: 100vh;
  }

  .auth-grid,
  .dashboard-hero-card {
    grid-template-columns: 1fr;
  }

  .auth-image-panel {
    min-height: 36vh;
  }

  .settings-visual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-theme-toggle {
    top: 16px;
    right: 16px;
  }

  .auth-image-panel {
    min-height: 28vh;
  }

  .login-card-django {
    max-width: 100%;
    padding: 20px 18px 26px;
  }

  .auth-actions .btn {
    width: 100%;
  }
}

.dashboard-native-content {
  display: grid;
  gap: 20px;
}

.dashboard-page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.dashboard-header-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  min-width: min(100%, 360px);
}

.dashboard-meta-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #dbe4f3;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dashboard-meta-card strong,
.dashboard-meta-card small,
.dashboard-meta-label {
  display: block;
}

.dashboard-meta-card strong {
  font-size: 1rem;
  color: #13213d;
}

.dashboard-meta-card small,
.dashboard-meta-label {
  color: #5f6b7a;
}

.dashboard-meta-label {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-section {
  display: grid;
  gap: 14px;
}

.dashboard-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
}

.dashboard-section-heading h3 {
  margin: 0 0 4px;
  color: #1f2937;
  font-size: 1.4rem;
}

.dashboard-section-heading p {
  margin: 0;
  color: #5f6b7a;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.dashboard-metric-card,
.dashboard-panel {
  background: #ffffff;
  border: 1px solid #dbe4f3;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 32px rgba(0, 39, 156, 0.06);
}

.dashboard-metric-card {
  position: relative;
  overflow: hidden;
}

.dashboard-metric-card::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: #0043c7;
}

.dashboard-metric-card--success::after {
  background: #15803d;
}

.dashboard-metric-card--warning::after {
  background: #b45309;
}

.dashboard-metric-card--danger::after {
  background: #b91c1c;
}

.dashboard-metric-card--neutral::after {
  background: #334155;
}

.dashboard-metric-label,
.dashboard-metric-detail {
  display: block;
}

.dashboard-metric-label {
  color: #5f6b7a;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dashboard-metric-value {
  display: block;
  color: #13213d;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.dashboard-metric-detail {
  color: #6b7280;
  font-size: 0.88rem;
}

.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.dashboard-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-entity-card {
  display: grid;
  gap: 14px;
}

.dashboard-entity-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.dashboard-entity-header h4,
.dashboard-panel h4 {
  margin: 0 0 4px;
  color: #13213d;
}

.dashboard-entity-header p,
.dashboard-panel > p {
  margin: 0;
  color: #5f6b7a;
}

.dashboard-entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-entity-meta span,
.dashboard-inline-stat,
.dashboard-compact-item {
  border-radius: 12px;
  border: 1px solid #e5edf8;
  background: #f8fbff;
}

.dashboard-entity-meta span {
  padding: 8px 10px;
  color: #334155;
  font-size: 0.88rem;
}

.dashboard-details {
  border-top: 1px solid #e5edf8;
  padding-top: 12px;
}

.dashboard-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #0043c7;
  margin-bottom: 10px;
}

.dashboard-table-wrap {
  overflow: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.dashboard-table th {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-table td {
  color: #1f2937;
  font-size: 0.92rem;
}

.dashboard-table--compact {
  min-width: 0;
}

.dashboard-inline-note {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.8rem;
}

.dashboard-inline-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.dashboard-inline-stat,
.dashboard-compact-item {
  padding: 12px 14px;
}

.dashboard-inline-stat strong,
.dashboard-inline-stat span,
.dashboard-inline-stat small,
.dashboard-compact-item strong,
.dashboard-compact-item span,
.dashboard-compact-item small {
  display: block;
}

.dashboard-inline-stat strong,
.dashboard-compact-item strong {
  color: #13213d;
}

.dashboard-inline-stat span,
.dashboard-compact-item span {
  color: #334155;
  margin-top: 4px;
}

.dashboard-inline-stat small,
.dashboard-compact-item small {
  margin-top: 4px;
  color: #64748b;
}

.dashboard-compact-list {
  display: grid;
  gap: 10px;
}

.dashboard-empty-state {
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e2e8f0;
  color: #334155;
}

.status-badge--ativo,
.status-badge--aprovado {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.status-badge--inativo,
.status-badge--reprovado {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.status-badge--em_analise {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}

.dashboard-json-cell {
  max-width: 340px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

html[data-theme="dark"] .dashboard-page-header,
html[data-theme="dark"] .dashboard-metric-card,
html[data-theme="dark"] .dashboard-panel {
  background: #111c32;
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

html[data-theme="dark"] .dashboard-meta-card,
html[data-theme="dark"] .dashboard-entity-meta span,
html[data-theme="dark"] .dashboard-inline-stat,
html[data-theme="dark"] .dashboard-compact-item,
html[data-theme="dark"] .dashboard-empty-state {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .dashboard-section-heading h3,
html[data-theme="dark"] .dashboard-metric-value,
html[data-theme="dark"] .dashboard-entity-header h4,
html[data-theme="dark"] .dashboard-inline-stat strong,
html[data-theme="dark"] .dashboard-compact-item strong,
html[data-theme="dark"] .dashboard-meta-card strong,
html[data-theme="dark"] .dashboard-table td {
  color: #f8fafc;
}

html[data-theme="dark"] .dashboard-section-heading p,
html[data-theme="dark"] .dashboard-meta-card small,
html[data-theme="dark"] .dashboard-meta-label,
html[data-theme="dark"] .dashboard-metric-label,
html[data-theme="dark"] .dashboard-metric-detail,
html[data-theme="dark"] .dashboard-entity-header p,
html[data-theme="dark"] .dashboard-inline-stat span,
html[data-theme="dark"] .dashboard-inline-stat small,
html[data-theme="dark"] .dashboard-compact-item span,
html[data-theme="dark"] .dashboard-compact-item small,
html[data-theme="dark"] .dashboard-inline-note,
html[data-theme="dark"] .dashboard-empty-state,
html[data-theme="dark"] .dashboard-table th,
html[data-theme="dark"] .dashboard-table td,
html[data-theme="dark"] .dashboard-entity-meta span {
  color: #94a3b8;
}

html[data-theme="dark"] .dashboard-table th,
html[data-theme="dark"] .dashboard-table td,
html[data-theme="dark"] .dashboard-details {
  border-color: rgba(148, 163, 184, 0.14);
}

@media (max-width: 980px) {
  .dashboard-page-header,
  .dashboard-split-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-page-header {
    flex-direction: column;
  }

  .dashboard-header-meta {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .dashboard-table {
    min-width: 620px;
  }
}
