/* One-time code boxes (shared source, scripts: otp-boxes.js). Structure and states only; every colour and size comes from the --otp-* tokens that
   each platform maps to its own palette (palettes/*.css, appended to this file by build-otp-kit.mjs). Class prefix: otp-. */
.otp { display: grid; gap: 6px; min-width: 0; position: relative; }
.otp-label { font-weight: 650; font-size: .92rem; color: var(--otp-text, #111); }
.otp-hint { font-size: .875rem; color: var(--otp-muted, #444); }
.otp-row { display: grid; gap: var(--otp-gap, 6px); grid-template-columns: repeat(6, minmax(0, 1fr)); max-inline-size: 22rem; direction: ltr; }
.otp-len-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-inline-size: 12rem; }
.otp-len-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-inline-size: 15rem; }
.otp-len-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); max-inline-size: 18.5rem; }
.otp-len-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.otp-len-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); max-inline-size: 25rem; }
.otp-len-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); max-inline-size: 28rem; }
@media (max-width: 24rem) { .otp-row { --otp-gap: 4px; } }
.otp .otp-box {
  inline-size: 100%; min-inline-size: 0; block-size: 3rem; min-block-size: 44px; box-sizing: border-box; margin: 0; padding: 0; text-align: center;
  font-family: var(--otp-font, inherit); font-size: 1.5rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  border: 2px solid var(--otp-border, #555); border-radius: var(--otp-radius, 6px); background: var(--otp-bg, #fff); color: var(--otp-text, #111);
  caret-color: var(--otp-focus, #0b57d0); box-shadow: none;
}
.otp .otp-box:focus { border-color: var(--otp-focus, #0b57d0); outline: 3px solid var(--otp-focus, #0b57d0); outline-offset: 2px; }
.otp .otp-box.is-filled { border-color: var(--otp-accent, #0b57d0); background: var(--otp-accent-soft, #e8eefc); }
.otp .otp-box:disabled { opacity: .6; cursor: not-allowed; }
.otp .otp-row.has-error .otp-box { border-color: var(--otp-bad, #a52a1f); background: var(--otp-bad-bg, #fbe6e3); color: var(--otp-bad, #a52a1f); }
.otp .otp-row.has-error .otp-box:focus { outline-color: var(--otp-focus, #0b57d0); }
.otp .otp-msg { margin: 0; color: var(--otp-bad, #a52a1f); font-size: .9rem; font-weight: 600; }
.otp .otp-msg:empty { display: none; }
/* the one real field: present for the form, the password manager and the phone autofill, never seen */
.otp .otp-real { position: absolute; inset-inline-start: 0; inset-block-end: 0; inline-size: 1px; block-size: 1px; min-block-size: 0; margin: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .otp-row.is-shake { animation: otp-shake .45s ease-in-out; }
}
@keyframes otp-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@media (forced-colors: active) {
  .otp .otp-box { border-color: ButtonText; }
  .otp .otp-box:focus { outline-color: Highlight; }
  .otp .otp-box.is-filled { border-color: Highlight; }
}

/* palette mapping: the Elshai tokens (mh.css, light, dark and auto) */
:root {
  --otp-text: var(--text); --otp-muted: var(--muted); --otp-bg: var(--raise); --otp-border: var(--control); --otp-focus: var(--focus);
  --otp-accent: var(--primary); --otp-accent-soft: var(--primary-soft); --otp-bad: var(--bad); --otp-bad-bg: var(--bad-bg);
  --otp-radius: 6px; --otp-font: var(--font-ui, inherit);
}
