/* PV: analytics views shared by the provider dashboard and the admin Providers page (see pv.js).
   Colours come from whichever page hosts it (--violet/--pink, --surface, --text ...), with fallbacks. */
.pv {
  --pv-accent: var(--pink, var(--violet, #8b5cf6));
  --pv-accent-2: var(--accent-2, #22d3ee);
  --pv-surface: var(--surface, #17131f);
  --pv-surface-2: var(--surface-elevated, #1c1826);
  --pv-border: var(--border, #2c2738);
  --pv-text: var(--text, #f4f2f8);
  --pv-muted: var(--text-secondary, #a79fc4);
  --pv-faint: var(--text-faint, #726a8c);
  --pv-good: var(--ok, #4dbb5f);
  --pv-bad: var(--error, #ef6a86);
  --pv-warn: var(--warn, #d99425);
  color: var(--pv-text);
}
.pv *, .pv *::before, .pv *::after { box-sizing: border-box; }
.pv h2, .pv h3, .pv h4, .pv p { margin: 0; }
.pv-muted { color: var(--pv-muted); font-size: 13px; }
.pv-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-note { color: var(--pv-muted); font-size: 12.5px; line-height: 1.5; margin-top: 10px !important; }
.pv-sub { color: var(--pv-muted); font-size: 12.5px; }
.pv-sub a { color: var(--pv-accent); text-decoration: none; font-weight: 600; }

.pv-intro { margin-bottom: 18px; }
.pv-intro h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.pv-intro p { color: var(--pv-muted); font-size: 14px; margin-top: 4px; max-width: 70ch; }

/* KPI tiles */
.pv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pv-kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pv-kpi { background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 14px; padding: 16px 18px; position: relative; overflow: hidden; }
.pv-kpi.primary { background: linear-gradient(135deg, color-mix(in srgb, var(--pv-accent) 14%, var(--pv-surface)), var(--pv-surface) 70%); border-color: color-mix(in srgb, var(--pv-accent) 40%, var(--pv-border)); }
.pv-kpi-label { font-size: 12px; font-weight: 600; color: var(--pv-muted); text-transform: uppercase; letter-spacing: .06em; }
.pv-kpi-value { font-size: 30px; font-weight: 800; margin: 6px 0 4px; letter-spacing: -.02em; line-height: 1.1; }
.pv-kpi-value small { font-size: 14px; font-weight: 600; color: var(--pv-muted); margin-left: 2px; }
.pv-kpi-extra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; min-height: 28px; }
.pv-kpi .pv-spark { margin-left: auto; }

.pv-delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 50px; white-space: nowrap; }
.pv-delta.up { color: var(--pv-good); background: color-mix(in srgb, var(--pv-good) 16%, transparent); }
.pv-delta.down { color: var(--pv-bad); background: color-mix(in srgb, var(--pv-bad) 16%, transparent); }
.pv-delta.flat { color: var(--pv-muted); background: color-mix(in srgb, var(--pv-muted) 16%, transparent); }

.pv-spark .line { fill: none; stroke: var(--pv-accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.pv-spark .fill { fill: var(--pv-accent); opacity: .16; }

/* cards */
.pv-card { background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 14px; padding: 16px 18px 18px; margin-bottom: 16px; min-width: 0; }
.pv-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pv-card h3 { font-size: 15px; font-weight: 700; }
.pv-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pv-grid2 > .pv-card { margin-bottom: 16px; }

.pv-toggle { display: inline-flex; background: var(--pv-surface-2); border: 1px solid var(--pv-border); border-radius: 50px; padding: 3px; margin-bottom: 8px; }
.pv-toggle button { background: transparent; border: none; color: var(--pv-muted); font-weight: 600; font-size: 12.5px; padding: 5px 14px; border-radius: 50px; cursor: pointer; }
.pv-toggle button.active { background: var(--pv-accent); color: #fff; }

/* charts */
.pv-chart { position: relative; width: 100%; }
.pv-area .grid { stroke: var(--pv-border); stroke-width: 1; stroke-dasharray: 3 4; }
.pv-area .axis { fill: var(--pv-faint); font-size: 11px; }
.pv-area { --c: var(--pv-accent); display: block; }
.pv-area .line { fill: none; stroke: var(--c); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.pv-area .cursor { stroke: var(--pv-muted); stroke-dasharray: 3 3; }
.pv-area .dot { fill: var(--c); stroke: var(--pv-surface); stroke-width: 2; }
.pv-tip { position: absolute; pointer-events: none; background: var(--pv-surface-2); border: 1px solid var(--pv-border); border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.4; box-shadow: 0 8px 20px rgba(0,0,0,.35); white-space: nowrap; z-index: 2; }
.pv-bars { display: flex; align-items: flex-end; gap: 3px; }
.pv-bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.pv-bar { width: 100%; background: color-mix(in srgb, var(--pv-accent) 55%, transparent); border-radius: 3px 3px 0 0; min-height: 2px; transition: background .15s; }
.pv-bar.peak, .pv-bar-col:hover .pv-bar { background: var(--pv-accent); }
.pv-bars-axis { display: flex; margin-top: 6px; font-size: 11px; color: var(--pv-faint); }
.pv-bars-axis span { flex: 1; text-align: left; white-space: nowrap; }
.pv-bars-axis.two { justify-content: space-between; } .pv-bars-axis.two span { flex: none; }

.pv-hbars { display: grid; gap: 10px; }
.pv-hrow { display: grid; grid-template-columns: minmax(90px, 36%) 1fr auto; align-items: center; gap: 12px; font-size: 13.5px; }
.pv-hlabel { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pv-htrack { height: 8px; background: var(--pv-surface-2); border-radius: 50px; overflow: hidden; }
.pv-hfill { height: 100%; background: linear-gradient(90deg, var(--pv-accent), var(--pv-accent-2)); border-radius: 50px; }
.pv-hval { text-align: right; font-weight: 700; white-space: nowrap; }
.pv-hval small { display: block; font-weight: 500; color: var(--pv-muted); font-size: 11.5px; }
.pv-flag { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--pv-surface-2); border: 1px solid var(--pv-border); color: var(--pv-muted); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; flex: none; }

.pv-stack { display: flex; height: 14px; border-radius: 50px; overflow: hidden; background: var(--pv-surface-2); }
.pv-seg.a, .pv-dot.a { background: var(--pv-accent); } .pv-seg.b, .pv-dot.b { background: var(--pv-accent-2); }
.pv-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.pv-legend small { color: var(--pv-muted); } .pv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* posters and title cards */
.pv-poster-img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--pv-surface-2); }
.pv-poster-img.xs { width: 28px; height: 40px; aspect-ratio: auto; border-radius: 5px; flex: none; }
.pv-poster-img.lg { border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.45); }
.pv-poster-ph { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 34px; color: #fff; background: linear-gradient(160deg, var(--pv-accent), #3b1f7a); }
.pv-poster-img.xs.pv-poster-ph { font-size: 14px; }
.pv-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pv-search, .pv-select { width: auto; background: var(--pv-surface); border: 1px solid var(--pv-border); color: var(--pv-text); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.pv-search { flex: 1; min-width: 200px; max-width: 360px; } .pv-search:focus, .pv-select:focus { outline: none; border-color: var(--pv-accent); }
.pv-poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 14px; }
.pv-title-card { background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; outline: none; }
.pv-title-card:hover, .pv-title-card:focus-visible { transform: translateY(-3px); border-color: var(--pv-accent); box-shadow: 0 14px 30px rgba(0,0,0,.35); }
.pv-poster-wrap { position: relative; } .pv-poster-wrap .pv-poster-img { border-radius: 0; }
.pv-poster-top { position: absolute; top: 8px; left: 8px; }
.pv-poster-shade { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 9px; background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; font-size: 12px; font-weight: 600; }
.pv-title-body { padding: 12px 14px 14px; }
.pv-title-body h4 { font-size: 14.5px; font-weight: 700; }
.pv-title-nums { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 15px; }
.pv-title-sub { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--pv-muted); }

.pv-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 50px; }
.pv-badge.live { background: color-mix(in srgb, var(--pv-good) 85%, #000); color: #fff; }
.pv-badge.draft { background: rgba(0,0,0,.55); color: #ddd; } .pv-badge.sched { background: color-mix(in srgb, var(--pv-warn) 90%, #000); color: #fff; }
.pv-hero .pv-badge.draft { background: color-mix(in srgb, var(--pv-muted) 30%, transparent); color: var(--pv-text); }
.pv-badge.tier { background: color-mix(in srgb, var(--pv-accent) 24%, transparent); color: var(--pv-accent); }
.pv-badge.genre { background: var(--pv-surface-2); color: var(--pv-muted); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }

/* title detail hero */
.pv-hero { position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--pv-border); background: var(--pv-surface); }
.pv-hero::before { content: ""; position: absolute; inset: 0; background-image: var(--hero, none); background-size: cover; background-position: center; filter: blur(26px) saturate(1.2); opacity: .32; transform: scale(1.15); }
.pv-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--pv-surface) 8%, transparent 80%); opacity: .75; }
.pv-hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 190px 1fr; gap: 26px; padding: 24px; align-items: start; }
.pv-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pv-hero-info h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.pv-synopsis { margin-top: 10px !important; color: var(--pv-muted); line-height: 1.6; font-size: 14px; max-width: 70ch; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pv-hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; }
.pv-hero-stats div { display: flex; flex-direction: column; gap: 2px; } .pv-hero-stats b { font-size: 20px; font-weight: 800; } .pv-hero-stats span { font-size: 12px; color: var(--pv-muted); }
.pv-callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pv-callout { border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.5; border: 1px solid; }
.pv-callout.good { background: color-mix(in srgb, var(--pv-good) 10%, var(--pv-surface)); border-color: color-mix(in srgb, var(--pv-good) 35%, var(--pv-border)); }
.pv-callout.warn { background: color-mix(in srgb, var(--pv-warn) 10%, var(--pv-surface)); border-color: color-mix(in srgb, var(--pv-warn) 35%, var(--pv-border)); }
.pv-callout span { color: var(--pv-muted); }

/* tables */
.pv-table-wrap { overflow-x: auto; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pv-table th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--pv-muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--pv-border); white-space: nowrap; }
.pv-table td { padding: 10px; border-bottom: 1px solid var(--pv-border); vertical-align: middle; max-width: 260px; }
.pv-table tr:last-child td { border-bottom: none; }
.pv-reach { display: inline-block; vertical-align: middle; width: 90px; height: 7px; background: var(--pv-surface-2); border-radius: 50px; overflow: hidden; margin-right: 8px; }
.pv-reach div { height: 100%; background: var(--pv-accent); border-radius: 50px; }
.pv-table small { color: var(--pv-muted); }
.pv-link { background: none; border: none; color: var(--pv-accent); font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0; }
.pv-ret-row td { background: var(--pv-surface-2); } .pv-ret b { display: block; font-size: 12.5px; margin-bottom: 8px; }
.pv-actions { display: flex; gap: 10px; margin-top: 12px; }
.pv-btn { border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 13px; cursor: pointer; border: 1px solid var(--pv-border); background: var(--pv-accent); color: #fff; }
.pv-btn.ghost { background: transparent; color: var(--pv-text); } .pv-btn.ghost:hover { border-color: var(--pv-accent); }

.pv-empty { text-align: center; padding: 56px 20px; background: var(--pv-surface); border: 1px dashed var(--pv-border); border-radius: 16px; }
.pv-empty h3 { font-size: 20px; margin: 10px 0 6px; } .pv-empty p { color: var(--pv-muted); max-width: 46ch; margin: 0 auto; line-height: 1.6; font-size: 14px; }
.pv-empty-art { opacity: .8; }

@media (max-width: 900px) {
  .pv-kpis, .pv-kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-grid2 { grid-template-columns: 1fr; }
  .pv-hero-inner { grid-template-columns: 120px 1fr; gap: 16px; padding: 16px; }
  .pv-hero-info h2 { font-size: 22px; }
  .pv-hrow { grid-template-columns: minmax(80px, 40%) 1fr auto; }
}
@media (max-width: 520px) {
  .pv-kpis, .pv-kpis.six { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pv-kpi { padding: 13px 14px; } .pv-kpi-value { font-size: 24px; }
  .pv-hero-inner { grid-template-columns: 1fr; } .pv-hero-poster { max-width: 140px; }
  .pv-poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pv-hero-stats { gap: 18px; }
}

/* titles: smaller grid cards, list layout, layout switch */
.pv-title-body { padding: 10px 12px 12px; } .pv-title-body h4 { font-size: 13.5px; } .pv-title-nums { font-size: 14px; margin-top: 4px; } .pv-title-sub { font-size: 11.5px; }
.pv-viewswitch { display: inline-flex; margin-left: auto; background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 10px; padding: 3px; }
.pv-viewswitch button { background: transparent; border: none; color: var(--pv-muted); width: 34px; height: 30px; padding: 0; border-radius: 8px; display: grid; place-items: center; cursor: pointer; box-shadow: none; }
.pv-viewswitch button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pv-viewswitch button.active { background: var(--pv-accent); color: #fff; }
.pv-poster-img.sm { width: 40px; height: 58px; aspect-ratio: auto; border-radius: 7px; flex: none; }
.pv-poster-img.sm.pv-poster-ph { font-size: 17px; }
.pv-list { display: grid; gap: 8px; }
.pv-list-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 110px 90px 96px 16px; align-items: center; gap: 16px; background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 12px; padding: 10px 16px 10px 12px; cursor: pointer; outline: none; transition: border-color .15s, background .15s; }
.pv-list-row:hover, .pv-list-row:focus-visible { border-color: var(--pv-accent); background: var(--pv-surface-2); }
.pv-list-title { font-weight: 700; font-size: 14.5px; }
.pv-list-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; color: var(--pv-muted); flex-wrap: wrap; }
.pv-list-meta .pv-badge { font-size: 10px; padding: 2px 8px; }
.pv-list-num { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--pv-muted); } .pv-list-num b { font-size: 14.5px; color: var(--pv-text); }
.pv-list-go { color: var(--pv-faint); font-size: 22px; line-height: 1; }
@media (max-width: 700px) { .pv-list-row { grid-template-columns: 40px minmax(0, 1fr) 90px; } .pv-list-row .pv-list-num:nth-of-type(2), .pv-list-spark, .pv-list-go { display: none; } .pv-poster-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
