/* IB Studio: YouTube > Detailed analytics, copied from the CRM (crm/css/ytstats.css + the chart rules it needs from
   crm/css/charts.css and crm/css/youtube.css), so the page looks the same in both. The sidebar part is left out. */
.card__empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card__meta { color: var(--muted); font-size: var(--fs-small); margin-top: 4px; }
.table-wrap { overflow-x: auto; }
.kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi__value { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.kpi__sub { color: var(--muted); font-size: 12px; }
.ys-kpi.kc--t-cash { background: linear-gradient(135deg, var(--red), var(--coral)); }
.ys-kpi { background: var(--paper); border-radius: var(--card-radius); box-shadow: var(--card-shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.mf-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12.5px; }
@media (max-width: 900px) { .ys-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } .ys-grid { grid-template-columns: minmax(0, 1fr) !important; } }

/* ---- crm/css/charts.css: tooltip + donut */
.ctip[hidden] { display: none; }
.ctip { position: absolute; z-index: 30; pointer-events: none; display: grid; gap: 2px; min-width: 150px; max-width: 260px; padding: 10px 12px;
  border-radius: 12px; background: var(--glass); color: var(--ink); box-shadow: var(--frame-shadow); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  font: 500 12.5px/1.35 var(--f-body); }
.ctip b { font-weight: 650; font-size: 12.5px; }
.ctip__big { font: 600 20px/1.2 var(--f-mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ctip small { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.dn { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
.dn__legend { width: 100%; }
.dn__chart { max-width: 220px; width: 100%; }
.dn__svg { display: block; width: 100%; height: auto; overflow: visible; }
.dn__slice { outline: none; transition: opacity 0.2s var(--ease), transform 0.25s var(--ease); transform-box: fill-box; transform-origin: center; }
.dn.is-hover .dn__slice:not(.is-on) { opacity: 0.38; }
.dn__slice.is-on { transform: scale(1.03); }
.dn__slice:focus-visible path { stroke: var(--ring); stroke-width: 3; }
.dn__val { font: 650 12px var(--f-mono); pointer-events: none; }
.dn__total { font: 650 30px var(--f-mono); letter-spacing: -0.04em; fill: var(--ink); }
.dn__cap { font: 500 12px var(--f-body); fill: var(--muted); }
.dn__empty { fill: none; stroke: var(--track); }
.dn__legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dn__item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; font-size: 13px; padding: 3px 6px; border-radius: 6px; }
.dn__item.is-on { background: var(--hover); }
.dn__item.is-muted { color: var(--muted); }
.dn__dot { width: 10px; height: 10px; border-radius: 3px; }
.dn__dot--hollow { border: 1.5px dashed var(--dash); }
.dn__lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn__n { font: 600 13px var(--f-mono); text-align: right; }
.dn__n--note { grid-column: span 2; font: italic 500 12px var(--f-body); }
.dn__pct { font: 500 12px var(--f-mono); color: var(--muted); text-align: right; }
@keyframes dn-in { from { opacity: 0; transform: scale(0.85); } }
.dn__slice { animation: dn-in 0.6s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@media (max-width: 520px) { .dn { grid-template-columns: minmax(0, 1fr); justify-items: center; } .dn__legend { width: 100%; } }

/* ---- crm/css/youtube.css: line chart parts */
.lc__chart, .sc__chart { outline: none; border-radius: 8px; }
.lc__chart:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.lc__svg, .sc__svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.lc__grid line { stroke: var(--line); stroke-width: 1; }
.lc__grid .sc__vline { stroke-dasharray: 2 4; }
.lc__tick { font: 500 10.5px var(--f-mono); fill: var(--muted); font-variant-numeric: tabular-nums; }
.lc__tick--a { fill: color-mix(in srgb, var(--red) 70%, var(--muted)); }
.lc__tick--b { fill: color-mix(in srgb, var(--yt-clicks) 75%, var(--muted)); }
.sc__axis { font-family: var(--f-body); }
.lc__area { opacity: 0.12; }
.lc__line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.lc__line--b { stroke-width: 2; }
.lc__guide { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.lc__hit { fill: transparent; cursor: crosshair; }
.lc__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 6px; font-size: 12px; color: var(--ink-2); }
.lc__legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lc__key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.lc__key--line { width: 14px; height: 3px; border-radius: 2px; margin-right: 0; }

/* ---- crm/css/ytstats.css */
/* page */
.ys-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.ys-view > * { min-width: 0; }
.ys-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ys-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.ys-switch__btn { border: 0; padding: 7px 12px; border-radius: 9px; background: none; color: var(--ink-2); font: 600 13px var(--f-body); cursor: pointer; }
.ys-switch__btn:hover { color: var(--ink); background: var(--hover); }
.ys-switch__btn.is-on { background: var(--paper); color: var(--red-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--line); }
.ys-switch__btn.is-pending { color: var(--muted); font-weight: 500; }
.ys-td--pending { color: var(--faint); font-size: 12px; font-style: italic; }
.ys-switch__btn:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

.ys-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ys-kpi { min-width: 0; }
.ys-kpi .kpi__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ys-kpi.kc--t-cash .kpi__label, .ys-kpi.kc--t-cash .kpi__value, .ys-kpi.kc--t-cash .kpi__sub { color: #fff; }

.ys-card { min-width: 0; }
.ys-thumb { flex: none; width: 64px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; }

/* ranked bars */
.ys-bar-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.ys-bar { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.ys-bar__rank { font-size: 13px; font-weight: 700; color: var(--muted); text-align: right; }
.ys-bar:first-child .ys-bar__rank { color: var(--red); }
.ys-bar__body { display: grid; gap: 6px; min-width: 0; }
.ys-bar__title { font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ys-bar__title:hover { color: var(--red-ink); text-decoration: underline; }
.ys-bar__track { position: relative; height: 14px; border-radius: 99px; background: var(--track); }
.ys-bar__fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--red), var(--coral)); transition: width 0.6s var(--ease); }
.ys-bar--down .ys-bar__fill { background: linear-gradient(90deg, color-mix(in srgb, var(--slate) 75%, transparent), var(--slate)); }
.ys-bar__avg { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); opacity: 0.55; }
.ys-bar__v { min-width: 64px; text-align: right; font-size: 15px; }

.ys-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--gap); }

/* many lines */
.ml { position: relative; }
.ml__svg { display: block; width: 100%; height: auto; }
.ml__stroke { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ml__area { opacity: 0.06; }
.ml__end { stroke: var(--paper); stroke-width: 2; }
.ml__line { transition: opacity 0.15s; }
.ml.is-focus .ml__line { opacity: 0.18; }
.ml.is-focus .ml__line.is-on { opacity: 1; }
.ml.is-focus .ml__line.is-on .ml__area { opacity: 0.14; }
.ml__legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ml__chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 10px; border: 0; border-radius: 999px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font: 500 12.5px var(--f-body); cursor: default; }
.ml__chip.is-on { color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-strong, var(--line)); }
.ml__chip:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.ml__key { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ml__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* side by side */
.ys-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ys-table th, .ys-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.ys-table thead th { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ys-table thead th:first-child, .ys-vid { text-align: left; }
.ys-th { border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.ys-th:hover { color: var(--ink); }
.ys-table th.is-sort { color: var(--red-ink); }
.ys-table td.is-sort { background: color-mix(in srgb, var(--red-soft) 45%, transparent); }
.ys-vid { display: flex; align-items: center; gap: 10px; min-width: 240px; font-weight: 600; }
.ys-vid .ys-thumb { width: 52px; }
.ys-vid a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.ys-vid a:hover { color: var(--red-ink); text-decoration: underline; }
.ys-td { white-space: nowrap; }
.ys-td .mono { display: block; }
.ys-mini { display: block; height: 4px; margin: 4px 0 0 auto; width: 64px; border-radius: 99px; background: var(--track); overflow: hidden; }
.ys-mini span { display: block; height: 100%; border-radius: 99px; background: var(--red); }
.ys-td:not(.is-sort) .ys-mini span { background: var(--slate); }

@media (max-width: 1100px) { .ys-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .ys-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ys-bar { grid-template-columns: 18px 48px minmax(0, 1fr) auto; gap: 8px; }
  .ys-bar .ys-thumb { width: 48px; }
  .ys-bar__v { min-width: 48px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ys-bar__fill, .sb__caret { transition: none; } }

/* ---- studio only: the placeholder when a video has no thumbnail, and the KPI tile tones */
.ys-thumb { display: grid; place-items: center; background: var(--paper-3); }
.ys-thumb .thumb__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ys-thumb__ph { color: var(--muted); }
.ys-view .page-head { margin-bottom: 0; }
.ys-view .tabs { margin: 0; }
.ys-kpi .kpi__label { display: inline-flex; align-items: center; gap: 8px; }
.ys-kpi__icon { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--paper-2); color: var(--ink-2); }
.ys-kpi.kc--t-cash .ys-kpi__icon { background: rgba(255, 255, 255, .2); color: #fff; }
.ys-kpi.kc--t-hot .ys-kpi__icon { background: var(--red-soft); color: var(--red-ink); }
.ys-kpi.kc--t-booked .ys-kpi__icon { background: var(--blue-soft); color: var(--blue-ink); }
.ys-kpi.kc--t-leads .ys-kpi__icon { background: var(--lilac-soft); color: var(--lilac-ink); }
