/* ══════════════════════════════════════════════════════════
   APEX GLOBAL — Ask Apex UI
   Dark Navy / Gold Premium Theme
══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  /* Core palette */
  --bg:               #07091C;
  --bg-deep:          #050714;
  --sidebar-bg:       #060818;
  --surface:          #0D1228;
  --surface-2:        #111830;
  --surface-hover:    #141C36;
  --border:           #1A2545;
  --border-light:     #243355;

  /* Gold accent */
  --gold:             #C9A84C;
  --gold-light:       #E0BB65;
  --gold-dark:        #A88830;
  --gold-glow:        rgba(201, 168, 76, 0.18);
  --gold-glow-sm:     rgba(201, 168, 76, 0.10);

  /* Text */
  --text:             #EDF0FF;
  --text-muted:       #7B8DB8;
  --text-faint:       #3E4E6E;

  /* Semantic */
  --success:          #22C55E;
  --warning:          #F59E0B;
  --danger:           #EF4444;
  --accent:           #C9A84C;
  --accent-hover:     #A88830;

  /* Misc */
  --radius:           12px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --shadow:           0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg:        0 8px 48px rgba(0, 0, 0, 0.7);
  --transition:       0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}


/* ══════════════════════════════════════════
   LANDING OVERLAY — Split Panel (McKinsey style)
══════════════════════════════════════════ */

.landing-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: row;
  transition: opacity 0.5s ease, transform 0.5s ease;
  overflow: hidden;
}
.landing-overlay.exiting {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

/* ── LEFT PANEL ─────────────────────────── */
.lp-left {
  width: 42%;
  min-width: 340px;
  background: #07091C;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(201,168,76,0.12);
  position: relative;
  overflow: hidden;
}

/* subtle dot grid on left */
.lp-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(26,37,69,0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,37,69,0.5) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.lp-left-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 44px 52px;
}

/* Logo */
.lp-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: auto;
}
.lp-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #07091C;
  flex-shrink: 0;
}
.lp-logo-text { display: flex; flex-direction: column; gap: 2px; }
.lp-logo-name {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  line-height: 1;
}
.lp-logo-sub {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  line-height: 1;
}

/* Hero copy */
.lp-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 0 40px;
}

.lp-beta-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 20px;
}

.lp-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(52px, 5.5vw, 76px);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 28px;
}

.lp-desc {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 380px;
}

/* Domain pills on left */
.lp-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.lp-domain-pill {
  font-size: 11.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 13px;
  letter-spacing: 0.03em;
}

.lp-confidential {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* ── RIGHT PANEL ────────────────────────── */
.lp-right {
  flex: 1;
  background: #0B1640;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Decorative glows on right panel */
.lp-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}
.lp-glow-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,168,76,0.12) 0%, transparent 65%);
  top: -120px; right: -80px;
}
.lp-glow-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59,90,246,0.15) 0%, transparent 65%);
  bottom: -80px; left: -60px;
}

.lp-right-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 56px 140px;
  gap: 36px;
}

/* Bot greeting block */
.lp-bot-wrap {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.lp-bot-icon {
  width: 52px; height: 52px;
  min-width: 52px;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  backdrop-filter: blur(8px);
}

.lp-bot-greeting {
  font-size: clamp(22px, 2.8vw, 34px);
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  letter-spacing: -0.02em;
}
.lp-bot-greeting strong {
  color: var(--gold-light);
}

/* ── Document Selector (Landing) ────────── */
.lp-doc-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lp-doc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
}
.lp-doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lp-doc-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.lp-doc-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold-glow);
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}
.lp-doc-btn:hover { border-color: rgba(201,168,76,0.4); }
.lp-doc-btn:hover::before { opacity: 1; }
.lp-doc-btn.active {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
  box-shadow: 0 0 20px rgba(201,168,76,0.15), inset 0 0 12px rgba(201,168,76,0.05);
}
.lp-doc-btn.active::before { opacity: 1; }

.lp-doc-icon {
  width: 32px; height: 32px; min-width: 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.lp-doc-btn.active .lp-doc-icon {
  color: var(--gold);
  border-color: rgba(201,168,76,0.3);
  background: rgba(201,168,76,0.08);
}
.lp-doc-info {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.lp-doc-name {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.7);
  line-height: 1;
  transition: color 0.2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-doc-btn.active .lp-doc-name { color: var(--gold-light); }
.lp-doc-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-doc-btn.active .lp-doc-sub { color: rgba(201,168,76,0.6); }

/* active check badge */
.lp-doc-btn.active::after {
  content: '';
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--gold);
}

/* ── Document Filter Strip (Chat) ────────── */
.doc-filter-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.doc-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
  white-space: nowrap;
}
.doc-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.doc-filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow-sm);
}
.doc-filter-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow-sm);
  box-shadow: 0 0 10px rgba(201,168,76,0.12);
  font-weight: 600;
}
.doc-filter-active-label {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
  white-space: nowrap;
}

/* Search box on right */
.lp-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-xl);
  padding: 14px 14px 14px 20px;
  backdrop-filter: blur(10px);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lp-search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201,168,76,0.15);
}

.lp-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  color: #fff;
  min-width: 0;
}
.lp-input::placeholder { color: rgba(255,255,255,0.35); }

.lp-submit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: #07091C;
  border: none;
  border-radius: var(--radius-lg);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.lp-submit-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201,168,76,0.4);
}
.lp-submit-btn:active { transform: none; }

/* Prompts on right */
.lp-prompts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lp-prompts-label {
  font-size: 11.5px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.lp-prompts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

/* Prompt chips — shared class used by both landing variants */
.prompt-chip {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition),
              background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.prompt-chip:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(201,168,76,0.1);
  box-shadow: 0 0 14px rgba(201,168,76,0.12);
}

/* Floating badge — bottom-right corner */
.lp-float-badge {
  position: absolute;
  bottom: 36px;
  right: 36px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(7,9,28,0.85);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 14px;
  padding: 12px 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.lp-float-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #07091C;
  flex-shrink: 0;
}
.lp-float-text {
  display: flex; flex-direction: column; gap: 2px;
}
.lp-float-name {
  font-size: 14px; font-weight: 700;
  color: #fff;
  line-height: 1;
}
.lp-float-sub {
  font-size: 10px; font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.1em;
  line-height: 1;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 860px) {
  .landing-overlay { flex-direction: column; }
  .lp-left { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid rgba(201,168,76,0.12); }
  .lp-left-inner { padding: 28px 28px 32px; }
  .lp-hero { padding: 24px 0 20px; }
  .lp-title { font-size: 42px; }
  .lp-right-inner { padding: 36px 28px 100px; gap: 28px; }
  .lp-bot-greeting { font-size: 22px; }
  .lp-float-badge { bottom: 20px; right: 20px; }
  .prompt-chip { white-space: normal; }
}


/* ══════════════════════════════════════════
   CHAT LAYOUT
══════════════════════════════════════════ */

.layout { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
  width: 268px; min-width: 268px; max-width: 268px;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width .2s ease, min-width .2s ease, max-width .2s ease, opacity .2s ease;
  overflow: hidden;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar.hidden { width: 0; min-width: 0; max-width: 0; opacity: 0; border-right: none; }

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #07091C;
  flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; gap: 1px; }
.sidebar-brand-name {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1;
}
.sidebar-brand-sub {
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  line-height: 1;
}

.sidebar-new-btn-wrap {
  padding: 0 12px 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.home-btn:hover {
  background: var(--gold-glow-sm);
  border-color: var(--gold);
  color: var(--gold);
}

.new-chat-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.new-chat-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* Conversation list */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.conv-group-label {
  padding: 8px 8px 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.conv-item {
  display: flex; align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  gap: 8px;
  transition: background var(--transition);
  position: relative;
}
.conv-item:hover { background: var(--surface); }
.conv-item.active { background: var(--surface); border-left: 2px solid var(--gold); padding-left: 8px; }

.conv-item-title {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.conv-item.active .conv-item-title { color: var(--text); }

.conv-item-actions { display: none; align-items: center; gap: 2px; flex-shrink: 0; }
.conv-item:hover .conv-item-actions,
.conv-item.active .conv-item-actions { display: flex; }

.conv-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: transparent; border: none;
  color: var(--text-faint);
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.conv-action-btn:hover { background: var(--border); color: var(--text); }
.conv-action-btn.danger:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.model-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-faint);
  padding: 6px 8px;
}
.model-dot {
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Main ─────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--sidebar-bg);
}
.topbar.visible { display: flex; }

.topbar-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.topbar-logo-mark {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #07091C;
}
.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chat wrapper ─────────────────────────── */
.chat-wrapper {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--bg);
}
.chat-wrapper::-webkit-scrollbar { width: 5px; }
.chat-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Welcome screen ──────────────────────── */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 48px 24px;
  text-align: center;
}

.welcome-apex-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #07091C;
  margin-bottom: 20px;
  box-shadow: 0 0 40px rgba(201,168,76,0.2);
}

.welcome-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.welcome-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 580px;
  width: 100%;
}

.suggestion-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
}
.suggestion-card:hover {
  background: var(--surface-hover);
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--gold-glow-sm);
}

.suggestion-icon {
  width: 28px; height: 28px;
  background: var(--gold-glow-sm);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}
.suggestion-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.suggestion-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Messages ─────────────────────────────── */
.messages { padding: 24px 0 32px; }

.message-row {
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.message-row.user { align-items: flex-end; }

.message-inner {
  width: 100%;
  max-width: 780px;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message-row.user .message-inner { align-items: flex-end; }

.message-bubble {
  max-width: 82%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.65;
  word-break: break-word;
}
.message-row.user .message-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-bottom-right-radius: 4px;
  color: var(--text);
}
.message-row.assistant .message-bubble {
  background: transparent;
  padding: 4px 0;
  max-width: 100%;
  border-radius: 0;
}

/* Apex AI avatar label */
.message-row.assistant .message-inner::before {
  content: '';
  display: block;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2307091C'%3E%3Cpath d='M12 2L22 20H2L12 2Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  flex-shrink: 0;
}

/* Markdown styles */
.message-bubble h1,.message-bubble h2,.message-bubble h3 { margin: 18px 0 8px; font-weight: 600; color: var(--text); }
.message-bubble h1 { font-size: 20px; } .message-bubble h2 { font-size: 17px; } .message-bubble h3 { font-size: 15px; }
.message-bubble h1:first-child,.message-bubble h2:first-child,.message-bubble h3:first-child { margin-top: 0; }
.message-bubble p { margin: 8px 0; }
.message-bubble p:first-child { margin-top: 0; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul,.message-bubble ol { margin: 8px 0; padding-left: 22px; }
.message-bubble li { margin: 5px 0; }
.message-bubble strong { font-weight: 600; color: var(--text); }
.message-bubble em { font-style: italic; }
.message-bubble a { color: var(--gold); text-decoration: underline; }
.message-bubble blockquote {
  border-left: 3px solid var(--gold);
  margin: 10px 0;
  padding: 6px 14px;
  color: var(--text-muted);
  background: var(--gold-glow-sm);
  border-radius: 0 6px 6px 0;
}
.message-bubble table { border-collapse: collapse; margin: 12px 0; font-size: 13.5px; width: 100%; }
.message-bubble th,.message-bubble td { border: 1px solid var(--border-light); padding: 7px 12px; }
.message-bubble th { background: var(--surface-2); font-weight: 600; color: var(--gold); }
.message-bubble code {
  background: rgba(201,168,76,0.08);
  color: var(--gold-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: 'Fira Code', Consolas, monospace;
}
.message-bubble pre {
  background: #070C1A;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin: 14px 0;
  overflow: hidden;
}
.message-bubble pre code {
  display: block;
  padding: 14px 18px;
  overflow-x: auto;
  background: transparent;
  border-radius: 0;
  line-height: 1.55;
}

.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: #050A16;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
}
.copy-btn {
  background: transparent; border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
  display: flex; align-items: center; gap: 4px;
}
.copy-btn:hover { background: var(--surface-hover); color: var(--text); }
.copy-btn.copied { color: var(--gold); }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 14px 0; }
.typing-dot {
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0.5;
  animation: apex-bounce 1.3s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes apex-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* Message actions */
.message-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); margin-top: 4px; }
.message-row:hover .message-actions { opacity: 1; }
.msg-action-btn {
  display: flex; align-items: center; gap: 4px;
  background: transparent; border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
}
.msg-action-btn:hover { background: var(--surface-hover); color: var(--text); }

/* File notice in chat */
.file-notice {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text);
  margin: 4px 0;
  max-width: 100%;
}
.file-notice-icon { color: var(--gold); flex-shrink: 0; margin-top: 1px; }
.file-notice-body { display: flex; flex-direction: column; gap: 3px; }
.file-notice-title { font-weight: 600; color: var(--gold); }
.file-notice-meta { font-size: 12px; color: var(--text-muted); }
.file-notice-constraint { font-size: 12px; color: var(--warning); margin-top: 2px; }

/* ── File pills ───────────────────────────── */
.file-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 28px 8px;
  max-width: 808px;
  width: 100%;
  margin: 0 auto;
}
.file-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 5px 12px 5px 9px;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 260px;
}
.file-pill svg { flex-shrink: 0; }
.file-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill-meta { color: var(--text-faint); flex-shrink: 0; font-size: 11px; }
.file-pill-remove {
  background: transparent; border: none;
  color: var(--text-faint);
  cursor: pointer; padding: 0 2px; font-size: 16px; flex-shrink: 0;
  border-radius: 50%; transition: color var(--transition); line-height: 1;
}
.file-pill-remove:hover { color: var(--danger); }

/* ── Input area ───────────────────────────── */
.input-area {
  padding: 8px 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.input-box {
  display: flex; align-items: flex-end;
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  gap: 10px;
  width: 100%; max-width: 780px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow-sm);
}

.attach-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: transparent; border: none;
  color: var(--text-muted);
  border-radius: 8px; cursor: pointer; flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.attach-btn:hover { background: var(--surface-hover); color: var(--text); }
.attach-btn.active { color: var(--gold); }

#messageInput {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; line-height: 1.5;
  resize: none; max-height: 200px; overflow-y: auto;
  font-family: inherit;
}
#messageInput::placeholder { color: var(--text-faint); }
#messageInput::-webkit-scrollbar { width: 4px; }
#messageInput::-webkit-scrollbar-thumb { background: var(--border); }

.send-btn {
  width: 36px; height: 36px;
  border-radius: 9px; border: none;
  background: var(--gold);
  color: #07091C;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
}
.send-btn:not(:disabled):hover { background: var(--gold-light); transform: translateY(-1px); }
.send-btn:disabled { background: var(--surface-hover); color: var(--text-faint); cursor: not-allowed; opacity: 0.5; }

.stop-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.stop-btn:hover { background: var(--surface-hover); color: var(--text); }

.disclaimer {
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  max-width: 640px;
}


/* ══════════════════════════════════════════
   DESCRIPTION MODAL
══════════════════════════════════════════ */

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 300;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 620px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.modal-header { padding: 22px 24px 14px; flex-shrink: 0; }
.modal-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-title-row svg { color: var(--gold); flex-shrink: 0; }
.modal-filename { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.modal-tabs { display: flex; gap: 4px; padding: 0 24px 0; overflow-x: auto; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.modal-tabs:empty { display: none; }
.modal-tab { padding: 8px 14px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 13px; font-family: inherit; cursor: pointer; white-space: nowrap; transition: color var(--transition), border-color var(--transition); margin-bottom: -1px; }
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 500; }

.modal-body { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.modal-sheet-info { display: flex; gap: 12px; margin-bottom: 4px; }
.modal-info-badge { font-size: 12px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; }

.modal-col-row { display: flex; flex-direction: column; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; transition: border-color var(--transition); }
.modal-col-row:focus-within { border-color: var(--gold); }
.modal-col-header { display: flex; align-items: center; gap: 8px; }
.modal-col-name { font-size: 13px; font-weight: 600; color: var(--text); font-family: 'Fira Code', Consolas, monospace; }

.stat-badge { font-size: 11px; padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.stat-badge.numeric { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.stat-badge.text { background: rgba(201,168,76,0.12); color: var(--gold-light); }
.stat-badge.empty { background: var(--surface-hover); color: var(--text-faint); }
.stat-detail { font-size: 11px; color: var(--text-faint); margin-left: auto; }

.modal-col-input {
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 13px; padding: 4px 0; outline: none;
  font-family: inherit; transition: border-color var(--transition); width: 100%;
}
.modal-col-input::placeholder { color: var(--text-faint); }
.modal-col-input:focus { border-bottom-color: var(--gold); }

.modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 20px; border-top: 1px solid var(--border); flex-shrink: 0; gap: 12px; }
.modal-constraint-note { font-size: 12px; color: var(--warning); flex: 1; line-height: 1.4; }
.modal-btns { display: flex; gap: 8px; flex-shrink: 0; }

.modal-skip-btn {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-muted); border-radius: 8px; padding: 8px 18px;
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.modal-skip-btn:hover { background: var(--surface-hover); color: var(--text); }

.modal-done-btn {
  background: var(--gold); border: none;
  color: #07091C; border-radius: 8px; padding: 8px 22px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background var(--transition);
}
.modal-done-btn:hover { background: var(--gold-light); }


/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */

@media (max-width: 700px) {
  .sidebar { position: absolute; left: 0; top: 0; height: 100%; z-index: 50; }
  .suggestion-grid { grid-template-columns: 1fr; max-width: 340px; }
  .welcome-title { font-size: 22px; }
  .modal { max-height: 95vh; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .landing-header { padding: 20px 20px; }
  .landing-footer { padding: 16px 20px 24px; }
  .prompts-grid { flex-direction: column; align-items: center; }
  .prompt-chip { white-space: normal; text-align: center; }
  .landing-submit-btn span { display: none; }
}
