:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --light: 480ms;
  --ink: #f4f8ff;
  --muted: rgba(232, 240, 255, 0.78);
  --faint: rgba(214, 228, 255, 0.62);
  --line: rgba(255, 255, 255, 0.34);
  --glass: rgba(8, 22, 52, 0.38);
  --glass-2: rgba(255, 255, 255, 0.1);
  --highlight: rgba(255, 255, 255, 0.55);
  --field: rgba(255, 255, 255, 0.1);
  --field-text: #fff;
  --placeholder: rgba(226, 236, 255, 0.55);
  --icon: rgba(226, 236, 255, 0.72);
  --shadow: 0 24px 60px rgba(2, 8, 24, 0.28);
  --check: #3b82f6;
  --msg-ok: #bbf7d0;
  --msg-err: #fecaca;
  --focus: rgba(147, 197, 253, 0.95);
  color-scheme: dark;
}

html[data-theme="light"] {
  --ink: #0c2744;
  --muted: rgba(12, 39, 68, 0.72);
  --faint: rgba(12, 39, 68, 0.55);
  --line: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.46);
  --glass-2: rgba(255, 255, 255, 0.38);
  --highlight: rgba(255, 255, 255, 0.9);
  --field: rgba(255, 255, 255, 0.5);
  --field-text: #0c2744;
  --placeholder: rgba(12, 39, 68, 0.42);
  --icon: rgba(12, 39, 68, 0.5);
  --shadow: 0 24px 50px rgba(20, 70, 120, 0.16);
  --msg-ok: #166534;
  --msg-err: #991b1b;
  --focus: rgba(29, 123, 255, 0.85);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #071428;
  transition: color var(--light) var(--ease-in-out), background-color var(--light) var(--ease-in-out);
}

html[data-theme="light"] body { background: #c5e4fb; }

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 560px at 12% 18%, rgba(70, 130, 255, 0.45), transparent 62%),
    radial-gradient(760px 520px at 88% 8%, rgba(120, 190, 255, 0.28), transparent 58%),
    radial-gradient(680px 480px at 72% 92%, rgba(16, 48, 120, 0.7), transparent 62%),
    linear-gradient(165deg, #16315f 0%, #071428 46%, #0c2348 100%);
}

.sky-day {
  opacity: 0;
  background:
    radial-gradient(860px 540px at 16% 12%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(740px 500px at 86% 6%, rgba(170, 214, 255, 0.9), transparent 58%),
    radial-gradient(640px 460px at 64% 96%, rgba(110, 176, 230, 0.45), transparent 60%),
    linear-gradient(165deg, #f3f9ff 0%, #cfe7fb 52%, #a9d4f6 100%);
  transition: opacity var(--light) var(--ease-in-out);
}

html[data-theme="light"] .sky-day { opacity: 1; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
}

.b1 { width: 42vw; height: 42vw; left: -8vw; top: 8vh; background: #3d7dff; opacity: 0.55; }
.b2 { width: 34vw; height: 34vw; right: -6vw; top: -8vh; background: #8ec8ff; opacity: 0.4; }
.b3 { width: 38vw; height: 38vw; right: 12vw; bottom: -14vh; background: #163e86; opacity: 0.7; }

.sky-day .b1 { background: #fff; opacity: 0.85; }
.sky-day .b2 { background: #b7dcff; opacity: 0.8; }
.sky-day .b3 { background: #7eb6ea; opacity: 0.55; }

.theme {
  position: fixed;
  z-index: 3;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color var(--light) var(--ease-in-out), border-color var(--light) var(--ease-in-out);
}

.theme:active { transform: scale(0.97); }
.theme:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.sun,
.moon {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  transition: opacity 280ms var(--ease-in-out), transform 280ms var(--ease-in-out);
}

.moon {
  display: grid;
  color: #fff;
  opacity: 1;
  transform: translateY(0);
}

.moon svg { width: 22px; height: 22px; fill: currentColor; }

.sun {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, #fff7e8 70%, #ffe3a8 100%);
  box-shadow: 0 0 12px 2px rgba(255, 236, 190, 0.85);
  opacity: 0;
  transform: translateY(8px);
}

html[data-theme="light"] .moon { opacity: 0; transform: translateY(-8px); }
html[data-theme="light"] .sun { opacity: 1; transform: translateY(0); }

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding:
    max(7vh, calc(env(safe-area-inset-top) + 72px))
    max(6vw, env(safe-area-inset-right))
    max(6vh, env(safe-area-inset-bottom))
    max(7vw, env(safe-area-inset-left));
}

.brand { max-width: 36rem; }

.logo img {
  width: clamp(4.5rem, 8vw, 6.5rem);
  height: auto;
  display: block;
}

.brand h1 {
  margin: 18px 0 8px;
  font-size: clamp(3rem, 6vw, 4.6rem);
  font-weight: 560;
  letter-spacing: -0.05em;
  line-height: 0.92;
}

.product {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 550;
  color: var(--muted);
  transition: color var(--light) var(--ease-in-out);
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.modes li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--highlight);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.sheets { width: 100%; }

.card {
  width: 100%;
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 28px 26px 22px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow);
  backdrop-filter: blur(28px) saturate(165%);
  -webkit-backdrop-filter: blur(28px) saturate(165%);
  transition:
    background-color var(--light) var(--ease-in-out),
    border-color var(--light) var(--ease-in-out),
    box-shadow var(--light) var(--ease-in-out);
}

.card h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 640;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.lead {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
}

.field {
  position: relative;
  display: block;
  margin-bottom: 12px;
}

.field input,
.field select {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  color: var(--field-text);
  font: 500 1rem system-ui, sans-serif;
  padding: 0 46px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    color var(--light) var(--ease-in-out),
    background-color var(--light) var(--ease-in-out),
    border-color var(--light) var(--ease-in-out),
    box-shadow 160ms var(--ease-out);
}

.labeled .field input,
.labeled .field select { padding: 0 16px; }
.field select { padding-right: 40px; }

.field input::placeholder { color: var(--placeholder); }

.field input:focus,
.field select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 28%, transparent);
}

.field select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-color: var(--field);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2ecff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

html[data-theme="light"] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c2744' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.field select:invalid { color: var(--placeholder); }

/* Cursor 2026-10-23: glass-theme VeyoraSelect on login / create company */
.field .vsel {
  display: block;
  width: 100%;
  margin-bottom: 0;
  z-index: 4;
}
.field .vsel.open { z-index: 40; }
.field .vsel > select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  background: none !important;
}
.labeled .vsel-lab { display: none !important; }
.field .vsel-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding: 0 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--field-text);
  font: 500 1rem system-ui, sans-serif;
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--light) var(--ease-in-out),
    box-shadow 160ms var(--ease-out),
    background-color var(--light) var(--ease-in-out);
}
.field .vsel-btn:hover {
  border-color: color-mix(in srgb, var(--focus) 55%, var(--line));
  background: color-mix(in srgb, var(--field) 70%, rgba(255, 255, 255, 0.12));
}
.field .vsel.open .vsel-btn,
.field .vsel-btn:focus-visible {
  outline: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 28%, transparent);
}
.field .vsel-val {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--field-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.field .vsel.is-empty .vsel-val {
  color: var(--placeholder);
  font-weight: 500;
}
.field .vsel-chev {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--icon);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, background 0.15s, color 0.15s;
}
html[data-theme="light"] .field .vsel-chev {
  background: rgba(12, 39, 68, 0.08);
}
.field .vsel-chev svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field .vsel.open .vsel-chev {
  transform: rotate(180deg);
  background: color-mix(in srgb, var(--check) 28%, transparent);
  color: #93c5fd;
}
html[data-theme="light"] .field .vsel.open .vsel-chev {
  color: #1677e8;
  background: rgba(22, 119, 232, 0.14);
}
.field .vsel-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 100%;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.96);
  color: #0c2744;
  box-shadow: 0 18px 44px rgba(2, 12, 36, 0.28);
  z-index: 50;
  animation: loginVselIn 0.16s var(--ease-out);
}
html[data-theme="light"] .field .vsel-panel {
  border-color: rgba(12, 39, 68, 0.1);
  background: #fff;
  box-shadow: 0 16px 40px rgba(20, 70, 120, 0.18);
}
@keyframes loginVselIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.field .vsel-list {
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.field .vsel-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font: 600 0.95rem system-ui, sans-serif;
  color: #0c2744;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.field .vsel-opt:hover {
  background: #f0f6ff;
  border-color: #d7e6f8;
}
.field .vsel-opt.on {
  background: #e8f1ff;
  border-color: #c5ddf8;
  color: #0b4ea8;
}
.field .vsel-opt.dim {
  opacity: 0.4;
  cursor: not-allowed;
}
.field .vsel-opt-txt {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field .vsel-check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1677e8;
  color: #fff;
  display: grid;
  place-items: center;
}
.field .vsel-check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field .vsel-empty {
  padding: 14px;
  text-align: center;
  color: #6b7a96;
  font-size: 13px;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--field-text);
  caret-color: var(--field-text);
  transition: background-color 99999s ease-out, color var(--light) var(--ease-in-out);
}

.icon,
.eye {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--icon);
  transform: translateY(-50%);
}

.icon { left: 6px; }
.icon svg,
.eye svg { width: 18px; height: 18px; }

.eye {
  right: 6px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}

.eye:active { transform: translateY(-50%) scale(0.97); }
.eye:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.eye .eye-open { display: none; }
.eye[aria-pressed="true"] .eye-shut { display: none; }
.eye[aria-pressed="true"] .eye-open { display: block; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 18px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
}

.remember input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 6px;
  border: 1.5px solid var(--icon);
  background: transparent;
  display: grid;
  place-items: center;
}

.remember input:checked { background: var(--check); border-color: var(--check); }

.remember input:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border: 1.8px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.remember input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.forgot,
.text-btn,
.back {
  border: 0;
  background: none;
  color: var(--faint);
  font: 600 0.92rem system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
}

.forgot,
.text-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.text-btn { width: 100%; margin-top: 8px; }
.back { min-height: 36px; margin: 0 0 8px; padding: 0; }

.primary {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #5aa2ff 0%, #1d6dff 100%);
  color: #fff;
  font: 650 1rem system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(29, 109, 255, 0.32);
  transition: transform 160ms var(--ease-out);
}

.primary:active { transform: scale(0.97); }
.primary svg { width: 18px; height: 18px; }
.primary:focus-visible,
.forgot:focus-visible,
.text-btn:focus-visible,
.back:focus-visible,
.ghost:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.form-msg {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 620;
}

.form-msg.ok { color: var(--msg-ok); }
.form-msg.err { color: var(--msg-err); }

.labeled { display: block; margin-bottom: 12px; }
.labeled .field { margin-bottom: 0; }

.label {
  display: block;
  margin: 0 4px 6px;
  font-size: 0.8rem;
  font-weight: 640;
  color: var(--muted);
}

.label abbr { text-decoration: none; }

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.logo-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.logo-row img,
.result-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.result-logo { width: 56px; height: 56px; margin-bottom: 12px; }

.ghost {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-2);
  color: var(--ink);
  font: 600 0.9rem system-ui, sans-serif;
  cursor: pointer;
}

.logo-row:focus-within .ghost { outline: 2px solid var(--focus); outline-offset: 3px; }

.result {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass-2);
  display: grid;
  gap: 8px;
}

.result div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.result dt { color: var(--muted); font-size: 0.86rem; font-weight: 550; }
.result dd { margin: 0; font-size: 0.9rem; font-weight: 680; text-align: right; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
  font-size: 0.78rem;
  font-weight: 700;
}

.status.pending { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
html[data-theme="light"] .status { color: #166534; background: rgba(22, 101, 52, 0.12); }
html[data-theme="light"] .status.pending { color: #92400e; background: rgba(245, 158, 11, 0.22); }

@media (hover: hover) and (pointer: fine) {
  .forgot:hover,
  .eye:hover,
  .text-btn:hover,
  .back:hover { color: var(--ink); }
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: start;
    gap: 22px;
    padding:
      max(24px, calc(env(safe-area-inset-top) + 68px))
      max(16px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .brand { text-align: center; }
  .logo img { margin-inline: auto; }
  .brand h1 { font-size: clamp(2.4rem, 12vw, 3.2rem); }
  .modes { justify-content: center; }
  .sheets { width: min(100%, 28rem); }
  .card { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --light: 200ms; }
  .theme:active,
  .primary:active { transform: none; }
  .sun,
  .moon { transform: none; transition: opacity 200ms ease; }
  .eye:active { transform: translateY(-50%); }
}

@media (prefers-reduced-transparency: reduce) {
  .card,
  .theme,
  .modes li,
  .result,
  .ghost {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  html[data-theme="dark"] .card,
  html[data-theme="dark"] .theme { background: rgba(8, 22, 52, 0.94); }
  html[data-theme="light"] .card,
  html[data-theme="light"] .theme { background: rgba(255, 255, 255, 0.96); }
}

@media (prefers-contrast: more) {
  .card,
  .field input,
  .field select,
  .theme { border-width: 2px; }
}
