/* ==========================================================
   NovaCody v9.0 — Chat App Styles
   Dark "nova" theme: charcoal + emerald/teal accents
   Pro SaaS-level polish
   ========================================================== */

:root {
  --bg: #0a0f0e;
  --bg-elev: #11181a;
  --bg-elev2: #161f22;
  --bg-hover: #1c272b;
  --border: #1f2a2d;
  --border-light: #2a3a3e;
  --text: #e8f0ee;
  --text-muted: #8b9b97;
  --text-dim: #5f6e6b;
  --accent: #2dd4bf;
  --accent-2: #34d399;
  --accent-glow: rgba(45, 212, 191, 0.18);
  --danger: #f87171;
  --coral: #fb7185;
  --amber: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 280px;
  --sidebar-collapsed-w: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
textarea, input, select { font-family: inherit; }

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

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: width .2s ease;
}
#sidebar.collapsed { width: var(--sidebar-collapsed-w); }
#sidebar.collapsed .brand-name,
#sidebar.collapsed .new-chat-label,
#sidebar.collapsed .conv-title,
#sidebar.collapsed .conv-del { display: none; }
#sidebar.collapsed .brand { justify-content: center; }
#sidebar.collapsed .new-chat-btn { padding: 11px; justify-content: center; }
#sidebar.collapsed .conv-item { justify-content: center; padding: 9px; }
#sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 8px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { filter: drop-shadow(0 2px 8px var(--accent-glow)); }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.round { width: 42px; height: 42px; border: 1px solid var(--border-light); }
.icon-btn.round:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.recording { color: var(--coral); border-color: var(--coral); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.new-chat-btn {
  margin: 14px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: none;
  border-radius: var(--radius-sm);
  color: #062019;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.new-chat-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 18px var(--accent-glow); }

.conversations {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .12s;
  position: relative;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text); }
.conv-item.active { background: var(--bg-hover); color: var(--text); }
.conv-item.active::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-del {
  opacity: 0;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { background: rgba(248,113,113,.15); color: var(--danger); }

/* ===== Main ===== */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  position: relative;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,15,14,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  height: 56px;
}
.topbar-skill { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.skill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); transition: background .15s; }
.topbar-spacer { flex: 1; }
.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 11px;
  color: var(--text-muted);
}
.online-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: online-pulse 2s ease-in-out infinite;
}
@keyframes online-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.only-desktop { display: inline-flex; }

/* ===== v5: Provider toggle (Cloud ↔ In-Browser) ===== */
.provider-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.provider-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.provider-btn:hover:not(:disabled) { color: var(--text); background: var(--bg-elev2); }
.provider-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 1px 8px rgba(20, 184, 166, .25);
}
.provider-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.provider-btn svg { flex-shrink: 0; }

@media (max-width: 640px) {
  .provider-btn span { display: none; }
  .provider-btn { padding: 6px 8px; }
}

/* ===== v5: WebLLM model loading progress ===== */
.webllm-progress {
  margin: 16px auto;
  max-width: 560px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
}
.webllm-progress-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.webllm-progress-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.webllm-progress-text { flex: 1; min-width: 0; }
.webllm-progress-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.webllm-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elev2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.webllm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 3px;
  transition: width .3s ease;
}
.webllm-progress-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== Welcome screen ===== */
.welcome {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 24px;
}
.welcome-inner { max-width: 720px; width: 100%; text-align: center; }
.welcome-logo { filter: drop-shadow(0 4px 30px var(--accent-glow)); }
.welcome-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 18px 0 8px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.welcome-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 15px; }

/* When the input bar lives inside the welcome section (welcome state),
   drop the top border so it reads as inline rather than pinned. */
.welcome .input-bar { border-top: none; padding-top: 0; }

/* ===== Skill details (sample prompts only — no description box in v4) ===== */
.skill-details {
  width: 100%;
  max-width: 820px;
  padding: 8px 0 24px;
  margin: 0 auto;
}
.skill-details-inner { padding: 0 18px; }
.try-asking-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 10px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.try-asking-label .label-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #0a0a0a;
}

.sample-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: stretch; }
.sample-chip {
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sample-chip:hover { border-color: var(--accent); color: var(--text); background: var(--bg-hover); box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.sample-chip .chip-arrow { color: var(--text-dim); transition: color .15s, transform .15s; flex-shrink: 0; }
.sample-chip:hover .chip-arrow { color: var(--accent); transform: translateX(3px); }

/* ===== PDF download card (Report skill) ===== */
.pdf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.32);
  border-radius: var(--radius);
  margin: 6px 0 12px;
}
.pdf-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pdf-meta { flex: 1; min-width: 0; }
.pdf-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #818cf8, #8b5cf6);
  color: #fff !important;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform .15s, box-shadow .15s;
}
.pdf-download:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35); }

/* ===== Messages ===== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
}
.msg {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 14px;
  animation: fadeUp .35s ease-out both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.msg.user .msg-avatar { background: var(--bg-elev2); border: 1px solid var(--border-light); color: var(--text-muted); }
.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #062019;
}
.msg-body { flex: 1; min-width: 0; padding-top: 4px; }
.msg-role { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; font-weight: 600; }
.msg-role .skill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Markdown content */
.msg-content { font-size: 14.5px; line-height: 1.7; word-wrap: break-word; }
.msg-content p { margin: 0 0 12px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h1,.msg-content h2,.msg-content h3 { margin: 18px 0 10px; font-weight: 700; line-height: 1.3; }
.msg-content h1 { font-size: 1.5em; }
.msg-content h2 { font-size: 1.3em; }
.msg-content h3 { font-size: 1.12em; }
.msg-content ul,.msg-content ol { margin: 0 0 12px; padding-left: 22px; }
.msg-content li { margin: 3px 0; }
.msg-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 14px;
  margin: 0 0 12px;
  color: var(--text-muted);
  background: var(--bg-elev);
  border-radius: 0 8px 8px 0;
}
.msg-content code:not(pre code) {
  background: var(--bg-elev2);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--accent);
}
.msg-content pre {
  background: #0d1117 !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 14px;
  overflow: hidden;
  position: relative;
}
.msg-content pre .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.msg-content pre .copy-code {
  cursor: pointer;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  transition: color .12s;
}
.msg-content pre .copy-code:hover { color: var(--accent); }
.msg-content pre code {
  display: block;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}
.msg-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg-content table { border-collapse: collapse; margin: 0 0 14px; width: 100%; }
.msg-content th,.msg-content td { border: 1px solid var(--border-light); padding: 7px 11px; text-align: left; font-size: 13.5px; }
.msg-content th { background: var(--bg-elev); font-weight: 600; }
.msg-content hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.msg-content img.gen-image {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 4px 0;
}
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.msg-attachments img {
  max-width: 180px;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.source-card {
  padding: 9px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
}
.source-card a { color: var(--accent); font-weight: 600; display: block; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-card .src-host { color: var(--text-dim); font-size: 11px; }
.source-card .src-snippet { color: var(--text-muted); margin-top: 4px; font-size: 12px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.msg-actions { display: flex; gap: 6px; margin-top: 8px; }
.msg-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--text-dim);
  border-radius: 6px;
  transition: all .12s;
}
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.msg-action-btn.playing { color: var(--accent); }

.streaming-cursor::after {
  content: "▋";
  color: var(--accent);
  animation: blink 1s infinite;
  margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.audio-player { margin-top: 8px; width: 100%; max-width: 320px; height: 36px; }

/* ===== Thinking Indicator (v4) ===== */
.thinking-indicator {
  padding: 4px 0;
  animation: fadeUp .35s ease-out both;
}
.thinking-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.thinking-headline .ti-avatar {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.thinking-headline .ti-avatar img { width: 14px; height: 14px; }
.thinking-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.thinking-dots .tdot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: tdot-bounce 1.2s ease-in-out infinite;
}
.thinking-dots .tdot:nth-child(2) { animation-delay: .15s; }
.thinking-dots .tdot:nth-child(3) { animation-delay: .3s; }
@keyframes tdot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.4} 40%{transform:translateY(-3px);opacity:1} }

.thinking-stages { margin-left: 32px; display: flex; flex-direction: column; gap: 8px; }
.thinking-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  transition: opacity .3s;
}
.thinking-stage .stage-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.thinking-stage.done .stage-icon {
  background: rgba(52, 211, 153, .2);
  border-radius: 50%;
}
.thinking-stage.done .stage-icon svg { color: var(--accent-2); }
.thinking-stage.active .stage-icon .spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thinking-stage.pending .stage-icon {
  width: 8px; height: 8px;
  border: 1px solid var(--text-dim);
  border-radius: 50%;
  margin: 4px;
}
.thinking-stage.done .stage-text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-dim); }
.thinking-stage.active .stage-text { color: var(--text); font-weight: 500; }
.thinking-stage.pending .stage-text { color: var(--text-dim); }

/* ===== Input bar ===== */
.input-bar {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--border);
  background: rgba(10,15,14,.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 18px 12px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.attachments-preview {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.attachments-preview .att {
  position: relative;
}
.attachments-preview img {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}
.attachments-preview .att-remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--bg-elev2);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
}
.attachments-preview .att-remove:hover { color: var(--danger); }

.input-row { display: flex; align-items: flex-end; gap: 8px; }
.textarea-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--bg-elev);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 6px 6px 6px 18px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.textarea-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#prompt {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  min-height: 66px;
  max-height: 220px;
  padding: 10px 0;
}
#prompt::placeholder { color: var(--text-dim); }
.attach-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .12s;
  margin-bottom: 4px;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--accent); }
.send-btn, .stop-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.send-btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #062019;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.send-btn:hover { transform: scale(1.06); box-shadow: 0 6px 20px var(--accent-glow); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.stop-btn {
  background: var(--bg-elev2);
  border: 1px solid var(--coral);
  color: var(--coral);
}
.stop-btn:hover { background: rgba(251,113,133,.15); }

.skill-pills {
  display: flex; gap: 6px; flex-wrap: nowrap;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.skill-pills::-webkit-scrollbar { height: 4px; }
.skill-pills::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.skill-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.skill-pill:hover { border-color: var(--border-light); color: var(--text); }
.skill-pill.active { background: var(--accent-glow); border-color: var(--accent); color: var(--text); box-shadow: 0 2px 8px var(--accent-glow); }
.skill-pill .pill-icon { width: 14px; height: 14px; display: flex; align-items: center; }

.image-size-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; justify-content: flex-start;
  font-size: 12.5px; color: var(--text-muted);
}
#image-size {
  background: var(--bg-elev);
  border: 1px solid var(--border-light);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12.5px;
}

.input-helper {
  margin-top: 6px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== Floating "Built by Hemanshu" attribution ===== */
/* v8: raised z-index above the credit pill so the send/stop buttons are
   always clickable even if the pill's bounding box overlaps them on small
   screens. The input-bar itself also gets position:relative + z-index so
   the whole input row sits above the pill. */
.footer-credit-pill {
  position: absolute;
  bottom: 8px;
  right: 4px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 5px;
  background: rgba(17, 24, 26, .8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  transition: all .15s;
}
.footer-credit-pill:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-elev);
}
.footer-credit-pill .credit-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #059669);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.footer-credit-pill strong { color: var(--text); font-weight: 600; }

/* ===== Profile Modal ===== */
.profile-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.profile-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
}
.profile-modal-card {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  animation: fadeUp .3s ease-out;
}
/* Custom scrollbar for the profile modal (matches Next.js custom-scroll) */
.profile-modal-card::-webkit-scrollbar { width: 8px; }
.profile-modal-card::-webkit-scrollbar-track { background: transparent; }
.profile-modal-card::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
.profile-modal-card::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.profile-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elev2);
  border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 2;
}
.profile-modal-close:hover { color: var(--text); background: var(--bg-hover); }

/* ===== v7: Profile modal content (full detailed portfolio, mirrors Next.js) ===== */
.pm-card {
  padding: 0;
  color: var(--text);
}

/* ----- Sections (vertical rhythm + dividers) ----- */
.pm-section {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}
.pm-section:last-of-type { border-bottom: none; }
.pm-section-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.pm-section-sub {
  margin: -6px 0 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.pm-spark { color: var(--accent); font-size: 13px; }

/* ----- Hero ----- */
.pm-hero {
  position: relative;
  overflow: hidden;
  padding: 30px 28px 24px;
  border-bottom: 1px solid var(--border);
}
.pm-hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}
.pm-hero-glow-teal {
  top: -60px; right: -40px;
  width: 220px; height: 220px;
  background: rgba(45,212,191,.22);
}
.pm-hero-glow-coral {
  bottom: -70px; left: -30px;
  width: 200px; height: 200px;
  background: rgba(251,113,133,.12);
}
.pm-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.pm-avatar {
  position: relative;
  width: 80px; height: 80px;
  margin-bottom: 14px;
}
.pm-avatar-badge {
  width: 80px; height: 80px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(135deg, #2dd4bf, #10b981, #0d9488);
  box-shadow: 0 10px 28px rgba(16,185,129,.35);
}
.pm-status-dot {
  position: absolute;
  bottom: -3px; right: -3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #34d399;
  border: 3px solid var(--bg-elev);
  display: flex; align-items: center; justify-content: center;
}
.pm-status-dot::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #064e3b;
  animation: pm-pulse 1.8s infinite;
}
.pm-name {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pm-role {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.pm-avail {
  margin: 10px 0 0;
  font-size: 12px;
  color: #34d399;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(52,211,153,.1);
  border: 1px solid rgba(52,211,153,.3);
}
.pm-pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: pm-pulse 1.8s infinite;
}
@keyframes pm-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.pm-bio {
  margin: 16px 0 14px;
  max-width: 520px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-muted);
}
.pm-contact-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.pm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-light);
  background: var(--bg-elev2);
  color: var(--text);
  transition: all .15s;
  cursor: pointer;
}
.pm-btn:hover { transform: translateY(-1px); }
.pm-btn-wa { color: #34d399; border-color: rgba(52,211,153,.35); }
.pm-btn-wa:hover { background: rgba(52,211,153,.12); }
.pm-btn-email { color: var(--accent); border-color: rgba(45,212,191,.35); }
.pm-btn-email:hover { background: var(--accent-glow); }
.pm-btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}
.pm-btn-primary:hover { opacity: .88; box-shadow: 0 6px 18px rgba(232,240,238,.18); }
.pm-btn-wa-solid {
  background: #34d399;
  color: #062019;
  border-color: transparent;
}
.pm-btn-wa-solid:hover { background: #2cc189; box-shadow: 0 6px 18px rgba(52,211,153,.35); }
.pm-contact-info {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--text-dim);
}
.pm-contact-info a { color: var(--text-muted); text-decoration: none; transition: color .12s; }
.pm-contact-info a:hover { color: var(--accent); }
.pm-contact-info .sep { margin: 0 6px; opacity: .5; }

/* ----- What I've Built (stats grid) ----- */
.pm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.pm-stat {
  padding: 14px 10px;
  text-align: center;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .15s, transform .15s;
}
.pm-stat:hover { border-color: var(--border-light); transform: translateY(-2px); }
.pm-stat-num {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}
.pm-stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.25;
}

/* ----- Core Expertise ----- */
.pm-expertise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.pm-exp-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.pm-exp-card:hover { border-color: rgba(45,212,191,.3); }
.pm-exp-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 1px solid transparent;
}
.pm-tone-teal { background: rgba(45,212,191,.15); color: var(--accent); border-color: rgba(45,212,191,.3); }
.pm-tone-coral { background: rgba(251,113,133,.15); color: var(--coral); border-color: rgba(251,113,133,.3); }
.pm-tone-amber { background: rgba(251,191,36,.15); color: var(--amber); border-color: rgba(251,191,36,.3); }
.pm-exp-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
.pm-exp-desc {
  margin: 3px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ----- My Products (detailed cards) ----- */
.pm-products {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pm-product-card {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.pm-product-card:hover { border-color: rgba(45,212,191,.3); }
.pm-product-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.pm-product-logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.pm-product-meta { flex: 1; min-width: 0; }
.pm-product-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255,255,255,.06);
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pm-product-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
  color: var(--text);
}
.pm-product-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.pm-product-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}
.pm-product-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pm-ps { text-align: center; }
.pm-ps-num {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.pm-ps-label {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}
.pm-product-features {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 14px;
}
.pm-product-features li {
  position: relative;
  padding-left: 16px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.pm-product-features li::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  color: #34d399;
  font-weight: 700;
  font-size: 11px;
}
.pm-product-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pm-tag {
  padding: 4px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.pm-tag-here {
  background: rgba(251,191,36,.15);
  border-color: rgba(251,191,36,.3);
  color: var(--amber);
  font-weight: 700;
}
.pm-product-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: gap .15s, color .12s;
}
.pm-product-link:hover { gap: 7px; color: var(--accent-2); }

/* ----- My Approach ----- */
.pm-approach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.pm-approach-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  position: relative;
}
.pm-approach-num {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}
.pm-approach-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.pm-approach-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* ----- Looking Forward ----- */
.pm-forward-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-muted);
}

/* ----- Work With Me CTA ----- */
.pm-cta-section { padding: 26px 28px; }
.pm-cta {
  padding: 22px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(135deg, rgba(45,212,191,.1), rgba(20,184,166,.04));
  border: 1px solid rgba(45,212,191,.3);
}
.pm-cta-headline {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.pm-cta-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.pm-avail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-bottom: 20px;
}
.pm-avail-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}
.pm-avail-bolt { color: var(--accent); font-size: 11px; }
.pm-cta-tagline-1 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.pm-cta-sub-2 {
  margin: 0 auto 10px;
  max-width: 420px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}
.pm-cta-tagline-2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pm-cta-row { margin-bottom: 14px; }
.pm-cta-contact {
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.pm-cta-contact a { color: var(--text-muted); text-decoration: none; }
.pm-cta-contact a:hover { color: var(--accent); }
.pm-cta-contact .sep { margin: 0 6px; opacity: .5; }
.pm-cta-availability {
  margin: 0 0 14px;
  font-size: 11px;
  color: var(--text-dim);
}
.pm-cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.pm-cta-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .12s;
}
.pm-cta-links a:hover { color: var(--accent); }
.pm-globe { font-size: 11px; }

/* ----- Footer ----- */
.pm-footer {
  padding: 16px 28px 20px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  border-top: 1px solid var(--border);
}
.pm-footer strong { color: var(--text-muted); font-weight: 600; }

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .pm-hero { padding: 24px 20px 20px; }
  .pm-section { padding: 18px 20px; }
  .pm-cta-section { padding: 20px; }
  .pm-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pm-expertise-grid { grid-template-columns: 1fr; }
  .pm-approach-grid { grid-template-columns: 1fr; }
  .pm-product-stats { grid-template-columns: repeat(2, 1fr); }
  .pm-product-features { grid-template-columns: 1fr; }
  .pm-name { font-size: 22px; }
  .pm-avatar, .pm-avatar-badge { width: 68px; height: 68px; }
  .pm-avatar-badge { font-size: 22px; }
  .pm-cta { padding: 18px 14px; }
}

/* ===== Mobile ===== */
.only-mobile { display: none; }
.backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}
.backdrop.show { display: block; }

@media (max-width: 768px) {
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 50;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 30px rgba(0,0,0,.4);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar.collapsed { width: var(--sidebar-w) !important; }
  .welcome-title { font-size: 28px; }
  .msg { padding: 10px 16px; }
  .input-bar { padding: 8px 14px 10px; }
  .sources-grid { grid-template-columns: 1fr; }
  .sample-prompts { grid-template-columns: 1fr; }
  .footer-credit-pill { bottom: 4px; right: 4px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
