:root {
  --navy950: #020E26;
  --navy900: #031D50;
  --navy800: #0A2A66;
  --navy700: #163A7D;
  --gold600: #A06D00;
  --gold500: #F9B90A;
  --gold400: #FCD111;
  --gold300: #FFE48A;
  --ivory: #F7F6F2;
  --white: #FFFFFF;
  --danger: #B42318;
  --ok: #1F7A4D;
  --muted-light: #6E6E73;
  --muted-dark: #A1A9B8;
  --border-light: #E3E3E8;
  --border-dark: #1C3363;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --bg: var(--ivory);
  --bg-soft: #EFEEE9;
  --surface: var(--white);
  --card: var(--white);
  --text: var(--navy950);
  --heading: var(--navy900);
  --muted: var(--muted-light);
  --border: var(--border-light);
  --gold-text: var(--gold600);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.7);
  --shadow-sm: 0 1px 2px rgba(3, 29, 80, 0.06), 0 1px 1px rgba(3, 29, 80, 0.04);
  --shadow: 0 12px 32px -12px rgba(3, 29, 80, 0.18), 0 2px 6px rgba(3, 29, 80, 0.05);
  --shadow-lg: 0 40px 80px -30px rgba(3, 29, 80, 0.35);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: var(--navy950);
  --bg-soft: #041638;
  --surface: #061A42;
  --card: #071E4B;
  --text: var(--ivory);
  --heading: var(--white);
  --muted: var(--muted-dark);
  --border: var(--border-dark);
  --gold-text: var(--gold300);
  --glass: rgba(6, 26, 66, 0.62);
  --glass-strong: rgba(6, 26, 66, 0.82);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-sm: none;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold500); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--heading); letter-spacing: -0.022em; line-height: 1.08; margin: 0; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--gold500); color: var(--navy900); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.skip:focus { top: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 980px;
  border: 1px solid transparent; text-decoration: none; font-weight: 600; font-size: 15px;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform 0.2s var(--ease), background-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--gold500); color: var(--navy900); box-shadow: 0 8px 24px -10px rgba(249, 185, 10, 0.8); }
.btn-primary:hover { background: var(--gold400); }
.btn-dark { background: var(--navy900); color: var(--white); }
.btn-dark:hover { background: var(--navy800); }
[data-theme="dark"] .btn-dark { background: var(--white); color: var(--navy900); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.btn-glass { background: rgba(255, 255, 255, 0.14); color: var(--white); border-color: rgba(255, 255, 255, 0.28); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.24); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn[disabled], .btn.is-busy { opacity: 0.6; pointer-events: none; }
.btn-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-text); font-weight: 600; text-decoration: none; min-height: 44px; }
.btn-link::after { content: "\203A"; font-size: 1.3em; line-height: 1; transition: transform 0.2s var(--ease); }
.btn-link:hover::after { transform: translateX(3px); }

/* Forms */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field label, .label { font-size: 14px; font-weight: 600; color: var(--text); }
.optional { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 4px; }
.hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 17px; transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 40px; cursor: pointer;
  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 d='M1 1.5l5 5 5-5' stroke='%236E6E73' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold500) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 76px; }
.input-action {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--gold-text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.input-action:hover { background: color-mix(in srgb, var(--gold500) 12%, transparent); }
.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; }
.input-prefix span { display: flex; align-items: center; padding: 0 0 0 16px; color: var(--muted); font-size: 15px; white-space: nowrap; }
.input-prefix .input { border: 0; padding-left: 2px; box-shadow: none; background: transparent; }
.input-prefix:focus-within { border-color: var(--gold500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold500) 22%, transparent); }
.input-code { text-align: center; font-family: var(--mono); font-size: 28px; letter-spacing: 0.5em; padding-left: calc(16px + 0.5em); min-height: 64px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold500); flex: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .span-2 { grid-column: span 2; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Alerts and badges */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: 15px; border: 1px solid; }
.alert svg { flex: none; margin-top: 2px; }
.alert-error { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--text); }
.alert-error svg { color: var(--danger); }
.alert-ok { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-ok svg { color: var(--ok); }
.alert-info { background: color-mix(in srgb, var(--gold500) 10%, var(--surface)); border-color: color-mix(in srgb, var(--gold500) 35%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: 980px; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
[data-theme="dark"] .badge-ok { color: #5FD39A; }
.badge-warn { background: color-mix(in srgb, var(--gold500) 18%, transparent); color: var(--gold-text); }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
[data-theme="dark"] .badge-danger { color: #FF8A80; }
.badge-plain::before { display: none; }

/* Logo tile: the cross is navy, so dark surfaces get a light tile. */
.mark { display: inline-grid; place-items: center; flex: none; }
.mark img { width: 100%; height: 100%; object-fit: contain; }
.mark-tile { background: var(--white); border-radius: 24%; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.45); }
.mark-tile img { width: 76%; height: 76%; }
[data-theme="dark"] .mark-auto { background: var(--white); border-radius: 24%; }
[data-theme="dark"] .mark-auto img { width: 80%; height: 80%; }

/* Motion */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--delay, 0s); }
.js .reveal.is-visible { opacity: 1; transform: none; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoom { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold500) 50%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }

/* Auth screens */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr); }
.auth-aside { position: relative; overflow: hidden; color: var(--white); display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; isolation: isolate; }
.auth-aside > img.auth-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; animation: zoom 18s var(--ease) both; }
.auth-aside::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(3, 29, 80, 0.55) 0%, rgba(2, 14, 38, 0.88) 70%), radial-gradient(80% 60% at 0% 100%, rgba(249, 185, 10, 0.35), transparent 60%); }
.auth-aside .mark { width: 56px; height: 56px; }
.auth-aside h2 { color: var(--white); font-size: clamp(2rem, 3.4vw, 3.1rem); max-width: 14ch; margin-bottom: 16px; animation: rise 1s var(--ease) 0.15s both; }
.auth-aside p { color: rgba(255, 255, 255, 0.82); font-size: 18px; max-width: 34ch; animation: rise 1s var(--ease) 0.3s both; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; animation: rise 1s var(--ease) 0.45s both; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, 0.9); font-size: 15px; }
.auth-points li::before { content: ""; width: 22px; height: 22px; flex: none; border-radius: 50%; background: rgba(249, 185, 10, 0.2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' stroke='%23FCD111' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat; }
.auth-aside-foot { font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.auth-main { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 24px; background: radial-gradient(70% 50% at 100% 0%, color-mix(in srgb, var(--gold500) 12%, transparent), transparent 70%), var(--bg); }
.auth-top { position: absolute; top: 20px; left: 24px; right: 24px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.auth-top a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.auth-top a:hover { color: var(--text); }
.auth-card { width: min(440px, 100%); padding: 40px; border-radius: 28px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); animation: rise 0.8s var(--ease) both; }
.auth-head { text-align: center; margin-bottom: 28px; }
.auth-head .mark { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; }
.auth-head h1 { font-size: 28px; margin-bottom: 8px; }
.auth-head p { color: var(--muted); font-size: 15px; }
.auth-icon { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold500) 16%, transparent); color: var(--gold-text); }
.auth-alt { margin-top: 24px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--gold-text); font-weight: 600; text-decoration: none; }
.auth-foot { margin-top: 28px; display: flex; gap: 18px; justify-content: center; font-size: 13px; color: var(--muted); }
.auth-foot a { color: var(--muted); text-decoration: none; }
.auth-foot a:hover { color: var(--text); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 12px; font-size: 15px; color: var(--muted); }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--navy900); color: var(--gold400); }
[data-theme="dark"] .steps li::before { background: var(--gold500); color: var(--navy900); }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-radius: 14px; background: var(--bg-soft); border: 1px dashed var(--border); }
.secret-box code { flex: 1; font-family: var(--mono); font-size: 15px; letter-spacing: 0.08em; word-break: break-all; color: var(--heading); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.welcome-grid { display: grid; gap: 12px; margin: 24px 0; }
.welcome-item { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--bg-soft); }
.welcome-item strong { display: block; color: var(--heading); font-size: 15px; }
.welcome-item span { color: var(--muted); font-size: 13px; }
.welcome-item svg { color: var(--gold-text); flex: none; }

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { min-height: 280px; padding: 28px 24px; }
  .auth-aside h2 { font-size: 2rem; }
  .auth-aside .auth-points, .auth-aside-foot { display: none; }
  .auth-main { padding: 28px 16px 40px; justify-content: flex-start; }
  .auth-top { position: static; margin-bottom: 20px; width: min(440px, 100%); }
  .auth-card { padding: 28px 22px; margin-top: -72px; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
