/* ============================================================
   Yasmin KI — IBL Brand v3
   INSTABUSINESSLIGA: Rot #bb0a00 · Weiß · Poppins
   ============================================================ */

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

:root {
  /* IBL Brand Colors */
  --red:        #bb0a00;
  --red-hover:  #e83a2e;
  --red-dark:   #7a0700;
  --red-dim:    rgba(187,10,0,0.08);
  --red-border: rgba(187,10,0,0.25);

  /* Neutrals (light theme) */
  --bg:       #ffffff;
  --bg-2:     #f7f5f4;
  --bg-3:     #f0edec;
  --bg-4:     #e8e4e3;

  /* Text */
  --text:   #1a1a1a;
  --text-2: #333333;
  --text-3: #666666;
  --text-4: #999999;

  /* Borders */
  --border:   #e5e1e0;
  --border-2: #d8d3d2;

  /* Status */
  --success: #2e7d32;
  --error:   #bb0a00;
  --warning: #e65100;

  /* Typography */
  --font: 'Poppins', -apple-system, sans-serif;

  /* Sizes */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --sidebar-w: 285px;
  --header-h:  64px;

  /* Effects */
  --shadow:     0 2px 20px rgba(0,0,0,0.08);
  --shadow-red: 0 0 0 3px rgba(187,10,0,0.15);
  --transition: 0.18s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* ============================================================
   AUTH — Split Layout
   ============================================================ */
.auth-overlay {
  position: fixed; inset: 0;
  background: var(--bg-2);
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(4vh, 28px) 24px 40px; z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Two-column split card */
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 900px; width: 100%;
  min-height: 600px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.14);
  animation: fadeUp 0.35s ease;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* Left column — Hero */
.auth-hero {
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(232,58,46,0.5) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(122,7,0,0.6) 0%, transparent 60%);
  pointer-events: none;
}

.auth-hero-inner {
  position: relative; z-index: 1;
  text-align: center; color: white;
}

/* Profile photo */
.auth-hero-photo {
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 20px;
  border: 3px solid rgba(255,255,255,0.35);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.auth-hero-photo img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}

.yasmin-initials {
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 800; color: white;
  letter-spacing: -0.02em;
}

.auth-hero-label {
  font-size: 0.58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 8px;
}

.auth-hero-name {
  font-size: 1.75rem; font-weight: 800;
  line-height: 1.1; letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.auth-hero-claim {
  font-size: 0.9rem; font-weight: 400; font-style: italic;
  color: rgba(255,255,255,0.8);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Social proof numbers */
.auth-social-proof {
  display: flex; align-items: center; gap: 20px;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.proof-item { text-align: center; }
.proof-number { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.proof-label { display: block; font-size: 0.65rem; font-weight: 500; color: rgba(255,255,255,0.7); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.3; }

.proof-divider { width: 1px; height: 40px; background: rgba(255,255,255,0.2); flex-shrink: 0; }

.auth-hero-desc {
  font-size: 0.8rem; color: rgba(255,255,255,0.65);
  line-height: 1.65; max-width: 280px; margin: 0 auto;
}

/* Right column — Form */
.auth-form-col {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}

.auth-form-inner {
  width: 100%; max-width: 340px;
}

.auth-logo { margin-bottom: 28px; text-align: center; }

.auth-name {
  display: block;
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.auth-tagline {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--red);
  margin-top: 8px;
  font-weight: 700;
}

.auth-desc { color: var(--text-3); font-size: 0.88rem; margin-bottom: 28px; line-height: 1.65; }
.auth-form-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-4); margin-bottom: 20px; }

.field { margin-bottom: 10px; }

.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  padding: 13px 16px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--red);
  box-shadow: var(--shadow-red);
}

.field input::placeholder, .field textarea::placeholder { color: var(--text-4); }
.field select option { background: var(--bg); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font); cursor: pointer;
  transition: background var(--transition), transform 0.1s, opacity var(--transition);
  font-weight: 500; white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  width: 100%; background: var(--red); color: white;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 15px; margin-top: 4px;
  border-radius: var(--radius-sm);
}
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--red-dark); }
}

.btn-ghost {
  background: none; color: var(--text-3); font-size: 0.82rem; padding: 8px 12px;
}
.btn-ghost:hover { color: var(--red); }

.btn-danger { background: rgba(187,10,0,0.08); color: var(--red); font-size: 0.8rem; padding: 10px 16px; border: 1px solid var(--red-border); }
.btn-danger:hover { background: rgba(187,10,0,0.14); }

.btn-sm { font-size: 0.78rem; padding: 8px 14px; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition), background var(--transition);
  color: var(--text-3);
}
.btn-icon:hover { color: var(--red); background: var(--red-dim); }

.msg-text { font-size: 0.78rem; margin-top: 10px; }
.msg-error { color: var(--error); }
.msg-success { color: var(--success); }
.msg-info { color: var(--text-3); }
.field-error {
  font-size: 0.72rem;
  color: var(--error);
  margin: 3px 0 0 2px;
  line-height: 1.3;
}
.field-error.hidden { display: none; }
.field input.invalid { border-color: var(--error) !important; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { color: var(--text-4); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }

.auth-links { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding-step { animation: fadeUp 0.3s ease; }

.onboarding-progress {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 24px;
}

.onboarding-progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-2);
  transition: background 0.2s;
}

.onboarding-progress-dot.active { background: var(--red); width: 24px; border-radius: 4px; }
.onboarding-progress-dot.done { background: var(--red-dark); }

.onboarding-title { font-weight: 700; font-size: 1.25rem; margin-bottom: 8px; letter-spacing: -0.01em; }
.onboarding-subtitle { color: var(--text-3); font-size: 0.85rem; margin-bottom: 24px; }

.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }

.option-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 500;
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.option-btn:hover { border-color: var(--red-border); background: var(--red-dim); color: var(--red); }
.option-btn.selected { border-color: var(--red); background: var(--red-dim); color: var(--red); font-weight: 600; }

/* Nische Emoji Grid */
.niche-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.niche-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 6px 12px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.15s, box-shadow 0.18s;
  font-family: var(--font);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.niche-card:active { transform: scale(0.95); }
.niche-emoji {
  font-size: 1.7rem;
  line-height: 1;
  display: block;
}
.niche-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  line-height: 1.2;
}
.niche-card:hover { border-color: var(--red-border); background: var(--red-dim); box-shadow: 0 2px 10px rgba(187,10,0,0.08); }
.niche-card:hover .niche-label { color: var(--red); }
.niche-card.selected {
  border-color: var(--red);
  background: var(--red-dim);
  box-shadow: 0 2px 14px rgba(187,10,0,0.15);
  transform: scale(1.04);
}
.niche-card.selected .niche-label { color: var(--red); font-weight: 700; }
.niche-card--other { border-style: dashed; }
.niche-card--other.selected { border-style: solid; }

/* ============================================================
   LAYOUT
   ============================================================ */
#app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* Main content area — holds both dashboard and chat views */
#main-content {
  flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg);
}

.page-view { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.page-view.hidden { display: none !important; }
.page-scroll { flex: 1; overflow-y: auto; padding: 28px 24px; }
.page-inner { margin: 0 auto; width: 100%; }
@media (max-width: 640px) {
  .page-scroll { padding: 18px 14px; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; }

.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: white;
  letter-spacing: 0.05em; flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 700; font-size: 0.92rem; color: var(--text);
  letter-spacing: -0.01em;
}

.btn-new-chat {
  background: var(--red); border: none; border-radius: var(--radius-xs);
  color: white; cursor: pointer; padding: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.btn-new-chat:hover { background: var(--red-hover); }

.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text); font-family: var(--font); font-size: 0.82rem;
  padding: 8px 12px; outline: none;
  transition: border-color var(--transition);
}
.sidebar-search input:focus { border-color: var(--red); }
.sidebar-search input::placeholder { color: var(--text-4); }

.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.chat-list-empty { color: var(--text-4); font-size: 0.8rem; text-align: center; padding: 24px 12px; line-height: 1.6; }

.chat-list-item {
  padding: 10px 12px; border-radius: var(--radius-xs);
  transition: background var(--transition);
  margin-bottom: 1px;
  display: flex; align-items: center; gap: 8px;
  position: relative;
}

.chat-list-item:hover { background: var(--bg-3); }
.chat-list-item.active { background: var(--bg-3); border-left: 2px solid var(--red); padding-left: 10px; }

.chat-list-content { flex: 1; min-width: 0; cursor: pointer; }
.chat-list-title { font-size: 0.82rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list-date { font-size: 0.7rem; color: var(--text-4); margin-top: 2px; }

.chat-list-pin {
  background: none; border: none; cursor: pointer;
  color: var(--text-4); font-size: 11px; padding: 2px;
  opacity: 0; transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
}
.chat-list-item:hover .chat-list-pin { opacity: 1; }
.chat-list-pin.pinned { opacity: 1; color: var(--red); }

.chat-list-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-4); font-size: 14px; padding: 3px 5px;
  border-radius: 4px; opacity: 0; transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
}
.chat-list-item:hover .chat-list-delete { opacity: 1; }
.chat-list-delete:hover { color: var(--red); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}

.btn-settings, .btn-logout {
  width: 100%; background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-3); font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  padding: 9px; cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-settings:hover { color: var(--text); border-color: var(--border-2); background: var(--bg-3); }
.btn-logout:hover { color: var(--red); border-color: var(--red-border); }

.btn-admin {
  background: var(--red-dim); border: 1.5px solid var(--red-border);
  color: var(--red); font-size: 0.78rem; font-weight: 600;
}
.btn-admin:hover { background: rgba(187,10,0,0.14); }

/* ── Sidebar navigation ─────────────────────────────────────── */
.sidebar-nav {
  padding: 8px 10px 4px;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: none; border: none;
  color: var(--text-3); font-family: var(--font); font-size: 0.84rem; font-weight: 500;
  cursor: pointer; text-align: left; position: relative;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--red-dim); color: var(--red); font-weight: 600; }
.nav-item.active svg { stroke: var(--red); }
.nav-item svg { flex-shrink: 0; transition: stroke var(--transition); }

.nav-item-row {
  display: flex; align-items: center; gap: 4px;
  padding-right: 6px;
}
.nav-item-row .nav-item { flex: 1; min-width: 0; }
.nav-item-action {
  flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 6px;
  background: none; border: 1.5px solid var(--border-2);
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: all var(--transition);
}
.nav-item-row:hover .nav-item-action { opacity: 1; pointer-events: auto; }
.nav-item-action:hover { background: var(--red-dim); border-color: var(--red-border); color: var(--red); }
.nav-item-row .nav-item.active ~ .nav-item-action { border-color: rgba(187,10,0,.3); }

/* ── Dashboard topbar ───────────────────────────────────────── */
.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.dash-topbar-left { display: flex; align-items: center; gap: 12px; }
.dash-topbar-right { display: flex; align-items: center; gap: 10px; }

.dash-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  letter-spacing: -.02em; margin: 0;
}

.dash-counter {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 700;
  color: var(--text-2); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 10px; white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
  font-variant-numeric: tabular-nums;
}
.dash-counter.limit {
  color: var(--error);
  border-color: rgba(211,47,47,.3);
  background: rgba(211,47,47,.06);
}

.dash-settings-btn {
  width: 36px; height: 36px; border-radius: 9px;
  background: none; border: 1.5px solid var(--border);
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.dash-settings-btn:hover { background: var(--bg-2); border-color: var(--border-2); color: var(--text); }

.dash-body {
  flex: 1; overflow-y: auto; padding: 28px 24px;
  scroll-behavior: smooth;
}

/* ── Limit modal ─────────────────────────────────────────────── */
.modal-limit-card {
  max-width: 400px !important;
  text-align: center;
  padding: 36px 32px 28px;
  position: relative;
}
.limit-modal-icon {
  font-size: 2.8rem; margin-bottom: 12px; line-height: 1;
  animation: limitBounce .6s ease;
}
@keyframes limitBounce { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-8px)} 70%{transform:translateY(-3px)} }
.limit-modal-title {
  font-size: 1.2rem; font-weight: 800; color: var(--text);
  letter-spacing: -.02em; margin-bottom: 10px;
}
.limit-modal-body {
  font-size: .85rem; color: var(--text-2); line-height: 1.6; margin-bottom: 22px;
}
.limit-modal-actions {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px;
}
.limit-modal-actions .btn-primary { width: 100%; }
.limit-modal-note {
  font-size: .72rem; color: var(--text-4); margin: 0; line-height: 1.5;
}

/* ============================================================
   CHAT AREA
   ============================================================ */
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); height: 100%; }

.chat-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
}

.header-left  { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* Voice Mode header button */
.header-voice-btn {
  display: flex; align-items: center; gap: 7px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text-3);
  font-family: var(--font); font-size: 0.75rem; font-weight: 600;
  padding: 7px 14px; cursor: pointer;
  transition: all var(--transition);
}
.header-voice-btn:hover {
  border-color: var(--red); color: var(--red);
  background: var(--red-dim);
}
.header-voice-btn.active {
  background: var(--red); color: white; border-color: var(--red);
}
@media (max-width: 768px) {
  .header-voice-btn span { display: none; }
  .header-voice-btn { padding: 8px; border-radius: 50%; width: 38px; height: 38px; justify-content: center; }
}

.btn-sidebar-toggle {
  display: none; background: none; border: none;
  color: var(--text-3); cursor: pointer; padding: 4px;
}

.header-identity { display: flex; align-items: center; gap: 12px; }

.header-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: white; flex-shrink: 0;
  letter-spacing: 0.02em;
}

.header-name { font-weight: 700; font-size: 1.02rem; color: var(--text); letter-spacing: -0.01em; }
.header-status { display: flex; align-items: center; gap: 5px; font-size: 0.7rem; color: var(--text-4); font-weight: 400; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }

/* Messages */
.chat-main { flex: 1; overflow-y: auto; padding: 32px 24px; scroll-behavior: smooth; }

.messages { display: flex; flex-direction: column; gap: 18px; max-width: 760px; margin: 0 auto; }

.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.yasmin { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 14px 18px;
  border-radius: var(--radius);
  line-height: 1.75;
  font-size: 0.94rem;
}

.msg.user .msg-bubble {
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-bottom-right-radius: 4px;
  color: var(--text);
}

.msg.yasmin .msg-bubble {
  background: var(--bg);
  border: 1.5px solid var(--red-border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

/* Rich text in bubbles */
.msg-bubble p { margin-bottom: 0.6em; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble strong { font-weight: 600; color: var(--text); }
.msg-bubble a { color: var(--red); text-decoration: underline; }
.msg-bubble ul, .msg-bubble ol { margin: 0.5em 0 0.5em 0; padding: 0; list-style: none; }
.msg-bubble ul li, .msg-bubble ol li { margin-bottom: 0.35em; padding-left: 1.3em; position: relative; }
.msg-bubble ul li::before { content: '•'; position: absolute; left: 0.2em; color: var(--text-2); }
.msg-bubble ol { counter-reset: ol-counter; }
.msg-bubble ol li { counter-increment: ol-counter; }
.msg-bubble ol li::before { content: counter(ol-counter) '.'; position: absolute; left: 0; color: var(--text-2); font-weight: 600; min-width: 1em; }
.msg-bubble code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; font-family: 'SF Mono', Menlo, monospace; border: 1px solid var(--border); }
.msg-bubble pre { background: var(--bg-3); padding: 12px; border-radius: var(--radius-xs); overflow-x: auto; margin: 0.5em 0; border: 1px solid var(--border); }
.msg-bubble blockquote { border-left: 3px solid var(--red); padding-left: 14px; color: var(--text-3); margin: 0.5em 0; }
.msg-bubble h3 { font-size: 1em; font-weight: 700; margin-bottom: 0.3em; color: var(--red); letter-spacing: -0.01em; }

/* Typing indicator */
.typing-indicator .msg-bubble { padding: 14px 18px; }
.typing-dots { display: flex; gap: 5px; align-items: center; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100%{ transform:translateY(0); opacity:.35; } 40%{ transform:translateY(-6px); opacity:1; } }

/* Streaming cursor */
.streaming .msg-bubble::after { content: '▋'; color: var(--red); animation: blink 0.9s infinite; margin-left: 2px; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

/* Footer */
.chat-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 24px 18px;
  flex-shrink: 0;
}

.project-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  margin-bottom: 6px;
  background: #8b5cf618;
  border: 1px solid #8b5cf640;
  border-radius: 8px;
  font-size: .72rem;
  color: #7c3aed;
  font-weight: 600;
}
.project-context-bar strong { color: #6d28d9; }

.file-preview-bar {
  display: flex; gap: 8px; padding: 8px 0; overflow-x: auto; flex-wrap: nowrap;
}

.file-preview-item { position: relative; flex-shrink: 0; }
.file-preview-item img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-xs); border: 1.5px solid var(--border); }
.file-preview-name { display: inline-block; background: var(--bg-3); padding: 6px 10px; border-radius: var(--radius-xs); font-size: 0.72rem; color: var(--text-2); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border); }
.file-preview-remove { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: white; border: none; font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.input-bar:focus-within { border-color: var(--red); box-shadow: var(--shadow-red); }

#msg-input {
  flex: 1; background: none; border: none; color: var(--text);
  font-family: var(--font); font-size: 0.95rem; line-height: 1.5;
  resize: none; outline: none;
  max-height: 120px; min-height: 24px; align-self: center;
}
#msg-input::placeholder { color: var(--text-4); }

.input-btn { background: none; border: none; color: var(--text-4); cursor: pointer; padding: 6px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; transition: color var(--transition); flex-shrink: 0; }
.input-btn:hover { color: var(--red); }
.input-btn.send:hover { color: var(--red); }
.input-btn.recording { color: var(--red); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

.footer-note { font-size: 0.68rem; color: var(--text-4); text-align: center; margin-top: 8px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 300;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 540px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  animation: fadeUp 0.2s ease;
}

.modal-lg { max-width: 780px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }

.modal-close {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-section { margin-bottom: 24px; }
.modal-section-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-4); margin-bottom: 12px; font-weight: 700;
}

/* Settings modal tabs */
.modal-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.modal-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-3); font-family: var(--font); font-size: 0.82rem; font-weight: 500;
  padding: 10px 16px; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}
.modal-tab:hover { color: var(--text-2); }
.modal-tab.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }

.modal-tab-content.hidden { display: none; }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px;
  text-align: center;
}

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--red); line-height: 1; letter-spacing: -0.03em; }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-4); margin-top: 5px; font-weight: 600; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th { text-align: left; padding: 8px 12px; color: var(--text-4); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; border-bottom: 1px solid var(--border); font-weight: 700; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.admin-table tr:hover td { background: var(--bg-2); }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.badge-pro { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-border); }
.badge-free { background: var(--bg-3); color: var(--text-4); border: 1px solid var(--border); }
.badge-admin { background: rgba(230,81,0,0.1); color: var(--warning); border: 1px solid rgba(230,81,0,0.25); }
.badge-verified { background: rgba(46,125,50,0.1); color: var(--success); border: 1px solid rgba(46,125,50,0.2); }

/* KB entries */
.kb-entry {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 8px;
  background: var(--bg-2);
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color var(--transition);
}
.kb-entry:hover { border-color: var(--red-border); }

.kb-entry-info { flex: 1; min-width: 0; }
.kb-entry-title { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-entry-meta { font-size: 0.72rem; color: var(--text-4); display: flex; gap: 12px; }
.kb-entry-actions { display: flex; gap: 6px; flex-shrink: 0; }

.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-track {
  width: 38px; height: 22px; border-radius: 22px; background: var(--bg-4);
  border: 1.5px solid var(--border); position: relative;
  transition: background var(--transition), border-color var(--transition);
}
.toggle-track.on { background: var(--red); border-color: var(--red); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: white;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-track.on .toggle-thumb { transform: translateX(16px); }

/* ============================================================
   RESPONSIVE — Tablet 1024px
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 260px; }
  .messages { max-width: 680px; }
  .chat-main { padding: 24px 20px; }
}

/* ============================================================
   RESPONSIVE — Small Tablet / Large Mobile 860px
   ============================================================ */
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; max-width: 440px; }
  .auth-hero { padding: 32px 28px; }
  .auth-hero-name { font-size: 1.4rem; }
  .auth-hero-photo { width: 88px; height: 88px; }
  .auth-form-col { padding: 32px 28px; }
  :root { --sidebar-w: 240px; }
}

/* ============================================================
   RESPONSIVE — Mobile 768px
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar: slide-in overlay */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%); box-shadow: none;
    width: 80vw; max-width: 300px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.12);
  }
  .btn-sidebar-toggle { display: flex; }

  /* Dashboard topbar on mobile */
  .dash-topbar { padding: 0 14px; }
  .dash-title { font-size: .9rem; }
  .dash-body { padding: 16px 14px; }
  .home-hero { padding: 20px 18px; }
  .home-hero-name { font-size: 1.1rem; }
  .home-hero-cta { padding: 8px 14px; font-size: .78rem; }
  .home-screen { gap: 14px; padding-bottom: 24px; }

  /* Chat area: full screen flex column */
  .chat-area { width: 100%; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
  .chat-header { height: 56px; padding: 0 14px; }
  .header-name { font-size: 0.96rem; }
  .header-avatar { width: 34px; height: 34px; border-radius: 8px; }

  /* Messages */
  .chat-main {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 12px 8px;
    -webkit-overflow-scrolling: touch;
  }
  .messages { gap: 12px; }
  .msg { max-width: 88%; }
  .msg-bubble { font-size: 0.88rem; padding: 11px 13px; line-height: 1.65; }
  .msg-bubble h3 { font-size: 0.9rem; }

  /* Input bar — always at bottom, above safe area */
  .chat-footer {
    flex-shrink: 0; background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 8px 10px calc(env(safe-area-inset-bottom, 8px) + 6px);
    position: relative; z-index: 10;
  }
  .footer-note { display: none; }
  .input-bar { border-radius: 14px; padding: 6px 6px 6px 10px; gap: 6px; }
  #msg-input { font-size: 0.88rem; }
  .input-btn { min-width: 40px; min-height: 40px; width: 40px; height: 40px; border-radius: 10px; }
  .input-btn svg { width: 17px; height: 17px; }
  .input-btn.send { width: 40px; height: 40px; border-radius: 10px; }

  /* Modals */
  .modal { padding: 20px 18px; max-width: calc(100vw - 20px); border-radius: 16px; }
  .modal-lg { max-width: calc(100vw - 12px); max-height: 92vh; }
  .modal-tab { min-height: 42px; font-size: 0.8rem; padding: 0 12px; }
  .modal-section-title { font-size: 0.82rem; }

  /* Touch targets */
  .btn-settings, .btn-logout, .btn-admin { min-height: 44px; }
  .chat-list-item { min-height: 48px; }

  /* Grid adjustments */
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .niche-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .niche-card { padding: 11px 4px 10px; border-radius: 12px; }
  .niche-emoji { font-size: 1.5rem; }
  .niche-label { font-size: 0.65rem; }

  /* Sidebar footer */
  .sidebar-footer { padding: 10px 12px calc(env(safe-area-inset-bottom, 12px) + 10px); gap: 6px; }
  .btn-settings, .btn-logout { font-size: 0.8rem; padding: 10px 12px; }

  /* Admin table */
  .admin-table { font-size: 0.72rem; }
  .admin-table th, .admin-table td { padding: 8px 6px; }

  /* Onboarding */
  .onboarding-title { font-size: 1.2rem; }
}

/* ============================================================
   RESPONSIVE — Small phones 480px
   ============================================================ */
@media (max-width: 480px) {
  .msg { max-width: 94%; }
  .msg-bubble { font-size: 0.85rem; padding: 10px 12px; }
  .niche-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .niche-card { padding: 9px 3px 8px; }
  .niche-emoji { font-size: 1.3rem; }
  .niche-label { font-size: 0.6rem; }
  .modal { padding: 18px 14px; }
  .header-status { display: none; }
}

/* ============================================================
   RESPONSIVE — Very small phones 360px
   ============================================================ */
@media (max-width: 360px) {
  .chat-header { padding: 0 10px; gap: 8px; }
  .header-name { font-size: 0.88rem; }
  .header-avatar { width: 30px; height: 30px; }
  .input-btn { min-width: 36px; min-height: 36px; width: 36px; height: 36px; }
  .niche-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 16px 12px; }
  .amb-name { font-size: 1.1rem; }
  .amb-proof-num { font-size: 0.9rem; }
}

/* ============================================================
   RESPONSIVE — Large desktop 1440px+
   ============================================================ */
@media (min-width: 1440px) {
  :root { --sidebar-w: 300px; }
  .messages { max-width: 820px; }
  .chat-main { padding: 40px 32px; }
  .msg-bubble { font-size: 0.97rem; }
}

/* ============================================================
   RESPONSIVE — Extra large 1920px+
   ============================================================ */
@media (min-width: 1920px) {
  :root { --sidebar-w: 320px; }
  .messages { max-width: 900px; }
}

/* ============================================================
   AUTH — Mobile Banner (compact hero above form on mobile)
   ============================================================ */
.auth-mobile-banner {
  display: none; /* shown only on mobile */
}

/* ============================================================
   MOBILE AUTH REDESIGN (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Auth overlay: full screen, no card padding */
  .auth-overlay {
    padding: 0;
    background: #ffffff;
    align-items: flex-start;
  }

  .auth-split {
    grid-template-columns: 1fr;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    min-height: 100svh;
    min-height: 100vh;
  }

  /* Hide desktop hero column */
  .auth-hero { display: none !important; }

  /* Form column: full width, scrollable */
  .auth-form-col {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100svh;
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Show compact mobile hero */
  .auth-mobile-banner {
    display: flex;
    flex-direction: column;
    background: linear-gradient(150deg, #bb0a00 0%, #8b0800 60%, #6a0600 100%);
    padding: calc(48px + env(safe-area-inset-top, 0px)) 24px 28px;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
  }

  .auth-mobile-banner::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 80% 20%, rgba(232,58,46,0.4) 0%, transparent 60%);
    pointer-events: none;
  }

  .amb-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin-bottom: 20px;
    position: relative; z-index: 1;
  }

  .amb-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.45);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    flex-shrink: 0;
  }
  .amb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

  .amb-initials {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 800; color: white;
    background: rgba(255,255,255,0.15);
  }

  .amb-info { text-align: center; }
  .amb-ibl {
    font-size: 0.52rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.22em;
    color: rgba(255,255,255,0.65);
    margin-bottom: 4px;
  }
  .amb-name {
    font-size: 1.35rem; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1.1;
  }

  .amb-proof {
    display: flex; align-items: center; gap: 0;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    overflow: hidden;
    position: relative; z-index: 1;
  }
  .amb-proof-item {
    flex: 1; text-align: center;
    padding: 12px 8px;
  }
  .amb-proof-num {
    display: block;
    font-size: 1.05rem; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1;
  }
  .amb-proof-label {
    display: block;
    font-size: 0.58rem; font-weight: 600;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase; letter-spacing: 0.1em;
    margin-top: 3px;
  }
  .amb-proof-divider {
    width: 1px; align-self: stretch;
    background: rgba(255,255,255,0.2);
    margin: 8px 0;
  }

  /* Form inner on mobile */
  .auth-form-inner {
    max-width: 100%;
    padding: 28px 24px calc(40px + env(safe-area-inset-bottom, 0px));
    flex: 1;
  }

  .auth-logo { margin-bottom: 20px; }
  .auth-name { font-size: 1.5rem; }
}

/* ============================================================
   EXTRA SMALL (≤ 390px)
   ============================================================ */
@media (max-width: 390px) {
  .amb-name { font-size: 1.1rem; }
  .chat-header { padding: 0 14px; }
  .header-name { font-size: 0.92rem; }
  .modal { padding: 20px 16px; }
}

/* ============================================================
   LANDSCAPE MOBILE
   ============================================================ */
@media (orientation: landscape) and (max-height: 500px) {
  .auth-overlay { padding: 0; }
  .auth-mobile-banner { padding: 20px 24px 16px; }
  .amb-top { margin-bottom: 12px; }
  .amb-photo { width: 48px; height: 48px; }
  .auth-form-inner { padding: 20px 24px; }
  .chat-header { height: 48px; }
  .chat-main { padding: 10px 14px; }
}

/* ============================================================
   SIDEBAR BACKDROP (mobile overlay)
   ============================================================ */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.sidebar-backdrop.active { display: block; }

/* ============================================================
   MESSAGE ACTIONS (copy / timestamp on hover)
   ============================================================ */
.msg-actions {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  height: 20px;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions { opacity: 1; }

.msg-action-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-4); font-size: 11px;
  padding: 3px 7px; border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  display: flex; align-items: center; gap: 3px;
  font-family: var(--font); font-weight: 500;
  line-height: 1;
}
.msg-action-btn:hover { color: var(--text-2); background: var(--bg-3); }
.msg-action-btn.copied { color: var(--success); }
.msg-timestamp { font-size: 0.63rem; color: var(--text-4); user-select: none; }

/* ── Prompt Quality Badge ── */
.prompt-quality-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  padding: 5px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 100%;
  font-size: .68rem;
  cursor: default;
  transition: opacity .15s;
  opacity: 0.7;
}
.prompt-quality-badge:hover { opacity: 1; }
.pq-score {
  font-weight: 800;
  font-size: .72rem;
  white-space: nowrap;
}
.pq-level {
  font-weight: 700;
  font-size: .68rem;
  white-space: nowrap;
}
.pq-tips {
  font-size: .65rem;
  color: var(--text-3);
  flex-basis: 100%;
}
.pq-tips span {
  background: var(--bg-3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 3px;
  white-space: nowrap;
  display: inline-block;
}

/* ============================================================
   CHAR COUNTER
   ============================================================ */
#char-counter {
  font-size: 0.67rem;
  color: var(--text-4);
  flex-shrink: 0;
  align-self: flex-end;
  padding-bottom: 8px;
  user-select: none;
  transition: color 0.15s;
}
#char-counter.warn { color: var(--warning); }
#char-counter.danger { color: var(--error); font-weight: 600; }

/* ============================================================
   PWA safe-area support
   ============================================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  .chat-footer {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   CONTENT VISIBILITY (performance for long chat lists)
   ============================================================ */
.chat-list-item {
  content-visibility: auto;
  contain-intrinsic-size: 0 48px;
}

/* ============================================================
   VOICE MODE OVERLAY
   ============================================================ */
.voice-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(160deg, #0d0d0d 0%, #1a0500 50%, #0d0d0d 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 24px 24px calc(48px + env(safe-area-inset-bottom, 0px));
  color: white;
  animation: voiceFadeIn 0.35s ease;
}

@keyframes voiceFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* Top bar */
.voice-exit-btn {
  position: absolute; top: 24px; left: 24px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.75);
  font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  padding: 8px 16px; cursor: pointer;
  transition: all 0.2s;
}
.voice-exit-btn:hover { background: rgba(255,255,255,0.14); color: white; }

.voice-tts-toggle {
  position: absolute; top: 24px; right: 24px;
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.75);
  font-family: var(--font); font-size: 0.75rem; font-weight: 600;
  padding: 8px 14px; cursor: pointer;
  transition: all 0.2s;
}
.voice-tts-toggle:hover { background: rgba(255,255,255,0.14); color: white; }
.voice-tts-toggle.active { background: rgba(187,10,0,0.3); border-color: var(--red); color: white; }

/* Center section */
.voice-center {
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
  flex: 1; justify-content: center;
}

/* Avatar with animated rings */
.voice-avatar-wrap {
  position: relative;
  width: 180px; height: 180px;
  display: flex; align-items: center; justify-content: center;
}

.voice-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(187,10,0,0.4);
  animation: voiceRingPulse 2.5s ease-out infinite;
  opacity: 0;
}
.vr1 { width: 180px; height: 180px; animation-delay: 0s; }
.vr2 { width: 220px; height: 220px; animation-delay: 0.6s; }
.vr3 { width: 260px; height: 260px; animation-delay: 1.2s; }

@keyframes voiceRingPulse {
  0%   { opacity: 0;   transform: scale(0.85); }
  30%  { opacity: 0.6; }
  100% { opacity: 0;   transform: scale(1.05); }
}

/* Listening state: faster, brighter rings */
.voice-overlay.listening .voice-ring { border-color: rgba(187,10,0,0.7); animation-duration: 1.4s; }
.voice-overlay.listening .vr1 { animation-delay: 0s; }
.voice-overlay.listening .vr2 { animation-delay: 0.35s; }
.voice-overlay.listening .vr3 { animation-delay: 0.7s; }

/* Speaking state: gentle warm pulse */
.voice-overlay.speaking .voice-ring { border-color: rgba(232,58,46,0.5); animation-duration: 1.8s; }

.voice-avatar-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(187,10,0,0.6);
  box-shadow: 0 0 40px rgba(187,10,0,0.3), 0 0 80px rgba(187,10,0,0.1);
  flex-shrink: 0;
  position: relative; z-index: 1;
  transition: box-shadow 0.4s ease;
}
.voice-overlay.listening .voice-avatar-circle {
  box-shadow: 0 0 60px rgba(187,10,0,0.5), 0 0 120px rgba(187,10,0,0.2);
  border-color: var(--red);
}
.voice-overlay.speaking .voice-avatar-circle {
  box-shadow: 0 0 50px rgba(232,58,46,0.5), 0 0 100px rgba(232,58,46,0.15);
  border-color: var(--red-hover);
}
.voice-avatar-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.voice-avatar-initials {
  width: 100%; height: 100%;
  background: var(--red);
  align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 800; color: white;
}

/* Status text */
.voice-status-text {
  font-size: 1.05rem; font-weight: 600;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.01em;
  text-align: center;
  min-height: 28px;
  transition: color 0.3s;
}
.voice-overlay.listening .voice-status-text { color: #ff6b5b; }
.voice-overlay.speaking  .voice-status-text { color: #ff8f83; }

/* Live transcript */
.voice-transcript-text {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
  max-width: 320px;
  line-height: 1.55;
  min-height: 44px;
  transition: color 0.2s;
  font-style: italic;
}
.voice-overlay.listening .voice-transcript-text { color: rgba(255,255,255,0.75); }

/* Controls */
.voice-controls {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}

.voice-mic-main {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--red);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(187,10,0,0.5);
  transition: all 0.2s;
  color: white;
}
.voice-mic-main:hover { background: var(--red-hover); transform: scale(1.05); }
.voice-mic-main:active { transform: scale(0.95); }

.voice-overlay.listening .voice-mic-main {
  background: #e83a2e;
  box-shadow: 0 0 0 8px rgba(187,10,0,0.2), 0 4px 24px rgba(187,10,0,0.5);
  animation: micPulse 1.2s ease-in-out infinite;
}
.voice-overlay.speaking .voice-mic-main {
  background: rgba(255,255,255,0.12);
  cursor: default;
}

@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 8px rgba(187,10,0,0.2), 0 4px 24px rgba(187,10,0,0.5); }
  50%      { box-shadow: 0 0 0 16px rgba(187,10,0,0.08), 0 4px 32px rgba(187,10,0,0.6); }
}

.voice-hint {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .voice-avatar-wrap { width: 160px; height: 160px; }
  .voice-avatar-circle { width: 120px; height: 120px; }
  .vr1 { width: 160px; height: 160px; }
  .vr2 { width: 200px; height: 200px; }
  .vr3 { width: 240px; height: 240px; }
  .voice-mic-main { width: 72px; height: 72px; }
}

/* Welcome message — Desktop vs Mobile */
.welcome-mobile { display: none; }
.welcome-desktop { display: block; }

@media (max-width: 600px) {
  .welcome-desktop { display: none; }
  .welcome-mobile { display: block; }
}

/* ============================================================
   Plan Cards — Upgrade Modal Tab
   ============================================================ */
.plan-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-2);
  position: relative;
  transition: border-color .2s;
}
.plan-card:hover { border-color: var(--red-border); }
.plan-card.plan-card-featured {
  border-color: var(--red);
  background: var(--red-dim);
}
.plan-card.plan-card-current {
  opacity: .6;
  pointer-events: none;
}
.plan-card-badge {
  position: absolute;
  top: -10px; right: 16px;
  background: var(--red);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: .04em;
}
.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.plan-card-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}
.plan-card-price {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--red);
}
.plan-card-features {
  list-style: none;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-card-features li {
  font-size: .8rem;
  color: var(--text-2);
  padding-left: 18px;
  position: relative;
}
.plan-card-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}
.plan-upgrade-btn {
  width: 100%;
  font-size: .85rem;
}
.plan-card.plan-card-current .plan-upgrade-btn::before {
  content: 'Aktueller Plan';
}
.plan-card.plan-card-current .plan-upgrade-btn {
  background: var(--bg-4) !important;
  color: var(--text-3) !important;
  cursor: default;
}

/* ============================================================
   HOME DASHBOARD
   ============================================================ */
.home-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  padding: 0 0 32px;
  animation: homeIn .3s ease;
}
@keyframes homeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Hero */
.home-hero {
  background: linear-gradient(135deg, var(--red) 0%, #7a0700 100%);
  border-radius: 18px;
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  pointer-events: none;
}
.home-hero-avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  border: 2.5px solid rgba(255,255,255,.3);
  object-fit: cover;
  background: rgba(255,255,255,.15);
}
.home-hero-text { flex: 1; min-width: 0; }
.home-hero-greeting {
  font-size: .78rem;
  color: rgba(255,255,255,.7);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.home-hero-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-hero-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.65);
  margin-top: 2px;
}
.home-hero-cta {
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.home-hero-cta:hover { background: rgba(255,255,255,.25); }

/* Two-column grid */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) { .home-grid { grid-template-columns: 1fr; } }

/* Card base */
.home-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: border-color .15s, box-shadow .15s;
}
.home-card:hover { border-color: var(--red-border); box-shadow: var(--shadow); }
.home-card-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-card-title-icon {
  width: 22px; height: 22px;
  background: var(--red-dim);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.home-card-title-icon svg { width: 12px; height: 12px; stroke: var(--red); }

/* Onboarding checklist */
.ob-list { display: flex; flex-direction: column; gap: 8px; }
.ob-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
}
.ob-item:hover { background: var(--bg-2); }
.ob-item.done { opacity: .55; cursor: default; }
.ob-item.done:hover { background: transparent; }
.ob-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.ob-item.done .ob-check {
  background: var(--success);
  border-color: var(--success);
}
.ob-check svg { display: none; }
.ob-item.done .ob-check svg { display: block; }
.ob-item-label {
  font-size: .8rem;
  color: var(--text);
  font-weight: 500;
  flex: 1;
}
.ob-item.done .ob-item-label { text-decoration: line-through; color: var(--text-4); }
.ob-item-arrow {
  color: var(--text-4);
  font-size: .75rem;
}
.ob-item.done .ob-item-arrow { display: none; }

/* Progress bar */
.home-progress-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.home-progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
}
.home-progress-bar {
  height: 6px;
  background: var(--red);
  border-radius: 99px;
  transition: width .5s ease;
}
.home-progress-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-3);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════
   BUSINESS SHORTCUTS — Premium Design
   ══════════════════════════════════════════════ */

/* Card meta row: label + count badge */
.shortcuts-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.shortcuts-subheader-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-4);
}
.shortcuts-subheader-count {
  font-size: .63rem;
  font-weight: 600;
  color: var(--text-4);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: .01em;
}

/* ── Category nav: wrapper provides the scroll-fade + arrow buttons ── */
.chip-cat-wrap {
  position: relative;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Right-edge fade — behind the next arrow */
.chip-cat-wrap::after {
  content: '';
  position: absolute;
  right: 32px;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity .2s;
}
/* Left-edge fade — behind the prev arrow */
.chip-cat-wrap::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to left, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .2s;
}
.chip-cat-wrap.no-overflow::after { opacity: 0; }
.chip-cat-wrap:not(.no-overflow-left)::before { opacity: 1; }

/* Prev / Next arrow buttons */
.cat-nav-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.cat-nav-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 2px 8px rgba(187,10,0,.25);
}
/* The scrollable track */
.chip-cat-track {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  background: var(--bg-3);
  border-radius: 11px;
}
.chip-cat-track::-webkit-scrollbar { display: none; }

/* Individual category button */
.chip-cat-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .74rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .18s, color .18s, box-shadow .18s;
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
/* Count badge */
.chip-cat-btn .cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-radius: 20px;
  font-size: .58rem;
  font-weight: 800;
  background: rgba(0,0,0,.09);
  color: inherit;
  flex-shrink: 0;
  transition: background .18s, color .18s;
}
.chip-cat-btn.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 12px rgba(187,10,0,.30);
}
.chip-cat-btn.active .cat-count {
  background: rgba(255,255,255,.28);
  color: #fff;
}
.chip-cat-btn:not(.active):hover {
  background: var(--bg);
  color: var(--text-2);
}
.chip-cat-btn:not(.active):hover .cat-count {
  background: var(--border);
}

/* ── Divider row between categories and chips ── */
.shortcuts-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.shortcuts-divider-label {
  font-size: .61rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-4);
  white-space: nowrap;
  flex-shrink: 0;
}
.shortcuts-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.shortcuts-divider-hint {
  font-size: .63rem;
  color: var(--text-4);
  white-space: nowrap;
  flex-shrink: 0;
  font-style: italic;
}

/* ── Shortcut chips ── */
.home-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  animation: chips-in .2s ease both;
}
@keyframes chips-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 15px 8px 13px;
  font-size: .77rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s,
              transform .15s, box-shadow .15s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
/* Red left-accent bar */
.home-chip::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
  opacity: 0;
  transform: scaleY(.5);
  transition: opacity .15s, transform .15s;
}
/* Arrow indicator */
.home-chip::after {
  content: '↗';
  font-size: .66rem;
  opacity: 0;
  transform: translateX(-6px) scale(.7);
  transition: opacity .18s, transform .18s;
  color: var(--red);
  flex-shrink: 0;
}
.home-chip:hover {
  background: var(--red-dim);
  border-color: var(--red-border);
  color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(187,10,0,.12);
}
.home-chip:hover::before {
  opacity: 1;
  transform: scaleY(1);
}
.home-chip:hover::after {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.home-chip:active {
  transform: translateY(0);
  box-shadow: none;
  transition-duration: .05s;
}

/* Stats row */
.home-stats {
  display: flex;
  gap: 10px;
}
.home-stat {
  flex: 1;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.home-stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -.02em;
}
.home-stat-label {
  font-size: .68rem;
  color: var(--text-3);
  margin-top: 1px;
  font-weight: 500;
}

/* Full-width card */
.home-card-full { grid-column: 1 / -1; }

/* Recent chats list */
.dash-recent-list { display: flex; flex-direction: column; gap: 4px; }
.dash-recent-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
  font-size: .78rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.dash-recent-item:hover { background: var(--bg-2); color: var(--text); }
.dash-recent-item span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dash-recent-date { font-size: .68rem; color: var(--text-4); flex-shrink: 0; margin-left: auto; padding-left: 8px; }

/* Mobile tweaks */
@media (max-width: 640px) {
  .chat-main { padding: 16px 14px; }
  .home-hero { padding: 20px 18px; }
  .home-hero-name { font-size: 1.1rem; }
  .home-hero-cta { padding: 8px 14px; font-size: .78rem; }
  .home-screen { gap: 14px; padding-bottom: 24px; }
}

/* ============================================================
   HELP CENTER — full page view
   ============================================================ */

/* Scroll container */
.help-page-scroll {
  flex: 1; overflow-y: auto; scroll-behavior: smooth;
}

/* Hero */
.help-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 32px 32px 24px;
  background: linear-gradient(135deg, var(--red) 0%, #8b0000 100%);
  color: #fff;
}
.help-hero-img {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  flex-shrink: 0; border: 3px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.help-hero-body { flex: 1; min-width: 0; }
.help-hero-badge {
  font-size: .65rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,0.75); margin-bottom: 4px;
}
.help-hero-title {
  font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; letter-spacing: -.02em;
  color: #fff;
}
.help-hero-sub { font-size: .82rem; color: rgba(255,255,255,0.82); line-height: 1.5; }

/* Search */
.help-page-search-wrap {
  padding: 16px 32px;
  background: var(--bg); border-bottom: 1.5px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.help-page-search-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 16px;
  transition: border-color var(--transition);
}
.help-page-search-inner:focus-within { border-color: var(--red-border); background: var(--bg); }
.help-page-search-inner input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: .88rem; color: var(--text);
}
.help-page-search-inner input::placeholder { color: var(--text-4); }

/* Content area */
.help-page-content { padding: 24px 32px 48px; }

/* Tabs */
.help-page-tabs {
  display: flex; gap: 4px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 24px; overflow-x: auto; scrollbar-width: none;
}
.help-page-tabs::-webkit-scrollbar { display: none; }
.help-tab {
  padding: 8px 18px; font-size: .8rem; font-weight: 600; cursor: pointer;
  background: none; border: none; border-bottom: 2.5px solid transparent;
  color: var(--text-3); font-family: var(--font); white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1.5px; flex-shrink: 0;
}
.help-tab:hover { color: var(--text); }
.help-tab.active { color: var(--red); border-bottom-color: var(--red); }

/* Two-column card grid */
.help-cards-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px;
}
.help-section-col { min-width: 0; }

/* Article cards */
.help-section-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-4);
  margin-bottom: 10px; margin-top: 0;
}
.help-card {
  background: var(--bg-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  display: flex; align-items: flex-start; gap: 12px;
}
.help-card:hover { border-color: var(--red-border); background: var(--bg); box-shadow: 0 2px 12px rgba(187,10,0,0.07); }
.help-card-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; margin-top: 1px; }
.help-card-body { flex: 1; min-width: 0; }
.help-card-title { font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.help-card-desc { font-size: .75rem; color: var(--text-3); line-height: 1.5; }
.help-card-arrow { color: var(--text-4); font-size: 1.1rem; align-self: center; flex-shrink: 0; }

/* Article full view */
.help-article-view { max-width: 700px; }
.help-article-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; color: var(--text-3); cursor: pointer;
  background: var(--bg-2); border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-weight: 600;
  padding: 7px 14px; margin-bottom: 24px;
  transition: color var(--transition), border-color var(--transition);
}
.help-article-back:hover { color: var(--text); border-color: var(--border-2); }
#help-article-body h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 16px; }
#help-article-body h3 { font-size: .9rem; font-weight: 700; margin: 22px 0 8px; color: var(--text-2); }
#help-article-body p { font-size: .85rem; color: var(--text-2); line-height: 1.75; margin-bottom: 12px; }
#help-article-body ul, #help-article-body ol { padding-left: 20px; margin-bottom: 12px; }
#help-article-body li { font-size: .85rem; color: var(--text-2); line-height: 1.75; margin-bottom: 5px; }
#help-article-body .tip {
  background: var(--red-dim); border-left: 3px solid var(--red);
  border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 16px 0;
  font-size: .83rem; color: var(--text-2); line-height: 1.65;
}
#help-article-body .tip strong { color: var(--red); }
#help-article-body .step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
#help-article-body .step:last-child { border-bottom: none; }
#help-article-body .step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; flex-shrink: 0; margin-top: 2px;
}
#help-article-body .step-text { font-size: .85rem; color: var(--text-2); line-height: 1.65; }
#help-article-body .step-text strong { color: var(--text); font-weight: 700; }

/* FAQ */
.faq-item {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; overflow: hidden;
}
.faq-q {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; cursor: pointer; background: var(--bg-2);
  font-size: .85rem; font-weight: 600; color: var(--text);
  transition: background var(--transition); user-select: none;
}
.faq-q:hover { background: var(--bg-3); }
.faq-q.open { color: var(--red); background: var(--red-dim); }
.faq-chevron { transition: transform 0.22s ease; font-size: .75rem; color: var(--text-4); flex-shrink: 0; }
.faq-q.open .faq-chevron { transform: rotate(180deg); }
.faq-a {
  display: none; padding: 14px 18px;
  font-size: .82rem; color: var(--text-2); line-height: 1.75;
  border-top: 1px solid var(--border); background: var(--bg);
}
.faq-a.open { display: block; }

/* Shortcut grid */
.shortcut-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px;
}
.shortcut-card {
  background: var(--bg-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.shortcut-key {
  font-size: .72rem; font-weight: 700; color: var(--red);
  background: var(--red-dim); border-radius: 5px;
  padding: 2px 8px; display: inline-block; margin-bottom: 6px; font-family: monospace;
}
.shortcut-desc { font-size: .78rem; color: var(--text-2); line-height: 1.4; }

/* No results */
.help-no-results {
  text-align: center; padding: 48px 20px; color: var(--text-3); font-size: .88rem;
}
.help-no-results-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Mobile */
@media (max-width: 900px) {
  .help-cards-grid { grid-template-columns: 1fr; gap: 0; }
  .help-section-col + .help-section-col { margin-top: 24px; }
}
@media (max-width: 640px) {
  .help-hero { padding: 20px 16px 18px; gap: 14px; }
  .help-hero-img { width: 54px; height: 54px; }
  .help-hero-title { font-size: 1.2rem; }
  .help-hero-sub { font-size: .77rem; }
  .help-page-search-wrap { padding: 12px 14px; }
  .help-page-content { padding: 16px 14px 36px; }
  .help-page-tabs { margin-bottom: 16px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .help-article-back { padding: 6px 12px; font-size: .77rem; }
}

/* ── Maintenance Overlay ───────────────────────────────────────── */
.maintenance-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(10, 10, 10, 0.96);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  backdrop-filter: blur(4px);
}
.maintenance-overlay.active { display: flex; }
.maintenance-box {
  background: #fff;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}
.maintenance-box .icon { font-size: 3rem; margin-bottom: 1rem; }
.maintenance-box h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1a1814;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
.maintenance-box p { font-size: .95rem; color: #555; line-height: 1.6; margin: 0; }

/* ── Chip Item Wrapper (chip + fav star) ─────────────────── */
.chip-item {
  display: inline-flex;
  align-items: stretch;
}
.chip-fav {
  background: none;
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 0 8px;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-4);
  opacity: 0;
  transition: opacity .15s, color .15s;
  line-height: 1;
}
.chip-item:hover .chip-fav { opacity: 1; }
.chip-fav.active {
  color: #f59e0b;
  opacity: 1;
}
.chip-fav:hover { color: #f59e0b !important; }
/* When chip-item has fav: adjust right border-radius of chip */
.chip-item .home-chip {
  border-radius: 10px 0 0 10px;
}

/* ── Small chip variant (history row) ──────────────────────── */
.home-chip-sm {
  font-size: .7rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.home-chip-sm::before,
.home-chip-sm::after { display: none; }
