:root {
  color-scheme: dark;
  --tv-card-radius: 20px;
  --tv-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  --tv-border: rgba(255, 255, 255, 0.16);
  --tv-text: rgba(255, 255, 255, 0.92);
  --tv-text-dim: rgba(255, 255, 255, 0.72);
  --tv-bg: #0b1020;
  --tv-danger: #ef4444;
  --tv-warning: #f59e0b;
  --tv-success: #10b981;
  --tv-space-1: 6px;
  --tv-space-2: 10px;
  --tv-space-3: 14px;
  --tv-focus-ring: rgba(255, 255, 255, 0.22);
}

/* Layout + typography reset (Keycloak base styles vary) */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* iOS Safari: prevent horizontal drift due to fixed/blur layers */
}

/* Base */
body {
  background: var(--tv-bg);
  color: var(--tv-text);
  font-family: inherit;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* iOS Safari: avoid initial scrollX offset */
}

.tv-required {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
}

.tv-steps {
  margin: 14px 0 18px;
  padding-left: 18px;
  padding-right: 18px; /* keep content visually centered inside card (incl. QR) */
  color: var(--tv-text);
}

.tv-steps > li {
  margin: 10px 0;
}

.tv-steps-title {
  font-weight: 650;
  color: rgba(255, 255, 255, 0.92);
}

.tv-steps-body {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.45;
}

.tv-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
}

.tv-qr {
  width: 168px;
  height: 168px;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  display: block;
  margin: 0 auto;
}

.tv-qr-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.tv-otp-spacer {
  height: 84px;
}

@media (max-width: 560px) {
  .tv-otp-spacer {
    height: 140px;
  }
}

.tv-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 0;
  width: 100%;
  max-width: 100%;
  /* Default focus ring; overridden per product */
  --tv-focus-ring: rgba(255, 255, 255, 0.22);
}

.tv-shell::before,
.tv-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 480ms ease;
}

/* ERP background layer (default) */
.tv-shell::before {
  opacity: 1;
  background:
    radial-gradient(1100px 900px at 18% 14%, rgba(79, 70, 229, 0.26), transparent 62%),
    radial-gradient(900px 700px at 82% 18%, rgba(255, 255, 255, 0.06), transparent 58%),
    linear-gradient(135deg, #060914 0%, #0b1020 46%, #050816 100%);
}

/* Messenger background layer */
.tv-shell::after {
  opacity: 0;
  background:
    radial-gradient(1100px 900px at 18% 14%, rgba(244, 129, 32, 0.32), transparent 62%),
    radial-gradient(900px 700px at 82% 18%, rgba(255, 255, 255, 0.06), transparent 58%),
    linear-gradient(135deg, #060914 0%, #0b1020 46%, #050816 100%);
}

.tv-shell[data-tv-product="messenger"]::before {
  opacity: 0;
}
.tv-shell[data-tv-product="messenger"]::after {
  opacity: 1;
}

.tv-shell[data-tv-product="erp"] {
  --tv-focus-ring: rgba(79, 70, 229, 0.35);
}
.tv-shell[data-tv-product="messenger"] {
  --tv-focus-ring: rgba(244, 129, 32, 0.38);
}

.tv-enter .tv-card,
.tv-enter .tv-underlay {
  opacity: 0;
  transform: translateY(8px) scale(0.99);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tv-enter.tv-enter--in .tv-card,
.tv-enter.tv-enter--in .tv-underlay {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* NOTE: tabs in multi login are UI-only; avoid adding any "switching" hide transitions here. */

@media (prefers-reduced-motion: reduce) {
  .tv-enter .tv-card,
  .tv-enter .tv-underlay {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.tv-card {
  /* Use % instead of vw to avoid iOS Safari horizontal drift when container has padding */
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-card-radius);
  box-shadow:
    var(--tv-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 22px 22px 18px 22px;
  position: relative;
  z-index: 2;
}

.tv-shell[data-tv-product="messenger"] .tv-card {
  box-shadow:
    var(--tv-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tv-underlay {
  /* Centered, and sized relative to padded container to prevent horizontal overflow on iOS Safari */
  width: min(480px, calc(100% - 48px));
  height: 90px;
  border-radius: 28px;
  position: absolute;
  left: 0;
  right: 0;
  margin-inline: auto;
  transform: translateY(190px);
  filter: blur(0px);
  opacity: 0.95;
  z-index: 1;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.0), rgba(79, 70, 229, 0.35), rgba(79, 70, 229, 0.0));
}

.tv-shell[data-tv-product="erp"] .tv-underlay {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.0), rgba(79, 70, 229, 0.45), rgba(79, 70, 229, 0.0));
}

.tv-shell[data-tv-product="messenger"] .tv-underlay {
  background: linear-gradient(90deg, rgba(244, 129, 32, 0.0), rgba(244, 129, 32, 0.55), rgba(244, 129, 32, 0.0));
}

.tv-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.tv-locale {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tv-locale-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--tv-text);
  font-weight: 650;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.tv-locale-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tv-locale-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--tv-focus-ring);
}

.tv-locale-flag,
.tv-locale-option-flag {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.tv-locale-current {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-locale-caret {
  opacity: 0.8;
  font-weight: 800;
}

.tv-locale-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  /* Prevent small horizontal overflow on mobile */
  width: min(320px, calc(100vw - 48px));
  border-radius: 14px;
  background: rgba(10, 14, 28, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  padding: 10px;
  z-index: 20;
}

.tv-locale-search-wrap {
  margin-bottom: 8px;
}

.tv-locale-search {
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--tv-text);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.14);
  outline: none;
  font-size: 14px;
}

.tv-locale-search:focus-visible {
  border-color: rgba(255, 255, 255, 0.30);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.tv-locale-list {
  display: grid;
  gap: 6px;
  max-height: 250px;
  overflow: auto;
  padding-right: 2px;
}

.tv-locale-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--tv-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.tv-locale-option:hover {
  background: rgba(255, 255, 255, 0.07);
}

.tv-locale-option.is-active {
  color: rgba(0, 0, 0, 0.86);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.92);
}

.tv-shell[data-tv-product="messenger"] .tv-locale-option.is-active {
  background: #fde3ce;
}
.tv-shell[data-tv-product="erp"] .tv-locale-option.is-active {
  background: #dfdefa;
}

.tv-locale-empty {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--tv-text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.tv-product-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  margin: 6px 0 14px 0;
  position: relative; /* anchor the version badge */
}

.tv-product-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.tv-product-title {
  color: var(--tv-text);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tv-product-subtitle {
  margin-top: 2px;
  color: var(--tv-text-dim);
  font-size: 13px;
  line-height: 1.35;
}

/* Hidden theme version badge (appears on hover over logo/title).
   Rendered purely via CSS var from template.ftl (no JS dependency). */
.tv-product-head::after {
  content: var(--tv-theme-version, "");
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.86);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(-2px) scale(0.98);
  pointer-events: none;
  transition: opacity 160ms ease, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tv-product-head:hover::after,
.tv-product-head:focus-within::after {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Tabs */
.tv-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  margin-bottom: 14px;
  position: relative;
}

/* Default: mono pages hide tabs; JS can opt-in to show them for "multi" flow. */
.tv-shell[data-tv-product="messenger"][data-tv-tabs-hidden="1"] .tv-tabs,
.tv-shell[data-tv-product="academy"][data-tv-tabs-hidden="1"] .tv-tabs {
  display: none;
}

.tv-tab-indicator {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 18px) / 2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 320ms ease;
  z-index: 0;
  pointer-events: none;
}

.tv-tabs[data-tv-active="messenger"] .tv-tab-indicator {
  /* In transforms, % is relative to the element itself (indicator), not the container.
     The indicator width == tab width, so 100% + gap moves exactly to the 2nd tab. */
  transform: translateX(calc(100% + 6px));
}

.tv-shell[data-tv-product="messenger"] .tv-tab-indicator {
  background: #fde3ce;
}

.tv-shell[data-tv-product="erp"] .tv-tab-indicator {
  background: #dfdefa;
}

.tv-tab {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--tv-text-dim);
  outline: none;
  min-height: 44px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700; /* make ERP/Messenger names bold as requested (after `font` shorthand) */
  cursor: pointer;
  position: relative;
  z-index: 1;
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
}

.tv-tab-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 8px;
  opacity: 0.95;
  object-fit: cover;
}

.tv-tab:hover {
  color: var(--tv-text);
  background: rgba(255, 255, 255, 0.06);
}

.tv-tab:focus-visible {
  box-shadow: 0 0 0 3px var(--tv-focus-ring);
}

.tv-tab.is-active {
  color: rgba(0, 0, 0, 0.85);
  background: transparent;
}

.tv-shell[data-tv-product="messenger"] .tv-tab.is-active,
.tv-shell[data-tv-product="erp"] .tv-tab.is-active {
  background: transparent;
}

/* Alerts */
.tv-alert {
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0 12px 0;
  font-size: 14px;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--tv-text);
}

.tv-alert--error {
  border-color: rgba(239, 68, 68, 0.40);
}
.tv-alert--warning {
  border-color: rgba(245, 158, 11, 0.40);
}
.tv-alert--success {
  border-color: rgba(16, 185, 129, 0.40);
}
.tv-alert--info {
  border-color: rgba(255, 255, 255, 0.16);
}

/* Form */
.tv-subtitle {
  margin: 0 0 12px 0;
  color: var(--tv-text-dim);
  text-align: center;
  font-size: 14px;
}

.tv-form {
  display: grid;
  gap: 12px;
}

.tv-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tv-label {
  color: var(--tv-text);
  font-size: 13px;
  font-weight: 600;
}

.tv-input {
  width: 100%;
  max-width: 100%;
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--tv-text);
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.16);
  outline: none;
  position: relative;
  z-index: 1;
  font-size: 16px; /* iOS: prevent auto-zoom */
  line-height: 1.25;
}

/* Selects should look like inputs (custom chevron instead of native UI).
   Some browsers apply strong UA styles to <select>; use !important to ensure consistency. */
.tv-select-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Reliable custom chevron (Safari/iOS sometimes ignores background-image on <select>). */
.tv-select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.62) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.62) 50%, transparent 50%);
  background-repeat: no-repeat, no-repeat;
  background-position: 2px 6px, 7px 6px;
  background-size: 6px 6px, 6px 6px;
}

/* Safari can be stubborn about select UA styles; force the branded look on wrapped selects. */
.tv-select-wrap select.tv-input,
.tv-select-wrap select.tv-input.tv-select {
  color-scheme: dark;
}

select.tv-input,
select.tv-input.tv-select {
  appearance: none !important;
  -webkit-appearance: none !important; /* Safari: ensure native arrow is removed */
  -moz-appearance: none;
  cursor: pointer;
  display: block;

  /* Match text inputs above (height/radius/padding). Some UAs ignore non-important styles on select. */
  min-height: 44px;
  height: 44px;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.92) !important; /* Safari: prevent gray text */
  font-size: 16px;
  line-height: 1.25;

  /* Keep right padding for chevron (override .tv-input shorthand padding). */
  padding: 11px 44px 11px 12px;

  /* Avoid shorthand pitfalls for <select>: set background pieces explicitly. */
  background-color: rgba(0, 0, 0, 0.26) !important;
  /* Chevron is rendered via wrapper pseudo-element for Safari consistency. */
  background-image: none !important;
  background-clip: padding-box;

  /* Firefox: keep selected text aligned like inputs. */
  text-align-last: left;
}

/* Safari-specific: align select text and remove native inner effects. */
@supports (-webkit-touch-callout: none) {
  .tv-select-wrap select.tv-input,
  .tv-select-wrap select.tv-input.tv-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-color: rgba(0, 0, 0, 0.26) !important;
    background-image: none !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: rgba(255, 255, 255, 0.92) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.92) !important;
    height: 44px !important;
    min-height: 44px !important;
    /* Ensure the chevron doesn't overlap text (chevron rendered on wrapper). */
    padding-right: 44px !important;
  }
  select.tv-input,
  select.tv-input.tv-select {
    box-shadow: none !important;
    text-shadow: none !important;
    /* Safari sometimes ignores vertical padding on selects; center via line-height. */
    line-height: 44px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

/* Legacy Edge/IE: hide default dropdown arrow (safe no-op elsewhere). */
select.tv-input::-ms-expand {
  display: none;
}

.tv-input-wrap {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
}

.tv-input-wrap[data-tv-pass-meter="1"] {
  --tv-pass-pct: 0%;
  --tv-pass-scale: 0;
  --tv-pass-meter: rgba(255, 255, 255, 0.18);
  --tv-pass-track: rgba(255, 255, 255, 0.14);
}

/* Password strength/progress bar inside the input area */
.tv-input-wrap[data-tv-pass-meter="1"]::before,
.tv-input-wrap[data-tv-pass-meter="1"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 4px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(1px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  z-index: 2;
}

.tv-input-wrap[data-tv-pass-meter="1"]::before {
  background: var(--tv-pass-track);
}

.tv-input-wrap[data-tv-pass-meter="1"]::after {
  background: var(--tv-pass-meter);
  transform-origin: left center;
  transform: translateY(1px) scaleX(var(--tv-pass-scale));
  transition: opacity 180ms ease, transform 220ms ease;
  box-shadow: none;
}

.tv-input-wrap[data-tv-pass-meter="1"].tv-pass-meter--on::after {
  opacity: 1;
  transform: translateY(0) scaleX(var(--tv-pass-scale));
}

.tv-input-wrap[data-tv-pass-meter="1"].tv-pass-meter--on::before {
  opacity: 1;
  transform: translateY(0);
}

.tv-input--with-affix {
  padding-right: 92px;
}

.tv-affix-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  border-radius: 12px;
  padding: 8px 10px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.tv-affix-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tv-affix-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--tv-focus-ring);
}

.tv-input::placeholder {
  color: rgba(255, 255, 255, 0.40);
}

.tv-inline-error.tv-anim-in,
.tv-inline-warn.tv-anim-in {
  animation: tvHintIn 180ms ease-out both;
}

.tv-pass-rules.tv-anim-in {
  animation: tvHintIn 180ms ease-out both;
}

@keyframes tvHintIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tv-input:focus-visible {
  border-color: rgba(255, 255, 255, 0.30);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.tv-input--otp {
  letter-spacing: 0.22em;
  text-align: center;
  font-weight: 800;
  font-size: 18px;
}

.tv-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tv-text-dim);
  font-size: 13px;
  user-select: none;
}

.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  text-decoration: none;
}

.tv-btn--block {
  display: flex;
  width: 100%;
}

.tv-passkey-actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

.tv-btn--primary {
  color: rgba(0, 0, 0, 0.88);
  background: rgba(255, 255, 255, 0.90);
  position: relative;
  overflow: hidden;
}

.tv-shell[data-tv-product="erp"] .tv-btn--primary {
  background: #d5d2f5;
}
.tv-shell[data-tv-product="messenger"] .tv-btn--primary {
  background: #fcdcc1;
}

.tv-btn--primary:hover {
  filter: brightness(1.02);
}

.tv-btn--primary:active {
  transform: translateY(1px);
}

.tv-btn--primary::after {
  content: "";
  position: absolute;
  inset: -45% -70%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.00) 35%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0.00) 65%,
    transparent 100%
  );
  transform: translateX(-45%) rotate(10deg);
  animation: tvShine 3.2s ease-in-out infinite;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

@keyframes tvShine {
  0% {
    transform: translateX(-55%) rotate(10deg);
    opacity: 0.0;
  }
  18% {
    opacity: 0.0;
  }
  35% {
    opacity: 0.75;
  }
  55% {
    opacity: 0.35;
  }
  80% {
    transform: translateX(55%) rotate(10deg);
    opacity: 0.0;
  }
  100% {
    transform: translateX(55%) rotate(10deg);
    opacity: 0.0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-shell::before,
  .tv-shell::after {
    transition: none;
  }
  .tv-btn--primary::after {
    animation: none;
    opacity: 0;
  }
}

.tv-btn--primary:focus-visible,
.tv-btn--ghost:focus-visible {
  box-shadow: 0 0 0 3px var(--tv-focus-ring);
  outline: none;
}

.tv-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tv-text);
}

.tv-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tv-btn--ghost:active {
  transform: translateY(1px);
}

.tv-btn[disabled],
.tv-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tv-btn:disabled::after {
  opacity: 0;
  animation: none;
}

.tv-links {
  text-align: center;
  margin-top: 6px;
}

.tv-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 13px;
}

.tv-link:hover {
  text-decoration: underline;
}

/* Modal (used for access-denied on multi login) */
.tv-modal {
  position: relative;
  margin-top: 14px;
}
.tv-modal__backdrop {
  position: absolute;
  inset: -12px;
  background: rgba(8, 12, 24, 0.55);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tv-modal__panel {
  position: relative;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.tv-modal__title {
  font-weight: 800;
  color: var(--tv-text);
  letter-spacing: 0.01em;
}
.tv-modal__text {
  margin-top: 8px;
  color: var(--tv-text-dim);
  line-height: 1.45;
}
.tv-modal__actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tv-hint {
  text-align: center;
  color: var(--tv-text-dim);
  font-size: 12px;
}

.tv-help {
  color: var(--tv-text-dim);
  font-size: 12px;
  line-height: 1.35;
}

.tv-help--field {
  margin-top: 2px;
  text-align: left;
}

.tv-help--error {
  color: #f27070;
}

.tv-help--warning {
  color: #f7b34f;
}

.tv-inline-error {
  margin-top: 6px;
}

.tv-inline-warn {
  margin-top: 6px;
}

.tv-pass-rules {
  margin: 6px 0 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.tv-pass-rule {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--tv-text-dim);
  font-size: 12px;
  line-height: 1.35;
}

.tv-pass-rule::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 2px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.tv-pass-rule.is-ok {
  color: #4bc99a;
}

.tv-pass-rule.is-ok::before {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.35);
}

.tv-help--center {
  text-align: center;
}

.tv-input--error {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

@media (max-width: 420px) {
  .tv-card {
    padding: 18px 16px 16px 16px;
  }
  .tv-underlay {
    transform: translateY(175px);
  }
}

@media (max-width: 390px) {
  .tv-shell {
    padding: 18px;
  }
  .tv-tabs {
    margin-bottom: 12px;
  }
  .tv-form {
    gap: 10px;
  }
  .tv-tab {
    padding: 11px 10px;
  }
}


