/* DV360 · Component primitives v1.1 */

/* ─────────── Material Symbols base ─────────── */
.msym {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  vertical-align: middle;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  user-select: none;
}

/* ─────────── Buttons ─────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-text);
  font: 500 14px/20px var(--ff-sans);
  letter-spacing: .1px;
  cursor: pointer;
  transition: background .14s ease, box-shadow .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
}
.btn .msym { font-size: 18px; }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dark); box-shadow: var(--shadow-1); }
.btn--primary[data-state="hover"] { background: var(--c-primary-dark); box-shadow: var(--shadow-1); }
.btn--primary:disabled { background: var(--c-border); color: #fff; cursor: not-allowed; box-shadow: none; }

.btn--outlined { border-color: var(--c-border); color: var(--c-primary); background: #fff; }
.btn--outlined:hover { background: var(--c-primary-50); border-color: var(--c-primary-100); }

.btn--text { color: var(--c-primary); padding: 0 8px; }
.btn--text:hover { background: var(--c-primary-50); }

.btn--icon {
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  color: var(--c-text-2);
  border-radius: 50%;
}
.btn--icon:hover { background: var(--c-surface); color: var(--c-text); }
.btn--icon[disabled] { color: var(--c-border-strong); cursor: not-allowed; }

/* "Danger" button: red kept only for destructive actions (disconnect cabinet, delete user) */
.btn--danger { background: var(--c-error); color: #fff; }
.btn--danger:hover { background: #B5271C; }

/* ─────────── Fields ─────────── */
.field { display: inline-flex; flex-direction: column; gap: 6px; min-width: 220px; }
.field__label {
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .6px;
  color: var(--c-text-2);
  text-transform: uppercase;
}
.field__wrap {
  display: flex; align-items: center; gap: 6px;
  height: var(--control-h);
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 0 12px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.field__wrap:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-50); }
.field input { flex: 1; border: 0; outline: 0; background: transparent; font: 400 14px/20px var(--ff-sans); color: var(--c-text); min-width: 0; }
.field input::placeholder { color: var(--c-text-3); }
.field__icon { color: var(--c-text-3); font-size: 18px; }
.field--has-icon .field__wrap { padding-left: 10px; }
.field__msg { font: 400 12px/16px var(--ff-sans); color: var(--c-warning-700); }
.field--error .field__wrap { border-color: var(--c-warning); background: #FFFCF1; }
.field--error .field__wrap:focus-within { box-shadow: 0 0 0 3px var(--c-warning-50); }
.field--inline { min-width: 240px; }
.field--inline .field__label { display: none; }

/* ─────────── Date range ─────────── */
.daterange {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--control-h);
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font: 500 14px/20px var(--ff-sans);
  color: var(--c-text);
}
.daterange:hover { border-color: var(--c-primary); }
.daterange .msym { color: var(--c-text-2); }
.daterange__compare {
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--c-surface);
  border-radius: var(--r-sm);
  font: 400 12px/16px var(--ff-sans);
  color: var(--c-text-2);
}
.daterange__chev { color: var(--c-text-2); margin-left: 4px; }

/* ─────────── Segmented ─────────── */
.seg {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  overflow: hidden;
  height: var(--control-h);
}
.seg button {
  appearance: none; background: transparent; border: 0;
  padding: 0 14px;
  font: 500 13px/1 var(--ff-sans); color: var(--c-text-2);
  cursor: pointer;
  border-right: 1px solid var(--c-border);
  transition: background .14s ease, color .14s ease;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--c-surface); color: var(--c-text); }
.seg button.is-active { background: var(--c-primary-50); color: var(--c-primary-dark); }
.seg--sm { height: var(--control-h-sm); }
.seg--sm button { padding: 0 10px; font-size: 12px; }

/* ─────────── Dropdown ─────────── */
.dropdown {
  display: inline-flex; align-items: center; gap: 10px;
  height: var(--control-h);
  padding: 0 12px 0 14px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  min-width: 180px;
}
.dropdown:hover { border-color: var(--c-primary); }
.dropdown__label {
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--c-text-2);
}
.dropdown__value { font: 500 14px/20px var(--ff-sans); color: var(--c-text); margin-left: auto; }
.dropdown .msym { color: var(--c-text-2); }
.dropdown--empty .dropdown__value { color: var(--c-text-3); }
.dropdown--sm { height: var(--control-h-sm); min-width: 0; padding: 0 8px 0 12px; }
.dropdown--sm .dropdown__value { font-size: 12px; }

/* ─────────── Chips ─────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 1px solid var(--c-border);
  font: 500 13px/1 var(--ff-sans);
  color: var(--c-text-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--c-primary); color: var(--c-text); }
.chip.is-active { background: var(--c-primary-50); border-color: var(--c-primary-100); color: var(--c-primary-dark); }
.chip--removable .msym { font-size: 16px; color: var(--c-primary-dark); }

/* ─────────── Toggle ─────────── */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: 500 13px/1 var(--ff-sans); color: var(--c-text); position: relative; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  position: relative;
  width: 34px; height: 14px;
  background: var(--c-border);
  border-radius: var(--r-pill);
  transition: background .14s ease;
}
.toggle__thumb {
  position: absolute;
  top: -3px; left: -2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-2);
  transition: transform .18s ease, background .18s ease;
}
.toggle input:checked ~ .toggle__track { background: var(--c-primary-100); }
.toggle input:checked ~ .toggle__track .toggle__thumb { transform: translateX(18px); background: var(--c-primary); }

/* ─────────── Language switch ─────────── */
.lang-switch {
  display: inline-flex;
  background: var(--c-surface);
  border-radius: var(--r-pill);
  padding: 3px;
}
.lang-switch button {
  appearance: none; background: transparent; border: 0;
  height: 26px; padding: 0 12px;
  border-radius: var(--r-pill);
  font: 500 12px/1 var(--ff-sans); letter-spacing: .4px;
  color: var(--c-text-2);
  cursor: pointer;
}
.lang-switch button.is-active { background: #fff; color: var(--c-primary-dark); box-shadow: var(--shadow-1); }

/* ─────────── Account switch ─────────── */
.account-switch {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 4px 10px 4px 4px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.account-switch:hover { border-color: var(--c-primary); }
.account-switch__ava {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #1A73E8, #9334E6);
  color: #fff;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font: 700 13px/1 var(--ff-sans);
  letter-spacing: .5px;
}
.account-switch__name { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.account-switch__name b { font: 500 14px/16px var(--ff-sans); color: var(--c-text); }
.account-switch__name em { font: 400 12px/14px var(--ff-sans); color: var(--c-text-2); font-style: normal; }
.account-switch .msym { color: var(--c-text-2); margin-left: 4px; }

/* ─────────── Role pills ─────────── */
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  font: 500 12px/1 var(--ff-sans);
}
.role-pill .msym { font-size: 16px; }
.role-pill--super  { background: var(--c-primary-50); color: var(--c-primary-dark); }
.role-pill--mgr    { background: #F3E8FD; color: #6627B5; }
.role-pill--client { background: var(--c-success-50); color: var(--c-success); }

/* ─────────── Status dot (line items, IO statuses) ─────────── */
.status-dot {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 12px/16px var(--ff-sans);
  color: var(--c-text-2);
}
.status-dot::before {
  content: ""; width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c-success);
}
.status-dot--warn::before { background: var(--c-warning); }
.status-dot--paused::before { background: var(--c-neg); }
.status-dot--alert {
  position: relative;
  padding-left: 22px;
}
.status-dot--alert::before { background: var(--c-warning); }
.status-dot--alert::after {
  content: "!";
  position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px;
  font: 700 9px/10px var(--ff-sans);
  color: #fff;
  text-align: center;
}

/* ─────────── Breadcrumb / scope path ─────────── */
.scope-path {
  display: inline-flex; align-items: center; gap: 0;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  padding: 4px 6px;
  height: 44px;
}
.scope-path__item {
  display: inline-flex; flex-direction: column;
  padding: 2px 14px;
  gap: 1px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--r-pill);
}
.scope-path__item:hover { background: var(--c-surface); }
.scope-path__label {
  font: 500 10px/12px var(--ff-sans);
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--c-text-2);
}
.scope-path__value { font: 500 13px/18px var(--ff-sans); color: var(--c-text); }
.scope-path__sep {
  width: 18px;
  display: grid; place-items: center;
  color: var(--c-text-3);
}
.scope-path__sep .msym { font-size: 18px; }

/* ─────────── Tabs (underline, DV360-style) ─────────── */
.tabs {
  display: inline-flex; gap: 0;
  border-bottom: 1px solid var(--c-border);
  width: 100%;
}
.tabs__tab {
  appearance: none; background: transparent; border: 0;
  position: relative;
  padding: 14px 22px;
  font: 500 14px/20px var(--ff-sans);
  color: var(--c-text-2);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.tabs__tab:hover { color: var(--c-text); }
.tabs__tab.is-active { color: var(--c-primary); }
.tabs__tab.is-active::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 3px;
  background: var(--c-primary);
  border-radius: 2px 2px 0 0;
}
.tabs__tab .pin { font-size: 16px; color: var(--c-primary); transform: rotate(45deg); }

/* ─────────── Sidebar nav (rail) ─────────── */
.rail {
  background: #fff;
  border-right: 1px solid var(--c-border);
  width: 256px;
  padding: 12px 8px;
}
.rail__group { margin-bottom: 4px; }
.rail__group-label {
  padding: 12px 16px 6px;
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--c-text-3);
}
.rail__item {
  display: flex; align-items: center; gap: 14px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font: 500 13px/1 var(--ff-sans);
  color: var(--c-text);
  cursor: pointer;
  text-decoration: none;
}
.rail__item .msym { font-size: 20px; color: var(--c-text-2); }
.rail__item:hover { background: var(--c-surface); }
.rail__item.is-active { background: var(--c-primary); color: #fff; }
.rail__item.is-active .msym { color: #fff; }
.rail__item.is-child { padding-left: 50px; height: 36px; font-weight: 400; color: var(--c-text-2); }
.rail__item.is-child:hover { background: var(--c-surface); color: var(--c-text); }
.rail__item.is-child.is-active { background: var(--c-primary-50); color: var(--c-primary-dark); }
.rail__caret { margin-left: auto; color: var(--c-text-2); font-size: 18px; }

/* ─────────── Tooltip ─────────── */
.tooltip-demo { position: relative; padding: 60px 0 0 0; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% - 56px);
  left: -10px;
  width: 280px;
  background: #202124;
  color: #fff;
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-3);
}
.tooltip__title { font: 500 13px/18px var(--ff-sans); margin-bottom: 4px; }
.tooltip__body { font: 400 12px/17px var(--ff-sans); color: rgba(255,255,255,.86); }
.tooltip__hint { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.16); font: 400 11px/14px var(--ff-sans); color: rgba(255,255,255,.7); }
.tooltip__tail {
  position: absolute;
  bottom: -6px; left: 22px;
  width: 12px; height: 12px;
  background: #202124;
  transform: rotate(45deg);
}

/* ─────────── KPI card ─────────── */
.kpi {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column;
  position: relative;
  min-height: 200px;
}
.kpi:hover { box-shadow: var(--shadow-2); }
.kpi__head { display: flex; align-items: center; justify-content: space-between; }
.kpi__label {
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--c-text-2);
}
.kpi__help.btn--icon { width: 28px; height: 28px; }
.kpi__help .msym { font-size: 18px; }
.kpi__value {
  margin-top: 14px;
  font: 700 34px/40px var(--ff-sans);
  letter-spacing: -.5px;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.kpi__cents { font-size: 22px; color: var(--c-text-2); font-weight: 500; }
.kpi__cur { color: var(--c-text-2); font-weight: 500; margin-right: 2px; }
.kpi__value--money { display: inline-flex; align-items: baseline; gap: 0; }
.kpi__delta {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 13px/18px var(--ff-sans);
  color: var(--c-text-2);
}
.kpi__delta .msym { font-size: 18px; }
.kpi__delta em { font-style: normal; color: var(--c-text-3); font-weight: 400; font-size: 12px; margin-left: 4px; }
.kpi__delta--up { color: var(--c-success); }
.kpi__delta--down { color: var(--c-neg); }
.kpi__delta--neutral { color: var(--c-text-2); }
.kpi__spark { margin-top: auto; padding-top: 14px; }
.kpi__spark svg { width: 100%; height: 56px; display: block; overflow: visible; }
.kpi--accent { border-top: 3px solid var(--c-primary); padding-top: 17px; }

/* ─────────── Computed metric row ─────────── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.metric {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-1);
}
.metric:hover { box-shadow: var(--shadow-2); }
.metric__label {
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--c-text-2);
}
.metric__value {
  font: 700 26px/32px var(--ff-sans);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.metric__unit { font-size: 16px; color: var(--c-text-2); font-weight: 500; }
.metric__delta { font: 500 12px/16px var(--ff-sans); color: var(--c-text-2); }
.metric__delta--up { color: var(--c-success); }
.metric__delta--down { color: var(--c-neg); }
.metric__formula {
  margin-top: 6px;
  font: 400 11px/14px var(--ff-mono);
  color: var(--c-text-3);
}
.metric--empty .metric__value { color: var(--c-text-2); }

/* ─────────── Chart card ─────────── */
.chartcard {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column;
  position: relative;
}
.chartcard__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
}
.chartcard h4 { margin: 0; font: 500 16px/22px var(--ff-sans); color: var(--c-text); }
.chartcard__sub { font: 400 12px/16px var(--ff-sans); color: var(--c-text-2); }
.chartcard__tools { display: inline-flex; align-items: center; gap: 8px; }
.chartcard__legend {
  margin-top: 14px;
  display: inline-flex; gap: 18px;
  font: 400 12px/16px var(--ff-sans);
  color: var(--c-text-2);
}
.chartcard__legend i {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 6px; vertical-align: middle;
}
.chartcard__body { margin-top: 8px; }
.chartcard__body svg { width: 100%; height: 220px; display: block; }
.chartcard__xaxis {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font: 400 11px/14px var(--ff-mono);
  color: var(--c-text-3);
}

/* ─────────── Bar chart card (DV360 "Total cost" style) ─────────── */
.barcard__body { margin-top: 14px; display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.barcard__bar { flex: 1; background: var(--c-primary); border-radius: 2px 2px 0 0; min-height: 4px; transition: background .14s ease; }
.barcard__bar.is-future { background: var(--c-primary-100); }
.barcard__bar:hover { background: var(--c-primary-dark); }
.barcard__bar.is-future:hover { background: #B4D0FB; }
.barcard__xaxis {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font: 400 9px/12px var(--ff-mono);
  color: var(--c-text-3);
  letter-spacing: -.4px;
}
.barcard__progress {
  margin-top: 6px;
  height: 4px;
  background: var(--c-surface);
  border-radius: 2px;
  overflow: hidden;
}
.barcard__progress i { display: block; height: 100%; background: var(--c-primary); border-radius: 2px; }

/* ─────────── Donut · interactive ─────────── */
.chartcard--donut { padding-bottom: 8px; }
.donut {
  position: relative;
  width: 200px; height: 200px;
  margin: 16px auto 4px;
}
.donut svg { width: 100%; height: 100%; overflow: visible; }
.donut__seg {
  fill: none;
  stroke-width: 22;
  cursor: pointer;
  transition: stroke-width .18s ease, opacity .18s ease;
  transform-origin: 80px 80px;
}
.donut__seg:hover { stroke-width: 28; }
.donut[data-hover] .donut__seg:not(:hover) { opacity: .35; }
.donut__center {
  position: absolute; inset: 0;
  display: grid; place-items: center; align-content: center;
  text-align: center;
  pointer-events: none;
}
.donut__total { font: 700 24px/28px var(--ff-sans); color: var(--c-text); font-variant-numeric: tabular-nums; }
.donut__totalLabel {
  font: 500 11px/14px var(--ff-sans); color: var(--c-text-2);
  letter-spacing: .8px; text-transform: uppercase;
}
.donut-legend {
  margin-top: 12px;
  display: flex; flex-direction: column; gap: 0;
}
.donut-legend__row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--r-sm);
  align-items: center;
  cursor: pointer;
  transition: background .14s ease;
}
.donut-legend__row:hover { background: var(--c-surface-2); }
.donut-legend__row.is-hover { background: var(--c-primary-50); }
.donut-legend__row.is-dim { opacity: .4; }
.donut-legend__row i { width: 10px; height: 10px; border-radius: 2px; }
.donut-legend__row b {
  font: 500 13px/18px var(--ff-sans);
  color: var(--c-text);
}
.donut-legend__row .num {
  font: 500 13px/18px var(--ff-sans);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.donut-legend__row .pct {
  font: 500 12px/16px var(--ff-sans);
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
  min-width: 48px; text-align: right;
}
.donut-legend__row.is-hover .pct,
.donut-legend__row.is-hover b { color: var(--c-primary-dark); }
.donut__toast {
  position: absolute; top: 6px; right: 6px;
  display: none;
  align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  background: #202124; color: #fff;
  border-radius: var(--r-pill);
  font: 500 11px/14px var(--ff-sans);
  letter-spacing: .3px;
  box-shadow: var(--shadow-2);
}
.donut__toast.is-shown { display: inline-flex; animation: fade-up .2s ease both; }
.donut__toast .msym { font-size: 14px; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }

/* ─────────── Table ─────────── */
.table-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.table-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  gap: 16px;
}
.table-card__head h4 { margin: 0; font: 500 16px/22px var(--ff-sans); }
.table-card__sub { font: 400 12px/16px var(--ff-sans); color: var(--c-text-2); }
.table-card__tools { display: inline-flex; align-items: center; gap: 8px; }
.table-wrap { overflow-x: auto; }
.dtable {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.dtable thead th {
  position: sticky; top: 0;
  background: var(--c-surface-2);
  padding: 10px 16px;
  font: 500 12px/16px var(--ff-sans);
  letter-spacing: .3px;
  color: var(--c-text-2);
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  cursor: pointer;
}
.dtable thead th:hover { color: var(--c-text); background: var(--c-surface); }
.dtable thead th .msym { font-size: 16px; vertical-align: middle; margin-left: 4px; color: var(--c-text-2); }
.dtable thead th.is-sorted { color: var(--c-primary-dark); }
.dtable thead th.is-sorted .msym { color: var(--c-primary-dark); }
.dtable .th-num { text-align: right; }

.dtable tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  font: 400 13px/18px var(--ff-sans);
  color: var(--c-text);
}
.dtable tbody tr:hover { background: var(--c-surface-2); }
.dtable .td-num { text-align: right; white-space: nowrap; font-weight: 500; }
.cell-id { display: inline-flex; align-items: center; gap: 10px; }
.cell-id__dot { width: 8px; height: 8px; border-radius: 50%; }
.cell-id em { color: var(--c-text-2); font-style: normal; font-size: 12px; padding: 1px 6px; background: var(--c-surface); border-radius: var(--r-sm); margin-left: 4px; }

/* Viewable Rate indicators — no red, dark neutral instead */
.vrate {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font: 500 12px/16px var(--ff-sans);
}
.vrate--good { background: var(--c-success-50); color: var(--c-success); }
.vrate--mid  { background: var(--c-warning-50); color: var(--c-warning-700); }
.vrate--bad  { background: var(--c-neg-50); color: var(--c-neg-strong); }

/* Mini bar (cell-level data viz) */
.cell-bar {
  display: inline-flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums;
}
.cell-bar__track {
  width: 60px; height: 6px;
  background: var(--c-surface);
  border-radius: 3px;
  overflow: hidden;
}
.cell-bar__fill { display: block; height: 100%; background: var(--c-primary); border-radius: 3px; }
.cell-bar__fill--warn { background: var(--c-warning); }
.cell-bar__fill--neg  { background: var(--c-neg); }

.tr-total td {
  background: var(--c-surface-2);
  font-weight: 700;
  color: var(--c-text);
  border-bottom: 0;
}

.table-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--c-border);
  background: #fff;
  font: 400 12px/16px var(--ff-sans);
  color: var(--c-text-2);
}
.pager { display: inline-flex; align-items: center; gap: 8px; }
.pager .btn--icon { width: 28px; height: 28px; }

/* ─────────── Creative tile (gallery) ─────────── */
.creative-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.creative-tile {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  cursor: pointer;
}
.creative-tile:hover { box-shadow: var(--shadow-2); border-color: var(--c-primary-100); transform: translateY(-2px); }
.creative-tile__preview {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--c-surface-2);
  display: grid; place-items: center;
  overflow: hidden;
}
.creative-tile__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creative-tile__preview .msym { font-size: 40px; color: var(--c-text-3); }
.creative-tile__badge {
  position: absolute; top: 10px; left: 10px;
  background: #202124; color: #fff;
  font: 500 10px/14px var(--ff-sans); letter-spacing: .4px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
}
.creative-tile__badge--top { background: var(--c-success); }
.creative-tile__badge--video { background: var(--c-primary); }
.creative-tile__format {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(32,33,36,.78); color: #fff;
  font: 500 10px/14px var(--ff-mono); letter-spacing: .2px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
}
.creative-tile__body { padding: 12px 14px 14px; }
.creative-tile__name {
  font: 500 13px/18px var(--ff-sans);
  color: var(--c-primary);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.creative-tile__meta {
  font: 400 11px/14px var(--ff-sans);
  color: var(--c-text-2);
  margin-top: 2px;
}
.creative-tile__metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.creative-tile__metric {
  display: flex; flex-direction: column; gap: 1px;
}
.creative-tile__metric span {
  font: 500 9px/12px var(--ff-sans);
  letter-spacing: .5px; text-transform: uppercase;
  color: var(--c-text-3);
}
.creative-tile__metric b {
  font: 700 14px/18px var(--ff-sans);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}
.creative-tile__score {
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
}
.creative-tile__score-track {
  flex: 1; height: 4px;
  background: var(--c-surface);
  border-radius: 2px;
  overflow: hidden;
}
.creative-tile__score-fill { display: block; height: 100%; border-radius: 2px; background: var(--c-primary); }
.creative-tile__score-fill--mid { background: var(--c-warning); }
.creative-tile__score-fill--low { background: var(--c-neg); }
.creative-tile__score b {
  font: 700 12px/16px var(--ff-sans);
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
  letter-spacing: -.2px;
  min-width: 28px; text-align: right;
}
.creative-tile__score span {
  font: 500 10px/12px var(--ff-sans);
  letter-spacing: .4px;
  color: var(--c-text-3);
  text-transform: uppercase;
}

/* ─────────── Skeletons / states ─────────── */
.sk {
  background: linear-gradient(90deg, #eceef0 0%, #f4f6f7 50%, #eceef0 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk--full { width: 100%; }
.sk--w20 { width: 20%; }
.sk--w40 { width: 40%; }
.sk--w50 { width: 50%; }
.sk--w60 { width: 60%; }
.sk--w80 { width: 80%; }
.sk--h12 { height: 12px; }
.sk--h16 { height: 16px; }
.sk--h28 { height: 28px; }
.sk--h56 { height: 56px; }
.sk--h180 { height: 180px; }

.kpi--skeleton, .chartcard--skeleton { position: relative; }
.kpi--state, .chartcard--state {
  text-align: center;
  align-items: center;
  gap: 8px;
}
.kpi--state .kpi__label { width: 100%; text-align: left; }
.kpi--state .state-illo { margin: 4px auto 0; }
.state-illo svg { width: 64px; height: 64px; }
.state-illo--xl svg { width: 140px; height: 92px; }
.state-title { font: 500 15px/22px var(--ff-sans); color: var(--c-text); margin-top: 4px; }
.state-text  { font: 400 13px/18px var(--ff-sans); color: var(--c-text-2); max-width: 280px; margin: 0 auto; }
.state-actions { display: inline-flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.kpi--state .state-actions, .chartcard--state .state-actions { margin-top: 14px; }

/* Error state — uses warning amber as visual frame; red kept only for the small "API" badge */
.kpi--state-error { border-color: var(--c-warning); background: #FFFCF1; }
.kpi--state-partial { background: #FFFCF1; border-color: #F8DE7E; text-align: left; align-items: stretch; }
.kpi__value--muted { color: var(--c-text); position: relative; display: inline-flex; align-items: baseline; gap: 8px; }
.partial-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-warning); display: inline-block; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

.state-tag {
  position: absolute; top: 12px; right: 12px;
  font: 500 10px/14px var(--ff-sans);
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--c-text-3);
  background: var(--c-surface);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.kpi--state-error .state-tag { background: var(--c-warning-50); color: var(--c-warning-700); }
.kpi--state-partial .state-tag { background: var(--c-warning-50); color: var(--c-warning-700); }
