/* ═══════════════════════════════════════════════════════════════════
   CRM PREMIUM — HubSpot-level UI
   v1.0 — 2026-03-16
   ═══════════════════════════════════════════════════════════════════ */

/* ── KANBAN BOARD ─────────────────────────────────────────────────── */
.gcrm-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 16px;
  min-height: 500px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--accent, #6366f1) transparent;
}

.gcrm-column {
  flex: 0 0 260px;
  min-width: 240px;
  max-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  scroll-snap-align: start;
  transition: box-shadow 0.3s, border-color 0.3s;
}
.gcrm-column:hover {
  border-color: rgba(255,255,255,0.12);
}
.gcrm-column.drag-over {
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.25), inset 0 0 30px rgba(99,102,241,0.05);
}

.gcrm-col-header {
  padding: 14px 16px 10px;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.gcrm-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary, #e2e8f0);
}
.gcrm-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gcrm-col-count {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted, #94a3b8);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.gcrm-col-value {
  padding: 0 16px 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent, #6366f1);
  letter-spacing: -0.5px;
}
.gcrm-col-weighted {
  padding: 0 16px 8px;
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}
.gcrm-col-weighted span {
  color: var(--accent, #6366f1);
  font-weight: 600;
}

.gcrm-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.gcrm-col-empty {
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
  padding: 24px 8px;
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: 10px;
  margin: 8px 0;
}

/* ── DEAL CARDS ───────────────────────────────────────────────────── */
.gcrm-deal-card {
  position: relative;
  background: var(--bg-card, rgba(255,255,255,0.04));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0;
  cursor: grab;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  overflow: hidden;
}
.gcrm-deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.15);
}
.gcrm-deal-card:active {
  cursor: grabbing;
  transform: scale(0.97);
}
.gcrm-deal-card[draggable="true"] {
  user-select: none;
}

.gcrm-deal-bar {
  height: 3px;
  width: 100%;
}
.gcrm-deal-content {
  padding: 12px 14px;
}
.gcrm-deal-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 6px;
  line-height: 1.3;
}
.gcrm-deal-contact {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 8px;
}
.gcrm-deal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gcrm-deal-amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary, #e2e8f0);
}
.gcrm-deal-date {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 6px;
}
.gcrm-deal-prob {
  font-size: 11px;
  font-weight: 700;
}
.gcrm-deal-days {
  font-size: 10px;
  color: var(--text-muted, #94a3b8);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.gcrm-deal-days.warning {
  color: #f59e0b;
}
.gcrm-deal-days.danger {
  color: #ef4444;
}

/* ── PIPELINE SUMMARY BAR ────────────────────────────────────────── */
.gcrm-pipeline-summary {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.gcrm-pipe-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gcrm-pipe-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary, #e2e8f0);
  letter-spacing: -0.5px;
}
.gcrm-pipe-stat-label {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.gcrm-pipe-divider {
  width: 1px;
  background: rgba(255,255,255,0.08);
  align-self: stretch;
}

/* ── STATS PAGE ──────────────────────────────────────────────────── */
.gcrm-stats-layout {
  padding: 0;
}
.gcrm-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.gcrm-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.gcrm-stat-glass {
  background: var(--bg-card, rgba(255,255,255,0.04));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.gcrm-stat-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, #6366f1);
  opacity: 0.6;
}
.gcrm-stat-glass:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.gcrm-stat-glass-icon {
  font-size: 24px;
  margin-bottom: 6px;
}
.gcrm-stat-glass-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--stat-color, #6366f1);
  letter-spacing: -1px;
}
.gcrm-stat-glass-label {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── FUNNEL CHART (CSS pure) ──────────────────────────────────────── */
.gcrm-funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 0;
  max-width: 500px;
  margin: 0 auto;
}
.gcrm-funnel-step {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  position: relative;
  transition: transform 0.2s, filter 0.2s;
  cursor: default;
  min-width: 120px;
}
.gcrm-funnel-step:hover {
  transform: scaleX(1.03);
  filter: brightness(1.15);
}
.gcrm-funnel-step-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 20px;
  gap: 12px;
}
.gcrm-funnel-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.gcrm-funnel-count {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.gcrm-funnel-rate {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  text-align: center;
  padding: 4px 0;
  font-weight: 600;
}

/* ── CANVAS CHART CONTAINER ──────────────────────────────────────── */
.gcrm-chart-container {
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 20px;
  margin-top: 16px;
}
.gcrm-chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gcrm-chart-canvas {
  width: 100%;
  height: 200px;
  display: block;
}

/* ── TIMELINE ────────────────────────────────────────────────────── */
.gcrm-activity-timeline {
  position: relative;
  padding-left: 28px;
}
.gcrm-activity-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent, #6366f1), rgba(99,102,241,0.1));
}
.gcrm-tl-item {
  position: relative;
  padding: 0 0 16px;
}
.gcrm-tl-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-primary, #0f1117);
  border: 2px solid var(--accent, #6366f1);
  z-index: 1;
}
.gcrm-tl-dot.call   { border-color: #3b82f6; }
.gcrm-tl-dot.email  { border-color: #8b5cf6; }
.gcrm-tl-dot.meeting { border-color: #10b981; }
.gcrm-tl-dot.note   { border-color: #f59e0b; }
.gcrm-tl-dot.task   { border-color: #06b6d4; }
.gcrm-tl-dot.deal   { border-color: #ec4899; }

.gcrm-tl-card {
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 14px;
}
.gcrm-tl-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.gcrm-tl-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary, #e2e8f0);
}
.gcrm-tl-card-time {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}
.gcrm-tl-card-type {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── CONTACT DRAWER (enriched) ────────────────────────────────────── */
.gcrm-contact-drawer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .gcrm-contact-drawer { grid-template-columns: 1fr; }
}

.gcrm-contact-header-premium {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}
.gcrm-avatar-xl {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.gcrm-contact-info-block h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}
.gcrm-contact-info-block .meta {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
}
.gcrm-contact-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.gcrm-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-primary, #e2e8f0);
  cursor: pointer;
  transition: all 0.2s;
}
.gcrm-quick-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent, #6366f1);
  color: var(--accent, #6366f1);
}

/* ── SCORE RING ───────────────────────────────────────────────────── */
.gcrm-score-ring {
  width: 80px;
  height: 80px;
  position: relative;
  flex-shrink: 0;
}
.gcrm-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gcrm-score-ring .track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 5;
}
.gcrm-score-ring .fill {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}
.gcrm-score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary, #e2e8f0);
  line-height: 1;
}
.gcrm-score-label {
  font-size: 9px;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── RELANCES PREMIUM ─────────────────────────────────────────────── */
.gcrm-relances-layout {
  padding: 0;
}
.gcrm-relances-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.gcrm-relances-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.gcrm-relance-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s;
}
.gcrm-relance-tab.active, .gcrm-relance-tab:hover {
  background: var(--accent, #6366f1);
  color: #fff;
  border-color: var(--accent, #6366f1);
}

.gcrm-relance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gcrm-relance-row:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.gcrm-relance-urgency {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}
.gcrm-urgency--low   { background: #10b981; }
.gcrm-urgency--medium { background: #f59e0b; }
.gcrm-urgency--high  { background: #ef4444; }

.gcrm-urgency-text--low   { color: #10b981; }
.gcrm-urgency-text--medium { color: #f59e0b; }
.gcrm-urgency-text--high  { color: #ef4444; }

.gcrm-relances-summary {
  padding: 12px 16px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-primary, #e2e8f0);
}

.gcrm-stagnant-deals {
  margin-top: 24px;
}
.gcrm-stagnant-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  margin-bottom: 8px;
}
.gcrm-stagnant-stage {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.gcrm-stagnant-info {
  flex: 1;
}
.gcrm-stagnant-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #e2e8f0);
}
.gcrm-stagnant-meta {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

/* ── TOP CONTACTS ────────────────────────────────────────────────── */
.gcrm-top-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.gcrm-top-contact-card {
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gcrm-top-contact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* ── SECTION TITLES ──────────────────────────────────────────────── */
.gcrm-stats-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gcrm-stats-section-title::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--accent, #6366f1);
  border-radius: 2px;
}

/* ── STATUS BARS ──────────────────────────────────────────────────── */
.gcrm-status-bars {
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 20px;
}
.gcrm-status-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.gcrm-status-bar-row:last-child { margin-bottom: 0; }
.gcrm-status-bar-label {
  width: 80px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  flex-shrink: 0;
}
.gcrm-status-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.gcrm-status-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.gcrm-status-bar-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  width: 30px;
  text-align: right;
}
.gcrm-status-bar-pct {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  width: 35px;
  text-align: right;
}

/* ── RECENT CONTACTS ─────────────────────────────────────────────── */
.gcrm-recent-contacts {
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
}
.gcrm-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.gcrm-recent-row:hover {
  background: rgba(255,255,255,0.04);
}

/* ── PIPELINE TOOLBAR ─────────────────────────────────────────────── */
.gcrm-pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── GLOBAL TIMELINE ──────────────────────────────────────────────── */
.gcrm-global-timeline {
  background: var(--bg-secondary, #1a1f2e);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 20px;
  margin-top: 16px;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .gcrm-board {
    gap: 8px;
  }
  .gcrm-column {
    flex: 0 0 220px;
    min-width: 200px;
  }
  .gcrm-pipeline-summary {
    flex-direction: column;
    gap: 12px;
  }
  .gcrm-pipe-divider {
    width: 100%;
    height: 1px;
  }
  .gcrm-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── MINI DEALS IN CONTACT ────────────────────────────────────────── */
.gcrm-deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.gcrm-mini-deal {
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}
.gcrm-mini-deal:hover {
  transform: translateY(-2px);
}

/* ── ANIMATION ─────────────────────────────────────────────────────── */
@keyframes gcrm-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gcrm-board .gcrm-column {
  animation: gcrm-slide-up 0.4s ease both;
}
.gcrm-board .gcrm-column:nth-child(2) { animation-delay: 0.05s; }
.gcrm-board .gcrm-column:nth-child(3) { animation-delay: 0.1s; }
.gcrm-board .gcrm-column:nth-child(4) { animation-delay: 0.15s; }
.gcrm-board .gcrm-column:nth-child(5) { animation-delay: 0.2s; }
.gcrm-board .gcrm-column:nth-child(6) { animation-delay: 0.25s; }

.gcrm-stat-glass {
  animation: gcrm-slide-up 0.4s ease both;
}

.gcrm-funnel-step {
  animation: gcrm-slide-up 0.3s ease both;
}
.gcrm-funnel-step:nth-child(2) { animation-delay: 0.05s; }
.gcrm-funnel-step:nth-child(3) { animation-delay: 0.1s; }
.gcrm-funnel-step:nth-child(4) { animation-delay: 0.15s; }
.gcrm-funnel-step:nth-child(5) { animation-delay: 0.2s; }
.gcrm-funnel-step:nth-child(6) { animation-delay: 0.25s; }
