/* Workspace chrome — forest bar + cream work area. */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-bg);
}

.app-shell__bar {
  flex-shrink: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(16px, 3vw, 32px);
  background: var(--color-brand);
  color: var(--color-brand-fg);
}

.app-shell__brand {
  font-family: var(--font-logo);
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.app-shell__nav {
  display: flex;
  flex: 1;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.app-shell__nav-link {
  color: color-mix(in srgb, var(--color-brand-fg) 78%, transparent);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.app-shell__nav-link:hover,
.app-shell__nav-link--active {
  color: var(--color-brand-fg);
  background: color-mix(in srgb, var(--color-brand-fg) 12%, transparent);
}

.app-shell__logout {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-brand-fg) 40%, transparent);
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}

.app-shell__logout:hover {
  background: color-mix(in srgb, var(--color-brand-fg) 12%, transparent);
}

.app-shell__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sibagro-quick-hint {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  line-height: 0;
}

.sibagro-quick-hint__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--color-fg) 28%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--color-fg-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
}

.sibagro-quick-hint__btn:hover,
.sibagro-quick-hint__btn:focus-visible {
  color: var(--color-fg);
  border-color: color-mix(in srgb, var(--color-fg) 45%, transparent);
  outline: none;
}

.sibagro-quick-hint__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-fg) 35%, transparent);
  outline-offset: 1px;
}

.sibagro-quick-hint__tip {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  width: min(280px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-fg);
  box-shadow: var(--widget-shadow);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-line;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition:
    opacity 120ms ease,
    visibility 120ms ease,
    transform 120ms ease;
}

.sibagro-quick-hint__btn:hover .sibagro-quick-hint__tip,
.sibagro-quick-hint__btn:focus-visible .sibagro-quick-hint__tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sibagro-card-with-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.sibagro-card-with-title__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
}

.sibagro-card-with-title__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sibagro-card-with-title__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-fg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sibagro-card-with-title__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sibagro-card-with-title__body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Full-bleed body; title/? sit on top of content (map ocean). */
.sibagro-card-with-title--overlay {
  position: relative;
}

.sibagro-card-with-title--overlay .sibagro-card-with-title__header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 12px 14px;
  background: transparent;
  pointer-events: none;
}

.sibagro-card-with-title--overlay .sibagro-card-with-title__title-row,
.sibagro-card-with-title--overlay .sibagro-card-with-title__right {
  pointer-events: auto;
}

.sibagro-card-with-title--overlay .sibagro-card-with-title__title {
  color: var(--color-ink, #1a1a1a);
  text-shadow: 0 1px 0 color-mix(in srgb, #fff 55%, transparent);
}

.sibagro-card-with-title--overlay .sibagro-card-with-title__body {
  flex: 1;
  min-height: 0;
  height: 100%;
}
/* Control Tower — Sibagro brand tokens (docs/brand.md), not leftover navy mock */

.ct {
  --ct-font-body: 14px;
  --ct-font-label: 12px;
  --ct-font-data: 22px;
  --ct-font-h1: 20px;
  --ct-font-h2: 18px;
  --ct-bg: var(--color-bg);
  --ct-surface: var(--color-surface);
  --ct-fg: var(--color-fg);
  --ct-muted: var(--color-fg-muted);
  --ct-border: var(--color-border);
  --ct-accent: var(--color-paprika);
  --ct-chrome: var(--color-brand);
  --ct-chrome-fg: var(--color-brand-fg);
  --ct-page-pad: 16px;
  --ct-gap: 12px;
  --ct-control-h: 32px;
  --ct-sidebar-rail: 40px;
  --ct-sidebar-w: 202px;
  font-family: var(--font-body), ui-sans-serif, system-ui, sans-serif;
  color: var(--ct-fg);
  background: var(--ct-bg);
  font-size: var(--ct-font-body);
  font-synthesis: none;
  color-scheme: light dark;
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.ct * {
  box-sizing: border-box;
}

.ct .app {
  min-height: 100%;
  height: 100%;
  display: flex;
}

.ct .sidebar {
  /* icon-col 24 + pad 8×2 = 40 — совпадает с --ct-sidebar-rail */
  --rv-ui-chrome-nav-icon-col: 24px;
  --rv-ui-chrome-nav-rail-pad: 8px;
  --rv-ui-chrome-nav-row-height: 37px;
  --rv-ui-chrome-nav-icon-size: 18px;
  --rv-ui-chrome-nav-row-radius: 5px;
  --rv-ui-chrome-nav-row-gap: 1px;
  --rv-ui-chrome-nav-group-gap: 8px;
  --rv-ui-chrome-nav-label-gap: 10px;
  --rv-ui-chrome-nav-rail-width: min(80vw, 280px);
  --ui-chrome-fg: var(--ct-chrome-fg);
  --ui-chrome-fg-muted: color-mix(in srgb, var(--ct-chrome-fg) 86%, transparent);
  --ui-chrome-brand: var(--ct-chrome-fg);
  --ui-chrome-font-size-body: var(--ct-font-label);
  --rv-ui-chrome-nav-row-bg-hover: color-mix(in srgb, var(--ct-chrome-fg) 10%, transparent);
  --rv-ui-chrome-nav-row-bg-active: color-mix(in srgb, var(--ct-chrome-fg) 16%, transparent);
  width: max-content;
  min-width: var(--ct-sidebar-rail);
  background: linear-gradient(
    180deg,
    var(--ct-chrome),
    color-mix(in srgb, var(--ct-chrome) 78%, #000)
  );
  color: var(--ct-chrome-fg);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 6;
}

.ct:not(.ct--collapsed) .sidebar {
  box-shadow: 10px 0 28px color-mix(in srgb, #000 32%, transparent);
}

.ct .sidebar .rv-nav-rail {
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ct-chrome-fg) 28%, transparent) transparent;
}

.ct .sidebar-toggle__bars,
.ct .sidebar-toggle__bars::before,
.ct .sidebar-toggle__bars::after {
  display: block;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
}

.ct .sidebar-toggle__bars {
  position: relative;
}

.ct .sidebar-toggle__bars::before,
.ct .sidebar-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.ct .sidebar-toggle__bars::before {
  top: -4px;
}

.ct .sidebar-toggle__bars::after {
  top: 4px;
}

.ct .sidebar .rv-nav-row__suffix em {
  background: var(--color-paprika);
  padding: 0 6px;
  height: 18px;
  line-height: 18px;
  border-radius: 4px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
}

.ct .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ct .content {
  margin-left: var(--ct-sidebar-rail);
  width: calc(100% - var(--ct-sidebar-rail));
  height: 100%;
  overflow: auto;
}

.ct .topbar {
  margin: var(--ct-gap) var(--ct-page-pad) 0;
  min-height: unset;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ct-gap);
  padding: 14px;
  position: sticky;
  top: var(--ct-gap);
  z-index: 4;
}

.ct .topbar h1 {
  margin: 0;
  font-size: var(--ct-font-h1);
  font-family: inherit;
  font-weight: 700;
}

.ct .topbar p {
  margin: 2px 0 0;
  color: var(--ct-muted);
  font-size: var(--ct-font-label);
}

.ct .top-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ct .top-controls label {
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ct .top-controls select,
.ct .page--screen label select {
  height: var(--ct-control-h);
  border: 1px solid var(--ct-border);
  border-radius: 5px;
  background: var(--ct-surface);
  padding: 0 28px 0 10px;
  color: var(--ct-fg);
}

.ct .top-controls a,
.ct .top-controls .primary,
.ct .primary {
  box-sizing: border-box;
  height: var(--ct-control-h);
  min-height: var(--ct-control-h);
  border: 1px solid var(--ct-border);
  background: transparent;
  color: var(--ct-fg);
  border-radius: 5px;
  padding: 0 12px;
  font-size: var(--ct-font-label);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.ct .top-controls a.primary,
.ct .primary {
  border-color: transparent;
  background: var(--ct-accent);
  color: #fff;
}

.ct .bell {
  font-size: 19px;
  position: relative;
}

.ct .bell b {
  position: absolute;
  right: -8px;
  top: -8px;
  background: #e1382d;
  color: #fff;
  font-size: var(--ct-font-label);
  border-radius: 10px;
  padding: 2px 4px;
}

.ct .help {
  border: 1px solid var(--ct-border);
  border-radius: 50%;
  font-size: 12px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct .user {
  font-size: var(--ct-font-label);
  border-left: 1px solid var(--ct-border);
  padding-left: 14px;
  min-width: 150px;
}

.ct .user small {
  display: block;
  color: var(--ct-muted);
  margin-top: 2px;
}

.ct .page {
  padding: var(--ct-gap) var(--ct-page-pad) 20px;
}

.ct .page--home,
.ct .page--screen {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--ct-gap);
  align-items: stretch;
}

.ct .page--home > *,
.ct .page--screen > * {
  min-width: 0;
}

.ct .page--home .kpi-grid {
  grid-column: 1 / -1;
}

.ct .page--home .chain-card,
.ct .page--home .planning-rail,
.ct .page--home .trace-card,
.ct .page--home .mode-note {
  grid-column: 1 / -1;
}

.ct .page--home .change-feed {
  grid-column: 1 / 7;
}

.ct .page--home .right-stack {
  grid-column: 7 / 13;
}

.ct .page--home > .mini-table {
  grid-column: span 6;
}

.ct .page--home .bottom-cards {
  grid-column: 1 / -1;
}

.ct .span-3 {
  grid-column: span 3;
}

.ct .span-4 {
  grid-column: span 4;
}

.ct .span-6 {
  grid-column: span 6;
}

.ct .span-8 {
  grid-column: span 8;
}

.ct .span-12 {
  grid-column: 1 / -1;
}

.ct .card {
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ct-fg) 6%, transparent);
}

.ct .kpi-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--ct-gap);
}

.ct .kpi-grid > .kpi {
  grid-column: span 2;
}

.ct .kpi-grid:has(> :nth-child(3):last-child) > .kpi {
  grid-column: span 4;
}

.ct .kpi-grid:has(> :nth-child(4):last-child) > .kpi {
  grid-column: span 3;
}

.ct .kpi {
  height: 112px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.ct .kpi > span {
  font-weight: 600;
  font-size: var(--ct-font-label);
}

.ct .kpi strong {
  display: block;
  font-size: var(--ct-font-data);
  margin-top: 6px;
}

.ct .kpi small {
  font-size: var(--ct-font-label);
}

.ct .up {
  color: #109b64;
}

.ct .down {
  color: #d94235;
}

.ct .spark {
  position: absolute;
  bottom: 8px;
  left: 12px;
  width: calc(100% - 24px);
  height: 32px;
  color: var(--ct-accent);
}

.ct .main-grid {
  display: contents;
}

.ct .chain-card {
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ct .chain-card.sibagro-card-with-title {
  height: auto;
}

.ct .chain-card .sibagro-card-with-title__header {
  padding: 0 0 10px;
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 8px;
}

.ct .chain-card .sibagro-card-with-title__title {
  color: var(--ct-fg);
  font-family: inherit;
  font-size: 16px;
  white-space: normal;
}

.ct .chain-card .sibagro-card-with-title__right {
  flex: 1 1 16rem;
}

.ct .chain-card .sibagro-card-with-title__body {
  flex: 1;
  overflow-x: auto;
}

.ct .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--ct-font-label);
}

.ct .section-head b {
  font-size: 16px;
}

.ct .section-head a {
  color: var(--ct-accent);
  font-size: var(--ct-font-label);
  cursor: pointer;
  text-decoration: none;
}

.ct .mode-note {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
}

.ct .mode-note b {
  color: var(--ct-fg);
}

.ct .layer-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ct .layer-switch button {
  border: 1px solid var(--ct-border);
  background: var(--ct-surface);
  color: var(--ct-fg);
  border-radius: 5px;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
}

.ct .layer-switch button small {
  display: block;
  color: var(--ct-muted);
}

.ct .layer-switch button.selected {
  border-color: var(--ct-accent);
}

.ct .rail {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ct .rail-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.ct .rail-node {
  width: 168px;
  min-height: 118px;
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--ct-surface);
}

.ct .rail-node:hover {
  border-color: var(--ct-accent);
}

.ct .rail-code,
.ct .rail-node em {
  font-size: 11px;
  color: var(--ct-muted);
  font-style: normal;
}

.ct .rail-node b {
  font-size: var(--ct-font-label);
}

.ct .rail-node small {
  color: var(--ct-muted);
  line-height: 1.3;
}

.ct .rail-arrow {
  color: var(--ct-accent);
}

.ct .trace-lead {
  margin: 0 0 10px;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
}

.ct .trace-flow {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
}

.ct .trace-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.ct .trace-node {
  flex: 1;
  min-width: 110px;
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ct .trace-node.ok {
  border-color: color-mix(in srgb, #138858 45%, var(--ct-border));
}

.ct .trace-node.warn {
  border-color: color-mix(in srgb, #d68910 45%, var(--ct-border));
}

.ct .trace-node.bad {
  border-color: color-mix(in srgb, #d74439 45%, var(--ct-border));
}

.ct .trace-node small {
  color: var(--ct-muted);
}

.ct .waterfall {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  margin-bottom: 12px;
}

.ct .waterfall-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.ct .waterfall-col i {
  display: block;
  width: 100%;
  background: var(--ct-accent);
  border-radius: 4px 4px 0 0;
  min-height: 8px;
}

.ct .rm-chart {
  width: 100%;
  height: 140px;
  color: var(--ct-accent);
}

.ct .toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
}

.ct .toggles select,
.ct .toggles button {
  font-size: var(--ct-font-label);
  height: var(--ct-control-h);
  border: 1px solid var(--ct-border);
  border-radius: 4px;
  background: var(--ct-surface);
  color: var(--ct-fg);
  padding: 0 10px;
}

.ct .chain-grid {
  min-width: 960px;
  display: grid;
  grid-template-columns:
    minmax(88px, 1fr)
    20px
    minmax(140px, 2fr)
    20px
    minmax(140px, 2fr)
    20px
    minmax(140px, 2fr)
    20px
    minmax(140px, 2fr)
    20px
    minmax(88px, 1fr);
  gap: 10px 0;
  align-items: stretch;
}

.ct .flow-node {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ct .flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ct-accent);
  font-size: 18px;
  line-height: 1;
}

.ct .external {
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 6px;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
  min-height: 100%;
}

.ct .factory-icon {
  font-size: 28px;
  margin-top: 8px;
}

.ct .company {
  width: auto;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid;
  padding: 8px;
  border-radius: 8px;
  text-align: center;
}

.ct .company h4 {
  font-size: var(--ct-font-label);
  margin: 0;
  font-family: inherit;
}

.ct .company > small {
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
}

.ct .account-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  flex: 1;
}

.ct .sibplast {
  background: #edf5ff;
  border-color: #80aeea;
}

.ct .npk {
  background: #effaf0;
  border-color: #95ce9a;
}

.ct .sn {
  background: #effcff;
  border-color: #81c8d2;
}

.ct .td {
  background: #f5f0ff;
  border-color: #bba3e8;
}

.ct .account {
  display: grid;
  grid-template-columns: minmax(3.5rem, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  text-align: left;
  min-height: 40px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--ct-surface) 88%, #000);
  border: 1px solid var(--ct-border);
  border-radius: 5px;
}

.ct .account b {
  font-size: var(--ct-font-label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.35;
  color: var(--ct-accent);
}

.ct .account span {
  font-size: var(--ct-font-label);
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.ct .chain-services {
  grid-column: 3 / 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ct .service {
  min-height: 40px;
  border: 1px solid;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 10px;
  font-size: var(--ct-font-label);
}

.ct .service b {
  font-weight: 600;
}

.ct .service small {
  font-size: var(--ct-font-label);
}

.ct .service.orange {
  border-color: #e6a23c;
  background: #fff9ed;
  color: #b66b00;
}

.ct .service.coral {
  border-color: #f0a497;
  background: #fff2ef;
  color: #b54636;
}

.ct .legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
  justify-content: center;
  margin-top: 9px;
}

.ct .right-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.ct .right-stack .quick {
  flex: 1;
}

.ct .right-stack > .card {
  padding: 10px;
}

.ct .badge {
  font-style: normal;
  background: #e44137;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: var(--ct-font-label);
  margin-left: 4px;
}

.ct .compact {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ct-font-label);
}

.ct .compact th {
  color: #718092;
  text-align: left;
  font-weight: 500;
  padding: 4px;
}

.ct .compact td {
  border-top: 1px solid #edf1f5;
  padding: 6px 4px;
  vertical-align: top;
}

.ct .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}

.ct .dot.red {
  background: #ee453b;
}

.ct .dot.orange {
  background: #f1a420;
}

.ct .risks {
  min-height: 122px;
}

.ct .risk-row {
  display: grid;
  grid-template-columns: 14px 1fr 35px 85px;
  align-items: center;
  font-size: var(--ct-font-label);
  margin: 8px 0;
}

.ct .risk-row small {
  color: #536273;
  text-align: right;
}

.ct .row-three {
  display: contents;
}

.ct .mini-table,
.ct .quick {
  padding: 10px;
  min-height: 180px;
  overflow: hidden;
}

.ct .mini-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ct-font-label);
}

.ct .mini-table td {
  padding: 6px 4px;
  border-top: 1px solid #edf1f5;
  white-space: nowrap;
}

.ct .pill {
  padding: 2px 5px;
  border-radius: 8px;
}

.ct .red-pill {
  background: #fee8e6;
  color: #d74439;
}

.ct .green-pill {
  background: #e6f7ee;
  color: #138858;
}

.ct .blue-pill {
  background: #e7f0ff;
  color: #2871bf;
}

.ct .quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ct .quick a,
.ct .quick .quick-disabled {
  min-height: 48px;
  border: 1px solid var(--ct-border);
  border-radius: 5px;
  background: var(--ct-surface);
  text-align: left;
  padding: 8px 12px;
  font-size: var(--ct-font-label);
  color: var(--ct-fg);
  text-decoration: none;
  display: flex;
  align-items: center;
}

.ct .quick a:hover {
  border-color: var(--ct-accent);
}

.ct .quick a span,
.ct .quick .quick-disabled span {
  font-size: 16px;
  margin-right: 8px;
  color: var(--ct-muted);
}

.ct .bottom-cards {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--ct-gap);
}

.ct .bottom-cards > .card {
  grid-column: span 4;
}

.ct .small-card {
  padding: 10px;
  min-height: 120px;
}

.ct .bar-row {
  font-size: var(--ct-font-label);
  margin: 8px 0;
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  align-items: center;
}

.ct .bar {
  height: 5px;
  background: #edf1f4;
  border-radius: 5px;
  overflow: hidden;
}

.ct .bar i {
  display: block;
  height: 100%;
  background: var(--ct-accent);
  border-radius: 5px;
}

.ct .price-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 18px 18px 18px calc(var(--ct-sidebar-rail) + 18px);
}

.ct .price-overlay__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: color-mix(in srgb, var(--ct-chrome) 42%, transparent);
  cursor: pointer;
}

.ct .price-engine {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 14px;
}

.ct .price-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ct .price-title h2 {
  font-size: 16px;
  margin: 0;
  font-family: inherit;
}

.ct .price-title p {
  font-size: var(--ct-font-label);
  color: #6c7989;
  margin: 2px 0;
}

.ct .chain-meta {
  display: flex;
  gap: 8px;
  font-size: var(--ct-font-label);
  align-items: center;
}

.ct .chain-meta > * {
  border: 1px solid var(--ct-border);
  border-radius: 4px;
  padding: 6px 10px;
  background: var(--ct-surface);
}

.ct .price-close {
  border: 1px solid #d3dde8;
  background: #fff;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: var(--ct-font-label);
}

.ct .price-body {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) minmax(0, 7fr) minmax(280px, 3fr);
  gap: 12px;
  margin-top: 8px;
  align-items: start;
}

.ct .chain-list {
  border: 1px solid #dce4ed;
  border-radius: 6px;
  padding: 8px;
}

.ct .tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--ct-font-label);
}

.ct .tabs button {
  font-size: var(--ct-font-label);
  border: 0;
  border-radius: 4px;
  background: var(--ct-accent);
  color: white;
  padding: 5px;
}

.ct .chain-list input {
  width: 100%;
  margin: 8px 0;
  border: 1px solid #d8e1e9;
  border-radius: 4px;
  padding: 7px;
  font-size: var(--ct-font-label);
}

.ct .chain-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--ct-border);
  padding: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.ct .chain-item b {
  font-size: var(--ct-font-label);
  grid-column: 1;
  color: var(--ct-accent);
}

.ct .chain-item span {
  font-size: var(--ct-font-label);
  grid-column: 1;
  margin-top: 3px;
  color: var(--ct-muted);
}

.ct .chain-item em {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: var(--ct-font-label);
  font-style: normal;
  color: var(--ct-muted);
  white-space: nowrap;
}

.ct .chain-item.selected {
  background: #eef5ff;
  border: 1px solid #b9d4f4;
  border-radius: 4px;
}

.ct .price-main {
  min-width: 0;
  overflow: visible;
}

.ct .steps {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 8px 0;
  overflow-x: auto;
}

.ct .step-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.ct .price-step {
  position: relative;
  flex: 1 1 0;
  min-width: 108px;
  min-height: 96px;
  border: 1px solid;
  border-radius: 6px;
  padding: 14px 10px 10px;
  text-align: center;
  background: var(--ct-surface);
  overflow: visible;
}

.ct .price-step i {
  position: absolute;
  left: 8px;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: white;
  background: #486b94;
  font-style: normal;
  font-size: var(--ct-font-label);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct .price-step b {
  font-size: var(--ct-font-label);
  display: block;
}

.ct .price-step strong {
  display: block;
  font-size: 15px;
  margin: 6px 0;
}

.ct .price-step span {
  font-size: var(--ct-font-label);
}

.ct .price-step small {
  font-size: var(--ct-font-label);
  display: block;
  margin-top: 6px;
}

.ct .price-step.gray {
  border-color: #cfd8e2;
}

.ct .price-step.blue {
  border-color: #83ace6;
  background: #f2f7ff;
}

.ct .price-step.green {
  border-color: #82ca99;
  background: #f2fbf5;
}

.ct .price-step.red {
  border-color: #e45b52;
  background: #fff6f5;
}

.ct .price-step.purple {
  border-color: #b59be4;
  background: #f8f4ff;
}

.ct .step-arrow {
  color: #385877;
}

.ct .detail-head {
  font-size: var(--ct-font-label);
  font-weight: 600;
  margin: 10px 0 4px;
}

.ct .markup-wrap {
  width: 100%;
  overflow-x: auto;
}

.ct .markup {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--ct-font-label);
  table-layout: auto;
}

.ct .markup th,
.ct .markup td {
  padding: 8px 10px;
  border: 1px solid var(--ct-border);
  vertical-align: middle;
  white-space: nowrap;
}

.ct .markup th {
  font-weight: 500;
  color: var(--ct-muted);
  text-align: left;
  background: color-mix(in srgb, var(--ct-surface) 88%, #000);
}

.ct .markup .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.ct .markup-total td {
  font-weight: 700;
  background: color-mix(in srgb, var(--ct-accent) 10%, var(--ct-surface));
}

.ct .markup .ok {
  color: #15965f;
  font-weight: 700;
}

.ct .markup .warn {
  color: #e28a00;
  font-weight: 700;
}

.ct .price-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ct .optimizer {
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  padding: 12px;
  min-width: 0;
}

.ct .optimizer h3 {
  font-size: var(--ct-font-label);
  margin: 0 0 8px;
  font-family: inherit;
}

.ct .price-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px;
  font-size: var(--ct-font-label);
  border: 1px solid #e1e7ed;
  border-radius: 5px;
  padding: 8px;
}

.ct .price-box b {
  font-size: var(--ct-font-label);
}

.ct .deficit {
  background: #fff0ee;
  color: #d64035;
  border: 1px solid #f3beb7;
  border-radius: 4px;
  padding: 6px;
  text-align: center;
  font-size: var(--ct-font-label);
  font-weight: 600;
  margin: 7px 0;
}

.ct .optimizer label {
  font-size: var(--ct-font-label);
  display: block;
}

.ct .optimizer select {
  width: 100%;
  height: 28px;
  margin-top: 4px;
  border: 1px solid #d3dde7;
  border-radius: 4px;
}

.ct .wide {
  width: 100%;
  margin: 7px 0;
}

.ct .optimizer h4 {
  font-size: var(--ct-font-label);
  margin: 6px 0;
}

.ct .opt-table {
  width: 100%;
  font-size: var(--ct-font-label);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.ct .opt-table th,
.ct .opt-table td {
  border-bottom: 1px solid var(--ct-border);
  padding: 8px 10px;
  overflow: visible;
  white-space: nowrap;
}

.ct .opt-table th:first-child,
.ct .opt-table td:first-child {
  width: 42%;
  white-space: normal;
}

.ct .opt-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.ct .apply {
  width: 100%;
  margin-top: 10px;
  background: var(--ct-accent);
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  font-size: var(--ct-font-label);
  font-weight: 600;
}

.ct .price-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ct .price-actions button {
  border: 1px solid var(--ct-border);
  background: var(--ct-surface);
  border-radius: 4px;
  padding: 8px 6px;
  font-size: var(--ct-font-label);
  text-align: left;
  color: var(--ct-fg);
}

.ct .page--screen > .card,
.ct .price-engine,
.ct .page--home .chain-card,
.ct .page--home .change-feed,
.ct .page--home .right-stack > .card,
.ct .page--home > .mini-table,
.ct .page--home .small-card {
  padding: 14px;
}

.ct .page--screen label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--ct-font-label);
  color: var(--ct-muted);
  margin-bottom: 12px;
}

.ct .price-engine {
  position: relative;
  width: 100%;
  overflow: auto;
}

.ct .account,
.ct .chain-meta > *,
.ct .price-step,
.ct .markup th {
  background: color-mix(in srgb, var(--ct-surface) 88%, #000);
}

.ct .sibplast {
  background: color-mix(in srgb, #80aeea 18%, var(--ct-surface));
}

.ct .npk {
  background: color-mix(in srgb, #95ce9a 16%, var(--ct-surface));
}

.ct .sn {
  background: color-mix(in srgb, #81c8d2 16%, var(--ct-surface));
}

.ct .td {
  background: color-mix(in srgb, #bba3e8 16%, var(--ct-surface));
}

.ct .service.orange {
  background: color-mix(in srgb, #e6a23c 16%, var(--ct-surface));
  color: #f0c27a;
}

.ct .service.coral {
  background: color-mix(in srgb, #f0a497 16%, var(--ct-surface));
  color: #f0b4a8;
}

.ct .red-pill {
  background: color-mix(in srgb, #d74439 22%, var(--ct-surface));
}

.ct .green-pill {
  background: color-mix(in srgb, #138858 22%, var(--ct-surface));
}

.ct .blue-pill {
  background: color-mix(in srgb, #2871bf 22%, var(--ct-surface));
}

.ct .chain-item.selected,
.ct .price-step.blue,
.ct .price-step.green,
.ct .price-step.red,
.ct .price-step.purple {
  background: color-mix(in srgb, var(--ct-accent) 12%, var(--ct-surface));
}

.ct .deficit {
  background: color-mix(in srgb, #d64035 18%, var(--ct-surface));
}

.ct .bar {
  background: color-mix(in srgb, var(--ct-fg) 12%, var(--ct-surface));
}

.ct .compact td,
.ct .mini-table td,
.ct .opt-table td {
  border-top-color: var(--ct-border);
}

@media (max-width: 1100px) {
  .ct .kpi-grid > .kpi {
    grid-column: span 4;
  }

  .ct .kpi-grid:has(> :nth-child(4):last-child) > .kpi {
    grid-column: span 6;
  }

  .ct .page--home .chain-card,
  .ct .page--home .change-feed,
  .ct .page--home .right-stack {
    grid-column: 1 / -1;
  }

  .ct .chain-grid,
  .ct .steps {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .ct .price-body {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .ct .price-body .price-side {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .ct .span-3,
  .ct .span-4,
  .ct .span-6,
  .ct .span-8,
  .ct .page--home > .mini-table,
  .ct .bottom-cards > .card,
  .ct .kpi-grid > .kpi {
    grid-column: 1 / -1;
  }

  .ct .price-body {
    grid-template-columns: 1fr;
  }
}
.hub-page {
  min-height: 100%;
  padding: clamp(24px, 4vw, 48px) var(--pad-x);
  overflow: auto;
}

.hub-page__inner {
  max-width: var(--page-max);
  margin: 0 auto;
}

.hub-page__intro {
  margin-bottom: 28px;
}

.hub-page__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  color: var(--color-fg);
  margin: 0 0 8px;
}

.hub-page__lead {
  margin: 0;
  color: var(--color-fg-muted);
  font-size: 16px;
  max-width: 42rem;
}

.hub-page__tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.hub-page__tile {
  display: block;
  height: 100%;
  padding: 20px 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 12px);
  background: var(--color-surface, var(--color-bg));
  color: inherit;
  text-decoration: none;
}

.hub-page__tile:hover {
  border-color: color-mix(in srgb, var(--color-brand) 45%, var(--color-border));
}

.hub-page__tile-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}

.hub-page__tile-blurb {
  margin: 0;
  color: var(--color-fg-muted);
  font-size: 14px;
  line-height: 1.45;
}
/* Twin of app/frontend MonthCalendar + PeriodPicker chrome — sibagro tokens. */

.month-picker {
  position: relative;
  flex-shrink: 0;
}

.month-picker__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 2px 3px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-fg) 45%, transparent);
  background: transparent;
  color: var(--color-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.month-picker__trigger:disabled {
  opacity: 0.45;
  cursor: default;
}

.month-picker__trigger:not(:disabled):hover,
.month-picker--open .month-picker__trigger {
  border-bottom-color: var(--color-fg);
}

.month-picker__chevron {
  display: inline-flex;
  color: var(--color-fg-muted);
  transition: transform 160ms ease;
}

.month-picker--open .month-picker__chevron {
  transform: rotate(180deg);
  color: var(--color-fg);
}

.month-picker__popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  box-sizing: border-box;
  width: min(320px, 92vw);
  min-width: 280px;
  padding: 14px;
  background: var(--color-surface);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px color-mix(in srgb, #000 18%, transparent);
}

.month-picker__year-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.month-picker__year {
  min-width: 4ch;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-fg);
}

.month-picker__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-fg);
  cursor: pointer;
}

.month-picker__nav:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-brand) 10%, transparent);
}

.month-picker__nav:disabled {
  color: var(--color-fg-muted);
  cursor: default;
}

.month-picker__nav:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* G-MP-03: grid 4×3 */
.month-picker__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.month-picker__month {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--color-fg);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.month-picker__month:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-brand) 8%, transparent);
}

.month-picker__month:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.month-picker__month--selected {
  color: var(--color-brand-fg);
  background: var(--color-brand);
  border-color: var(--color-brand);
  font-weight: 600;
}

.month-picker__month--selected:hover:not(:disabled) {
  background: var(--color-brand);
  color: var(--color-brand-fg);
}

.month-picker__month--disabled {
  color: var(--color-fg-muted);
  cursor: default;
}
/* Bento KPI — swap-matrix kpi-bento-strip.module.scss twin (cols4, ~18% height). */

.margin-page__kpi {
  flex: 0 0 18%;
  min-height: 150px;
  max-height: 230px;
  min-width: 0;
}

.margin-kpi.rv-kpi-strip {
  height: 100%;
  margin-bottom: 0;
  grid-template-columns: 1.6fr 1fr 1.2fr 1.2fr;
  gap: 16px;
  align-items: stretch;
}

.margin-kpi.rv-kpi-strip[data-emphasis="hero"] .rv-kpi-card:first-child,
.margin-kpi .rv-kpi-card--hero {
  grid-column: auto;
}

.margin-kpi__card.rv-kpi-card {
  min-height: 0;
  overflow: hidden;
  height: 100%;
  gap: 6px;
  padding: 16px 20px 12px;
}

.margin-kpi__card.rv-surface-card {
  border-radius: var(--rv-ui-radius-card);
}

.margin-kpi__card .rv-kpi-card__header {
  flex: 0 0 auto;
  gap: 6px;
}

.margin-kpi__card .rv-kpi-card__title {
  line-height: 1.25;
}

.margin-kpi__card .rv-kpi-card__title::first-letter {
  text-transform: uppercase;
}

.margin-kpi__card .rv-kpi-card__supporting {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.margin-kpi .rv-kpi-value__main {
  font-size: 1.875rem;
  line-height: 1.13;
  white-space: nowrap;
}

.margin-kpi .rv-kpi-card--hero .rv-kpi-value__main {
  font-size: 2.375rem;
  line-height: 1.1;
}

.margin-kpi .rv-kpi-value__postfix {
  font-size: 1rem;
  font-weight: 500;
}

.margin-kpi__card .rv-kpi-card__chart {
  flex: 1 1 0;
  min-height: 40px;
  max-height: none;
  margin-top: auto;
  overflow: hidden;
  padding: 6px 10px;
  box-sizing: border-box;
}

.margin-kpi__spark.rv-sparkline {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 40px;
  pointer-events: none;
}

@container rv-kpi-strip (max-width: 56rem) {
  .margin-kpi.rv-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container rv-kpi-strip (max-width: 32rem) {
  .margin-page__kpi {
    flex-basis: auto;
    max-height: none;
  }

  .margin-kpi.rv-kpi-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Margin page chrome — table layout lives in @rv/ui-table SchemaTable. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.margin-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 20px) 16px;
  overflow: hidden;
}

.margin-page__filters {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.margin-page__floor {
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 2px 3px;
  border: none;
  border-radius: 0;
  border-bottom: var(--rv-ui-border-width, 1px) solid
    color-mix(in srgb, var(--color-fg) 45%, transparent);
  background: transparent;
  color: var(--color-fg);
  font: inherit;
  font-size: var(--rv-ui-font-size-body, 14px);
  font-weight: var(--rv-ui-font-weight-medium, 500);
  line-height: var(--rv-ui-line-height-body, 1.35);
  cursor: text;
}

.margin-page__floor:focus-within {
  border-bottom-color: var(--color-fg);
}

.margin-page__floor-label {
  color: var(--color-fg);
  white-space: nowrap;
}

.margin-page__floor-input {
  box-sizing: border-box;
  width: 3.25rem;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.margin-page__floor-input::placeholder {
  color: var(--color-fg-muted);
  opacity: 0.85;
}

.margin-page__floor-input:focus {
  outline: none;
}

.margin-page__floor-unit {
  color: var(--color-fg-muted);
  font-size: var(--rv-ui-font-size-label, 12px);
  white-space: nowrap;
}

.margin-page__widget.rv-widget-card {
  flex: 1 1 0;
  min-height: 0;
  border-radius: var(--rv-ui-radius-card);
}

.margin-page__widget .rv-widget-card__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}

.margin-page__widget .rv-widget-card__title {
  font-size: 1rem;
  font-weight: 600;
  /* Beat global `h2 { Fraunces }` — title stays Source Sans like filters. */
  font-family: var(--font-body);
}

.margin-page__search input {
  font: inherit;
  font-size: 13px;
  min-width: 200px;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-fg);
}

.margin-page__row--low {
  background: color-mix(in srgb, #c47a1a 8%, var(--color-surface));
}

.margin-page__row--low:hover,
.margin-page__table-host tbody tr:hover {
  background: color-mix(in srgb, var(--color-brand) 5%, var(--color-surface));
}
/* Sales workspace — kit ChromeBar + NavRail on Sibagro brand tokens. */

.sales-shell {
  --sales-sidebar-rail: 40px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-fg);
}

.sales-shell__bar {
  flex-shrink: 0;
  z-index: 2;
  min-height: 48px;
  padding: 10px clamp(16px, 3vw, 32px);
  background: var(--color-brand);
  color: var(--color-brand-fg);
  --ui-chrome-fg: var(--color-brand-fg);
  --ui-chrome-fg-muted: color-mix(in srgb, var(--color-brand-fg) 78%, transparent);
  --ui-chrome-brand: var(--color-brand-fg);
  --rv-ui-chrome-bar-font-size: 14px;
}

.sales-shell__brand {
  font-family: var(--font-logo);
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.sales-shell__brand:hover,
.sales-shell__brand:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sales-shell__body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.sales-shell__sidebar {
  --rv-ui-chrome-nav-icon-col: 24px;
  --rv-ui-chrome-nav-rail-pad: 8px;
  --rv-ui-chrome-nav-row-height: 37px;
  --rv-ui-chrome-nav-icon-size: 18px;
  --rv-ui-chrome-nav-row-radius: 5px;
  --rv-ui-chrome-nav-row-gap: 1px;
  --rv-ui-chrome-nav-group-gap: 8px;
  --rv-ui-chrome-nav-label-gap: 10px;
  --rv-ui-chrome-nav-rail-width: min(80vw, 280px);
  --ui-chrome-fg: var(--color-brand-fg);
  --ui-chrome-fg-muted: color-mix(in srgb, var(--color-brand-fg) 86%, transparent);
  --ui-chrome-brand: var(--color-brand-fg);
  --ui-chrome-font-size-body: 12px;
  --rv-ui-chrome-nav-row-bg-hover: color-mix(in srgb, var(--color-brand-fg) 10%, transparent);
  --rv-ui-chrome-nav-row-bg-active: color-mix(in srgb, var(--color-brand-fg) 16%, transparent);
  width: max-content;
  min-width: var(--sales-sidebar-rail);
  background: linear-gradient(
    180deg,
    var(--color-brand),
    color-mix(in srgb, var(--color-brand) 78%, #000)
  );
  color: var(--color-brand-fg);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 6;
}

.sales-shell:not(.sales-shell--collapsed) .sales-shell__sidebar {
  box-shadow: 10px 0 28px color-mix(in srgb, #000 32%, transparent);
}

.sales-shell__sidebar .rv-nav-rail {
  flex: 1;
  height: 100%;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-brand-fg) 28%, transparent)
    transparent;
}

.sales-shell__toggle-bars,
.sales-shell__toggle-bars::before,
.sales-shell__toggle-bars::after {
  display: block;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
}

.sales-shell__toggle-bars {
  position: relative;
}

.sales-shell__toggle-bars::before,
.sales-shell__toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.sales-shell__toggle-bars::before {
  top: -4px;
}

.sales-shell__toggle-bars::after {
  top: 4px;
}

.sales-shell__nav-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.sales-shell__logout-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.sales-shell__content {
  margin-left: var(--sales-sidebar-rail);
  width: calc(100% - var(--sales-sidebar-rail));
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ar-page {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "banner"
    "kpi"
    "table";
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 20px) 16px;
  overflow: hidden;
}

.ar-page__kpi {
  grid-area: kpi;
  min-width: 0;
}

.ar-page__banner {
  grid-area: banner;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, #b42318 14%, var(--color-bg));
  color: var(--color-fg);
  font-size: 13px;
  line-height: 1.45;
}

.ar-page__widget.rv-widget-card {
  grid-area: table;
  min-width: 0;
  min-height: 0;
}

.ar-page__row--unresolved {
  background: color-mix(in srgb, #b42318 10%, transparent);
}
.illiquid-page {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "banner"
    "kpi"
    "table";
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 20px) 16px;
  overflow: hidden;
}

.illiquid-page__kpi {
  grid-area: kpi;
  min-width: 0;
}

.illiquid-page__banner {
  grid-area: banner;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, #b42318 14%, var(--color-bg));
  color: var(--color-fg);
  font-size: 13px;
  line-height: 1.45;
}

.illiquid-page__widget.rv-widget-card {
  grid-area: table;
  min-width: 0;
  min-height: 0;
}

.illiquid-kpi--ok {
  box-shadow: inset 0 -3px 0 #2f7d32;
}

.illiquid-kpi--watch {
  box-shadow: inset 0 -3px 0 #b54708;
}

.illiquid-kpi--critical {
  box-shadow: inset 0 -3px 0 #b42318;
}

.illiquid-page__row--ok {
  background: color-mix(in srgb, #2f7d32 7%, transparent);
}

.illiquid-page__row--watch {
  background: color-mix(in srgb, #b54708 9%, transparent);
}

.illiquid-page__row--critical {
  background: color-mix(in srgb, #b42318 10%, transparent);
}
.plan-12m-page {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 20px) 16px;
  overflow: hidden;
}

.plan-12m-page__kpi {
  min-width: 0;
}

.plan-12m-page__widget.rv-widget-card {
  min-width: 0;
  min-height: 0;
}

.plan-12m-page__row--neg-margin {
  background: color-mix(in srgb, #b42318 12%, transparent);
}
.saldovka-page {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 12px clamp(12px, 2vw, 20px) 16px;
  overflow: hidden;
}

.saldovka-page__widget.rv-widget-card {
  min-width: 0;
  min-height: 0;
}

.saldovka-page__row--no-lead {
  background: color-mix(in srgb, #b54708 12%, transparent);
}
.auth-session-loading {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #12241d;
  color: #c8c0b0;
  font-size: 14px;
}
.simple-page {
  padding-block: clamp(56px, 10vh, 100px);
}

.simple-page__inner {
  max-width: 640px;
}

.simple-page__title {
  font-size: clamp(32px, 4vw, 48px);
  color: var(--color-brand);
  margin-bottom: 16px;
}

.simple-page__intro {
  color: var(--color-fg-muted);
  font-size: 17px;
  margin: 0 0 28px;
}

.simple-page__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.simple-page__list-item {
  padding: 14px 18px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  color: var(--color-fg);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: filter 0.15s ease, background 0.15s ease;
}

.btn--accent {
  background: var(--color-accent);
  color: var(--color-accent-fg);
}

.btn--accent:hover {
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-bg-alt);
}

.hero {
  padding-block: clamp(56px, 10vh, 120px) clamp(40px, 6vh, 80px);
}

.hero__grid {
  max-width: 760px;
}

.hero__eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin: 0 0 16px;
  text-transform: uppercase;
}

.hero__title {
  font-size: var(--display-size);
  line-height: var(--display-lh);
  margin-bottom: 24px;
  color: var(--color-brand);
}

.hero__body {
  font-size: 18px;
  color: var(--color-fg-muted);
  max-width: 52ch;
  margin: 0 0 32px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.pillars {
  background: var(--color-bg-alt);
  padding-block: clamp(48px, 8vh, 96px);
}

.pillars__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 3vw, 40px);
}

.pillars__item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 28px;
  border: 1px solid var(--color-border);
}

.pillars__title {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--color-brand);
}

.pillars__body {
  color: var(--color-fg-muted);
  margin: 0;
  font-size: 15px;
}

.value {
  padding-block: clamp(56px, 8vh, 100px);
}

.value__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.value__eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.value__title {
  font-size: clamp(26px, 3vw, 36px);
  color: var(--color-brand);
}

.value__points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.value__point {
  padding-left: 24px;
  border-left: 3px solid var(--color-accent);
  color: var(--color-fg-muted);
}

@media (max-width: 900px) {
  .pillars__list,
  .value__grid {
    grid-template-columns: 1fr;
  }
}
.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.landing__header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.landing__header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 18px;
}

.landing__brand {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--color-brand);
  text-decoration: none;
}

.landing__nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
}

.landing__nav-link {
  text-decoration: none;
  color: var(--color-fg-muted);
  font-weight: 500;
  font-size: 15px;
  transition: color 0.15s ease;
}

.landing__nav-link:hover,
.landing__nav-link--active {
  color: var(--color-accent);
}

.landing__nav-login {
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-accent-fg);
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  transition: filter 0.15s ease;
}

.landing__nav-login:hover {
  filter: brightness(1.05);
}

.landing__main {
  flex: 1;
}

.landing__footer {
  background: var(--color-brand);
  color: var(--color-brand-fg);
  padding-block: clamp(32px, 6vw, 56px);
}

.landing__footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
}

.landing__footer-wordmark {
  font-family: var(--font-logo);
  font-size: 22px;
  margin: 0 0 8px;
}

.landing__footer-tagline {
  opacity: 0.8;
  margin: 0 0 12px;
  max-width: 32ch;
}

.landing__footer-email {
  color: inherit;
  opacity: 0.9;
  text-decoration: underline;
}

.landing__footer-col-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin: 0 0 12px;
}

.landing__footer-link {
  display: block;
  color: inherit;
  opacity: 0.9;
  text-decoration: none;
  margin-bottom: 8px;
}

.landing__footer-link:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (max-width: 720px) {
  .landing__footer-inner {
    grid-template-columns: 1fr;
  }

  .landing__nav {
    gap: 14px;
  }

  .landing__nav-link {
    font-size: 13px;
  }
}
/* Sized by .map-page__work grid cell (top-right ⅓×⅔); chrome: .sibagro-widget */
.materials-table {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.materials-table__controls {
  --materials-control-h: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Search keeps a light field; selects/actions are underline chrome. */
.materials-table__controls .materials-table__search input {
  box-sizing: border-box;
  height: var(--materials-control-h);
  min-height: var(--materials-control-h);
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-fg) 45%, transparent);
  background: transparent;
}

.materials-table__search {
  flex: 1;
  min-width: 96px;
  max-width: 160px;
}

.materials-table__search input {
  width: 100%;
  color: var(--color-fg);
}

.materials-table__search input::placeholder {
  color: var(--color-fg-muted);
}

.materials-table__search input:focus {
  outline: 2px solid color-mix(in srgb, var(--color-fg) 35%, transparent);
  outline-offset: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.materials-table__row--risk-high {
  box-shadow: inset 2px 0 0 var(--map-risk-high, #c0392b);
}
.materials-table__row--risk-medium {
  box-shadow: inset 2px 0 0 var(--map-risk-medium, #c47a1a);
}
.materials-table__row--risk-low {
  box-shadow: inset 2px 0 0 var(--map-risk-low, #3d7a4a);
}

.materials-table__row--selected.materials-table__row--risk-high {
  box-shadow: inset 3px 0 0 var(--map-risk-high, #c0392b);
}
.materials-table__row--selected.materials-table__row--risk-medium {
  box-shadow: inset 3px 0 0 var(--map-risk-medium, #c47a1a);
}
.materials-table__row--selected.materials-table__row--risk-low {
  box-shadow: inset 3px 0 0 var(--map-risk-low, #3d7a4a);
}

.materials-table__status {
  margin: 8px 14px;
  font-size: 13px;
  color: var(--color-fg-muted);
}

.materials-table__status--err {
  color: var(--map-origin, #c23b22);
}

.materials-table__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 6px 10px;
  scrollbar-width: none; /* Firefox — scroll via wheel/touch only */
  -ms-overflow-style: none; /* legacy Edge */
}

.materials-table__scroll::-webkit-scrollbar {
  display: none; /* Chromium / Safari */
}

.materials-table__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  font: inherit;
  color: inherit;
}

.materials-table__row--header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-fg-muted);
  padding-top: 4px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
}

.materials-table__row--body {
  cursor: pointer;
  font-size: 13px;
  color: var(--color-fg);
}

.materials-table__row--body:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-brand) 18%, transparent);
}

.materials-table__row--selected {
  background: color-mix(in srgb, var(--map-origin, #c23b22) 18%, transparent);
  box-shadow: inset 3px 0 0 var(--map-origin, #c23b22);
}

.materials-table__row--muted {
  opacity: 0.5;
  cursor: not-allowed;
}

.materials-table__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-fg);
}

.materials-table__qty {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--color-fg);
}

.materials-table__uom {
  color: var(--color-fg-muted);
  font-size: 11px;
}
/*
 * Layers (outside → in):
 * 1. section.map — grid cell only (no fill); must NOT clip child box-shadow
 * 2. .map-shell.sibagro-widget — card chrome; fill = surface (= materials)
 * 3. WidgetCard overlay — title + «?» on top of map
 * 4. .map-shell__canvas / .map__stage — full-bleed surface
 * 5. svg / land / pins; legend copy lives in QuickHint; zoom = wheel + «Мир»
 */
.map {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: transparent;
  /* visible: .sibagro-widget shadow lives on the child */
  overflow: visible;
}

/*
 * Card = full map cell (= ⅔ width × ⅔ height of work zone).
 * Right ⅓ = MaterialsTable; bottom ⅓ row stays free.
 */
.map-shell.sibagro-widget {
  /* same fill as materials (.sibagro-widget → --color-surface) */
  background: var(--color-surface);
  color: var(--color-fg);
}

.map-shell {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-shell__card {
  flex: 1;
  min-height: 0;
}

.map-shell__card-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-shell__canvas {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--map-ocean);
  overflow: hidden;
  border-radius: 0;
}

.map-shell__filter-chip {
  position: absolute;
  z-index: 5;
  right: 14px;
  bottom: 14px;
  margin: 0;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  color: var(--color-fg);
  font-size: 12px;
  box-shadow: 0 4px 16px color-mix(in srgb, #000 18%, transparent);
}

.map__stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--map-ocean);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.map__svg {
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
}

.map__svg:active {
  cursor: grabbing;
}

.map__ocean {
  fill: var(--map-ocean);
}

/* Paper-cut: raised land plate with long soft shadow */
.map__land-layer {
  filter: drop-shadow(10px 14px 0.5px color-mix(in srgb, var(--color-ink) 14%, transparent))
    drop-shadow(2px 3px 1px color-mix(in srgb, var(--color-ink) 8%, transparent));
}

.map__country {
  fill: var(--map-land);
  stroke: none;
  cursor: pointer;
  transition: fill 0.12s ease;
}

.map__country--muted {
  fill: color-mix(in srgb, var(--map-land) 72%, var(--map-ocean));
  cursor: default;
}

.map__country--interest {
  fill: var(--map-land);
}

.map__country--hover.map__country--interest,
.map__country--hover.map__country--muted {
  fill: var(--map-land-hover);
}

.map__country--selected {
  fill: var(--map-land-selected);
}

.map__country--selected:not(.map__country--interest) {
  stroke: var(--map-border-interest);
  stroke-width: calc(1.4px * var(--map-stroke-scale, 1));
  stroke-linejoin: round;
}

.map__borders {
  fill: none;
  stroke: var(--map-border-muted);
  stroke-width: calc(0.4px * var(--map-stroke-scale, 1));
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.map__interest-outline {
  fill: none;
  stroke: var(--map-border-interest);
  stroke-width: calc(1.05px * var(--map-stroke-scale, 1));
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.map__admin1 {
  fill: color-mix(in srgb, var(--map-land) 40%, transparent);
  stroke: var(--map-border-muted);
  stroke-width: calc(0.45px * var(--map-stroke-scale, 1));
  stroke-linejoin: round;
  cursor: pointer;
  pointer-events: auto;
}

.map__admin1--focus {
  fill: color-mix(in srgb, var(--color-paprika) 18%, var(--map-land));
  stroke: var(--map-border-muted);
  stroke-width: calc(0.45px * var(--map-stroke-scale, 1));
}

.map__admin1--hover {
  fill: color-mix(in srgb, var(--color-paprika) 28%, var(--map-land));
}

.map__admin1--selected {
  fill: color-mix(in srgb, var(--color-paprika) 42%, #fff6ee);
  stroke: var(--map-border-muted);
  stroke-width: calc(0.45px * var(--map-stroke-scale, 1));
}

.map__callout-line {
  stroke: var(--map-callout-line);
  stroke-width: 0.85;
  stroke-linecap: round;
}

.map__callout-title {
  fill: var(--map-callout-fg);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--map-callout-halo);
  stroke-width: 2.8px;
}

.map__callout-sub {
  fill: var(--map-callout-fg-muted);
  font-family: var(--font-body);
  font-size: 7.5px;
  paint-order: stroke;
  stroke: var(--map-callout-halo);
  stroke-width: 2.4px;
}

.map__origin {
  pointer-events: auto;
  cursor: pointer;
}

.map__origin-ring {
  fill: none;
  stroke: var(--map-origin);
  stroke-width: calc(1px * var(--map-stroke-scale, 1));
  opacity: 0.5;
}

.map__origin-dot {
  fill: var(--map-origin);
}

.map__origin--cluster .map__origin-ring {
  opacity: 0.75;
  stroke-width: calc(1.4px * var(--map-stroke-scale, 1));
}

.map__origin-badge {
  fill: #fff;
  font-family: var(--font-body);
  font-size: 7px;
  font-weight: 700;
  pointer-events: none;
}

.map__origin--selected .map__origin-ring {
  stroke: var(--color-paprika, #c45c26);
  opacity: 1;
  stroke-width: calc(1.8px * var(--map-stroke-scale, 1));
}

.map__origin--selected .map__origin-dot {
  fill: var(--color-paprika, #c45c26);
}

.map__origin--risk-high .map__origin-ring {
  stroke: var(--map-risk-high);
}
.map__origin--risk-high .map__origin-dot {
  fill: var(--map-risk-high);
}
.map__origin--risk-medium .map__origin-ring {
  stroke: var(--map-risk-medium);
}
.map__origin--risk-medium .map__origin-dot {
  fill: var(--map-risk-medium);
}
.map__origin--risk-low .map__origin-ring {
  stroke: var(--map-risk-low);
}
.map__origin--risk-low .map__origin-dot {
  fill: var(--map-risk-low);
}

.map__tooltip {
  position: absolute;
  z-index: 4;
  min-width: 140px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 96%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--color-ink) 12%, transparent);
  pointer-events: none;
  transform: translate(0, 0);
}

.map__tooltip-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-fg);
}

.map__tooltip-meta {
  margin: 0;
  font-size: 12px;
  color: var(--color-fg-muted);
}

.map__tooltip-crops {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--color-fg);
}

/* Header chrome immediately after «Карта» / ? — dropdown opens down into map. */
.map-shell__header.rv-widget-card__header {
  justify-content: flex-start;
  gap: 16px;
  overflow: visible;
}

.map-shell__header .rv-widget-card__actions {
  flex: 0 0 auto;
  justify-content: flex-start;
  gap: 14px;
  overflow: visible;
}

/* Overlay chrome sits on map ocean — force readable fg (Materials card is fine). */
.map-shell__header .underline-action,
.map-shell__header .rv-select__trigger,
.map-shell__header .rv-select__prefix,
.map-shell__header .rv-select__value,
.map-shell__header .rv-select__chevron {
  color: var(--color-fg);
  text-shadow: 0 1px 2px color-mix(in srgb, var(--map-ocean) 80%, #000);
}

.map-shell__header .rv-select__prefix,
.map-shell__header .rv-select__chevron {
  color: var(--color-fg-muted);
}

.map-shell__header .underline-action {
  border-bottom-color: color-mix(in srgb, var(--color-fg) 45%, transparent);
}

.map-shell__header .rv-select__trigger {
  border-bottom-color: color-mix(in srgb, var(--color-fg) 45%, transparent);
}

.map__chrome-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

.map__loading {
  position: absolute;
  color: var(--color-fg-muted);
  font-size: 14px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Country panel — overlay on the map canvas */
.map__panel-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 56px;
  z-index: 3;
  width: min(320px, calc(100% - 24px));
  pointer-events: none;
}

.map__panel-overlay .map__panel {
  pointer-events: auto;
  height: 100%;
  max-height: 100%;
}

.map__panel {
  position: relative;
  width: 100%;
  max-height: 100%;
  overflow: auto;
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--color-ink) 12%, transparent);
  padding: 28px 22px;
}

.map__panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-fg-muted);
}

.map__panel-name {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--color-fg);
  margin: 0 0 16px;
  padding-right: 24px;
}

.map__panel-status {
  color: var(--color-fg-muted);
}

.map__panel-status--error {
  color: var(--color-accent);
}

.map__panel-risk {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.map__risk-badge {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-border);
}

.map__risk-badge--low {
  border-left-color: var(--color-forest);
}

.map__risk-badge--medium {
  border-left-color: var(--color-paprika);
}

.map__risk-badge--high {
  border-left-color: #a3271b;
}

.map__risk-label {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

.map__risk-value {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-fg);
  text-transform: capitalize;
}

.map__risk-rationale {
  margin: 0;
  font-size: 13px;
  color: var(--color-fg-muted);
}

.map__panel-chat {
  margin-top: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--color-paprika, #c45c26) 45%, transparent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-fg, inherit);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.map__panel-chat:hover {
  background: color-mix(in srgb, var(--color-bg-alt, #222) 80%, transparent);
}

.map__panel-weather {
  margin: 0;
  font-size: 14px;
  color: var(--color-fg-muted);
  text-transform: capitalize;
}

.map__panel-roster {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map__panel-roster-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.map__panel-roster-item:hover {
  border-color: var(--map-border-interest);
}

.map__panel-roster-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-fg);
}

.map__panel-roster-crops {
  font-size: 12px;
  color: var(--color-fg-muted);
}

.map__panel-products {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map__panel-products-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map__panel-product {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
}

.map__panel-product:last-child {
  border-bottom: none;
}

.map__panel-product-name {
  font-size: 14px;
  color: var(--color-fg);
}

.map__panel-product-crop {
  font-size: 12px;
  color: var(--color-fg-muted);
}

@media (max-width: 720px) {
  .map__panel-overlay {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 42%;
  }
}
.map-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--color-bg);
}

/*
 * Work zone grid: 2×2 of content area.
 * Top-left ⅔×⅔ = map card; top-right ⅓×⅔ = materials table;
 * bottom row free for later widgets.
 */
.map-page__work {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  background: var(--color-bg);
  overflow: hidden;
}

.map-page__work .map {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 0;
}

.map-page__work .materials-table {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  max-width: none;
  height: auto;
  min-width: 0;
}
/* T1 theme contract — override only these vars in product theme.css */

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Palette (product theme.css overrides) */
  --t1-bg: #f5f5f4;
  --t1-bg-soft: #ebeae8;
  --t1-surface: rgba(255, 255, 255, 0.85);
  --t1-surface-solid: #ffffff;
  --t1-border: rgba(22, 22, 22, 0.14);
  --t1-text: #161616;
  --t1-text-muted: #3f4f63;
  --t1-text-brand: #161616;
  --t1-accent: #0043ce;
  --t1-accent-deep: #0043ce;
  --t1-input-bg: #ffffff;
  --t1-error-bg: rgba(218, 30, 40, 0.08);
  --t1-error-text: #991b1b;
  --t1-success: #1a7f48;
  --t1-success-soft: rgba(26, 127, 72, 0.12);

  /* Auth brand mark (login/register) — studio canon */
  --t1-auth-brand-mark-size: 64px;
  --t1-auth-brand-mark-radius: 18px;
  --t1-auth-brand-gap: 14px;

  /* Geometry — sync with breakpoints.ts T1_BP; studio canon */
  --t1-header-h: 72px;
  --t1-bp-narrow: 900px;
  --t1-bp-short-viewport: 680px;
  --t1-bp-auth-compact: 720px;
  --t1-bp-header-compact: 720px;
  --t1-bp-storage-compact: 700px;
  --t1-bp-process-tight: 520px;

  /* Auth shell */
  --t1-auth-card-max-width: 420px;
  --t1-auth-shell-gap: 24px;
  --t1-auth-shell-gap-compact: 16px;
  --t1-auth-card-padding: 24px 22px;
  --t1-auth-card-padding-compact: 18px 16px;

  /* Layout L2 */
  --t1-l2-gap: clamp(16px, 3vw, 32px);
  --t1-l2-padding: clamp(20px, 4vw, 40px);
  --t1-workspace-max-width: 1280px;

  /* Safe area */
  --t1-safe-top: env(safe-area-inset-top, 0px);
  --t1-safe-right: env(safe-area-inset-right, 0px);
  --t1-safe-bottom: env(safe-area-inset-bottom, 0px);
  --t1-safe-left: env(safe-area-inset-left, 0px);

  /* Motion (layout morph) */
  --t1-motion-layout: 375ms;
  --t1-motion-ease-layout: cubic-bezier(0.16, 1, 0.3, 1);

  /*
   * Typography — studio canon; product theme overrides --t1-font-display/body only.
   * Do not override --t1-font-size-* or --t1-line-height-auth-* in products.
   */
  --t1-font-display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --t1-font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --t1-line-height-auth-body: 1.55;
  --t1-font-size-auth-form-sig: 1.4rem;
  --t1-font-size-auth-step-title: 1.35rem;
  --t1-font-size-auth-step-text: 0.92rem;
  --t1-font-size-auth-step-text-muted: 0.88rem;
  --t1-font-size-auth-field-label: 0.82rem;
  --t1-font-size-auth-input: 0.9375rem; /* 15px @ 16px root — studio body control size */
  --t1-font-size-auth-btn: 0.9375rem;
  --t1-font-size-auth-form-error: 0.88rem;
  --t1-font-size-auth-tabs-link: 0.88rem;
  --t1-font-size-auth-sso-divider: 0.82rem;
  --t1-font-size-auth-sso-btn: 0.78rem;
  --t1-font-size-auth-brand-logo: clamp(1.2rem, 2.5vw, 1.65rem);
  --t1-font-size-auth-brand-tagline: 0.68rem;
  --t1-font-size-auth-guard-title: clamp(1.75rem, 4vw, 2.25rem);
  --t1-font-size-auth-guard-text: 1rem;
  --t1-radius-lg: 24px;
  --t1-radius-md: 16px;
  --t1-radius-sm: 12px;

  /* Chrome / forms */
  --t1-on-accent: #ffffff;
  --t1-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  --t1-form-gap: 14px;
  --t1-input-padding: 12px 14px;
  --t1-btn-padding: 12px 18px;
  --t1-motion-enter: 300ms;
  --t1-motion-stagger: 50ms;
  --t1-motion-stagger-max: 5;
  --t1-motion-ease-enter: cubic-bezier(0, 0, 0.2, 1);
  --t1-motion-interaction: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --t1-motion-interaction-fast: 150ms cubic-bezier(0.4, 0, 1, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --t1-bg: #161616;
  --t1-bg-soft: #262626;
  --t1-surface: rgba(38, 38, 38, 0.92);
  --t1-surface-solid: #262626;
  --t1-border: rgba(244, 244, 244, 0.14);
  --t1-text: #f4f4f4;
  --t1-text-muted: #c6c6c6;
  --t1-text-brand: #f4f4f4;
  --t1-accent: #78a9ff;
  --t1-accent-deep: #a6c8ff;
  --t1-input-bg: #393939;
  --t1-on-accent: #161616;
  --t1-error-bg: rgba(250, 77, 86, 0.14);
  --t1-error-text: #ffb3b8;
  --t1-success: #6fdc8c;
  --t1-success-soft: rgba(111, 220, 140, 0.16);
  --t1-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
/**
 * T1 layout presets — scroll + auth geometry only.
 * Product visual styling stays in theme.css (--t1-* overrides).
 * Preset names: `{product}-auth`, `{product}-storage`, `{product}-home`.
 */

.screen-grid {
  display: grid;
  width: 100%;
  grid-template-columns: var(--screen-grid-columns, 1fr);
  grid-template-rows: var(--screen-grid-rows, 1fr);
  gap: var(--t1-l2-gap);
}

.screen-grid[data-screen-scroll="viewport"] {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.screen-grid[data-screen-scroll="page"] {
  flex: 0 1 auto;
  height: auto;
  align-content: start;
  overflow: visible;
}

.screen-grid[data-screen-layout-preset$="-storage"] {
  flex: 0 0 auto;
  align-content: start;
}

/* Auth preset — any product prefix */
.screen-grid[data-screen-layout-preset$="-auth"],
.t1-auth-grid {
  width: 100%;
  max-width: var(--t1-auth-card-max-width);
  margin: 0 auto;
  flex: 0 1 auto;
  height: auto;
  align-content: start;
  gap: var(--t1-auth-shell-gap);
  padding: 0;
}

@media (max-height: 720px) {
  .screen-grid[data-screen-layout-preset$="-auth"],
  .t1-auth-grid {
    gap: var(--t1-auth-shell-gap-compact);
  }
}

.screen-grid[data-screen-layout-preset$="-auth"][data-screen-scroll="page"] {
  padding-bottom: var(--t1-safe-bottom);
}

.screen-grid[data-screen-layout-preset$="-auth"] .screen-grid__slot-content {
  width: 100%;
}

.screen-layout-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  padding: var(--t1-l2-padding);
  color: var(--t1-text-muted);
}

.screen-layout-pending__mark {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--t1-bg-soft) 60%, transparent);
  border: 1px solid var(--t1-border);
  animation: screen-layout-pending-pulse 1.4s ease-in-out infinite;
}

@keyframes screen-layout-pending-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.96);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.screen-layout-missing {
  padding: var(--t1-l2-padding);
  color: var(--t1-error-text);
  background: var(--t1-error-bg);
  border-radius: var(--t1-radius-md);
}

.screen-layout-missing__title {
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.screen-layout-missing__reason {
  margin: 0;
}

.screen-layout-missing__debug {
  margin-top: 12px;
  font-size: 0.75rem;
  overflow: auto;
}
/**
 * T1 chrome — auth shell layout, form system, SSO region.
 * Product theme: palette + --t1-font-display/body only; sizes from t1-tokens.css (studio canon).
 */

.t1-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Auth route shell */
.t1.t1--login,
.t1--login {
  position: relative;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding:
    calc(24px + var(--t1-safe-top))
    max(20px, var(--t1-safe-right))
    calc(24px + var(--t1-safe-bottom))
    max(20px, var(--t1-safe-left));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--t1-bg);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-step-text);
  line-height: var(--t1-line-height-auth-body);
  color: var(--t1-text);
}

.t1.t1--login:has([data-screen-scroll="page"]),
.t1--login:has([data-screen-scroll="page"]) {
  height: auto;
  min-height: 100dvh;
}

.t1__foreground,
.t1--login .t1__foreground {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin: auto;
}

.t1-auth-stack {
  width: 100%;
  max-width: var(--t1-auth-card-max-width);
  display: flex;
  flex-direction: column;
  gap: var(--t1-auth-shell-gap);
}

.t1-auth-stack > .t1-auth-card {
  width: 100%;
  box-sizing: border-box;
}

.t1-auth-card {
  padding: var(--t1-auth-card-padding);
  border-radius: var(--t1-radius-md);
  border: 1px solid var(--t1-border);
  background: var(--t1-surface-solid);
  box-shadow: var(--t1-shadow);
}

.t1-auth-brand {
  display: flex;
  justify-content: center;
  padding-inline: 20px;
}

.t1-auth-form {
  position: relative;
}

.t1-auth-form__sig {
  margin: 0 0 20px;
  font-family: var(--t1-font-display);
  font-size: var(--t1-font-size-auth-form-sig);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  text-align: center;
  color: var(--t1-text-muted);
}

.t1-form {
  display: flex;
  flex-direction: column;
  gap: var(--t1-form-gap);
}

.t1-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.t1-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.t1-field__label {
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-field-label);
  color: var(--t1-text-muted);
}

.t1-field__hint {
  font-family: var(--t1-font-body);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--t1-text-muted);
}

.t1-input {
  width: 100%;
  box-sizing: border-box;
  padding: var(--t1-input-padding);
  border-radius: var(--t1-radius-sm);
  border: 1px solid var(--t1-border);
  background: var(--t1-input-bg);
  color: var(--t1-text);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-input);
  line-height: var(--t1-line-height-auth-body);
  transition:
    border-color var(--t1-motion-interaction),
    background var(--t1-motion-interaction),
    box-shadow var(--t1-motion-interaction),
    outline-color var(--t1-motion-interaction);
}

.t1-input::placeholder {
  color: var(--t1-text-muted);
  opacity: 0.72;
}

.t1-input:hover:not(:disabled):not(:focus-visible) {
  border-color: color-mix(in srgb, var(--t1-accent) 32%, var(--t1-border));
  background: color-mix(in srgb, var(--t1-bg-soft) 35%, var(--t1-input-bg));
}

.t1-input:focus-visible {
  outline: 2px solid var(--t1-accent);
  outline-offset: 2px;
  border-color: color-mix(in srgb, var(--t1-accent) 45%, var(--t1-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t1-accent) 18%, transparent);
}

/* UX-B1: поле пароля с кнопкой показа/скрытия. */
.t1-input-wrap {
  position: relative;
  display: block;
}

.t1-input--reveal {
  padding-right: 44px;
}

.t1-input__reveal {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--t1-text-muted);
  cursor: pointer;
  border-radius: var(--t1-radius-sm);
  transition: color var(--t1-motion-interaction);
}

.t1-input__reveal:hover {
  color: var(--t1-text);
}

.t1-input__reveal:focus-visible {
  outline: 2px solid var(--t1-accent);
  outline-offset: -2px;
}

.t1-input__reveal-icon {
  display: inline-flex;
}

.t1-form__error {
  margin: 0;
  color: var(--t1-error-text);
  background: var(--t1-error-bg);
  padding: 10px 12px;
  border-radius: var(--t1-radius-sm);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-form-error);
}

.t1-field__error {
  font-family: var(--t1-font-body);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--t1-error-text);
}

.t1-field-row {
  display: flex;
  gap: var(--t1-form-gap);
}

.t1-field-row > .t1-field {
  flex: 1 1 0;
  min-width: 0;
}

.t1-field__requirements {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 6px 16px;
}

.t1-field__requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--t1-font-body);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--t1-text-muted);
  transition: color var(--t1-motion-interaction);
}

.t1-field__requirement--met {
  color: var(--t1-success);
}

.t1-field__requirement-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}

.t1-field__requirement--met .t1-field__requirement-mark {
  background: var(--t1-success-soft);
  border-color: var(--t1-success);
  color: var(--t1-success);
}

.t1-combobox {
  position: relative;
}

.t1-combobox__list {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  background: var(--t1-input-bg);
  border: 1px solid var(--t1-border);
  border-radius: var(--t1-radius-sm);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--t1-text) 14%, transparent);
}

.t1-combobox__option {
  padding: 8px 10px;
  border-radius: var(--t1-radius-sm);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-input);
  color: var(--t1-text);
  cursor: pointer;
  transition: background var(--t1-motion-interaction-fast);
}

.t1-combobox__option:hover,
.t1-combobox__option--active {
  background: color-mix(in srgb, var(--t1-accent) 12%, var(--t1-input-bg));
}

.t1-btn {
  appearance: none;
  box-sizing: border-box;
  border: 1px solid var(--t1-border);
  background: var(--t1-bg-soft);
  color: var(--t1-text);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-btn);
  line-height: var(--t1-line-height-auth-body);
  font-weight: 600;
  padding: var(--t1-btn-padding);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background var(--t1-motion-interaction),
    border-color var(--t1-motion-interaction),
    color var(--t1-motion-interaction),
    box-shadow var(--t1-motion-interaction),
    filter var(--t1-motion-interaction-fast),
    transform var(--t1-motion-interaction-fast);
}

.t1-btn:hover:not(:disabled):not(.t1-btn--primary) {
  border-color: color-mix(in srgb, var(--t1-accent) 28%, var(--t1-border));
  background: color-mix(in srgb, var(--t1-accent) 6%, var(--t1-bg-soft));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--t1-accent) 10%, transparent);
}

.t1-btn--primary {
  background: var(--t1-accent);
  border-color: transparent;
  color: var(--t1-on-accent);
}

.t1-btn--primary:hover:not(:disabled) {
  background: var(--t1-accent-deep);
  border-color: transparent;
  color: var(--t1-on-accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--t1-accent-deep) 40%, transparent);
}

.t1-btn--primary:active:not(:disabled) {
  filter: brightness(0.94);
  transform: translateY(1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--t1-accent-deep) 30%, transparent);
}

.t1-btn:focus {
  outline: none;
}

.t1-btn:focus-visible {
  outline: 2px solid var(--t1-accent);
  outline-offset: 2px;
}

.t1-btn--block {
  width: 100%;
}

.t1-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.t1-auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 999px;
  background: var(--t1-bg-soft);
  border: 1px solid var(--t1-border);
}

.t1-auth-tabs__link {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-tabs-link);
  font-weight: 600;
  color: var(--t1-text-muted);
  padding: 8px 12px;
  border-radius: 999px;
  transition:
    background var(--t1-motion-interaction),
    color var(--t1-motion-interaction),
    box-shadow var(--t1-motion-interaction);
}

.t1-auth-tabs__link:hover:not(.t1-auth-tabs__link--active) {
  color: var(--t1-text);
  background: color-mix(in srgb, var(--t1-surface-solid) 55%, transparent);
}

.t1-auth-tabs__link--active {
  background: var(--t1-surface-solid);
  color: var(--t1-text);
  box-shadow: var(--t1-shadow);
}

.t1-auth-step-title {
  margin: 0 0 12px;
  font-family: var(--t1-font-display);
  font-size: var(--t1-font-size-auth-step-title);
  color: var(--t1-text);
}

.t1-auth-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.t1-auth-step-head .t1-auth-step-title {
  margin-bottom: 0;
}

.t1-auth-step-text {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-step-text);
  color: var(--t1-text);
  line-height: 1.5;
}

.t1-auth-step-text--lead {
  margin-bottom: 16px;
  color: var(--t1-text-muted);
}

.t1-auth-step-text--muted {
  color: var(--t1-text-muted);
  font-size: var(--t1-font-size-auth-step-text-muted);
}

.t1-auth-link,
.t1-auth-step-text--muted a {
  color: var(--t1-accent-deep);
  text-decoration: none;
  transition:
    color var(--t1-motion-interaction),
    text-decoration-color var(--t1-motion-interaction-fast);
}

.t1-auth-link:hover,
.t1-auth-step-text--muted a:hover {
  color: var(--t1-accent);
  text-decoration: underline;
}

.t1-auth-link:focus-visible,
.t1-auth-step-text--muted a:focus-visible {
  outline: 2px solid var(--t1-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.t1-auth-link--inline {
  flex-shrink: 0;
}

.t1-auth-link--block {
  display: inline-block;
}

.t1-auth-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-top: 12px;
}

.t1-auth-sso {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--t1-border);
}

.t1-auth-sso__divider {
  margin: 0 0 10px;
  text-align: center;
  font-size: var(--t1-font-size-auth-sso-divider);
  color: var(--t1-text-muted);
}

.t1-auth-sso__buttons {
  display: flex;
  gap: 8px;
}

.t1-auth-sso__btn-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
}

.t1-auth-sso__buttons > .t1-auth-sso__btn {
  flex: 1 1 0;
}

.t1-auth-sso__btn {
  flex: 1;
  width: 100%;
  min-width: 0;
  gap: 8px;
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-sso-btn);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--t1-motion-interaction),
    border-color var(--t1-motion-interaction),
    box-shadow var(--t1-motion-interaction);
}

.t1-auth-sso__btn:hover:not(:disabled):not(.t1-auth-sso__btn--disabled) {
  border-color: color-mix(in srgb, var(--t1-accent) 25%, var(--t1-border));
  background: color-mix(in srgb, var(--t1-accent) 5%, var(--t1-bg-soft));
}

.t1-auth-sso__icon,
.t1-auth-sso__btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.t1-auth-sso__btn--disabled:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.t1-auth-sso__tooltip {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: var(--t1-radius-sm);
  background: var(--t1-surface-solid);
  border: 1px solid var(--t1-border);
  box-shadow: var(--t1-shadow);
  color: var(--t1-text);
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-sso-btn);
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--t1-motion-interaction-fast),
    transform var(--t1-motion-interaction-fast),
    visibility var(--t1-motion-interaction-fast);
}

.t1-auth-sso__tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--t1-surface-solid);
  filter: drop-shadow(0 1px 0 var(--t1-border));
}

.t1-auth-sso__btn-wrap:hover .t1-auth-sso__tooltip,
.t1-auth-sso__btn-wrap:focus-within .t1-auth-sso__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-height: 720px) {
  .screen-grid[data-screen-layout-preset$="-auth"] .t1-auth-card,
  .t1-auth-grid .t1-auth-card {
    padding: var(--t1-auth-card-padding-compact);
  }
}

.t1-auth-loading {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
}

.t1-auth-loading .t1__foreground {
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* Auth brand block — studio canon; product supplies mark asset + copy */
.t1-brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: var(--t1-auth-brand-gap);
  max-width: 100%;
  text-align: left;
}

.t1-brand__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.t1-brand__mark {
  display: block;
  width: var(--t1-auth-brand-mark-size);
  height: var(--t1-auth-brand-mark-size);
  flex-shrink: 0;
  border-radius: var(--t1-auth-brand-mark-radius);
  object-fit: cover;
  box-shadow: var(--t1-shadow);
  border: 1px solid var(--t1-border);
}

.t1-auth-brand .t1-brand__mark {
  width: var(--t1-auth-brand-mark-size);
  height: var(--t1-auth-brand-mark-size);
  border-radius: var(--t1-auth-brand-mark-radius);
}

.t1-brand__logo {
  font-family: var(--t1-font-display);
  font-size: var(--t1-font-size-auth-brand-logo);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--t1-text-brand);
  max-width: 100%;
}

.t1-brand__tagline {
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-brand-tagline);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--t1-text-muted);
  max-width: 100%;
}

/* Awaiting approval overlay (post-login guard) */
.t1-auth-guard {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.t1-auth-guard__content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.t1-auth-guard__content--dimmed {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.t1-auth-guard__overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: clamp(20px, 4vw, 40px);
  background: color-mix(in srgb, var(--t1-bg) 35%, transparent);
}

.t1-auth-guard__card {
  width: 100%;
  max-width: 640px;
  padding: clamp(32px, 5vw, 56px);
  border-radius: var(--t1-radius-lg);
  background: color-mix(in srgb, var(--t1-surface-solid) 88%, transparent);
  border: 1px solid var(--t1-border);
  box-shadow: var(--t1-shadow);
  backdrop-filter: blur(16px);
}

.t1-auth-guard__title {
  margin: 0 0 16px;
  font-family: var(--t1-font-display);
  font-size: var(--t1-font-size-auth-guard-title);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  color: var(--t1-text);
}

.t1-auth-guard__description {
  margin: 0;
  font-family: var(--t1-font-body);
  font-size: var(--t1-font-size-auth-guard-text);
  line-height: 1.55;
  text-align: center;
  color: var(--t1-text-muted);
}

.t1-auth-guard__description a {
  color: var(--t1-accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.t1-auth-guard__description a:hover {
  color: var(--t1-accent);
}

@media (prefers-reduced-motion: reduce) {
  .t1-auth-motion-card {
    animation: none !important;
  }

  .t1-auth-sso__tooltip {
    transition: none;
  }

  .t1-auth-tabs__link,
  .t1-auth-link,
  .t1-btn,
  .t1-input,
  .t1-auth-sso__btn {
    transition: none !important;
  }
}
/**
 * T1 motion tokens + L2 screen-grid motion + auth route stability.
 * Product home/chat view-transition — in product CSS (e.g. studio.css).
 * Product-only motion (--t1-motion-layout-focus, ambient, flap) — override in product tokens.css.
 */

:root,
[data-theme="light"],
[data-theme="dark"] {
  --t1-motion-enter: 300ms;
  --t1-motion-exit: 200ms;
  --t1-motion-layout: 375ms;
  --t1-motion-auth-route: 1.5s;
  --t1-motion-data: 500ms;
  --t1-motion-stagger: 50ms;
  --t1-motion-stagger-max: 5;
  --t1-motion-pulse-opacity: 0.88;
  --t1-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t1-motion-ease-layout: cubic-bezier(0.16, 1, 0.3, 1);
  --t1-motion-ease-enter: cubic-bezier(0, 0, 0.2, 1);
  --t1-motion-ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --t1-motion-interaction: var(--t1-motion-enter) var(--t1-motion-ease-default);
  --t1-motion-interaction-fast: var(--t1-motion-exit) var(--t1-motion-ease-default);
}

@keyframes t1-widget-mount-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes t1-auth-route-in {
  from {
    opacity: 0.28;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* L2 screen-grid motion (factory screens) */
.screen-motion-root {
  transition:
    grid-template-columns var(--t1-motion-layout) var(--t1-motion-ease-default),
    grid-template-rows var(--t1-motion-layout) var(--t1-motion-ease-default),
    opacity var(--t1-motion-layout) var(--t1-motion-ease-default);
}

.screen-grid--layout-morph {
  opacity: var(--t1-motion-pulse-opacity);
}

.screen-motion-slot {
  animation: t1-widget-mount-in var(--t1-motion-enter) var(--t1-motion-ease-enter) both;
  animation-delay: calc(
    min(var(--stagger-index, 0), var(--t1-motion-stagger-max)) * var(--t1-motion-stagger)
  );
}

.screen-motion-slot-content {
  transition: opacity var(--t1-motion-data) var(--t1-motion-ease-default) var(--t1-motion-layout);
}

.screen-grid--layout-morph .screen-motion-slot-content {
  opacity: var(--t1-motion-pulse-opacity);
}

/* Auth shell: stable chrome — no slot mount, no layout-morph pulse, one body crossfade on tab swap */
.t1-auth-shell-stable .t1__foreground,
.t1-auth-shell-stable.t1-motion-page,
.t1-auth-shell-stable .t1-motion-page {
  animation: none !important;
}

.t1-auth-shell-stable .screen-motion-root {
  transition: none;
}

.t1-auth-shell-stable .screen-motion-slot {
  animation: none;
}

.t1-auth-shell-stable .screen-motion-slot-content {
  transition: none;
}

.t1-auth-shell-stable .screen-grid--layout-morph,
.t1-auth-shell-stable .screen-grid--layout-morph .screen-motion-slot-content {
  opacity: 1;
}

.t1-auth-shell-stable .t1-auth-motion-card {
  animation: none;
}

.t1-auth-shell-stable .t1-auth-grid[data-t1-auth-route-enter="true"] .screen-grid__slot[data-screen-grid-slot="body"] .t1-auth-motion-card {
  animation: t1-auth-route-in var(--t1-motion-auth-route) var(--t1-motion-ease-layout) both;
}

@media (prefers-reduced-motion: reduce) {
  .t1-motion-page,
  .screen-motion-slot,
  .t1-auth-shell-stable .t1-auth-motion-card {
    animation: none !important;
  }

  .screen-motion-root,
  .screen-motion-slot-content {
    transition: none !important;
  }

  .screen-motion-slot {
    view-transition-name: none !important;
  }
}
/* Sibagro auth — только product overrides поверх kit t1-chrome. */

.sibagro-auth {
  min-height: 100vh;
  min-height: 100dvh;
}

/*
 * Kit default mark = квадрат (--t1-auth-brand-mark-size).
 * Лого Sibagro = широкая колбаса → перебить .t1-auth-brand .t1-brand__mark.
 */
.sibagro-auth .t1-auth-brand .t1-brand__mark--sausage,
.sibagro-auth .t1-brand__mark--sausage {
  width: min(180px, 56vw);
  height: auto;
  aspect-ratio: 220 / 72;
  max-width: 180px;
  border-radius: 0;
  object-fit: contain;
}

.sibagro-auth .t1-brand--sausage {
  gap: 10px;
}

.sibagro-auth .t1-brand--sausage .t1-brand__logo {
  display: none;
}

/* DEV-only hint when product-web / rv_auth not mounted — not a UI defect. */
.sibagro-auth-hydrate-warn {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 20;
  transform: translateX(-50%);
  margin: 0;
  max-width: min(420px, calc(100vw - 32px));
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  color: var(--t1-text-muted, #c8c0b0);
  background: color-mix(in srgb, var(--t1-surface-solid, #1b3a2f) 92%, transparent);
  border: 1px solid var(--t1-border, rgba(216, 207, 189, 0.22));
  opacity: 0.85;
}
/**
 * Sibagro brand tokens. Rationale: docs/brand.md.
 */
:root {
  /* brand palette */
  --color-forest: #1b3a2f;
  --color-paprika: #c45c26;
  --color-cream: #f3ede3;
  --color-ink: #1a1a1a;
  --color-mist: #e8e2d6;

  /* semantic aliases */
  --color-bg: var(--color-cream);
  --color-bg-alt: var(--color-mist);
  --color-surface: #ffffff;
  --color-fg: var(--color-ink);
  --color-fg-muted: #4a4a44;
  --color-accent: var(--color-paprika);
  --color-accent-fg: #ffffff;
  --color-brand: var(--color-forest);
  --color-brand-fg: var(--color-cream);
  /*
   * 12m series — clove (forest×paprika lifted on mist).
   * Not RAG (delta-pos/neg), not CTA paprika, not forest-as-ink.
   */
  --color-spark: color-mix(
    in srgb,
    color-mix(in srgb, var(--color-forest) 55%, var(--color-paprika)) 70%,
    var(--color-mist)
  );
  --color-border: #d8cfbd;

  /* Delta polarity (ratings DeltaCell / HeaderCell sort) */
  --color-delta-pos: #1a7a3c;
  --color-delta-neg: #b33;
  --color-delta-neutral: var(--color-mist);
  --color-error: var(--color-delta-neg);

  /* typography */
  --font-display: "Fraunces", "Georgia", serif;
  --font-logo: "Play", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;

  --display-size: clamp(40px, 6vw, 76px);
  --display-lh: 1.05;
  --display-weight: 500;

  /* layout */
  --page-max: 1180px;
  --pad-x: clamp(20px, 5vw, 64px);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* work-zone widget chrome (map, materials, future slots) */
  --widget-radius: var(--radius-lg);
  --widget-border: 1px solid var(--color-border);
  --widget-shadow:
    0 1px 0 color-mix(in srgb, var(--color-fg) 8%, transparent) inset,
    0 18px 48px color-mix(in srgb, #000 28%, transparent);

  /* map — ocean = widget surface (same as materials card); ≤2 stroke: muted | ink */
  --map-ocean: var(--color-surface);
  --map-land: #f7f2e8;
  --map-land-hover: color-mix(in srgb, var(--color-paprika) 16%, #f7f2e8);
  --map-land-selected: color-mix(in srgb, var(--color-paprika) 38%, #fff8f1);
  --map-border-muted: #c4c0b4;
  --map-border: var(--map-border-muted);
  --map-border-interest: #1a1a1a;
  --map-origin: #c0392b;
  --map-risk-high: #c0392b;
  --map-risk-medium: #c47a1a;
  --map-risk-low: #3d7a4a;
  --map-stroke-scale: 1;
  /* callouts: ink on cream ocean (light) / cream on dark ocean (dark) */
  --map-callout-fg: #1a1a1a;
  --map-callout-fg-muted: #4a4a44;
  --map-callout-halo: var(--map-ocean);
  --map-callout-line: color-mix(in srgb, var(--color-ink) 40%, transparent);
}

[data-theme="dark"] {
  --color-bg: #121410;
  --color-bg-alt: #1c1f18;
  --color-surface: #23261f;
  --color-fg: var(--color-cream);
  --color-fg-muted: #c8c0b0;
  --color-border: #3f4338;
  /* mist used as soft fill (buttons, map footer mix) — must not stay cream */
  --color-mist: #2a2e26;
  /* --color-brand stays forest: header / CTA backgrounds */
  /* Same clove, lifted on cream so the stroke stays visible on olive surfaces. */
  --color-spark: color-mix(
    in srgb,
    color-mix(in srgb, var(--color-forest) 55%, var(--color-paprika)) 42%,
    var(--color-cream)
  );

  /* ocean follows widget surface; land stays paper-cut light */
  --map-ocean: var(--color-surface);
  --map-land: #e8e0d2;
  --map-land-hover: color-mix(in srgb, var(--color-paprika) 22%, #e8e0d2);
  --map-land-selected: color-mix(in srgb, var(--color-paprika) 40%, #fff0e4);
  --map-border-muted: #6a6558;
  --map-border-interest: #f3ede3;
  /* ocean is dark — callouts need cream ink + dark halo, not black-on-black */
  --map-callout-fg: #f3ede3;
  --map-callout-fg-muted: #c8c0b0;
  --map-callout-halo: #121410;
  --map-callout-line: color-mix(in srgb, var(--color-cream) 55%, transparent);
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}

/*
 * @rv/ui-table structural styles — host supplies required --rv-ui-* theme.
 * Spark styles live in @rv/ui-spark/styles.css — import both when using Sparkline.
 * DiffChart styles live in @rv/ui-diff/styles.css — import both when using DiffChart.
 */

/*
 * body, не :root: --rv-ui-* приходят из host-темы на body (semantic-токены
 * хостов живут на body/body.dark); на html они invalid.
 */
body {
  --ui-table-fg: var(--rv-ui-color-fg);
  --ui-table-fg-muted: var(--rv-ui-color-fg-muted);
  --ui-table-brand: var(--rv-ui-color-brand);
  --ui-table-delta-pos: var(--rv-ui-color-positive);
  --ui-table-delta-neg: var(--rv-ui-color-negative);
  --ui-table-radius-sm: var(--rv-ui-radius-sm);
  --ui-table-tooltip-bg: var(--rv-ui-color-surface-elevated);
  --ui-table-tooltip-fg: var(--rv-ui-color-fg);
  --ui-table-font-family: var(--rv-ui-font-family);
  --ui-table-font-size-body: var(--rv-ui-font-size-body);
  --ui-table-font-size-label: var(--rv-ui-font-size-label);
  --ui-table-font-weight-medium: var(--rv-ui-font-weight-medium);
  --ui-table-font-weight-semibold: var(--rv-ui-font-weight-semibold);
  --ui-table-line-height: var(--rv-ui-line-height-body);
  --ui-table-space-xs: var(--rv-ui-space-xs);
  --ui-table-space-sm: var(--rv-ui-space-sm);
  --ui-table-space-md: var(--rv-ui-space-md);
  /* Header chrome: layout считает ширину из тех же токенов, что рисует CSS. */
  --ui-table-sort-btn-size: var(--rv-ui-table-sort-btn-size, 28px);
}

.rv-num-cell,
.rv-delta-cell {
  display: flex;
  align-items: center;
  justify-content: var(--table-numeric-align, center);
  text-align: var(--table-numeric-align, center);
  width: 100%;
  min-width: 0;
  font-family: var(--ui-table-font-family);
  font-variant-numeric: tabular-nums;
  font-size: inherit;
  color: var(--ui-table-fg);
  line-height: inherit;
}

.rv-num-cell--center,
.rv-delta-cell--center {
  justify-content: center;
  text-align: center;
}

.rv-num-cell--end,
.rv-delta-cell--end {
  justify-content: end;
  text-align: end;
}

.rv-num-cell__pair {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  min-width: 0;
}

.rv-num-cell__value {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.rv-num-cell__sep {
  flex: 0 0 auto;
  white-space: pre;
}

.rv-num-cell__unit {
  flex: 1 1 auto;
  min-width: 0;
  /* Donor .numericUnit: same color/size as digits (delta green/red included). */
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.rv-delta-cell--pos {
  color: var(--ui-table-delta-pos);
}

.rv-delta-cell--neg {
  color: var(--ui-table-delta-neg);
}

/* Donor `.deltaHeatHost` + `.deltaHeatBadge`: pill = column slot, unit ellipsis. */
.rv-delta-cell--heat-host {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-delta-cell__heat {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: var(--table-numeric-align, center);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* φ-геометрия как `.rv-rank-cell__badge` / donor heat-cell. */
  padding-block: 0.382em;
  padding-inline: 0.618em;
  border-radius: var(--ui-table-radius-sm);
  background: color-mix(
    in srgb,
    var(--heat-color, var(--ui-table-delta-pos)) 16%,
    transparent
  );
  overflow: hidden;
  white-space: nowrap;
}

.rv-delta-cell--center .rv-delta-cell__heat {
  justify-content: center;
}

.rv-delta-cell--end .rv-delta-cell__heat {
  justify-content: end;
}

.rv-delta-cell--pos .rv-delta-cell__heat {
  background: color-mix(
    in srgb,
    var(--heat-color, var(--ui-table-delta-pos)) 16%,
    transparent
  );
}

.rv-delta-cell--neg .rv-delta-cell__heat {
  background: color-mix(
    in srgb,
    var(--heat-color, var(--ui-table-delta-neg)) 16%,
    transparent
  );
}

.rv-delta-cell__heat .rv-num-unit,
.rv-delta-cell__heat .rv-num-cell__pair {
  display: flex;
  width: max-content;
  max-width: 100%;
}

.rv-delta-cell--neutral {
  color: var(--ui-table-fg-muted);
}

.rv-num-cell__truncate {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

/* Hug the current label; HeaderCell centers [select][sort] over numeric cells. */
.rv-header-metric-select__slot {
  flex: 0 1 auto;
  width: max-content;
  min-width: 0;
  max-width: 100%;
}

.rv-trunc-cell--clickable {
  cursor: pointer;
}

/* Same wrap as TruncedText / donor `.headerCell .headerTextWrap`. */
.rv-header-cell .rv-header-cell__text--wrap {
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.rv-header-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--ui-table-space-xs);
  width: 100%;
  height: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
  color: var(--ui-table-fg-muted);
  font-family: var(--ui-table-font-family);
  font-size: var(--rv-ui-table-font-size, var(--ui-table-font-size-body));
  font-weight: var(--ui-table-font-weight-medium);
  line-height: var(--rv-ui-table-line-height, var(--ui-table-line-height));
  padding: var(
      --table-header-padding-block,
      var(--rv-ui-table-header-padding-block, var(--rv-ui-space-sm))
    )
    var(
      --table-cell-padding-inline,
      var(--rv-ui-table-cell-padding-inline, var(--rv-ui-space-sm))
    );
}

.rv-header-cell > *:first-child {
  flex: 1 1 0;
  min-width: 0;
}

.rv-header-cell > * + * {
  flex-shrink: 0;
}

.rv-header-cell--start {
  justify-content: flex-start;
  text-align: start;
}

.rv-header-cell--metric-select {
  justify-content: center;
  text-align: center;
  /* Donor `.tableAnthropic`: --shell-chrome-bar-text via host Style port. */
  color: var(--rv-ui-chrome-table-header-fg, var(--ui-table-fg));
}

.rv-header-cell--metric-select > *:first-child {
  flex: 0 1 auto;
  min-width: 0;
}

.rv-header-cell--metric-select > * + * {
  flex: none;
}

.rv-header-cell__text {
  width: 100%;
  min-width: 0;
  text-align: inherit;
}

.rv-header-cell--sorted-desc {
  color: var(--ui-table-delta-pos);
}

.rv-header-cell--sorted-asc {
  color: var(--ui-table-delta-neg);
}

.rv-sort-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  padding: 0;
  border: 0;
  background: transparent;
  /* Donor thead: same grey as header label, not brand/muted mix. */
  color: inherit;
  cursor: pointer;
  border-radius: var(--ui-table-radius-sm);
}

.rv-sort-btn:hover {
  color: inherit;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.rv-sort-btn--active {
  color: inherit;
}

.rv-sort-btn__icon {
  display: block;
  width: 0.85em;
  height: 0.62em;
  transition: transform var(--rv-ui-motion-feedback)
    var(--rv-ui-motion-ease-default);
  /* Donor OrderIcon: default rotated; DESC = 0°, ASC = 180°. */
  transform: rotate(180deg);
  opacity: 1;
}

.rv-sort-btn--active .rv-sort-btn__icon {
  opacity: 1;
}

.rv-sort-btn__icon--desc {
  transform: rotate(0deg);
}

.rv-sort-btn__icon--asc {
  transform: rotate(180deg);
}

.rv-trunc-cell {
  overflow: hidden;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-family: var(--ui-table-font-family);
  font-size: inherit;
  line-height: inherit;
  color: var(--ui-table-fg);
}

.rv-trunc-cell--start {
  text-align: start;
}

.rv-trunc-cell--center {
  text-align: center;
}

.rv-trunc-cell.rv-trunc-text--single {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rv-num-cell--bar {
  position: relative;
}

.rv-num-cell__bar {
  position: absolute;
  inset-block: 10%;
  inset-inline-start: 0;
  z-index: 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ui-table-brand) 18%, transparent);
  pointer-events: none;
}

/* Hug digits+unit when they fit (parent centers). When the col is
   the digit floor, min-width:0 lets the unit yield — otherwise
   justify:center + overflow:hidden clips «1» from «1,54 тыс.». */
.rv-num-cell__content {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
}

.rv-rank-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-width: 0;
  font-family: var(--ui-table-font-family);
  font-variant-numeric: tabular-nums;
  font-size: inherit;
  /* Donor .rank: № приглушён как заголовки, не как рабочая область. */
  color: var(--ui-table-fg-muted);
  line-height: inherit;
}

.rv-rank-cell--center {
  justify-content: center;
}

/* Donor .rankTopBadge (frontend issue 381): компактный скруглённый ПРЯМОУГОЛЬНИК (не pill
   999px). φ-геометрия inline-label-badge-table: block 1em/φ², inline 1em/φ;
   radius 0.5em ≈ донорские 6px при 12px кегле. */
.rv-rank-cell__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  /* Equal width in the column — widest rank (donor slot 1.83em). */
  min-width: 1.83em;
  padding-block: 0.382em;
  padding-inline: 0.618em;
  border-radius: 0.5em;
  background: var(
    --rv-ui-table-row-selected-bg,
    color-mix(in srgb, var(--ui-table-brand) 14%, transparent)
  );
  color: var(--ui-table-fg);
  font-weight: var(--ui-table-font-weight-semibold);
  font-size: inherit;
  line-height: 1;
}

/* Donor .rankSlot: min-width под выравнивание колонки (22px @ 12px кегле). */
.rv-rank-cell__slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  min-width: 1.83em;
  font-variant-numeric: tabular-nums;
  font-weight: var(--ui-table-font-weight-semibold);
}

.rv-bar-cell {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 100%;
}

.rv-bar-cell__track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ui-table-fg) 8%, transparent);
  overflow: hidden;
}

.rv-bar-cell__fill {
  height: 100%;
  border-radius: 4px;
}

.rv-num-unit {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: var(--table-numeric-align, center);
  width: max-content;
  max-width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.rv-num-unit__sign,
.rv-num-unit__value {
  flex: 0 0 auto;
}

.rv-num-unit__sep {
  flex: 0 0 auto;
  white-space: pre;
}

.rv-num-unit__unit {
  flex: 0 0 auto;
  white-space: nowrap;
  /* Donor .numericUnit: inherit cell/delta color, not muted label. */
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

/* `%` sits flush against the digits and belongs to the T1 floor — it never yields. */
.rv-num-unit__percent-glyph {
  display: inline-block;
  white-space: nowrap;
}

.rv-num-unit__unit .rv-trunc-text {
  width: 100%;
}

.rv-metric-pair {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: var(--table-numeric-align, center);
  align-items: baseline;
  gap: var(--ui-table-space-xs);
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-size: var(--ui-table-font-size-body);
}

.rv-metric-pair--center {
  justify-content: center;
}

.rv-metric-pair--end {
  justify-content: end;
}

.rv-metric-pair__value {
  text-align: end;
  color: var(--ui-table-fg);
}

.rv-metric-pair__delta {
  text-align: start;
  color: var(--ui-table-fg-muted);
  font-size: var(--ui-table-font-size-label);
}

.rv-metric-pair__delta--up {
  color: var(--ui-table-delta-pos);
}

.rv-metric-pair__delta--down {
  color: var(--ui-table-delta-neg);
}

.rv-flex-metric {
  display: flex;
  align-items: center;
  gap: var(--table-cell-inner-gap, var(--table-cell-padding-inline, var(--rv-ui-space-sm, 8px)));
  width: 100%;
  min-width: 0;
  height: 100%;
}

/* Row interaction: hover feedback + cross-widget selection. */
.rv-schema-table__row--interactive {
  cursor: pointer;
}

.rv-schema-table__row--interactive:hover > td {
  background-color: var(--rv-ui-table-row-hover-bg, transparent);
}

.rv-schema-table__row--selected > td {
  background-color: var(--rv-ui-table-row-selected-bg, transparent);
}

.rv-flex-metric--collapsed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.rv-flex-metric--clickable {
  cursor: pointer;
}



.rv-ui-table-tier-text {
  min-width: 0;
}

/* DataTableHost — semantic table shell (loading / error / empty) */

.rv-table-host {
  /* Inherit --table-cell-padding-* from host body. Do not re-alias
     --table-cell-padding-inline ← --rv-ui-table-cell-padding-inline here:
     the bridge is the reverse, and rebinding cycles (used pad → 0). */
  --table-cell-inner-gap: var(
    --table-cell-padding-inline,
    var(--rv-ui-table-cell-padding-inline, var(--rv-ui-space-sm))
  );
  width: 100%;
  min-width: 0;
  min-height: 0;
  /* Fill WidgetCard.Body (3-port): host owns the used height, body region scrolls. */
  flex: 1 1 0;
  height: 100%;
  /* Donor type-body-sm — host --rv-ui-table-font-size, else kit body. */
  font-family: var(--ui-table-font-family);
  font-size: var(--rv-ui-table-font-size, var(--ui-table-font-size-body));
  line-height: var(--rv-ui-table-line-height, var(--ui-table-line-height));
  color: var(--ui-table-fg);
  /* Unsplit: host is the scrollport. Split: body region scrolls (see --split). */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rv-table-host::-webkit-scrollbar,
.rv-table-host__body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Head outside the scrollport; only .rv-table-host__body overflows. */
.rv-table-host--split {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rv-table-host__head {
  flex: 0 0 auto;
  overflow: hidden;
  background-color: var(--rv-ui-table-header-bg, var(--rv-ui-color-surface));
}

.rv-table-host__body {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rv-table-host__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rv-table-host__table th,
.rv-table-host__table td {
  box-sizing: border-box;
  vertical-align: middle;
  overflow: hidden;
  min-width: 0;
  position: relative;
  z-index: 0;
  padding: 0;
  border: 0;
  /* Donor DataTable: --table-row-border via host Style port. */
  border-block-end: var(
    --rv-ui-table-row-border,
    1px solid color-mix(in srgb, var(--rv-ui-color-fg) 12%, transparent)
  );
}

.rv-table-host__table th {
  color: var(--ui-table-fg-muted);
  background-color: var(--rv-ui-table-header-bg, var(--rv-ui-color-surface));
}

/* Donor: padding on inner .cell / .headerCell, not th/td (fold + layout measure). */
.rv-table-host__table td > * {
  box-sizing: border-box;
  padding: var(
      --table-cell-padding-block,
      var(--rv-ui-table-cell-padding-block, var(--rv-ui-space-sm))
    )
    var(
      --table-cell-padding-inline,
      var(--rv-ui-table-cell-padding-inline, var(--rv-ui-space-sm))
    );
}

/* Donor SparklineCell: absolute fill of td (padding lives on text cells, not chart).
   Standalone spark is often wrapped in FlexMetricCell for the width gate —
   that wrapper must stay a direct td child and carry the same fill, or the
   SVG measures a few pixels of height and the line goes flat. */
.rv-table-host__table td > [data-ui-table-spark],
.rv-table-host__table td > .rv-flex-metric--fill {
  position: absolute;
  inset: 0;
  padding: 0;
}

.rv-table-host__thead {
  background-color: var(--rv-ui-table-header-bg, var(--rv-ui-color-surface));
}

.rv-table-host__state {
  padding: var(--rv-ui-space-lg) var(--rv-ui-space-md);
  text-align: center;
  color: var(--ui-table-fg-muted);
  font-size: var(--ui-table-font-size-body);
  line-height: var(--ui-table-line-height);
}

/* SchemaTable — donor FE formulaLayout path (colgroup is sole width source). */

/* Auto-layout paint before first canvas measure is the visible two-pass shift. */
.rv-schema-table:not(.rv-schema-table--layout-ready) .rv-schema-table__table,
.rv-schema-table:not(.rv-schema-table--layout-ready) .rv-table-host__table {
  visibility: hidden;
}

.rv-schema-table.rv-schema-table--layout-ready .rv-schema-table__table,
.rv-schema-table.rv-schema-table--layout-ready .rv-table-host__table {
  table-layout: fixed;
  /* Fit host. Sparks share leftover evenly or all collapse — never Σ > clip. */
  width: 100%;
  max-width: 100%;
}

.rv-schema-table.rv-schema-table--layout-ready th,
.rv-schema-table.rv-schema-table--layout-ready td {
  overflow: hidden;
}

.rv-schema-table__header-fit {
  width: 0;
  min-width: 100%;
  overflow: hidden;
}

.rv-schema-table.rv-schema-table--layout-ready col.rv-schema-table__col--shift {
  transition:
    width var(--rv-ui-motion-layout-shift, 375ms)
    var(--rv-ui-motion-ease-default, cubic-bezier(0.25, 0.1, 0.25, 1));
}

/* Cells ride the animating colgroup. Hiding them for the whole shift (donor
   behaviour) is what reads as the table blinking on a metric switch — content
   only hides when there is nothing to preserve (`--query-layout`). */
.rv-schema-table--query-layout
  .rv-table-host__tbody
  td:not(.rv-table-host__state)
  > * {
  opacity: 0;
  transition: none;
}

.rv-schema-table--layout-ready:not(.rv-schema-table--query-layout)
  .rv-table-host__tbody
  td:not(.rv-table-host__state)
  > * {
  opacity: 1;
  transition:
    opacity var(--rv-ui-motion-data-change, 180ms)
    var(--rv-ui-motion-ease-default, cubic-bezier(0.25, 0.1, 0.25, 1));
}

/* Surface pulse while a settled query change repaints the body. */
.rv-schema-table__body--surface {
  transition:
    opacity var(--rv-ui-motion-data-change, 180ms)
    var(--rv-ui-motion-ease-default, cubic-bezier(0.25, 0.1, 0.25, 1));
}

/* Donor `.refreshingTable`: painted rows are stale, not gone. */
.rv-schema-table__body--refreshing {
  opacity: var(--rv-ui-table-refreshing-opacity, 0.88);
  transition:
    opacity var(--rv-ui-motion-data-change, 180ms)
    var(--rv-ui-motion-ease-default, cubic-bezier(0.25, 0.1, 0.25, 1));
}

@media (prefers-reduced-motion: reduce) {
  .rv-schema-table.rv-schema-table--layout-ready col.rv-schema-table__col--shift {
    transition: none;
  }

  .rv-schema-table__body--surface,
  .rv-schema-table__body--refreshing {
    transition: none;
  }

  .rv-schema-table--query-layout
    .rv-table-host__tbody
    td:not(.rv-table-host__state)
    > *,
  .rv-schema-table--layout-ready:not(.rv-schema-table--query-layout)
    .rv-table-host__tbody
    td:not(.rv-table-host__state)
    > * {
    opacity: 1;
    transition: none;
  }
}

/* Surface for the page in flight: the body must not end at the last loaded
   row while the reader is still moving. */
.rv-schema-table__row--pending > td {
  border-block-end: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
}

.rv-schema-table__row--pending .rv-skeleton {
  width: 100%;
  opacity: 0.5;
}

/* Cursor pagination feedback — donor ProgressRow (three bouncing dots).
   Height stays 0: a growing row would push the list under the reader. */
.rv-schema-table__progress-row {
  height: 0;
}

.rv-schema-table__progress-cell {
  position: relative;
  height: 0;
  padding: 0;
  overflow: visible;
  border: none !important;
}

.rv-schema-table__progress-anchor {
  position: absolute;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.rv-schema-table__progress-anchor--top {
  top: 0;
}

.rv-schema-table__progress-anchor--bottom {
  bottom: 0;
}

.rv-schema-table__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rv-ui-space-xs, 4px);
  padding: var(--rv-ui-space-xs, 4px) var(--rv-ui-space-sm, 8px);
  border-radius: var(--rv-ui-radius-md, 8px);
  background-color: var(--rv-ui-color-surface, transparent);
}

.rv-schema-table__dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background-color: var(--rv-ui-color-accent, currentColor);
  animation: rv-schema-table-dot-bounce 1.4s ease-in-out infinite both;
}

.rv-schema-table__dot:nth-child(1) {
  animation-delay: -0.32s;
}

.rv-schema-table__dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes rv-schema-table-dot-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-schema-table__dot {
    animation: none;
    opacity: 0.7;
  }
}

.rv-schema-table__th--fit {
  width: 0;
  min-width: 100%;
  overflow: hidden;
}

.rv-schema-table__cell--collapsed,
.rv-schema-table__col--collapsed {
  width: 0 !important;
  max-width: 0;
  min-width: 0;
  padding: 0 !important;
  border: 0;
  overflow: hidden;
  visibility: collapse;
  font-size: 0;
  line-height: 0;
}

.rv-schema-table__group-row .rv-schema-table__group {
  text-align: center;
  font-family: var(--ui-table-font-family);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ui-table-fg-muted, var(--rv-ui-color-fg-muted));
  border-bottom: 1px solid var(--ui-table-border, var(--rv-ui-color-border));
  padding: var(--table-cell-padding-block) var(--table-cell-padding-inline);
  background-color: var(--rv-ui-table-header-bg);
}

.rv-schema-table__group[data-tone="fact"] {
  background-color: color-mix(
    in srgb,
    var(--rv-ui-color-positive) 8%,
    var(--rv-ui-table-header-bg)
  );
}

.rv-schema-table__group[data-tone="plan"] {
  background-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 8%,
    var(--rv-ui-table-header-bg)
  );
}

.rv-schema-table__stack-header {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1.15;
}

.rv-schema-table__stack-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--ui-table-fg-muted, var(--rv-ui-color-fg-muted));
  text-transform: none;
  letter-spacing: 0;
}

.rv-schema-table__th--sortable {
  cursor: pointer;
  user-select: none;
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}

/*
 * @rv/ui-spark — theme via CSS variables (shared with ui-table / ui-kpi).
 */

.rv-sparkline-cell {
  --rv-spark-min: 48px;
  --rv-ui-spark-stroke-width: 2.5;
  --rv-ui-spark-fill-opacity: 0.4;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  /* Donor row = pad×2 + lh + hairline. min-height:0 + height:100% in a
     spark-only td collapses the viewBox to 1px (hairline, «пусто»). */
  min-height: var(--rv-ui-table-row-min-height);
  flex: 1 1 auto;
  align-items: stretch;
  container-type: inline-size;
}

.rv-sparkline-cell--fill {
  flex: 1 1 auto;
}

.rv-sparkline-cell__svg,
.rv-sparkline {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.rv-sparkline {
  overflow: hidden;
  touch-action: pan-y;
  outline: none;
}

.rv-sparkline__pointer-tooltip {
  transform: translate(12px, calc(-100% - 12px));
}

.rv-sparkline:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-sparkline__line,
.rv-sparkline__area,
.rv-sparkline__dot,
.rv-sparkline__active-dot {
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
  transform-box: fill-box;
  transform-origin: center;
}

.rv-sparkline__active-dot {
  pointer-events: none;
}

/* Full viewBox capture — SVG empty space does not hit the root (FE Recharts overlay). */
.rv-sparkline__hit {
  pointer-events: all;
  fill: transparent;
}

.rv-sparkline__tooltip-content {
  display: grid;
  gap: var(--rv-ui-space-xs);
  min-width: max-content;
  font-family: var(--rv-ui-font-family);
}

.rv-sparkline__tooltip-label {
  color: var(--rv-ui-color-fg-muted);
  font-size: var(--rv-ui-font-size-label);
}

.rv-sparkline__tooltip-value {
  color: var(--rv-ui-color-fg);
  font-size: var(--rv-ui-font-size-body);
  font-variant-numeric: tabular-nums;
}

.rv-sparkline-cell__svg--fixed {
  flex: 0 1 auto;
  max-width: 100%;
}

/*
 * Collapse below --rv-spark-min (SparklineCell sets inline; default 48px).
 * Primary SoT for formula layout: @rv/ui-table useFlexChartRenderable (ResizeObserver).
 * CSS container query = fallback when hook is not wired.
 */
@container (max-width: var(--rv-spark-min, 48px)) {
  .rv-sparkline-cell {
    display: none;
  }
}

.rv-ui-table-tier-spark {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rv-sparkline__line,
  .rv-sparkline__area,
  .rv-sparkline__dot,
  .rv-sparkline__active-dot {
    transition-duration: 0ms;
  }
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}

/*
 * @rv/ui-chrome — portable chrome controls.
 * Structure only. Host theme is the required --rv-ui-* contract.
 */

/*
 * body, не :root: --rv-ui-* приходят из host-темы на body (semantic-токены
 * хостов живут на body/body.dark); на html они invalid.
 */
body {
  --ui-chrome-fg: var(--rv-ui-color-fg);
  --ui-chrome-fg-muted: var(--rv-ui-color-fg-muted);
  --ui-chrome-brand: var(--rv-ui-color-brand);
  --ui-chrome-brand-hover: var(--rv-ui-color-brand-hover);
  /* Calendar selection / year hover. Host may remap (Sibagro → paprika). */
  --ui-chrome-accent: var(--rv-ui-color-brand);
  --ui-chrome-surface: var(--rv-ui-color-surface);
  --ui-chrome-bg: var(--rv-ui-color-surface-elevated);
  --ui-chrome-border: var(--rv-ui-color-border);
  --ui-chrome-radius-sm: var(--rv-ui-radius-sm);
  --ui-chrome-radius-md: var(--rv-ui-radius-md);
  --ui-chrome-inverse: var(--rv-ui-color-on-accent);
  --ui-chrome-error: var(--rv-ui-color-error);
  --ui-chrome-font-size-body: var(--rv-ui-font-size-body);
  --ui-chrome-font-size-label: var(--rv-ui-font-size-label);
  --ui-chrome-font-weight-regular: var(--rv-ui-font-weight-regular);
  --ui-chrome-font-weight-medium: var(--rv-ui-font-weight-medium);
  --ui-chrome-font-weight-semibold: var(--rv-ui-font-weight-semibold);
  --ui-chrome-line-height: var(--rv-ui-line-height-body);

  /* C-P2-1 — chrome control dimensions (fallback px @ FHD). */
  --rv-ui-chrome-select-trigger-height: 28px;
  --rv-ui-chrome-multi-trigger-min-height: 32px;
  --rv-ui-chrome-button-height-md: 36px;
  --rv-ui-chrome-button-height-lg: 44px;
  --rv-ui-chrome-chevron-size: 10px;
  --rv-ui-chrome-multi-trigger-max-width: 220px;
  --rv-ui-chrome-multi-menu-min-width: 220px;
  --rv-ui-chrome-multi-menu-max-width: 360px;
  --rv-ui-chrome-multi-list-max-height: 260px;
  --rv-ui-chrome-check-size: 14px;
  --rv-ui-chrome-check-border-width: 1.5px;
  --rv-ui-chrome-check-radius: 3px;
  --rv-ui-chrome-menu-offset-sm: 4px;
  --rv-ui-chrome-menu-offset-md: 6px;
  --rv-ui-chrome-year-nav-gap: 12px;
  --rv-ui-chrome-radius-pill: 999px;
  --rv-ui-chrome-badge-heat-pad-block: 2px;
  --rv-ui-chrome-badge-heat-pad-inline: 10px;
  --rv-ui-chrome-badge-value-pad-block: 8px;
  --rv-ui-chrome-badge-value-pad-inline: 14px;
  /* Инлайн-паддинг триггера: @rv/ui-table считает по нему header chrome. */
  --rv-ui-chrome-select-trigger-pad-inline: 2px;
  /* Donor floating bar: text + 12×24 V, gap 6px @ FHD. */
  --rv-ui-chrome-nav-chevron-width: 12px;
  --rv-ui-chrome-nav-chevron-height: 24px;
  --rv-ui-chrome-nav-chevron-gap: 6px;
  /* Donor widget header — compact, same row as title (not toolbar 36). */
  --rv-ui-chrome-search-height: 32px;
  --rv-ui-chrome-search-min-width: 8rem;
  --rv-ui-chrome-search-radius: 8px;
  --rv-ui-chrome-search-pad-block: 4px;
  --rv-ui-chrome-search-pad-inline: 10px;
  --rv-ui-chrome-toggle-height: 28px;
  /* light-dark() = <color> only (host body color-scheme). Light: gray well +
     white thumb — oklch(l-0.07) on a white card is invisible. Dark: unchanged. */
  --rv-ui-chrome-toggle-track-bg: light-dark(
    color-mix(in srgb, var(--ui-chrome-fg) 16%, var(--ui-chrome-bg)),
    oklch(from var(--ui-chrome-surface) calc(l - 0.07) c h / 0.78)
  );
  --rv-ui-chrome-toggle-track-border: color-mix(
    in srgb,
    var(--ui-chrome-fg) 28%,
    transparent
  );
  --rv-ui-chrome-toggle-track-shadow: inset 0 1px 3px
    color-mix(in srgb, var(--ui-chrome-fg) 16%, transparent);
  --rv-ui-chrome-toggle-thumb-bg: light-dark(
    var(--ui-chrome-surface),
    oklch(from var(--ui-chrome-bg) calc(l + 0.08) c h)
  );
  --rv-ui-chrome-toggle-thumb-shadow:
    0 1px 0 color-mix(in srgb, var(--ui-chrome-fg) 20%, transparent),
    0 2px 8px color-mix(in srgb, var(--ui-chrome-fg) 14%, transparent);
  /* Dropdown panel — one substrate for bar, table header and month calendar.
     Host publishes --shell-chrome-bar-dropdown-* on <body>, so portaled panels
     resolve them as well; px here is the standalone FHD fallback. */
  --rv-ui-chrome-dropdown-panel-bg: var(
    --shell-chrome-bar-dropdown-panel,
    var(--ui-chrome-surface)
  );
  --rv-ui-chrome-dropdown-panel-border-color: var(
    --shell-chrome-bar-dropdown-panel-border,
    var(--ui-chrome-border)
  );
  --rv-ui-chrome-dropdown-panel-shadow: var(
    --shell-chrome-bar-dropdown-panel-shadow,
    var(--rv-ui-shadow-popover)
  );
  --rv-ui-chrome-dropdown-panel-radius: var(
    --shell-chrome-bar-dropdown-panel-radius,
    12px
  );
  --rv-ui-chrome-dropdown-panel-pad-block: var(
    --shell-chrome-bar-dropdown-panel-pad-block,
    12px
  );
  --rv-ui-chrome-dropdown-panel-pad-inline: var(
    --shell-chrome-bar-dropdown-panel-pad-inline,
    12px
  );
  --rv-ui-chrome-dropdown-option-pad-block: var(
    --shell-chrome-bar-dropdown-option-pad-block,
    6px
  );
  --rv-ui-chrome-dropdown-option-pad-inline: var(
    --shell-chrome-bar-dropdown-option-pad-inline,
    12px
  );

  /* Nav rail — icon-колонка равна ширине контента свёрнутого рельса. */
  --rv-ui-chrome-nav-row-height: 32px;
  --rv-ui-chrome-nav-row-radius: 6px;
  --rv-ui-chrome-nav-row-gap: 2px;
  --rv-ui-chrome-nav-group-gap: 16px;
  --rv-ui-chrome-nav-icon-col: 32px;
  --rv-ui-chrome-nav-icon-size: 20px;
  --rv-ui-chrome-nav-label-gap: 10px;
  --rv-ui-chrome-nav-indent: 14px;
  --rv-ui-chrome-nav-rail-pad: 8px;
  /* Потолок оверлея, не ширина: развёрнутый рельс = max-content подписей. */
  --rv-ui-chrome-nav-rail-width: 80vw;
  /* Donor floating L1: one rhythm for slots and clusters (FHD 16). */
  --rv-ui-chrome-bar-slot-gap: 16px;
  --rv-ui-chrome-bar-cluster-gap: 16px;
  /* Bar type — Anthropic 14 / lh 1.4: bar text and closed select triggers. */
  --rv-ui-chrome-bar-font-size: 14px;
  --rv-ui-chrome-bar-letter-spacing: 0.01em;
  --rv-ui-chrome-bar-line-height: 1.4;
  /* Opened list — 12 in the same Anthropic face. Menus portal to <body>, so the
     face cannot be inherited from the bar or a table header — keep it on tokens. */
  --rv-ui-chrome-select-font-size: var(--density-type-body-sm-fs, 12px);
  --rv-ui-chrome-select-font-family: var(
    --font-chrome-bar,
    var(--rv-ui-font-family)
  );

  --rv-ui-chrome-nav-row-bg-hover: color-mix(
    in srgb,
    var(--ui-chrome-fg) 8%,
    transparent
  );
  --rv-ui-chrome-nav-row-bg-active: color-mix(
    in srgb,
    var(--ui-chrome-brand) 12%,
    transparent
  );
}

/* ─── Button ─── */

.rv-button {
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  border: var(--rv-ui-border-width) solid transparent;
  border-radius: var(--ui-chrome-radius-md);
  font: inherit;
  font-weight: var(--ui-chrome-font-weight-medium);
  line-height: var(--ui-chrome-line-height);
  white-space: nowrap;
  cursor: pointer;
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default),
    border-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default);
}

.rv-button:hover:not(:disabled) {
  opacity: 0.92;
}

.rv-button:focus-visible,
.rv-select__trigger:focus-visible,
.rv-multi-select__trigger:focus-visible,
.rv-multi-select__search input:focus-visible,
.rv-select__option:focus-visible,
.rv-multi-select__option:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-button:disabled,
.rv-button--loading {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.65;
}

.rv-button--medium {
  min-height: var(--rv-ui-chrome-button-height-md);
  padding: 8px 16px;
  font-size: var(--ui-chrome-font-size-body);
}

.rv-button--large {
  min-height: var(--rv-ui-chrome-button-height-lg);
  padding: 12px 20px;
  font-size: var(--ui-chrome-font-size-body);
}

.rv-button--unsized {
  min-height: 0;
  padding: 0;
}

.rv-button--full {
  width: 100%;
}

.rv-button--primary {
  background: var(--ui-chrome-brand);
  color: var(--ui-chrome-inverse);
}

.rv-button--primary:hover:not(:disabled) {
  background: var(--ui-chrome-brand-hover);
}

.rv-button--secondary {
  background: transparent;
  color: var(--ui-chrome-fg);
  border-color: var(--ui-chrome-border);
}

.rv-button--outlined {
  background: var(--ui-chrome-surface);
  color: var(--ui-chrome-brand);
  border-color: var(--ui-chrome-brand);
}

.rv-button--base {
  background: var(--ui-chrome-brand);
  color: var(--ui-chrome-inverse);
  border: none;
  font-weight: var(--ui-chrome-font-weight-semibold);
  border-radius: var(--ui-chrome-radius-sm);
}

.rv-button--icon {
  width: var(--rv-ui-chrome-button-height-md);
  height: var(--rv-ui-chrome-button-height-md);
  min-height: var(--rv-ui-chrome-button-height-md);
  padding: 0;
  background: transparent;
  color: var(--ui-chrome-fg-muted);
  border-radius: var(--rv-ui-chrome-radius-pill);
}

.rv-button--icon.rv-button--large {
  width: var(--rv-ui-chrome-button-height-lg);
  height: var(--rv-ui-chrome-button-height-lg);
  min-height: var(--rv-ui-chrome-button-height-lg);
}

.rv-button--icon.rv-button--active {
  background: var(--ui-chrome-brand);
  color: var(--ui-chrome-inverse);
}

.rv-button__inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rv-button__spinner {
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: rv-button-spin var(--rv-ui-motion-duration-lg) linear infinite;
}

@keyframes rv-button-spin {
  to {
    transform: rotate(360deg);
  }
}

.rv-button__icon {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

/* ─── Select + MultipleSelect: one bar trigger (donor toolbar-nav) ─── */

.rv-select,
.rv-multi-select {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Donor ChromeBarSelect compactTrigger: hug current label, not mode floor. */
.rv-select--compact {
  width: max-content;
  max-width: 100%;
  flex: 0 0 auto;
}

.rv-select--compact .rv-select__value {
  min-width: 0;
  width: auto;
  flex: 0 0 auto;
}

.rv-multi-select {
  max-width: 100%;
}

.rv-select__trigger,
.rv-multi-select__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--rv-ui-chrome-nav-chevron-gap);
  height: auto;
  min-height: unset;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: var(--ui-chrome-font-weight-medium);
  line-height: var(--ui-chrome-line-height);
  white-space: nowrap;
  cursor: pointer;
}

.rv-multi-select__trigger {
  max-width: max-content;
}

.rv-select__trigger:disabled,
.rv-multi-select__trigger:disabled {
  opacity: 0.45;
  cursor: default;
}

.rv-select__trigger:hover,
.rv-select--open .rv-select__trigger,
.rv-select__trigger[aria-expanded="true"],
.rv-multi-select__trigger:hover,
.rv-multi-select--open .rv-multi-select__trigger {
  background: transparent;
  color: inherit;
}

/* Search trigger is a div (input cannot nest in a button) — same box, text caret. */
.rv-select__trigger--search {
  cursor: text;
}

/*
 * Width follows the measured label floor, so opening search does not resize
 * the trigger; without the var (tableHeader) a readable default keeps the caret.
 */
.rv-select__search {
  box-sizing: content-box;
  width: calc(var(--chrome-dropdown-label-min-ch, 10) * 1ch);
  min-width: 4ch;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
}

.rv-select__search:focus {
  outline: none;
}

.rv-select__search::placeholder {
  color: var(--ui-chrome-fg-muted);
  opacity: 1;
}

.rv-select__prefix {
  color: var(--ui-chrome-fg-muted);
  font-weight: var(--ui-chrome-font-weight-regular);
}

.rv-select__prefix::after {
  content: "\00a0";
}

.rv-select__value {
  font-weight: var(--ui-chrome-font-weight-medium);
  min-width: calc(var(--chrome-dropdown-label-min-ch, 0) * 1ch);
}

.rv-select__chevron,
.rv-multi-select__chevron,
.rv-period-picker__chevron {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--rv-ui-chrome-nav-chevron-width);
  height: var(--rv-ui-chrome-nav-chevron-height);
  color: inherit;
  line-height: 0;
  transform: none;
  transition: transform var(--rv-ui-motion-feedback)
    var(--rv-ui-motion-ease-default);
}

.rv-select--open .rv-select__chevron,
.rv-multi-select--open .rv-multi-select__chevron,
.rv-period-picker__trigger[aria-expanded="true"] .rv-period-picker__chevron {
  transform: rotate(180deg);
}

.rv-select__chevron svg,
.rv-multi-select__chevron svg,
.rv-period-picker__chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .rv-select__chevron,
  .rv-multi-select__chevron,
  .rv-period-picker__chevron {
    transition: none;
  }
}

.rv-select__menu {
  position: absolute;
  top: calc(100% + var(--rv-ui-chrome-menu-offset-sm));
  left: 0;
  z-index: var(--rv-ui-z-popover);
  /* Donor ChromeBarSelect toolbar: hug labels, no 16ch floor. */
  box-sizing: border-box;
  width: max-content;
  min-width: max(
    100%,
    calc(var(--chrome-dropdown-menu-min-ch, 0) * 1ch)
  );
  margin: 0;
  list-style: none;
  background: var(--rv-ui-chrome-dropdown-panel-bg);
  color: var(--ui-chrome-fg);
  border: var(--rv-ui-border-width) solid
    var(--rv-ui-chrome-dropdown-panel-border-color);
  border-radius: var(--rv-ui-chrome-dropdown-panel-radius);
  padding: var(--rv-ui-chrome-dropdown-panel-pad-block)
    var(--rv-ui-chrome-dropdown-panel-pad-inline);
  font-family: var(--rv-ui-chrome-select-font-family, inherit);
  font-size: var(--rv-ui-chrome-select-font-size, 12px);
  box-shadow: var(--rv-ui-chrome-dropdown-panel-shadow);
}

/* Portal menu: coords via inline fixed style; keep hug (donor toolbar). */
.rv-select__menu--portal {
  top: auto;
  left: auto;
  width: max-content;
  min-width: max(
    100%,
    calc(var(--chrome-dropdown-menu-min-ch, 0) * 1ch)
  );
  overflow: auto;
}

.rv-select__option,
.rv-multi-select__option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}

.rv-select__option {
  padding: var(--rv-ui-chrome-dropdown-option-pad-block)
    var(--rv-ui-chrome-dropdown-option-pad-inline);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.rv-multi-select__option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rv-select__option:hover,
.rv-select__option--focused {
  color: var(--ui-chrome-fg);
  background: transparent;
  text-decoration-color: currentColor;
}

.rv-multi-select__option:hover,
.rv-multi-select__option--focused {
  color: var(--ui-chrome-fg);
  background: color-mix(in srgb, var(--ui-chrome-fg) 6%, transparent);
}

.rv-select__option--active {
  color: var(--ui-chrome-fg);
  font-weight: var(--ui-chrome-font-weight-medium);
  text-decoration-color: currentColor;
}

/* Stays readable in the list, but reads as unavailable and never underlines. */
.rv-select__option--disabled,
.rv-select__option--disabled:hover {
  opacity: 0.45;
  cursor: default;
  text-decoration-color: transparent;
}

.rv-multi-select__option--selected {
  color: var(--ui-chrome-fg);
  font-weight: var(--ui-chrome-font-weight-semibold);
}

.rv-select--table-header {
  display: inline-flex;
  flex: 0 1 auto;
  width: max-content;
  min-width: 0;
  max-width: 100%;
}

/*
 * tableHeader = donor `.tableAnthropic` in thead: ghost trigger, no underline,
 * width = current label + chevron (not 100% of the col, not L1 underline).
 * Slot stretches (HeaderMetricSelect); sort sits at the header edge.
 */
.rv-select--table-header .rv-select__trigger {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  gap: 0.5em;
  justify-content: flex-start;
  border: none;
  border-radius: 0;
  border-bottom: none;
  background: transparent;
  box-shadow: none;
  color: var(--rv-ui-chrome-table-header-fg, var(--ui-chrome-fg));
  font: inherit;
  font-family: var(--rv-ui-chrome-select-font-family, inherit);
  font-size: var(--rv-ui-chrome-select-font-size, 12px);
  font-weight: var(--ui-chrome-font-weight-medium);
  line-height: inherit;
  white-space: nowrap;
}

.rv-select--table-header .rv-select__value {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: inherit;
  white-space: nowrap;
  text-align: left;
  color: inherit;
}

.rv-select--table-header .rv-select__chevron {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  /* Donor nav chevron 12×24 @ FHD; 1em×2em tracks table header type. */
  width: var(--rv-ui-chrome-table-header-chevron-width, 1em);
  height: var(--rv-ui-chrome-table-header-chevron-height, 2em);
  font-size: inherit;
  line-height: 0;
  color: inherit;
  transform: none;
}

.rv-select--table-header .rv-select__chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-select--table-header.rv-select--open .rv-select__trigger,
.rv-select--table-header .rv-select__trigger:hover {
  border-bottom: none;
  color: var(--rv-ui-chrome-table-header-fg, var(--ui-chrome-fg));
  background: transparent;
}

/* Substrate, radius, paddings and hug-to-labels width all stay on
   .rv-select__menu — one panel style for bar, table header and month calendar. */

.rv-select__menu--table-header .rv-select__option {
  background: transparent;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.rv-select__menu--table-header .rv-select__option:hover,
.rv-select__menu--table-header .rv-select__option--focused {
  background: transparent;
  color: var(--ui-chrome-fg);
  text-decoration-color: currentColor;
}

.rv-select__menu--table-header .rv-select__option--active {
  background: transparent;
  color: var(--rv-ui-chrome-table-header-fg, var(--ui-chrome-fg));
  font-weight: var(--ui-chrome-font-weight-medium);
  text-decoration-color: currentColor;
}

/* ─── MultipleSelect (menu / checklist; trigger shares Select) ─── */

.rv-multi-select__value {
  min-width: 0;
  max-width: var(--rv-ui-chrome-multi-trigger-max-width);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-multi-select__menu {
  position: absolute;
  top: calc(100% + var(--rv-ui-chrome-menu-offset-sm));
  left: 0;
  z-index: var(--rv-ui-z-popover);
  min-width: max(100%, var(--rv-ui-chrome-multi-menu-min-width));
  max-width: min(var(--rv-ui-chrome-multi-menu-max-width), 92vw);
  padding: 0;
  background: var(--rv-ui-chrome-dropdown-panel-bg);
  border: var(--rv-ui-border-width) solid
    var(--rv-ui-chrome-dropdown-panel-border-color);
  border-radius: var(--rv-ui-chrome-dropdown-panel-radius);
  font-family: var(--rv-ui-chrome-select-font-family, inherit);
  font-size: var(--rv-ui-chrome-select-font-size, 12px);
  box-shadow: var(--rv-ui-chrome-dropdown-panel-shadow);
  overflow: hidden;
}

/* Portal shell: coords via inline fixed style on wrapper. */
.rv-multi-select__menu--portal {
  position: static;
  top: auto;
  left: auto;
  min-width: 0;
  max-width: none;
  width: 100%;
  max-height: inherit;
  overflow: auto;
}

.rv-multi-select__search {
  padding: 8px 10px;
  border-bottom: var(--rv-ui-border-width) solid var(--ui-chrome-border);
}

.rv-multi-select__search input {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: var(--rv-ui-border-width) solid var(--ui-chrome-border);
  border-radius: var(--ui-chrome-radius-sm);
  background: var(--ui-chrome-bg);
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: var(--ui-chrome-font-size-body);
}

.rv-multi-select__list {
  list-style: none;
  margin: 0;
  padding: var(--rv-ui-chrome-menu-offset-md) 0;
  max-height: var(--rv-ui-chrome-multi-list-max-height);
  overflow: auto;
}

.rv-multi-select__check {
  flex: none;
  box-sizing: border-box;
  width: var(--rv-ui-chrome-check-size);
  height: var(--rv-ui-chrome-check-size);
  border: var(--rv-ui-chrome-check-border-width) solid
    color-mix(in srgb, var(--ui-chrome-fg) 35%, transparent);
  border-radius: var(--rv-ui-chrome-check-radius);
  background: transparent;
}

.rv-multi-select__check--on {
  border-color: var(--ui-chrome-brand);
  background: var(--ui-chrome-brand);
  box-shadow: inset 0 0 0 2px var(--ui-chrome-surface);
}

.rv-multi-select__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-multi-select__empty {
  padding: 12px;
  text-align: center;
  color: var(--ui-chrome-fg-muted);
  font-size: var(--ui-chrome-font-size-body);
}

/* ─── DropdownPopover (plain panel) ─── */

.rv-dropdown {
  position: relative;
  display: inline-flex;
}

.rv-dropdown__panel {
  box-sizing: border-box;
  overflow: auto;
  padding: var(--rv-ui-chrome-menu-offset-md) 0;
  background: var(--rv-ui-chrome-dropdown-panel-bg);
  color: var(--ui-chrome-fg);
  border: var(--rv-ui-border-width) solid
    var(--rv-ui-chrome-dropdown-panel-border-color);
  border-radius: var(--rv-ui-chrome-dropdown-panel-radius);
  box-shadow: var(--rv-ui-chrome-dropdown-panel-shadow);
}

/* ─── SearchField ─── */

.rv-search-field {
  box-sizing: border-box;
  display: inline-flex;
  width: 100%;
  min-width: var(--rv-ui-chrome-search-min-width);
  height: auto;
  min-height: var(--rv-ui-chrome-search-height);
  margin: 0;
  padding: var(--rv-ui-chrome-search-pad-block)
    var(--rv-ui-chrome-search-pad-inline);
  border: var(--rv-ui-border-width) solid var(--ui-chrome-border);
  border-radius: var(--rv-ui-chrome-search-radius);
  background: var(--ui-chrome-surface);
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: var(--ui-chrome-font-size-body);
  line-height: var(--ui-chrome-line-height);
}

.rv-search-field::placeholder {
  color: var(--ui-chrome-fg-muted);
}

.rv-search-field:focus-visible {
  outline: 2px solid var(--ui-chrome-brand);
  outline-offset: 1px;
}

.rv-search-field:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* ─── ToggleGroup — WidgetCard.Actions segmented control ─── */

.rv-toggle-group {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  isolation: isolate;
  gap: var(--rv-ui-space-xs);
  height: var(--rv-ui-chrome-toggle-height);
  padding: 2px;
  border: var(--rv-ui-border-width) solid var(--rv-ui-chrome-toggle-track-border);
  border-radius: var(--ui-chrome-radius-md);
  background: var(--rv-ui-chrome-toggle-track-bg);
  box-shadow: var(--rv-ui-chrome-toggle-track-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rv-toggle-group__item {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: var(--ui-chrome-radius-sm);
  background: transparent;
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: var(--ui-chrome-font-size-label);
  font-weight: var(--ui-chrome-font-weight-medium);
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-emphasized),
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-emphasized),
    box-shadow var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-emphasized);
}

.rv-toggle-group__item:hover:not([aria-pressed="true"]):not(:disabled) {
  color: var(--ui-chrome-fg);
  background: color-mix(in srgb, var(--ui-chrome-fg) 8%, transparent);
}

.rv-toggle-group__item[aria-pressed="true"] {
  background: var(--rv-ui-chrome-toggle-thumb-bg);
  color: var(--ui-chrome-fg);
  font-weight: var(--ui-chrome-font-weight-semibold);
  box-shadow: var(--rv-ui-chrome-toggle-thumb-shadow);
}

.rv-toggle-group__item:focus-visible {
  outline: 2px solid var(--ui-chrome-brand);
  outline-offset: 1px;
}

.rv-toggle-group__item:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .rv-toggle-group__item {
    transition: none;
  }
}

/* ─── NavRail / NavRow ─── */

.rv-nav-rail {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  width: max-content;
  max-width: var(--rv-ui-chrome-nav-rail-width);
  padding: var(--rv-ui-chrome-nav-rail-pad);
  gap: var(--rv-ui-chrome-nav-group-gap);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  transition: width var(--rv-ui-motion-layout-shift)
    var(--rv-ui-motion-ease-emphasized);
}

.rv-nav-rail[data-collapsed="true"] {
  width: calc(
    var(--rv-ui-chrome-nav-icon-col) + var(--rv-ui-chrome-nav-rail-pad) * 2
  );
  max-width: none;
}

.rv-nav-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--rv-ui-chrome-nav-row-gap);
}

.rv-nav-rail[data-collapsed="true"] .rv-nav-group {
  width: auto;
  min-width: 0;
}

.rv-nav-group[data-align="end"] {
  margin-top: auto;
}

.rv-nav-row {
  /* max-content — ширина рельса по самой длинной подписи; 1fr — хвост («Новинка») в одну колонку. */
  --rv-nav-label-col: minmax(max-content, 1fr);
  --rv-nav-col-gap: var(--rv-ui-chrome-nav-label-gap);
  --rv-nav-label-opacity: 1;
  --rv-nav-suffix-display: inline-flex;
  --rv-nav-row-indent: 0px;

  box-sizing: border-box;
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  padding-inline-start: var(--rv-nav-row-indent);
  border: 0;
  border-radius: var(--rv-ui-chrome-nav-row-radius);
  background: transparent;
  color: var(--ui-chrome-fg-muted);
  font: inherit;
  font-size: var(--ui-chrome-font-size-body);
  font-weight: var(--ui-chrome-font-weight-regular);
  line-height: var(--ui-chrome-line-height);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default),
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

.rv-nav-row[data-depth] {
  --rv-nav-row-indent: var(--rv-ui-chrome-nav-indent);
}

.rv-nav-rail[data-collapsed="true"] .rv-nav-row {
  width: 100%;
  --rv-nav-label-col: 0px;
  --rv-nav-col-gap: 0px;
  --rv-nav-label-opacity: 0;
  --rv-nav-suffix-display: none;
  --rv-nav-row-indent: 0px;
}

.rv-nav-row__inner {
  display: grid;
  grid-template-columns:
    var(--rv-ui-chrome-nav-icon-col)
    var(--rv-nav-label-col)
    auto;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: var(--rv-ui-chrome-nav-row-height);
  column-gap: var(--rv-nav-col-gap);
}

.rv-nav-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rv-nav-row__icon svg {
  width: var(--rv-ui-chrome-nav-icon-size);
  height: var(--rv-ui-chrome-nav-icon-size);
  flex-shrink: 0;
}

.rv-nav-row__label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: var(--rv-nav-label-opacity);
  transition: opacity var(--rv-ui-motion-exit) var(--rv-ui-motion-ease-default);
}

.rv-nav-row__suffix {
  display: var(--rv-nav-suffix-display);
  align-items: center;
  flex-shrink: 0;
}

.rv-nav-row:hover {
  background: var(--rv-ui-chrome-nav-row-bg-hover);
  color: var(--ui-chrome-fg);
}

.rv-nav-row:focus-visible {
  outline: 2px solid var(--ui-chrome-brand);
  outline-offset: 1px;
}

.rv-nav-row[data-accented="true"] {
  color: var(--ui-chrome-brand);
}

.rv-nav-row[data-active="true"] {
  background: var(--rv-ui-chrome-nav-row-bg-active);
  color: var(--ui-chrome-brand);
  font-weight: var(--ui-chrome-font-weight-medium);
}

.rv-nav-row:disabled,
.rv-nav-row[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
}

/* ─── ChromeBar / Group / Slot ─── */

.rv-chrome-bar {
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  gap: var(--rv-ui-chrome-bar-cluster-gap);
  --ui-chrome-font-size-label: var(--rv-ui-chrome-bar-font-size);
  --ui-chrome-font-size-body: var(--rv-ui-chrome-bar-font-size);
  font-size: var(--rv-ui-chrome-bar-font-size);
  font-weight: var(--ui-chrome-font-weight-medium);
  letter-spacing: var(--rv-ui-chrome-bar-letter-spacing);
  line-height: var(--rv-ui-chrome-bar-line-height);
}

.rv-chrome-bar-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
  gap: var(--rv-ui-chrome-bar-slot-gap);
}

.rv-chrome-bar-group[data-align="end"] {
  margin-inline-start: auto;
}

/* Donor AppHeader (frontend 559): lead+filters must shrink so inner
   ScrollableRow can overflow-x. Default group is flex-shrink:0 — that clips
   the bar instead of scrolling. */
.rv-chrome-bar-body {
  flex: 1 1 0;
  min-width: 0;
  flex-shrink: 1;
}

.rv-chrome-bar-scroll {
  gap: var(--rv-ui-chrome-bar-slot-gap);
  align-self: stretch;
}

.rv-chrome-bar-scroll--lead {
  flex: 0 1 auto;
  min-width: 0;
}

.rv-chrome-bar-scroll--main {
  flex: 1 1 0;
  min-width: 0;
}

.rv-chrome-bar-scroll .rv-chrome-bar-group {
  flex-shrink: 0;
}

.rv-chrome-bar-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-width: max-content;
}

/* Host composition (`zone=`): no ChromeBarGroup — slots join the host flex row. */
.rv-chrome-schema-host-slot {
  display: contents;
}

.rv-chrome-schema-label {
  /* shrink-to-fit: TruncedText width:100% + tooltip display:contents
     stretch a label across the toolbar and paint over the neighbour. */
  display: inline-block;
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  max-width: max-content;
  font-size: var(--ui-chrome-font-size-label);
  font-weight: var(--ui-chrome-font-weight-medium);
  color: var(--ui-chrome-fg);
  line-height: var(--ui-chrome-line-height);
}

/* ─── ScrollableRow / Breadcrumbs / MonthCalendar / ChromeBadge ─── */

.rv-scrollable-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.rv-scrollable-row::-webkit-scrollbar {
  display: none;
}

.rv-breadcrumbs {
  min-width: 0;
}

.rv-breadcrumbs__list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--rv-ui-chrome-bar-slot-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rv-breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: inherit;
  font: inherit;
  font-weight: var(--ui-chrome-font-weight-medium);
  line-height: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.rv-breadcrumbs__item[data-chrome-crumb="current"] {
  text-decoration-color: currentColor;
}

.rv-breadcrumbs__item[data-chrome-crumb="current"]:hover,
.rv-breadcrumbs:has([data-chrome-crumb="parent"] .rv-breadcrumbs__link:hover)
  [data-chrome-crumb="current"] {
  text-decoration: line-through;
  color: var(--ui-chrome-error);
}

.rv-breadcrumbs__link {
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-decoration: inherit;
}

.rv-breadcrumbs__link:focus-visible {
  outline: 2px solid var(--ui-chrome-brand);
  outline-offset: 1px;
}

.rv-period-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-chrome-bar-slot-gap);
  min-width: 0;
}

.rv-period-picker__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-chrome-nav-chevron-gap);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: var(--ui-chrome-font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
}

.rv-period-picker__trigger:focus-visible {
  outline: 2px solid var(--ui-chrome-brand);
  outline-offset: 1px;
}

.rv-period-picker__trigger-text {
  min-width: 0;
}

.rv-period-picker__grain {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

/* Donor: PeriodPicker calendar surface (G-MP-07 ≥320, padded panel). */
.rv-period-picker__panel {
  box-sizing: border-box;
  min-width: 320px;
  padding: var(--rv-ui-chrome-dropdown-panel-pad-block)
    var(--rv-ui-chrome-dropdown-panel-pad-inline);
}

.rv-month-calendar {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-chrome-bar-slot-gap);
  width: 100%;
  min-width: 0;
}

.rv-month-calendar__year-nav {
  --rv-month-year-size: calc(var(--ui-chrome-font-size-body) * 1.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rv-ui-chrome-year-nav-gap);
}

.rv-month-calendar__year,
.rv-month-calendar__year-nav-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding-block: 0.35em;
  padding-inline: 0.7em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.rv-month-calendar__year-nav-btn {
  min-width: 4.5ch;
  font-size: calc(var(--rv-month-year-size) * 0.66);
  font-weight: var(--ui-chrome-font-weight-medium);
  color: var(--ui-chrome-fg-muted);
  cursor: pointer;
}

.rv-month-calendar__year-nav-btn:hover:not(:disabled) {
  color: var(--ui-chrome-fg);
  background: transparent;
  text-decoration-color: currentColor;
}

.rv-month-calendar__year-nav-btn:disabled {
  color: var(--ui-chrome-fg-muted);
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none;
}

.rv-month-calendar__year-nav-btn:focus-visible {
  outline: 2px solid var(--ui-chrome-accent);
  outline-offset: 2px;
}

.rv-month-calendar__year {
  min-width: 5ch;
  font-size: var(--rv-month-year-size);
  font-weight: var(--ui-chrome-font-weight-semibold);
  color: var(--ui-chrome-fg);
  text-decoration-color: currentColor;
}

.rv-month-calendar__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: var(--rv-ui-chrome-button-height-lg);
  color: var(--ui-chrome-fg-muted);
  font-size: var(--ui-chrome-font-size-label);
  text-align: center;
}

.rv-month-calendar__viewport {
  overflow: hidden;
}

.rv-month-calendar__grid {
  display: grid;
  gap: var(--rv-ui-chrome-menu-offset-md);
  width: 100%;
}

.rv-month-calendar__grid[data-year-dir="next"] {
  animation: rv-month-year-in-next var(--rv-ui-motion-layout-shift)
    var(--rv-ui-motion-ease-emphasized) both;
}

.rv-month-calendar__grid[data-year-dir="prev"] {
  animation: rv-month-year-in-prev var(--rv-ui-motion-layout-shift)
    var(--rv-ui-motion-ease-emphasized) both;
}

@keyframes rv-month-year-in-next {
  from {
    transform: translateX(14px);
    opacity: 0.45;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes rv-month-year-in-prev {
  from {
    transform: translateX(-14px);
    opacity: 0.45;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-month-calendar__grid[data-year-dir] {
    animation: none;
  }
}

/* Donor L1 bar MonthCalendar: underline selected, not brand pill. */
.rv-month-calendar__month {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  margin: 0;
  padding: var(--rv-ui-chrome-dropdown-option-pad-block)
    var(--rv-ui-chrome-dropdown-option-pad-inline);
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: var(--ui-chrome-font-size-label);
  font-weight: var(--ui-chrome-font-weight-medium);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.rv-month-calendar__month[aria-pressed="true"] {
  background: transparent;
  color: var(--ui-chrome-fg);
  font-weight: var(--ui-chrome-font-weight-medium);
  text-decoration-color: currentColor;
}

.rv-month-calendar__month:hover:not(:disabled):not([aria-pressed="true"]) {
  background: transparent;
  text-decoration-color: currentColor;
}

.rv-month-calendar__month:disabled {
  background: transparent;
  color: var(--ui-chrome-fg-muted);
  cursor: not-allowed;
  text-decoration: none;
}

.rv-month-calendar__month:focus-visible {
  outline: 2px solid var(--ui-chrome-accent);
  outline-offset: 2px;
}

.rv-chrome-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0;
  padding: 2px 8px;
  border: 0;
  border-radius: var(--rv-ui-chrome-radius-pill);
  background: color-mix(in srgb, var(--ui-chrome-fg) 8%, transparent);
  color: var(--ui-chrome-fg);
  font: inherit;
  font-size: var(--ui-chrome-font-size-label);
}

/* label / delta / interactive — text. heat / value — pills. Host supplies --rv-chrome-badge-heat. */
.rv-chrome-badge[data-face="label"],
.rv-chrome-badge[data-face="delta"],
.rv-chrome-badge[data-face="interactive"] {
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.rv-chrome-badge[data-face="interactive"] {
  cursor: pointer;
}

.rv-chrome-badge[data-face="delta"] {
  color: var(--rv-chrome-badge-heat, var(--ui-chrome-fg));
  font-weight: var(--ui-chrome-font-weight-semibold);
}

.rv-chrome-badge[data-face="heat"] {
  padding: var(--rv-ui-chrome-badge-heat-pad-block)
    var(--rv-ui-chrome-badge-heat-pad-inline);
  border-radius: var(--rv-ui-chrome-radius-pill);
  font-variant-numeric: tabular-nums;
  font-weight: var(--ui-chrome-font-weight-semibold);
  color: var(--rv-chrome-badge-heat, var(--ui-chrome-fg));
  background: color-mix(
    in srgb,
    var(--rv-chrome-badge-heat, transparent) 16%,
    transparent
  );
}

.rv-chrome-badge[data-face="value"] {
  padding: var(--rv-ui-chrome-badge-value-pad-block)
    var(--rv-ui-chrome-badge-value-pad-inline);
  border-radius: var(--rv-ui-chrome-radius-pill);
  font-weight: var(--ui-chrome-font-weight-semibold);
  color: var(--ui-chrome-inverse);
  background: var(--ui-chrome-brand);
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}

/* @rv/ui-surface owns structure; the host supplies the --rv-ui-* theme. */

.rv-surface-card,
.rv-widget-card,
.rv-widget-card__header,
.rv-widget-card__title,
.rv-widget-card__hint,
.rv-widget-card__search,
.rv-widget-card__actions,
.rv-widget-card__body,
.rv-data-surface {
  min-width: 0;
  box-sizing: border-box;
}

.rv-surface-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  box-shadow: var(--rv-ui-shadow-card);
  font-family: var(--rv-ui-font-family);
}

.rv-surface-card--fill {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.rv-widget-card {
  container-name: rv-widget-card;
  container-type: inline-size;
  /* Donor module-surface / market `.wrapper`: card owns inset, header has no second pad. */
  padding: var(--rv-ui-space-card);
  gap: var(--rv-ui-space-sm);
  border-width: var(--rv-ui-border-width-card);
}

/* Cover the host slot. Host stays `position: relative` and keeps used height. */
.rv-widget-card--expanded {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.rv-widget-card__header {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: fit-content;
  padding: 0;
}

.rv-widget-card__header--overlay {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  pointer-events: none;
}

.rv-widget-card__header--overlay > * {
  pointer-events: auto;
}

.rv-widget-card__title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--rv-ui-color-fg);
  /* Donor card-chrome-title: chrome bar type, medium, not body-sm. */
  font-family: var(--rv-ui-font-family-card-title);
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-card__title-affix {
  opacity: 0.3;
}

.rv-widget-card__title-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  touch-action: pan-x;
}

.rv-widget-card__title-scroll::-webkit-scrollbar {
  display: none;
}

.rv-surface-quick-hint,
.rv-widget-card__hint {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: visible;
  line-height: 0;
  cursor: help;
  color: var(--rv-ui-color-fg-muted);
}

.rv-surface-quick-hint__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rv-surface-quick-hint__icon > svg {
  width: 1em;
  height: 1em;
}

.rv-widget-card__search {
  display: flex;
  flex: 0 1 12rem;
  align-items: center;
  min-width: 8rem;
  max-width: 16rem;
}

.rv-widget-card__search > * {
  width: 100%;
  min-width: 0;
}

.rv-widget-card__actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--rv-ui-space-xs);
  min-width: 0;
  margin-inline-start: auto;
}

.rv-widget-idea,
.rv-widget-expand {
  flex: 0 0 auto;
  align-self: center;
  margin-inline-start: var(--rv-ui-space-xs);
}

.rv-widget-idea__trigger,
.rv-widget-expand__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--rv-ui-widget-header-icon-size, 24px);
  height: var(--rv-ui-widget-header-icon-size, 24px);
  min-width: var(--rv-ui-widget-header-icon-size, 24px);
  min-height: var(--rv-ui-widget-header-icon-size, 24px);
  padding: 0;
  border: none;
  border-radius: var(--rv-ui-radius-sm);
  background: transparent;
  cursor: pointer;
  transition:
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    background-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

/* «…» is a neutral affordance; expand keeps the donor accent. */
.rv-widget-idea__trigger {
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-expand__trigger {
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__trigger svg,
.rv-widget-expand__trigger svg {
  display: block;
  flex: none;
  width: var(--rv-ui-widget-header-glyph-size, 16px);
  height: var(--rv-ui-widget-header-glyph-size, 16px);
}

.rv-widget-idea__trigger:hover,
.rv-widget-idea__trigger[aria-expanded="true"] {
  background: color-mix(in srgb, var(--rv-ui-color-brand) 12%, transparent);
  color: var(--rv-ui-color-brand);
  transform: scale(1.06);
}

.rv-widget-expand__trigger:hover,
.rv-widget-expand__trigger[aria-pressed="true"] {
  background: color-mix(in srgb, var(--rv-ui-color-error) 12%, transparent);
  transform: scale(1.06);
}

.rv-widget-idea__trigger:focus-visible,
.rv-widget-expand__trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__panel {
  position: fixed;
  z-index: var(--rv-ui-z-popover);
  box-sizing: border-box;
  overflow: visible;
  width: 360px;
  padding: var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  box-shadow: var(--rv-ui-shadow-popover);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  opacity: 0;
}

/* Paints only after the anchor measure lands, so it never flashes at 0,0. */
.rv-widget-idea__panel--ready {
  animation: rv-widget-idea-in var(--rv-ui-motion-enter)
    var(--rv-ui-motion-ease-decelerate) both;
}

@keyframes rv-widget-idea-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rv-widget-idea__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--rv-ui-space-sm);
  margin: 0 0 var(--rv-ui-space-xs);
}

.rv-widget-idea__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: none;
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  background: transparent;
  color: var(--rv-ui-color-fg-muted);
  cursor: pointer;
  transition:
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__close:hover:not(:disabled) {
  background: color-mix(in srgb, var(--rv-ui-color-fg) 8%, transparent);
  color: var(--rv-ui-color-fg);
}

.rv-widget-idea__close:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__close:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.rv-widget-idea__heading {
  min-width: 0;
  flex: 1 1 auto;
}

.rv-widget-idea__kicker {
  margin: 0 0 2px;
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: var(--rv-ui-line-height-tight);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__title {
  margin: 0;
  font-family: var(--rv-ui-font-family-card-title, var(--rv-ui-font-family));
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-idea__kind {
  display: flex;
  max-width: 100%;
  margin: 0 0 var(--rv-ui-space-sm);
}

/* Slot geometry only — the injected control owns its own look. */
.rv-widget-idea__kind > * {
  flex: 1 1 auto;
  min-width: 0;
}

.rv-widget-idea__kind-native {
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  font: inherit;
  cursor: pointer;
}

.rv-widget-idea__kind-native:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__hint {
  margin: 0 0 var(--rv-ui-space-md);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__status {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--rv-ui-space-sm) var(--rv-ui-space-xs) var(--rv-ui-space-xs);
}

.rv-widget-idea__status-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 0 var(--rv-ui-space-md);
  border-radius: 999px;
}

.rv-widget-idea__panel--ready .rv-widget-idea__status-icon {
  animation: rv-widget-idea-pop var(--rv-ui-motion-enter)
    var(--rv-ui-motion-ease-spring) both;
}

@keyframes rv-widget-idea-pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-widget-idea__panel--ready,
  .rv-widget-idea__panel--ready .rv-widget-idea__status-icon {
    animation: none;
    opacity: 1;
  }
}

.rv-widget-idea__status-icon--ok {
  background: color-mix(in srgb, var(--rv-ui-color-positive) 16%, transparent);
  color: var(--rv-ui-color-positive);
}

.rv-widget-idea__status-icon--fail {
  background: color-mix(in srgb, var(--rv-ui-color-error) 16%, transparent);
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__status-title {
  margin: 0 0 var(--rv-ui-space-xs);
  font-family: var(--rv-ui-font-family-card-title, var(--rv-ui-font-family));
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-idea__status-hint {
  margin: 0 0 var(--rv-ui-space-md);
  max-width: 20rem;
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__status-action {
  display: flex;
  justify-content: center;
  width: 100%;
}

.rv-widget-idea__field-wrap {
  display: block;
}

.rv-widget-idea__field {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 7rem;
  padding: 12px 14px;
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-md);
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  resize: none;
  transition:
    border-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    box-shadow var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__field::placeholder {
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__field:hover:not(:disabled):not(:focus) {
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 32%,
    var(--rv-ui-color-border)
  );
}

.rv-widget-idea__field:focus {
  outline: none;
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 45%,
    var(--rv-ui-color-border)
  );
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--rv-ui-color-brand) 18%, transparent);
}

.rv-widget-idea__field:disabled {
  opacity: 0.64;
}

.rv-widget-idea__meta {
  display: flex;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  min-height: 1.25rem;
  margin-top: var(--rv-ui-space-xs);
}

.rv-widget-idea__count,
.rv-widget-idea__error {
  font-size: var(--rv-ui-font-size-label);
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__count {
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}

.rv-widget-idea__error {
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__actions {
  display: flex;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-sm);
}

.rv-widget-idea__action {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: var(--rv-ui-space-xs);
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--rv-ui-chrome-button-height-md, 36px);
  padding: 0 var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid transparent;
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  font: inherit;
  font-weight: var(--rv-ui-font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default),
    border-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    box-shadow var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__action--ghost {
  background: transparent;
  border-color: var(--rv-ui-color-border);
  color: var(--rv-ui-color-fg);
}

.rv-widget-idea__action--ghost:hover:not(:disabled) {
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 28%,
    var(--rv-ui-color-border)
  );
  background: color-mix(in srgb, var(--rv-ui-color-brand) 6%, transparent);
}

.rv-widget-idea__action--primary {
  background: var(--rv-ui-color-brand);
  color: var(--rv-ui-color-on-accent);
}

.rv-widget-idea__action--primary:hover:not(:disabled) {
  background: var(--rv-ui-color-brand-hover);
  box-shadow: 0 4px 16px
    color-mix(in srgb, var(--rv-ui-color-brand) 34%, transparent);
}

.rv-widget-idea__action--primary:active:not(:disabled) {
  transform: translateY(1px);
}

.rv-widget-idea__action:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__action:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.rv-widget-idea__spinner {
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: rv-widget-idea-spin var(--rv-ui-motion-duration-lg) linear infinite;
}

@keyframes rv-widget-idea-spin {
  to {
    transform: rotate(360deg);
  }
}

.rv-widget-card__body {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.rv-widget-card__body > * {
  min-width: 0;
  flex: 1 1 0;
  min-height: 0;
  align-self: stretch;
}

.rv-data-surface {
  position: relative;
  width: 100%;
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
    var(--rv-ui-motion-ease-default);
}

/* Occupy the host slot. Host gives a used height (flex/grid item or px).
   Host does not become a flex column for this — height:100% + stretch. */
.rv-data-surface--fill {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rv-data-surface {
    transition: none;
  }
}

/* Donor /statistics 2×2 module: one surface, cell dividers, nested cards flush. */
.rv-widget-quad {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: var(--rv-ui-space-card);
  background: var(--rv-ui-color-surface);
  border: var(--rv-ui-border-width-card) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  box-shadow: var(--rv-ui-shadow-card);
}

.rv-widget-quad > * {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.rv-widget-quad > *:nth-child(1) {
  border-right: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-bottom: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-right: var(--rv-ui-space-lg);
  padding-bottom: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(2) {
  border-bottom: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-left: var(--rv-ui-space-lg);
  padding-bottom: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(3) {
  border-right: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-right: var(--rv-ui-space-lg);
  padding-top: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(4) {
  padding-left: var(--rv-ui-space-lg);
  padding-top: var(--rv-ui-space-lg);
}

.rv-widget-quad .rv-widget-card,
.rv-widget-quad .rv-surface-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
  height: 100%;
}

.rv-disclosure {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host > * {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host .rv-widget-card,
.rv-disclosure__host .rv-surface-card {
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

.rv-disclosure-bar {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-width: 0;
}

.rv-disclosure-bar--attached {
  flex-direction: column-reverse;
}

.rv-disclosure-bar--bleed {
  /* Donor DisclosureBar.bleed: adapt(16 / −20 / −20) + card radius. */
  margin-top: clamp(5.33px, 0.4167vw, 16px);
  margin-inline: calc(-1 * var(--rv-ui-space-card));
  margin-bottom: calc(-1 * var(--rv-ui-space-card));
  overflow: visible;
  border-end-start-radius: var(--rv-ui-radius-card);
  border-end-end-radius: var(--rv-ui-radius-card);
}

.rv-disclosure-bar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--rv-ui-color-fg-muted);
  cursor: pointer;
}

.rv-disclosure-bar--attached .rv-disclosure-bar__toggle {
  height: clamp(12px, 0.9375vw, 36px);
  line-height: 0;
}

.rv-disclosure-bar__toggle:focus-visible {
  outline: 2px solid var(--rv-ui-color-brand);
  outline-offset: -2px;
}

.rv-disclosure-flap {
  display: block;
  width: 100%;
  /* Donor chrome-flap-root-card: adapt(36px). */
  height: clamp(12px, 0.9375vw, 36px);
  pointer-events: none;
}

.rv-disclosure-flap__svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform var(--rv-ui-motion-duration-md, 200ms)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-flap--open .rv-disclosure-flap__svg {
  transform: scaleY(-1);
}

.rv-disclosure-flap__zone {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 6%, transparent);
  transition: fill var(--rv-ui-motion-feedback, 120ms)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-flap__zone--premium {
  fill-opacity: 0.12;
}

.rv-disclosure-flap__edge {
  stroke: var(--rv-ui-color-border);
  stroke-width: 1.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition:
    stroke var(--rv-ui-motion-feedback, 120ms) var(--rv-ui-motion-ease-default),
    stroke-width var(--rv-ui-motion-feedback, 120ms)
      var(--rv-ui-motion-ease-default);
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium),
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium) {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 12%, transparent);
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__zone--premium,
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__zone--premium {
  fill-opacity: 0.22;
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__edge,
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__edge {
  stroke: var(--rv-ui-color-fg-muted);
  stroke-width: 2px;
}

.rv-disclosure-flap--open .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium) {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 11%, transparent);
}

.rv-disclosure-flap--open .rv-disclosure-flap__zone--premium {
  fill-opacity: 0.22;
}

.rv-disclosure-flap--open .rv-disclosure-flap__edge {
  stroke-width: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .rv-disclosure-flap__svg,
  .rv-disclosure-flap__zone,
  .rv-disclosure-flap__edge {
    transition: none;
  }
}

.rv-disclosure-bar__chevron {
  width: 1.25rem;
  height: 1.25rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.rv-disclosure-bar--open .rv-disclosure-bar__chevron {
  transform: rotate(225deg);
}

.rv-disclosure-bar__panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--rv-ui-motion-duration-lg)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-bar__panel-inner {
  overflow: hidden;
  padding-inline: var(--rv-ui-space-lg);
  padding-block: 0;
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-body);
}

.rv-disclosure-bar__panel--open .rv-disclosure-bar__panel-inner {
  padding-block: var(--rv-ui-space-sm) var(--rv-ui-space-md);
}

.rv-disclosure-bar__overlay {
  position: fixed;
  z-index: var(--rv-ui-z-popover);
  box-sizing: border-box;
  overflow: auto;
  padding: var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  background: var(--rv-ui-color-surface-elevated, var(--rv-ui-color-surface));
  color: var(--rv-ui-color-fg);
  box-shadow: var(--rv-ui-shadow-popover);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-body);
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.rv-disclosure-bar__overlay--ready {
  visibility: visible;
  pointer-events: auto;
  animation: rv-disclosure-overlay-in var(--rv-ui-motion-enter, 160ms)
    var(--rv-ui-motion-ease-decelerate, ease-out) both;
}

.rv-disclosure-bar__overlay .rv-disclosure-bar__panel-inner {
  padding: 0;
  overflow: visible;
}

@keyframes rv-disclosure-overlay-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rv-disclosure-bar__title {
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-strip {
  --rv-ui-kpi-strip-min-col: 140px;
  --rv-ui-kpi-strip-min-col-compact: 112px;
  --rv-ui-kpi-chart-min-height: 28px;

  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, var(--rv-ui-kpi-strip-min-col)), 1fr)
  );
  gap: var(--rv-ui-space-md);
  width: 100%;
  min-width: 0;
  align-items: stretch;
  justify-items: stretch;
  grid-auto-rows: 1fr;
  container-name: rv-kpi-strip;
  container-type: inline-size;
}

/* Pack: content min-size must not inflate a 1fr track (long titles). */
.rv-kpi-strip > * {
  min-width: 0;
}

.rv-kpi-strip[data-density="compact"] {
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, var(--rv-ui-kpi-strip-min-col-compact)), 1fr)
  );
  gap: var(--rv-ui-space-sm);
  grid-auto-rows: min-content;
  align-content: start;
}

/*
 * Pack: catalog N equal cells. auto-fill so rows do not collapse (strip auto-fit
 * + 1fr does). Size is density, not this layout.
 */
.rv-kpi-strip[data-layout="pack"] {
  --rv-ui-kpi-pack-min-col: 176px;

  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, var(--rv-ui-kpi-pack-min-col)), 1fr)
  );
  grid-auto-rows: min-content;
  align-content: start;
  align-items: stretch;
}

.rv-kpi-strip[data-layout="stack"] {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: auto;
  align-content: space-between;
  height: 100%;
}

/*
 * Donor Disclosure is height:100% + host flex 1 — four stacked quotes
 * then overlay and the flap cuts the title. Stack items stay content-sized.
 */
.rv-kpi-strip[data-layout="stack"] .rv-disclosure {
  height: auto;
  flex: 0 0 auto;
}

.rv-kpi-strip[data-layout="stack"] .rv-disclosure__host,
.rv-kpi-strip[data-layout="stack"] .rv-disclosure__host > * {
  flex: 0 0 auto;
  height: auto;
}

/* Donor StatisticCard: surface + padding on the card that owns the flap.
 * Do not set overflow-x:hidden — with overflow-y:visible it computes to
 * `hidden auto` and clips a flex-collapsed host. */
.rv-kpi-strip .rv-disclosure.rv-surface-card {
  padding: var(--rv-ui-space-card);
  overflow: visible;
}

.rv-kpi-strip .rv-disclosure.rv-surface-card .rv-kpi-card {
  padding: 0;
}

.rv-kpi-strip[data-layout="stack"] .rv-kpi-card--quote,
.rv-kpi-strip[data-layout="stack"] .rv-kpi-card--quote .rv-kpi-card__surface {
  flex: 0 0 auto;
  min-height: auto;
  height: auto;
}

.rv-kpi-card {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-sm);
  min-width: 0;
  flex: 1 1 var(--rv-ui-kpi-strip-min-col);
  padding: var(--rv-ui-space-md);
  box-sizing: border-box;
}

.rv-kpi-card__surface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: inherit;
  min-height: 0;
}

.rv-kpi-card--compact,
.rv-kpi-strip[data-density="compact"] .rv-kpi-card {
  gap: var(--rv-ui-space-xs);
  padding: var(--rv-ui-space-sm);
}

.rv-kpi-card--hero,
.rv-kpi-strip[data-emphasis="hero"] .rv-kpi-card:first-child {
  grid-column: 1 / -1;
}

.rv-kpi-card--clickable {
  cursor: pointer;
}

.rv-kpi-card--clickable:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-kpi-card--selected,
.rv-surface-card.rv-kpi-card--selected {
  background: var(--rv-ui-color-surface-selected);
}

.rv-kpi-card__header {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  min-width: 0;
}

.rv-kpi-card--quote {
  flex: 0 0 auto;
}

.rv-kpi-card--quote .rv-kpi-card__header {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  width: 100%;
}

/* Donor .title: nowrap ellipsis. Value row never shrinks. */
.rv-kpi-card--quote .rv-kpi-card__title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family-card-title);
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-kpi-card--quote .rv-kpi-card__value-wrap {
  flex: 0 0 auto;
}

.rv-kpi-card--quote .rv-kpi-value,
.rv-kpi-card--quote .rv-kpi-value__surface {
  width: auto;
  flex-direction: row;
}

.rv-kpi-card--quote .rv-kpi-value__line {
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: var(--rv-ui-space-sm);
}

.rv-kpi-card--quote .rv-kpi-value__main {
  font-family: var(--rv-ui-font-family-card-title);
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-card--quote .rv-kpi-value__postfix {
  font-family: var(--rv-ui-font-family-card-title);
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-kpi-card--quote .rv-kpi-value__delta {
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-card--product {
  flex: 0 0 auto;
}

.rv-kpi-card--product .rv-kpi-card__header {
  flex-direction: row;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  width: 100%;
}

.rv-kpi-card--product .rv-kpi-card__title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--rv-ui-color-fg);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-card__rank {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* String rank only — host OrderItem owns size/palette when it is the child. */
.rv-kpi-card__rank:not(:has(> *)) {
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0.15em 0.4em;
  border-radius: var(--rv-ui-radius-sm);
  font-variant-numeric: tabular-nums;
  font-weight: var(--rv-ui-font-weight-semibold);
  font-size: var(--rv-ui-font-size-label);
  color: var(--rv-ui-color-on-accent);
  background: var(--rv-ui-color-brand);
}

.rv-kpi-card__chips {
  display: grid;
  grid-template-columns: repeat(var(--chip-count, 3), minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  overflow: visible;
  gap: var(--rv-ui-space-xs);
}

.rv-kpi-card__chips > * {
  width: 100%;
  min-width: 0;
}

.rv-kpi-strip[data-layout="stack"] .rv-kpi-card--product,
.rv-kpi-strip[data-layout="stack"] .rv-kpi-card--product .rv-kpi-card__surface {
  flex: 0 0 auto;
  min-height: auto;
  height: auto;
}

.rv-kpi-card__value-wrap {
  min-width: 0;
}

.rv-kpi-card__title {
  color: var(--rv-ui-color-fg-muted);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
}

/*
 * Spark density. Default = StatisticBadge (/sparklines summary): pad 16/20,
 * chart 68px. Compact must win — otherwise every kind=spark looks the same.
 * Compact title is 1 line, no 2lh. Card height stays auto (not host pack overlay).
 */
.rv-kpi-card--spark .rv-kpi-card__title {
  min-height: var(--rv-ui-kpi-spark-title-min-height, 2lh);
}

.rv-kpi-card--spark {
  padding: 16px 20px 20px;
  gap: 16px;
}

.rv-kpi-strip .rv-kpi-card--spark .rv-kpi-card__title {
  min-height: var(--rv-ui-kpi-spark-title-min-height, 0);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: 1.25;
}

.rv-kpi-card--spark .rv-kpi-value__line {
  flex-wrap: nowrap;
  align-items: baseline;
}

.rv-kpi-card--spark .rv-kpi-value__delta {
  margin-inline-start: auto;
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-semibold);
  white-space: nowrap;
}

.rv-kpi-card--spark .rv-kpi-card__chart {
  flex: 0 0 auto;
  height: var(--rv-ui-kpi-spark-chart-height, 68px);
  min-height: var(--rv-ui-kpi-spark-chart-height, 68px);
  max-height: var(--rv-ui-kpi-spark-chart-height, 68px);
  margin-top: 0;
}

.rv-kpi-card--spark.rv-kpi-card--compact,
.rv-kpi-strip[data-density="compact"] .rv-kpi-card--spark {
  padding: var(--rv-ui-space-sm);
  gap: var(--rv-ui-space-xs);
  min-height: 0;
}

.rv-kpi-card--spark.rv-kpi-card--compact .rv-kpi-card__title,
.rv-kpi-strip[data-density="compact"] .rv-kpi-card--spark .rv-kpi-card__title {
  min-height: 0;
}

.rv-kpi-card--spark.rv-kpi-card--compact .rv-kpi-card__chart,
.rv-kpi-strip[data-density="compact"] .rv-kpi-card--spark .rv-kpi-card__chart {
  height: var(--rv-ui-kpi-spark-chart-height-compact, 40px);
  min-height: var(--rv-ui-kpi-spark-chart-height-compact, 40px);
  max-height: var(--rv-ui-kpi-spark-chart-height-compact, 40px);
}

.rv-kpi-card__supporting,
.rv-kpi-value__supporting {
  min-width: 0;
  color: var(--rv-ui-color-fg-muted);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
}

.rv-kpi-card__chart {
  min-height: var(--rv-ui-kpi-chart-min-height);
  height: var(--rv-ui-kpi-chart-height, auto);
  max-height: var(--rv-ui-kpi-chart-max-height, none);
  min-width: 0;
  flex: 1 1 auto;
}

/*
 * Spark + DataSurface fill: fill is height:100% / min-height:0 and assumes
 * the host cell already has a used height (/sparklines). In an auto-row
 * strip (/map metrics) that collapses the card to padding and the spark
 * paints over the next card. Keep content min-size; flex-grow still fills
 * a stretched cell.
 */
.rv-kpi-card--spark .rv-kpi-card__surface.rv-data-surface--fill {
  height: auto;
  min-height: min-content;
  flex: 1 1 auto;
}

.rv-kpi-value {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  min-width: 0;
}

.rv-kpi-value__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--rv-ui-space-xs);
  min-width: 0;
}

.rv-kpi-value__transition {
  display: inline-flex;
  min-width: 0;
}

.rv-kpi-value__main {
  font-size: var(--rv-ui-font-size-value);
  font-weight: var(--rv-ui-font-weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: var(--rv-ui-line-height-tight);
  color: var(--rv-ui-color-fg);
}

.rv-kpi-value--compact .rv-kpi-value__main,
.rv-kpi-strip[data-density="compact"] .rv-kpi-value__main {
  font-size: var(--rv-ui-font-size-value-compact);
}

.rv-kpi-value--hero .rv-kpi-value__main,
.rv-kpi-strip[data-emphasis="hero"]
  .rv-kpi-card:first-child
  .rv-kpi-value__main {
  font-size: var(--rv-ui-font-size-value-hero);
}

.rv-kpi-value__postfix {
  color: var(--rv-ui-color-fg-muted);
  font-size: var(--rv-ui-font-size-body);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-kpi-value--hero .rv-kpi-value__postfix,
.rv-kpi-strip[data-emphasis="hero"]
  .rv-kpi-card:first-child
  .rv-kpi-value__postfix {
  font-size: var(--rv-ui-font-size-body);
}

.rv-kpi-value__second {
  font-size: var(--rv-ui-font-size-body);
  color: var(--rv-ui-color-fg-muted);
  font-variant-numeric: tabular-nums;
}

.rv-kpi-value__delta {
  font-size: var(--rv-ui-font-size-body);
  font-variant-numeric: tabular-nums;
  font-weight: var(--rv-ui-font-weight-medium);
}

/* FE Chip pair — donor Chip.small + card-metric-chips-row(2). */
.rv-kpi-value--chip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1 1 0;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: var(--rv-ui-kpi-chip-gap, var(--rv-ui-space-sm));
}

.rv-kpi-value--chip:not(:has(.rv-kpi-value__chip--delta)) {
  grid-template-columns: minmax(0, 1fr);
}

.rv-kpi-value__chip {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  gap: var(--rv-ui-space-xs);
  padding: 2px 4px;
  border-radius: 4.5px;
  background: var(
    --rv-ui-kpi-chip-bg,
    var(--rv-ui-color-surface-elevated)
  );
  box-shadow: var(--rv-ui-kpi-chip-ring, none);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-body);
  font-variant-numeric: tabular-nums;
  line-height: var(--rv-ui-line-height-tight);
  white-space: nowrap;
}

.rv-kpi-value--chip .rv-kpi-value__main,
.rv-kpi-value--chip .rv-kpi-value__transition {
  flex: 0 0 auto;
  font-size: inherit;
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-value--chip .rv-kpi-value__postfix {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-kpi-value__chip--delta {
  font-weight: var(--rv-ui-font-weight-semibold);
}

.rv-kpi-value__surface {
  display: flex;
  min-width: 0;
  width: 100%;
}

.rv-kpi-value__surface > .rv-kpi-value--chip {
  flex: 1 1 0;
}

/* Histogram / card header: title | equal chip-row (donor titleRow + cellChips). */
.rv-widget-card:has(.rv-kpi-value--chip) .rv-widget-card__title {
  flex: 1 1 0;
}

.rv-widget-card:has(.rv-kpi-value--chip) .rv-widget-card__actions {
  flex: 1 1 0;
  justify-content: stretch;
  min-width: 0;
  margin-inline-start: 0;
}

.rv-widget-card:has(.rv-kpi-value--chip) .rv-widget-card__actions > .rv-kpi-value,
.rv-widget-card:has(.rv-kpi-value--chip) .rv-widget-card__actions > .rv-kpi-value__surface {
  width: 100%;
}

/*
 * Card metric chip-row ranks — port of app/frontend _card-metric-chip-row.scss
 * (card-metric-rank-drives / card-metric-rank-residual).
 * Normative: app/frontend card-metric-chip-row reference + card-metric-priority.ts
 */
[data-metric-rank="value"],
[data-metric-rank="title"],
[data-metric-rank="subtitle"] {
  min-width: 0;
  white-space: nowrap;
}

[data-metric-rank="value"] {
  flex-shrink: 0;
  max-width: 100%;
}

[data-metric-rank="title"],
[data-metric-rank="subtitle"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-metric-rank="label"] {
  width: 0;
  min-width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}
/* @rv/ui-motion — timing only; consuming themes own all visual styling. */

:root {
  --rv-ui-motion-duration-xs: 150ms;
  --rv-ui-motion-duration-sm: 200ms;
  --rv-ui-motion-duration-md: 300ms;
  --rv-ui-motion-duration-layout: 375ms;
  --rv-ui-motion-duration-lg: 500ms;
  --rv-ui-motion-duration-xl: 1000ms;

  --rv-ui-motion-ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rv-ui-motion-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --rv-ui-motion-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --rv-ui-motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --rv-ui-motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rv-ui-motion-ease: var(--rv-ui-motion-ease-default);

  --rv-ui-motion-feedback: var(--rv-ui-motion-duration-xs);
  --rv-ui-motion-enter: var(--rv-ui-motion-duration-md);
  --rv-ui-motion-exit: var(--rv-ui-motion-duration-sm);
  --rv-ui-motion-data-change: var(--rv-ui-motion-duration-lg);
  --rv-ui-motion-layout-shift: var(--rv-ui-motion-duration-layout);
  --rv-ui-motion-stagger: 50ms;

  --rv-ui-motion-surface-pulse-min-opacity: 0.88;
  --rv-ui-motion-surface-opacity-duration: var(
    --rv-ui-motion-data-change
  );

  --rv-ui-motion-table-layout-idle: 1000ms;
  --rv-ui-motion-table-shift-duration: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-delay: var(
    --rv-ui-motion-layout-shift
  );
  --rv-ui-motion-table-query-reveal-duration: var(
    --rv-ui-motion-data-change
  );
  --rv-ui-motion-table-query-hold-duration: calc(
    var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-layout-shift)
      + var(--rv-ui-motion-data-change)
  );
}

.rv-ui-motion-surface {
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
      var(--rv-ui-motion-ease-default);
}

.rv-ui-motion-value-transition {
  animation:
    rv-ui-motion-value-enter var(--rv-ui-motion-data-change)
      var(--rv-ui-motion-ease-default) both;
}

@keyframes rv-ui-motion-value-enter {
  from {
    opacity: var(--rv-ui-motion-surface-pulse-min-opacity);
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --rv-ui-motion-duration-xs: 0ms;
    --rv-ui-motion-duration-sm: 0ms;
    --rv-ui-motion-duration-md: 0ms;
    --rv-ui-motion-duration-layout: 0ms;
    --rv-ui-motion-duration-lg: 0ms;
    --rv-ui-motion-duration-xl: 0ms;
    --rv-ui-motion-stagger: 0ms;
  }

  .rv-ui-motion-surface,
  .rv-ui-motion-value-transition {
    animation: none;
    transition: none;
  }
}

/* @rv/ui-primitives — structure only; host owns the --rv-ui-* theme. */

:root {
  /* Donor Tooltip.module.scss: min(40vw, 720px); mobile 80vw. */
  --rv-ui-tooltip-viewport-max-width: 40vw;
  --rv-ui-skeleton-shimmer-span: 200%;
}

.rv-trunc-text {
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Header canon (table + mosaic): whole words only; leftover → … */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.rv-trunc-text--single {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  word-break: normal;
  -webkit-box-orient: unset;
  -webkit-line-clamp: unset;
}

.rv-tooltip-trigger {
  display: contents;
}

.rv-tooltip-trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-tooltip {
  position: fixed;
  z-index: var(--rv-ui-z-tooltip);
  width: max-content;
  max-width: min(
    var(--rv-ui-tooltip-max-width),
    var(--rv-ui-tooltip-viewport-max-width)
  );
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--rv-ui-tooltip-padding-block)
    var(--rv-ui-tooltip-padding-inline);
  border-radius: var(--rv-ui-tooltip-radius);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  white-space: pre-line;
  pointer-events: auto;
  box-shadow: var(--rv-ui-tooltip-shadow);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  transition:
    opacity var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-decelerate);
}

/*
 * Пузырь у курсора: позиция — transform. Opacity/transform ease здесь
 * оставляли предыдущий пузырь на экране при быстром ходе по сетке.
 */
.rv-tooltip--pointer {
  pointer-events: none;
  transition: none;
  will-change: transform;
}

/* Glass mode piece (`GlassTooltipShell`). Tokens optional — host maps product glass. */
.rv-tooltip-glass {
  background: var(--rv-ui-tooltip-glass-bg, var(--rv-ui-color-surface-elevated));
  border-color: var(--rv-ui-tooltip-glass-border, var(--rv-ui-color-border));
  box-shadow: var(--rv-ui-tooltip-glass-shadow, var(--rv-ui-tooltip-shadow));
  color: var(--rv-ui-tooltip-glass-fg, var(--rv-ui-color-fg));
  backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
  -webkit-backdrop-filter: blur(var(--rv-ui-tooltip-glass-blur, 0px))
    saturate(var(--rv-ui-tooltip-glass-saturate, 1));
}

@media (max-width: 768px) {
  .rv-tooltip {
    --rv-ui-tooltip-viewport-max-width: 80vw;
  }
}

/*
 * Assembled metrics: kit paints rows. Ink/weight from theme tokens.
 * Label + value sit together (flex-start), not space-between.
 */
.rv-tooltip-assembled {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-regular);
  line-height: var(--rv-ui-line-height-body);
}

.rv-tooltip-assembled__title {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-ui-space-sm);
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__title::first-letter {
  text-transform: capitalize;
}

.rv-tooltip-assembled__swatch {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: var(--rv-ui-radius-sm);
  background: var(--rv-ui-color-brand);
}

.rv-tooltip-assembled__row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__label {
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
}

.rv-tooltip-assembled__value {
  display: inline-flex;
  align-items: center;
  gap: var(--rv-ui-space-xs);
  color: var(--rv-ui-color-fg);
  font-weight: var(--rv-ui-font-weight-regular);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rv-tooltip-assembled__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 12px;
  height: 8px;
}

.rv-tooltip-assembled__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-tooltip-assembled__row--pos .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-positive);
}

.rv-tooltip-assembled__row--neg .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-negative);
}

.rv-tooltip-assembled__row--zero .rv-tooltip-assembled__arrow {
  color: var(--rv-ui-color-fg-muted);
}

.rv-tooltip-assembled__periods {
  display: flex;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-xs);
}

.rv-tooltip-assembled__period {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
  padding-right: var(--rv-ui-space-sm);
}

.rv-tooltip-assembled__period:first-child {
  border-right: var(--rv-ui-tooltip-assembled-period-divider);
}

.rv-tooltip-assembled__period-values {
  display: flex;
  flex-direction: column;
  gap: var(--rv-ui-space-xs);
}

.rv-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: var(--rv-ui-spinner-size-md);
  height: var(--rv-ui-spinner-size-md);
  border: var(--rv-ui-spinner-stroke-md) solid var(--rv-ui-color-border);
  border-top-color: var(--rv-ui-color-brand);
  border-radius: 50%;
  animation: rv-ui-spinner-rotate var(--rv-ui-motion-duration-lg) linear infinite;
}

.rv-spinner--sm {
  width: var(--rv-ui-spinner-size-sm);
  height: var(--rv-ui-spinner-size-sm);
  border-width: var(--rv-ui-spinner-stroke-sm);
}

.rv-spinner--lg {
  width: var(--rv-ui-spinner-size-lg);
  height: var(--rv-ui-spinner-size-lg);
  border-width: var(--rv-ui-spinner-stroke-lg);
}

.rv-skeleton {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--rv-ui-skeleton-line-height);
  overflow: hidden;
  border-radius: var(--rv-ui-radius-sm);
  background: linear-gradient(
    90deg,
    var(--rv-ui-color-surface) 0%,
    var(--rv-ui-color-surface-elevated) 50%,
    var(--rv-ui-color-surface) 100%
  );
  background-size: var(--rv-ui-skeleton-shimmer-span) 100%;
  animation: rv-ui-skeleton-shimmer var(--rv-ui-motion-duration-xl)
    var(--rv-ui-motion-ease-default) infinite;
}

.rv-skeleton--text {
  height: var(--rv-ui-skeleton-line-height);
}

.rv-skeleton--circle {
  width: var(--rv-ui-skeleton-avatar-size);
  height: var(--rv-ui-skeleton-avatar-size);
  border-radius: 50%;
}

@keyframes rv-ui-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rv-ui-skeleton-shimmer {
  from {
    background-position: var(--rv-ui-skeleton-shimmer-span) 0;
  }

  to {
    background-position: calc(var(--rv-ui-skeleton-shimmer-span) * -1) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-spinner,
  .rv-skeleton {
    animation: none;
  }
}

/* @rv/ui-surface owns structure; the host supplies the --rv-ui-* theme. */

.rv-surface-card,
.rv-widget-card,
.rv-widget-card__header,
.rv-widget-card__title,
.rv-widget-card__hint,
.rv-widget-card__search,
.rv-widget-card__actions,
.rv-widget-card__body,
.rv-data-surface {
  min-width: 0;
  box-sizing: border-box;
}

.rv-surface-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  box-shadow: var(--rv-ui-shadow-card);
  font-family: var(--rv-ui-font-family);
}

.rv-surface-card--fill {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.rv-widget-card {
  container-name: rv-widget-card;
  container-type: inline-size;
  /* Donor module-surface / market `.wrapper`: card owns inset, header has no second pad. */
  padding: var(--rv-ui-space-card);
  gap: var(--rv-ui-space-sm);
  border-width: var(--rv-ui-border-width-card);
}

/* Cover the host slot. Host stays `position: relative` and keeps used height. */
.rv-widget-card--expanded {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.rv-widget-card__header {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: fit-content;
  padding: 0;
}

.rv-widget-card__header--overlay {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  pointer-events: none;
}

.rv-widget-card__header--overlay > * {
  pointer-events: auto;
}

.rv-widget-card__title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--rv-ui-color-fg);
  /* Donor card-chrome-title: chrome bar type, medium, not body-sm. */
  font-family: var(--rv-ui-font-family-card-title);
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-card__title-affix {
  opacity: 0.3;
}

.rv-widget-card__title-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  touch-action: pan-x;
}

.rv-widget-card__title-scroll::-webkit-scrollbar {
  display: none;
}

.rv-surface-quick-hint,
.rv-widget-card__hint {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: visible;
  line-height: 0;
  cursor: help;
  color: var(--rv-ui-color-fg-muted);
}

.rv-surface-quick-hint__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rv-surface-quick-hint__icon > svg {
  width: 1em;
  height: 1em;
}

.rv-widget-card__search {
  display: flex;
  flex: 0 1 12rem;
  align-items: center;
  min-width: 8rem;
  max-width: 16rem;
}

.rv-widget-card__search > * {
  width: 100%;
  min-width: 0;
}

.rv-widget-card__actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--rv-ui-space-xs);
  min-width: 0;
  margin-inline-start: auto;
}

.rv-widget-idea,
.rv-widget-expand {
  flex: 0 0 auto;
  align-self: center;
  margin-inline-start: var(--rv-ui-space-xs);
}

.rv-widget-idea__trigger,
.rv-widget-expand__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--rv-ui-widget-header-icon-size, 24px);
  height: var(--rv-ui-widget-header-icon-size, 24px);
  min-width: var(--rv-ui-widget-header-icon-size, 24px);
  min-height: var(--rv-ui-widget-header-icon-size, 24px);
  padding: 0;
  border: none;
  border-radius: var(--rv-ui-radius-sm);
  background: transparent;
  cursor: pointer;
  transition:
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    background-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

/* «…» is a neutral affordance; expand keeps the donor accent. */
.rv-widget-idea__trigger {
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-expand__trigger {
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__trigger svg,
.rv-widget-expand__trigger svg {
  display: block;
  flex: none;
  width: var(--rv-ui-widget-header-glyph-size, 16px);
  height: var(--rv-ui-widget-header-glyph-size, 16px);
}

.rv-widget-idea__trigger:hover,
.rv-widget-idea__trigger[aria-expanded="true"] {
  background: color-mix(in srgb, var(--rv-ui-color-brand) 12%, transparent);
  color: var(--rv-ui-color-brand);
  transform: scale(1.06);
}

.rv-widget-expand__trigger:hover,
.rv-widget-expand__trigger[aria-pressed="true"] {
  background: color-mix(in srgb, var(--rv-ui-color-error) 12%, transparent);
  transform: scale(1.06);
}

.rv-widget-idea__trigger:focus-visible,
.rv-widget-expand__trigger:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__panel {
  position: fixed;
  z-index: var(--rv-ui-z-popover);
  box-sizing: border-box;
  overflow: visible;
  width: 360px;
  padding: var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  background: var(--rv-ui-color-surface-elevated);
  color: var(--rv-ui-color-fg);
  box-shadow: var(--rv-ui-shadow-popover);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  opacity: 0;
}

/* Paints only after the anchor measure lands, so it never flashes at 0,0. */
.rv-widget-idea__panel--ready {
  animation: rv-widget-idea-in var(--rv-ui-motion-enter)
    var(--rv-ui-motion-ease-decelerate) both;
}

@keyframes rv-widget-idea-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rv-widget-idea__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--rv-ui-space-sm);
  margin: 0 0 var(--rv-ui-space-xs);
}

.rv-widget-idea__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: none;
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  background: transparent;
  color: var(--rv-ui-color-fg-muted);
  cursor: pointer;
  transition:
    color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__close:hover:not(:disabled) {
  background: color-mix(in srgb, var(--rv-ui-color-fg) 8%, transparent);
  color: var(--rv-ui-color-fg);
}

.rv-widget-idea__close:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__close:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.rv-widget-idea__heading {
  min-width: 0;
  flex: 1 1 auto;
}

.rv-widget-idea__kicker {
  margin: 0 0 2px;
  font-size: var(--rv-ui-font-size-label);
  font-weight: var(--rv-ui-font-weight-medium);
  line-height: var(--rv-ui-line-height-tight);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__title {
  margin: 0;
  font-family: var(--rv-ui-font-family-card-title, var(--rv-ui-font-family));
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-idea__kind {
  display: flex;
  max-width: 100%;
  margin: 0 0 var(--rv-ui-space-sm);
}

/* Slot geometry only — the injected control owns its own look. */
.rv-widget-idea__kind > * {
  flex: 1 1 auto;
  min-width: 0;
}

.rv-widget-idea__kind-native {
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  font: inherit;
  cursor: pointer;
}

.rv-widget-idea__kind-native:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__hint {
  margin: 0 0 var(--rv-ui-space-md);
  font-size: var(--rv-ui-font-size-label);
  line-height: var(--rv-ui-line-height-body);
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__status {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--rv-ui-space-sm) var(--rv-ui-space-xs) var(--rv-ui-space-xs);
}

.rv-widget-idea__status-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 0 var(--rv-ui-space-md);
  border-radius: 999px;
}

.rv-widget-idea__panel--ready .rv-widget-idea__status-icon {
  animation: rv-widget-idea-pop var(--rv-ui-motion-enter)
    var(--rv-ui-motion-ease-spring) both;
}

@keyframes rv-widget-idea-pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-widget-idea__panel--ready,
  .rv-widget-idea__panel--ready .rv-widget-idea__status-icon {
    animation: none;
    opacity: 1;
  }
}

.rv-widget-idea__status-icon--ok {
  background: color-mix(in srgb, var(--rv-ui-color-positive) 16%, transparent);
  color: var(--rv-ui-color-positive);
}

.rv-widget-idea__status-icon--fail {
  background: color-mix(in srgb, var(--rv-ui-color-error) 16%, transparent);
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__status-title {
  margin: 0 0 var(--rv-ui-space-xs);
  font-family: var(--rv-ui-font-family-card-title, var(--rv-ui-font-family));
  font-size: var(--rv-ui-font-size-card-title);
  font-weight: var(--rv-ui-font-weight-semibold);
  line-height: var(--rv-ui-line-height-tight);
}

.rv-widget-idea__status-hint {
  margin: 0 0 var(--rv-ui-space-md);
  max-width: 20rem;
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__status-action {
  display: flex;
  justify-content: center;
  width: 100%;
}

.rv-widget-idea__field-wrap {
  display: block;
}

.rv-widget-idea__field {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 7rem;
  padding: 12px 14px;
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-md);
  background: var(--rv-ui-color-surface);
  color: var(--rv-ui-color-fg);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  resize: none;
  transition:
    border-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    box-shadow var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__field::placeholder {
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__field:hover:not(:disabled):not(:focus) {
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 32%,
    var(--rv-ui-color-border)
  );
}

.rv-widget-idea__field:focus {
  outline: none;
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 45%,
    var(--rv-ui-color-border)
  );
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--rv-ui-color-brand) 18%, transparent);
}

.rv-widget-idea__field:disabled {
  opacity: 0.64;
}

.rv-widget-idea__meta {
  display: flex;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  min-height: 1.25rem;
  margin-top: var(--rv-ui-space-xs);
}

.rv-widget-idea__count,
.rv-widget-idea__error {
  font-size: var(--rv-ui-font-size-label);
  color: var(--rv-ui-color-fg-muted);
}

.rv-widget-idea__count {
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}

.rv-widget-idea__error {
  color: var(--rv-ui-color-error);
}

.rv-widget-idea__actions {
  display: flex;
  align-items: center;
  gap: var(--rv-ui-space-sm);
  margin-top: var(--rv-ui-space-sm);
}

.rv-widget-idea__action {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: var(--rv-ui-space-xs);
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--rv-ui-chrome-button-height-md, 36px);
  padding: 0 var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid transparent;
  border-radius: var(--rv-ui-chrome-radius-pill, 999px);
  font: inherit;
  font-weight: var(--rv-ui-font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--rv-ui-motion-feedback)
      var(--rv-ui-motion-ease-default),
    border-color var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    box-shadow var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default),
    transform var(--rv-ui-motion-feedback) var(--rv-ui-motion-ease-default);
}

.rv-widget-idea__action--ghost {
  background: transparent;
  border-color: var(--rv-ui-color-border);
  color: var(--rv-ui-color-fg);
}

.rv-widget-idea__action--ghost:hover:not(:disabled) {
  border-color: color-mix(
    in srgb,
    var(--rv-ui-color-brand) 28%,
    var(--rv-ui-color-border)
  );
  background: color-mix(in srgb, var(--rv-ui-color-brand) 6%, transparent);
}

.rv-widget-idea__action--primary {
  background: var(--rv-ui-color-brand);
  color: var(--rv-ui-color-on-accent);
}

.rv-widget-idea__action--primary:hover:not(:disabled) {
  background: var(--rv-ui-color-brand-hover);
  box-shadow: 0 4px 16px
    color-mix(in srgb, var(--rv-ui-color-brand) 34%, transparent);
}

.rv-widget-idea__action--primary:active:not(:disabled) {
  transform: translateY(1px);
}

.rv-widget-idea__action:focus-visible {
  outline: var(--rv-ui-focus-width) solid var(--rv-ui-color-focus);
  outline-offset: var(--rv-ui-focus-offset);
}

.rv-widget-idea__action:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.rv-widget-idea__spinner {
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: rv-widget-idea-spin var(--rv-ui-motion-duration-lg) linear infinite;
}

@keyframes rv-widget-idea-spin {
  to {
    transform: rotate(360deg);
  }
}

.rv-widget-card__body {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.rv-widget-card__body > * {
  min-width: 0;
  flex: 1 1 0;
  min-height: 0;
  align-self: stretch;
}

.rv-data-surface {
  position: relative;
  width: 100%;
  transition:
    opacity var(--rv-ui-motion-surface-opacity-duration)
    var(--rv-ui-motion-ease-default);
}

/* Occupy the host slot. Host gives a used height (flex/grid item or px).
   Host does not become a flex column for this — height:100% + stretch. */
.rv-data-surface--fill {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rv-data-surface {
    transition: none;
  }
}

/* Donor /statistics 2×2 module: one surface, cell dividers, nested cards flush. */
.rv-widget-quad {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: var(--rv-ui-space-card);
  background: var(--rv-ui-color-surface);
  border: var(--rv-ui-border-width-card) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  box-shadow: var(--rv-ui-shadow-card);
}

.rv-widget-quad > * {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.rv-widget-quad > *:nth-child(1) {
  border-right: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-bottom: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-right: var(--rv-ui-space-lg);
  padding-bottom: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(2) {
  border-bottom: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-left: var(--rv-ui-space-lg);
  padding-bottom: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(3) {
  border-right: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  padding-right: var(--rv-ui-space-lg);
  padding-top: var(--rv-ui-space-lg);
}

.rv-widget-quad > *:nth-child(4) {
  padding-left: var(--rv-ui-space-lg);
  padding-top: var(--rv-ui-space-lg);
}

.rv-widget-quad .rv-widget-card,
.rv-widget-quad .rv-surface-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
  height: 100%;
}

.rv-disclosure {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host > * {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.rv-disclosure__host .rv-widget-card,
.rv-disclosure__host .rv-surface-card {
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

.rv-disclosure-bar {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-width: 0;
}

.rv-disclosure-bar--attached {
  flex-direction: column-reverse;
}

.rv-disclosure-bar--bleed {
  /* Donor DisclosureBar.bleed: adapt(16 / −20 / −20) + card radius. */
  margin-top: clamp(5.33px, 0.4167vw, 16px);
  margin-inline: calc(-1 * var(--rv-ui-space-card));
  margin-bottom: calc(-1 * var(--rv-ui-space-card));
  overflow: visible;
  border-end-start-radius: var(--rv-ui-radius-card);
  border-end-end-radius: var(--rv-ui-radius-card);
}

.rv-disclosure-bar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--rv-ui-color-fg-muted);
  cursor: pointer;
}

.rv-disclosure-bar--attached .rv-disclosure-bar__toggle {
  height: clamp(12px, 0.9375vw, 36px);
  line-height: 0;
}

.rv-disclosure-bar__toggle:focus-visible {
  outline: 2px solid var(--rv-ui-color-brand);
  outline-offset: -2px;
}

.rv-disclosure-flap {
  display: block;
  width: 100%;
  /* Donor chrome-flap-root-card: adapt(36px). */
  height: clamp(12px, 0.9375vw, 36px);
  pointer-events: none;
}

.rv-disclosure-flap__svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform var(--rv-ui-motion-duration-md, 200ms)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-flap--open .rv-disclosure-flap__svg {
  transform: scaleY(-1);
}

.rv-disclosure-flap__zone {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 6%, transparent);
  transition: fill var(--rv-ui-motion-feedback, 120ms)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-flap__zone--premium {
  fill-opacity: 0.12;
}

.rv-disclosure-flap__edge {
  stroke: var(--rv-ui-color-border);
  stroke-width: 1.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition:
    stroke var(--rv-ui-motion-feedback, 120ms) var(--rv-ui-motion-ease-default),
    stroke-width var(--rv-ui-motion-feedback, 120ms)
      var(--rv-ui-motion-ease-default);
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium),
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium) {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 12%, transparent);
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__zone--premium,
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__zone--premium {
  fill-opacity: 0.22;
}

.rv-disclosure-bar__toggle:hover .rv-disclosure-flap__edge,
.rv-disclosure-bar__toggle:focus-visible .rv-disclosure-flap__edge {
  stroke: var(--rv-ui-color-fg-muted);
  stroke-width: 2px;
}

.rv-disclosure-flap--open .rv-disclosure-flap__zone:not(.rv-disclosure-flap__zone--premium) {
  fill: color-mix(in srgb, var(--rv-ui-color-fg-muted) 11%, transparent);
}

.rv-disclosure-flap--open .rv-disclosure-flap__zone--premium {
  fill-opacity: 0.22;
}

.rv-disclosure-flap--open .rv-disclosure-flap__edge {
  stroke-width: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .rv-disclosure-flap__svg,
  .rv-disclosure-flap__zone,
  .rv-disclosure-flap__edge {
    transition: none;
  }
}

.rv-disclosure-bar__chevron {
  width: 1.25rem;
  height: 1.25rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.rv-disclosure-bar--open .rv-disclosure-bar__chevron {
  transform: rotate(225deg);
}

.rv-disclosure-bar__panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--rv-ui-motion-duration-lg)
    var(--rv-ui-motion-ease-default);
}

.rv-disclosure-bar__panel-inner {
  overflow: hidden;
  padding-inline: var(--rv-ui-space-lg);
  padding-block: 0;
  color: var(--rv-ui-color-fg);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-body);
}

.rv-disclosure-bar__panel--open .rv-disclosure-bar__panel-inner {
  padding-block: var(--rv-ui-space-sm) var(--rv-ui-space-md);
}

.rv-disclosure-bar__overlay {
  position: fixed;
  z-index: var(--rv-ui-z-popover);
  box-sizing: border-box;
  overflow: auto;
  padding: var(--rv-ui-space-md);
  border: var(--rv-ui-border-width) solid var(--rv-ui-color-border);
  border-radius: var(--rv-ui-radius-card);
  background: var(--rv-ui-color-surface-elevated, var(--rv-ui-color-surface));
  color: var(--rv-ui-color-fg);
  box-shadow: var(--rv-ui-shadow-popover);
  font-family: var(--rv-ui-font-family);
  font-size: var(--rv-ui-font-size-body);
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.rv-disclosure-bar__overlay--ready {
  visibility: visible;
  pointer-events: auto;
  animation: rv-disclosure-overlay-in var(--rv-ui-motion-enter, 160ms)
    var(--rv-ui-motion-ease-decelerate, ease-out) both;
}

.rv-disclosure-bar__overlay .rv-disclosure-bar__panel-inner {
  padding: 0;
  overflow: visible;
}

@keyframes rv-disclosure-overlay-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rv-disclosure-bar__title {
  margin-bottom: var(--rv-ui-space-xs);
  font-weight: var(--rv-ui-font-weight-semibold);
}
/*
 * Sibagro bridge into @rv/ui-* theme contract.
 * Load after kit package CSS entries in main.tsx.
 */
body {
  --rv-ui-color-fg: var(--color-fg);
  --rv-ui-color-fg-muted: var(--color-fg-muted);
  --rv-ui-color-on-accent: var(--color-accent-fg);
  --rv-ui-color-surface: var(--color-surface);
  --rv-ui-color-surface-elevated: var(--color-bg-alt);
  --rv-ui-color-border: var(--color-border);
  /* SchemaTable sticky thead — solid mist, never transparent mix. */
  --ui-table-bg-alt: var(--color-bg-alt);
  --ui-table-border: var(--color-border);
  --ui-table-fg-muted: var(--color-fg-muted);
  --rv-ui-color-brand: var(--color-brand);
  --rv-ui-color-brand-hover: color-mix(in srgb, var(--color-brand) 88%, #000);
  /* Kit calendar year/month selection. Default in kit = brand; paprika here. */
  --ui-chrome-accent: var(--color-paprika);
  --rv-ui-color-positive: var(--color-delta-pos);
  --rv-ui-color-negative: var(--color-delta-neg);
  --rv-ui-color-neutral: var(--color-delta-neutral);
  --rv-ui-color-error: var(--color-error);
  --rv-ui-color-focus: var(--color-accent);
  --rv-ui-color-spark: var(--color-spark);

  --rv-ui-font-family: var(--font-body);
  --rv-ui-font-size-body: 13px;
  --rv-ui-font-size-label: 12px;
  --rv-ui-font-size-value: 1.875rem;
  --rv-ui-font-size-value-compact: 1.875rem;
  --rv-ui-font-size-value-hero: 2.375rem;
  --rv-ui-line-height-body: 1.35;
  --rv-ui-line-height-tight: 1.15;
  --rv-ui-font-weight-regular: 400;
  --rv-ui-font-weight-medium: 500;
  --rv-ui-font-weight-semibold: 600;

  --rv-ui-focus-width: 2px;
  --rv-ui-focus-offset: 2px;
  --rv-ui-border-width: 1px;
  --rv-ui-radius-sm: var(--radius-sm);
  --rv-ui-radius-md: var(--radius-md);
  --rv-ui-radius-card: var(--radius-lg);
  --rv-ui-space-xs: 4px;
  --rv-ui-space-sm: 8px;
  --rv-ui-space-md: 12px;
  --rv-ui-space-lg: 24px;
  --space-card: 12px;
  --rv-ui-space-card: 12px;
  --rv-ui-font-size-card-title: 15px;
  --rv-ui-font-family-card-title: var(--font-body);
  --rv-ui-border-width-card: 2px;

  --rv-ui-shadow-card:
    0 1px 0 color-mix(in srgb, var(--color-fg) 6%, transparent) inset,
    0 10px 32px color-mix(in srgb, #000 10%, transparent);
  --rv-ui-shadow-popover: 0 12px 28px color-mix(in srgb, #000 22%, transparent);
  --rv-ui-tooltip-shadow: var(--rv-ui-shadow-popover);
  --rv-ui-z-popover: 50;
  --rv-ui-z-tooltip: 10000;

  --rv-ui-tooltip-max-width: 360px;
  --rv-ui-tooltip-padding-block: 6px;
  --rv-ui-tooltip-padding-inline: 10px;
  --rv-ui-spinner-size-sm: 0.875rem;
  --rv-ui-spinner-size-md: 1.25rem;
  --rv-ui-spinner-size-lg: 1.75rem;
  --rv-ui-spinner-stroke-sm: 1.5px;
  --rv-ui-spinner-stroke-md: 2px;
  --rv-ui-spinner-stroke-lg: 3px;
  --rv-ui-skeleton-line-height: 1em;
  --rv-ui-skeleton-avatar-size: 2.5rem;
}
/**
 * Shared work-zone card chrome — map shell, materials table, future widgets.
 * Tokens: --widget-* in styles/tokens.css. Canon: docs/map-markers.md § Visual shell.
 */
.sibagro-widget {
  box-sizing: border-box;
  background: var(--color-surface);
  color: var(--color-fg);
  border: var(--widget-border);
  border-radius: var(--widget-radius);
  box-shadow: var(--widget-shadow);
  overflow: hidden;
  isolation: isolate;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html,
body,
#root {
  height: 100%;
}

#root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  margin: 0;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

/* Только img — глобальный svg { display:block } ломает kit chrome (reveal). */
img {
  display: block;
  max-width: 100%;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
