/* ============================================================
   Dashboard cards — Admin v2 metrics + Dashboard 22 blocks,
   all re-cut in frosted glass. Inner tiles use tinted fills
   (not their own blur): they already sit on frosted glass.
   ============================================================ */

/* ---------------- card heading ---------------- */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.head h3 {
  display: flex;
  align-items: center;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.head-side {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------------- KPI tiles ---------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 20px 18px;
  transform-style: preserve-3d;
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-ic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft-2);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.25);
  transition: transform 0.6s var(--spring);
}
.kpi:hover .kpi-ic {
  transform: rotate(-12deg) scale(1.1);
}
.kpi-num {
  font-size: clamp(32px, 2.8vw, 42px);
  font-weight: 600;
  letter-spacing: -1.6px;
  transform: translateZ(30px);
}
.kpi-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.kpi-foot > div {
  min-width: 0;
}
.kpi-foot strong,
.kpi-foot small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-foot strong {
  font-size: 14.5px;
  font-weight: 600;
}
.kpi-foot small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}
.kpi .spark {
  flex-shrink: 0;
}
.kpi.revenue {
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 78%, transparent), color-mix(in srgb, var(--accent-deep) 82%, transparent));
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.kpi.revenue .kpi-ic {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.kpi.revenue .kpi-foot small {
  color: rgba(255, 255, 255, 0.75);
}
.kpi.revenue .trend.down {
  background: rgba(255, 255, 255, 0.92);
}
.kpi.revenue .spark {
  color: #fff;
}

/* ---------------- quick actions ---------------- */
.quick {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.quick[data-reveal].in,
.quick[data-reveal] {
  opacity: 1;
  animation: none;
}
.chip-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 22px;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--edge-card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  opacity: 0;
  transition: background-color 0.3s;
}
.quick.in .chip-action {
  animation: chipIn 0.8s var(--spring) both;
  animation-delay: calc(var(--base, 0ms) + var(--i, 0) * 75ms + var(--q) * 60ms);
}
@keyframes chipIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.86);
  }
  to {
    opacity: 1;
  }
}
.chip-action:hover {
  background: var(--soft);
}
.chip-ic {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft-2);
  transition: transform 0.5s var(--spring);
}
.chip-action:hover .chip-ic {
  transform: rotate(-10deg) scale(1.1);
  background: var(--solid);
  color: var(--on-solid);
}
.chip-txt {
  position: relative;
  min-width: 0;
}
.chip-txt strong,
.chip-txt small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-txt strong {
  font-size: 13.5px;
  font-weight: 600;
}
.chip-txt small {
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- revenue bars ---------------- */
.legend-row {
  display: flex;
  gap: 16px;
  margin: -6px 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.rbars {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  height: var(--h);
}
.rb-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 28px;
  font-size: 12px;
  color: var(--faint);
}
.rb-axis span {
  line-height: 0;
}
.rb-plot {
  position: relative;
  display: flex;
  gap: 6px;
  height: 100%;
}
.rb-grid {
  position: absolute;
  inset: 0 0 28px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.rb-grid i {
  border-top: 1px dashed var(--line-2);
}
.rb-col {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.rb-stack {
  flex: none;
  height: calc(100% - 28px);
  width: min(48px, 64%);
  display: flex;
  flex-direction: column-reverse;
  transition:
    opacity 0.3s,
    transform 0.45s var(--spring);
}
.rb-cost,
.rb-profit {
  flex: none;
  border-radius: 11px;
  transition: height 1.1s var(--spring);
  transition-delay: calc(var(--i) * 55ms);
}
@starting-style {
  .rb-cost,
  .rb-profit {
    height: 0;
  }
}
.rb-cost {
  height: calc(var(--c) * 100%);
  background: var(--solid);
}
.rb-profit {
  height: calc(var(--p) * 100%);
  margin-bottom: 4px;
  background: repeating-linear-gradient(135deg, var(--accent) 0 2.6px, color-mix(in srgb, var(--accent) 45%, transparent) 2.6px 6px);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.rb-col.now .rb-profit {
  background: repeating-linear-gradient(135deg, var(--accent-2) 0 2.6px, var(--accent) 2.6px 6px);
  box-shadow:
    inset 0 0 0 1.5px var(--accent),
    0 0 26px -4px var(--accent);
}
.rbars.hovering .rb-col:not(.on) .rb-stack {
  opacity: 0.35;
}
.rb-col.on .rb-stack {
  transform: translateY(-5px) scaleX(1.06);
}
.rb-m {
  position: absolute;
  bottom: 0;
  height: 22px;
  font-size: 12.5px;
  color: var(--muted);
  transition: color 0.2s;
}
.rb-col.on .rb-m,
.rb-col.now .rb-m {
  color: var(--ink);
  font-weight: 600;
}
.rb-tip {
  position: absolute;
  left: 50%;
  top: calc((1 - var(--p) - var(--c)) * (100% - 28px) - 14px);
  z-index: 5;
  display: grid;
  gap: 3px;
  min-width: 128px;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -88%) scale(0.85);
  transition:
    opacity 0.2s,
    transform 0.4s var(--spring);
}
.rb-tip b {
  font-size: 16px;
}
.rb-tip span {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.8;
}
.rb-tip .dot.cost {
  background: var(--on-solid);
  opacity: 0.6;
}
.rb-col.on .rb-tip {
  opacity: 1;
  transform: translate(-50%, -100%);
}

/* ---------------- donut ---------------- */
.channels {
  display: flex;
  flex-direction: column;
}
.donut {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.donut-ring {
  position: relative;
}
.donut-ring svg {
  overflow: visible;
}
.donut-track {
  fill: none;
  stroke: var(--line);
}
.donut-seg {
  cursor: pointer;
  transition:
    stroke-dasharray 1.3s var(--ease-out),
    stroke-width 0.45s var(--spring),
    opacity 0.3s,
    filter 0.3s;
}
.donut-seg.dim {
  opacity: 0.28;
}
.donut-seg.lit {
  stroke-width: 30px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
}
.donut-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-mid b {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.8px;
  animation: popIn 0.45s var(--spring);
}
.donut-mid span {
  font-size: 12.5px;
  color: var(--muted);
}
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 22px;
  width: 100%;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 6px 8px;
  border-radius: 10px;
  transition:
    opacity 0.3s,
    background-color 0.2s;
}
.legend li:hover {
  background: var(--card-2);
}
.legend li.dim {
  opacity: 0.4;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend span {
  flex: 1;
}

/* ---------------- ring (target) ---------------- */
.target {
  display: flex;
  flex-direction: column;
}
.target-ring {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 4px 0 18px;
}
.ring {
  position: relative;
}
.ring svg {
  overflow: visible;
}
.ring-track {
  fill: none;
  stroke: var(--line-2);
}
.ring-arc {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.8s var(--ease-out);
}
.ring-head {
  transition: transform 1.8s var(--ease-out);
}
.ring-glow {
  fill: var(--accent-2);
  opacity: 0.35;
}
.ring-dot {
  fill: #fff;
}
.ring-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring-mid b {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -1px;
}
.ring-mid > span {
  font-size: 12.5px;
  color: var(--muted);
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mini-stats div {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 4px;
  border-radius: 16px;
  background: var(--card-2);
  transition: transform 0.4s var(--spring);
}
.mini-stats div:hover {
  transform: translateY(-3px);
}
.mini-stats b {
  font-size: 17px;
}
.mini-stats small {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- pipeline + leaders (shared bars) ---------------- */
.stages {
  display: grid;
  gap: 16px;
}
.stages li {
  display: grid;
  grid-template-columns: 10px 92px minmax(0, 1fr) 26px 54px;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}
.stages .dot {
  width: 10px;
  height: 10px;
}
.stages b {
  text-align: right;
}
.stages small {
  text-align: right;
  color: var(--muted);
}
.track {
  height: 8px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}
.fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 1.4s var(--ease-out);
  transition-delay: calc(var(--i) * 90ms);
}

.leader-list {
  display: grid;
  gap: 12px;
}
.leader-list li {
  display: grid;
  grid-template-columns: 26px 38px minmax(0, 1.4fr) minmax(40px, 1fr) 70px;
  align-items: center;
  gap: 11px;
  padding: 4px 0;
}
.rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--card-2);
  color: var(--muted);
}
.rank.r1 {
  background: linear-gradient(135deg, #ffe08a, #e7a813);
  color: #4a3300;
  box-shadow: 0 4px 12px -4px rgba(231, 168, 19, 0.8);
}
.rank.r2 {
  background: linear-gradient(135deg, #f2f2f2, #b8bcc2);
  color: #33363a;
}
.rank.r3 {
  background: linear-gradient(135deg, #ffd2b0, #c9773f);
  color: #42200a;
}
.leader-who {
  min-width: 0;
}
.leader-who strong,
.leader-who small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leader-who strong {
  font-size: 13.5px;
}
.leader-who small {
  font-size: 12px;
  color: var(--muted);
}
.leader-list b {
  text-align: right;
  font-size: 14px;
}

/* ---------------- videos ---------------- */
.video {
  flex: none;
  width: 246px;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 8px 8px 12px;
  border-radius: 22px;
  text-align: left;
  scroll-snap-align: start;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--edge-card);
  transition: background-color 0.25s;
  animation: rise 0.6s var(--ease-out) both;
  animation-delay: calc(var(--i) * 60ms);
}
.video:hover {
  background: var(--soft-2);
}
.video.fresh {
  animation: freshPop 0.9s var(--spring) both;
  box-shadow:
    inset 0 0 0 1.5px var(--accent),
    0 0 26px -8px var(--accent);
}
.video-art {
  position: relative;
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  display: block;
  aspect-ratio: 200 / 130;
  border-radius: 16px;
  overflow: hidden;
}
.video-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease);
}
.video:hover .video-art img {
  transform: scale(1.08);
}
.video-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(8, 12, 11, 0.45));
  pointer-events: none;
}
.video-play {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: #141414;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.25s,
    transform 0.5s var(--spring);
}
.video-play svg {
  margin-left: 2px;
  fill: currentColor;
}
.video:hover .video-play {
  opacity: 1;
  transform: none;
}
.video-len {
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 8px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  font-style: normal;
  background: rgba(16, 32, 28, 0.82);
  color: #fff;
}
.video strong {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  padding: 0 4px;
}
.video-meta {
  display: flex;
  gap: 10px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.video-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------------- live feed ---------------- */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-bg);
}
.live-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}
.feed-list {
  display: grid;
  gap: 4px;
}
.feed-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 16px;
  transition: background-color 0.25s;
}
.feed-list li:hover {
  background: var(--card-2);
}
.feed-list li.fresh {
  animation: feedIn 1.2s var(--spring) both;
}
@keyframes feedIn {
  0% {
    opacity: 0;
    transform: translateX(-24px) scale(0.94);
    background: color-mix(in srgb, var(--accent) 22%, transparent);
  }
  40% {
    opacity: 1;
    transform: none;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
  }
  100% {
    background: transparent;
  }
}
.feed-list p {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink-2);
}
.feed-list p strong {
  color: var(--ink);
}
.feed-list small {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}
.feed-ic {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.feed-ic.green {
  color: var(--green);
  background: var(--green-bg);
}
.feed-ic.accent {
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.feed-ic.red {
  color: var(--red);
  background: var(--red-bg);
}
.feed-ic.blue {
  color: var(--blue);
  background: rgba(63, 116, 246, 0.14);
}
.feed-ic.amber {
  color: var(--amber);
  background: rgba(227, 155, 18, 0.15);
}

/* ---------------- responsive ---------------- */
@container main (max-width: 1300px) {
  .quick {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@container main (max-width: 820px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .kpis {
    gap: 12px;
  }
  .kpi {
    padding: 16px;
  }
  .kpi-num {
    font-size: 30px;
  }
  .kpi .spark {
    display: none;
  }
  .quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .head {
    flex-wrap: wrap;
  }
  .stages li {
    grid-template-columns: 10px 80px minmax(0, 1fr) 24px;
  }
  .stages small {
    display: none;
  }
  .leader-list li {
    grid-template-columns: 26px 38px minmax(0, 1fr) 70px;
  }
  .leader-list .track {
    display: none;
  }
}
