/* Nestaura sign-in code modal. Self-contained: every class is prefixed otp- so it can't
   collide with signin.css. Load it after signin.css. */
.otp-overlay {
  --otp-teal: #004d40;
  --otp-teal-deep: #00352c;
  --otp-teal-hover: #00614f;
  --otp-brass: #a97c43;
  --otp-mist: #f1f6f5;
  --otp-ink: #14231f;
  --otp-muted: #5b6b67;
  --otp-line: #d9e3e0;
  --otp-danger: #b3261e;
  --otp-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --otp-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --otp-ease: cubic-bezier(.2, .8, .2, 1);

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 28, 23, .6);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  font-family: var(--otp-sans);
  animation: otpFade .22s ease-out;
}
.otp-overlay[hidden] { display: none; }
html.otp-open, html.otp-open body { overflow: hidden; }

.otp-sheet {
  position: relative;
  width: min(100%, 440px);
  padding: 44px 36px 26px;
  border-radius: 22px;
  background: #fff;
  color: var(--otp-ink);
  text-align: center;
  box-shadow: 0 40px 90px -24px rgba(0, 24, 19, .6), 0 10px 28px -10px rgba(0, 24, 19, .35);
  animation: otpRise .34s var(--otp-ease);
}
.otp-sheet::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 56px; height: 3px;
  transform: translateX(-50%);
  border-radius: 0 0 3px 3px;
  background: var(--otp-brass);
}

/* Crest */
.otp-crest {
  display: grid;
  place-items: center;
  width: 68px; height: 68px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--otp-mist);
  color: var(--otp-teal);
  box-shadow: 0 0 0 1px rgba(169, 124, 67, .5), 0 0 0 9px rgba(0, 77, 64, .06);
  transition: background .3s var(--otp-ease), color .3s var(--otp-ease);
}
.otp-crest svg { width: 30px; height: 30px; }
.otp-crest .otp-ic-ok { display: none; }
.otp-sheet.is-success .otp-crest { background: var(--otp-teal); color: #fff; animation: otpPop .45s var(--otp-ease); }
.otp-sheet.is-success .otp-ic-mail { display: none; }
.otp-sheet.is-success .otp-ic-ok { display: block; }

.otp-title {
  margin: 0 0 8px;
  font-family: var(--otp-serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--otp-teal-deep);
}
.otp-lead { margin: 0 auto 26px; max-width: 320px; font-size: 15px; line-height: 1.6; color: var(--otp-muted); }
.otp-lead strong { color: var(--otp-ink); font-weight: 600; word-break: break-all; }

/* Code field: one real input (paste, autofill and screen readers work) laid over six display cells */
.otp-field { position: relative; margin: 0 auto 14px; max-width: 340px; }
.otp-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%; height: 100%;
  margin: 0; padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 1em;
  opacity: 0.01;
  cursor: text;
  -webkit-appearance: none;
  appearance: none;
}
.otp-input:focus { outline: none; }
.otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-cell {
  position: relative;
  display: grid;
  place-items: center;
  height: 62px;
  border: 1px solid var(--otp-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 53, 44, .05);
  font-family: var(--otp-serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1;
  color: var(--otp-teal-deep);
  transition: border-color .15s, background .15s, box-shadow .15s, color .15s;
}
.otp-cell.is-filled { border-color: #b7c7c3; background: var(--otp-mist); }
.otp-field.is-focused .otp-cell.is-active {
  border-color: var(--otp-teal);
  box-shadow: 0 0 0 4px rgba(0, 77, 64, .12), inset 0 -2px 0 var(--otp-brass);
}
.otp-field.is-focused .otp-cell.is-active:not(.is-filled)::after {
  content: "";
  width: 2px; height: 26px;
  border-radius: 2px;
  background: var(--otp-teal);
  animation: otpCaret 1.1s steps(1) infinite;
}
.otp-field.is-error .otp-cell { border-color: var(--otp-danger); background: #fdf3f2; color: var(--otp-danger); }
.otp-field.is-error { animation: otpShake .38s ease; }
.otp-sheet.is-success .otp-cell { border-color: var(--otp-teal); background: #e1efeb; color: var(--otp-teal); box-shadow: none; }

/* Status line */
.otp-status { min-height: 20px; margin: 0 0 14px; font-size: 14px; line-height: 1.4; color: var(--otp-muted); }
.otp-status.is-error { color: var(--otp-danger); }
.otp-status.is-info { color: #1b7a5a; }

/* Expiry */
.otp-timer { display: grid; gap: 8px; margin: 0 auto 22px; max-width: 340px; font-size: 13px; color: var(--otp-muted); }
.otp-timer-row { display: flex; justify-content: space-between; align-items: baseline; }
.otp-timer b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--otp-ink); }
.otp-bar { display: block; height: 3px; border-radius: 3px; background: var(--otp-line); overflow: hidden; }
.otp-bar i { display: block; height: 100%; width: 100%; border-radius: 3px; background: var(--otp-teal); transition: width .5s linear, background .3s; }
.otp-timer.is-low .otp-bar i { background: var(--otp-brass); }
.otp-timer.is-low b { color: var(--otp-brass); }
.otp-timer.is-expired b { color: var(--otp-danger); }
.otp-timer.is-expired .otp-bar i { width: 0 !important; }

/* Actions */
.otp-verify {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 54px;
  border: 0; border-radius: 12px;
  background: var(--otp-teal);
  color: #fff;
  font: 600 16px/1 var(--otp-sans);
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 20px -10px rgba(0, 53, 44, .7);
  transition: background .15s, transform .1s, opacity .15s;
}
.otp-verify:hover:not(:disabled) { background: var(--otp-teal-hover); }
.otp-verify:active:not(:disabled) { transform: translateY(1px); }
.otp-verify:disabled { opacity: .55; cursor: not-allowed; }
.otp-verify.is-loading { opacity: .85; cursor: progress; }
.otp-verify .otp-spin {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: otpSpin .8s linear infinite;
}
.otp-verify.is-loading .otp-spin { display: inline-block; }

.otp-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.otp-link {
  padding: 8px 2px;
  border: 0; background: none;
  font: 600 14px/1.2 var(--otp-sans);
  color: var(--otp-teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.otp-link:hover:not(:disabled) { color: var(--otp-teal-hover); }
.otp-link:disabled { color: var(--otp-muted); text-decoration: none; cursor: not-allowed; }
.otp-link.is-quiet { color: var(--otp-muted); font-weight: 500; }

.otp-assure {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 20px -8px 0;
  padding-top: 16px;
  border-top: 1px solid var(--otp-line);
  font-size: 12.5px; line-height: 1.5;
  color: var(--otp-muted);
  text-align: left;
}
.otp-assure svg { flex: none; width: 16px; height: 16px; color: var(--otp-brass); }

.otp-overlay :focus-visible { outline: 3px solid rgba(169, 124, 67, .55); outline-offset: 2px; border-radius: 6px; }

/* Phones: slides up as a bottom sheet */
@media (max-width: 560px) {
  .otp-overlay { align-items: flex-end; padding: 0; }
  .otp-sheet {
    width: 100%;
    padding: 40px 22px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    animation: otpSlide .38s var(--otp-ease);
  }
  .otp-cells { gap: 6px; }
  .otp-cell { height: 58px; font-size: 26px; }
  .otp-title { font-size: 27px; }
}

@keyframes otpFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes otpRise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes otpSlide { from { transform: translateY(100%); } to { transform: none; } }
@keyframes otpPop { 0% { transform: scale(.82); } 60% { transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes otpSpin { to { transform: rotate(360deg); } }
@keyframes otpCaret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes otpShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
  .otp-overlay, .otp-sheet, .otp-field, .otp-crest, .otp-cell::after { animation: none !important; }
  .otp-bar i, .otp-cell, .otp-verify { transition: none !important; }
}
