:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #f8f7ff;
  --text: #18181b;
  --text-2: #27272a;
  --muted: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --purple: #7c3aed;
  --purple-2: #8b5cf6;
  --purple-3: #a855f7;
  --purple-soft: #f3e8ff;
  --purple-glow: rgba(124, 58, 237, 0.14);
  --green: #16a34a;
  --shadow-md: 0 10px 30px rgba(24,24,27,.08);
  --shadow-lg: 0 24px 70px rgba(24,24,27,.12);
  --radius-lg: 24px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 80% 10%, rgba(124,58,237,.14), transparent 32%),
    radial-gradient(circle at 10% 20%, rgba(168,85,247,.08), transparent 28%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
}

.auth-page-wrap {
  width: min(100%, 1120px);
}

.auth-page-wrap-wide {
  width: min(100%, 1280px);
}

.auth-shell {
  display: grid;
  grid-template-columns: 1fr;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(24, 24, 27, .08);
  backdrop-filter: blur(10px);
}

@media (min-width: 960px) {
  .auth-shell {
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 680px;
  }

  .auth-shell-wide {
    grid-template-columns: 0.82fr 1.18fr;
    min-height: 760px;
  }
}

.auth-brand-panel {
  padding: 36px 32px;
  background:
    radial-gradient(circle at 20% 15%, rgba(124,58,237,.12), transparent 34%),
    linear-gradient(180deg, var(--surface-3) 0%, var(--surface-2) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 960px) {
  .auth-brand-panel { padding: 48px 44px; }
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
}

.auth-back:hover { color: var(--purple); }

.auth-logo-row {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
}

.auth-logo-img {
  display: block;
  width: auto;
  height: 38px;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
}

.auth-logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--purple), var(--purple-3));
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px var(--purple-glow);
  flex-shrink: 0;
}

.auth-logo-row strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-logo-row span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-brand-inner h1 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
  font-weight: 800;
  color: var(--text);
}

.auth-brand-inner > p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.96rem;
  max-width: 420px;
}

.auth-chat-preview {
  background: var(--surface);
  border: 1px solid rgba(24, 24, 27, .09);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.auth-chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.auth-chat-bar::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(22, 163, 74, .4);
}

.auth-chat-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.auth-msg {
  max-width: 92%;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
}

.auth-msg-bot {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
  color: var(--text-2);
}

.auth-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple), var(--purple-3));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.auth-status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.auth-status-card {
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid rgba(24, 24, 27, .08);
  background: rgba(255, 255, 255, .75);
  text-align: center;
}

.auth-status-card strong {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.auth-status-card span {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--purple);
  letter-spacing: -0.02em;
}

.auth-trust-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

.auth-trust-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-2);
}

.auth-trust-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple-2);
  flex-shrink: 0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--surface);
}

@media (min-width: 960px) {
  .auth-panel { padding: 48px 52px; }
}

.auth-card {
  width: min(100%, 420px);
}

.auth-card h2 {
  margin: 0 0 10px;
  font-size: clamp(1.55rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

.auth-subtitle {
  margin: 0 0 30px;
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text-2);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

input, select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2371717a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

.btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--purple), var(--purple-3));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--purple-glow);
  transition: transform var(--transition), box-shadow var(--transition);
  margin-top: 4px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.24);
}

.btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.auth-inline-cta {
  margin: 0 0 16px;
}

.auth-inline-cta .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-size: 0.92rem;
  border: 1px solid #fca5a5;
}

.note {
  background: var(--purple-soft);
  color: #5b21b6;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  border: 1px solid rgba(124, 58, 237, 0.15);
  line-height: 1.55;
}

.auth-footer .auth-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted, #71717a);
  line-height: 1.5;
}

.tvkd-resend-verify { margin-top: 16px; }

.register-plan-fieldset {
  border: none;
  margin: 0 0 24px;
  padding: 0;
}

.register-plan-legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding: 0;
  letter-spacing: -0.01em;
}

.register-plan-dropdown {
  position: relative;
  min-width: 0;
}

.register-plan-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid rgba(124, 58, 237, 0.35);
  border-radius: 16px;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
  box-shadow:
    0 0 0 3px var(--purple-glow),
    0 8px 24px rgba(124, 58, 237, 0.08);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.register-plan-dropdown.is-open .register-plan-trigger {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  box-shadow: none;
}

.register-plan-trigger:hover {
  border-color: var(--purple);
}

.register-plan-trigger-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.register-plan-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.register-plan-chevron {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--purple);
  border-bottom: 2px solid var(--purple);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--transition);
}

.register-plan-dropdown.is-open .register-plan-chevron {
  transform: rotate(-135deg) translateY(2px);
}

.register-plan-list {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(320px, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1.5px solid rgba(124, 58, 237, 0.35);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  background: #fff;
  box-shadow:
    0 12px 32px rgba(24, 24, 27, 0.1),
    inset 0 0 0 1px var(--purple-glow);
}

.register-plan-list[hidden] {
  display: none !important;
}

.register-plan-option {
  display: block;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.register-plan-option:last-child {
  border-bottom: none;
}

.register-plan-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.register-plan-option-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 12px 16px;
  background: #fff;
  transition: background var(--transition);
  overflow-wrap: anywhere;
}

.register-plan-option:hover .register-plan-option-inner {
  background: rgba(124, 58, 237, 0.04);
}

.register-plan-option.is-selected .register-plan-option-inner {
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
}

.register-plan-name {
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--text);
  letter-spacing: -0.02em;
  min-width: 0;
}

.register-plan-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--purple);
  letter-spacing: -0.02em;
  min-width: 0;
  max-width: 100%;
}

.register-plan-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.register-plan-meta {
  display: block;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--purple);
  font-weight: 600;
}

.register-plan-option[data-plan="enterprise"] .register-plan-option-inner {
  border-left: 3px dashed rgba(124, 58, 237, 0.35);
}

.auth-card-wide {
  max-width: none;
}

.auth-footer {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.auth-footer a {
  color: var(--purple);
  font-weight: 700;
  text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 959px) {
  body {
    align-items: flex-start;
    padding: 16px 12px;
  }

  .auth-brand-panel {
    padding: 28px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .auth-chat-preview,
  .auth-status-row,
  .auth-trust-list {
    display: none;
  }

  .auth-brand-inner h1 {
    font-size: 1.35rem;
  }

  .auth-shell {
    border-radius: 20px;
  }

  .auth-panel {
    padding: 28px 22px 36px;
  }
}

/* Trang kết quả xác nhận email — layout centered, không dùng auth 2 cột */
.auth-result-body {
  display: block;
  padding: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(124,58,237,.16), transparent 32%),
    radial-gradient(circle at 80% 90%, rgba(168,85,247,.12), transparent 28%),
    #fafafa;
}

.auth-result-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.auth-result-card {
  width: min(100%, 620px);
  padding: 40px;
  border: 1px solid rgba(24,24,27,.10);
  border-radius: 32px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 28px 90px rgba(24,24,27,.12);
}

.auth-result-brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 32px;
  text-decoration: none;
}

.auth-result-brand img {
  display: block;
  width: auto;
  height: 38px;
  max-width: 160px;
  object-fit: contain;
}

.auth-result-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 24px;
  border-radius: 20px;
}

.auth-result-icon--success {
  background: #f3e8ff;
  color: #7c3aed;
}

.auth-result-icon--invalid,
.auth-result-icon--used {
  background: #fee2e2;
  color: #dc2626;
}

.auth-result-icon--expired {
  background: #fef3c7;
  color: #d97706;
}

.auth-result-card h1 {
  margin: 0 0 14px;
  color: #18181b;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.055em;
  font-weight: 900;
}

.auth-result-message {
  margin: 0;
  color: #71717a;
  font-size: 17px;
  line-height: 1.75;
}

.auth-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid #e4e4e7;
}

.auth-result-actions a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 850;
  text-decoration: none;
  font-size: 0.98rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-result-actions .primary {
  background: linear-gradient(135deg,#7c3aed,#a855f7);
  color: #fff;
  box-shadow: 0 16px 36px rgba(124,58,237,.22);
}

.auth-result-actions .primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(124,58,237,.28);
}

.auth-result-actions .secondary {
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #27272a;
}

.auth-result-actions .secondary:hover {
  border-color: #d4d4d8;
  background: #fafafa;
}

@media (max-width: 640px) {
  .auth-result-page {
    padding: 24px 16px;
  }

  .auth-result-card {
    padding: 28px;
    border-radius: 24px;
  }

  .auth-result-actions {
    flex-direction: column;
  }

  .auth-result-actions a {
    width: 100%;
  }
}
