/* ============================================================
   MAYA — Global Stylesheet
   Dark editorial aesthetic. Intimate, premium, real.
   Drop this into static/style.css — replaces your existing one.
   Page-specific overrides go in their own <style> blocks or files.
   ============================================================ */

/* ============================================================
   CSS VARIABLES — change these to retheme the whole app
   ============================================================ */
:root {
  /* Core palette */
  --bg-base:        #0a0a0b;       /* deepest background */
  --bg-surface:     #111113;       /* cards, panels */
  --bg-elevated:    #18181c;       /* inputs, message bubbles */
  --bg-highlight:   #1f1f25;       /* hover states */

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.06);
  --border-mid:     rgba(255,255,255,0.12);
  --border-bright:  rgba(255,255,255,0.22);

  /* Text */
  --text-primary:   #f0ede8;       /* main body copy */
  --text-secondary: #9b9790;       /* subtext, timestamps */
  --text-muted:     #5a5855;       /* placeholders, disabled */
  --text-accent:    #e8c8a0;       /* warm gold — Maya's color */

  /* Accent system */
  --accent-primary: #c9956a;       /* warm terracotta — buttons, links */
  --accent-glow:    rgba(201,149,106,0.18);
  --accent-hover:   #d4a87a;
  --accent-danger:  #c96a6a;       /* errors, warnings */
  --accent-success: #6ac97a;       /* success states */

  /* Maya bubble vs user bubble */
  --bubble-maya:    #16151a;
  --bubble-user:    #1e1c25;
  --bubble-border-maya: rgba(201,149,106,0.15);
  --bubble-border-user: rgba(255,255,255,0.07);

  /* Typography */
  --font-display:   Georgia, 'Times New Roman', serif;
  --font-body:      system-ui, -apple-system, sans-serif;
  --font-mono:      'Courier New', monospace;

  /* Sizing */
  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      20px;
  --radius-xl:      32px;
  --radius-pill:    999px;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;

  /* Transitions */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:     120ms;
  --t-mid:      220ms;
  --t-slow:     380ms;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow:0 0 24px var(--accent-glow);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  /* Subtle grain texture over solid bg */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201,149,106,0.07) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-attachment: fixed;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); }
h4 { font-size: 1.15rem; }

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  color: var(--text-accent);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container--narrow {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container--chat {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ============================================================
   SURFACE / CARD
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.card--elevated {
  background: var(--bg-elevated);
  border-color: var(--border-mid);
}

.card--glow {
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border-color: rgba(201,149,106,0.25);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-mid) var(--ease-out),
    transform var(--t-fast) var(--ease-spring);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary — filled warm */
.btn-primary {
  background: var(--accent-primary);
  color: #0a0a0b;
  border-color: var(--accent-primary);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 20px rgba(201,149,106,0.35);
  color: #0a0a0b;
  text-decoration: none;
}

/* Ghost — outlined */
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-mid);
}
.btn-ghost:hover {
  background: var(--bg-highlight);
  border-color: var(--border-bright);
  color: var(--text-primary);
  text-decoration: none;
}

/* Subtle — low emphasis */
.btn-subtle {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  font-size: 0.85rem;
  padding: 8px 16px;
}
.btn-subtle:hover {
  background: var(--bg-highlight);
  color: var(--text-primary);
  text-decoration: none;
}

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--accent-danger);
  border-color: rgba(201,106,106,0.3);
}
.btn-danger:hover {
  background: rgba(201,106,106,0.1);
  border-color: var(--accent-danger);
  text-decoration: none;
}

/* Size modifiers */
.btn-sm {
  font-size: 0.8rem;
  padding: 7px 14px;
}
.btn-lg {
  font-size: 1rem;
  padding: 14px 28px;
}
.btn-icon {
  padding: 10px;
  border-radius: var(--radius-md);
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 11px 15px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  transition:
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  background: var(--bg-highlight);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Chat-specific input — no resize, grows with content */
.input-chat {
  resize: none;
  overflow-y: hidden;
  min-height: 44px;
  max-height: 160px;
  border-radius: var(--radius-xl);
  padding: 11px 48px 11px 18px;
  line-height: 1.5;
  overflow-y: auto;
}

/* ============================================================
   CHAT MESSAGE BUBBLES
   ============================================================ */
.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) 0;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  max-width: 78%;
  animation: msg-in var(--t-slow) var(--ease-out) both;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message--maya {
  align-self: flex-start;
}

.message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border-mid);
}

.message__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback initials avatar */
.message__avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.message__bubble {
  padding: 10px 15px;
  border-radius: var(--radius-lg);
  font-size: 0.93rem;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}

.message--maya .message__bubble {
  background: var(--bubble-maya);
  border: 1px solid var(--bubble-border-maya);
  border-bottom-left-radius: var(--radius-sm);
  color: var(--text-primary);
}

.message--user .message__bubble {
  background: var(--bubble-user);
  border: 1px solid var(--bubble-border-user);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--text-primary);
}

.message__time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  padding: 0 var(--space-2);
}

/* Image inside message */
.message__image {
  max-width: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-2);
}
.message__image img {
  width: 100%;
  display: block;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bubble-maya);
  border: 1px solid var(--bubble-border-maya);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  width: fit-content;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   CHAT LAYOUT WRAPPER
   (wraps the full chat screen)
   ============================================================ */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 820px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,10,11,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-header__identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1.5px solid rgba(201,149,106,0.4);
  box-shadow: 0 0 12px rgba(201,149,106,0.2);
}

.chat-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.chat-header__status {
  font-size: 0.75rem;
  color: var(--accent-success);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header__status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-success);
  animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

.chat-body::-webkit-scrollbar {
  width: 4px;
}
.chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--radius-pill);
}

.chat-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: rgba(10,10,11,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  bottom: 0;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.chat-input-row:focus-within {
  border-color: rgba(201,149,106,0.4);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-row textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0;
  border-radius: 0;
  font-size: 0.93rem;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  overflow-y: auto;
  box-shadow: none;
}

.chat-input-row textarea:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  border: none;
  color: #0a0a0b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease-spring), box-shadow var(--t-mid);
}

.chat-send-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px rgba(201,149,106,0.4);
}

.chat-send-btn:active {
  transform: scale(0.92);
}

/* ============================================================
   CREDITS / PAYWALL BADGE
   ============================================================ */
.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.credits-badge__value {
  color: var(--accent-primary);
  font-weight: 500;
}

.credits-badge--low {
  border-color: rgba(201,106,106,0.3);
  color: var(--accent-danger);
}
.credits-badge--low .credits-badge__value {
  color: var(--accent-danger);
}

/* ============================================================
   AUTH PAGES (login, register)
   ============================================================ */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-7) var(--space-6);
  box-shadow: var(--shadow-lg);
}

.auth-card__logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-style: italic;
  color: var(--text-accent);
  text-align: center;
  margin-bottom: var(--space-1);
}

.auth-card__tagline {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ============================================================
   PAYWALL / PURCHASE MODAL OVERLAY
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-5);
  animation: overlay-in var(--t-mid) var(--ease-out) both;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modal-in var(--t-slow) var(--ease-spring) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: var(--space-2);
}

.modal__sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--space-5);
}

/* Credit pack tiers */
.credit-packs {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.credit-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.credit-pack:hover,
.credit-pack.selected {
  border-color: rgba(201,149,106,0.5);
  background: var(--bg-highlight);
  box-shadow: 0 0 0 1px rgba(201,149,106,0.2);
}

.credit-pack__label {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.credit-pack__amount {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-accent);
}

.credit-pack__badge {
  font-size: 0.7rem;
  background: rgba(201,149,106,0.15);
  color: var(--accent-primary);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-weight: 600;
}

/* ============================================================
   NAVIGATION (top nav if needed)
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,10,11,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav__logo {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--text-accent);
  text-decoration: none;
}
.nav__logo:hover {
  text-decoration: none;
  color: var(--accent-hover);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
}

.nav__links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--t-fast);
}
.nav__links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert--error {
  background: rgba(201,106,106,0.08);
  border-color: rgba(201,106,106,0.25);
  color: #e89090;
}
.alert--success {
  background: rgba(106,201,122,0.08);
  border-color: rgba(106,201,122,0.25);
  color: #90e8a0;
}
.alert--info {
  background: rgba(201,149,106,0.08);
  border-color: rgba(201,149,106,0.2);
  color: var(--text-accent);
}

/* ============================================================
   DIVIDERS / SEPARATORS
   ============================================================ */
hr,
.divider {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-5) 0;
}

/* ============================================================
   SCROLLBAR (global)
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--radius-pill);
}

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-highlight) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-accent   { color: var(--text-accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-danger   { color: var(--accent-danger); }
.text-success  { color: var(--accent-success); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

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

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --space-5: 18px;
    --space-6: 24px;
    --space-7: 36px;
  }

  .chat-layout {
    height: 100dvh; /* use dynamic viewport on mobile */
  }

  .message {
    max-width: 90%;
  }

  .auth-card {
    padding: var(--space-6) var(--space-5);
  }

  .modal {
    padding: var(--space-5);
  }
}

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