/* The signed-in user's access profile determines the application identity. */
:root, .role-theme-default, .role-theme-mixed {
  --role-color: #64748b;
  --role-color-dark: #0f172a;
  --role-color-soft: rgba(148, 163, 184, .18);
  --role-color-glow: rgba(100, 116, 139, .28);
}

.role-theme-insurance {
  --role-color: #2563eb;
  --role-color-dark: #172554;
  --role-color-soft: rgba(59, 130, 246, .2);
  --role-color-glow: rgba(37, 99, 235, .38);
  --theme-primary: #2563eb;
  --theme-primary-hover: #1d4ed8;
  --theme-primary-soft: #eff6ff;
  --theme-primary-border: #bfdbfe;
}

.role-theme-accounting {
  --role-color: #dc2626;
  --role-color-dark: #7f1d1d;
  --role-color-soft: rgba(239, 68, 68, .19);
  --role-color-glow: rgba(220, 38, 38, .36);
  --theme-primary: #dc2626;
  --theme-primary-hover: #b91c1c;
  --theme-primary-soft: #fef2f2;
  --theme-primary-border: #fecaca;
}

.role-theme-admin {
  --role-color: #b8860b;
  --role-color-dark: #493300;
  --role-color-soft: rgba(184, 134, 11, .22);
  --role-color-glow: rgba(184, 134, 11, .42);
  --theme-primary: #9a7008;
  --theme-primary-hover: #765606;
  --theme-primary-soft: #fffbeb;
  --theme-primary-border: #e8c96a;
}

body[class*="role-theme-"] .navbar.prudent-nav {
  background: radial-gradient(circle at 88% -80%, var(--role-color-soft), transparent 40%), linear-gradient(135deg, var(--role-color-dark), var(--theme-brand-800) 58%, var(--theme-brand-900)) !important;
  border-bottom: 3px solid var(--role-color);
}

body[class*="role-theme-"] .navbar.prudent-nav .navbar-nav .nav-link.active {
  background: var(--role-color-soft);
  box-shadow: inset 0 0 0 1px var(--role-color-glow);
}

body[class*="role-theme-"] .navbar.prudent-nav .dropdown-item:hover,
body[class*="role-theme-"] .navbar.prudent-nav .dropdown-item:focus {
  background: var(--role-color-soft);
  border-color: var(--role-color-glow);
}

body[class*="role-theme-"] .navbar.prudent-nav .dropdown-item:hover::before,
body[class*="role-theme-"] .navbar.prudent-nav .dropdown-item:focus::before,
body[class*="role-theme-"] .avatar-dot {
  background: var(--role-color);
  box-shadow: 0 0 0 3px var(--role-color-soft);
}

.user-pill-identity { align-items: flex-start; display: flex; flex-direction: column; gap: 1px; line-height: 1.05; }
.user-pill-name { font-size: .86rem; }
.user-role-label { color: color-mix(in srgb, var(--role-color) 58%, white); font-size: .61rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }

body[class*="role-theme-"] .header-actions > .dropdown:last-child > .user-pill {
  border-color: var(--role-color-glow);
  box-shadow: inset 0 0 0 1px var(--role-color-soft), 0 0 18px var(--role-color-soft);
}

.role-theme-insurance .btn-primary,
.role-theme-accounting .btn-primary,
.role-theme-admin .btn-primary {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
}

.role-theme-insurance .btn-primary:hover,
.role-theme-accounting .btn-primary:hover,
.role-theme-admin .btn-primary:hover {
  background-color: var(--theme-primary-hover);
  border-color: var(--theme-primary-hover);
}

.role-theme-insurance .btn-outline-primary,
.role-theme-accounting .btn-outline-primary,
.role-theme-admin .btn-outline-primary {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
}

.role-theme-insurance .btn-outline-primary:hover,
.role-theme-accounting .btn-outline-primary:hover,
.role-theme-admin .btn-outline-primary:hover {
  background-color: var(--theme-primary);
  color: white;
}

.role-theme-insurance :is(.form-control, .form-select):focus,
.role-theme-accounting :is(.form-control, .form-select):focus,
.role-theme-admin :is(.form-control, .form-select):focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 .2rem var(--role-color-soft);
}

@media (max-width: 520px) { .user-role-label { display: none; } }
