/* ── Omnicanal-AIAgents Platform Design System ───────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary:        #10b981;
  --primary-dark:   #059669;
  --primary-light:  #d1fae5;
  --primary-muted:  rgba(16,185,129,.12);
  --sidebar-bg:     #111827;
  --sidebar-text:   #9ca3af;
  --sidebar-active-bg: rgba(16,185,129,.15);
  --sidebar-active-text: #10b981;
  --sidebar-hover:  rgba(255,255,255,.05);
  --bg:             #f9fafb;
  --bg-card:        #ffffff;
  --border:         #e5e7eb;
  --border-light:   #f3f4f6;
  --text:           #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --warning:        #f59e0b;
  --warning-bg:     #fffbeb;
  --info:           #3b82f6;
  --info-bg:        #eff6ff;
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm:      6px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── App Layout ──────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .18s ease;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand img { max-width: 100%; }
.sidebar-brand > div { min-width: 0; max-width: 100%; }
.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-icon svg { color: #fff; }
.brand-name { font-size: 16px; font-weight: 600; color: #fff; }
.brand-sub  { font-size: 11px; color: var(--sidebar-text); margin-top: 1px; }

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

.nav-section {
  padding: 16px 16px 6px;
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: rgba(156,163,175,.5);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 6px; margin: 1px 8px;
  font-size: 13px; font-weight: 500; color: var(--sidebar-text);
  cursor: pointer; transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e5e7eb; }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.sidebar-user-name  { font-size: 13px; font-weight: 500; color: #e5e7eb; }
.sidebar-user-role  { font-size: 11px; color: var(--sidebar-text); }
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); margin-left: auto; flex-shrink: 0;
}

/* ── Sidebar colapsable (preferencia del usuario) ────────────────── */
.sidebar-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius); flex-shrink: 0;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; }

body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .sidebar-brand { align-items: center; justify-content: center; padding: 18px 8px 14px; }
body.sidebar-collapsed .sidebar-brand > div { display: none; }
body.sidebar-collapsed .sidebar-brand img { height: auto; max-width: 40px; }
body.sidebar-collapsed .nav-section { display: none; }
body.sidebar-collapsed .nav-item {
  font-size: 0; justify-content: center; gap: 0; padding: 9px 0;
}
body.sidebar-collapsed .nav-item svg { width: 18px; height: 18px; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; padding: 12px 8px; }
body.sidebar-collapsed .sidebar-footer > div:not(.avatar-sm),
body.sidebar-collapsed .online-dot { display: none; }

/* ── Main Content ────────────────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 56px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  flex-shrink: 0;
}
.topbar-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
}
.topbar-breadcrumb .current { color: var(--text); font-weight: 500; }
.topbar-breadcrumb svg { width: 14px; height: 14px; opacity: .4; }

.topbar-search {
  flex: 1; max-width: 360px; margin-left: 16px;
  position: relative;
}
.topbar-search input {
  width: 100%; padding: 7px 12px 7px 36px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; color: var(--text);
  background: var(--bg); outline: none; transition: border-color .15s;
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 16px; height: 16px;
}
.search-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.1); z-index: 9999; overflow: hidden;
}
.search-dropdown.open { display: block; }
.search-result {
  padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; transition: background .1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg); }
.search-result-label { font-size: 13px; font-weight: 500; color: var(--text); }
.search-result-sub { font-size: 11px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.search-result-badge { font-weight: 600; }
.search-empty { padding: 12px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: background .15s;
  position: relative;
}
.topbar-btn:hover { background: var(--bg); }
.topbar-btn svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background .15s;
}
.topbar-user:hover { background: var(--bg); }
.topbar-user-name { font-size: 13px; font-weight: 500; }
.topbar-user-role { font-size: 11px; color: var(--text-secondary); }
.topbar-user svg { width: 14px; height: 14px; color: var(--text-muted); }

.page-body { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
}
.card-subtitle { font-size: 13px; color: var(--text-secondary); }

/* ── Stat Cards ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
}
.stat-card.warning { border-color: #fde68a; background: #fffbeb; }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.green   { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue    { background: #dbeafe; color: var(--info); }
.stat-icon.orange  { background: #fef3c7; color: var(--warning); }
.stat-icon.gray    { background: var(--border-light); color: var(--text-secondary); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-content { flex: 1; }
.stat-label  { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value  { font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-delta {
  font-size: 12px; display: flex; align-items: center; gap: 4px;
}
.delta-up   { color: var(--primary); }
.delta-down { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  border: none; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.badge-green    { background: var(--primary-light); color: var(--primary-dark); }
.badge-yellow   { background: #fef3c7; color: #92400e; }
.badge-blue     { background: #dbeafe; color: #1d4ed8; }
.badge-gray     { background: var(--border-light); color: var(--text-secondary); }
.badge-red      { background: var(--danger-bg); color: var(--danger); }
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ── Live Badge ──────────────────────────────────────────────────── */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--bg-card); outline: none; transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-muted);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Chats page ──────────────────────────────────────────────────── */
.chats-layout {
  display: flex; height: 100%; gap: 0;
  overflow: hidden;
}
.chat-list-panel {
  width: 320px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-list-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.chat-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: transparent; cursor: pointer;
  color: var(--text-secondary); transition: all .12s;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-chip:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.filter-chip[data-filter="hot"].active  { background:#ef4444; border-color:#ef4444; }
.filter-chip[data-filter="warm"].active { background:#f59e0b; border-color:#f59e0b; }
.filter-chip[data-filter="cold"].active { background:#6b7280; border-color:#6b7280; }
.chip-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.25); border-radius: 10px;
  font-size: 10px; font-weight: 700; padding: 0 5px; min-width: 16px;
  margin-left: 2px;
}
.filter-chip:not(.active) .chip-badge { background: var(--border); color: var(--text-secondary); }
.temp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.temp-elapsed { font-size: 11px; font-weight: 600; }
.conv-temp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.chat-search { position: relative; }
.chat-search input {
  width: 100%; padding: 7px 10px 7px 32px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: var(--font); color: var(--text);
  background: var(--bg); outline: none;
}
.chat-search input:focus { border-color: var(--primary); background: #fff; }
.chat-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 14px; height: 14px;
}

.chat-list-items { flex: 1; overflow-y: auto; }
.chat-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background .1s;
  display: flex; gap: 10px; align-items: flex-start;
}
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: var(--primary-light); }
.chat-item.escalated { border-left: 3px solid var(--warning); }
.chat-item-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: #fff;
}
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-row1 { display: flex; justify-content: space-between; align-items: baseline; }
.chat-item-name { font-size: 13px; font-weight: 600; }
.chat-item-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.chat-item-row2 { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chat-item-preview {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.chat-item-row3 {
  display: flex; align-items: center; gap: 3px;
  margin-top: 3px; font-size: 10px; color: var(--text-muted);
}
.item-duration { font-weight: 500; color: var(--text-muted); }
.temp-pill {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 5px; border-radius: 8px;
  font-size: 10px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
}

/* ── Chat detail panel ───────────────────────────────────────────── */
.chat-detail-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
}
.chat-detail-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
}
.chat-detail-header {
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.chat-detail-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.chat-detail-name { font-size: 14px; font-weight: 600; }
.chat-detail-phone { font-size: 12px; color: var(--text-secondary); }
.chat-detail-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.messages-area {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 0;
}
.msg-group { margin-bottom: 12px; display: flex; flex-direction: column; }
.msg-label {
  font-size: 10px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 4px;
}
.msg-label.right { text-align: right; }
.bubble {
  max-width: 65%; padding: 9px 14px;
  font-size: 13px; line-height: 1.55; word-break: break-word;
  border-radius: 12px;
}
.bubble.client {
  background: var(--bg-card); color: var(--text);
  align-self: flex-start; border-radius: 2px 12px 12px 12px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.bubble.ai {
  background: var(--primary); color: #fff;
  align-self: flex-end; border-radius: 12px 12px 2px 12px;
}
.bubble.human {
  background: #ecfdf5; color: #065f46;
  align-self: flex-end; border-radius: 12px 12px 2px 12px;
  border: 1px solid #a7f3d0;
}
.bubble.system {
  background: #fffbeb; color: #78350f;
  align-self: center; border-radius: 12px; font-size: 12px;
  font-style: italic; border: 1px solid #fde68a; max-width: 80%;
}
.bubble-time {
  font-size: 10px; opacity: .6; display: block;
  margin-top: 3px; text-align: right;
}
.bubble.client .bubble-time { text-align: left; }

.reply-area {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 12px 16px; flex-shrink: 0;
}
.reply-form { display: flex; gap: 8px; align-items: flex-end; }
.reply-input {
  flex: 1; min-height: 40px; max-height: 120px;
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); resize: none; outline: none;
  font-family: var(--font); font-size: 13px; color: var(--text);
  background: var(--bg); transition: border-color .15s;
}
.reply-input:focus { border-color: var(--primary); background: #fff; }
.reply-send {
  height: 40px; padding: 0 16px; background: var(--primary);
  color: #fff; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.reply-send:hover { background: var(--primary-dark); }
.reply-blocked {
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--bg); border: 1px dashed var(--border);
  text-align: center; color: var(--text-muted); font-size: 13px;
}
.reply-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}

/* ── Agent cards ─────────────────────────────────────────────────── */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.agent-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.agent-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.agent-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  background: var(--primary-light); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.agent-icon svg { width: 22px; height: 22px; color: var(--primary); }
.agent-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.agent-desc { font-size: 12px; color: var(--text-secondary); }
.agent-badge { margin-left: auto; }

.agent-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-bottom: 16px;
}
.agent-stat { }
.agent-stat-label { font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted); }
.agent-stat-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.agent-stat-value.good { color: var(--primary); }
.agent-stat-value.warn { color: var(--warning); }

.agent-tags { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.agent-tag {
  padding: 3px 8px; border-radius: 20px; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px;
}
.agent-tag svg { width: 12px; height: 12px; }
.agent-actions { display: flex; gap: 8px; }

/* ── Prompts ─────────────────────────────────────────────────────── */
.prompt-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
}
.prompt-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.prompt-name { font-size: 15px; font-weight: 600; }
.prompt-desc { font-size: 13px; color: var(--text-secondary); }
.prompt-version-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  background: var(--primary-light); color: var(--primary-dark);
}
.prompt-body {
  background: var(--bg); border-radius: var(--radius);
  padding: 12px 14px; font-size: 13px; color: var(--text-secondary);
  font-family: 'Courier New', monospace; margin-bottom: 12px;
  max-height: 100px; overflow: hidden; white-space: pre-wrap;
  border: 1px solid var(--border);
}
.prompt-history { }
.prompt-history-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.prompt-version-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  background: var(--bg); margin-bottom: 4px;
}
.version-num { font-size: 12px; font-weight: 600; color: var(--primary); }
.version-meta { font-size: 12px; color: var(--text-secondary); flex: 1; }
.version-active-badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  background: var(--primary-light); color: var(--primary-dark); border-radius: 20px;
}

/* ── Metrics / Charts ────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; margin-bottom: 24px; }
.chart-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.chart-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.chart-title { font-size: 14px; font-weight: 600; }
.chart-sub { font-size: 12px; color: var(--text-muted); }
.model-item { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.model-row { display: flex; justify-content: space-between; align-items: center; }
.model-name { font-size: 13px; font-weight: 500; }
.model-cost { font-size: 13px; font-weight: 600; }
.model-bar-bg { height: 6px; background: var(--border); border-radius: 10px; }
.model-bar { height: 6px; border-radius: 10px; transition: width .5s; }
.model-tokens { font-size: 11px; color: var(--text-muted); }

/* ── Connections ─────────────────────────────────────────────────── */
.connections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.connection-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.connection-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.connection-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.connection-icon svg { width: 22px; height: 22px; }
.connection-name { font-size: 14px; font-weight: 600; }
.connection-type { font-size: 12px; color: var(--text-secondary); }
.connection-badge { margin-left: auto; }
.connection-field {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  margin-bottom: 8px;
}
.connection-field-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); }
.connection-field-value { font-size: 13px; font-family: monospace; margin-top: 2px; }
.connection-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── Toasts ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text); color: #fff; padding: 10px 16px;
  border-radius: var(--radius); font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s ease;
}
.toast.success { background: var(--primary); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 24px; width: 400px; box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
