:root {
  --md-primary: #0ea5e9;
  --md-primary-dark: #0369a1;
  --md-primary-container: #e0f2fe;
  --md-secondary: #14b8a6;
  --md-secondary-dark: #0f766e;
  --md-surface: #ffffff;
  --md-surface-2: #f8fafc;
  --md-outline: #d7e3ef;
  --md-text: #0f172a;
  --md-text-muted: #51657a;
  --bg-radial-a: #e0f2fe;
  --bg-radial-b: #ccfbf1;
  --bg-grad-start: #f5f9fd;
  --bg-grad-end: #f8fafc;
  --header-bg: rgba(255, 255, 255, 0.9);
  --header-border: rgba(148, 163, 184, 0.2);
  --aside-start: #0b385f;
  --aside-mid: #0a6698;
  --aside-end: #0f766e;
  --aside-text: #f8fafc;
  --aside-muted: rgba(241, 245, 249, 0.94);
  --feature-bg: rgba(2, 6, 23, 0.26);
  --feature-border: rgba(255, 255, 255, 0.2);
  --feature-icon: #a5f3fc;
  --input-bg: #ffffff;
  --input-border: #c9d8e6;
  --note-bg: #f8fafc;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;
  --radius-md: 16px;
  --radius-lg: 24px;
  --elev-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --elev-2: 0 8px 20px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.06);
  --elev-3: 0 16px 32px rgba(3, 105, 161, 0.2), 0 3px 12px rgba(3, 105, 161, 0.12);
}

:root[data-theme="dark"] {
  --md-primary: #38bdf8;
  --md-primary-dark: #0ea5e9;
  --md-primary-container: #0d2738;
  --md-secondary: #2dd4bf;
  --md-secondary-dark: #14b8a6;
  --md-surface: #101b2e;
  --md-surface-2: #15243a;
  --md-outline: #31475f;
  --md-text: #e2e8f0;
  --md-text-muted: #9eb1c8;
  --bg-radial-a: #0f2738;
  --bg-radial-b: #0d2e2a;
  --bg-grad-start: #070d17;
  --bg-grad-end: #0e1b2e;
  --header-bg: rgba(9, 15, 27, 0.9);
  --header-border: rgba(148, 163, 184, 0.22);
  --aside-start: #0a1e2f;
  --aside-mid: #10395a;
  --aside-end: #10443d;
  --aside-text: #ecfeff;
  --aside-muted: rgba(226, 232, 240, 0.92);
  --feature-bg: rgba(15, 23, 42, 0.58);
  --feature-border: rgba(148, 163, 184, 0.32);
  --feature-icon: #67e8f9;
  --input-bg: #0d1728;
  --input-border: #38536f;
  --note-bg: #1a2b42;
  --danger-bg: #3a1518;
  --danger-border: #7f1d1d;
  --danger-text: #fecaca;
  --success-bg: #0f2e26;
  --success-border: #166534;
  --success-text: #a7f3d0;
  --elev-1: 0 1px 2px rgba(2, 6, 23, 0.58), 0 2px 6px rgba(2, 6, 23, 0.36);
  --elev-2: 0 12px 24px rgba(2, 6, 23, 0.52), 0 3px 12px rgba(2, 6, 23, 0.3);
  --elev-3: 0 18px 34px rgba(2, 6, 23, 0.58), 0 4px 14px rgba(2, 6, 23, 0.38);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.auth-page {
  min-height: 100vh;
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
  color: var(--md-text);
  background:
    radial-gradient(circle at 0% 0%, var(--bg-radial-a) 0%, rgba(0, 0, 0, 0) 36%),
    radial-gradient(circle at 100% 100%, var(--bg-radial-b) 0%, rgba(0, 0, 0, 0) 34%),
    linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.auth-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 78px;
  padding: 0.8rem clamp(1rem, 3vw, 2.3rem);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-logo {
  width: auto;
  height: 44px;
  display: block;
  object-fit: contain;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--md-primary), var(--md-primary-dark));
  color: #ffffff;
  box-shadow: var(--elev-1);
}

.brand-mark .material-symbols-rounded {
  font-size: 24px;
}

.brand-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.06;
}

.brand-text small {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-toggle {
  min-width: 140px;
  gap: 0.34rem;
}

.theme-toggle .material-symbols-rounded {
  font-size: 18px;
}

.theme-label {
  font-weight: 700;
  font-size: 0.84rem;
}

.auth-main {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 1.4rem auto 2.3rem;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr);
  gap: 1rem;
  align-items: stretch;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  color: var(--aside-text);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 2vw, 2.1rem);
  background: linear-gradient(145deg, var(--aside-start) 0%, var(--aside-mid) 52%, var(--aside-end) 100%);
  box-shadow: var(--elev-3);
}

.auth-aside::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -56px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(186, 230, 253, 0.14);
}

:root[data-theme="dark"] .auth-aside::after {
  background: rgba(56, 189, 248, 0.16);
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.74rem;
  font-weight: 700;
}

.auth-kicker .material-symbols-rounded {
  font-size: 18px;
}

.auth-aside h2 {
  margin: 0.95rem 0 0.6rem;
  font-size: clamp(1.3rem, 2.1vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.auth-aside p {
  margin: 0;
  color: var(--aside-muted);
  line-height: 1.65;
}

.feature-list {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.66rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.64rem 0.72rem;
  border-radius: 12px;
  background: var(--feature-bg);
  border: 1px solid var(--feature-border);
  font-size: 0.9rem;
}

.feature-list .material-symbols-rounded {
  color: var(--feature-icon);
  font-size: 18px;
}

.auth-card {
  border: 1px solid var(--md-outline);
  border-radius: var(--radius-lg);
  background: var(--md-surface);
  box-shadow: var(--elev-2);
  padding: clamp(1.15rem, 2vw, 2rem);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.card-head {
  margin-bottom: 1rem;
}

.card-head p {
  margin: 0 0 0.18rem;
  color: var(--md-text-muted);
  font-weight: 500;
}

.card-head h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2.05rem);
  letter-spacing: -0.015em;
}

.card-head .card-sub {
  margin: 0.45rem 0 0;
  color: var(--md-text-muted);
  font-size: 0.92rem;
}

.alert {
  border-radius: 12px;
  padding: 0.72rem 0.84rem;
  border: 1px solid transparent;
  margin-bottom: 0.82rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.stacked-alerts {
  display: grid;
  gap: 0.52rem;
  margin-bottom: 0.8rem;
}

.auth-form {
  display: grid;
  gap: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.82rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.span-2 {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--md-text-muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.84rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--md-text);
  background: var(--input-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input::placeholder,
.field select::placeholder {
  color: var(--md-text-muted);
}

.field input[type="file"] {
  padding: 0.55rem 0.66rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.section-label {
  margin: 0.2rem 0 0.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-text-muted);
}

.helper-row {
  display: flex;
  justify-content: flex-end;
}

.inline-link {
  color: var(--md-primary-dark);
  font-weight: 500;
}

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

:root[data-theme="dark"] .inline-link {
  color: var(--md-primary);
}

.btn {
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 1.16rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--md-primary), var(--md-primary-dark));
  box-shadow: 0 8px 18px rgba(3, 105, 161, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(3, 105, 161, 0.35);
}

.btn-soft {
  color: var(--md-primary-dark);
  background: var(--md-primary-container);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.btn-soft:hover {
  background: #d5ecfb;
}

:root[data-theme="dark"] .btn-soft {
  color: var(--md-primary);
  background: rgba(14, 165, 233, 0.13);
  border-color: rgba(56, 189, 248, 0.4);
}

:root[data-theme="dark"] .btn-soft:hover {
  background: rgba(14, 165, 233, 0.2);
}

.btn-block {
  width: 100%;
}

.alt-line {
  margin: 0.92rem 0 0;
  font-size: 0.9rem;
  text-align: center;
  color: var(--md-text-muted);
}

.note {
  margin-top: 0.5rem;
  border: 1px solid var(--md-outline);
  background: var(--note-bg);
  border-radius: 12px;
  padding: 0.74rem 0.8rem;
  color: var(--md-text-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.note strong {
  color: var(--md-text);
}

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.otp-input {
  width: 52px;
  height: 58px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--md-text);
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.otp-input:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.timer-resend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  font-size: 0.88rem;
  color: var(--md-text-muted);
  margin-bottom: 0.34rem;
}

.timer-resend p {
  margin: 0;
}

#countdown {
  font-weight: 700;
  color: var(--md-primary-dark);
}

:root[data-theme="dark"] #countdown {
  color: var(--md-primary);
}

#resend-link.disabled {
  pointer-events: none;
  opacity: 0.44;
}

.button-stack {
  display: grid;
  gap: 0.52rem;
}

.auth-aside,
.auth-card {
  animation: rise-in 0.35s ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .auth-header {
    flex-wrap: wrap;
    justify-content: center;
  }

  .theme-toggle {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .auth-main {
    width: calc(100% - 1.2rem);
    margin-top: 1rem;
  }

  .auth-card,
  .auth-aside {
    border-radius: var(--radius-md);
    padding: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .helper-row {
    justify-content: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .theme-label {
    display: none;
  }

  .otp-input {
    width: 44px;
    height: 52px;
    font-size: 1.12rem;
  }

  .timer-resend {
    flex-direction: column;
    align-items: flex-start;
  }
}
