/* ── Tunnel Analytics Dashboard CSS ─────────────────────────────────────── */
.tad-panel {
  max-width: 1200px;
  width: 96vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.tad-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-muted, #888); font-size: 0.9rem; gap: 16px;
}
.tad-spinner {
  width: 32px; height: 32px; border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent, #7c3aed); border-radius: 50%;
  animation: tad-spin 0.8s linear infinite;
}
@keyframes tad-spin { to { transform: rotate(360deg); } }

.tad-header-left { display: flex; align-items: center; gap: 12px; }
.tad-back-btn {
  padding: 4px 12px; font-size: 0.75rem; border-radius: 6px; border: 1px solid var(--border, #333);
  background: transparent; color: var(--text-muted, #888); cursor: pointer; transition: all 0.18s;
}
.tad-back-btn:hover { background: var(--accent, #7c3aed); color: #fff; border-color: var(--accent); }
.tad-period-tabs { display: flex; gap: 4px; }
.tad-period-btn {
  padding: 5px 14px; font-size: 0.75rem; border-radius: 6px; border: 1px solid var(--border, #333);
  background: transparent; color: var(--text-muted, #888); cursor: pointer; transition: all 0.18s;
}
.tad-period-btn.active, .tad-period-btn:hover {
  background: var(--accent, #7c3aed); color: #fff; border-color: var(--accent, #7c3aed);
}

.tad-body { overflow-y: auto; padding: 24px 28px 32px; flex: 1; }

/* KPIs */
.tad-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-bottom: 24px; }
.tad-kpi-card {
  background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border, #333);
  border-radius: 12px; padding: 16px 14px; text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tad-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.tad-kpi-icon { font-size: 1.3rem; margin-bottom: 6px; }
.tad-kpi-value { font-size: 1.4rem; font-weight: 700; margin-bottom: 2px; }
.tad-kpi-label { font-size: 0.72rem; color: var(--text-muted, #888); }

/* Funnel */
.tad-funnel-block {
  background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border, #333);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 24px;
}
.tad-funnel { display: flex; flex-direction: column; gap: 8px; }
.tad-funnel-step { display: flex; align-items: center; gap: 10px; }
.tad-funnel-bar {
  height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; min-width: 80px; transition: width 0.6s ease;
}
.tad-funnel-label { font-size: 0.78rem; font-weight: 600; color: #fff; }
.tad-funnel-count { font-size: 0.82rem; font-weight: 700; color: #fff; }
.tad-funnel-drop { font-size: 0.68rem; color: #ef4444; font-weight: 500; white-space: nowrap; }

/* Charts */
.tad-two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.tad-chart-block {
  background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border, #333);
  border-radius: 12px; padding: 16px 18px;
}
.tad-chart-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 14px; }

/* Heatmap */
.tad-heatmap { display: flex; flex-direction: column; gap: 2px; }
.tad-hm-row { display: flex; align-items: center; gap: 2px; }
.tad-hm-label { width: 32px; font-size: 0.65rem; color: var(--text-muted, #888); text-align: right; flex-shrink: 0; }
.tad-hm-hour-label { width: calc((100% - 32px) / 8); font-size: 0.6rem; color: var(--text-muted, #666); text-align: center; }
.tad-hm-cell {
  flex: 1; height: 14px; border-radius: 2px; transition: opacity 0.15s;
  cursor: default;
}
.tad-hm-cell:hover { outline: 1px solid rgba(255,255,255,0.4); z-index: 1; }

/* Table */
.tad-section {
  background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border, #333);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 20px;
}
.tad-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.tad-table th {
  color: var(--text-muted, #888); font-weight: 500; padding: 0 8px 10px;
  text-align: left; border-bottom: 1px solid var(--border, #333);
}
.tad-table td {
  padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.04);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tad-table tr:hover { background: rgba(255,255,255,0.03); }
.tad-tunnel-name { font-weight: 500; }
.tad-status {
  padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 600;
}
.tad-status-published { background: rgba(16,185,129,0.15); color: #10b981; }
.tad-status-draft { background: rgba(136,136,136,0.15); color: #888; }
.tad-status-paused { background: rgba(245,158,11,0.15); color: #f59e0b; }
.tad-badge {
  padding: 2px 7px; border-radius: 10px; font-size: 0.7rem; font-weight: 600;
  background: rgba(99,102,241,0.15); color: #818cf8;
}
.tad-empty { color: var(--text-muted, #888); font-size: 0.8rem; text-align: center; padding: 16px; }

/* Referrer bars */
.tad-ref-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tad-ref-name { width: 120px; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.tad-ref-bar-bg { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.tad-ref-bar { height: 100%; background: var(--accent, #7c3aed); border-radius: 3px; transition: width 0.4s; }
.tad-ref-count { font-size: 0.72rem; color: var(--text-muted, #888); width: 30px; text-align: right; flex-shrink: 0; }

@media (max-width: 768px) {
  .tad-two-cols { grid-template-columns: 1fr; }
  .tad-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .tad-panel { width: 100vw; max-width: 100vw; border-radius: 0; }
}
