:root {
  color-scheme: dark;
  --bg: #101b5c;
  --bg-soft: #1e2a78;
  --surface: #24337c;
  --surface-glass: rgba(36, 51, 124, 0.55);
  --text: #ffffff;
  --text-soft: #f5f5f5;
  --accent: #00c2a8;
  --accent-strong: #3ad1c9;
  --accent-shadow: rgba(0, 194, 168, 0.35);
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 12px;
  --max-width: 1180px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(58, 209, 201, 0.08), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(0, 194, 168, 0.12), transparent 46%),
    var(--bg-soft);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

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

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 24px clamp(24px, 5vw, 72px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, rgba(16, 27, 92, 0.9), rgba(30, 42, 120, 0.95));
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.1rem;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(0, 194, 168, 0.15);
  font-size: 20px;
}

.site-nav {
  display: inline-flex;
  gap: 18px;
}

.nav-link {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  color: var(--text);
  background: rgba(0, 194, 168, 0.2);
}

.nav-actions {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.nav-profile {
  position: relative;
}

.nav-avatar {
  appearance: none;
  border: none;
  outline: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 194, 168, 0.3), rgba(58, 209, 201, 0.65));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.nav-avatar:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 194, 168, 0.6);
}

.nav-profile-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#overlays {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483647;
}

#overlays[hidden] {
  display: none;
}

#overlays .profile-overlay-menu {
  position: fixed;
  pointer-events: auto;
  min-width: 240px;
  background: rgba(10, 15, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.nav-profile-name {
  margin: 0;
  font-weight: 600;
}

.nav-profile-plan {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.nav-profile-status {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.nav-profile-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.nav-profile-links a {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}

.nav-profile-links a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  background: transparent;
  color: var(--text);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 30px -12px var(--accent-shadow);
}

.btn-secondary {
  background: rgba(0, 194, 168, 0.12);
  border: 1px solid rgba(0, 194, 168, 0.45);
}

.btn-outline {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: 999px;
}

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 92px) clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-content {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.hero-content h1 {
  margin: 12px 0 16px;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  line-height: 1.12;
}

.subheadline {
  font-size: 1.25rem;
  color: var(--text-soft);
  margin-bottom: 28px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.hero-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
}

.benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  text-align: left;
  justify-items: center;
}

.benefits li {
  padding-left: 28px;
  position: relative;
  color: rgba(255, 255, 255, 0.75);
  max-width: 480px;
  width: 100%;
}

.benefits li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-strong);
  font-weight: 700;
}

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(56px, 7vw, 88px) clamp(24px, 5vw, 72px);
}

.section-heading {
  max-width: 640px;
  margin-bottom: 36px;
}

.section-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 2.6rem);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.plan-card {
  padding: 28px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(160deg, rgba(36, 51, 124, 0.9), rgba(16, 27, 92, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 22px 46px -32px rgba(0, 8, 60, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.step {
  background: rgba(36, 51, 124, 0.7);
  border-radius: var(--border-radius-md);
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  padding: 48px clamp(24px, 5vw, 72px);
  background: #11194a;
}

.site-footer h4 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.65);
}

.layout-dashboard {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 92px) clamp(24px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 28px;
}

.sidebar {
  background: rgba(16, 27, 92, 0.7);
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-scroll {
  padding: 16px 22px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
}

.history-chip {
  border-radius: 18px;
  padding: 14px 18px;
  background: rgba(36, 51, 124, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-area {
  background: rgba(16, 27, 92, 0.55);
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 32px clamp(20px, 5vw, 48px);
  display: grid;
  gap: 20px;
}

.message {
  max-width: 720px;
  padding: 18px 22px;
  border-radius: 22px;
  line-height: 1.5;
  background: rgba(36, 51, 124, 0.8);
}

.message.user {
  justify-self: end;
  background: rgba(0, 194, 168, 0.2);
}

.interpretation-card {
  border-radius: var(--border-radius-md);
  padding: 24px;
  background: rgba(0, 194, 168, 0.08);
  border: 1px solid rgba(0, 194, 168, 0.15);
}

.chat-input {
  padding: 22px clamp(20px, 5vw, 48px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 16px;
}

.chat-input textarea {
  flex: 1;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px 18px;
  background: rgba(11, 21, 78, 0.85);
  color: var(--text);
  resize: vertical;
  min-height: 90px;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(0, 194, 168, 0.22);
  background: rgba(0, 194, 168, 0.18);
  color: var(--text);
  font-size: 1.2rem;
}

.profile-card,
.auth-wrapper,
.help-card {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 92px) clamp(24px, 5vw, 72px);
}

.profile-card,
.auth-card,
.help-card {
  background: rgba(16, 27, 92, 0.65);
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px;
  display: grid;
  gap: 24px;
}

.auth-form,
.contact-form form {
  display: grid;
  gap: 16px;
}

.input-field {
  display: grid;
  gap: 6px;
}

.input-field input,
.input-field textarea {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 14px;
  background: rgba(11, 21, 78, 0.85);
  color: var(--text);
  font-family: inherit;
}

.saved-analyses {
  display: grid;
  gap: 16px;
}

.analysis-item {
  background: rgba(0, 194, 168, 0.08);
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(0, 194, 168, 0.2);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.verification-banner,
.confirmation {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 194, 168, 0.12);
  color: var(--accent-strong);
}

.error-text {
  color: #ff6b6b;
  text-align: center;
  margin: 0;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: auto auto auto;
  }
  .site-nav,
  .nav-actions {
    display: none;
  }
  .nav-open .site-nav,
  .nav-open .nav-actions {
    display: flex;
    flex-direction: column;
    background: rgba(16, 27, 92, 0.97);
    padding: 18px;
    border-radius: 16px;
    gap: 12px;
  }
  .layout-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  .site-header {
    padding: 16px 20px;
  }
  .section,
  .hero {
    padding: 44px 20px;
  }
  .auth-card,
  .profile-card,
  .help-card {
    padding: 32px 20px;
  }
  .chat-input {
    flex-direction: column;
  }
}
/* --- Django helpers --- */
.flash-messages {
  max-width: 960px;
  margin: 1rem auto;
  padding: 0 1rem;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  background: rgba(107, 226, 177, 0.12);
  border: 1px solid rgba(107, 226, 177, 0.3);
}
.flash-error {
  background: rgba(255, 71, 87, 0.12);
  border-color: rgba(255, 71, 87, 0.4);
}
.section-tight {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}
.card,
.list-card {
  background: rgba(12, 14, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-grid input,
.form-grid textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
}
.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-list li a {
  display: block;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
}
.chat-title {
  font-weight: 600;
}
.chat-meta {
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}
.chat-preview {
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.8);
}
.chat-preview.is-empty {
  font-style: italic;
  color: rgba(255, 255, 255, 0.5);
}
.chat-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-shell__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.chat-shell__messages {
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
}
.bubble {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.bubble-user {
  align-self: flex-end;
  background: rgba(76, 176, 255, 0.15);
  border-color: rgba(76, 176, 255, 0.4);
}
.bubble-assistant {
  align-self: flex-start;
  background: rgba(107, 226, 177, 0.12);
  border-color: rgba(107, 226, 177, 0.4);
}
.bubble__author {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.bubble__meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
}
.chat-shell__composer textarea {
  width: 100%;
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.75);
}
.list-card ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.list-card li {
  padding: 0.25rem 0;
}
.plan-card.is-highlighted {
  border: 1px solid rgba(107, 226, 177, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}
.form-errors {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.4);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.input-error {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #ff4757;
}
.input-field.has-error input,
.input-field.has-error textarea {
  border-color: rgba(255, 71, 87, 0.5);
}
.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}
.checkbox-field input {
  width: 1rem;
  height: 1rem;
}
