:root {
  --bg-base: #0f1419;
  --bg-elevated: #1a1f27;
  --bg-card: #242d38;
  --bg-hover: #2d3845;
  --bg-active: #3a4556;

  --text-primary: #e1e6eb;
  --text-secondary: #a8b1ba;
  --text-tertiary: #7a8490;
  --text-muted: #5a646d;

  /* Accent - starts neutral, customizable via CSS vars */
  --accent: #4a9eff;
  --accent-hover: #5da9ff;
  --accent-light: rgba(74, 158, 255, 0.1);
  --accent-border: rgba(74, 158, 255, 0.2);

  --status-online: #43d65f;
  --status-online-bg: rgba(67, 214, 95, 0.1);
  --status-idling: #4a9eff;
  --status-idling-bg: rgba(74, 158, 255, 0.1);
  --status-offline: #7a8490;
  --status-offline-bg: rgba(122, 132, 144, 0.05);

  --danger: #d93835;
  --danger-bg: rgba(217, 56, 53, 0.1);
  --success: #43d65f;
  --warning: #f5b842;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 20px;
  --text-3xl: 24px;
  --text-4xl: 28px;

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* User customization (pulled from backend) */
  --user-primary-color: var(--accent);
  --user-bg-image: none;
  --user-accent-rgb: 74, 158, 255;
}

/* Dark mode by default, light mode support */
@media (prefers-color-scheme: light) {
  :root {
    --bg-base: #f8f9fa;
    --bg-elevated: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #f5f6f7;
    --bg-active: #e8eaed;

    --text-primary: #0f1419;
    --text-secondary: #5a646d;
    --text-tertiary: #7a8490;
    --text-muted: #a8b1ba;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.15);
  }
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  width: 100%;
  max-width: 1000px;
  position: relative;
}

.wrap::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  background: var(--user-bg-image);
  background-size: cover;
  background-position: center top;
  opacity: 0.15;
  pointer-events: none;
  z-index: -1;
}

.card {
  position: relative;
  z-index: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.card:has(.profile-avatar-wrap:hover) {
  z-index: 1;
}

.card h1, .card h2, .card h3 {
  font-weight: 600;
  margin: 0 0 var(--space-md);
  line-height: var(--leading-tight);
  letter-spacing: -0.3px;
}

.card h1 {
  font-size: var(--text-2xl);
}

.card h2 {
  font-size: var(--text-xl);
  color: var(--text-secondary);
}

.card h3 {
  font-size: var(--text-lg);
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-tertiary {
  color: var(--text-tertiary);
}

.text-muted {
  color: var(--text-muted);
}

.muted {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin: 0 0 var(--space-md);
  line-height: var(--leading-relaxed);
}

.status-line {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--accent);
  min-height: 18px;
  margin: 0 0 var(--space-md);
  font-weight: 500;
}

.fineprint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-relaxed);
  margin: var(--space-md) 0 0;
}

.fineprint strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  display: block;
}

.field-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--text-base);
  margin-bottom: var(--space-md);
  height: 36px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.input:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

@media (max-width: 600px) {
  body {
    padding: var(--space-lg) var(--space-md);
  }

  .card {
    padding: var(--space-lg);
  }

  .card h1 {
    font-size: var(--text-xl);
  }
}

@media (max-width: 480px) {
  body {
    padding: var(--space-md);
  }

  .card {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
