/* ============================================================================
   Weft Client Portal — Design System
   Deep purple brand, dark surfaces, premium feel
   ============================================================================ */

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

:root {
  /* Brand palette */
  --weft-50: #faf5ff;
  --weft-100: #f3e8ff;
  --weft-200: #e9d5ff;
  --weft-300: #d8b4fe;
  --weft-400: #c084fc;
  --weft-500: #a855f7;
  --weft-600: #9333ea;
  --weft-700: #7c3aed;
  --weft-800: #6b21a8;
  --weft-900: #581c87;

  /* Surfaces */
  --darker: #050508;
  --dark: #0a0a0f;
  --surface: #111118;
  --surface-light: #1a1a24;
  --surface-hover: #22222e;
  --border: #2a2a3a;
  --border-light: #333348;

  /* Text */
  --text: #e4e4eb;
  --text-secondary: #9898ab;
  --text-muted: #666680;
  --text-dim: #444458;

  /* Status */
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ============================================================================
   Light Mode Theme
   ============================================================================ */

body.light-mode {
  --darker: #f5f5f7;
  --dark: #ffffff;
  --surface: #f0f0f4;
  --surface-light: #e8e8ee;
  --surface-hover: #dddde5;
  --border: #d0d0dc;
  --border-light: #c0c0cc;
  --text: #1a1a2e;
  --text-secondary: #4a4a60;
  --text-muted: #7a7a92;
  --text-dim: #a0a0b4;
  --green-dim: rgba(34, 197, 94, 0.1);
  --red-dim: rgba(239, 68, 68, 0.1);
  --amber-dim: rgba(245, 158, 11, 0.1);
}

body.light-mode .msg-bubble.assistant {
  background: #ffffff;
  border-color: var(--border);
}

body.light-mode .login-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

body.light-mode .login-card::before { opacity: 0.15; }

body.light-mode #login-screen::before { background: rgba(124, 58, 237, 0.08); }
body.light-mode #login-screen::after { background: rgba(168, 85, 247, 0.05); }

body.light-mode ::selection {
  background: var(--weft-200);
  color: var(--weft-900);
}

body.light-mode ::-webkit-scrollbar-thumb { background: #c0c0d0; }
body.light-mode ::-webkit-scrollbar-thumb:hover { background: var(--weft-500); }

body.light-mode .toast {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

body.light-mode .session-dropdown {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

body.light-mode .preview-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   Base
   ============================================================================ */

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--darker);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--weft-700);
  color: white;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--weft-700); }

.screen { height: 100vh; }

/* ============================================================================
   Login Screen
   ============================================================================ */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#login-screen::before,
#login-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}

#login-screen::before {
  width: 500px; height: 500px;
  background: rgba(124, 58, 237, 0.15);
  top: -10%; left: -10%;
  animation: float-slow 10s ease-in-out infinite;
}

#login-screen::after {
  width: 400px; height: 400px;
  background: rgba(168, 85, 247, 0.1);
  bottom: -10%; right: -10%;
  animation: float-slower 12s ease-in-out infinite;
}

@keyframes float-slow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 25px); }
}

@keyframes float-slower {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-25px, 40px); }
}

.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 400px;
  z-index: 1;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-xl) + 1px);
  background: linear-gradient(135deg, var(--weft-700), var(--weft-500), var(--weft-700));
  z-index: -1;
  opacity: 0.3;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo .logo-mark {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.logo-thread {
  height: 4px;
  border-radius: 2px;
  width: 36px;
}

.logo-thread:nth-child(1) { background: var(--weft-600); }
.logo-thread:nth-child(2) { background: var(--weft-500); }
.logo-thread:nth-child(3) { background: var(--weft-400); }

.login-card h1 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 14px;
}

#login-form { margin-top: 32px; }

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--weft-600);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input::placeholder { color: var(--text-dim); }

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--weft-700);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--weft-600);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
  text-align: center;
}

/* ============================================================================
   Layout — 3-column: sidebar | chat | right-panel
   ============================================================================ */

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

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--darker);
  position: relative;
}

/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-threads {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.logo-threads .t { height: 3px; width: 20px; border-radius: 1.5px; }
.logo-threads .t:nth-child(1) { background: var(--weft-600); }
.logo-threads .t:nth-child(2) { background: var(--weft-500); }
.logo-threads .t:nth-child(3) { background: var(--weft-400); }

.brand-name {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.client-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--weft-400);
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* Theme toggle + generic icon button */
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--weft-400);
  border-color: var(--weft-600);
  background: rgba(124, 58, 237, 0.08);
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 16px 20px 8px;
}

.agent-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Agent Cards */
.agent-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface);
}

.agent-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.agent-card.active {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
}

.agent-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.agent-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-card-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.agent-card.active .agent-card-avatar {
  background: rgba(124, 58, 237, 0.25);
}

.agent-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.agent-card.active .agent-card-name {
  color: var(--weft-300);
}

.agent-card-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.agent-card-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.agent-card-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.agent-card-status .dot.online {
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}

.agent-card-status .dot.sleeping { background: var(--amber); }

.agent-card-status .status-text {
  color: var(--text-dim);
}

.agent-card-status .status-text.online { color: var(--green); }
.agent-card-status .status-text.sleeping { color: var(--amber); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.agent-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.system-status-label {
  font-size: 12px;
  color: var(--text-muted);
}

.system-status-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.system-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.system-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.system-dot.offline { background: var(--red); }

#system-status-text { color: var(--text-muted); }
#system-status-text.online { color: var(--green); }
#system-status-text.offline { color: var(--red); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: var(--surface-light);
  color: var(--text);
}

.btn-logout i { font-size: 14px; opacity: 0.7; }

/* ============================================================================
   Empty State
   ============================================================================ */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 40px;
}

.empty-visual {
  position: relative;
  margin-bottom: 32px;
}

.empty-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--weft-700), var(--weft-500));
  opacity: 0.15;
  filter: blur(30px);
}

.empty-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  opacity: 0.5;
  color: var(--weft-400);
}

.empty-state h2 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 300px;
  text-align: center;
  line-height: 1.5;
}

/* ============================================================================
   Top Bar
   ============================================================================ */

.top-bar {
  height: 64px;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark);
}

.top-bar-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.top-bar-info h1 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

#top-bar-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.meta-sep {
  color: var(--text-dim);
  font-size: 8px;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-inline .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-inline.online { color: var(--green); }
.status-inline.offline { color: var(--text-muted); }

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-top-bar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}

.btn-top-bar:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--weft-600);
  color: var(--weft-300);
}

.btn-new-chat {
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-new-chat:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--weft-600);
  color: var(--weft-300);
}

.btn-new-chat i { font-size: 10px; }

/* ============================================================================
   Session History Dropdown
   ============================================================================ */

.session-dropdown {
  position: absolute;
  top: 64px;
  right: 16px;
  width: 340px;
  max-height: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 50;
  overflow: hidden;
  animation: dropdown-in 0.15s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.session-dropdown-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.session-list {
  max-height: 340px;
  overflow-y: auto;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid var(--border);
}

.session-item:last-child { border-bottom: none; }

.session-item:hover {
  background: var(--surface-hover);
}

.session-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--weft-400);
  flex-shrink: 0;
}

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

.session-item-preview {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.session-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================================
   Chat Container — flex row: chat | right-panel
   ============================================================================ */

.chat-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================================
   Welcome Screen (no messages yet)
   ============================================================================ */

.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  animation: scale-in 0.4s ease-out;
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.welcome-emoji {
  font-size: 52px;
  margin-bottom: 16px;
  animation: welcome-bounce 0.6s ease-out;
}

@keyframes welcome-bounce {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.welcome-name {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-role {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 36px;
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
}

.welcome-starters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.starter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-secondary);
  text-align: left;
}

.starter-card:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--text);
  transform: translateX(4px);
}

.starter-card span { flex: 1; }

.starter-card i {
  color: var(--weft-500);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.starter-card:hover i { opacity: 1; }

/* ============================================================================
   Messages
   ============================================================================ */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message rows — entrance animations per role */
.message-row {
  display: flex;
  gap: 12px;
}

.message-row.assistant { animation: msg-in-left 0.3s ease-out; }
.message-row.user { animation: msg-in-right 0.3s ease-out; justify-content: flex-end; }
.message-row.system { animation: fade-in 0.3s ease-out; justify-content: center; }

@keyframes msg-in-left {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes msg-in-right {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Avatar */
.msg-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-top: 2px;
}

/* Bubbles */
.msg-bubble {
  max-width: 70%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.msg-bubble.user {
  background: var(--weft-700);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.msg-bubble.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  flex: 1;
  max-width: 680px;
}

.msg-bubble.assistant.streaming {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.08);
}

/* User message text */
.msg-bubble.user .msg-text {
  white-space: pre-wrap;
}

.msg-bubble.user .msg-time {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  text-align: right;
}

/* Assistant message parts */
.msg-bubble.assistant .msg-body {
  white-space: normal;
}

.msg-bubble.assistant .msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.15s;
}

.msg-bubble.assistant:hover .msg-footer {
  opacity: 1;
}

.msg-time {
  font-size: 10px;
  color: var(--text-dim);
}

/* System messages */
.msg-system {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Markdown inside assistant bubbles */
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  margin: 12px 0 6px;
  line-height: 1.3;
}
.msg-body h1 { font-size: 18px; }
.msg-body h2 { font-size: 16px; }
.msg-body h3 { font-size: 15px; }
.msg-body h4 { font-size: 14px; }
.msg-body p { margin: 6px 0; }
.msg-body ul, .msg-body ol { padding-left: 20px; margin: 6px 0; }
.msg-body li { margin: 3px 0; }
.msg-body code {
  background: var(--surface-light);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.msg-body pre {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.4;
}
.msg-body pre code { background: none; border: none; padding: 0; }
.msg-body blockquote {
  border-left: 3px solid var(--weft-500);
  padding: 6px 12px;
  margin: 8px 0;
  color: var(--text-secondary);
  background: rgba(124, 58, 237, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg-body table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 13px; }
.msg-body th, .msg-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.msg-body th { background: var(--surface-light); font-weight: 600; }
.msg-body a { color: var(--weft-400); text-decoration: none; }
.msg-body a:hover { text-decoration: underline; }
.msg-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg-body img { max-width: 100%; border-radius: var(--radius-sm); }

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--weft-500);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.typing-text {
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.elapsed-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}

/* Feedback + Copy */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-feedback {
  display: flex;
  align-items: center;
  gap: 4px;
}

.feedback-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.5;
  transition: all 0.15s;
}

.feedback-btn:hover {
  opacity: 1;
  background: var(--surface-light);
}

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

.btn-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-dim);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy:hover {
  color: var(--text);
  background: var(--surface-light);
}

/* ============================================================================
   Tool Status + Artifact Cards (inline during streaming)
   ============================================================================ */

.tool-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  animation: fade-in 0.15s ease-out;
  margin-left: 44px;
}

.tool-status .tool-icon { font-size: 11px; opacity: 0.7; }

.tool-status.executing {
  color: var(--weft-400);
  border-color: rgba(124, 58, 237, 0.2);
  background: rgba(124, 58, 237, 0.05);
}

.tool-status.executing .tool-icon {
  animation: pulse 1s ease-in-out infinite;
}

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

/* Inline tool status pill — updates in place below the response bubble */
.tool-status-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--weft-400);
  margin-top: 4px;
  margin-left: 8px;
  animation: fade-in 0.15s ease-out;
  transition: opacity 0.15s;
}

.tool-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 1.2s ease-in-out infinite;
}

.tool-status-dot.executing {
  background: var(--weft-400);
  animation: pulse 0.8s ease-in-out infinite;
}

.tool-status-dot.done {
  background: #22c55e;
  animation: none;
}

.artifact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  animation: fade-in 0.15s ease-out;
  max-width: 300px;
  margin-left: 44px;
}

.artifact-card:hover {
  border-color: var(--weft-600);
  background: rgba(124, 58, 237, 0.05);
  transform: translateY(-1px);
}

.artifact-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.artifact-info { flex: 1; min-width: 0; }
.artifact-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.artifact-dl { color: var(--text-muted); font-size: 14px; flex-shrink: 0; transition: color 0.15s; }
.artifact-card:hover .artifact-dl { color: var(--weft-400); }

/* ============================================================================
   Input Area
   ============================================================================ */

.input-area {
  padding: 16px 24px 24px;
  background: var(--darker);
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.btn-attach {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-attach:hover {
  color: var(--weft-400);
  background: var(--surface-light);
}

.input-field {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus-within {
  border-color: var(--weft-600);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 128px;
  line-height: 1.5;
  padding: 6px 0;
}

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

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--weft-700);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-send:hover {
  background: var(--weft-600);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.3);
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
}

/* ============================================================================
   Quick Actions
   ============================================================================ */

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 24px 10px;
}

.quick-action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--weft-600);
  color: var(--weft-300);
}

/* ============================================================================
   Suggestion Cards
   ============================================================================ */

.suggestions-container {
  padding: 8px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-dim);
  animation: fade-in 0.2s ease-out;
  transition: opacity 0.2s;
}

.suggestion-card.suggestion-warning { border-left-color: var(--amber); }
.suggestion-card.suggestion-insight { border-left-color: var(--weft-500); }
.suggestion-card.suggestion-action { border-left-color: var(--green); }

.suggestion-content { flex: 1; min-width: 0; }
.suggestion-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.suggestion-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.suggestion-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.suggestion-dismiss:hover {
  color: var(--text);
  background: var(--surface-light);
}

/* ============================================================================
   Right Panel — Files & Tasks
   ============================================================================ */

.right-panel {
  width: 320px;
  min-width: 320px;
  background: var(--dark);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  background: none;
  color: var(--text-muted);
}

.panel-tab:hover {
  color: var(--text);
}

.panel-tab.active {
  background: var(--weft-700);
  color: white;
}

.panel-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.btn-toolbar-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--weft-700);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toolbar-primary:hover {
  background: var(--weft-600);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.2);
}

.btn-toolbar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}

.btn-toolbar:hover {
  color: var(--text);
  background: var(--surface-light);
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

/* Upload progress */
.upload-progress { margin: 0 12px; }

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  animation: fade-in 0.15s ease-out;
}

.upload-item-icon { font-size: 14px; color: var(--weft-400); }
.upload-item-name { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item-status { font-size: 11px; font-weight: 500; }
.upload-item-status.uploading { color: var(--weft-400); }
.upload-item-status.done { color: var(--green); }
.upload-item-status.error { color: var(--red); }

/* Breadcrumbs */
.files-breadcrumbs {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  overflow-x: auto;
  min-height: 0;
}

.files-breadcrumbs:empty { display: none; }

.breadcrumb {
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
  white-space: nowrap;
}

.breadcrumb:hover {
  color: var(--weft-400);
  background: rgba(124, 58, 237, 0.1);
}

.breadcrumb.current { color: var(--text); font-weight: 500; cursor: default; }
.breadcrumb.current:hover { background: none; }

.breadcrumb-sep { color: var(--text-dim); font-size: 10px; user-select: none; }

/* File items */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.file-item:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.file-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  color: white;
}

.file-item-icon.pdf { background: #dc2626; }
.file-item-icon.doc { background: #2563eb; }
.file-item-icon.sheet { background: #16a34a; }
.file-item-icon.image { background: #0891b2; }
.file-item-icon.code { background: #7c3aed; }
.file-item-icon.data { background: #9333ea; }
.file-item-icon.archive { background: #d97706; }
.file-item-icon.text { background: #6b7280; }
.file-item-icon.folder { background: rgba(124, 58, 237, 0.15); color: var(--weft-400); }
.file-item-icon.default { background: var(--surface-light); color: var(--text-muted); border: 1px solid var(--border); }

.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.file-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-item:hover .file-item-actions { opacity: 1; }

.file-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.file-action-btn:hover { color: var(--text); background: var(--surface); }
.file-action-btn.delete:hover { color: var(--red); background: var(--red-dim); }

/* Panel empty state */
.panel-empty {
  text-align: center;
  padding: 40px 20px;
}

.panel-empty-icon {
  font-size: 28px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.panel-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.panel-empty-text {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ============================================================================
   Task Items
   ============================================================================ */

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.task-card:hover {
  border-color: var(--border-light);
}

.task-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.task-card.active::before { background: var(--green); }
.task-card.paused::before { background: var(--text-dim); }

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.task-card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.task-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.task-badge.active {
  background: var(--green-dim);
  color: var(--green);
}

.task-badge.paused {
  background: var(--surface-light);
  color: var(--text-muted);
}

.task-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.task-card-agent {
  font-size: 11px;
  color: var(--text-dim);
}

.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.task-card-schedule {
  display: flex;
  gap: 6px;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-light);
  color: var(--text-secondary);
}

.task-tag i { font-size: 9px; opacity: 0.7; }

.task-card-runs {
  font-size: 11px;
  color: var(--text-dim);
}

.task-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.task-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.task-toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-toggle .slider::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.task-toggle input:checked + .slider {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--weft-600);
}

.task-toggle input:checked + .slider::after {
  transform: translateX(14px);
  background: var(--weft-500);
}

/* Tasks summary */
.tasks-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tasks-stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.tasks-stat-value {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tasks-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Drop zone overlay for files panel */
.panel-scroll.drag-over {
  background: rgba(124, 58, 237, 0.04);
  outline: 2px dashed var(--weft-600);
  outline-offset: -4px;
  border-radius: var(--radius-sm);
}

/* ============================================================================
   File Preview Modal
   ============================================================================ */

.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 80%;
  max-width: 900px;
  height: 80vh;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scale-in 0.2s ease-out;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-header h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 12px;
}

.preview-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.preview-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
  padding: 24px;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.preview-markdown {
  padding: 24px;
}

.preview-code {
  padding: 24px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin: 0;
  background: none;
  border: none;
}

.preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  color: var(--text-muted);
}

.preview-unsupported i {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.preview-unsupported p {
  margin-bottom: 16px;
  font-size: 14px;
}

.preview-unsupported .btn-primary {
  width: auto;
  padding: 10px 24px;
}

.preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.preview-error {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
  max-width: 360px;
}

.toast.removing {
  animation: toast-out 0.2s ease-in forwards;
}

.toast-icon { font-size: 14px; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--weft-400); }
.toast-warning .toast-icon { color: var(--amber); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ============================================================================
   Template Modal
   ============================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  animation: scale-in 0.2s ease-out;
}

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

.modal-header h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text);
  background: var(--surface-light);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

.btn-secondary {
  padding: 9px 18px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-actions .btn-primary {
  width: auto;
  padding: 9px 24px;
}

/* ============================================================================
   Hamburger & Mobile
   ============================================================================ */

.btn-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 12px;
}

.btn-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
}

.btn-hamburger:hover span { background: var(--weft-400); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1100px) {
  .right-panel {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 900px) {
  .sidebar { width: 64px; min-width: 64px; }
  .sidebar-header { padding: 16px 8px; justify-content: center; }
  .sidebar-header-right { display: none; }
  .brand-name, .client-badge, .sidebar-label,
  .agent-card-meta, .agent-card-role,
  .system-status-label, #system-status-text,
  .btn-logout span { display: none; }
  .agent-card { padding: 10px; justify-content: center; }
  .agent-card-top { margin-bottom: 0; justify-content: center; }
  .agent-card-info { gap: 0; }
  .agent-card-name { display: none; }
  .agent-card-status { display: none; }
  .sidebar-footer .system-status { justify-content: center; }
  .sidebar-footer .btn-logout { justify-content: center; padding: 8px; }
  .right-panel { display: none; }
}

@media (max-width: 600px) {
  .sidebar {
    width: 300px;
    min-width: 300px;
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left 0.25s ease;
  }
  .sidebar.sidebar-open { left: 0; }

  .btn-hamburger { display: flex; }

  .top-bar { padding-left: 16px; }
  .msg-bubble { max-width: 90% !important; }
  .input-area { padding: 8px 12px 16px; }
  .messages { padding: 16px 12px; }
  .right-panel { display: none; }

  .quick-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 12px 6px;
    -webkit-overflow-scrolling: touch;
  }

  .suggestions-container { padding: 6px 12px 0; }

  .session-dropdown {
    right: 8px;
    left: 8px;
    width: auto;
  }

  .preview-card {
    width: 95%;
    height: 90vh;
    max-height: 90vh;
  }

  .toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  .toast { max-width: 100%; }

  .sidebar-header-right { display: flex; }
  .sidebar-header, .agent-card, .agent-card-top,
  .agent-card-info, .agent-card-meta { /* reset compact styles from 900px breakpoint */ }
  .brand-name, .client-badge, .sidebar-label,
  .agent-card-meta, .agent-card-role, .agent-card-name,
  .agent-card-status, .system-status-label,
  #system-status-text, .btn-logout span { display: revert; }
  .sidebar-header { padding: 20px 20px 16px; justify-content: space-between; }
  .agent-card { padding: 14px; }
  .agent-card-top { margin-bottom: 10px; justify-content: space-between; }
  .agent-card-info { gap: 10px; }
}
