/*
 * "4 Real-time analytics — The same report, running continuously" section (AI Agent Governance page).
 * Loaded on top of aig-inventory.css, which provides the section shell, numbered header, stat cards
 * and status badges; this file adds the .dlh-aig-inv--analytics variant and the dashboard cards.
 */

.dlh-aig-inv.dlh-aig-inv--analytics { background: #f9fafa; padding: 82.5px 16px 81.5px; }
.dlh-aig-inv--analytics .dlh-aig-inv__inner { max-width: 1126px; }

/* Stat cards: white, Figma widths 254 / 289 / 253 / 267 */
.dlh-aig-inv--analytics .dlh-aig-stats { max-width: 1126px; grid-template-columns: 254fr 289fr 253fr 267fr; }
.dlh-aig-inv--analytics .dlh-aig-stat { background: #fff; }
.dlh-aig-inv .dlh-aig-stat__value--up { color: #dc2626; }
.dlh-aig-inv .dlh-aig-stat__value--down { color: #16a34a; }

/* ---------- Spend trend chart ----------
   Drawn in the card's 1126 × 447 Figma units (--u), so every line, label and asset keeps its exact
   place as the card scales. Text never drops below 10px. */
.dlh-aig-trend-scroll { width: 100%; }
.dlh-aig-trend {
  --u: calc(100cqw / 1126);
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 1126 / 447;
  border-radius: 24px;
  background: #fff;
  overflow: hidden;
  text-align: left;
  color: #000;
}
.dlh-aig-trend > * { position: absolute; }
.dlh-aig-trend img { display: block; max-width: none; }
.dlh-aig-inv .dlh-aig-trend__title {
  left: calc(32 * var(--u)); top: calc(34 * var(--u));
  color: var(--dlh-aig-inv-ink);
  font-size: max(14px, calc(16 * var(--u))); font-weight: 500; line-height: 1.375; white-space: nowrap;
}
.dlh-aig-trend__unit {
  right: calc(90 * var(--u)); top: calc(38 * var(--u));   /* right edge at x = 1036 */
  font-size: max(10px, calc(12 * var(--u))); line-height: 1.333; white-space: nowrap;
}
.dlh-aig-trend__today {
  left: calc(560 * var(--u)); top: calc(71 * var(--u));
  color: #545454;
  font-size: max(10px, calc(14 * var(--u))); line-height: 1.571;
}
.dlh-aig-trend__grid { left: calc(72 * var(--u)); top: calc(94.5 * var(--u)); width: calc(1025 * var(--u)); height: calc(249 * var(--u)); }
.dlh-aig-trend__area { left: calc(72.5 * var(--u)); top: calc(109.8 * var(--u)); width: calc(485 * var(--u)); height: calc(233.18 * var(--u)); }
.dlh-aig-trend__actual { left: calc(71.27 * var(--u)); top: calc(109.07 * var(--u)); width: calc(486.18 * var(--u)); height: calc(198.74 * var(--u)); }
.dlh-aig-trend__projected { left: calc(556.22 * var(--u)); top: calc(108.72 * var(--u)); width: calc(491 * var(--u)); height: calc(187.77 * var(--u)); }
.dlh-aig-trend__marker { left: calc(558 * var(--u)); top: calc(96 * var(--u)); width: 2px; height: calc(244 * var(--u)); }

.dlh-aig-trend__y {
  right: calc(1079 * var(--u)); top: calc(87 * var(--u));   /* right-aligned at x = 47 */
  height: calc(269 * var(--u));
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end;
}
.dlh-aig-trend__x {
  left: calc(72 * var(--u)); top: calc(356 * var(--u));
  width: calc(1025 * var(--u));
  display: flex; justify-content: space-between;
}
.dlh-aig-trend__y,
.dlh-aig-trend__x { font-size: max(10px, calc(14 * var(--u))); line-height: calc(22 * var(--u)); white-space: nowrap; }

.dlh-aig-trend__legend {
  left: calc(32 * var(--u)); top: calc(397 * var(--u));
  display: flex; align-items: center; gap: calc(33 * var(--u));
  font-size: max(10px, calc(12 * var(--u))); line-height: 1.333; white-space: nowrap;
}
.dlh-aig-trend__legend > span { display: flex; align-items: center; gap: 7px; }

/* ---------- Shared white dashboard card ---------- */
.dlh-aig-card {
  border-radius: 24px;
  background: #fff;
  padding: 27px 32px 32px;
  text-align: left;
  min-width: 0;
}
.dlh-aig-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dlh-aig-inv .dlh-aig-card__title {
  color: var(--dlh-aig-inv-ink);
  font-size: 16px; font-weight: 500; line-height: 22px; letter-spacing: 0;
}
.dlh-aig-card__note { margin-top: 10px; font-size: 12px; line-height: 16px; white-space: nowrap; }

/* Spend by platform (495) + Costliest agents (605) */
.dlh-aig-dash-row {
  width: 100%; max-width: 1121px;
  display: grid; grid-template-columns: 495fr 605fr; gap: 21px;
}
.dlh-aig-platforms,
.dlh-aig-costliest { min-height: 400px; }

.dlh-aig-platforms__body { display: flex; align-items: flex-start; gap: 17px; margin: 44px 0 0 16px; }   /* donut top at y = 97 (head is 53 tall) */
.dlh-aig-donut { position: relative; flex: none; width: 205px; height: 205px; }
.dlh-aig-donut img { display: block; width: 205px; height: 205px; }
.dlh-aig-donut__value,
.dlh-aig-donut__label { position: absolute; left: 50%; transform: translate(-50%, -50%); white-space: nowrap; }
.dlh-aig-donut__value { top: 98.5px; color: var(--dlh-aig-inv-ink); font-size: 24px; line-height: 29px; letter-spacing: -0.18px; }
.dlh-aig-donut__label { top: 122px; color: #545454; font-size: 14px; line-height: 22px; }

.dlh-aig-platforms__legend { margin-top: 34px; display: flex; flex-direction: column; gap: 17px; }
.dlh-aig-inv .dlh-aig-platforms__legend li {
  display: flex; align-items: center; gap: 7px;
  color: var(--dlh-aig-inv-ink);
  font-size: 12px; line-height: 16px; white-space: nowrap;
}
.dlh-aig-platforms__swatch { flex: none; width: 16px; height: 16px; border-radius: 4px; }
.dlh-aig-platforms__value { color: #9d9d9d; }
.dlh-aig-inv .dlh-aig-platforms__foot { max-width: 431px; margin-top: 17px; color: #9d9d9d; font-size: 12px; line-height: 16px; }

.dlh-aig-costliest__bars { margin-top: 34px; display: flex; flex-direction: column; gap: 22px; }
.dlh-aig-costliest__bars li { display: flex; flex-direction: column; gap: 8px; }
.dlh-aig-costliest__label {
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--dlh-aig-inv-ink);
  font-size: 13px; font-weight: 600; line-height: 16px; letter-spacing: -0.2px;
}
.dlh-aig-costliest__label span { color: #9d9d9d; }
.dlh-aig-costliest__track { display: block; height: 8px; border-radius: 999px; background: #dbdbdb; overflow: hidden; }
.dlh-aig-costliest__fill { display: block; height: 100%; border-radius: 999px; }
.dlh-aig-costliest__fill--red { background: #f95048; }
.dlh-aig-costliest__fill--yellow { background: #feda33; }
.dlh-aig-costliest__fill--green { background: #47d7ac; }

/* Right-sizing opportunities: list 1024 wide at x = 31, right note ends at x = 1096 */
.dlh-aig-opps { width: 100%; padding: 34px 30px 34px 31px; }
.dlh-aig-opps .dlh-aig-card__head { padding-left: 1px; }
.dlh-aig-opps .dlh-aig-card__title { margin-top: 0; }
.dlh-aig-opps .dlh-aig-card__note { margin-top: 3px; }
.dlh-aig-opps__list { max-width: 1024px; margin-top: 21px; }
.dlh-aig-opp {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px;
  border-bottom: 1px solid #dbdbdb;
}
.dlh-aig-opp:last-child { border-bottom: 0; }
.dlh-aig-opp__text { display: flex; flex-direction: column; gap: 6px; flex: 0 1 auto; min-width: min(484px, 100%); color: var(--dlh-aig-inv-ink); }
.dlh-aig-inv .dlh-aig-opp__agent { font-size: 17px; line-height: 24px; letter-spacing: -0.18px; }
.dlh-aig-inv .dlh-aig-opp__action { font-size: 12px; line-height: 16px; }
.dlh-aig-opp__meta { display: flex; align-items: center; gap: 8px; flex: none; }
.dlh-aig-opp__saving { color: var(--dlh-aig-inv-ink); font-size: 20px; line-height: 24px; letter-spacing: -0.18px; }

/* Tablet: charts stack */
@media (max-width: 1023px) {
  .dlh-aig-dash-row { grid-template-columns: 1fr; gap: 16px; }
  .dlh-aig-platforms,
  .dlh-aig-costliest { min-height: 0; }
}

@media (max-width: 900px) {
  .dlh-aig-inv.dlh-aig-inv--analytics { padding: 72px 16px; }
  .dlh-aig-inv--analytics .dlh-aig-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Phones: the trend chart keeps a readable size and scrolls sideways in its box;
   donut legend and opportunity values drop below */
@media (max-width: 720px) {
  .dlh-aig-inv.dlh-aig-inv--analytics { padding: 64px 16px; }
  .dlh-aig-trend-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 24px; }
  .dlh-aig-trend { min-width: 640px; }
  .dlh-aig-card { padding: 24px 20px; }
  .dlh-aig-card__head { flex-direction: column; gap: 4px; }
  .dlh-aig-card__note { margin-top: 0; }
  .dlh-aig-opps .dlh-aig-card__note { margin-top: 0; }
  .dlh-aig-platforms__body { flex-direction: column; align-items: center; gap: 24px; margin: 24px 0 0; }
  .dlh-aig-platforms__legend { margin-top: 0; gap: 12px; }
  .dlh-aig-costliest__bars { margin-top: 24px; gap: 18px; }
  .dlh-aig-opps__list { margin-top: 12px; }
  .dlh-aig-opp { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 0; }
  .dlh-aig-opp__text { width: auto; }
}
