:root {
  --app-primary: #123B5D;
  --app-primary-dark: #0C2A43;
  --app-primary-light: #EAF2F8;
  --app-secondary: #1B6B78;
  --app-secondary-light: #E8F5F6;
  --app-accent: #D6A64C;
  --app-accent-hover: #B88932;
  --app-success: #18865A;
  --app-success-light: #E7F6EF;
  --app-warning: #C88719;
  --app-warning-light: #FFF4DD;
  --app-danger: #C13D3D;
  --app-danger-light: #FCEBEC;
  --app-info: #2676A8;
  --app-info-light: #EAF5FB;
  --app-bg: #F5F8FA;
  --app-surface: #FFFFFF;
  --app-surface-muted: #F0F4F7;
  --app-text: #1E2A35;
  --app-text-muted: #62717C;
  --app-border: #D9E2E8;
  --app-shadow-sm: 0 2px 8px rgba(18, 59, 93, 0.08);
  --app-shadow-md: 0 8px 24px rgba(18, 59, 93, 0.12);
  --app-radius-sm: 8px;
  --app-radius-md: 12px;
  --app-radius-lg: 16px;
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 76px;
  --sidebar-bg: #0C2A43;
  --sidebar-bg-alt: #123B5D;
  --sidebar-active: rgba(27, 107, 120, 0.34);
  --sidebar-text: #DCE8F0;
  --sidebar-muted: #91A8B8;
  --sidebar-accent: #D6A64C;
}

body {
  background: var(--app-bg);
  color: var(--app-text);
  font-family: Arial, Helvetica, sans-serif;
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
}

.form-alert {
  color: var(--app-danger);
  min-height: 24px;
}

.app-brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 10px;
  text-decoration: none;
}

.app-brand img {
  display: block;
  height: 44px;
  object-fit: contain;
  width: auto;
}

.app-brand--sidebar img {
  height: 40px;
}

.app-brand--compact img {
  height: 36px;
}

/* Fundo institucional compartilhado por login, seleção de contexto e acesso negado. */

.auth-shell {
  background:
    radial-gradient(circle at 20% 20%, rgba(27, 107, 120, 0.22), transparent 38%),
    linear-gradient(135deg, #0C2A43 0%, #123B5D 58%, #0A2034 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-aside {
  align-items: center;
  color: #fff;
  display: flex;
  padding: 48px;
}

.auth-aside-inner {
  max-width: 460px;
}

.auth-aside .app-brand img {
  height: 64px;
  margin-bottom: 28px;
}

.auth-aside h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.auth-aside-rule {
  background: var(--app-accent);
  border-radius: 999px;
  height: 4px;
  margin-bottom: 22px;
  width: 64px;
}

.auth-aside p {
  color: rgba(220, 232, 240, 0.86);
  font-size: 1.02rem;
  line-height: 1.55;
}

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

.auth-card {
  background: var(--app-surface);
  border: 1px solid rgba(214, 166, 76, 0.28);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-md);
  max-width: 420px;
  padding: 32px;
  width: 100%;
}

.auth-card .app-brand {
  justify-content: center;
  margin-bottom: 18px;
}

.auth-card .app-brand img {
  height: 56px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  text-align: center;
}

.auth-message {
  color: var(--app-text-muted);
  margin-bottom: 22px;
  text-align: center;
}

.auth-notice {
  background: var(--app-warning-light);
  border: 1px solid rgba(200, 135, 25, 0.25);
  border-radius: var(--app-radius-sm);
  color: var(--app-warning);
  font-size: 0.86rem;
  margin-bottom: 18px;
  padding: 10px 12px;
}

.auth-link-muted {
  background: none;
  border: 0;
  color: var(--app-text-muted);
  cursor: not-allowed;
  font-size: 0.86rem;
  padding: 0;
  text-decoration: underline dotted;
}

.login-page {
  background: #F4F6F9;
}

.auth-login-shell {
  background: #F4F6F9;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
}

.auth-login-brand-panel {
  align-items: stretch;
  background: linear-gradient(150deg, #0C2A43 0%, #123B5D 58%, #0E2C4A 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 56px 64px;
  position: relative;
}

.auth-login-brand-panel::before,
.auth-login-brand-panel::after {
  content: "";
  display: block;
  position: absolute;
}

.auth-login-brand-panel::before {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  height: 100%;
  right: 18%;
  top: 0;
}

.auth-login-brand-panel::after {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  bottom: 18%;
  left: 0;
  width: 100%;
}

.auth-login-brand-panel .auth-aside-inner {
  position: relative;
  z-index: 1;
}

.auth-login-brand-panel .auth-aside-inner {
  max-width: 470px;
}

.auth-login-brand-panel .auth-aside-rule {
  margin-bottom: 28px;
  width: 46px;
}

.auth-login-brand-panel h1 {
  font-size: 2.65rem;
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 20px;
}

.auth-login-brand-panel p {
  color: rgba(255, 255, 255, 0.74);
  font-size: 1.06rem;
  line-height: 1.6;
  margin: 0;
}

.auth-login-shell .auth-panel {
  background: #F4F6F9;
  padding: 48px 40px;
}

.auth-login-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  max-width: 400px;
  padding: 0;
}

.auth-login-card .app-brand {
  justify-content: center;
  margin-bottom: 8px;
}

.auth-login-card .app-brand img {
  height: 210px;
  width: 210px;
}

.auth-login-card h1 {
  color: var(--app-primary-dark);
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-login-card .auth-message {
  font-size: 0.95rem;
  margin-bottom: 34px;
}

.auth-field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-field-row {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.auth-login-card .form-label {
  color: #33465A;
  font-size: 0.86rem;
  font-weight: 700;
  margin: 0;
}

.auth-login-card .auth-link-muted {
  color: var(--app-accent-hover);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-login-card .form-control {
  border: 1.5px solid #D6DEE7;
  border-radius: 10px;
  color: var(--app-primary-dark);
  font-size: 0.95rem;
  height: 50px;
  padding: 0 16px;
}

.auth-login-card .form-control:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 4px rgba(18, 59, 93, 0.1);
}

.auth-login-card .btn-primary {
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(12, 42, 67, 0.24);
  font-weight: 700;
  height: 52px;
  margin-top: 8px;
}

.auth-login-separator {
  align-items: center;
  color: #94A3B8;
  display: flex;
  font-size: 0.8rem;
  gap: 14px;
  margin: 28px 0;
}

.auth-login-separator::before,
.auth-login-separator::after {
  background: #E2E8F0;
  content: "";
  flex: 1;
  height: 1px;
}

.auth-login-support {
  color: #64748B;
  font-size: 0.9rem;
  margin: 0;
  text-align: center;
}

.auth-login-support a {
  color: var(--app-accent-hover);
  font-weight: 700;
  text-decoration: none;
}

.auth-context-header {
  color: #fff;
  margin-bottom: 26px;
  text-align: center;
}

.auth-context-header .app-brand {
  justify-content: center;
  margin-bottom: 22px;
}

.auth-context-header .app-brand img {
  height: 56px;
}

.auth-context-user {
  color: var(--app-accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-context-header h1 {
  font-size: 1.6rem;
  margin: 6px 0 8px;
}

.auth-context-header p {
  color: rgba(220, 232, 240, 0.86);
  margin: 0 auto;
  max-width: 520px;
}

.auth-wide {
  margin: 0 auto;
  max-width: 880px;
  padding: 48px 24px;
  width: 100%;
}

.autocomplete-wrap {
  position: relative;
}

.autocomplete-menu {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  box-shadow: var(--app-shadow-md);
  display: none;
  left: 0;
  max-height: 260px;
  overflow: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
}

.autocomplete-menu.is-open {
  display: block;
}

.autocomplete-item {
  background: transparent;
  border: 0;
  color: var(--app-text);
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
  background: var(--app-primary-light);
}

.autocomplete-item span,
.autocomplete-empty {
  color: var(--app-text-muted);
  font-size: 0.86rem;
}

.autocomplete-empty {
  padding: 10px 12px;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-login-shell {
    grid-template-columns: 1fr;
  }

  .auth-login-brand-panel {
    min-height: auto;
    padding: 32px 24px 28px;
  }

  .auth-login-brand-panel .auth-aside-inner {
    margin: 0;
  }

  .auth-login-brand-panel h1 {
    font-size: 2rem;
  }

  .auth-login-shell .auth-panel {
    padding: 34px 22px 44px;
  }

  .auth-login-card .app-brand img {
    height: 180px;
    width: 180px;
  }

  .auth-aside {
    padding: 32px 24px 12px;
  }

  .auth-aside-inner {
    max-width: none;
  }

  .auth-aside h1 {
    font-size: 1.5rem;
  }

  .auth-aside p {
    font-size: 0.94rem;
  }

  .auth-panel {
    padding: 12px 20px 40px;
  }
}
