/* R140MFA - two-step verification UI. Tokens per theme; the page decides light/dark (data-r140-theme). */
.r140-ov, .r140-toast, .r140-login, .r140-lnote {
  --r140-bg: #141824; --r140-surface: #1b2030; --r140-surface2: #222839; --r140-line: rgba(255,255,255,.09);
  --r140-text: #f3f5fa; --r140-text2: #a6aec0; --r140-text3: #7d869b;
  --r140-accent: #8b6dff; --r140-accent-ink: #ffffff; --r140-accent-soft: rgba(139,109,255,.16);
  --r140-danger: #ff5a52; --r140-danger-soft: rgba(255,90,82,.14); --r140-ok: #34d27a; --r140-ok-soft: rgba(52,210,122,.14);
  --r140-warn: #ffb02e; --r140-warn-soft: rgba(255,176,46,.14); --r140-scrim: rgba(5,7,12,.62);
  --r140-shadow: 0 24px 64px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.3);
  --r140-r: 20px; --r140-r2: 14px;
}
[data-r140-theme="light"].r140-ov, [data-r140-theme="light"].r140-toast, [data-r140-theme="light"].r140-login, [data-r140-theme="light"].r140-lnote {
  --r140-bg: #ffffff; --r140-surface: #f5f6f9; --r140-surface2: #eceef3; --r140-line: rgba(10,16,32,.09);
  --r140-text: #0c1122; --r140-text2: #535b6e; --r140-text3: #7a8295;
  --r140-accent: #5b3df5; --r140-accent-soft: rgba(91,61,245,.10);
  --r140-danger: #d92d22; --r140-danger-soft: rgba(217,45,34,.08); --r140-ok: #138a4b; --r140-ok-soft: rgba(19,138,75,.10);
  --r140-warn: #a35f00; --r140-warn-soft: rgba(255,159,10,.14); --r140-scrim: rgba(12,17,34,.38);
  --r140-shadow: 0 24px 64px rgba(12,17,34,.18), 0 2px 8px rgba(12,17,34,.08);
}

/* overlay + sheet */
.r140-ov { position: fixed; inset: 0; background: var(--r140-scrim); display: flex; align-items: center; justify-content: center; padding: 24px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: r140-fade .18s ease-out; font-family: inherit; }
.r140-ov * { box-sizing: border-box; }
.r140-ov.r140-out { animation: r140-fade-out .18s ease-in forwards; }
.r140-sheet { width: 100%; max-width: 520px; max-height: min(88vh, 860px); overflow: auto; overscroll-behavior: contain; background: var(--r140-bg); color: var(--r140-text);
  border: 1px solid var(--r140-line); border-radius: var(--r140-r); box-shadow: var(--r140-shadow); padding: 22px 22px 18px; animation: r140-pop .22s cubic-bezier(.2,.9,.3,1.2);
  -webkit-font-smoothing: antialiased; line-height: 1.5; font-size: 15px; text-align: start; }
.r140-sheet.r140-wide { max-width: 600px; }
.r140-grab { display: none; }
.r140-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.r140-hicon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--r140-accent-soft); color: var(--r140-accent); }
.r140-hicon svg, .r140-ic svg, .r140-lic svg { width: 22px; height: 22px; }
.r140-htext { flex: 1; min-width: 0; }
.r140-htext h2 { margin: 2px 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--r140-text); }
.r140-htext p { margin: 0; color: var(--r140-text2); font-size: 14px; }
.r140-x { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--r140-surface); color: var(--r140-text2); display: grid; place-items: center; cursor: pointer; margin-inline-start: auto; }
.r140-x svg { width: 18px; height: 18px; }
.r140-x:hover { color: var(--r140-text); }
.r140-err { background: var(--r140-danger-soft); color: var(--r140-danger); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.r140-body { display: block; }
.r140-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.r140-foot:empty { display: none; }
.r140-busy { cursor: progress; }
.r140-busy .r140-body { opacity: .7; pointer-events: none; }

/* text */
.r140-lead { margin: 0 0 16px; color: var(--r140-text2); font-size: 15px; }
.r140-h3 { margin: 20px 0 8px; font-size: 13px; font-weight: 600; color: var(--r140-text3); letter-spacing: .02em; text-transform: none; }
.r140-sub, .r140-p { margin: 0 0 10px; color: var(--r140-text2); font-size: 14px; }
.r140-foot-note { margin: 14px 2px 0; color: var(--r140-text3); font-size: 13px; }
.r140-warn-t { color: var(--r140-warn) !important; }
.r140-danger-t { color: var(--r140-danger) !important; }
.r140-mt { margin-top: 12px; }
bdi { unicode-bidi: isolate; }

/* pills / tags */
.r140-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--r140-surface2); color: var(--r140-text2); }
.r140-pill-on { background: var(--r140-ok-soft); color: var(--r140-ok); }
.r140-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--r140-accent-soft); color: var(--r140-accent); vertical-align: 1px; }
.r140-tag-n { background: var(--r140-surface2); color: var(--r140-text2); }

/* choices + grouped rows */
.r140-choices { display: grid; gap: 10px; }
.r140-choice, .r140-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 14px; border-radius: var(--r140-r2); background: var(--r140-surface);
  border: 1px solid transparent; color: var(--r140-text); font: inherit; min-height: 64px; }
.r140-choice { cursor: pointer; transition: border-color .15s, transform .15s; }
.r140-choice:hover, .r140-item-add:hover { border-color: var(--r140-accent); }
.r140-choice:active { transform: scale(.995); }
.r140-group { background: var(--r140-surface); border-radius: var(--r140-r2); overflow: hidden; }
.r140-group .r140-item { border-radius: 0; background: transparent; }
.r140-group .r140-item + .r140-item { border-top: 1px solid var(--r140-line); }
.r140-item-add { cursor: pointer; }
.r140-item-add strong { color: var(--r140-accent); }
.r140-item-dim .r140-ic { opacity: .55; }
.r140-item-empty { min-height: 52px; }
.r140-ic { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--r140-accent-soft); color: var(--r140-accent); }
.r140-ic-lg { width: 44px; height: 44px; border-radius: 12px; }
.r140-it { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.r140-it strong { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r140-it span { font-size: 13px; color: var(--r140-text2); }
.r140-chev { color: var(--r140-text3); display: grid; place-items: center; }
.r140-chev svg { width: 18px; height: 18px; }
[dir="rtl"] .r140-chev svg { transform: scaleX(-1); }
.r140-acts { display: flex; gap: 4px; flex: 0 0 auto; }

/* controls */
.r140-btn { appearance: none; border: 0; border-radius: 12px; min-height: 44px; padding: 0 18px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: filter .15s, opacity .15s; }
.r140-btn:disabled { opacity: .45; cursor: not-allowed; }
.r140-primary { background: var(--r140-accent); color: var(--r140-accent-ink); }
.r140-primary:not(:disabled):hover { filter: brightness(1.08); }
.r140-ghost { background: var(--r140-surface2); color: var(--r140-text); }
.r140-danger { background: var(--r140-danger); color: #fff; }
.r140-danger-ghost { background: transparent; color: var(--r140-danger); margin-inline-end: auto; padding: 0 6px; }
.r140-block { width: 100%; }
.r140-link { appearance: none; background: none; border: 0; padding: 8px 8px; min-height: 40px; color: var(--r140-accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 8px; }
.r140-link:hover { background: var(--r140-accent-soft); }
.r140-link:disabled { color: var(--r140-text3); background: none; cursor: default; }
.r140-muted { color: var(--r140-text2) !important; font-weight: 500; }
.r140-label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--r140-text2); }
.r140-input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--r140-line); background: var(--r140-surface); color: var(--r140-text); padding: 0 14px; font: inherit; font-size: 16px; }
.r140-ta { padding: 12px 14px; min-height: 84px; resize: vertical; }
.r140-input:focus, .r140-code:focus { outline: none; border-color: var(--r140-accent); box-shadow: 0 0 0 4px var(--r140-accent-soft); }
.r140-code { display: block; width: 100%; max-width: 280px; margin: 10px auto 4px; height: 58px; border-radius: 14px; border: 1px solid var(--r140-line); background: var(--r140-surface);
  color: var(--r140-text); text-align: center; font: 600 28px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .32em; padding: 0 0 0 .32em; }
.r140-code-text { font-size: 22px; letter-spacing: .12em; text-transform: uppercase; }
.r140-code::placeholder { color: var(--r140-text3); opacity: .55; }
.r140-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--r140-surface2); margin: 2px 0 6px; max-width: 100%; overflow-x: auto; }
.r140-seg-full { display: flex; }
.r140-seg button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--r140-text2); font: inherit; font-size: 13.5px; font-weight: 600; min-height: 36px; padding: 0 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.r140-seg button[aria-selected="true"], .r140-seg button[aria-checked="true"] { background: var(--r140-bg); color: var(--r140-text); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.r140-check { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 0; font-size: 14px; cursor: pointer; color: var(--r140-text); }
.r140-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--r140-accent); flex: 0 0 auto; }
.r140-check small { display: block; color: var(--r140-text3); font-size: 12.5px; }
.r140-radios { border: 0; padding: 0; margin: 0; }
.r140-radios .r140-check { margin: 8px 0 0; }
.r140-row2 { display: flex; justify-content: center; margin: 4px 0 0; }
.r140-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }

/* totp setup */
.r140-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.r140-steps > li { position: relative; padding-inline-start: 38px; margin: 0 0 18px; counter-increment: s; }
.r140-steps > li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--r140-accent-soft); color: var(--r140-accent); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.r140-steps p { margin: 2px 0 8px; }
.r140-apps { font-size: 12.5px; color: var(--r140-text3); }
.r140-qrwrap { display: flex; justify-content: center; margin: 8px 0 4px; }
.r140-qr { width: 200px; height: 200px; border-radius: 14px; background: #fff; padding: 8px; image-rendering: pixelated; }
.r140-det summary { cursor: pointer; color: var(--r140-accent); font-size: 14px; font-weight: 600; margin: 10px 0 4px; list-style: none; }
.r140-det summary::-webkit-details-marker { display: none; }
.r140-keybox { margin-top: 10px; background: var(--r140-surface); border-radius: 12px; padding: 10px 12px; }
.r140-klabel, .r140-ksub { display: block; font-size: 12.5px; color: var(--r140-text3); }
.r140-krow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.r140-krow code { font: 600 15px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; word-break: break-all; color: var(--r140-text); }

/* backup codes */
.r140-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: var(--r140-surface); padding: 12px; border-radius: var(--r140-r2); }
.r140-codes code { font: 600 15.5px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; padding: 11px 8px; text-align: center; border-radius: 9px; background: var(--r140-bg); color: var(--r140-text); }

/* banners, skeleton, toast */
.r140-banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px; margin: 0 0 14px; }
.r140-banner svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.r140-banner p { margin: 0; font-size: 14px; }
.r140-banner-warn { background: var(--r140-warn-soft); color: var(--r140-text); }
.r140-banner-warn svg { color: var(--r140-warn); }
.r140-banner .r140-link { padding-inline: 0; }
.r140-skel { height: 64px; border-radius: 14px; margin: 0 0 10px; background: linear-gradient(90deg, var(--r140-surface) 25%, var(--r140-surface2) 50%, var(--r140-surface) 75%); background-size: 200% 100%; animation: r140-shim 1.2s linear infinite; }
.r140-skel-s { height: 40px; width: 60%; }
.r140-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--r140-text); color: var(--r140-bg); padding: 12px 18px; border-radius: 14px; font-size: 14.5px; font-weight: 600; box-shadow: var(--r140-shadow); animation: r140-up .2s ease-out; max-width: calc(100vw - 32px); }
.r140-toast-err { background: var(--r140-danger); color: #fff; }
.r140-toast.r140-out { opacity: 0; transition: opacity .25s; }

/* sign-in page */
.r140-login .r140-lwrap { display: flex; flex-direction: column; gap: 4px; }
.r140-lhead { text-align: center; margin-bottom: 10px; }
.r140-lic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--r140-accent-soft); color: var(--r140-accent); }
.r140-lic svg { width: 28px; height: 28px; }
.r140-ltitle { font-size: 20px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
.r140-lsub { margin: 0; color: var(--r140-text2); font-size: 14.5px; line-height: 1.6; }
.r140-lp { margin: 4px 0 10px; color: var(--r140-text2); font-size: 14.5px; line-height: 1.65; }
.r140-lp.r140-ok { color: var(--r140-ok); }
.r140-lerr { background: var(--r140-danger-soft); color: var(--r140-danger); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 6px 0; text-align: center; }
.r140-login .r140-code { margin: 6px auto 0; }
.r140-lrow { display: flex; justify-content: center; }
.r140-lbtn { width: 100%; margin-top: 12px; min-height: 48px; }
.r140-ltrust { justify-content: center; margin: 12px 0 0; }
.r140-lalt { display: flex; flex-direction: column; align-items: center; margin-top: 10px; }
.r140-login .r140-group { margin: 6px 0; }
.r140-lnote { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.6; }
.r140-lnote.r140-ok { background: var(--r140-ok-soft); color: var(--r140-ok); }
.r140-lnote.r140-bad { background: var(--r140-danger-soft); color: var(--r140-danger); }

/* phone: bottom sheet */
@media (max-width: 640px) {
  .r140-ov { align-items: flex-end; padding: 0; }
  .r140-sheet, .r140-sheet.r140-wide { max-width: none; max-height: 94vh; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); animation: r140-slide .26s cubic-bezier(.2,.9,.3,1); }
  .r140-grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--r140-line); margin: 0 auto 12px; }
  .r140-foot { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--r140-bg); padding: 12px 0 calc(4px + env(safe-area-inset-bottom)); margin: 12px 0 0; }
  .r140-foot .r140-btn { flex: 1 1 auto; }
  .r140-foot .r140-danger-ghost { flex: 1 1 100%; order: 2; }
  .r140-acts { flex-direction: column; align-items: flex-end; gap: 0; }
  .r140-row3 { grid-template-columns: 1fr 1fr; }
  .r140-row3 .r140-btn:last-child { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) { .r140-ov, .r140-sheet, .r140-toast { animation: none !important; } .r140-skel { animation: none; } }
@keyframes r140-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes r140-fade-out { to { opacity: 0; } }
@keyframes r140-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes r140-slide { from { transform: translateY(100%); } to { transform: none; } }
@keyframes r140-up { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes r140-shim { to { background-position: -200% 0; } }
