:root {
  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --user-bubble: #10B981;
  --user-text: #ffffff;
  --agent-bubble: #f1f5f9;
  --agent-text: #1e293b;
  --error: #ef4444;
  --success: #22c55e;
  --radius: 16px;
  --radius-sm: 10px;
}

/* DARK THEME */
body.dark {
  --bg: #1a1a2e;
  --surface: #16213e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d3748;
  --user-bubble: #10B981;
  --user-text: #ffffff;
  --agent-bubble: #1e293b;
  --agent-text: #e2e8f0;
  --primary-light: #064e3b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* HEADER */
.header {
  background: #0b101c;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.header-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.header-brand-icon {
  height: 26px;
  width: auto;
  object-fit: contain;
}
.header-brand-text {
  font-family: 'Major Mono Display', monospace;
  font-size: 17px;
  color: #ffffff;
  letter-spacing: 2px;
  white-space: nowrap;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  width: auto;
  flex-shrink: 0;
}

.header-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.header-info { flex: 1; min-width: 0; }

.header-name {
  font-size: 15px;
  font-weight: 600;
  object-fit: contain;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-role {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.status-dot.connected { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.status-dot.disconnected { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.status-dot.connecting { background: #f59e0b; animation: pulse 1.5s infinite; box-shadow: 0 0 6px rgba(245,158,11,0.6); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* WS Status indicator (Sprint 1.3) */
.ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
.status-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.4s ease, opacity 0.3s ease;
}
.ws-status:hover .status-label,
.ws-status.show-label .status-label {
  max-width: 200px;
  opacity: 1;
}

/* Reconnection banner */
.reconnect-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-bottom: 1px solid #f59e0b;
  font-size: 13px;
  color: #92400e;
  z-index: 50;
  flex-shrink: 0;
  max-height: 40px;
  overflow: hidden;
}
.reconnect-banner.hidden { display: none; }
.reconnect-icon {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  flex-shrink: 0;
  animation: spin 1.5s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.reconnect-text { flex: 1; }
.reconnect-btn {
  padding: 4px 12px;
  border: 1px solid #d97706;
  border-radius: 6px;
  background: #fff;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.reconnect-btn:hover { background: #fef3c7; }

/* Dark theme variants */
.dark .reconnect-banner {
  background: linear-gradient(135deg, #451a03, #78350f);
  border-color: #b45309;
  color: #fde68a;
}
.dark .reconnect-btn {
  background: #78350f;
  border-color: #b45309;
  color: #fde68a;
}
.dark .reconnect-btn:hover { background: #92400e; }
.dark .status-label { color: #aaa; }
/* Status panel (dropdown on dot click) */
.ws-status { position: relative; }
.status-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
  animation: panelSlideIn 0.2s ease;
}
@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.status-panel.hidden { display: none; }
.status-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #f1f5f9;
}
.status-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.3px;
}
.status-panel-refresh {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #94a3b8;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.2s;
}
.status-panel-refresh:hover { background: #f1f5f9; color: #475569; }
.status-panel-refresh.spinning { animation: spin 0.8s linear infinite; }
.status-panel-body { padding: 8px 12px; }
.status-panel-footer {
  padding: 6px 16px 10px;
  font-size: 10px;
  color: #94a3b8;
  text-align: right;
  border-top: 1px solid #f1f5f9;
}
.status-panel-loading {
  padding: 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

/* Individual service row */
.svc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-radius: 8px;
  transition: background 0.15s;
}
.svc-row:hover { background: #f8fafc; }
.svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.svc-dot.ok { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.5); }
.svc-dot.warning { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,0.5); }
.svc-dot.error { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.5); }
.svc-info { flex: 1; min-width: 0; }
.svc-label { font-size: 12px; font-weight: 600; color: #334155; }
.svc-detail { font-size: 10px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dark theme */
.dark .status-panel {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.dark .status-panel-header { border-color: #334155; }
.dark .status-panel-title { color: #e2e8f0; }
.dark .status-panel-refresh { color: #64748b; }
.dark .status-panel-refresh:hover { background: #334155; color: #94a3b8; }
.dark .status-panel-footer { color: #475569; border-color: #334155; }
.dark .svc-row:hover { background: #1a2332; }
.dark .svc-label { color: #e2e8f0; }
.dark .svc-detail { color: #64748b; }
.dark .status-panel-loading { color: #64748b; }


/* MESSAGES */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

@media (min-width: 769px) {
  .messages { padding: 20px 32px; gap: 10px; }
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 769px) {
  .msg { max-width: 80%; }
}

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

.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  /* white-space handled by markdown renderer */
}

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

.msg.assistant .msg-bubble {
  background: var(--agent-bubble);
  color: var(--agent-text);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; }
.msg.assistant .msg-time { text-align: left; }

/* TYPING INDICATOR */
.typing {
  display: none;
  align-self: flex-start;
  padding: 10px 14px;
  background: var(--agent-bubble);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  gap: 4px;
  align-items: center;
}

.typing.visible { display: flex; }

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* STREAMING MESSAGE */
.streaming-bubble {
  display: none;
  align-self: flex-start;
  max-width: 80%;
}

.streaming-bubble.visible { display: flex; flex-direction: column; }

.streaming-bubble .msg-bubble {
  background: var(--agent-bubble);
  color: var(--agent-text);
  border-bottom-left-radius: 4px;
}

.streaming-cursor::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary);
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* INPUT */
.input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.input-wrapper {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: flex-end;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}

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

.btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.95); }

.btn-send {
  background: var(--primary);
  color: white;
}

.btn-send:hover { background: var(--primary-dark); }
.btn-send:disabled { background: var(--border); cursor: not-allowed; }

.btn-stop {
  background: var(--error);
  color: white;
  display: none;
}

.btn-stop.visible { display: flex; }
.btn-stop:hover { background: #dc2626; }

/* SVG icons */
.icon { width: 20px; height: 20px; }

/* ERROR BANNER */
.error-banner {
  display: none;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: var(--error);
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
}

.error-banner.visible { display: block; }

/* WELCOME */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
  flex: 1;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.welcome h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.welcome p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 300px;
}

/* FOOTER */
.footer {
  background: #0b101c;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 20px;
}

.footer-item {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  object-position: left center;
}

.footer-sep {
  width: 1px;
  height: 12px;
  background: rgba(255,255,255,0.2);
}

/* ATTACHMENT */
.attach-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}
.attach-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

.attach-preview {
  display: none;
  padding: 8px 16px 0;
  background: var(--surface);
}
.attach-preview.visible { display: flex; gap: 8px; flex-wrap: wrap; }

.attach-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attach-thumb .attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}
.attach-thumb .attach-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 8px;
  padding: 1px 3px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Drag over */
.messages.drag-over {
  background: rgba(16,185,129,0.05);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}

/* Image in message bubble */
.msg-bubble img.msg-image {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  margin-bottom: 6px;
  display: block;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #0f1523;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  flex-shrink: 0;
  z-index: 20;
  transition: transform 0.3s ease, width 0.3s ease;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  transform: translateX(-100%);
}

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

@media (min-width: 769px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
  }
  .sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; }
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  object-position: left center;
  flex: 1;
}

.btn-new-chat {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s, color 0.2s;
}
.btn-new-chat:hover {
  background: rgba(255,255,255,0.1);
  object-fit: contain;
}

.sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-sessions::-webkit-scrollbar { width: 4px; }
.sidebar-sessions::-webkit-scrollbar-track { background: transparent; }
.sidebar-sessions::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.session-item:hover {
  background: rgba(255,255,255,0.06);
}
.session-item.active {
  background: rgba(16,185,129,0.2);
}

.session-wa-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.session-title {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.session-item.active .session-title {
  object-fit: contain;
}

.session-preview {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.session-time {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-top: 3px;
}


/* FOLDER SYSTEM */
.sidebar-folders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  margin-bottom: 2px;
}
.sidebar-folders-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
}
.btn-add-folder {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-add-folder:hover { color: rgba(255,255,255,0.7); }

.folder-item {
  margin-bottom: 4px;
}
.folder-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 8px;
}
.folder-header:hover {
  background: rgba(255,255,255,0.06);
}
.folder-chevron {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.4);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.folder-item.collapsed .folder-chevron {
  transform: rotate(-90deg);
}
.folder-icon {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.folder-name {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-count {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.folder-actions {
  display: none;
  gap: 4px;
}
.folder-header:hover .folder-actions {
  display: flex;
}
.folder-header:hover .folder-count {
  display: none;
}
.folder-action-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  font-size: 13px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.folder-action-btn:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.1);
}
.folder-sessions {
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.folder-item.collapsed .folder-sessions {
  max-height: 0 !important;
  overflow: hidden;
}
.folder-sessions .session-item {
  padding-left: 40px;
}
.folder-name-input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(16,185,129,0.5);
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 6px;
  outline: none;
  flex: 1;
  min-width: 0;
}

/* Context menu for sessions */
.ctx-menu {
  position: fixed;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 6px;
  min-width: 180px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  transition: background 0.12s;
}
.ctx-menu-item:hover {
  background: rgba(255,255,255,0.08);
}
.ctx-menu-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.ctx-menu-item.danger { color: #ef4444; }
.ctx-menu-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 8px;
}
.sessions-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
  padding: 12px 12px 4px;
}

.sidebar-empty {
  padding: 20px 16px;
  text-align: center;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
}

/* APP MAIN (right side) */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

/* SIDEBAR TOGGLE */
.btn-sidebar-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,0.08); color: #fff; }
@media (min-width: 769px) {
  .btn-sidebar-toggle { display: flex; }
}
.btn-sidebar-toggle svg { width: 18px; height: 18px; }


/* BURGER BUTTON (mobile) */
.btn-burger {
  display: flex;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  object-fit: contain;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border-radius: 6px;
}
.btn-burger:hover { background: rgba(255,255,255,0.1); }

/* SIDEBAR OVERLAY (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 19;
}
.sidebar-overlay.visible { display: block; }

/* Desktop adjustments */
@media (min-width: 769px) {
  .btn-burger { display: none; }
}

/* THEME TOGGLE */
.btn-theme {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  margin-left: 8px;
  width: auto;
  padding: 0;
}
.btn-theme:hover {
  background: rgba(255,255,255,0.1);
  object-fit: contain;
}
.btn-theme svg {
  width: 18px;
  height: 18px;
}

/* Dark mode adjustments */
body.dark .input-wrapper {
  background: #1e293b;
  border-color: #334155;
}
body.dark .input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
body.dark #chat-input {
  color: #e2e8f0;
}
body.dark #chat-input::placeholder {
  color: #64748b;
}
body.dark .input-area {
  background: #16213e;
  border-top-color: #2d3748;
}
body.dark .error-banner {
  background: #2d1b1b;
  border-bottom-color: #5c2b2b;
}
body.dark .welcome-icon {
  background: #1e3a5f;
}
body.dark .attach-preview {
  background: #16213e;
}
body.dark .attach-thumb {
  border-color: #334155;
}
body.dark .msg-time {
  color: #64748b;
}

/* ACCOUNT BLOCK (bottom sidebar) */
.sidebar-account {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 12px;
  flex-shrink: 0;
}


.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 4px 12px 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}
.btn-logout svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.account-profile:hover {
  background: rgba(255,255,255,0.06);
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-plan {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.plan-badge.free {
  background: rgba(100,116,139,0.3);
  color: #94a3b8;
}
.plan-badge.pro {
  background: rgba(16,185,129,0.25);
  color: #60a5fa;
}

.account-dots {
  color: rgba(255,255,255,0.3);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

/* Credits bar */
.credits-section {
  margin-top: 8px;
  padding: 0 8px;
}

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

.credits-label {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.credits-value {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}

.credits-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.credits-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
.credits-fill.medium {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.credits-fill.low {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.btn-recharge {
  width: 100%;
  margin-top: 10px;
  padding: 7px 0;
  border-radius: 6px;
  border: 1px solid rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.1);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-recharge:hover {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.6);
}

/* Account popup menu */
.account-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 12px;
  right: 12px;
  margin-bottom: 6px;
  background: #1a2035;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 30;
}
.account-menu.visible { display: block; }

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s;
}
.account-menu-item:hover {
  background: rgba(255,255,255,0.06);
  object-fit: contain;
}
.account-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}
.account-menu-sep {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0;
}

/* MICROPHONE BUTTON */
.btn-mic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}
.btn-mic:hover {
  background: var(--bg);
  color: var(--primary);
}
.btn-mic.recording {
  color: #ef4444;
  animation: micPulse 1.2s infinite;
}
.btn-mic.recording:hover {
  background: rgba(239,68,68,0.1);
}
@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Mic unsupported */
.btn-mic.unsupported {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Recording indicator */
.recording-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(239,68,68,0.08);
  border-bottom: 1px solid rgba(239,68,68,0.15);
  font-size: 12px;
  color: #ef4444;
}
.recording-indicator.visible { display: flex; }

.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: recBlink 1s infinite;
}
@keyframes recBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.recording-indicator span { flex: 1; }

body.dark .recording-indicator {
  background: rgba(239,68,68,0.1);
  border-bottom-color: rgba(239,68,68,0.2);
}

/* Markdown rendering in bubbles */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  margin: 8px 0 4px 0;
  line-height: 1.3;
}
.msg-bubble h1 { font-size: 1.2em; }
.msg-bubble h2 { font-size: 1.1em; }
.msg-bubble h3 { font-size: 1.05em; }
.msg-bubble p { margin: 4px 0; }
.msg-bubble ul, .msg-bubble ol { margin: 4px 0 4px 20px; padding: 0; }
.msg-bubble li { margin: 2px 0; }
.msg-bubble code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9em;
}
body.dark .msg-bubble code {
  background: rgba(255,255,255,0.1);
}
.msg-bubble pre {
  background: rgba(0,0,0,0.06);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  line-height: 1.4;
}
body.dark .msg-bubble pre {
  background: rgba(0,0,0,0.3);
}
.msg-bubble pre code {
  background: none;
  padding: 0;
}
.msg-bubble blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--text-muted);
}
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.msg-bubble a { color: var(--primary); text-decoration: underline; }
.msg-bubble table { border-collapse: collapse; margin: 6px 0; font-size: 0.92em; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--border); padding: 4px 8px; }
.msg-bubble th { background: rgba(0,0,0,0.04); font-weight: 600; }
body.dark .msg-bubble th { background: rgba(255,255,255,0.06); }



/* V11 PREMIUM */
.msg-actions{display:flex;gap:2px;margin-top:4px;padding:2px 4px;opacity:0;transition:opacity .2s}
.msg:hover .msg-actions,.msg:last-child .msg-actions{opacity:1}
.msg-actions{opacity:1}
@media(min-width:769px){.msg-actions{opacity:0}}
.msg:hover .msg-actions,.msg:last-child .msg-actions{opacity:1}
.msg-action{display:flex;align-items:center;justify-content:center;width:30px;height:30px;border:none;background:none;cursor:pointer;color:var(--text-muted);border-radius:6px;padding:0;transition:background .15s,color .15s}
.msg-action:hover{background:rgba(0,0,0,.06);color:var(--text)}
.msg-action.liked{color:#22c55e}.msg-action.disliked{color:#ef4444}
body.dark .msg-action:hover{background:rgba(255,255,255,.08)}
.msg-action svg{width:16px;height:16px}
.msg-action.flash{animation:af .3s ease}
@keyframes af{0%{transform:scale(1)}50%{transform:scale(1.3)}100%{transform:scale(1)}}
.suggestions{display:grid;grid-template-columns:1fr;gap:10px;max-width:100%;margin-top:16px;width:100%;padding:0 4px}
@media(min-width:769px){.suggestions{grid-template-columns:1fr 1fr;gap:12px;max-width:500px;margin-top:20px;padding:0}}
.suggestion-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px;cursor:pointer;transition:transform .15s,box-shadow .15s,border-color .15s;text-align:left}
.suggestion-card:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08);border-color:var(--primary)}
body.dark .suggestion-card:hover{box-shadow:0 4px 12px rgba(0,0,0,.3)}
.suggestion-icon{font-size:20px;margin-bottom:8px}
.suggestion-title{font-size:14px;font-weight:600;color:var(--text);margin-bottom:4px}
.suggestion-desc{font-size:12px;color:var(--text-muted);line-height:1.4}
.typing-premium{display:none;align-self:flex-start;align-items:center;gap:10px;padding:12px 16px;background:var(--agent-bubble);border-radius:var(--radius);border-bottom-left-radius:4px;animation:fsi .3s ease}
.typing-premium.visible{display:flex}
.typing-avatar{width:28px;height:28px;border-radius:50%;background:rgba(16,185,129,.15);display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:12px;font-weight:700;color:var(--primary)}
.typing-avatar img{width:28px;height:28px;border-radius:50%;object-fit:cover}
.typing-label{font-size:13px;color:var(--text-muted);font-style:italic}
.typing-dots-inline{display:inline-flex;gap:3px;margin-left:2px;vertical-align:middle}
.typing-dots-inline span{width:4px;height:4px;border-radius:50%;background:var(--text-muted);animation:typingBounce 1.4s infinite ease-in-out}
.typing-dots-inline span:nth-child(2){animation-delay:.2s}
.typing-dots-inline span:nth-child(3){animation-delay:.4s}
.copy-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:none;background:none;cursor:pointer;color:var(--text-muted);padding:0;margin-left:3px;vertical-align:middle;opacity:0;transition:opacity .15s,color .15s;border-radius:3px}
.msg-bubble:hover .copy-btn{opacity:.5}
.copy-btn:hover{opacity:1 !important;color:var(--primary);background:rgba(0,0,0,.04)}
.copy-btn.ok{opacity:1 !important;color:#22c55e}
body.dark .copy-btn:hover{background:rgba(255,255,255,.06)}
.msg-bubble pre{position:relative}
.pre-copy{position:absolute;top:6px;right:6px;opacity:0;transition:opacity .15s}
.msg-bubble pre:hover .pre-copy{opacity:.6}
.pre-copy:hover{opacity:1 !important}
.msg-bubble a{word-break:break-all}
@keyframes fsi{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.msg{animation:fsi .3s ease}

/* Safe area for notched devices (iPhone etc) */
.header { padding-top: max(12px, env(safe-area-inset-top)); }
.input-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* Mobile touch improvements */
.msg-bubble { font-size: 15px; padding: 10px 14px; }
.header { min-height: 56px; }
#chat-input { font-size: 16px; } /* Prevents iOS zoom on focus */
.input-bar button { min-width: 44px; min-height: 44px; }

@media (min-width: 769px) {
  .header-brand-text { font-size: 18px; }
  .header-brand-icon { height: 28px; }
}

/* LOGIN SCREEN */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0b101c;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.login-screen.hidden { display: none; }

.login-card {
  background: #151c2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: loginFadeIn 0.5s ease;
}
@keyframes loginFadeIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.login-logo {
  width: 120px;
  height: auto;
  border-radius: 0;
  margin: 0 auto 24px;
  object-fit: contain;
}

.login-title {
  height: 28px;
  font-size: 28px;
  object-fit: contain;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-field {
  position: relative;
  margin-bottom: 16px;
  text-align: left;
}

.login-field label {
  display: block;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  object-fit: contain;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: monospace;
}
.login-field input:focus {
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
}
.login-field input::placeholder {
  color: rgba(255,255,255,0.25);
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
}
.login-remember input[type="checkbox"] {
  accent-color: #10B981;
  width: 16px;
  height: 16px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #10B981;
  object-fit: contain;
  width: auto;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.login-btn:hover { background: #059669; }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  text-align: left;
}
.login-error.visible { display: block; }


.login-hint {
  color: rgba(255,255,255,0.3);
  font-size: 11px;
  margin-top: 4px;
  padding-left: 2px;
}
.login-footer {
  margin-top: 24px;
  color: rgba(255,255,255,0.3);
  font-size: 11px;
}
.login-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.login-footer a:hover { color: #ffffff; }

.login-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: loginSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }
/* === WhatsApp Sender Header === */
.wa-sender-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wa-sender-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.wa-sender-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wa-sender-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-sender-phone {
  font-size: 10px;
  color: #888;
  line-height: 1.2;
}

.msg.wa-message .msg-bubble {
  border-left: 3px solid #25D366;
}

.msg-text {
  word-break: break-word;
}

/* Dark theme adjustments */
body.dark .wa-sender-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark .wa-sender-name {
  color: #e0e0e0;
}

body.dark .wa-sender-phone {
  color: #999;
}

body.dark .msg.wa-message .msg-bubble {
  border-left-color: #25D366;
}

/* WhatsApp batched message separator */
.wa-segment-sep {
  border: none;
  border-top: 1px dashed rgba(255,255,255,0.15);
  margin: 8px 0;
}

body:not(.dark) .wa-segment-sep {
  border-top-color: rgba(0,0,0,0.1);
}

/* === Unread Notification Badges === */
.unread-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
  animation: badge-pop 0.3s ease;
}

.session-item {
  position: relative;
}

.session-item.has-unread .session-title {
  font-weight: 700;
}

.folder-unread-badge {
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: 6px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* === SelfChat Info Banner === */
.selfchat-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 8px 12px;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: 10px;
  color: #a0d8a0;
  font-size: 12px;
  line-height: 1.4;
}

.selfchat-banner svg {
  flex-shrink: 0;
  color: #25D366;
}

.selfchat-banner span {
  flex: 1;
}

.selfchat-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.selfchat-close:hover {
  color: #fff;
}

body:not(.dark) .selfchat-banner {
  background: rgba(37, 211, 102, 0.08);
  color: #2e7d32;
}

body:not(.dark) .selfchat-close:hover {
  color: #333;
}

/* ============================================ */
/* Sources bar — Sprint 4                       */
/* ============================================ */
.sources-bar {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  background: #f8f9fb;
  border-bottom: 1px solid #e5e7eb;
  overflow: hidden;
  flex-shrink: 0;
}
.sources-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}
.sources-scroll::-webkit-scrollbar { display: none; }
.source-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  color: #374151;
  white-space: nowrap;
  cursor: default;
  transition: all 0.2s;
  flex-shrink: 0;
}
.source-chip:hover {
  border-color: #6366f1;
  background: #eef2ff;
}
.source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}
.source-dot.active {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
.source-dot.inactive { background: #ef4444; }
.source-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}
.source-name {
  font-weight: 500;
  letter-spacing: -0.01em;
}
body.dark .sources-bar {
  background: #151a27;
  border-bottom-color: #1e293b;
}
body.dark .source-chip {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark .source-chip:hover {
  border-color: #818cf8;
  background: #1e1b4b;
}

/* ============================================ */
/* Dashboard cards — Sprint 4                   */
/* ============================================ */
.dashboard-header {
  text-align: center;
  padding: 24px 16px 8px;
}
.dashboard-avatar {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.dashboard-avatar img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.dashboard-header h2 {
  font-size: 20px; font-weight: 600;
  color: #1f2937; margin: 0 0 6px;
}
.dashboard-header p {
  font-size: 14px; color: #6b7280; margin: 0;
}
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; padding: 20px 16px;
  max-width: 720px; margin: 0 auto;
}
.dashboard-card {
  display: flex; align-items: flex-start;
  gap: 12px; padding: 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dashboard-card:hover {
  border-color: #6366f1;
  background: #f5f3ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}
.dashboard-card:active { transform: translateY(0); }
.dashboard-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #6366f1;
}
.dashboard-card-icon svg { color: #6366f1; stroke: #6366f1; }
.dashboard-card-text { flex: 1; min-width: 0; }
.dashboard-card-title {
  font-size: 14px; font-weight: 600;
  color: #1f2937; margin-bottom: 2px;
}
.dashboard-card-desc {
  font-size: 12px; color: #6b7280; line-height: 1.3;
}
body.dark .dashboard-header h2 { color: #f1f5f9; }
body.dark .dashboard-header p { color: #94a3b8; }
body.dark .dashboard-card {
  background: #1e293b; border-color: #334155;
}
body.dark .dashboard-card:hover {
  border-color: #818cf8; background: #1e1b4b;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
body.dark .dashboard-card-icon {
  background: linear-gradient(135deg, #312e81, #3730a3);
}
body.dark .dashboard-card-icon svg { color: #a5b4fc; stroke: #a5b4fc; }
body.dark .dashboard-card-title { color: #f1f5f9; }
body.dark .dashboard-card-desc { color: #94a3b8; }
@media (max-width: 600px) {
  .sources-bar { padding: 4px 8px; }
  .source-chip { padding: 3px 8px; font-size: 10px; }
  .dashboard-cards { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
  .dashboard-card { padding: 12px; }
  .dashboard-card-icon { width: 38px; height: 38px; border-radius: 10px; }
  .dashboard-card-icon svg { width: 22px; height: 22px; }
  .dashboard-header h2 { font-size: 17px; }
}
