/* ============================================================
   trolyao.ai Standalone Chat — Premium Dark Design System
   ============================================================ */

:root {
  --bg-app: #050811;
  --bg-sidebar: #090d1a;
  --bg-sidebar-hover: rgba(99, 102, 241, 0.08);
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-input: #0f172a;
  --bg-modal: #0d1224;
  --border: rgba(99, 102, 241, 0.14);
  --border-focus: rgba(99, 102, 241, 0.45);
  --border-subtle: rgba(255, 255, 255, 0.06);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --emerald: #10b981;
  --rose: #f43f5e;
  --amber: #f59e0b;

  --grad-primary: linear-gradient(135deg, #6366f1, #8b5cf6 50%, #22d3ee);
  --grad-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06));
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 70%);

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-w: 280px;
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── APP LAYOUT ─── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
  background: var(--bg-app);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 40%);
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s var(--ease), width 0.3s var(--ease);
}

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

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.brand-icon {
  height: 32px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4));
}

.brand-dot {
  color: var(--cyan);
}

.btn-close-sidebar {
  display: none;
}

.sidebar-actions {
  padding: 16px 16px 10px;
}

.btn-new-chat {
  width: 100%;
  padding: 11px 16px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
  transition: all 0.2s var(--ease);
}

.btn-new-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}

.sidebar-search {
  padding: 0 16px 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text-muted);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.sessions-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  font-weight: 600;
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  position: relative;
  text-decoration: none;
  overflow: hidden;
}

.session-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.session-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
  font-weight: 500;
  border-left: 3px solid var(--accent);
}

.session-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 6px;
}

.session-delete-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.15s, color 0.15s;
}

.session-item:hover .session-delete-btn {
  opacity: 1;
}

.session-delete-btn:hover {
  color: var(--rose);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(5, 8, 17, 0.5);
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  width: 100%;
}

.footer-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-clear-all {
  color: var(--text-muted);
  font-size: 12px;
}

.btn-clear-all:hover {
  color: var(--rose);
}

/* ─── MAIN CHAT AREA ─── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Topbar */
.chat-topbar {
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(9, 13, 26, 0.6);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-toggle-menu {
  display: none;
}

.session-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.model-badge:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.status-dot.offline {
  background: var(--rose);
  box-shadow: 0 0 8px var(--rose);
}

.status-dot.loading {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ─── MESSAGES CONTAINER ─── */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
}

.chat-messages-container::-webkit-scrollbar {
  width: 6px;
}
.chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* ─── EMPTY STATE HERO ─── */
.empty-state {
  margin: auto;
  max-width: 800px;
  width: 100%;
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-hero-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 20px;
  background: var(--grad-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
}

.empty-hero-icon img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.empty-hero-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 40%, var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.empty-hero-subtitle {
  color: var(--text-secondary);
  font-size: 14.5px;
  max-width: 540px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.prompt-card:hover {
  background: rgba(22, 33, 62, 0.7);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.prompt-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.prompt-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.prompt-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── MESSAGES LIST ─── */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
  animation: fadeIn 0.25s var(--ease);
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.message-row.user .message-avatar {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
}

.message-row.assistant .message-avatar {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.message-content-wrapper {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sender-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

.message-body {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-primary);
  word-break: break-word;
}

.message-row.user .message-body {
  background: rgba(30, 41, 59, 0.6);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  display: inline-block;
  white-space: pre-wrap;
}

/* ─── THINKING / REASONING ACCORDION ─── */
.thinking-box {
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-left: 3px solid var(--violet);
  border-radius: 8px;
  margin: 8px 0 12px;
  overflow: hidden;
  transition: all 0.2s var(--ease);
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: rgba(139, 92, 246, 0.08);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--violet);
  user-select: none;
}

.thinking-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thinking-icon {
  font-size: 14px;
}

.thinking-chevron {
  transition: transform 0.2s;
}

.thinking-box.collapsed .thinking-chevron {
  transform: rotate(-90deg);
}

.thinking-body {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  border-top: 1px dashed rgba(139, 92, 246, 0.15);
  max-height: 400px;
  overflow-y: auto;
}

.thinking-box.collapsed .thinking-body {
  display: none;
}

/* ─── MARKDOWN STYLES ─── */
.message-body p {
  margin-bottom: 10px;
}
.message-body p:last-child {
  margin-bottom: 0;
}

.message-body pre {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin: 12px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-copy-code {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.btn-copy-code:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.message-body code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.message-body :not(pre) > code {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.message-body pre code {
  display: block;
  padding: 14px;
  overflow-x: auto;
  line-height: 1.5;
}

.message-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13.5px;
}

.message-body th, .message-body td {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
}

.message-body th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  text-align: left;
}

.message-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.message-body ul, .message-body ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.message-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 10px 0;
}

/* Message Actions */
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.msg-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.msg-action-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ─── BOTTOM INPUT WRAPPER ─── */
.chat-input-wrapper {
  padding: 0 24px 20px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 14px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(16px);
}

.input-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 10px 36px rgba(99, 102, 241, 0.18);
}

.tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.tool-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.input-counter {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Attachments preview */
.attachment-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.attachment-chip .remove-chip {
  cursor: pointer;
  color: var(--text-muted);
}
.attachment-chip .remove-chip:hover {
  color: var(--rose);
}

.input-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  min-height: 24px;
  outline: none;
  padding: 4px 0;
}

#user-input::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  transition: all 0.2s var(--ease);
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.stop-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--rose);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
  animation: pulseStop 1.5s infinite;
}

@keyframes pulseStop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(244, 63, 94, 0.6); }
  100% { transform: scale(1); }
}

.chat-disclaimer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ─── MODAL STYLES ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s var(--ease);
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-group h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body::-webkit-scrollbar {
  width: 5px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-hint {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.btn-toggle-pw {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s;
}

.preset-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--border);
}

.preset-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.preset-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.preset-endpoint {
  font-size: 11px;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 14px;
}

.col-half {
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(5, 8, 17, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.status-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-banner.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald);
}

.status-banner.error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--rose);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── MOBILE RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .btn-close-sidebar {
    display: inline-flex;
  }

  .btn-toggle-menu {
    display: inline-flex;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .session-title {
    max-width: 180px;
  }

  .chat-input-wrapper {
    padding: 0 12px 12px;
  }
}
