/* ============================================================
   NexiServe AI Assistant — Dashboard Styles
   Light, clean, "plug-and-play SaaS" design language.
   No build step. Pure CSS, no frameworks.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #fafafa;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --well-bg: #f7f7f9;
  --chip-bg: #f4f4f6;
  --active-bg: #f2f2f5;

  --border: #e8e8ec;
  --border-soft: #ececf0;
  --border-input: #e5e5ea;

  --text: #1a1a1e;
  --text-secondary: #55555e;
  --text-muted: #6b6b76;

  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-orange: #f97316;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;

  --black: #111114;

  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.16);

  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #dcdce2; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}
.login-wordmark {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--black);
  margin-bottom: 6px;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
}
.login-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease;
}
.login-google-btn:hover { background: #26262c; }
.login-google-btn svg { flex-shrink: 0; background: #fff; border-radius: 3px; padding: 1px; }
.login-note {
  opacity: 0.6;
  font-size: 12px;
  margin-top: 16px;
}
.login-fallback {
  margin-top: 20px;
  opacity: 0.6;
  text-align: left;
}
.login-fallback summary {
  cursor: pointer;
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}
.login-fallback form { margin-top: 12px; }
.login-field { margin-bottom: 10px; }
.login-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: #fff;
}
.login-error {
  color: var(--accent-red);
  font-size: 12px;
  min-height: 14px;
  margin-bottom: 8px;
}
.login-btn {
  width: 100%;
  padding: 10px 18px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   APP SHELL / LAYOUT
   ============================================================ */
.app-shell { height: 100vh; overflow: hidden; }
.main-layout {
  display: flex;
  height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.sidebar-top {
  padding: 24px 16px 16px;
}
.sidebar-wordmark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--black);
  padding: 0 8px;
  margin-bottom: 16px;
}
.workspace-switcher {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: left;
}
.workspace-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--black);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.workspace-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-chevron { flex-shrink: 0; color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
}
.sidebar-btn svg { flex-shrink: 0; }
.sidebar-btn:hover { background: var(--active-bg); }
.sidebar-btn.active {
  background: var(--active-bg);
  color: var(--text);
  font-weight: 600;
}
.nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 12px 8px;
}
.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a5a5b0;
  padding: 4px 10px 6px;
}
.sidebar-btn.admin { font-size: 13px; color: #83838c; }
.sidebar-btn.admin.active { color: var(--text); }

.sidebar-bottom {
  border-top: 1px solid var(--border-soft);
  padding: 12px 16px;
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; }
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-icon-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
}
.sidebar-icon-btn:hover { background: var(--active-bg); color: var(--text); }

/* ---------- Content area ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-alt);
}
.tab-panel { display: none; max-width: 1200px; margin: 0 auto; padding: 40px 44px 56px; }
.tab-panel.active { display: block; }

.panel-header { margin-bottom: 28px; }
.panel-header h1 {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}
.panel-subtitle { color: var(--text-muted); font-size: 14.5px; margin: 0; }
.panel-header.tasks-header,
.panel-header.skills-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.panel-header-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.glass-btn, .glass-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.glass-btn { padding: 10px 20px; font-size: 14px; }
.glass-btn-sm { padding: 8px 14px; font-size: 13px; }
.glass-btn:hover, .glass-btn-sm:hover { background: #26262c; }
.glass-btn-sm.ghost, .glass-btn.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.glass-btn-sm.ghost:hover, .glass-btn.ghost:hover { border-color: #cfcfd6; }
.glass-btn-sm.mini { padding: 4px 10px; font-size: 12px; }
.glass-btn-sm:disabled, .glass-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
}
.btn-secondary:hover { border-color: #cfcfd6; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
}
.btn-quiet {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.btn-quiet:hover { color: var(--text); }

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
}
.icon-btn:hover { background: var(--active-bg); color: var(--text); }

/* ============================================================
   CARDS / SURFACES (glass-* aliases -> light card system)
   ============================================================ */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.glass-card:hover { box-shadow: var(--shadow-hover); }
.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.glass-bar {
  background: #fff;
  border: 1px solid var(--border);
}
.glass-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
}
.glass-pill {
  display: inline-flex;
  align-items: center;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.glass-input, .glass-select {
  background: #fff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
}
.glass-input:focus, .glass-select:focus { outline: none; border-color: #b9b9c4; }
.glass-input.full { margin-bottom: 10px; }
.glass-input.sm { width: auto; padding: 6px 10px; font-size: 12.5px; }

.muted { color: var(--text-muted); }

/* Search input with inline icon (Integrations / Skills / Tasks) */
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-muted);
  flex: 1;
}
.search-input:focus-within { border-color: #b9b9c4; }
.search-input input {
  border: none;
  outline: none;
  flex: 1;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}
.search-input input::placeholder { color: #a5a5b0; }

.filter-pills { display: flex; gap: 8px; margin-top: 12px; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--chip-bg);
  color: var(--text-secondary);
}
.badge.blue { background: #eaf1ff; color: #2563eb; }
.badge.green { background: #eafbf0; color: #16a34a; }
.badge.orange { background: #fff3e8; color: #ea7d17; }
.badge.red { background: #fdeaea; color: #dc2626; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 24, 0.35);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 420px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Command palette */
.cmd-palette { width: 480px; max-width: 100%; padding: 16px; }
.cmd-list { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}
.cmd-item.active, .cmd-item:hover { background: var(--active-bg); color: var(--text); }
.cmd-icon { width: 20px; text-align: center; color: var(--text-muted); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 400;
}
.toast {
  background: var(--black);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; }
.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }
.toast.info { background: var(--black); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d0d0d8;
}
.pulse-dot.online { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.pulse-dot.large { width: 14px; height: 14px; }
.pulse-dot.small { width: 8px; height: 8px; }

.agent-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.agent-banner-left { display: flex; align-items: center; gap: 14px; }
.agent-banner-title { font-size: 16px; font-weight: 600; }
.agent-banner-sub { font-size: 13px; color: var(--text-muted); }

.stat-ring { position: relative; width: 44px; height: 44px; }
.stat-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.stat-ring .ring-bg { stroke: var(--chip-bg); }
.stat-ring .ring-fg { stroke: var(--accent-green); stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.stat-ring .ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.agent-profile { margin-bottom: 16px; }
.agent-profile-row { display: flex; align-items: center; gap: 18px; }
.agent-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--chip-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agent-profile-info { flex: 1; min-width: 0; }
.agent-profile-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.agent-profile-role { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.agent-profile-mission { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.agent-profile-status { text-align: right; flex-shrink: 0; }
.agent-profile-status-row { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-bottom: 4px; }
.agent-profile-online { font-size: 12.5px; color: var(--accent-green); }
.agent-profile-uptime { font-size: 11.5px; color: var(--text-muted); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background: #eaf1ff; color: #2563eb; }
.stat-icon.green { background: #eafbf0; color: #16a34a; }
.stat-icon.orange { background: #fff3e8; color: #ea7d17; }
.stat-icon.purple { background: #f2ecff; color: #7c3aed; }
.stat-info { display: flex; flex-direction: column; }
.stat-val { font-size: 22px; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dashboard-grid .card-wide { grid-column: 1 / -1; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { font-size: 13.5px; color: var(--text-secondary); }
.feed-scroll { max-height: 320px; overflow-y: auto; }

.feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.feed-dot.green { background: var(--accent-green); }
.feed-dot.red { background: var(--accent-red); }
.feed-time { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.feed-skill { font-weight: 500; flex-shrink: 0; }
.feed-action { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-cost { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

.followup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.followup-item:last-child { border-bottom: none; }
.followup-name { font-weight: 500; font-size: 13.5px; }
.followup-details { display: flex; align-items: center; gap: 10px; }
.followup-days { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   CHAT
   ============================================================ */
.chat-layout {
  display: flex;
  height: calc(100vh - 0px);
  margin: -40px -44px;
}
.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-soft);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.chat-sidebar-top {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.chat-list-item:hover { background: var(--active-bg); }
.chat-list-item.active { background: var(--active-bg); }
.chat-item-content { min-width: 0; flex: 1; }
.chat-list-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-date { font-size: 11px; color: var(--text-muted); }
.chat-item-actions { flex-shrink: 0; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 32px 44px; }
.welcome-msg { max-width: 640px; margin: 40px auto; text-align: center; }
.welcome-msg h2 { font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.welcome-msg p { color: var(--text-muted); margin-bottom: 20px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.quick-btn { border: none; cursor: pointer; }
.quick-btn:hover { background: var(--active-bg); }

.message { max-width: 640px; margin: 0 auto 16px; display: flex; }
.message-user { justify-content: flex-end; }
.message-assistant { justify-content: flex-start; }
.msg-bubble {
  max-width: 78%;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.message-user .msg-bubble {
  background: var(--black);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.message-assistant .msg-bubble {
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 16px 16px 16px 4px;
}
.msg-bubble p:first-child { margin-top: 0; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble code {
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}
.message-user .msg-bubble code { background: rgba(255, 255, 255, 0.18); }
.msg-bubble pre {
  background: #1a1a1e;
  color: #f2f2f5;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}
.msg-meta { max-width: 640px; margin: 4px auto 0; font-size: 11px; color: var(--text-muted); text-align: right; }
.msg-transcript { max-width: 640px; margin: 8px auto 0; font-size: 12.5px; }
.msg-transcript summary { cursor: pointer; color: var(--text-muted); }
.transcript-steps { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border-soft); }
.transcript-step { padding: 4px 0; color: var(--text-secondary); display: flex; gap: 6px; align-items: flex-start; }
.step-icon { flex-shrink: 0; }
.step-tool { font-weight: 500; }
.step-detail.thinking { font-style: italic; color: var(--text-muted); }

.typing-indicator .msg-bubble { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0 44px 28px;
  border-radius: var(--radius-md);
  padding: 10px 10px 10px 18px;
}
.chat-input-area textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14.5px;
  max-height: 160px;
  padding: 8px 0;
}
.send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.send-btn:hover { background: #26262c; }
.send-btn:disabled { opacity: 0.4; }

/* ============================================================
   TASKS / KANBAN
   ============================================================ */
.tasks-toolbar { margin-bottom: 18px; }
.tasks-toolbar .search-input { max-width: 360px; }

.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.kanban-col {
  background: var(--well-bg);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 200px;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.kanban-col-head h4 { margin: 0; font-size: 13.5px; font-weight: 600; flex: 1; }
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-dot.blue { background: var(--accent-blue); }
.kanban-dot.orange { background: var(--accent-orange); }
.kanban-dot.green { background: var(--accent-green); }
.kanban-count {
  font-size: 11.5px;
  color: var(--text-muted);
  background: #fff;
  border-radius: 999px;
  padding: 1px 8px;
}
.kanban-items { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kanban-items.drag-over { background: rgba(0, 0, 0, 0.03); border-radius: var(--radius-md); }
.kanban-card {
  background: #fff;
  padding: 12px 14px;
  cursor: grab;
}
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.kanban-card-title { font-size: 13.5px; font-weight: 500; flex: 1; }
.task-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 6px 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-empty { padding: 12px 4px; }

/* ============================================================
   COMMAND CENTER
   ============================================================ */
.cc-actions-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.cc-portfolio {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.cc-empty { padding: 40px 24px; text-align: center; color: var(--text-muted); }
.cc-client-card { cursor: pointer; }
.cc-client-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cc-health-ring { position: relative; width: 40px; height: 40px; flex-shrink: 0; }
.cc-health-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cc-health-ring .ring-bg { stroke: var(--chip-bg); }
.cc-health-ring.cc-health-green .ring-fg { stroke: var(--accent-green); }
.cc-health-ring.cc-health-yellow .ring-fg { stroke: var(--accent-yellow); }
.cc-health-ring.cc-health-red .ring-fg { stroke: var(--accent-red); }
.cc-health-ring .ring-score {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.cc-client-name { font-size: 14px; font-weight: 600; }
.cc-trend-arrow { font-size: 12px; margin-left: 4px; }
.cc-trend-improving { color: var(--accent-green); }
.cc-trend-declining { color: var(--accent-red); }
.cc-trend-stable { color: var(--text-muted); }
.cc-sentiment-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  margin-top: 2px;
}
.cc-sentiment-positive { background: #eafbf0; color: #16a34a; }
.cc-sentiment-negative { background: #fdeaea; color: #dc2626; }
.cc-sentiment-neutral { background: var(--chip-bg); color: var(--text-secondary); }
.cc-client-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }

.cc-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.cc-detail-header h2 { flex: 1; margin: 0; font-size: 22px; font-weight: 600; }
.cc-detail-actions { display: flex; gap: 8px; }
.cc-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.cc-tasks-card, .cc-pulse-card { margin-bottom: 14px; }

.cc-slack-summary { font-size: 13.5px; margin-bottom: 8px; }
.cc-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 12px 0 4px; }
.cc-blockers-list, .cc-actions-list, .cc-decisions-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }

.cc-project-item, .cc-meeting-item, .cc-task-item, .cc-pulse-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.cc-project-item:last-child, .cc-meeting-item:last-child, .cc-task-item:last-child, .cc-pulse-item:last-child { border-bottom: none; }
.cc-project-name, .cc-meeting-title, .cc-task-title { font-weight: 500; flex: 1; }
.cc-project-status { color: var(--text-muted); font-size: 12px; }
.cc-meeting-date, .cc-pulse-date { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.cc-task-status { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-blue); flex-shrink: 0; }
.cc-task-status.done { background: var(--accent-green); }
.cc-task-status.in_progress { background: var(--accent-orange); }
.cc-task-assignee { font-size: 12px; color: var(--text-muted); }
.cc-task-due { font-size: 12px; color: var(--text-muted); }
.cc-task-overdue { color: var(--accent-red); font-weight: 500; }
.cc-pulse-score { font-weight: 600; font-size: 13px; }
.cc-pulse-summary { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   META ADS
   ============================================================ */
.stat-value { font-size: 22px; font-weight: 600; line-height: 1.1; display: block; }

.meta-assembler { margin-bottom: 16px; }
.meta-assembler-head-right { display: flex; align-items: center; gap: 10px; }
.meta-assembler-preview { font-size: 12.5px; color: var(--text-muted); }
.meta-assembler-slots { display: flex; align-items: stretch; gap: 8px; margin-top: 14px; }
.meta-slot {
  flex: 1;
  background: var(--well-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}
.meta-slot-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.meta-slot-preview { font-size: 12.5px; color: var(--text-secondary); min-height: 32px; margin-bottom: 8px; }
.meta-slot-preview.filled { color: var(--text); font-weight: 500; }
.meta-slot-divider { display: flex; align-items: center; color: var(--text-muted); font-size: 18px; }
.meta-slot-picker {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}
.meta-slot-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); font-weight: 500; font-size: 13px; }
.meta-slot-picker-list { max-height: 260px; overflow-y: auto; padding: 8px; }
.meta-picker-item { padding: 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.meta-picker-item:hover, .meta-picker-item.selected { background: var(--active-bg); }
.meta-picker-text { margin-bottom: 4px; }

.meta-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 16px; }
.meta-lib-actions { display: flex; gap: 8px; }
.meta-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.meta-tab {
  border: none;
  background: var(--chip-bg);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
}
.meta-tab.active { background: var(--black); color: #fff; }
.meta-filter-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.meta-awareness-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.awareness-bar-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.awareness-bar-label { width: 56px; color: var(--text-muted); flex-shrink: 0; }
.awareness-bar-track { flex: 1; height: 6px; background: var(--chip-bg); border-radius: 4px; overflow: hidden; }
.awareness-bar-fill { height: 100%; border-radius: 4px; }
.awareness-bar-count { width: 20px; text-align: right; color: var(--text-muted); flex-shrink: 0; }

.meta-comp-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.meta-comp-card {
  position: relative;
  background: var(--well-bg);
  border-radius: var(--radius-md);
  padding: 10px 32px 10px 12px;
  border-left: 3px solid var(--border);
}
.meta-comp-card.tier-winner { border-left-color: var(--accent-yellow); }
.meta-comp-card.tier-performer { border-left-color: var(--accent-green); }
.meta-comp-card.tier-average { border-left-color: var(--accent-blue); }
.meta-comp-card.tier-underperformer { border-left-color: var(--accent-red); }
.meta-comp-text { font-size: 13px; margin-bottom: 6px; }
.meta-comp-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11px; }
.meta-comp-stat { color: var(--text-muted); }
.meta-comp-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.meta-comp-delete:hover { background: var(--active-bg); color: var(--accent-red); }

.awareness-badge, .source-tag, .body-format-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  font-size: 10.5px;
}

.meta-version-list { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.meta-version-row { background: var(--well-bg); border-radius: var(--radius-md); padding: 10px 12px; border-left: 3px solid var(--border); }
.meta-version-row.vs-published { border-left-color: var(--accent-green); }
.meta-version-row.vs-paused { border-left-color: var(--accent-orange); }
.meta-version-row.vs-killed { border-left-color: var(--accent-red); opacity: 0.7; }
.meta-ver-main { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.meta-ver-name { font-weight: 500; flex: 1; }
.meta-ver-status { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.meta-ver-metrics { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.meta-ver-actions { display: flex; gap: 6px; margin-top: 8px; }
.winner-star { color: var(--accent-yellow); }

.meta-ver-detail { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-top: -2px; margin-bottom: 8px; }
.ver-detail-components { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.ver-detail-comp { font-size: 12px; }
.ver-detail-label { display: block; font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.ver-detail-perf { overflow-x: auto; }
.ver-perf-table, .meta-lb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ver-perf-table th, .ver-perf-table td, .meta-lb-table th, .meta-lb-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border-soft); }
.lb-text { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-detail-actions { display: flex; align-items: center; gap: 8px; }

.meta-intel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.decay-alert-card { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.decay-alert-card:last-child { border-bottom: none; }
.decay-name { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.decay-reason { font-size: 12px; color: var(--text-muted); }

.kalei-winner { margin-bottom: 10px; }
.kalei-label { font-weight: 500; font-size: 13px; }
.kalei-section { margin-bottom: 10px; }
.kalei-title { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 6px; }
.kalei-item { font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.kalei-total { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.meta-leaderboard { margin-bottom: 16px; }
.meta-leaderboard-head-right { display: flex; align-items: center; gap: 8px; }
.meta-tabs-leaderboard { margin: 10px 0 0; }
.meta-leaderboard-body { margin-top: 10px; overflow-x: auto; }

.meta-sessions-head { cursor: pointer; }

/* ============================================================
   INTEGRATIONS
   ============================================================ */
.ix-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.client-switcher { width: auto; min-width: 180px; }
.client-select {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  padding: 0;
}
.client-select:focus { outline: none; }
.ix-search-wrap { max-width: 420px; }

.ix-banner {
  background: #fff8e6;
  border: 1px solid #f2e2b3;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: #7a5b12;
  margin-bottom: 18px;
}
.ix-banner.warn { background: #fff8e6; border-color: #f2e2b3; color: #7a5b12; }

.ix-section { margin-bottom: 26px; }
.ix-section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.ix-badge {
  display: inline-block;
  background: var(--chip-bg);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  margin-left: 4px;
}
.ix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ix-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.ix-card:hover { box-shadow: var(--shadow-hover); }
.ix-card.connected { border-color: #b9e6c9; }
.ix-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.ix-name { font-size: 14px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ix-card .ix-connect, .ix-card .ix-disconnect { flex-shrink: 0; }

/* ============================================================
   SKILLS
   ============================================================ */
.sk-subtoggle {
  display: inline-flex;
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.sk-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.sk-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

.sk-bundle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.sk-bundle {
  background: linear-gradient(135deg, #f4f0ff 0%, #eef6ff 100%);
  border: 1px solid var(--border);
  padding: 20px;
}
.sk-bundle::before {
  content: 'Bundle';
  display: inline-block;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.sk-bundle-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.sk-bundle-count { font-size: 12.5px; color: var(--text-muted); margin-bottom: 14px; }

.sk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.sk-card { display: flex; flex-direction: column; gap: 8px; }
.sk-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sk-cat {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--chip-bg);
  color: var(--text-secondary);
  padding: 2px 9px;
  border-radius: 999px;
}
.sk-need { font-size: 10.5px; color: var(--accent-orange); }
.sk-card-name { font-size: 16px; font-weight: 600; }
.sk-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; min-height: 40px; }
.sk-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sk-tag { font-size: 11.5px; color: var(--text-muted); }
.sk-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.sk-author { font-size: 12px; color: var(--text-muted); }

.sk-install, .sk-install-bundle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
}
.sk-install:hover, .sk-install-bundle:hover { background: #26262c; }
.sk-uninstall {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
}

/* ============================================================
   USAGE
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat-tile { text-align: left; }
.stat-tile .stat-label { display: block; margin-bottom: 6px; }
.stat-tile .stat-value { font-size: 24px; }

.usage-chart { margin-top: 12px; }
.usage-bar { fill: var(--accent-blue); opacity: 0.85; }
.usage-bar:hover { opacity: 1; }
.usage-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.usage-table th, .usage-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); }
.usage-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.metrics-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.metric-hero { display: flex; align-items: center; gap: 14px; }
.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric-icon.blue { background: #eaf1ff; color: #2563eb; }
.metric-icon.green { background: #eafbf0; color: #16a34a; }
.metric-icon.orange { background: #fff3e8; color: #ea7d17; }
.metric-icon.purple { background: #f2ecff; color: #7c3aed; }
.metric-val { font-size: 20px; font-weight: 600; }
.metric-label { font-size: 12px; color: var(--text-muted); }

.intel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.intel-card.green-tint { background: #f2fbf5; border-color: #cdecd8; }
.intel-card.red-tint { background: #fdf2f2; border-color: #f3cdcd; }
.intel-title { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.intel-val { font-size: 16px; font-weight: 600; }

.activity-log-card { margin-bottom: 24px; }
.activity-list { max-height: 460px; overflow-y: auto; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-size: 12px; flex-shrink: 0; width: 52px; }
.activity-action { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-cost { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.settings-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.setting-row { margin-bottom: 12px; }
.setting-row:last-child { margin-bottom: 0; }
.setting-row label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.services-grid { display: flex; flex-direction: column; gap: 8px; }
.service-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.svc-name { color: var(--text-secondary); }
.svc-badge { font-size: 12px; font-weight: 500; }
.svc-badge.connected { color: var(--accent-green); }
.svc-badge.disconnected { color: var(--text-muted); }
.settings-save-row { padding-bottom: 24px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .dashboard-grid,
  .meta-grid,
  .meta-intel-grid,
  .cc-detail-grid,
  .intel-row,
  .settings-grid,
  .sk-bundle-grid { grid-template-columns: 1fr; }
  .stats-row, .metrics-row, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ix-grid, .sk-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .main-layout { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
  }
  .sidebar-top, .sidebar-bottom { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 8px 12px; overflow-x: auto; }
  .nav-section { flex-direction: row; }
  .nav-divider { width: 1px; height: 24px; margin: 0 8px; }
  .nav-section-label { display: none; }
  .sidebar-btn span { display: none; }
  .sidebar-btn { padding: 8px; }
  .content { height: auto; }
  .app-shell { height: auto; overflow: visible; }
  .tab-panel { padding: 24px 18px 40px; }
  .stats-row, .metrics-row, .stat-grid, .kanban, .ix-grid, .sk-grid, .sk-bundle-grid { grid-template-columns: 1fr; }
  .chat-layout { margin: -24px -18px; flex-direction: column; height: auto; }
  .chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-soft); max-height: 200px; }
  .messages { padding: 20px; }
  .chat-input-area { margin: 0 20px 20px; }
  .panel-header.tasks-header, .panel-header.skills-header { flex-direction: column; }
}

/* --- Dynamic-content classes generated by app.js (contract completion) --- */
.chat-delete-btn,
.task-delete-btn {
  opacity: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: opacity .15s ease, color .15s ease;
  flex-shrink: 0;
}
.chat-list-item:hover .chat-delete-btn,
.kanban-card:hover .task-delete-btn { opacity: 1; }
.chat-delete-btn:hover,
.task-delete-btn:hover { color: var(--accent-red); }

.activity-skill {
  color: var(--accent-blue);
  font-size: 13px;
  min-width: 85px;
  font-weight: 500;
}

.briefing-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary, #55555e);
  white-space: pre-wrap;
}

.decay-reasons {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ============================================================
   GLASS LAYER — frosted, airy depth over the clean light base.
   Appended as an override pass so the base system stays intact.
   ============================================================ */

/* Soft ambient gradient behind everything */
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, 0.07), transparent 60%),
    radial-gradient(1000px 700px at -10% 20%, rgba(59, 130, 246, 0.07), transparent 55%),
    radial-gradient(900px 600px at 50% 110%, rgba(34, 197, 94, 0.05), transparent 60%),
    var(--bg-alt);
  background-attachment: fixed;
}

/* Frosted sidebar */
.sidebar {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
}

/* Frosted cards — every card surface picks up gentle translucency */
.glass-card,
.ix-card,
.sk-card,
.sk-bundle,
.stat-card,
.usage-stat,
.chart-card {
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 1px 2px rgba(16, 16, 32, 0.04), 0 8px 24px rgba(16, 16, 32, 0.05);
}
.glass-card:hover,
.ix-card:hover,
.sk-card:hover {
  box-shadow: 0 2px 6px rgba(16, 16, 32, 0.06), 0 14px 34px rgba(16, 16, 32, 0.09);
  border-color: rgba(255, 255, 255, 0.95);
}

/* Kanban wells: airy glass troughs */
.kanban-col {
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }

/* Search + inputs: subtle frost */
.search-input, .client-switcher, .workspace-switcher {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Login card */
.login-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 24px 70px rgba(16, 16, 32, 0.10);
}

/* ---------- Friendly feed (humanized activity) ---------- */
.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.045);
  font-size: 14px;
}
.feed-item:last-child { border-bottom: none; }
.feed-icon { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.feed-action { flex: 1; color: var(--text); }
.feed-time { color: var(--text-muted); font-size: 12.5px; flex-shrink: 0; }
.feed-item-error .feed-action { color: #b45309; }
.feed-empty, .kanban-empty {
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 26px 12px;
  line-height: 1.7;
}
.kanban-empty span { font-size: 12.5px; opacity: .8; }
.activity-detail { color: var(--text-muted); font-weight: 400; font-size: 12.5px; }

/* ---------- Custom integration request card ---------- */
.ix-request-card {
  margin-top: 28px;
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background:
    linear-gradient(120deg, rgba(139, 92, 246, 0.06), rgba(59, 130, 246, 0.06)),
    rgba(255, 255, 255, 0.6);
}
.ix-request-text h3 { margin: 0 0 6px; font-size: 17px; }
.ix-request-text p { margin: 0; color: var(--text-secondary); font-size: 13.5px; max-width: 520px; }
.ix-request-form { display: flex; gap: 10px; flex-shrink: 0; }
.ix-request-form input {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.85);
  outline: none;
}
.ix-request-form input:focus { border-color: #c9c9d4; }

/* ============================================================
   META ADS WAREHOUSE — Sub-tab UI
   ============================================================ */

/* Sub-tab bar */
.meta-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.meta-subtab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 0;
}
.meta-subtab:hover { color: var(--text); }
.meta-subtab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* Sub-panels */
.meta-subpanel { padding-top: 4px; }

/* Range / control bar */
.meta-range-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.meta-range-bar label { font-weight: 500; }
.mw-updated { font-size: 12px; color: var(--text-muted); }

/* KPI strip (funnel) */
#mwFunnelKpis .stat-card { min-width: 110px; }
#mwFunnelKpis .stat-val  { font-size: 22px; font-weight: 700; }

/* Funnel viz */
.mw-funnel-viz {
  padding: 20px 16px;
}
.mw-funnel-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.mw-funnel-label {
  width: 110px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}
.mw-funnel-bar-wrap {
  flex: 1;
  background: var(--well-bg);
  border-radius: 6px;
  height: 28px;
  overflow: hidden;
}
.mw-funnel-bar {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.mw-funnel-val {
  width: 70px;
  text-align: right;
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.mw-funnel-drop {
  width: 60px;
  text-align: right;
  font-size: 12px;
  color: var(--accent-red);
  flex-shrink: 0;
}
.mw-funnel-drop.good { color: var(--accent-green); }

/* Trend: ASCII-style mini bar chart */
.mw-trend { padding: 16px; overflow-x: auto; }
.mw-trend-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mw-trend-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mw-trend-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.mw-trend-table tr:last-child td { border-bottom: none; }

/* Campaign table */
.mw-campaigns { padding: 0; overflow-x: auto; }
.mw-camp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mw-camp-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.mw-camp-table th:hover { color: var(--text); }
.mw-camp-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.mw-camp-table tr:last-child td { border-bottom: none; }
.mw-camp-table tr:hover td { background: var(--well-bg); }
.mw-camp-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mw-camp-status.active { background: #dcfce7; color: #16a34a; }
.mw-camp-status.paused { background: #fef9c3; color: #a16207; }
.mw-camp-status.unknown { background: var(--chip-bg); color: var(--text-muted); }
.sort-asc::after { content: ' ▲'; font-size: 10px; }
.sort-desc::after { content: ' ▼'; font-size: 10px; }

/* Lead feed */
.mw-lead-feed { overflow-x: auto; }
.mw-lead-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mw-lead-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mw-lead-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.mw-lead-table tr:last-child td { border-bottom: none; }
.mw-lead-table tr:hover td { background: var(--well-bg); }
.mw-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.mw-score.hot  { background: #dcfce7; color: #16a34a; }
.mw-score.warm { background: #fef9c3; color: #a16207; }
.mw-score.cold { background: #fee2e2; color: #b91c1c; }
.mw-link { color: var(--accent-blue); text-decoration: none; font-size: 12px; }
.mw-link:hover { text-decoration: underline; }

/* Spam log */
.mw-spam-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 768px) {
  .mw-spam-grid { grid-template-columns: 1fr; }
}
.mw-spam-rules { padding-bottom: 8px; }
.mw-spam-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.mw-spam-rule-row:last-child { border-bottom: none; }
.mw-spam-rule-name { color: var(--text); font-weight: 500; }
.mw-spam-rule-count {
  background: var(--accent-red);
  color: #fff;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 8px;
}
.mw-spam-table-card { overflow-x: auto; }
.mw-spam-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.mw-spam-tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mw-spam-tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.mw-spam-tbl tr:last-child td { border-bottom: none; }
.mw-spam-tbl tr:hover td { background: var(--well-bg); }
.mw-reason-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  margin: 1px 2px;
}
