/* --- Base Layout --- */
html {
  scroll-behavior: smooth;
}

header {
  width: 100%;
  background: #efeff1;
  padding: 0.8em max(12px, env(safe-area-inset-right)) 0.8em max(12px, env(safe-area-inset-left));
  padding-top: max(0.8em, env(safe-area-inset-top));
  box-shadow: 0 2px 8px #0001;
  position: relative;
  z-index: 100;
  --nav-row-h: 56px;
  --idle-row-h: 24px;
}

.header-content {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: var(--nav-row-h) var(--idle-row-h);
  align-items: center;
  column-gap: 1rem;
  padding: 0 2em;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  width: 90%;
  padding: 0 2em;
}

footer {
  width: 100%;
  background: #efeff1;
  padding: 1.2em 0;
  box-shadow: 0 -1px 8px #0001;
  position: relative;
  margin-top: 2em;
  color: #444;
  font-size: 1em;
}

.logo {
  text-align: left;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}

.logo img {
  max-height: 80px;
}

.title {
  font-size: 1.4em;
  color: #444;
  font-weight: 600;
  margin-left: 0.5em;
  flex-shrink: 0;
}

/* Nav sits in row 1, right-aligned */
header .header-content nav {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: flex;
  gap: 1.25rem;
}

nav a {
  color: #008cd3;
  text-decoration: none;
  font-size: 1em;
  font-weight: 500;
}

nav a:hover, nav a:focus {
  text-decoration: underline;
  color: #008cd3;
}

body {
  margin: 0;
  background: #f6f8fa;
  min-height: 100vh;
  font-family: 'Segoe UI', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

/* --- Main Content Area --- */
main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 60vh;
}

/* --- Auth Card and Form Styles --- */
.auth-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px 0 #0002;
  max-width: 370px;
  width: 100%;
  padding: 2.2em 2em 2em 2em;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  align-items: center;
}

.auth-card h1, .auth-card h2 {
  color: #124191;
  font-size: 1.4em;
  margin: 0;
  font-weight: 700;
}

.divider-under-h2 {
  border: none;
  border-top: 2px solid #bbb;
  width: 100%;
  margin: 0.2em 0 1.2em 0;
}

.step-label {
  font-size: 1em;
  font-weight: 500;
  color: #3d4251;
  margin-bottom: 0.5em;
  text-align: left;
}

.input-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  margin-bottom: 0.6em;
  position: relative;
}

input[type="email"],
input[type="tel"],
input[type="text"],
input[type="number"],
input[type="password"] {
  padding: 0.8em;
  font-size: 1em;
  border: 1px solid #d4d7dd;
  border-radius: 7px;
  outline: none;
  width: 100%;
  background: #f6f8fa;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

input:focus {
  border-color: #008cd3;
  background: #fff;
}

.toggle-visibility {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.35em;
  user-select: none;
  color: #555;
  background: none;
  border: none;
  outline: none;
  padding: 0 2px;
}

button, .button {
  width: 100%;
  background: #008cd3;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.5em 0.9em;
  font-size: 1em;
  font-weight: 400;
  box-shadow: 0 2px 6px #12419122;
  cursor: pointer;
  transition: background 0.2s;
}

.button-inline {
  width: auto;
  display: inline-block;
  align-self: flex-start;
}

#closeBtn {
  width: auto !important;
  display: inline-flex;
  align-self: center;
}

.privacy-card {
  align-items: flex-start;
}

.privacy-card h2 {
  margin-top: 20px;
  width: 100%;
}

button:disabled, .button:disabled {
  background: #9ca3af;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
}

#changeBtnDisabled:disabled {
  background: #9ca3af;
  color: #fff;
}

#changeBtnDisabled:not(:disabled) {
  background: #2176ff;
  color: #fff;
}

.table-actions {
  display: flex;
  flex-direction: row;
  gap: 0.6em;
  align-items: center;
  justify-content: flex-start;
}

.table-actions button {
  width: auto !important;
  flex: 0 0 auto;
  min-width: 82px;
}

.table-actions button:last-child {
  margin-right: 0;
}

.info, .success, .error {
  font-size: 0.98em;
  padding: 0.65em;
  border-radius: 6px;
  margin-bottom: 0.7em;
  text-align: center;
}

.info { background: #f3f7fa; color: #124191; }
.success { background: #e6fff4; color: #00875a; }
.error { background: #fff0f2; color: #bb2124; }

.optional {
  font-size: 0.92em;
  color: #6a6e7c;
  margin-bottom: 0.3em;
}

.divider {
  border: none;
  border-top: 1px solid #eaeaea;
  margin: 0.3em 0 0.5em 0;
}

.loading-dot {
  font-size: 1.3em;
  animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0.5; } }

.qr-section {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  align-items: center;
  margin-top: 1em;
}

.qr-section img {
  margin-top: 0.5em;
  border: 1px solid #eaeaea;
  border-radius: 5px;
  background: #fff;
  width: 148px;
  height: 148px;
}

/* --- Tooltip Styles --- */
.has-tooltip {
  position: relative;
  display: inline-block;
}

.has-tooltip .tooltip-text {
  visibility: hidden;
  background: hsl(192, 90%, 80%);
  color: #000000;
  text-align: center;
  border-radius: 4px;
  padding: 6px 12px;
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 125%;
  transform: translateX(-50%);
  white-space: pre-line;
  opacity: 0;
  transition: opacity 0.25s;
  font-size: 0.95em;
  box-shadow: 0 2px 10px #0001;
  min-width: 180px;
  max-width: 320px;
  width: 220px;
}

.has-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* --- Paragraphs, etc --- */
p {
  font-size: 1rem;
  color: #222;
  line-height: 1.5em;
  text-align: center;
  margin: 0 0 1em 0;
}

p1 {
  font-size: 1rem;
  color: #222;
  line-height: 1.5em;
  text-align: left;
  display: block;
  margin: 0 0 1em 0;
}

/* --- Password Strength Bar (if present) --- */
#strengthMeter {
  height: 8px;
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 4px;
  margin-top: 0.5em;
}

#strengthBar {
  height: 100%;
  width: 0%;
  background-color: red;
  border-radius: 4px;
  transition: width 0.3s, background-color 0.3s;
}

#matchIndicator {
  margin-top: 0.2em;
  font-weight: bold;
  font-size: 0.9em;
  text-align: left;
}

.disabled-block {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(80%);
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  padding: 0 2em;
}

.footer-legal a {
  color: #008cd3;
  text-decoration: none;
  font-weight: 500;
}

.footer-legal a:hover, .footer-legal a:focus {
  text-decoration: underline;
}

.footer-legal {
  font-size: 0.95em;
  color: #666;
}

/* Timer sits in row 2 — no margins so it doesn't push anything */
.idle-note {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  pointer-events: none;
  transition: opacity 0.18s ease;
  white-space: normal;
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
}

/* When JS adds .show, it fades in without changing layout */
.idle-note.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Action rows take the full line so the CTA has room to grow */
#emailOtpForm .email-otp-actions,
#phoneForm .phone-send-actions,
#phoneOtpForm .phone-otp-actions,
#totpActions {
  display: flex;
  width: 100%;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Default inside action rows: don't stretch */
#emailOtpForm .email-otp-actions button,
#phoneForm .phone-send-actions button,
#phoneOtpForm .phone-otp-actions button,
#totpActions button {
  width: auto !important;
  min-width: 0;
  white-space: nowrap;
}

/* Make the primary "Verify" button fill remaining space */
#verifyEmailOtpBtn,
#phoneForm #sendPhoneOtpBtn,
#verifyPhoneOtpBtn,
#totpActions #enrollMfaBtn {
  flex: 1 1 auto;
  min-width: 8rem;
}

/* Keep the secondary button styled as grey */
.email-otp-cancel,
#phoneForm .skip-sms-btn,
.skip-sms-btn,
#totpActions .skip-totp-btn {
  background: #bbb;
  color: #222;
  flex: 0 0 auto;
}

/* Keep secondary buttons content-sized */
#emailOtpForm .email-otp-actions .email-otp-cancel,
#phoneOtpForm .phone-otp-actions .skip-sms-btn,
#phoneMsg .phone-otp-actions .skip-sms-btn,
#phoneMsg .phone-otp-actions #retrySendSmsBtn,
#totpActions .action-row .skip-totp-btn,
#skipLink.email-otp-cancel {
  flex: 0 0 auto !important;
}

/* Ensure action-row buttons sit side-by-side */
#phoneMsg .phone-otp-actions,
#totpActions .action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 420px) {
  #emailOtpForm .email-otp-actions,
  #phoneForm .phone-send-actions,
  #phoneOtpForm .phone-otp-actions,
  #totpActions {
    flex-wrap: wrap;
  }
}

/* Optional: mobile tweak */
@media (max-width: 640px) {
  header {
    --nav-row-h: 50px;
    --idle-row-h: 22px;
  }
  .idle-note {
    font-size: 0.85rem;
    padding: 4px 8px;
  }
  main {
    padding: 1rem 0.5rem;
  }
}

/* Ensure forms inside the card actually take full width */
.auth-card form {
  width: 100%;
}

.green-button {
  background: #b7131e !important;
  color: #fff !important;
}

@keyframes mfa-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

.mfa-inline-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  border: 0.18em solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: mfa-spin 0.9s linear infinite;
  vertical-align: -0.15em;
}

.btn-busy {
  opacity: 0.8;
  pointer-events: none;
}

/* Overrides: button { width:100% } */
#cancelLink,
#skipLink {
  width: auto !important;
  display: inline-flex;
  padding: 0.5em 0.9em;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 0.75rem auto 1rem;
  width: min(100%, 1100px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.banner-warning {
  background: #fff4e5;
  border: 1px solid #ffd9a6;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.banner-cta {
  font-weight: 600;
  text-decoration: underline;
}

.banner-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: #333;
}

/* --- Password Banner (styled to match existing UI) --- */
#banner-slot {
  max-width: 1100px;
  margin: 0.6rem auto 0.8rem;
  padding: 0 2em;
}

/* card look aligned with .auth-card (radius/shadow) */
.banner-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 16px;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 6px 24px 0 #0002;
  padding: 12px 14px;
  position: relative;
}

/* subtle left accent to suggest "warning", fits your palette */
.banner-warning::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.banner-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-body {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #124191;
}

.banner-text {
  margin: 0;
  color: #222;
  font-size: 1.2rem;
}

.banner-actions {
  margin: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* local button styles that don't fight your global `button{width:100%}` */
.banner-actions .btn,
.banner-x {
  width: auto !important;
}

/* primary button uses your accent blue */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.45em 0.9em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px #12419122;
  transition: background 0.2s, filter 0.15s, transform 0.04s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #008cd3;
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* secondary (postpone) button uses your grey tones */
.btn-secondary {
  background: #efeff1;
  color: #222;
  border-color: #d4d7dd;
}

.btn-secondary:hover {
  background: #e9ebef;
}

/* compact close button on the right */
.banner-x {
  background: #efeff1;
  border: 1px solid #d4d7dd;
  border-radius: 7px;
  width: 32px !important;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #222;
  cursor: pointer;
}

.banner-x:hover {
  background: #e9ebef;
}

/* small screens: keep it tidy */
@media (max-width: 540px) {
  #banner-slot {
    padding: 0 1em;
  }
  .banner-card {
    grid-template-columns: auto 1fr;
  }
  .banner-x {
    grid-column: 2;
    justify-self: end;
    margin-top: 4px;
  }
}

/* A11y helper */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Desktop: hide the toggle button */
@media (min-width: 641px) {
  .nav-toggle {
    display: none;
  }
}

/* Mobile: hamburger + overlay styles */
@media (max-width: 640px) {
  /* Keep your grid (logo left, toggle right) */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-left: auto;
    background: #efeff1;
    color: #222;
    border: 1px solid #d4d7dd;
    border-radius: 7px;
    padding: 0.45em 0.6em;
    box-shadow: 0 2px 6px #12419122;
    width: 40px;
    height: 36px;
  }

  .nav-toggle .burger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 22px;
    height: 18px;
  }

  .nav-toggle .bar {
    width: 22px;
    height: 2px;
    background: #222;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }

  .nav-toggle[aria-expanded="true"] .bar1 {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .bar2 {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] .bar3 {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Hide nav by default on mobile (JS will overlay it) */
  header .header-content nav {
    display: none;
  }

  /* Backdrop covers the whole viewport when open */
  body.nav-overlay-open #nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: block;
  }

  /* The NAV becomes a fixed overlay panel (independent of layout) */
  body.nav-overlay-open #site-nav {
    position: fixed;
    top: var(--navTop, 64px);
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 6px 24px 0 #0002;
    padding: 8px;
    z-index: 2001;
  }

  /* Touch-friendly link rows */
  body.nav-overlay-open #site-nav a {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    color: #008cd3;
    text-decoration: none;
    font-weight: 500;
  }

  body.nav-overlay-open #site-nav a:hover,
	  body.nav-overlay-open #site-nav a:focus {
		background: #f3f7fa;
		text-decoration: none;
	  }
	  
	#audit-table {
	  table-layout: auto !important;
	}

	#audit-table th,
	#audit-table td {
	  white-space: nowrap;
	}

	#audit-table td.metadata-cell {
	  min-width: 420px;
	  max-width: 900px;
	  white-space: pre-wrap;
	  word-break: break-word;
	}
}