.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}
.auth-modal.is-open { display: flex; }
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}
.auth-modal-dialog { position: relative; z-index: 1; max-width: 480px; width: 100%; margin: 1.5rem; }

.auth-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #9ca3af;
  padding: 0.1rem 0.25rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.auth-modal-close:hover { background: rgba(15, 23, 42, 0.06); color: #4b5563; transform: translateY(-0.5px); }

.auth-page { min-height: auto; display: block; padding: 0; background: transparent; }
.auth-card {
  width: 100%;
  background: #ffffff;
  border-radius: 18px;
  padding: 2.2rem 2rem 2rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.auth-header { margin-bottom: 1.8rem; }
.auth-title { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; margin: 0 0 0.25rem; color: var(--attvin-blue-dark); letter-spacing: -0.01em; }
.auth-subtitle { margin: 0; font-size: 0.9rem; color: #6b7280; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-label-row { display: flex; justify-content: space-between; align-items: center; }
.auth-label { font-size: 0.85rem; font-weight: 500; color: #4b5563; }

.auth-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  background-color: #f9fafb;
  color: #111827;
}
.auth-input:focus {
  border-color: #0065C1;
  box-shadow: 0 0 0 1px rgba(0, 101, 193, 0.12);
  background-color: #ffffff;
}

.auth-error { min-height: 1.1rem; font-size: 0.8rem; color: #dc2626; }
.auth-footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.auth-footer-text { font-size: 0.8rem; color: #6b7280; }
.auth-footer-link { font-size: 0.8rem; font-weight: 500; color: #0065C1; text-decoration: none; }
.auth-footer-link:hover { text-decoration: underline; }
.auth-footer-message { font-size: 0.78rem; color: #059669; margin-top: 0.5rem; }

.account-picker-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.account-picker-item {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, background-color 0.15s ease;
  color: #111827;
}
.account-picker-item:hover {
  border-color: #0065C1;
  box-shadow: 0 8px 18px rgba(0, 101, 193, 0.12);
  transform: translateY(-1px);
  background-color: #f9fafb;
}
.account-picker-item--loading { opacity: 0.6; cursor: wait; }

.account-picker-item-inner { display: flex; align-items: center; gap: 0.75rem; }
.account-picker-avatar {
  width: 32px; height: 32px; border-radius: 999px; overflow: hidden; flex-shrink: 0;
  background: #e5e7eb; display: flex; align-items: center; justify-content: center;
}
.account-picker-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-picker-avatar-fallback {
  width: 100%; height: 100%; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.9rem; background: #0065c1; color: #ffffff;
}
.account-picker-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.account-picker-name { font-size: 0.95rem; font-weight: 500; color: #111827; }
.account-picker-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.78rem; color: #6b7280; }
.account-picker-role { padding: 0.1rem 0.4rem; border-radius: 999px; background: #CCE0F3; color: #004382; font-weight: 500; }

.account-picker-back { margin-top: 1.25rem; border: none; background: transparent; padding: 0; cursor: pointer; }

#no-account-panel { margin-top: 1rem; }
.no-account-card { border-radius: 14px; padding: 1.25rem 1rem; background: #fef3c7; border: 1px solid #facc15; color: #78350f; }
.no-account-card .auth-title { margin-bottom: 0.3rem; font-size: 1.1rem; }
#no-account-message { margin: 0; font-size: 0.85rem; color: #78350f; }

.auth-footer-link.is-disabled { pointer-events: none; opacity: 0.6; text-decoration: none; }
.forgot-spinner {
  display: none; width: 12px; height: 12px; border-radius: 999px; border: 2px solid currentColor;
  border-top-color: transparent; margin-left: 0.4rem; vertical-align: -2px;
  animation: forgotSpin 0.8s linear infinite;
}
.auth-footer-link.is-loading .forgot-spinner { display: inline-block; }
@keyframes forgotSpin { to { transform: rotate(360deg); } }

@media (max-width: 480px) { .auth-card { padding: 1.8rem 1.4rem 1.6rem; } }

/* ===== Fane-veksling (Logg inn / Få tilgang) ===== */
.auth-top { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.2rem; }
.auth-title-sm { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.2rem; color: #020617; }
.auth-switch {
  display: flex; gap: 0.4rem; background: #f1f5f9; border: 1px solid #e2e8f0;
  padding: 0.3rem; border-radius: 999px; width: fit-content;
}
.auth-switch-btn {
  border: none; background: transparent; padding: 0.45rem 0.9rem; border-radius: 999px;
  font-weight: 600; font-size: 0.85rem; cursor: pointer; color: #334155;
  transition: background-color 0.15s ease, transform 0.08s ease, color 0.15s ease;
}
.auth-switch-btn:hover { transform: translateY(-0.5px); }
.auth-switch-btn.is-active {
  background: #fff; box-shadow: 0 8px 18px rgba(0, 101, 193, 0.12);
  color: #004382;
}
.auth-view[hidden] { display: none; }
.auth-footer { margin-top: 1rem; font-size: 0.82rem; color: #64748b; text-align: center; }
.auth-footer-link { font-weight: 600; color: #0065C1; text-decoration: none; }
.auth-footer-link:hover { text-decoration: underline; }
.no-account-cta { margin-top: 0.9rem; display: flex; justify-content: center; }

/* ===== Få tilgang (Brreg-søk) ===== */
.access-badge {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.6rem;
  border-radius: 999px; background: #CCE0F3; color: #004382; font-weight: 700; font-size: 0.75rem;
  margin-bottom: 0.6rem;
}
.access-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 560px) { .access-split { grid-template-columns: 1fr; } }
.access-help { margin-top: 0.35rem; font-size: 0.78rem; color: #64748b; }
.access-search-wrap { position: relative; }
.access-search-input { padding-left: 2.2rem; }
.access-search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 0.95rem; opacity: 0.55; pointer-events: none; }
.access-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  overflow: hidden; z-index: 2; max-height: 320px; overflow-y: auto;
}
.access-result-item {
  padding: 0.8rem 0.9rem; cursor: pointer; border-top: 1px solid #f1f5f9;
  transition: background-color 0.12s ease, transform 0.08s ease;
  display: flex; gap: 0.8rem; align-items: flex-start;
}
.access-result-item:first-child { border-top: none; }
.access-result-item:hover { background: #f5faff; transform: translateY(-0.5px); }
.access-result-left {
  width: 34px; height: 34px; border-radius: 999px; background: #004382; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0;
}
.access-result-name { font-weight: 700; color: #0f172a; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-result-meta { margin-top: 0.2rem; font-size: 0.78rem; color: #64748b; display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; }
.access-dot { opacity: 0.5; }
.access-company-card {
  border: 1px solid #e5e7eb; border-radius: 16px; padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); margin-top: 0.25rem;
}
.access-company-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.access-company-name { font-size: 1.05rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.access-company-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.access-pill { font-size: 0.75rem; color: #0f172a; background: #f1f5f9; border: 1px solid #e2e8f0; padding: 0.18rem 0.5rem; border-radius: 999px; }
.access-pill.muted { color: #475569; }
.access-change {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 999px;
  padding: 0.35rem 0.6rem; font-size: 0.78rem; font-weight: 700; cursor: pointer; color: #334155;
  transition: box-shadow 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}
.access-change:hover { border-color: #CCE0F3; box-shadow: 0 10px 18px rgba(0, 101, 193, 0.10); transform: translateY(-0.5px); }
.access-company-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 0.9rem; }
@media (max-width: 560px) { .access-company-grid { grid-template-columns: 1fr; } }
.access-kv .k { font-size: 0.72rem; color: #64748b; font-weight: 700; margin-bottom: 0.15rem; }
.access-kv .v { font-size: 0.86rem; color: #0f172a; }
.access-check { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.82rem; color: #475569; margin-top: 0.25rem; }
.access-check input { margin-top: 0.15rem; }
.access-button { margin-top: 0.25rem; position: relative; }
.access-button.is-loading { pointer-events: none; opacity: 0.85; }
.access-button .btn-spinner {
  display: none; width: 14px; height: 14px; border-radius: 999px; border: 2px solid currentColor;
  border-top-color: transparent; margin-left: 0.5rem; animation: accessSpin 0.8s linear infinite;
}
.access-button.is-loading .btn-spinner { display: inline-block; }
@keyframes accessSpin { to { transform: rotate(360deg); } }
.access-success {
  margin-top: 0.75rem; font-size: 0.85rem; color: #059669; background: #ecfdf5;
  border: 1px solid #a7f3d0; border-radius: 12px; padding: 0.7rem 0.8rem;
}
