:root {
  color-scheme: dark;
  --ink: #f4f8ff;
  --muted: #a8b8ca;
  --muted-strong: #c8d5e4;
  --panel: rgba(8, 20, 36, 0.84);
  --panel-border: rgba(154, 199, 241, 0.2);
  --field: rgba(4, 13, 25, 0.62);
  --field-border: rgba(152, 190, 226, 0.24);
  --blue: #2186ff;
  --blue-light: #7dc2ff;
  --red: #ff7187;
  --green: #5bd6a1;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #06101d; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #06101d;
}

button,
input { font: inherit; }

a { color: inherit; }

.scene,
.scene > div {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scene { z-index: 0; overflow: hidden; background: #07111f; }

.scene__image {
  inset: -3% !important;
  background:
    linear-gradient(115deg, rgba(4, 13, 24, 0.5), rgba(4, 13, 24, 0.16)),
    url('/upload/backround/backround.png') center / cover no-repeat;
  animation: background-breathe 18s ease-in-out infinite alternate;
}

.scene__shade {
  background:
    radial-gradient(circle at 72% 40%, transparent 0, rgba(4, 12, 22, 0.14) 35%, rgba(4, 12, 22, 0.7) 88%),
    linear-gradient(90deg, rgba(3, 10, 19, 0.78) 0%, rgba(3, 10, 19, 0.5) 48%, rgba(3, 10, 19, 0.68) 100%);
}

.scene__grid {
  opacity: 0.07;
  background-image:
    linear-gradient(rgba(142, 191, 235, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 191, 235, 0.25) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to right, black, transparent 70%);
}

.blue-light {
  inset: -25% !important;
  opacity: 0;
  mix-blend-mode: screen;
  filter: blur(24px);
}

.blue-light--left {
  background: radial-gradient(circle at 12% 45%, rgba(0, 114, 255, 0.82) 0, rgba(0, 114, 255, 0.3) 15%, transparent 42%);
  animation: beacon-left 3.2s linear infinite;
}

.blue-light--right {
  background: radial-gradient(circle at 88% 42%, rgba(75, 171, 255, 0.72) 0, rgba(13, 116, 255, 0.25) 16%, transparent 42%);
  animation: beacon-right 3.2s linear infinite;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 68px);
  display: grid;
  grid-template-columns: minmax(0, 520px) 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
}

.page-shell--centered {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.auth-card {
  position: relative;
  grid-column: 1;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent 28%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  animation: card-arrive 680ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 28px 0 0 28px;
  background: linear-gradient(180deg, transparent, var(--blue-light) 32%, var(--blue) 68%, transparent);
  opacity: 0.78;
}

.brand {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 30px;
}

.brand__logo {
  position: relative;
  flex: 0 0 74px;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(123, 190, 255, 0.3);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(33, 134, 255, 0.22), rgba(5, 19, 34, 0.78));
  box-shadow: 0 12px 28px rgba(0, 67, 155, 0.3);
}

.brand__logo img {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  object-fit: contain;
  z-index: 2;
}

.brand__fallback {
  font-weight: 800;
  letter-spacing: -0.08em;
  color: var(--blue-light);
}

.brand__logo.has-logo .brand__fallback { visibility: hidden; }

.brand__copy { min-width: 0; }

.brand__eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--blue-light);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.brand h1,
.result-card h1,
.dashboard-card h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.brand p,
.result-card p,
.dashboard-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 25px;
  padding: 5px;
  border: 1px solid rgba(146, 185, 222, 0.13);
  border-radius: 14px;
  background: rgba(2, 9, 17, 0.42);
}

.auth-tabs__item {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.auth-tabs__item:not(.is-disabled):hover { color: var(--ink); }

.auth-tabs__item.is-active {
  color: #fff;
  background: rgba(26, 124, 239, 0.2);
  box-shadow: inset 0 0 0 1px rgba(94, 173, 255, 0.2), 0 7px 18px rgba(0, 59, 130, 0.2);
}

.auth-tabs__item.is-disabled { opacity: 0.58; cursor: not-allowed; }

.notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 13px 14px;
  border: 1px solid rgba(91, 214, 161, 0.28);
  border-radius: 12px;
  color: #c9f7e4;
  background: rgba(17, 117, 82, 0.14);
  font-size: 0.9rem;
  line-height: 1.45;
}

.notice--error {
  border-color: rgba(255, 113, 135, 0.28);
  color: #ffd2d9;
  background: rgba(141, 31, 53, 0.16);
}

.notice__icon {
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(91, 214, 161, 0.18);
  font-size: 0.76rem;
  font-weight: 800;
}

.notice--error .notice__icon { background: rgba(255, 113, 135, 0.16); }

.auth-form { display: grid; gap: 18px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field { min-width: 0; }

.field label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: var(--field);
  caret-color: var(--blue-light);
  transition: border-color 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

.field input:hover { border-color: rgba(152, 190, 226, 0.4); }

.field input:focus {
  border-color: rgba(88, 169, 255, 0.85);
  background: rgba(5, 17, 31, 0.86);
  box-shadow: 0 0 0 4px rgba(33, 134, 255, 0.13);
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 9999s ease-out;
}

.password-control { position: relative; }

.password-control input { padding-right: 91px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  color: var(--blue-light);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible { background: rgba(58, 143, 235, 0.13); outline: none; }

.field__hint,
.field__error {
  display: block;
  margin-top: 7px;
  font-size: 0.77rem;
  line-height: 1.4;
}

.field__hint { color: #8297ad; }
.field__error { color: #ff9aaa; }

.submit-button,
.secondary-button {
  min-height: 52px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
}

.submit-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 3px;
  padding: 0 20px;
  border: 1px solid rgba(129, 197, 255, 0.3);
  color: #fff;
  background: linear-gradient(135deg, #0e68d8, #2186ff 58%, #5cafff);
  box-shadow: 0 13px 30px rgba(0, 86, 190, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: transform 170ms ease, filter 170ms ease, box-shadow 170ms ease;
}

.submit-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 16px 35px rgba(0, 86, 190, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.submit-button:focus-visible,
.secondary-button:focus-visible,
.auth-tabs__item:focus-visible {
  outline: 3px solid rgba(125, 194, 255, 0.78);
  outline-offset: 3px;
}

.submit-button:disabled { cursor: wait; filter: saturate(0.7); opacity: 0.75; }

.submit-button.is-loading .submit-button__arrow { animation: arrow-wait 750ms ease-in-out infinite alternate; }

.submit-button--link {
  max-width: 280px;
  margin: 26px auto 0;
  text-decoration: none;
}

.form-note,
.role-note {
  margin: -2px 0 0;
  color: #8297ad;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.role-note { display: flex; align-items: center; justify-content: center; gap: 8px; }

.role-note__dot,
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(91, 214, 161, 0.1), 0 0 14px rgba(91, 214, 161, 0.6);
}

.page-footer {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 22px;
  color: rgba(203, 218, 232, 0.67);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.trap {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.result-card { text-align: center; }

.result-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border-radius: 20px;
  font-size: 1.8rem;
  font-weight: 800;
}

.result-icon--success { color: #bff7df; background: rgba(42, 181, 128, 0.16); border: 1px solid rgba(91, 214, 161, 0.28); }
.result-icon--error { color: #ffd2d9; background: rgba(180, 44, 70, 0.16); border: 1px solid rgba(255, 113, 135, 0.28); }

.dashboard-card { max-width: 560px; }
.dashboard-card__topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }

.role-badge {
  padding: 7px 11px;
  border: 1px solid rgba(114, 182, 251, 0.24);
  border-radius: 999px;
  color: var(--blue-light);
  background: rgba(33, 134, 255, 0.1);
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
}

.dashboard-card p { margin-bottom: 28px; }

.secondary-button {
  padding: 0 18px;
  border: 1px solid rgba(152, 190, 226, 0.28);
  color: var(--ink);
  background: rgba(10, 27, 47, 0.7);
}

.secondary-button:hover { border-color: rgba(125, 194, 255, 0.55); background: rgba(16, 44, 74, 0.82); }

@keyframes card-arrive {
  from { opacity: 0; transform: translateY(20px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes background-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes beacon-left {
  0%, 2%, 100% { opacity: 0; }
  4% { opacity: 0.42; }
  7% { opacity: 0; }
  10% { opacity: 0.34; }
  13%, 99% { opacity: 0; }
}

@keyframes beacon-right {
  0%, 48% { opacity: 0; }
  50% { opacity: 0.36; }
  53% { opacity: 0; }
  56% { opacity: 0.3; }
  59%, 100% { opacity: 0; }
}

@keyframes arrow-wait {
  from { transform: translateX(-2px); }
  to { transform: translateX(3px); }
}

@media (max-width: 760px) {
  .page-shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
  }

  .auth-card { width: 100%; border-radius: 22px; }
  .page-footer { padding: 18px 0 2px; }
  .scene__shade { background: rgba(3, 10, 19, 0.68); }
}

@media (max-width: 500px) {
  .auth-card { padding: 24px 19px; }
  .brand { align-items: flex-start; gap: 14px; margin-bottom: 24px; }
  .brand__logo { flex-basis: 60px; width: 60px; height: 60px; border-radius: 16px; }
  .brand h1 { font-size: 1.7rem; }
  .brand p { font-size: 0.92rem; }
  .field-grid { grid-template-columns: 1fr; gap: 18px; }
  .auth-tabs__item { font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .blue-light { display: none; }
}
