/* ════════════════════════════════════════════════════════════════════════
   Trendmetrik · Handoff KPI System — PR-1 (2026-06-08)
   Source: C:\Users\srht4\Downloads\KPi (2)\design_handoff_kpi_cards\css\kpi.css
   Bound to: static/css/v2/tokens.css (tmv2 design tokens)

   Scope: `.tm-kpi-v3` BEM family — applied by `templates/macros/tm_kpi_card.html`.
   Old `.tm-kpi-card__*` (Overview) and `.tm-kpi__*` (Live) selectors are LEFT
   ALONE: the macro emits BOTH old + new class roots on each element so old
   CSS (PR-A v4 premium chassis) and old JS hooks (#1838 click popover,
   dashboard-canli-init data-bind) keep functioning unchanged.

   Why: avoid a big-bang rewrite. PR-1 adds a refined visual layer that
   defeats older width/spacing rules with higher specificity, while every
   pre-existing selector still matches.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Handoff KPI tokens — mapped to tmv2 where possible, literal where the
     reference value is intentional. */
  --tmkv3-line:        var(--tm-border, #e7ebf1);
  --tmkv3-line-strong: var(--tm-border-strong, #dbe5ef);
  --tmkv3-ink:         var(--tm-text-primary, #0f172a);
  --tmkv3-ink-2:       var(--tm-text-secondary, #475569);
  --tmkv3-mute:        var(--tm-text-muted, #94a3b8);
  --tmkv3-primary:     var(--tm-brand-500, #0175e4);
  --tmkv3-primary-deep:var(--tm-brand-600, #0163c2);
  --tmkv3-success:     var(--tm-ok, #16a34a);
  --tmkv3-danger:      var(--tm-bad, #dc2626);
  --tmkv3-accent:      var(--tm-accent-500, #fd751f);
  --tmkv3-font-mono:   var(--tm-font-mono, "JetBrains Mono", ui-monospace, monospace);
  --tmkv3-font-sans:   var(--tm-font-sans, "Inter var", "Inter", sans-serif);
}

/* ──────────────────────────────────────────────────────────────────────
   1) CHASSIS — applies to BOTH static (Overview) and live (Canlı) cards.
   High-spec chain so it beats overview-real-spacing-2026-06-07.css
   (.tm-kpi-card.tmv2-metric-card at 6-class chain) and the existing
   live-dashboard.css base rules.
   ────────────────────────────────────────────────────────────────────── */
html body .tm-kpi-v3,
html body #overviewTab .tm-kpi-v3,
html body #overviewTab .tm-kpi-card.tm-kpi-v3,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tmv2-metric-card,
html body .tm-live-page .tm-kpi.tm-kpi-v3 {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1px solid var(--tmkv3-line) !important;
  border-radius: 12px !important;
  padding: 15px 16px 0 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  overflow: hidden !important;
  min-height: 178px !important;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease !important;
}

html body .tm-kpi-v3:hover,
html body #overviewTab .tm-kpi-card.tm-kpi-v3:hover,
html body .tm-live-page .tm-kpi.tm-kpi-v3:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.09);
  border-color: var(--tmkv3-line-strong);
}

/* Dark-mode chassis */
html.dark-mode body .tm-kpi-v3,
html.dark-mode body #overviewTab .tm-kpi-card.tm-kpi-v3,
html.dark-mode body .tm-live-page .tm-kpi.tm-kpi-v3 {
  background: #161c23 !important;
  border-color: #27272a !important;
}

/* ──────────────────────────────────────────────────────────────────────
   2) HEAD — icon chip + label + live badge + info trigger
   ────────────────────────────────────────────────────────────────────── */
.tm-kpi-v3__head {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  position: relative !important;
  z-index: 3 !important;
  padding: 0 !important;
  margin: 0 !important;
}

.tm-kpi-v3__icon {
  position: static !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 7px !important;
  background: #f1f5f9 !important;
  color: var(--tmkv3-ink-2) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  top: auto !important;
  right: auto !important;
}
.tm-kpi-v3__icon svg,
.tm-kpi-v3__icon i {
  width: 15px !important;
  height: 15px !important;
}

.tm-kpi-v3__label {
  font-family: var(--tmkv3-font-sans);
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

.tm-kpi-v3__tools {
  margin-left: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0;
}

/* Live badge (red pill + pulse dot) */
.tm-kpi-v3__live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 7px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-family: var(--tmkv3-font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.tm-kpi-v3__live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tmkv3-danger);
  animation: tmkv3PulseDot 1.4s ease-in-out infinite;
}
@keyframes tmkv3PulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.7); }
}

/* Info trigger — preserves PR #1838 click pathway via co-applied classes */
html body .tm-kpi-v3 .tm-kpi-v3__info {
  position: static !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--tmkv3-mute) !important;
  border: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background 150ms ease, color 150ms ease !important;
  flex-shrink: 0;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__info svg,
html body .tm-kpi-v3 .tm-kpi-v3__info i {
  width: 14px !important;
  height: 14px !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__info:hover {
  background: #f1f5f9 !important;
  color: var(--tmkv3-ink-2) !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__info[aria-expanded="true"] {
  background: var(--tmkv3-primary) !important;
  color: #fff !important;
}

/* ──────────────────────────────────────────────────────────────────────
   3) VALUE + DELTA
   ────────────────────────────────────────────────────────────────────── */
html body .tm-kpi-v3 .tm-kpi-v3__body {
  position: relative;
  z-index: 3;
  margin-top: 13px;
  display: block !important;
}

html body .tm-kpi-v3 .tm-kpi-v3__value {
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 26px !important;
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.05 !important;
  color: var(--tmkv3-ink) !important;
  font-variant-numeric: tabular-nums !important;
  display: flex !important;
  align-items: baseline !important;
  gap: 4px !important;
  margin: 0 !important;
  padding-right: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__value .tm-kpi-v3__unit {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--tmkv3-ink-2) !important;
  font-variant-numeric: tabular-nums !important;
}

html body .tm-kpi-v3 .tm-kpi-v3__delta-row {
  margin-top: 9px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  position: relative;
  z-index: 3;
}

html body .tm-kpi-v3 .tm-kpi-v3__delta {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 2px 8px 2px 6px !important;
  border-radius: 999px !important;
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums !important;
  transition: background 200ms ease !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta .tm-kpi-v3__delta-icon,
html body .tm-kpi-v3 .tm-kpi-v3__delta svg {
  width: 12px !important;
  height: 12px !important;
  stroke-width: 2.4 !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta--up {
  background: #dcfce7 !important;
  color: #15803d !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta--down {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta--flat {
  background: #f1f5f9 !important;
  color: var(--tmkv3-ink-2) !important;
}

html body .tm-kpi-v3 .tm-kpi-v3__vs {
  font-family: var(--tmkv3-font-sans) !important;
  font-size: 11.5px !important;
  color: var(--tmkv3-mute) !important;
  font-weight: 500 !important;
}

/* ──────────────────────────────────────────────────────────────────────
   4) CHART AREA — pinned to bottom, edge-to-edge
   ────────────────────────────────────────────────────────────────────── */
html body .tm-kpi-v3 .tm-kpi-v3__chart {
  position: relative;
  height: 62px;
  margin: auto -16px 0 !important;
  width: calc(100% + 32px) !important;
  display: block !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__chart > canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  animation: tmkv3FadeIn 0.8s cubic-bezier(0.45, 0, 0.2, 1) 220ms forwards;
}
@keyframes tmkv3FadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ──────────────────────────────────────────────────────────────────────
   5) HERO VARIANT — blue gradient + white content
   ────────────────────────────────────────────────────────────────────── */
html body .tm-kpi-v3.tm-kpi-v3--hero,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tm-kpi-v3--hero,
html body .tm-live-page .tm-kpi.tm-kpi-v3.tm-kpi-v3--hero {
  background:
    radial-gradient(120% 140% at 85% 0%, rgba(115, 183, 254, 0.45) 0%, transparent 50%),
    linear-gradient(145deg, #0163c2 0%, #0175e4 58%, #0b5cb0 100%) !important;
  border: 0 !important;
  box-shadow: 0 8px 24px rgba(1, 99, 194, 0.28) !important;
  color: #fff !important;
}
html body .tm-kpi-v3.tm-kpi-v3--hero:hover,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tm-kpi-v3--hero:hover,
html body .tm-live-page .tm-kpi.tm-kpi-v3.tm-kpi-v3--hero:hover {
  box-shadow: 0 14px 36px rgba(1, 99, 194, 0.34) !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__icon {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__label,
.tm-kpi-v3--hero .tm-kpi-v3__value,
.tm-kpi-v3--hero .tm-kpi-v3__unit {
  color: #fff !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__info {
  color: rgba(255, 255, 255, 0.78) !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__info:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__delta {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__vs {
  color: rgba(255, 255, 255, 0.78) !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__live-badge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}
.tm-kpi-v3--hero .tm-kpi-v3__live-dot {
  background: #fff !important;
}
/* Hero radial glow inside card (uses ::after — leaves ::before free for any
   prior accent stripe a parent CSS may have set, though we also suppress) */
html body .tm-kpi-v3.tm-kpi-v3--hero::before,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tm-kpi-v3--hero::before {
  display: none !important;
  content: none !important;
}
html body .tm-kpi-v3.tm-kpi-v3--hero::after,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tm-kpi-v3--hero::after,
html body .tm-live-page .tm-kpi.tm-kpi-v3.tm-kpi-v3--hero::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 65%);
  pointer-events: none;
  z-index: 1;
}

/* ──────────────────────────────────────────────────────────────────────
   6) RESPONSIVE
   Mirrors the reference 1.45fr+4 / repeat(2) / 1 breakpoint strategy via
   the existing `.tm-kpi-grid--primary` / `.tm-kpi-row` parent grids; here
   we tune card internals.
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  html body .tm-kpi-v3,
  html body #overviewTab .tm-kpi-card.tm-kpi-v3,
  html body .tm-live-page .tm-kpi.tm-kpi-v3 {
    min-height: 158px !important;
    padding: 13px 13px 0 !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__value {
    font-size: 20px !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__icon {
    width: 22px !important;
    height: 22px !important;
    border-radius: 6px !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__icon svg,
  html body .tm-kpi-v3 .tm-kpi-v3__icon i {
    width: 13px !important;
    height: 13px !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__chart {
    height: 48px;
    margin: auto -13px 0 !important;
    width: calc(100% + 26px) !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────
   7) MOTION RESPECT
   ────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html body .tm-kpi-v3,
  html body .tm-kpi-v3:hover {
    transition: none !important;
    transform: none !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__chart > canvas {
    animation: none !important;
    opacity: 1 !important;
  }
  .tm-kpi-v3__live-dot {
    animation: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   PR-2 Visual Fix — Adım 1+2: Hero 1.45fr grid (Overview + Canlı)
   Referans: design_handoff_kpi_cards/css/kpi.css §grid
     `.kpi-grid { grid-template-columns: 1.45fr repeat(4, 1fr); gap: 14px; }`
   We have 4 main cards (1 hero + 3 normal), so: 1.45fr repeat(3, 1fr).
   `.tm-kpi-grid--primary > :first-child` selector both styles the loaded
   hero (Ciro / Sipariş live) AND the first skeleton placeholder, so the
   layout stays consistent across hydrate.
   ════════════════════════════════════════════════════════════════════════ */

/* Desktop ≥ 1101: 1.45fr + 3×1fr — hero card sits in the wide slot */
@media (min-width: 1101px) {
  html body #overviewTab .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab .kpi-cards-wrapper .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-actual-content .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-skeleton-loader .tm-kpi-grid.tm-kpi-grid--primary {
    grid-template-columns: 1.45fr repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
  html body .tm-live-page .tm-kpi-row {
    grid-template-columns: 1.45fr repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
}

/* Tablet 576–1100: 2-col grid, hero spans both columns */
@media (max-width: 1100px) and (min-width: 576px) {
  html body #overviewTab .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab .kpi-cards-wrapper .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-actual-content .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-skeleton-loader .tm-kpi-grid.tm-kpi-grid--primary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  html body .tm-live-page .tm-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  html body #overviewTab .tm-kpi-grid--primary > *:first-child,
  html body #overviewTab #kpi-skeleton-loader .tm-kpi-grid--primary > *:first-child,
  html body .tm-live-page .tm-kpi-row > *:first-child {
    grid-column: span 2 !important;
  }
}

/* Mobile ≤ 575.98: 2-col, hero spans full row */
@media (max-width: 575.98px) {
  html body #overviewTab .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab .kpi-cards-wrapper .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-actual-content .tm-kpi-grid.tm-kpi-grid--primary,
  html body #overviewTab #kpi-skeleton-loader .tm-kpi-grid.tm-kpi-grid--primary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  html body .tm-live-page .tm-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  html body #overviewTab .tm-kpi-grid--primary > *:first-child,
  html body #overviewTab #kpi-skeleton-loader .tm-kpi-grid--primary > *:first-child,
  html body .tm-live-page .tm-kpi-row > *:first-child {
    grid-column: span 2 !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   PR-2 Visual Fix · Adım 3 — KPI Header (info icon flex + delta/vs ayrı + hero white chip)
   Ref: kpi.css §head + §ic + §info + §delta + §accent (lines 126-202, 320-345)
   ════════════════════════════════════════════════════════════════════════ */

/* Icon chip — hero variant: translucent white background per ref line 328 */
html body .tm-kpi-v3--hero .tm-kpi-v3__icon {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}

/* Info icon — header'a entegre (NOT absolute), referans line 144-156 */
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-v3__info,
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-card__info,
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-card__info--pop {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  margin-left: auto !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  background: transparent !important;
  border: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  color: var(--tmkv3-mute) !important;
  transition: background 150ms ease, color 150ms ease !important;
  flex-shrink: 0;
}
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-card__info:hover,
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-card__info--pop:hover {
  background: #f1f5f9 !important;
  color: var(--tmkv3-ink-2) !important;
}
html body .tm-kpi-v3--hero .tm-kpi-v3__head .tm-kpi-card__info,
html body .tm-kpi-v3--hero .tm-kpi-v3__head .tm-kpi-card__info--pop {
  color: rgba(255, 255, 255, 0.78) !important;
}
html body .tm-kpi-v3--hero .tm-kpi-v3__head .tm-kpi-card__info:hover,
html body .tm-kpi-v3--hero .tm-kpi-v3__head .tm-kpi-card__info--pop:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__head .tm-kpi-card__info[aria-expanded="true"] {
  background: var(--tmkv3-primary) !important;
  color: #fff !important;
}

/* Delta + vs label — pill her zaman görünür, vs label muted text yanında.
   Bottom-aligned satır referans line 189 ile. */
html body .tm-kpi-v3 .tm-kpi-v3__delta-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  margin-top: 9px !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 2px 8px 2px 6px !important;
  border-radius: 999px !important;
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1.2 !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta--up,
html body .tm-kpi-v3 .tm-kpi-v3__delta.positive {
  background: #dcfce7 !important;
  color: #15803d !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta--down,
html body .tm-kpi-v3 .tm-kpi-v3__delta.negative {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__delta i,
html body .tm-kpi-v3 .tm-kpi-v3__delta svg {
  width: 12px !important;
  height: 12px !important;
  stroke-width: 2.4 !important;
}
/* Hero variant — translucent white per ref line 335-337 */
html body .tm-kpi-v3--hero .tm-kpi-v3__delta,
html body .tm-kpi-v3--hero .tm-kpi-v3__delta--up,
html body .tm-kpi-v3--hero .tm-kpi-v3__delta--down,
html body .tm-kpi-v3--hero .tm-kpi-v3__delta.positive,
html body .tm-kpi-v3--hero .tm-kpi-v3__delta.negative {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}

/* vs label — muted text yanında pill'in */
html body .tm-kpi-v3 .tm-kpi-v3__vs {
  font-family: var(--tmkv3-font-sans) !important;
  font-size: 11.5px !important;
  color: var(--tmkv3-mute) !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
}
html body .tm-kpi-v3--hero .tm-kpi-v3__vs {
  color: rgba(255, 255, 255, 0.72) !important;
}

/* Value + unit — JetBrains Mono 26px / 500, unit 14px baseline aligned */
html body .tm-kpi-v3 .tm-kpi-v3__value {
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 26px !important;
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.05 !important;
  color: var(--tmkv3-ink) !important;
  font-variant-numeric: tabular-nums !important;
  display: flex !important;
  align-items: baseline !important;
  gap: 4px !important;
  margin: 13px 0 0 !important;
}
html body .tm-kpi-v3--hero .tm-kpi-v3__value {
  color: #fff !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__value .tm-kpi-v3__unit,
html body .tm-kpi-v3 .tm-kpi-v3__unit {
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--tmkv3-ink-2) !important;
}
html body .tm-kpi-v3--hero .tm-kpi-v3__unit {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ════════════════════════════════════════════════════════════════════════
   PR-2 Visual Fix — Adım 4: Sparkline 62px + hero halo + mobile no-wrap
   Referans: design_handoff_kpi_cards/css/kpi.css §kpi-chart §kpi-dot
     - .kpi-chart { height: 62px; margin: 0 -16px 0; margin-top: auto; }
     - .kpi-dot { 8×8, white border 2px, box-shadow 0 0 0 3px halo, left:100%-5px }
     - hero variant softer halo (rgba 255 .25)
     - value/unit single-line on mobile (white-space: nowrap on the value row)
   ════════════════════════════════════════════════════════════════════════ */

/* Strict 62px sparkline across ALL viewports (was 48px on mobile, dropped to
   62 to match the reference). Hero is edge-to-edge (-16 margin) on desktop,
   -13 on mobile to match the mobile padding-13. */
html body .tm-kpi-v3 .tm-kpi-v3__chart {
  height: 62px !important;
  min-height: 62px !important;
  margin: auto -16px 0 !important;
  width: calc(100% + 32px) !important;
  display: block !important;
  position: relative !important;
}
@media (max-width: 575.98px) {
  html body .tm-kpi-v3 .tm-kpi-v3__chart {
    height: 62px !important;
    min-height: 62px !important;
    margin: auto -13px 0 !important;
    width: calc(100% + 26px) !important;
  }
}
html body .tm-kpi-v3 .tm-kpi-v3__chart svg {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* End-of-line dot — HTML overlay positioned by tm-handoff-kpi-spark.js.
   `left: calc(100% - 5px)` keeps the dot inside the 62px chart strip's right
   edge, `top` is set inline by JS from the last data-point Y%. */
html body .tm-kpi-v3 .tm-kpi-v3__spark-dot {
  position: absolute !important;
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  background: var(--tmkv3-primary, #0175e4) !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none !important;
  box-shadow: 0 0 0 3px rgba(1, 117, 228, 0.12) !important;
  z-index: 4 !important;
}
/* Hero card softer halo — white tint, slightly larger ring so it reads on
   the saturated blue gradient (ref kpi.css L231). */
html body .tm-kpi-v3.tm-kpi-v3--hero .tm-kpi-v3__spark-dot,
html body .tm-kpi-v3 .tm-kpi-v3__spark-dot.tm-kpi-v3__spark-dot--on-hero {
  border-color: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22) !important;
}

/* Hover crosshair line + dot + tooltip (HTML overlays, opacity-driven) */
html body .tm-kpi-v3 .tm-kpi-v3__spark-cross-line {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 0 !important;
  border-left: 1px dashed var(--tmkv3-mute, #94a3b8) !important;
  transform: translateX(-50%) !important;
  opacity: 0 !important;
  transition: opacity 120ms ease !important;
  pointer-events: none !important;
  z-index: 4 !important;
}
html body .tm-kpi-v3.tm-kpi-v3--hero .tm-kpi-v3__spark-cross-line {
  border-left-color: rgba(255, 255, 255, 0.6) !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__spark-cross-dot {
  position: absolute !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  transform: translate(-50%, -50%) !important;
  opacity: 0 !important;
  transition: opacity 120ms ease !important;
  pointer-events: none !important;
  z-index: 5 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25) !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__chart.is-hovering .tm-kpi-v3__spark-cross-line,
html body .tm-kpi-v3 .tm-kpi-v3__chart.is-hovering .tm-kpi-v3__spark-cross-dot,
html body .tm-kpi-v3 .tm-kpi-v3__chart.is-hovering .tm-kpi-v3__spark-tip {
  opacity: 1 !important;
}
html body .tm-kpi-v3 .tm-kpi-v3__spark-tip {
  position: absolute !important;
  top: -2px !important;
  transform: translate(-50%, -100%) !important;
  background: #0f172a !important;
  color: #fff !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-family: var(--tmkv3-font-mono) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transition: opacity 120ms ease !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18) !important;
  z-index: 6 !important;
}

/* Mobile value + unit single-line — "248.977,00 TL" used to wrap the "L" of
   TL onto a second row at 390w. Non-hero cards are ~163px wide which is the
   tightest scenario; we shrink value 18px + unit 11px so even 6-digit
   currency renders intact. Hero is wider (full row) so it can keep 22 / 13. */
@media (max-width: 575.98px) {
  html body .tm-kpi-v3 .tm-kpi-v3__value {
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    font-size: 18px !important;
    gap: 3px !important;
    letter-spacing: -0.025em !important;
  }
  html body .tm-kpi-v3 .tm-kpi-v3__unit,
  html body .tm-kpi-v3 .tm-kpi-v3__value .tm-kpi-v3__unit {
    white-space: nowrap !important;
    font-size: 11px !important;
  }
  /* Hero spans full row at 390w, so it can use a larger value font without
     wrapping. */
  html body .tm-kpi-v3.tm-kpi-v3--hero .tm-kpi-v3__value {
    font-size: 22px !important;
  }
  html body .tm-kpi-v3.tm-kpi-v3--hero .tm-kpi-v3__value .tm-kpi-v3__unit,
  html body .tm-kpi-v3.tm-kpi-v3--hero .tm-kpi-v3__unit {
    font-size: 13px !important;
  }
}

/* Hero halo on the card body itself — soften the ::after radial gradient
   (current opacity 0.16 → 0.12) so it reads as a glow rather than a smudge
   behind the sparkline. Ref kpi.css §card.accent gives a lighter wash. */
html body .tm-kpi-v3.tm-kpi-v3--hero::after,
html body #overviewTab .tm-kpi-card.tm-kpi-v3.tm-kpi-v3--hero::after,
html body .tm-live-page .tm-kpi.tm-kpi-v3.tm-kpi-v3--hero::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%) !important;
}

/* ════════════════════════════════════════════════════════════════════════
   PR-2 Visual Fix · Adım 5 — Canlı sparkline bottom-anchored override
   Ref: live-dashboard.css line 1699-1705 sets
        `#tmLivePerformancePage .tm-kpi .tm-live-spark`
        to `position:absolute; right:14px; top:14px; 96×36` which collides
        with the v3 chassis (chart slot at the bottom of the card). The
        canvas now lives inside `.tm-kpi-v3__chart` so we need to reset
        absolute + size back to flow-layout and let the chart slot drive.
   Specificity: 0,1,3 (1 ID + .tm-kpi-v3 chain + .tm-live-spark) > legacy
   0,1,2 — guarantees override without touching live-dashboard.css.
   ════════════════════════════════════════════════════════════════════════ */
html body #tmLivePerformancePage .tm-kpi-v3 .tm-kpi-v3__chart .tm-live-spark,
html body #tmLivePerformancePage .tm-kpi-v3 .tm-live-spark {
  position: static !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}
/* Hero spark keeps the brightness-invert filter for the dark gradient bg */
html body #tmLivePerformancePage .tm-kpi-v3--hero .tm-live-spark {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

/* CANLI badge — ensure it sits in the header tools area, not absolute.
   live-dashboard.css doesn't position the new badge but the live page also
   loads tmv2 components that might absolute-position generic .badge — pin
   our badge selector down so it stays in the flex tools slot. */
html body #tmLivePerformancePage .tm-kpi-v3 .tm-kpi-v3__live-badge {
  position: static !important;
  display: inline-flex !important;
}

/* ════════════════════════════════════════════════════════════════════════
   PR-2 Visual Fix · Adım 7 — Global grid caption + chart range toggle
   Ref: KPI Kartları.html footer "Son 30 gün · 15 Nis – 16 May ·
        önceki dönemle karşılaştırma" (single global caption, not per-card)
        Grafikler.html top-right "14G | 30G | 90G" pill toggle group.
   ════════════════════════════════════════════════════════════════════════ */
.tm-kpi-grid__caption {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  font-family: var(--tmkv3-font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tmkv3-mute, #94a3b8);
  line-height: 1.4;
}
.tm-kpi-grid__caption i[data-lucide] {
  color: var(--tmkv3-mute, #94a3b8);
  flex-shrink: 0;
}
@media (max-width: 575.98px) {
  .tm-kpi-grid__caption {
    font-size: 11.5px;
    margin-top: 8px;
  }
}

/* Range toggle pill group (14G / 30G / 90G) — Grafikler.html line 71 */
.tm-chart-toggle {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 3px;
  gap: 0;
}
.tm-chart-toggle__btn {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 11px;
  border-radius: 999px;
  font-family: var(--tmkv3-font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  transition: background 0.18s, color 0.18s;
  letter-spacing: 0.02em;
}
.tm-chart-toggle__btn:hover {
  color: #0f172a;
}
.tm-chart-toggle__btn.is-active,
.tm-chart-toggle__btn[aria-pressed="true"] {
  background: #ffffff;
  color: #0163c2;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Hide the legacy <details> "Daha fazla KPI" wrapper because the 5th card
   (İade Oranı) is now part of the primary grid. */
.tm-overview-extra-kpi {
  display: none !important;
}

/* Trend chart panel host */
#tmOverviewTrendChart {
  min-height: 320px;
  position: relative;
  margin: 0;
}
@media (max-width: 575.98px) {
  #tmOverviewTrendChart {
    min-height: 240px;
  }
}
