/* ════════════════════════════════════════════════════════════
   BankRM Copilot – Design System & Styles
   3-Panel Layout: Sidebar | Chat | Side Panel
════════════════════════════════════════════════════════════ */

/* ── Google Font (Inter) fallback if offline ─────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand colors */
  --brand-50:  #edfafa;
  --brand-100: #d5f5f6;
  --brand-200: #afecef;
  --brand-500: #0e9f9f;
  --brand-600: #0a8282;
  --brand-700: #0a6566;
  --brand-800: #095050;
  --brand-900: #063e3e;

  /* Neutral */
  --gray-0:   #ffffff;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-150: #eaeff6;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --bg:             #e8edf5;
  --surface:        #ffffff;
  --surface-raised: #f8fafc;
  --surface-sunken: #f1f5f9;
  --border:         #dde3ef;
  --border-strong:  #b8c6d8;

  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted:     var(--gray-400);

  --primary:        var(--brand-700);
  --primary-hover:  var(--brand-800);
  --primary-soft:   var(--brand-50);
  --primary-ring:   rgba(10, 101, 102, 0.22);

  --success:     #16a34a;
  --success-soft: #f0fdf4;
  --warning:     #d97706;
  --warning-soft: #fffbeb;
  --danger:      #dc2626;
  --danger-soft: #fef2f2;

  /* Layout */
  --sidebar-w:    256px;
  --side-panel-w: 288px;
  --header-h:     52px;

  /* Radii */
  --radius-sm:  5px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15,23,42,0.06);
  --shadow-sm:  0 2px 6px rgba(15,23,42,0.08);
  --shadow-md:  0 4px 16px rgba(15,23,42,0.10);
  --shadow-lg:  0 12px 40px rgba(15,23,42,0.14);
  --shadow-app: 0 20px 60px rgba(15,23,42,0.18);

  /* Transitions */
  --ease-out: cubic-bezier(0.2, 0, 0.13, 1);
  --dur-fast: 140ms;
  --dur-mid:  220ms;
  --dur-slow: 360ms;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  background: var(--surface);
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-700) 60%, #117a7b 100%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 1px 0 rgba(0,0,0,0.2), 0 2px 8px rgba(10,101,102,0.3);
  z-index: 10;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.15);
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  line-height: 1;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

/* Header center */
.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  font-weight: 600;
}

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 600;
}

.model-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: rgba(22,163,74,0.15);
  border: 1px solid rgba(22,163,74,0.3);
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
  animation: pulse-dot 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

.status-dot.is-loading {
  background: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.3);
}

.status-dot.is-error {
  background: #f87171;
  box-shadow: 0 0 0 2px rgba(248,113,113,0.3);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.75);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast);
}
.icon-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ── App Body (3-panel grid) ───────────────────────────────── */
.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--side-panel-w);
  min-height: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--gray-50);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--dur-mid) var(--ease-out),
              opacity var(--dur-mid) var(--ease-out);
}

.sidebar.is-collapsed {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: background var(--dur-fast);
}
.new-chat-btn:hover { background: var(--primary-hover); }
.new-chat-btn svg { flex-shrink: 0; }

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-empty-hint {
  margin: 20px 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

/* Conversation item */
.conv-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  min-width: 0;
  animation: slide-in-left var(--dur-mid) var(--ease-out) both;
}
.conv-item:hover {
  background: var(--gray-100);
  border-color: var(--border);
}
.conv-item.is-active {
  background: var(--primary-soft);
  border-color: rgba(10,101,102,0.2);
}

.conv-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item.is-active .conv-item-title { color: var(--primary); }

.conv-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.conv-item-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: currentColor; }

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

/* ═══════════════════════════════════════════════
   CHAT PANEL
═══════════════════════════════════════════════ */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

/* Chat window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #f6f8fb 0%, #ffffff 40%);
}

.chat-window::-webkit-scrollbar { width: 5px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 10px; }
.chat-window::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* Welcome State */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  margin: 32px auto 16px;
  animation: fade-in var(--dur-slow) var(--ease-out) both;
}

.welcome-state[hidden] { display: none; }

.welcome-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #d0f0f0 100%);
  color: var(--primary);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.welcome-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

.welcome-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}

.welcome-state > p {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.suggestion-chip {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-xs);
}

/* Messages */
.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 75%;
  margin-bottom: 6px;
  animation: msg-appear var(--dur-mid) var(--ease-out) both;
}

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

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

.msg-bubble {
  padding: 11px 15px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 13.5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-600) 100%);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(10,101,102,0.25);
}

.msg.bot .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
}

.msg.is-error .msg-bubble {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

/* Loading message */
.msg.is-loading .msg-bubble {
  color: var(--text-muted);
}
.msg.is-loading .msg-bubble::after {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 3px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  animation: typing-dot 1.2s ease-in-out infinite;
  box-shadow: 9px 0 0 rgba(0,0,0,0.3), 18px 0 0 rgba(0,0,0,0.15);
}
@keyframes typing-dot {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-5px); }
}

/* Msg timestamp */
.msg-time {
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Source chip */
.msg-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: default;
  transition: border-color var(--dur-fast);
}
.msg-source-chip:hover { border-color: var(--primary); color: var(--primary); }

/* Draft editor */
.msg.has-editable-draft { max-width: min(680px, 100%); }
.msg.has-editable-draft .msg-bubble { width: 100%; }

.draft-editor {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 55vh;
  padding: 10px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  resize: vertical;
  overflow-y: auto;
  line-height: 1.6;
  transition: border-color var(--dur-fast);
}
.draft-editor:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.draft-editor[hidden] { display: none; }

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.draft-action {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--dur-fast);
}
.draft-action:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.draft-action.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.draft-action.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.draft-action[hidden] { display: none; }

/* Markdown in bot messages */
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 6px 18px; padding: 0; }
.msg-bubble li { margin-bottom: 3px; }
.msg-bubble code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg.user .msg-bubble code { background: rgba(255,255,255,0.18); }

/* ── Quick Actions ──────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.quick-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  transition: all var(--dur-fast) var(--ease-out);
  min-width: 0;
}
.quick-actions button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.quick-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.qa-key {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.quick-actions button:hover .qa-key {
  background: var(--primary);
  color: #fff;
}

.qa-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── Status bar ─────────────────────────────────────────────── */
.chat-status {
  padding: 3px 16px 2px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11.5px;
  min-height: 20px;
  line-height: 20px;
  border-top: 1px solid var(--gray-100);
}

/* ── Composer ───────────────────────────────────────────────── */
.composer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.composer-inner:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.composer-inner textarea {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  max-height: 140px;
  overflow-y: auto;
}
.composer-inner textarea::placeholder { color: var(--text-muted); }
.composer-inner textarea:focus { outline: none; }
.composer-inner textarea:disabled { cursor: not-allowed; }

#sendButton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: background var(--dur-fast), opacity var(--dur-fast);
  align-self: flex-end;
  margin-bottom: 0;
}
#sendButton:hover { background: var(--primary-hover); }
#sendButton:disabled { cursor: not-allowed; opacity: 0.55; }
#sendButton.is-loading { background: var(--gray-500); }

/* ═══════════════════════════════════════════════
   SIDE PANEL
═══════════════════════════════════════════════ */
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background: var(--gray-50);
  border-left: 1px solid var(--border);
  padding: 10px 8px;
  gap: 8px;
}

.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 10px; }

.sp-section {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-fast);
}
.sp-section:hover { box-shadow: var(--shadow-sm); }

.sp-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-raised);
}
.sp-section-header svg { flex-shrink: 0; }

.sp-badge {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.sp-section-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  padding: 6px 0 2px;
}

/* Tool Trace Steps */
.trace-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fade-in var(--dur-mid) var(--ease-out) both;
}

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

.trace-step-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
}

.trace-step-icon.pending  { background: var(--gray-100); color: var(--text-muted); }
.trace-step-icon.running  { background: #fef3c7; color: #d97706; animation: spin 1s linear infinite; }
.trace-step-icon.done     { background: #dcfce7; color: #16a34a; }
.trace-step-icon.error    { background: var(--danger-soft); color: var(--danger); }

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

.trace-step-body {
  flex: 1;
  min-width: 0;
}

.trace-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trace-step-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trace-connector {
  width: 1px;
  height: 10px;
  background: var(--border);
  margin: 2px 0 2px 11px;
}

/* Source pills */
.source-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  animation: fade-in var(--dur-mid) var(--ease-out) both;
}

.source-pill-method {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.source-pill-endpoint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Customer cards */
.customer-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  animation: fade-in var(--dur-mid) var(--ease-out) both;
}

.customer-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-200), var(--brand-100));
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.customer-info { flex: 1; min-width: 0; }
.customer-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Utility ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Focus Styles ───────────────────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */

/* Tablet: hide side panel */
@media (max-width: 1024px) {
  :root { --side-panel-w: 256px; }
}

@media (max-width: 860px) {
  .app-body {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
  .side-panel { display: none; }
}

/* Mobile: hide sidebar too */
@media (max-width: 640px) {
  .app-body {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .msg { max-width: 90%; }
  .chat-window { padding: 14px 12px; }

  .brand-name { font-size: 14px; }
  .header-center { display: none; }
}

@media (max-width: 400px) {
  .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .header-badge { display: none; }
}
