/* dashboard.css — Command Centre styles */
/* Mobile-first, card-based layout */

.db-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
  animation: db-fadeIn 0.3s ease;
}

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

.db-mobile-header {
  display: none;
  padding: 12px 0 16px;
}

.db-logo {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.db-logo i {
  color: #6366f1;
  margin-right: 6px;
}

/* ── Grid ── */
.db-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Cards ── */
.db-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.db-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.db-card-welcome {
  background: linear-gradient(135deg, #fafafa 0%, #f0f0ff 100%);
  border-color: #e0e0f0;
}

.db-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
  cursor: pointer;
  user-select: none;
}

.db-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-card-title i {
  font-size: 14px;
}

.db-collapse-icon {
  font-size: 12px;
  color: #999;
  transition: transform 0.2s;
}

.db-card.collapsed .db-collapse-icon {
  transform: rotate(-90deg);
}

.db-card.collapsed .db-card-body {
  display: none;
}

.db-card-body {
  padding: 16px 20px 20px;
}

/* ── Welcome Card ── */
.db-welcome-top {
  padding: 24px 20px 0;
}

.db-greeting {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.db-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.db-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 20px;
}

.db-stat {
  text-align: center;
  padding: 12px 4px;
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
}

.db-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.db-stat-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  font-weight: 500;
}

/* ── Activity items ── */
.db-activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f5f5f5;
}

.db-activity-item:last-child {
  border-bottom: none;
}

.db-activity-item i {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

/* ── Metrics grid ── */
.db-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.db-metric {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fafafa;
  border-radius: 10px;
}

.db-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.db-metric-data {
  min-width: 0;
}

.db-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.db-metric-label {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.db-trend {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
}

.db-trend.up {
  color: #10b981;
  background: #ecfdf5;
}

.db-trend.down {
  color: #ef4444;
  background: #fef2f2;
}

.db-trend.flat {
  color: #999;
  background: #f5f5f5;
}

.db-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fce7f3 100%);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  text-align: center;
}

.db-activity-summary {
  font-size: 12px;
  color: #888;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.db-activity-summary strong {
  color: #1a1a1a;
}

@media (max-width: 768px) {
  .db-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Empty / Placeholder states ── */
.db-empty-state,
.db-placeholder {
  text-align: center;
  padding: 20px 0;
}

.db-empty-icon,
.db-placeholder-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.db-empty-text,
.db-placeholder-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.db-placeholder-sub {
  font-size: 12px;
  color: #999;
}

.db-action-btn {
  margin-top: 12px;
  padding: 8px 20px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  font-weight: 500;
}

.db-action-btn:hover {
  background: #333;
}

/* ── Refresh button ── */
.db-refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 16px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: #666;
  cursor: pointer;
  width: 100%;
  justify-content: center;
}

.db-refresh-btn:hover:not(:disabled) {
  background: #f0f0f0;
  color: #333;
}

.db-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Badge ── */
.db-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 8px;
  font-weight: 600;
}

/* ── Ad items ── */
.db-ad-item {
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
}

.db-ad-item:last-child {
  border-bottom: none;
}

.db-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.db-ad-name {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
}

.db-ad-actions {
  display: flex;
  gap: 4px;
}

.db-ad-action {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
}

.db-ad-action:hover {
  background: #f0f0f0;
}

.db-ad-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.db-ad-text {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 8px;
}

.db-ad-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.db-ad-platform {
  background: #e0e7ff;
  color: #4338ca;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.db-ad-cta {
  background: #dcfce7;
  color: #166534;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.db-ad-tag {
  background: #f0f0f0;
  color: #666;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.db-ad-link {
  font-size: 12px;
  color: #6366f1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.db-ad-link:hover {
  text-decoration: underline;
}

/* ── Weekly Plan ── */
.db-plan-focus {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 12px;
  line-height: 1.4;
}

.db-plan-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.db-plan-progress-bar {
  flex: 1;
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
}

.db-plan-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 3px;
  transition: width 0.3s;
}

.db-plan-progress-text {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
}

.db-plan-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.db-plan-item {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.db-plan-item:hover {
  background: #fafafa;
}

.db-plan-item.completed {
  opacity: 0.6;
}

.db-plan-item.completed .db-plan-item-title {
  text-decoration: line-through;
}

.db-plan-check {
  padding-top: 2px;
  font-size: 18px;
}

.db-plan-item-content {
  flex: 1;
  min-width: 0;
}

.db-plan-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.db-plan-item-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
  margin-bottom: 6px;
}

.db-plan-item-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #999;
}

.db-plan-item-meta i {
  margin-right: 3px;
}

.db-plan-category {
  text-transform: capitalize;
}

/* ── Refresh row ── */
.db-refresh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.db-refresh-meta {
  font-size: 11px;
  color: #999;
}

/* ── News items ── */
.db-news-item {
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
}

.db-news-item:last-child {
  border-bottom: none;
}

.db-news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.db-news-category {
  font-size: 11px;
  color: #0ea5e9;
  font-weight: 500;
  text-transform: capitalize;
}

.db-news-category i {
  margin-right: 4px;
}

.db-news-actions {
  display: flex;
  gap: 2px;
}

a.db-news-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 4px;
  text-decoration: none;
  line-height: 1.3;
}

a.db-news-title:hover {
  color: #6366f1;
}

.db-news-summary {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* ── Funnel v2 ── */
.db-funnel-health {
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

.db-funnel-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.db-fv2-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.db-fv2-bar {
  position: relative;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
  transition: transform 0.15s;
}

.db-fv2-stage:hover .db-fv2-bar {
  transform: scale(1.02);
}

.db-fv2-bar-fill {
  position: absolute;
  inset: 0;
  background: var(--stage-color);
  opacity: 0.1;
  border-radius: 8px;
}

.db-fv2-stage.active .db-fv2-bar-fill {
  opacity: 0.15;
}

.db-fv2-stage.inactive .db-fv2-bar-fill {
  opacity: 0.05;
}

.db-fv2-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 0 16px;
  z-index: 1;
}

.db-fv2-content i {
  color: var(--stage-color);
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.db-fv2-stage.inactive .db-fv2-content i {
  opacity: 0.4;
}

.db-fv2-label {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  flex: 1;
}

.db-fv2-stage.inactive .db-fv2-label {
  color: #bbb;
}

.db-fv2-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--stage-color);
}

.db-fv2-setup {
  font-size: 12px;
  color: #bbb;
  font-weight: 500;
}

.db-fv2-stage.inactive:hover .db-fv2-setup {
  color: var(--stage-color);
}

.db-fv2-connector {
  display: flex;
  justify-content: center;
  height: 16px;
}

.db-fv2-arrow {
  color: #e0e0e0;
  font-size: 10px;
}

.db-fv2-arrow.active {
  color: #10b981;
}

.db-fv2-detail {
  width: var(--stage-width);
  margin: 0 auto;
  padding: 8px 16px;
  background: #fafafa;
  border-radius: 0 0 8px 8px;
  margin-top: -4px;
}

.db-fv2-detail-text {
  font-size: 12px;
  color: #666;
}

/* ── Skeleton loading ── */
.db-skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: db-shimmer 1.5s infinite;
}

@keyframes db-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Bottom Navigation (mobile only) ── */
.db-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  justify-content: space-around;
}

.db-bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  cursor: pointer;
  color: #999;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
}

.db-bnav-item i {
  font-size: 18px;
}

.db-bnav-item.active {
  color: #6366f1;
}

.db-bnav-item:hover {
  color: #1a1a1a;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .db-wrap {
    padding: 12px;
    padding-bottom: 90px;
  }
  
  .db-mobile-header {
    display: block;
  }
  
  .db-bottom-nav {
    display: flex;
  }
  
  .db-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 16px;
  }
  
  .db-greeting {
    font-size: 20px;
  }
  
  .db-stat-num {
    font-size: 22px;
  }
}

/* ── Card entrance animation ── */
.db-grid .db-card {
  animation: db-cardIn 0.3s ease backwards;
}
.db-grid .db-card:nth-child(1) { animation-delay: 0s; }
.db-grid .db-card:nth-child(2) { animation-delay: 0.05s; }
.db-grid .db-card:nth-child(3) { animation-delay: 0.1s; }
.db-grid .db-card:nth-child(4) { animation-delay: 0.15s; }
.db-grid .db-card:nth-child(5) { animation-delay: 0.2s; }
.db-grid .db-card:nth-child(6) { animation-delay: 0.25s; }

@keyframes db-cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  .db-wrap { color: #e0e0e0; }
  .db-card { background: #1e1e1e; border-color: #333; }
  .db-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  .db-card-welcome { background: linear-gradient(135deg, #1e1e2e 0%, #1e1e3e 100%); border-color: #333; }
  .db-card-title { color: #e0e0e0; }
  .db-greeting { color: #f0f0f0; }
  .db-stat { background: rgba(255,255,255,0.05); }
  .db-stat-num { color: #f0f0f0; }
  .db-metric { background: #252525; }
  .db-metric-value { color: #f0f0f0; }
  .db-plan-item:hover { background: #252525; }
  .db-plan-item-title { color: #e0e0e0; }
  .db-fv2-bar-fill { opacity: 0.2; }
  .db-fv2-label { color: #e0e0e0; }
  .db-fv2-detail { background: #252525; }
  a.db-news-title { color: #e0e0e0; }
  .db-ad-name { color: #e0e0e0; }
  .db-refresh-btn { background: #252525; border-color: #444; color: #ccc; }
  .db-activity-summary { border-color: #333; }
  .db-activity-summary strong { color: #e0e0e0; }
  .db-plan-focus { color: #e0e0e0; }
  .db-bottom-nav { background: #1e1e1e; border-color: #333; }
}

/* ── Desktop: 2-column grid for some cards ── */
@media (min-width: 769px) {
  .db-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  
  /* Welcome card spans full width */
  .db-card-welcome {
    grid-column: 1 / -1;
  }
  
  /* Funnel spans full width */
  .db-card:last-child {
    grid-column: 1 / -1;
  }
}

/* ── Coach Filter Bar ── */
.coach-filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  flex-shrink: 0;
}
.coach-pill {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  background: rgba(255,255,255,0.06);
  color: #aaa;
  transition: all 0.2s;
}
.coach-pill:hover { background: rgba(255,255,255,0.12); color: #fff; }
.coach-pill.active { background: #6366f1; color: #fff; }

/* ── Coach Badge in Inbox ── */
.coach-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(99,102,241,0.2);
  color: #818cf8;
  margin-left: 6px;
  vertical-align: middle;
}
.coach-badge.unassigned {
  background: rgba(255,255,255,0.06);
  color: #666;
}

/* ── Paused Badge ── */
.paused-badge {
  display: inline-block;
  margin-left: 4px;
  color: #FF9500;
  font-size: 11px;
  vertical-align: middle;
}


/* ── Business Switcher ── */
.business-switcher {
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
}
.biz-current {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f5f5f5;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
  min-height: 38px;
}
.biz-current:hover { background: #eee; }
.biz-current i { color: #999; font-size: 13px; }
.biz-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-arrow { font-size: 10px; color: #999; transition: transform 0.2s; }
.biz-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  overflow: hidden;
}
.biz-dropdown.open { display: block; }
.biz-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #444;
  transition: background 0.15s;
}
.biz-option:hover { background: #f5f5f5; color: #1a1a1a; }
.biz-option.biz-active { color: #4A90D9; font-weight: 500; }
