/* Ads > Funnel (tabs/funnel.js). Tokens only, from shell.css. The one orange use is the
   weakest-step outline, via --orange (#E04E24), one tile max per screen. No motion. */

/* ---- Header row ---- */
.fn-head { gap: 10px; }
.fn-range-note { font-size: 12px; color: var(--muted); }
.fn-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.fn-synced { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fn-stale-chip {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--warn-a15); color: var(--warn); border: 1px solid var(--warn-a30);
}

#fn-body.fn-is-loading { opacity: 0.55; pointer-events: none; }

.fn-error {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bad-a12); border: 1px solid var(--bad-a40); border-radius: var(--radius-8);
  padding: 14px 18px; color: var(--bad); font-size: 13px; margin-top: 16px;
}

.fn-muted { color: var(--muted); }
.fn-empty { padding: 32px 0; }

/* ---- Stage tiles ---- */
.fn-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.fn-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fn-tile .value { margin-bottom: 2px; }
.fn-tile--weakest { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.fn-tile--weakest:hover { border-color: var(--orange); }
.fn-tile-rate { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12px; }
.fn-tile-rate-v { color: var(--text-secondary); font-weight: 700; font-variant-numeric: tabular-nums; }
.fn-tile-cost { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fn-tile-extra { font-size: 11px; color: var(--dim); }

.fn-delta { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fn-delta--up { color: var(--good); }
.fn-delta--down { color: var(--bad); }
.fn-delta--flat { color: var(--muted); font-weight: 600; }

.fn-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  margin-top: 14px; font-size: 12.5px; color: var(--text-secondary);
}
.fn-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.fn-sep { color: var(--dim); }

/* ---- Charts ---- */
.fn-chart { position: relative; height: 180px; }
.fn-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fn-chart-card { border: 1px solid var(--cream-a08); border-radius: var(--radius-8); padding: 12px 14px 10px; min-width: 0; }
.fn-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.fn-chart-title { font-size: 13px; font-weight: 600; color: var(--text); }
.fn-chart-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.fn-chart-val { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; white-space: nowrap; }
.fn-chart--small { height: 160px; margin-top: 18px; }
.fn-chart--detail { height: 140px; margin-top: 12px; }
.fn-chart-note { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* ---- Per-creative table ---- */
.fn-filter { margin: 0 0 0 auto; }
.fn-filter .sub-tab-btn { padding: 6px 14px; }
.fn-table-wrap { max-width: 100%; }
.fn-table tbody tr.fn-row { cursor: pointer; }
.fn-table tbody tr.fn-row:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.fn-table tbody tr.fn-row[aria-expanded="true"] td { background: var(--cream-a03); }
.fn-table tbody tr.fn-row[aria-expanded="true"] td:first-child { background: var(--surface-alt); }
.fn-table td.fn-col-key { font-weight: 700; color: var(--text); }
.fn-table td.fn-col-trend { color: var(--text-secondary); }
.fn-table tbody td:first-child { min-width: 200px; }

.fn-row--untested td { color: var(--dim); }
.fn-row--untested .fn-thumb img { opacity: 0.45; }
.fn-row--untested td.fn-col-key,
.fn-row--untested .fn-creative-code { color: var(--muted); }

.fn-creative { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fn-thumb {
  width: 40px; height: 40px; flex-shrink: 0; overflow: hidden;
  border-radius: var(--radius-6); background: var(--sidebar);
}
.fn-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fn-creative-info { min-width: 0; }
.fn-creative-code { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fn-creative-sub {
  font-size: 10.5px; color: var(--muted); max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fn-cell-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.fn-hint { font-size: 10px; color: var(--muted); font-weight: 600; }
.fn-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); border: 1px solid var(--cream-a15); border-radius: var(--radius-pill); padding: 1px 6px;
}
.fn-spark { display: inline-block; vertical-align: middle; }

.fn-pill {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: var(--radius-pill); white-space: nowrap;
}
.fn-pill--live    { background: var(--good-a15); color: var(--good); }
.fn-pill--paused  { background: var(--warn-a15); color: var(--warn); }
.fn-pill--draft   { background: var(--cream-a08); color: var(--text-secondary); }
.fn-pill--retired { background: var(--cream-a05); color: var(--dim); }

/* Expanded creative row. The detail cell is not sticky: it spans every column. */
.fn-table tbody tr.fn-detail td,
.table-wrap table.sticky-first.fn-table tbody tr.fn-detail td:first-child {
  position: static; box-shadow: none; background: var(--surface-sunken);
  text-align: left; white-space: normal; padding: 14px 16px; cursor: default;
}
.fn-detail-inner { max-width: 1000px; }
.fn-detail-head { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.fn-tiles--mini .metric-tile { padding: 10px 12px; }
.fn-tiles--mini .metric-tile .value { font-size: 17px; }

.fn-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---- How to read this ---- */
.fn-howto summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text); }
.fn-howto summary:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: var(--radius-4); }
.fn-howto ul { margin: 12px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }

/* ---- Responsive ---- */
@media (max-width: 1000px) {
  .fn-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .fn-tiles, .fn-tiles--mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fn-chart { height: 170px; }
  .fn-charts { grid-template-columns: minmax(0, 1fr); }
  .fn-chart--small { height: 150px; }
  .fn-range-note { width: 100%; order: 3; }
  .fn-head-right { margin-left: 0; width: 100%; justify-content: flex-start; }
  .fn-filter { margin: 8px 0 0; }
  #top-funnel .card-header { flex-wrap: wrap; }
  .fn-table tbody td:first-child { min-width: 150px; }
  .fn-creative-sub { max-width: 110px; }
}
/* Phase 8 input floor (same 900px breakpoint as mobile.css): no iOS zoom on focus. */
@media (max-width: 900px) {
  .fn-range-select { font-size: 16px; }
}
