/* trf.css — Traffic & Channels tab */

.trf-page { color: var(--text); }

/* ===== Snapshot ===== */
.trf-snapshot {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.trf-snap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s, box-shadow .15s;
}
.trf-snap-card:hover { border-color: var(--border-strong); }
.trf-snap-card.alert { border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .04); }
.trf-snap-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}
.trf-snap-value { font-size: 24px; font-weight: 600; color: var(--text); line-height: 1.1; }
.trf-snap-delta {
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}
.trf-snap-delta.up { color: var(--success, #10B981); }
.trf-snap-delta.down { color: var(--danger, #EF4444); }
.trf-snap-delta-lbl { color: var(--text-3); font-weight: 400; }

/* ===== Block / Card ===== */
.trf-block { margin-bottom: 28px; }
.trf-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.trf-block-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }

.trf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.trf-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.trf-card-title { font-size: 13px; font-weight: 600; color: var(--text); }

.trf-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.trf-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ===== Tables ===== */
.trf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.trf-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
}
.trf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.trf-table tr:last-child td { border-bottom: 0; }
.trf-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.trf-table tr.total td { background: var(--surface-alt); font-weight: 600; }
.trf-table.mini td, .trf-table.mini th { padding: 6px 10px; font-size: 12px; }

.trf-ch-row { display: inline-flex; align-items: center; gap: 8px; }
.trf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.trf-bar-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.trf-bar-bg { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-alt); overflow: hidden; }
.trf-bar-fg { display: block; height: 100%; border-radius: 3px; }
.trf-bar-val { font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.trf-url { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); background: var(--surface-alt); padding: 2px 6px; border-radius: 4px; }

.trf-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-alt); font-size: 11px; font-variant-numeric: tabular-nums; }
.trf-pill.warn { background: rgba(245, 158, 11, .12); color: #B45309; }

.pos { color: var(--success, #10B981); }
.neg { color: var(--danger, #EF4444); }

/* ===== SVG ===== */
.trf-svg { width: 100%; height: auto; display: block; }

.trf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.trf-legend-item { display: inline-flex; align-items: center; gap: 5px; }

/* ===== Paths ===== */
.trf-paths { display: flex; flex-direction: column; gap: 10px; }
.trf-path-row {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trf-path-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.trf-path-node { display: inline-flex; }
.trf-path-arrow { color: var(--text-3); font-size: 12px; }
.trf-path-stats { display: flex; gap: 12px; font-size: 11px; color: var(--text-3); }
.trf-path-count { font-variant-numeric: tabular-nums; }
.trf-path-cr { font-weight: 500; }
.trf-path-cr.pos { color: var(--success, #10B981); }
.trf-path-cr.neg { color: var(--danger, #EF4444); }

/* ===== SEO ===== */
.trf-seo-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.trf-pos-badge {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: center;
}
.trf-pos-badge.good { background: rgba(16, 185, 129, .12); color: var(--success, #10B981); }
.trf-pos-badge.mid  { background: rgba(245, 158, 11, .12); color: #B45309; }
.trf-pos-badge.low  { background: rgba(239, 68, 68, .12); color: var(--danger, #EF4444); }

.trf-trend { font-weight: 500; font-size: 12px; }
.trf-trend.up { color: var(--success, #10B981); }
.trf-trend.down { color: var(--danger, #EF4444); }
.trf-trend.flat { color: var(--text-3); }

.trf-movers { display: flex; flex-direction: column; gap: 14px; }
.trf-movers-section { display: flex; flex-direction: column; gap: 6px; }
.trf-movers-h { font-size: 12px; font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.trf-movers-h.pos { color: var(--success, #10B981); }
.trf-movers-h.neg { color: var(--danger, #EF4444); }
.trf-mover-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.trf-mover-q { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trf-mover-stats { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.trf-mover-from { color: var(--text-3); }
.trf-mover-arrow { color: var(--text-3); }
.trf-mover-to { font-weight: 600; }
.trf-mover-to.pos { color: var(--success, #10B981); }
.trf-mover-to.neg { color: var(--danger, #EF4444); }

.trf-cov { display: flex; gap: 16px; align-items: flex-start; }
.trf-cov-svg { width: 140px; height: 140px; flex-shrink: 0; }
.trf-cov-list { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 11px; }
.trf-cov-row { display: flex; align-items: center; gap: 6px; }
.trf-cov-r { flex: 1; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.trf-cov-n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* ===== Funnel ===== */
.trf-funnel { display: flex; flex-direction: column; gap: 8px; }
.trf-fn-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px 80px;
  gap: 12px;
  align-items: center;
}
.trf-fn-row.alert .trf-fn-bar { background: linear-gradient(90deg, #EF4444, #DC2626); }
.trf-fn-step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.trf-fn-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: var(--surface-alt);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.trf-fn-bar-wrap { background: var(--surface-alt); border-radius: 8px; height: 32px; position: relative; overflow: hidden; }
.trf-fn-bar {
  background: linear-gradient(90deg, #6366F1, #8B5CF6);
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  transition: width .3s;
  min-width: 60px;
}
.trf-fn-val { color: white; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trf-fn-cr { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.trf-fn-drop { font-size: 11px; color: var(--danger, #EF4444); text-align: right; font-variant-numeric: tabular-nums; }

.trf-dev-funnel, .trf-cr-bars { display: flex; flex-direction: column; gap: 12px; }
.trf-dev-row, .trf-cr-row {
  display: grid;
  grid-template-columns: 96px 1fr 100px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.trf-cr-row { grid-template-columns: 110px 1fr 60px; }
.trf-dev-name, .trf-cr-lbl { color: var(--text-2); font-weight: 500; }
.trf-dev-bar, .trf-cr-bar { background: var(--surface-alt); height: 22px; border-radius: 6px; position: relative; overflow: hidden; }
.trf-dev-fill, .trf-cr-fill { height: 100%; background: linear-gradient(90deg, #6366F1, #8B5CF6); border-radius: 6px; transition: width .3s; }
.trf-dev-val { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--text); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trf-cr-val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.trf-dev-sessions { color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }

/* ===== Tech / CWV ===== */
.trf-cwv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.trf-cwv-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-alt);
}
.trf-cwv-card.pos { border-color: rgba(16, 185, 129, .35); background: rgba(16, 185, 129, .05); }
.trf-cwv-card.mid { border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .05); }
.trf-cwv-card.neg { border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .05); }
.trf-cwv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.trf-cwv-name { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.trf-cwv-val { font-size: 28px; font-weight: 600; color: var(--text); margin-bottom: 10px; line-height: 1; }
.trf-cwv-unit { font-size: 14px; color: var(--text-3); margin-left: 4px; font-weight: 400; }
.trf-cwv-meter-bg {
  position: relative;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: visible;
  margin-bottom: 4px;
}
.trf-cwv-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #34D399);
  border-radius: 3px;
}
.trf-cwv-card.mid .trf-cwv-meter-fill { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.trf-cwv-card.neg .trf-cwv-meter-fill { background: linear-gradient(90deg, #EF4444, #F87171); }
.trf-cwv-meter-target {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 10px;
  background: var(--text-2);
  transform: translateX(-1px);
}
.trf-cwv-meter-lbl { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); }

.trf-dev-mix { display: flex; flex-direction: column; gap: 10px; }
.trf-dev-mix-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.trf-dev-mix-lbl { color: var(--text-2); font-weight: 500; }
.trf-dev-mix-bar { background: var(--surface-alt); height: 22px; border-radius: 6px; position: relative; overflow: hidden; }
.trf-dev-mix-fill { height: 100%; background: linear-gradient(90deg, #06B6D4, #0EA5E9); border-radius: 6px; }
.trf-dev-mix-pct { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.trf-dev-mix-n { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

.trf-browsers { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.trf-browsers-h { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.trf-browsers-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
}
.trf-browsers-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.trf-errors { display: flex; flex-direction: column; gap: 8px; }
.trf-error-row {
  display: grid;
  grid-template-columns: 80px 60px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  background: var(--surface-alt);
  border-radius: 6px;
  font-size: 12px;
}
.trf-error-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.trf-error-tag.warn { background: rgba(245, 158, 11, .15); color: #B45309; }
.trf-error-tag.err  { background: rgba(239, 68, 68, .15); color: var(--danger, #EF4444); }
.trf-error-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.trf-error-top { font-size: 11px; }

/* ===== Skeleton ===== */
.trf-skel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.trf-skel-card {
  height: 180px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: trf-skel-loading 1.4s infinite;
  border-radius: 12px;
  border: 1px solid var(--border);
}
@keyframes trf-skel-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .trf-snapshot { grid-template-columns: repeat(2, 1fr); }
  .trf-2col, .trf-3col, .trf-cwv-grid, .trf-seo-kpis { grid-template-columns: 1fr; }
  .trf-fn-row { grid-template-columns: 1fr; gap: 4px; }
  .trf-fn-step { order: -1; }
}
