@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,400;0,600;0,700;0,800;0,900;1,700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  color-scheme: dark;
  --black:     #08090b;
  --ink:       #0e1117;
  --surface:   #13171f;
  --raise:     #1b2130;
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(255,255,255,0.14);
  --gold:      #f5c842;
  --gold-dim:  rgba(245,200,66,0.1);
  --gold-glow: rgba(245,200,66,0.2);
  --electric:  #5fe4ff;
  --elec-dim:  rgba(95,228,255,0.1);
  --text:      #eef0f6;
  --muted:     #7a849a;
  --faint:     #3b4257;
  --font-head: 'Barlow Condensed', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px;
  --shadow-pop: 0 16px 64px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 15px;
}
a { color: var(--electric); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; cursor: pointer; }
button { background: none; border: none; color: inherit; }

/* Grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.022;
  pointer-events: none;
  z-index: 9999;
}

/* ─── LAYOUT ────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 260px minmax(0,1fr); min-height: 100vh; }

/* ─── SIDEBAR ───────────────────────────────── */
.sidebar {
  background: var(--ink);
  border-right: 1px solid var(--border);
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 15px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; }
.brand-name {
  font-family: var(--font-head);
  font-size: 19px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text); line-height: 1;
}
.brand-tag { font-size: 10.5px; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; margin-top: 1px; }

.new-chat-btn {
  margin: 12px 12px 6px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 14px;
  background: var(--gold); color: var(--black);
  border-radius: var(--r-sm);
  font-family: var(--font-head); font-weight: 800; font-size: 14px;
  letter-spacing: 0.07em; text-transform: uppercase;
  transition: background 0.15s, transform 0.1s;
  width: calc(100% - 24px);
}
.new-chat-btn:hover { background: #ffd94d; transform: translateY(-1px); }
.new-chat-btn svg { width: 13px; height: 13px; }

.sidebar-nav { padding: 4px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: color 0.15s, background 0.15s;
  width: 100%; text-align: left;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.65; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--gold); background: var(--gold-dim); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.sidebar-section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint);
  padding: 10px 18px 4px;
}

.sidebar-profile {
  margin: 6px 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.sidebar-profile-role {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 3px;
}
.sidebar-profile-name {
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em; color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-profile-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-bottom: 10px;
}
.spf-item span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.spf-item strong { display: block; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-edit-btn {
  width: 100%; padding: 7px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: color 0.15s, border-color 0.15s;
}
.sidebar-edit-btn:hover { color: var(--text); border-color: var(--border-hi); }

.history-list { padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.history-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.history-item:hover { background: rgba(255,255,255,0.04); border-color: var(--border); }
.history-item.active { background: var(--gold-dim); border-color: rgba(245,200,66,0.22); }
.history-item-title {
  display: block; font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.history-item.active .history-item-title { color: var(--gold); }
.history-item-time { font-size: 11px; color: var(--muted); }
.history-empty { padding: 10px 10px; font-size: 13px; color: var(--faint); }

.mobile-dim {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 35;
  backdrop-filter: blur(2px);
}

/* ─── WORKSPACE ─────────────────────────────── */
.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8,9,11,0.93);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; overflow: hidden; }
.topbar-menu-btn {
  width: 34px; height: 34px;
  display: none; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--muted);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.topbar-menu-btn:hover { color: var(--text); border-color: var(--border-hi); }
.topbar-menu-btn svg { width: 17px; height: 17px; }
.topbar-title {
  font-family: var(--font-head);
  font-weight: 800; font-size: 17px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.topbar-subtitle {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-btn {
  padding: 7px 13px; border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.topbar-btn:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,0.04); }

.view { display: none; }
.view.active { display: block; }

/* ─── CHAT VIEW ─────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 290px;
  height: calc(100vh - 56px);
}
.chat-main {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0; overflow: hidden;
}

.chat-hero { padding: 32px 32px 0; flex-shrink: 0; animation: fadeUp 0.35s ease both; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 10px;
}
.hero-eyebrow::before { content: ''; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; display: inline-block; }
.chat-hero h1 {
  font-family: var(--font-head); font-weight: 900;
  font-size: clamp(30px, 4vw, 50px);
  letter-spacing: 0.02em; text-transform: uppercase;
  line-height: 0.94; color: var(--text); margin-bottom: 12px;
}
.chat-hero h1 em { font-style: normal; color: var(--gold); }
.chat-hero p {
  font-size: 14px; color: var(--muted);
  line-height: 1.62; max-width: 520px; margin-bottom: 22px;
}

.starter-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 26px; }
.starter-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.2s;
  display: flex; flex-direction: column; gap: 4px;
  animation: fadeUp 0.4s ease both;
}
.starter-card:nth-child(1) { animation-delay: 0.05s; }
.starter-card:nth-child(2) { animation-delay: 0.10s; }
.starter-card:nth-child(3) { animation-delay: 0.15s; }
.starter-card:nth-child(4) { animation-delay: 0.20s; }
.starter-card:hover { border-color: rgba(245,200,66,0.32); background: var(--raise); transform: translateY(-2px); }
.starter-card-title { font-family: var(--font-head); font-weight: 700; font-size: 13.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); }
.starter-card-body { font-size: 12px; color: var(--muted); line-height: 1.45; }

.messages-scroll { flex: 1; overflow-y: auto; padding: 8px 32px 20px; min-height: 0; scroll-behavior: smooth; }
.messages-scroll::-webkit-scrollbar { width: 4px; }
.messages-scroll::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }
.messages-inner { display: flex; flex-direction: column; gap: 16px; }

.msg-row { display: flex; gap: 10px; align-items: flex-start; }
.msg-row.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 7px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 800; font-size: 11px; letter-spacing: 0.04em;
}
.msg-row.user .msg-avatar { background: var(--raise); border: 1px solid var(--border-hi); color: var(--muted); }
.msg-row.assistant .msg-avatar { background: var(--gold); color: var(--black); }
.msg-bubble {
  max-width: min(74%, 660px); padding: 12px 16px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  font-size: 14.5px; line-height: 1.62;
}
.msg-row.user .msg-bubble { background: var(--raise); border-color: var(--border-hi); border-bottom-right-radius: 4px; }
.msg-row.assistant .msg-bubble { background: var(--surface); border-bottom-left-radius: 4px; }
.msg-role { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 5px; color: var(--muted); }
.msg-row.assistant .msg-role { color: var(--gold); }
.msg-body { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.typing-indicator { display: flex; gap: 5px; align-items: center; padding: 2px 0; }
.typing-indicator span { width: 7px; height: 7px; background: var(--gold); border-radius: 50%; opacity: 0.4; animation: typepulse 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typepulse { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1.1)} }

.composer-wrap { padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.composer {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 8px 8px 8px 18px;
  transition: border-color 0.2s;
}
.composer:focus-within { border-color: rgba(245,200,66,0.38); }
#chatInput {
  flex: 1; background: none; border: none; outline: none;
  resize: none; color: var(--text); font-size: 14.5px;
  line-height: 1.55; min-height: 40px; max-height: 160px;
  padding: 7px 0; caret-color: var(--gold);
}
#chatInput::placeholder { color: var(--faint); }
.send-btn {
  width: 40px; height: 40px;
  background: var(--gold); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--black);
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover { background: #ffd94d; transform: scale(1.06); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.4; transform: none; cursor: not-allowed; }
.send-btn svg { width: 17px; height: 17px; }
.composer-hint { font-size: 11px; color: var(--faint); padding: 4px 18px 0; }

.chat-rail { overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.chat-rail::-webkit-scrollbar { width: 3px; }
.chat-rail::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }
.rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; }
.rail-label { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.knowledge-item { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.knowledge-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.knowledge-item h4 { font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text); margin-bottom: 3px; }
.knowledge-item p { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ─── SECTION SHELL ─────────────────────────── */
.section-shell { max-width: 1100px; margin: 0 auto; padding: 36px 36px 60px; width: 100%; }
.section-header { margin-bottom: 30px; }
.section-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 8px;
}
.section-eyebrow::before { content: ''; width: 18px; height: 2px; background: var(--gold); border-radius: 1px; }
.section-title {
  font-family: var(--font-head); font-weight: 900;
  font-size: clamp(36px, 5vw, 58px);
  letter-spacing: 0.02em; text-transform: uppercase;
  line-height: 0.95; color: var(--text); margin-bottom: 10px;
}
.section-title em { font-style: normal; color: var(--gold); }
.section-desc { font-size: 14px; color: var(--muted); max-width: 580px; line-height: 1.62; }
.section-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ─── TOOLS ─────────────────────────────────── */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px,1fr)); gap: 14px; margin-bottom: 22px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
  display: flex; flex-direction: column; gap: 10px;
}
.tool-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.tool-card-icon {
  width: 38px; height: 38px;
  background: var(--gold-dim); border: 1px solid rgba(245,200,66,0.18);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; color: var(--gold);
}
.tool-card-icon svg { width: 18px; height: 18px; }
.tool-card h3 { font-family: var(--font-head); font-weight: 700; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); }
.tool-card p { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.tool-open-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--raise); border: 1px solid var(--border-hi);
  border-radius: var(--r-sm); font-size: 12px; font-weight: 700; color: var(--text);
  letter-spacing: 0.05em; text-transform: uppercase;
  font-family: var(--font-head);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  align-self: flex-start;
}
.tool-open-btn:hover { background: var(--gold-dim); border-color: rgba(245,200,66,0.28); color: var(--gold); }
.tool-open-btn svg { width: 12px; height: 12px; }

.tool-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 26px; }
.tool-panel.hidden { display: none; }
.tool-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.tool-panel-title { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); }
.panel-close-btn { padding: 6px 13px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; color: var(--muted); transition: color 0.15s, border-color 0.15s; }
.panel-close-btn:hover { color: var(--text); border-color: var(--border-hi); }

/* ─── FORMS ─────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 13px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.form-field input, .form-field textarea, .form-field select {
  background: var(--ink); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 13px;
  color: var(--text); font-size: 14px;
  transition: border-color 0.2s; outline: none;
}
.form-field input:focus, .form-field textarea:focus { border-color: rgba(245,200,66,0.4); }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--faint); }

.role-select { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 18px; }
.role-btn {
  padding: 12px; background: var(--ink);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--muted); font-family: var(--font-head); font-weight: 700;
  font-size: 13.5px; letter-spacing: 0.07em; text-transform: uppercase;
  transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.role-btn svg { width: 19px; height: 19px; opacity: 0.55; }
.role-btn:hover { color: var(--text); border-color: var(--border-hi); }
.role-btn.active { background: var(--gold-dim); border-color: rgba(245,200,66,0.5); color: var(--gold); }
.role-btn.active svg { opacity: 1; }

.submit-btn {
  width: 100%; padding: 13px;
  background: var(--gold); color: var(--black);
  border-radius: var(--r-md);
  font-family: var(--font-head); font-weight: 800;
  font-size: 15px; letter-spacing: 0.09em; text-transform: uppercase;
  transition: background 0.15s, transform 0.1s; margin-top: 4px;
}
.submit-btn:hover { background: #ffd94d; transform: translateY(-1px); }

/* ─── NEWS ──────────────────────────────────── */
.news-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.news-list { display: flex; flex-direction: column; gap: 11px; }
.news-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  transition: border-color 0.2s, background 0.2s;
}
.news-card:hover { border-color: var(--border-hi); background: var(--raise); }
.news-source-tag {
  display: inline-block; font-size: 10px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--electric); background: var(--elec-dim);
  border-radius: 4px; padding: 2px 7px; margin-bottom: 7px;
}
.news-card-title {
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em; color: var(--text); line-height: 1.35;
  margin-bottom: 5px; display: block; transition: color 0.15s;
}
.news-card-title:hover { color: var(--gold); }
.news-card-summary { font-size: 13px; color: var(--muted); line-height: 1.5; }
.news-loading { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.news-guide { display: flex; flex-direction: column; gap: 10px; }
.guide-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.guide-card strong { display: block; color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 3px; }

/* ─── INSIGHTS ──────────────────────────────── */
.insights-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.insight-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
.insight-card h3 { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); margin-bottom: 7px; }
.insight-card p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

/* ─── PROFILE ───────────────────────────────── */
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 30px; max-width: 740px; }
.profile-save-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.save-note { font-size: 13px; color: var(--muted); }
.save-note.saved { color: var(--gold); }
.profile-submit-btn {
  padding: 11px 26px;
  background: var(--gold); color: var(--black);
  border-radius: var(--r-md);
  font-family: var(--font-head); font-weight: 800; font-size: 14px; letter-spacing: 0.09em; text-transform: uppercase;
  transition: background 0.15s, transform 0.1s;
}
.profile-submit-btn:hover { background: #ffd94d; transform: translateY(-1px); }

/* ─── MODAL ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: var(--r-xl); padding: 36px;
  width: min(840px, 100%); max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-pop); animation: modalIn 0.25s ease;
}
@keyframes modalIn { from{opacity:0;transform:translateY(18px) scale(0.97)} to{opacity:1;transform:none} }
.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }
.modal-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 10px;
}
.modal-eyebrow::before { content: ''; width: 18px; height: 2px; background: var(--gold); border-radius: 1px; }
.modal-title {
  font-family: var(--font-head); font-weight: 900;
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: 0.02em; text-transform: uppercase; line-height: 0.94;
  color: var(--text); margin-bottom: 10px;
}
.modal-copy { font-size: 14px; color: var(--muted); line-height: 1.62; margin-bottom: 26px; max-width: 540px; }

/* ─── UTIL ──────────────────────────────────── */
.hidden { display: none !important; }
.refresh-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  font-family: var(--font-head); letter-spacing: 0.07em; text-transform: uppercase;
  transition: all 0.15s;
}
.refresh-btn:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,0.04); }
.refresh-btn svg { width: 13px; height: 13px; }

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

/* ─── RESPONSIVE ────────────────────────────── */
@media(max-width:1200px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-rail { display: none; }
  .news-layout { grid-template-columns: 1fr; }
}
@media(max-width:980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left:0;top:0;bottom:0;
    width: min(84vw,270px);
    transform: translateX(-106%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .mobile-dim { display: block; }
  .topbar-menu-btn { display: flex; }
  .section-shell { padding: 22px 18px 48px; }
  .chat-hero { padding: 22px 18px 0; }
  .messages-scroll { padding: 6px 18px 16px; }
  .composer-wrap { padding: 11px 14px 16px; }
  .insights-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: 1; }
  .modal-card { padding: 22px; }
}
@media(max-width:640px) {
  .starter-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .topbar-right .topbar-btn:not(#resetThreadBtn):not(#insightsBtn) { display: none; }
  .chat-hero h1 { font-size: 26px; }
  .section-title { font-size: 32px; }
}
