/* =========================================================
   Outbound CRM - Page-specific layouts (v4 · Themed)
   ========================================================= */

/* ===== Dashboard ===== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.dash-grid > .span-3 { grid-column: span 3; }
.dash-grid > .span-4 { grid-column: span 4; }
.dash-grid > .span-6 { grid-column: span 6; }
.dash-grid > .span-8 { grid-column: span 8; }
.dash-grid > .span-9 { grid-column: span 9; }
.dash-grid > .span-12 { grid-column: span 12; }
@media (max-width: 1280px) {
  .dash-grid > .span-3 { grid-column: span 6; }
  .dash-grid > .span-4 { grid-column: span 6; }
  .dash-grid > .span-8 { grid-column: span 12; }
  .dash-grid > .span-9 { grid-column: span 12; }
}
@media (max-width: 768px) {
  .dash-grid > [class*=span-] { grid-column: span 12; }
}

/* ===== Leaderboard ===== */
.lead-row {
  display: grid;
  grid-template-columns: 24px 36px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.18s, transform 0.18s;
  border-radius: 10px;
}
.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--surface-hover); transform: translateX(2px); }
.lead-row .rank { font-size: 12px; color: var(--muted); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.lead-row.top1 {
  background: linear-gradient(90deg, rgba(245,158,11,0.12) 0%, transparent 70%);
  border: 1px solid rgba(245,158,11,0.22);
  padding: 11px;
}
.lead-row.top1 .rank { color: var(--amber-500); }
.lead-row .name { font-weight: 500; font-size: 13.5px; color: var(--text); }
.lead-row .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.lead-row .wins { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.lead-row .rev {
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 90px; text-align: right;
  font-weight: 500;
}
.lead-row .conv {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--good-bg);
  color: var(--good-fg);
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--good-bd);
}
.lead-row .streak {
  color: var(--amber-500); font-size: 11px; font-weight: 700;
  padding: 2px 7px;
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 999px;
  margin-left: 6px;
}
.lead-row .crown svg { color: var(--amber-500); filter: drop-shadow(0 0 6px rgba(245,158,11,0.55)); }

/* ===== Activity board ===== */
.act-row {
  position: relative;
  display: flex; gap: 12px;
  padding: 11px 0 11px 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: 12.5px;
  color: var(--text-2);
}
.act-row::before {
  content: '';
  position: absolute; left: 4px; top: 16px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.act-row:nth-child(3n+2)::before { background: var(--purple-500); box-shadow: 0 0 0 3px rgba(139,92,246,0.18); }
.act-row:nth-child(3n)::before   { background: var(--amber-500); box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.act-row::after {
  content: '';
  position: absolute; left: 7.5px; top: 26px; bottom: -1px;
  width: 1px;
  background: var(--line);
}
.act-row:last-child::after { display: none; }
.act-row:last-child { border-bottom: none; }
.act-row .ts { color: var(--muted); font-size: 11px; min-width: 56px; }
.act-row b { font-weight: 600; color: var(--text); }
.act-list { max-height: 360px; overflow-y: auto; }

/* ===== Need attention card ===== */
.attn { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.attn .cell {
  position: relative;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: all 0.22s;
}
.attn .cell:hover { transform: translateY(-2px); border-color: var(--line-3); }
.attn .cell.warn {
  background: linear-gradient(135deg, var(--warn-bg), transparent 70%);
  border-color: var(--warn-bd);
}
.attn .cell.bad {
  background: linear-gradient(135deg, var(--bad-bg), transparent 70%);
  border-color: var(--bad-bd);
}
.attn .cell .lbl { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.attn .cell .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin-top: 4px; }
.attn .cell.bad .v { color: var(--bad-fg); }
.attn .cell.warn .v { color: var(--warn-fg); }
.attn .cell .lnk {
  color: var(--primary-3); font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px;
  transition: color 0.15s;
}
.attn .cell .lnk:hover { color: var(--primary-2); }

/* ===== Hot leads list ===== */
.hot-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line-2);
  align-items: center;
  transition: background 0.15s;
  border-radius: 9px;
  padding: 11px 8px;
  margin: 0 -8px;
}
.hot-row:hover { background: var(--surface-hover); }
.hot-row:last-child { border-bottom: none; }
.hot-row .name { font-size: 13px; font-weight: 500; color: var(--text); }
.hot-row .meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hot-row .score {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--amber-500);
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.30);
  border-radius: 999px;
}
.hot-row .score svg { filter: drop-shadow(0 0 4px rgba(245,158,11,0.45)); }

/* ===== Empty alerts ===== */
.alerts-empty { padding: 18px 14px; text-align: center; }
.alerts-empty .ill {
  width: 72px; height: 72px;
  margin: 10px auto 12px;
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.08));
  border: 1px solid var(--primary-border);
  border-radius: 20px;
  display: grid; place-items: center;
  color: var(--primary-3);
  box-shadow: var(--inner-highlight);
}
.alerts-empty h4 { color: var(--text); margin-bottom: 4px; }

/* ===== Bars ===== */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-stack { width: 100%; height: 200px; display: flex; flex-direction: column-reverse; gap: 1px; border-radius: 8px; overflow: hidden; background: var(--surface-soft); }
.bar-stack span { display: block; width: 100%; }
.bar-label { font-size: 10.5px; color: var(--muted); }

/* ===== Lead Inbox extras ===== */
.flag-cell { width: 30px; }
.flag-cell .ic { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.flag-cell .ic.warn { color: var(--warn-fg); background: var(--warn-bg); border: 1px solid var(--warn-bd); }
.flag-cell .ic.hot  { color: var(--amber-500); background: rgba(245,158,11,0.14); border: 1px solid rgba(245,158,11,0.25); }
.flag-cell .ic.ai   { color: var(--purple-500); background: rgba(139,92,246,0.14); border: 1px solid rgba(139,92,246,0.30); box-shadow: 0 0 10px rgba(139,92,246,0.22); }

.aura-bar { width: 64px; height: 6px; background: var(--surface-hover); border-radius: 4px; overflow: hidden; }
.aura-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #10B981 0%, #34D399 60%, #FBBF24 100%);
  box-shadow: 0 0 8px rgba(16,185,129,0.45);
}

.row-actions { display: inline-flex; gap: 4px; opacity: 0.40; transition: opacity 0.18s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }
.density-toggle button { padding: 4px 8px; }

/* ===== Lead Detail ===== */
.ld-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
@media (max-width: 1180px){ .ld-grid { grid-template-columns: 1fr; } }

.ld-head {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: calc(var(--tb-h) + 20px);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}
.ld-head .name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.ld-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ld-head .right { margin-left: auto; display: flex; gap: 7px; }

.aura-strip {
  background:
    linear-gradient(135deg, var(--primary-tint-2), rgba(139,92,246,0.08)),
    var(--surface);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 16px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-2);
  position: relative;
  overflow: hidden;
}
.aura-strip::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 400px 200px at 0% 0%, var(--primary-tint-2), transparent 60%);
  pointer-events: none;
}
.aura-strip > * { position: relative; }
.aura-strip .score { font-size: 26px; font-weight: 800; color: var(--primary-3); letter-spacing: -0.02em; }
.aura-strip .tier { font-weight: 700; color: var(--amber-500); }
.aura-strip .sug { color: var(--muted); }
.aura-strip .actions { margin-left: auto; }

.ld-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 18px 0;
}
.ld-tabs a {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.ld-tabs a.active { color: var(--primary-3); border-bottom-color: var(--primary); }
.ld-tabs a:hover { color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.full { grid-column: 1 / -1; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary-border), rgba(139,92,246,0.20), var(--line));
}
.tl-row { position: relative; padding: 10px 0; font-size: 13px; color: var(--text-2); }
.tl-row::before {
  content: ''; position: absolute; left: -20px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--canvas); border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.tl-row.system::before  { border-color: var(--purple-500); box-shadow: 0 0 0 3px rgba(139,92,246,0.18); }
.tl-row.created::before { border-color: var(--primary); }
.tl-row.msg-in::before  { border-color: var(--pink-400); box-shadow: 0 0 0 3px rgba(244,114,182,0.18); }
.tl-row .ts { font-size: 11px; color: var(--muted); }
.tl-row .who { color: var(--muted); font-size: 11.5px; }

.tl-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-filter button {
  font-size: 11.5px; padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  transition: all 0.15s;
}
.tl-filter button:hover { color: var(--text); border-color: var(--line-3); }
.tl-filter button.active {
  background: var(--grad-primary); color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(16,185,129,0.30);
}

/* Conversations */
.conv {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  max-height: 380px;
  overflow-y: auto;
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  margin-bottom: 10px;
  position: relative;
  line-height: 1.5;
}
.bubble .meta { font-size: 10.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 6px; align-items: center; }
.bubble.in {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.bubble.out {
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.10));
  border: 1px solid var(--primary-border);
  color: var(--text);
  margin-left: auto;
  box-shadow: 0 4px 14px rgba(16,185,129,0.14);
}
.composer {
  display: flex; gap: 10px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  background: var(--input-bg);
  transition: border-color 0.18s;
}
.composer:focus-within {
  border-color: var(--primary-border-2);
  box-shadow: 0 0 0 4px var(--input-ring);
}
.composer textarea {
  flex: 1; border: none; outline: none; resize: none; min-height: 44px;
  font-size: 13px; background: transparent; color: var(--text);
}
.composer-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 10px; margin-bottom: 10px;
}
.composer-tabs button {
  font-size: 11.5px; padding: 5px 11px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  transition: all 0.15s;
}
.composer-tabs button:hover { color: var(--text); }
.composer-tabs button.active {
  color: var(--primary-3);
  background: var(--primary-tint);
  border-color: var(--primary-border);
}

/* Right rail */
.rail-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  color: var(--text-2);
}
.rail-card h4 {
  font-size: 12.5px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text);
  letter-spacing: 0.02em;
}
.gauge { width: 80px; height: 80px; position: relative; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge .v {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800;
  color: var(--primary-3);
}
.suggested { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.fu-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  margin-bottom: 9px;
  background: var(--surface-soft);
  transition: all 0.18s;
}
.fu-card:hover { border-color: var(--primary-border); background: var(--surface-hover); }
.fu-card .ttl { font-size: 12.5px; font-weight: 500; color: var(--text); }
.fu-card .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.fu-card .acts { display: flex; gap: 5px; margin-top: 9px; }
.fu-card .acts button { font-size: 11px; padding: 4px 9px; }

/* ===== Kanban ===== */
.kb-wrap { overflow-x: auto; padding-bottom: 18px; }
.kb {
  display: flex; gap: 14px;
  min-width: max-content;
  padding-bottom: 10px;
}
.kb-col {
  width: 296px;
  flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 240px);
  box-shadow: var(--shadow-sm);
}
.kb-col-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-soft);
  border-radius: 14px 14px 0 0;
}
.kb-col-head .ttl {
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.kb-col-head .ttl .pip { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.kb-col-head .count { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kb-col-head .val { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-body {
  padding: 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 9px; flex: 1;
}
.kb-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px; padding: 12px; cursor: grab;
  box-shadow: var(--shadow-xs);
  transition: all 0.22s cubic-bezier(.4,.0,.2,1);
  color: var(--text-2);
}
.kb-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-card-hover);
}
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: 0.4; transform: rotate(2deg); }
.kb-card .top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.kb-card .name { font-weight: 500; font-size: 13px; color: var(--text); }
.kb-card .row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; gap: 8px; }
.kb-card .val { font-size: 12.5px; font-weight: 700; color: var(--primary-3); font-variant-numeric: tabular-nums; }
.kb-card .acts { display: flex; gap: 3px; }
.kb-card .acts button { width: 26px; height: 26px; padding: 0; border-radius: 7px; }
.kb-card .meta { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ===== Follow-ups board ===== */
.fu-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1200px) { .fu-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .fu-board { grid-template-columns: 1fr; } }
.fu-col {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  min-height: 380px;
  color: var(--text-2);
}
.fu-col-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.fu-col-head .ttl { font-weight: 600; font-size: 13.5px; color: var(--text); }
.fu-col-head .ttl .pip { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; box-shadow: 0 0 8px currentColor; }
.fu-col-head .count { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fu-list { padding: 11px; display: flex; flex-direction: column; gap: 9px; }

.fu-anal {
  background:
    linear-gradient(135deg, var(--primary-tint-2), rgba(139,92,246,0.08)),
    var(--surface);
  border: 1px solid var(--primary-border);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  position: relative; overflow: hidden;
  color: var(--text-2);
}
.fu-anal::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 500px 250px at 0% 0%, var(--primary-tint-2), transparent 60%);
  pointer-events: none;
}
.fu-anal > * { position: relative; }
.fu-anal .stat { font-size: 13px; }
.fu-anal .stat b {
  font-size: 24px; color: var(--primary-3); font-weight: 700;
  margin-right: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ===== Calls / Reports ===== */
.kpi-row6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 1280px) { .kpi-row6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .kpi-row6 { grid-template-columns: repeat(2, 1fr); } }

.h-bar { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 12.5px; color: var(--text-2); }
.h-bar .lbl { width: 140px; color: var(--muted); }
.h-bar .track {
  flex: 1; height: 10px;
  background: var(--surface-hover);
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line-2);
}
.h-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #34D399);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(16,185,129,0.40);
}
.h-bar .val {
  width: 44px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--text);
}

.rp-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
@media (max-width: 900px) { .rp-grid { grid-template-columns: 1fr; } }
.rp-side {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  height: max-content;
}
.rp-side a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; font-size: 13px;
  border-radius: 9px;
  color: var(--text-2);
  transition: all 0.15s;
  font-weight: 500;
}
.rp-side a:hover { background: var(--surface-hover); color: var(--text); }
.rp-side a.active {
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.08));
  color: var(--primary-3);
  font-weight: 600;
  border: 1px solid var(--primary-border);
  padding: 8px 10px;
}
.rp-side a svg { width: 16px; height: 16px; color: currentColor; opacity: 0.85; }

.rp-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .rp-charts { grid-template-columns: 1fr; } }

/* ===== Pipeline builder ===== */
.pb-row {
  display: grid;
  grid-template-columns: 20px 1fr 24px 80px 56px 60px 1fr 30px;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  margin-bottom: 9px;
  color: var(--text-2);
  transition: all 0.18s;
}
.pb-row:hover { border-color: var(--line-3); background: var(--surface-hover); }
.pb-row .swatch { width: 22px; height: 22px; border-radius: 7px; box-shadow: 0 0 0 1px var(--line-3); }
.pb-row .drag { color: var(--muted); cursor: grab; }
.pb-row input[type="text"] {
  background: transparent; border: none; outline: none;
  font-weight: 500; color: var(--text);
}
.pb-row input[type="number"] {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 7px;
  padding: 4px 9px; width: 72px;
  font-size: 12px;
  color: var(--text);
}
.toggle {
  width: 38px; height: 22px;
  background: var(--surface-hover);
  border-radius: 999px;
  position: relative; cursor: pointer;
  transition: background 0.18s;
  border: 1px solid var(--line);
}
.toggle::after {
  content:''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: .22s cubic-bezier(.4,.0,.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.30);
}
.toggle.on {
  background: var(--grad-primary);
  box-shadow: 0 0 12px rgba(16,185,129,0.40);
  border-color: transparent;
}
.toggle.on::after { left: 18px; }

.src-cell .src { font-size: 12px; }

/* ===== Teams ===== */
.tm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 900px) { .tm-grid { grid-template-columns: 1fr; } }
.tm-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  color: var(--text-2);
  transition: all 0.22s;
}
.tm-card:hover { border-color: var(--line-3); transform: translateY(-2px); }
.tm-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.tm-card-head h3 { display: flex; align-items: center; gap: 9px; color: var(--text); }
.tm-card-head .badge {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-3);
  border: 1px solid var(--primary-border);
  font-weight: 600;
}
.tm-rep-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  border: 1px dashed var(--line-3);
  border-radius: 11px;
  padding: 14px;
  min-height: 90px;
  background: var(--surface-soft);
}
.tm-rep-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 4px 11px 4px 4px; border-radius: 999px;
  font-size: 12px; cursor: grab;
  color: var(--text);
}
.tm-cap-row { display: flex; gap: 18px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.tm-cap-row b { color: var(--text); font-weight: 700; }
.tm-bar {
  height: 9px;
  background: var(--surface-hover);
  border-radius: 5px; overflow: hidden;
  margin-top: 10px;
}
.tm-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #10B981, #34D399);
  box-shadow: 0 0 10px rgba(16,185,129,0.40);
}

/* ===== Templates ===== */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 16px; }
.tpl-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  color: var(--text-2);
  transition: all 0.22s;
}
.tpl-card:hover { border-color: var(--primary-border); transform: translateY(-2px); }
.tpl-card .body {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55; white-space: pre-wrap;
}
.tpl-card .body mark {
  background: rgba(245,158,11,0.18);
  color: var(--amber-500);
  padding: 1px 4px; border-radius: 4px;
}

/* ===== Integrations ===== */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; }
.int-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 11px;
  color: var(--text-2);
  transition: all 0.22s;
}
.int-card:hover { border-color: var(--primary-border); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.int-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.08));
  border: 1px solid var(--primary-border);
  display: grid; place-items: center;
  font-weight: 800; color: var(--primary-3); font-size: 17px;
  box-shadow: var(--inner-highlight);
}
.int-card h4 { font-size: 14px; color: var(--text); }
.int-card .desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ===== Aura AI ===== */
.aura-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .aura-grid { grid-template-columns: 1fr; } }
.aura-script-card {
  background:
    linear-gradient(135deg, rgba(139,92,246,0.08), var(--primary-tint)),
    var(--surface);
  border: 1px solid rgba(139,92,246,0.22);
  border-radius: 14px;
  padding: 16px;
  color: var(--text-2);
}
.aura-script-card .ttl {
  font-size: 13px; font-weight: 600;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
  color: var(--text);
}
.aura-script-card .ttl svg { color: var(--purple-500); filter: drop-shadow(0 0 5px rgba(139,92,246,0.50)); }
.aura-script-card .body { font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.aura-script-card .body var {
  background: rgba(245,158,11,0.16);
  padding: 1px 5px; border-radius: 4px;
  font-style: normal; color: var(--amber-500); font-weight: 600;
}

.chart-frame { width: 100%; height: 240px; position: relative; }

/* Activities tabs */
.activities-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.activities-tabs button {
  padding: 10px 16px;
  font-size: 12.5px;
  background: transparent; border: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  transition: color 0.15s;
}
.activities-tabs button:hover { color: var(--text); }
.activities-tabs button.active {
  color: var(--primary-3);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.file-lozenge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--primary-border);
  background: var(--primary-tint);
  color: var(--primary-3);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
}

/* =========================================================
   Aura AI · Chat Workspace
   ========================================================= */
.aura-workspace {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 16px;
  height: calc(100vh - var(--tb-h) - 200px);
  min-height: 580px;
}
@media (max-width: 1280px) { .aura-workspace { grid-template-columns: 260px 1fr; } .aura-context { display: none; } }
@media (max-width: 900px)  { .aura-workspace { grid-template-columns: 1fr; height: auto; } .aura-bots { max-height: 280px; } }

/* ---------- Left: Bot list ---------- */
.aura-bots {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.bots-search {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-soft);
}
.bots-search svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; margin-left: 2px; }
.bots-search input {
  flex: 1; border: none; outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
}
.bots-search input::placeholder { color: var(--muted); }

.bots-group { padding: 6px 8px 8px; }
.bots-group + .bots-group { border-top: 1px solid var(--line-2); }
.bots-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--muted-2);
}
.bots-group-head .muted { color: var(--muted-2); font-size: 9.5px; letter-spacing: 0.06em; }

.aura-bots > *:nth-child(2) { flex-shrink: 0; }
.aura-bots > *:not(.bots-search) { overflow-y: auto; }
.aura-bots > .bots-group:last-child { flex: 1; }

.bot-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  border: 1px solid transparent;
  margin-bottom: 2px;
}
.bot-item:hover { background: var(--surface-hover); }
.bot-item.active {
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.10));
  border-color: var(--primary-border);
  box-shadow: 0 4px 14px rgba(16,185,129,0.18);
}
.bot-item .bot-av {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  color: #fff;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.bot-item .bot-av::after {
  content: '';
  position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--canvas);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.30);
}
.bot-item.is-pulse .bot-av { background: var(--grad-primary); }
.bot-item.is-core  .bot-av { background: var(--grad-purple); }
.bot-item.is-core  .bot-av::after { background: var(--purple-400); box-shadow: 0 0 0 1px rgba(139,92,246,0.30), 0 0 10px rgba(139,92,246,0.55); animation: aura-pulse 2.4s infinite; }

.bot-item .bot-meta { min-width: 0; }
.bot-item .bot-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.bot-item .bot-name .verified { color: var(--cyan-500); font-size: 11px; }
.bot-item .bot-role { font-size: 11px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-item .bot-badge {
  font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 5px;
  background: var(--surface-hover);
  color: var(--muted);
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bot-item.is-core .bot-badge {
  background: rgba(139,92,246,0.14); color: var(--purple-500); border-color: rgba(139,92,246,0.30);
}
.bot-item.is-pulse .bot-badge {
  background: var(--primary-tint); color: var(--primary-3); border-color: var(--primary-border);
}

/* ---------- Center: Chat ---------- */
.aura-chat {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.aura-chat::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 300px at 50% -20%, var(--primary-tint), transparent 70%),
    radial-gradient(ellipse 500px 250px at 100% 100%, rgba(139,92,246,0.08), transparent 60%);
  pointer-events: none;
}
.aura-chat > * { position: relative; }

.chat-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 13px;
  background: var(--surface-soft);
}
.chat-head .av {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 14px;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.chat-head .av::after {
  content: '';
  position: absolute; bottom: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--canvas);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.30);
  animation: online-pulse 2.4s ease-in-out infinite;
}
.chat-head .info { flex: 1; min-width: 0; }
.chat-head .name {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px;
  letter-spacing: -0.01em;
}
.chat-head .name .verified {
  color: var(--cyan-500); font-size: 12px;
  display: inline-flex; align-items: center; gap: 3px;
}
.chat-head .role {
  font-size: 12px; color: var(--muted);
  margin-top: 2px;
}
.chat-head .actions { display: flex; gap: 6px; }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex; flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
  animation: msg-in 0.28s cubic-bezier(.4,.0,.2,1);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg .av-sm {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.msg.user .av-sm { background: var(--grad-purple); }
.msg .body {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  position: relative;
}
.msg.bot  .body { border-top-left-radius: 4px; }
.msg.user .body {
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.10));
  border-color: var(--primary-border);
  border-top-right-radius: 4px;
  color: var(--text);
}
.msg .body b { font-weight: 600; color: var(--text); }
.msg .body ul { margin: 6px 0 0; padding-left: 18px; }
.msg .body li { margin: 3px 0; }
.msg .body .stat {
  display: inline-flex; align-items: baseline; gap: 4px;
  margin-right: 12px;
  font-weight: 600;
  color: var(--primary-3);
  font-variant-numeric: tabular-nums;
}
.msg .body .stat .lbl { font-size: 11px; color: var(--muted); font-weight: 500; }
.msg .body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-soft);
  padding: 1px 6px; border-radius: 5px;
  color: var(--primary-3);
}
.msg .ts {
  font-size: 10.5px; color: var(--muted);
  margin-top: 4px;
  display: block;
}

/* Typing indicator */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}
.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.4s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.30; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Empty state */
.chat-empty {
  margin: auto;
  text-align: center;
  padding: 36px;
  max-width: 420px;
}
.chat-empty .ill {
  width: 72px; height: 72px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(139,92,246,0.16), var(--primary-tint-2));
  border: 1px solid rgba(139,92,246,0.30);
  display: grid; place-items: center;
  color: var(--purple-400);
  box-shadow: 0 0 30px rgba(139,92,246,0.30);
}
.chat-empty h3 { color: var(--text); margin-bottom: 6px; font-size: 17px; }
.chat-empty p { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* Suggested prompts (chips above composer) */
.chat-suggest {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 22px 0;
}
.chat-suggest .sg {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.18s;
}
.chat-suggest .sg:hover {
  background: var(--primary-tint);
  border-color: var(--primary-border);
  color: var(--primary-3);
  transform: translateY(-1px);
}
.chat-suggest .sg::before {
  content: '✦'; color: var(--purple-400); font-size: 11px;
}

/* Composer */
.chat-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-soft);
}
.chat-composer .cc-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
}
.chat-composer .cc-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--line-3); }
.chat-composer .cc-btn svg { width: 16px; height: 16px; }
.chat-composer textarea {
  flex: 1;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  resize: none;
  min-height: 38px;
  max-height: 140px;
  font-family: inherit;
  line-height: 1.5;
  transition: all 0.18s;
}
.chat-composer textarea::placeholder { color: var(--muted); }
.chat-composer textarea:focus {
  outline: none;
  border-color: var(--primary-border-2);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 4px var(--input-ring);
}
.chat-composer .btn { height: 38px; padding: 0 16px; }
.chat-composer .btn svg { width: 14px; height: 14px; margin-left: 2px; }

/* ---------- Right: Context rail ---------- */
.aura-context {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.ctx-block { margin-bottom: 18px; }
.ctx-block:last-child { margin-bottom: 0; }
.ctx-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
  margin-bottom: 9px;
}
.ctx-persona {
  text-align: center;
  padding: 14px 4px 16px;
}
.ctx-persona .av-lg {
  width: 64px; height: 64px;
  border-radius: 18px;
  margin: 0 auto 10px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 8px 22px rgba(16,185,129,0.30);
  position: relative;
  letter-spacing: -0.02em;
}
.ctx-persona .av-lg::after {
  content: '';
  position: absolute; bottom: -3px; right: -3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #22C55E;
  border: 3px solid var(--surface-solid);
  box-shadow: 0 0 0 1px var(--line), 0 0 12px rgba(34,197,94,0.50);
}
.ctx-persona .name {
  font-size: 15px; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.ctx-persona .role {
  font-size: 11.5px; color: var(--muted); margin-top: 3px;
}
.ctx-persona .quote {
  margin-top: 11px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  font-style: italic;
}

.ctx-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ctx-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-3);
  border: 1px solid var(--primary-border);
  font-weight: 500;
}

.ctx-stat-row {
  display: flex; gap: 8px;
}
.ctx-stat {
  flex: 1;
  padding: 10px 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.ctx-stat .v {
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ctx-stat .l { font-size: 10.5px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

.ctx-source {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  transition: background 0.15s;
  cursor: pointer;
}
.ctx-source:hover { background: var(--surface-hover); border-color: var(--line-3); }
.ctx-source .src-ic {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--primary-tint);
  color: var(--primary-3);
  border: 1px solid var(--primary-border);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ctx-source .src-ic svg { width: 13px; height: 13px; }
.ctx-source .src-meta { min-width: 0; flex: 1; }
.ctx-source .ttl { font-weight: 500; color: var(--text); }
.ctx-source .sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.ctx-prompt {
  display: block;
  padding: 9px 11px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  color: var(--text-2);
  text-align: left;
  width: 100%;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.ctx-prompt:hover {
  background: var(--primary-tint);
  border-color: var(--primary-border);
  color: var(--primary-3);
}
.ctx-prompt::before { content: '› '; color: var(--muted-2); }

