:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --border: #222226;
  --accent: #e8ff47;
  --accent-dim: #c8df2a;
  --text: #f0f0f0;
  --text-muted: #a0a0a8;
  --text-faint: #6d6d76;
  --error: #ff4d4d;
  --success: #47ff8f;
  --radius: 4px;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
}

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

html {
  min-width: 0;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  overflow-x: hidden;
}

/* Split layout */
.split-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Brand side */
.brand-side {
  width: 42%;
  min-width: 360px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  position: relative;
  overflow: hidden;
}

.brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  pointer-events: none;
}

.brand-content { position: relative; z-index: 1; }

.logo {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(232,255,71,0.1);
  border: 1px solid rgba(232,255,71,0.2);
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
}

.brand-title {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 5vw, 5rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 1rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.brand-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-weight: 300;
}

.brand-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-item {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.check {
  color: var(--accent);
  font-weight: 700;
}

/* Form side */
.form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}

.form-container {
  width: 100%;
  max-width: 400px;
  min-width: 0;
}

.form-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.form-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
}

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }

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

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hint {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  min-height: 44px;
  min-width: 0;
}

input:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }

/* Role toggle */
.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.role-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.role-option input[type="radio"] { display: none; }

.role-icon { font-size: 1.5rem; }

.role-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.role-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.role-option.active {
  border-color: var(--accent);
  background: rgba(232,255,71,0.06);
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.875rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-loader { display: inline-block; }

/* Alert */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert.hidden { display: none; }
.alert-error { background: rgba(255,77,77,0.1); border: 1px solid rgba(255,77,77,0.3); color: var(--error); }
.alert-success { background: rgba(71,255,143,0.1); border: 1px solid rgba(71,255,143,0.3); color: var(--success); }

.form-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

.btn-primary:focus-visible,
.form-footer a:focus-visible,
.role-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible {
  outline: 2px solid rgba(232,255,71,0.25);
  outline-offset: 1px;
}

/* Responsive */
@media (max-width: 768px) {
  .brand-side { display: none; }
  .form-side { padding: 2rem 1.5rem; }
}

@media (max-width: 420px) {
  .role-toggle { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .brand-side {
    width: 38%;
    min-width: 0;
    padding: 3rem 2rem;
  }
  .brand-title { font-size: clamp(2.5rem, 6vw, 4rem); }
  .brand-stats { gap: 1.5rem; }
}

@media (max-width: 860px) {
  .split-layout {
    flex-direction: column;
  }
  .brand-side {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 220px;
    padding: 2rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand-title {
    font-size: 2.5rem;
  }
  .brand-sub {
    margin-bottom: 1.5rem;
  }
  .form-side {
    align-items: flex-start;
    padding: 2rem 1.5rem;
  }
  .form-container {
    max-width: 520px;
    margin: 0 auto;
  }
}

@media (max-width: 560px) {
  .brand-side {
    min-height: auto;
    padding: 1.5rem;
  }
  .brand-title {
    font-size: 2.1rem;
  }
  .brand-stats {
    gap: 1rem;
  }
  .stat-num {
    font-size: 1.1rem;
  }
  .form-side {
    padding: 1.5rem 1rem;
  }
  .form-title {
    font-size: 1.45rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 380px) {
  .brand-side {
    display: flex;
    min-height: auto;
    padding: 1rem 0.75rem 0.25rem;
    border-bottom: 0;
  }
  .brand-grid,
  .brand-sub,
  .brand-stats,
  .feature-list {
    display: none;
  }
  .logo {
    margin-bottom: 0.5rem;
  }
  .brand-title {
    font-size: 1.35rem;
    line-height: 1.05;
    margin-bottom: 0;
  }
  .form-side {
    min-height: auto;
    align-items: flex-start;
    padding-top: 1rem;
  }
  .btn-primary {
    width: 100%;
  }
}

@media (max-width: 320px) {
  .form-side {
    padding: 1rem 0.75rem;
  }
  .form-title {
    font-size: 1.25rem;
  }
  .form-eyebrow,
  label {
    font-size: 0.68rem;
  }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  .btn-primary {
    font-size: 0.82rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .role-option {
    padding: 0.85rem;
  }
}

@media (max-height: 620px) and (min-width: 861px) {
  .brand-side {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  .brand-title {
    font-size: 3rem;
  }
  .brand-sub {
    margin-bottom: 1.25rem;
  }
  .form-side {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  .auth-form {
    gap: 0.85rem;
  }
}
