:root {
  color-scheme: dark;
  --bg: #08090a;
  --bg-soft: #0f1011;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.05);
  --text: #f7f8f8;
  --text-soft: #d0d6e0;
  --muted: #8a8f98;
  --muted-2: #62666d;
  --brand: #5e6ad2;
  --brand-2: #7170ff;
  --brand-3: #828fff;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(113, 112, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(94, 106, 210, 0.12), transparent 24%),
    linear-gradient(180deg, #08090a 0%, #0b0c0e 100%);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv01', 'ss03';
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

body.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-shell,
.app-shell {
  width: min(1200px, 100%);
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.auth-panel,
.content-panel,
.stat-card,
.release-card {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

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

.auth-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 640px;
}

.brand-badge,
.status-pill,
.meta-chip,
.sql-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
}

.brand-badge,
.status-pill {
  width: fit-content;
  padding: 10px 14px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.auth-title,
.page-title {
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}

.auth-title {
  margin-top: 28px;
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 600;
}

.auth-subtitle,
.page-subtitle,
.helper-text,
.release-card-meta,
.release-changelog-preview,
.panel-header p,
.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

.auth-subtitle {
  max-width: 560px;
  font-size: 17px;
}

.auth-feature-list {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

.feature-item,
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feature-item {
  color: var(--text-soft);
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.feature-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  box-shadow: 0 0 22px rgba(113, 112, 255, 0.6);
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-header,
.topbar,
.release-card-top,
.panel-header,
.topbar-actions,
.release-version-row,
.release-link-group,
.meta-chip-row,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--brand-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-form-header h2,
.panel-header h2,
.release-card h3 {
  margin: 0;
  color: var(--text);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.field-group,
.field-label {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

.field-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field-input:focus {
  border-color: rgba(130, 143, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(113, 112, 255, 0.14);
}

.field-textarea {
  min-height: 160px;
  resize: vertical;
}

.password-wrap {
  position: relative;
}

.ghost-inline-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  box-shadow: 0 16px 40px rgba(94, 106, 210, 0.32);
}

.primary-button:hover,
.ghost-button:hover,
.ghost-inline-button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-soft);
  color: var(--text-soft);
}

.large-button {
  min-height: 54px;
  font-weight: 600;
}

.alert {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

body.page-app {
  padding: 28px;
}

.topbar {
  margin-bottom: 24px;
  padding: 10px 0;
}

.compact-topbar {
  margin-bottom: 20px;
}

.page-title {
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card,
.content-panel,
.release-card {
  border-radius: 22px;
  padding: 24px;
}

.stat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.release-grid {
  display: grid;
  gap: 18px;
}

.release-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
}

.release-card h3 {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.release-title {
  margin: 16px 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-soft);
}

.release-link-group {
  flex-wrap: wrap;
}

.secondary-link {
  color: var(--brand-3);
  font-size: 14px;
  font-weight: 600;
}

.meta-chip-row,
.sql-file-list,
.tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip,
.sql-pill,
.status-badge {
  padding: 8px 12px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.status-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.24);
  color: #86efac;
}

.status-muted {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
}

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

.field-group-full {
  grid-column: 1 / -1;
}

.checkbox-panel {
  display: grid;
  gap: 12px;
  max-height: 280px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.check-row {
  align-items: flex-start;
  color: var(--text-soft);
}

.check-row input {
  margin-top: 3px;
}

.prominent-check {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.toggle-stack,
.mini-section {
  display: grid;
  gap: 12px;
}

.side-panel {
  align-self: start;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

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

  .auth-brand-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body.page-auth,
  body.page-app {
    padding: 16px;
  }

  .auth-panel,
  .content-panel,
  .stat-card,
  .release-card {
    padding: 20px;
    border-radius: 20px;
  }

  .topbar,
  .auth-form-header,
  .release-card-top,
  .panel-header,
  .topbar-actions,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

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