/* ==========================================================================
   PLYX · раздел «Финансы»

   Всё оформление раздела живёт в этом файле, классы — с префиксом fin-.
   Цвета: токены темы кабинета и их прозрачности (color-mix),
   тени — нейтральные чёрные. Новых оттенков здесь нет.
   Раздел адаптируется по собственной ширине (container queries), поэтому
   не зависит от того, развёрнуто ли боковое меню.
   ========================================================================== */

.fin {
  container: fin / inline-size;

  --plx-surface: var(--surface);
  --plx-surface-2: var(--raised);
  --plx-field: var(--base);
  --plx-line: color-mix(in srgb, var(--text) 13%, var(--surface));
  --plx-text: var(--text);
  --plx-muted: var(--muted);
  --plx-accent: var(--gold);
  --plx-accent-ink: var(--on-accent, #1a1306);
  --plx-font: "Golos Text", system-ui, sans-serif;
  --plx-mono: var(--mono);

  --ink: var(--plx-text);
  --ink-2: color-mix(in srgb, var(--plx-text) 80%, transparent);
  --mute: var(--plx-muted);
  --line: var(--plx-line);
  --line-soft: color-mix(in srgb, var(--plx-text) 6%, transparent);
  --line-strong: color-mix(in srgb, var(--plx-text) 15%, transparent);
  --wash: color-mix(in srgb, var(--plx-text) 4%, transparent);
  --hl: color-mix(in srgb, var(--plx-text) 5%, transparent);
  --hl-strong: color-mix(in srgb, var(--plx-text) 38%, transparent);
  --acc: var(--plx-accent);
  --acc-ink: var(--plx-accent-ink);
  --acc-wash: color-mix(in srgb, var(--plx-accent) 11%, transparent);
  --acc-line: color-mix(in srgb, var(--plx-accent) 34%, transparent);
  --acc-glow: color-mix(in srgb, var(--plx-accent) 45%, transparent);

  --r-card: 16px;
  --r-ctl: 11px;
  --shadow-card: inset 0 1px 0 var(--hl), 0 1px 2px rgb(0 0 0 / 0.4), 0 14px 32px -18px rgb(0 0 0 / 0.7);
  --shadow-lift: inset 0 1px 0 var(--hl), 0 2px 4px rgb(0 0 0 / 0.4), 0 24px 44px -18px rgb(0 0 0 / 0.9);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.32, 0.44, 1);

  color: var(--ink);
  font-family: var(--plx-font);
  font-size: 14px;
  line-height: 1.5;
  interpolate-size: allow-keywords;
}

.fin [hidden] { display:none!important; }
.fin :is(.fin-tab,.fin-col,.fin-btn) { border:0; background:transparent; }
.fin .fin-btn--ghost { border:1px solid var(--line); }
.fin .fin-btn--primary { background:var(--acc); }
.fin .fin-btn--ghost:hover { background:var(--wash); }
.fin .fin-col:active { transform:none; }
.fin .fin-error:not(#fin-calc-error) { margin-block:12px; }
.fin .fin-label, .fin .fin-seg__opt { margin:0; }
.fin .fin-field :is(input,select), .fin .fin-inputwrap input { min-height:0; }
.fin .fin-seg__opt input { min-height:0; }
.fin .fin-details { margin:0; }
.fin .fin-calc__col, .fin .fin-result { min-width:0; }
.fin .fin-chart-empty { position:absolute; inset:0; display:grid; place-items:center; color:var(--mute); pointer-events:none; }
.fin .fin-tablecard { overflow:hidden; }
.fin .fin-money__rest { color:inherit; opacity:.7; }
.fin .fin-actions { max-width:100%; flex-wrap:wrap; }
.fin .fin-meta__shop { overflow-wrap:anywhere; }
.fin .fin-btn { max-width:100%; white-space:normal; }
.fin .fin-total__value { overflow-wrap:anywhere; }

.fin-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.fin :is(button, a, summary, [tabindex='0']):focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* ── Анимации ─────────────────────────────────────────── */

@keyframes fin-rise {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--fin-dir, 0) * 14px), 10px, 0);
  }
}
@keyframes fin-fade {
  from {
    opacity: 0;
  }
}
@keyframes fin-row {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes fin-tick {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}
@keyframes fin-pop {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
}
@keyframes fin-grow-x {
  from {
    transform: scaleX(0);
  }
}
@keyframes fin-grow-y {
  from {
    transform: scaleY(0);
  }
}
@keyframes fin-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fin-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--acc-glow);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px transparent;
  }
}
@keyframes fin-sweep {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(280%);
  }
}
@keyframes fin-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* Появление блоков панели каскадом. fill-mode: backwards — после окончания
   анимация «отпускает» элемент, и hover-состояния работают как обычно. */
.fin-rise {
  animation: fin-rise 0.5s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}

/* ── Шапка раздела ────────────────────────────────────── */

.fin-title {
  margin: 0;
  font-size: clamp(30px, 4.4cqi, 40px);
  font-weight: 800;
  letter-spacing: -0.032em;
  line-height: 1.05;
}

.fin-sub {
  margin: 10px 0 0;
  color: var(--mute);
  font-size: 15px;
}

/* ── Вкладки и действия ───────────────────────────────── */

.fin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 26px;
}

/* обёртка даёт горизонтальный скролл на узких экранах и место под свечение */
.fin-tabs-scroll {
  max-width: calc(100% + 16px);
  margin: -8px -8px -24px;
  padding: 8px 8px 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.fin-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.fin-tabs {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--plx-surface-2);
  box-shadow:
    inset 0 1px 0 var(--hl),
    0 1px 2px rgb(0 0 0 / 0.35);
}

.fin-tabs__pill {
  position: absolute;
  top: 4px;
  left: 0;
  width: var(--w, 0);
  height: calc(100% - 8px);
  border-radius: 10px;
  background: var(--acc);
  box-shadow:
    inset 0 1px 0 var(--hl-strong),
    0 8px 20px -6px var(--acc-glow);
  transform: translateX(var(--x, 0));
  pointer-events: none;
}
.fin-tabs[data-ready] .fin-tabs__pill {
  transition:
    transform 0.5s var(--ease-spring),
    width 0.5s var(--ease-spring);
}

.fin-tab {
  position: relative;
  z-index: 1;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  color: var(--ink-2);
  font: 650 14px/1 var(--plx-font);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}
.fin-tab:hover {
  color: var(--ink);
}
.fin-tab[aria-selected='true'] {
  color: var(--acc-ink);
}
.fin .fin-tab:focus-visible {
  outline-offset: 3px;
}

.fin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
  margin-left: auto;
  animation: fin-fade 0.35s var(--ease-out) backwards;
}

.fin-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 7px;
  margin: 0;
  color: var(--mute);
  font-size: 13px;
}
.fin-meta__shop {
  color: var(--ink-2);
  font-weight: 700;
}
.fin-meta__sep {
  opacity: 0.5;
}
.fin-meta__time {
  display: inline-block;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  animation: fin-tick 0.4s var(--ease-out) backwards;
}

/* ── Кнопки ───────────────────────────────────────────── */

.fin-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  font: 650 14px/1 var(--plx-font);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.15s var(--ease-out),
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.25s ease;
}
.fin-btn:active {
  transform: scale(0.97);
}
.fin-btn[aria-busy='true'] {
  cursor: progress;
}
.fin-btn svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.fin-btn--ghost {
  border-color: var(--line);
  background: var(--plx-surface);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 var(--hl),
    0 1px 2px rgb(0 0 0 / 0.35);
}
.fin-btn--ghost:hover {
  border-color: var(--line-strong);
  background: var(--plx-surface-2);
}

.fin-btn--primary {
  height: 44px;
  padding: 0 18px;
  background: var(--acc);
  color: var(--acc-ink);
  box-shadow:
    inset 0 1px 0 var(--hl-strong),
    0 8px 20px -10px var(--acc-glow);
}
.fin-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 var(--hl-strong),
    0 12px 26px -8px var(--acc-glow);
}
.fin-btn--primary:active {
  transform: scale(0.97);
}

.fin-btn__icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--mute);
  transition: color 0.2s ease;
}
.fin-btn:hover .fin-btn__icon {
  color: var(--ink);
}
.fin-btn__icon svg {
  animation: fin-pop 0.35s var(--ease-spring) backwards;
}
.fin-btn[data-state='loading'] .fin-btn__icon,
.fin-btn[data-state='done'] .fin-btn__icon {
  color: var(--acc);
}
.fin-btn[data-state='loading'] .fin-btn__icon svg {
  animation: fin-spin 0.8s linear infinite;
}

/* загрузка у основной кнопки: спиннер поверх подписи, ширина не меняется */
.fin-btn__label {
  transition: opacity 0.15s ease;
}
.fin-btn .fin-btn__spinner {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  margin: auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.fin-btn[aria-busy='true'] .fin-btn__label {
  opacity: 0;
}
.fin-btn[aria-busy='true'] .fin-btn__spinner {
  opacity: 1;
  animation: fin-spin 0.8s linear infinite;
}

/* ── Полоса загрузки под вкладками ────────────────────── */

.fin-progress {
  position: relative;
  height: 2px;
  margin-top: 14px;
  border-radius: 2px;
  overflow: hidden;
}
.fin-progress::before,
.fin-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fin-progress::before {
  background: var(--line-soft);
}
.fin-progress::after {
  right: auto;
  width: 36%;
  background: linear-gradient(90deg, transparent, var(--acc) 50%, transparent);
}
.fin-progress[data-on]::before,
.fin-progress[data-on]::after {
  opacity: 1;
}
.fin-progress[data-on]::after {
  animation: fin-sweep 1.15s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* ── Панели ───────────────────────────────────────────── */

.fin-panel {
  margin-top: 14px;
}

.fin-stack {
  display: grid;
  gap: 16px;
  transition: opacity 0.3s ease;
}
.fin-panel[aria-busy='true'] .fin-stack {
  opacity: 0.5;
}

.fin-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--plx-surface);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--plx-text) 2.5%, transparent), transparent 96px);
  box-shadow: var(--shadow-card);
}

.fin-h {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.fin-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fin-money--kpi {
  /* крупные суммы — пропорциональными цифрами, табличные остаются в таблицах */
  font-variant-numeric: proportional-nums;
}
.fin-money--kpi .fin-money__rest {
  margin-left: 0.04em;
  color: var(--mute);
  font-size: 0.56em;
  font-weight: 650;
  letter-spacing: -0.015em;
}

/* заливки сегментов: один акцент + нейтральные прозрачности и штриховка */
.fin-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.fin-swatch--outline {
  border: 1.5px solid var(--line-strong);
}
.fin [data-fill='paid'],
.fin [data-fill='profit'] {
  background: var(--acc);
}
.fin [data-fill='sent'] {
  background: color-mix(in srgb, var(--plx-accent) 40%, transparent);
}
.fin [data-fill='problem'] {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--plx-text) 62%, transparent) 0 2px,
    color-mix(in srgb, var(--plx-text) 12%, transparent) 2px 6px
  );
}
.fin [data-fill='cost'] {
  background: color-mix(in srgb, var(--plx-text) 44%, transparent);
}
.fin [data-fill='sale'] {
  background: color-mix(in srgb, var(--plx-text) 30%, transparent);
}
.fin [data-fill='premium'] {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--plx-text) 48%, transparent) 0 2px,
    color-mix(in srgb, var(--plx-text) 12%, transparent) 2px 5px
  );
}
.fin [data-fill='withdraw'] {
  background: color-mix(in srgb, var(--plx-text) 17%, transparent);
}

/* ── Холд: главный показатель ─────────────────────────── */

.fin-hero {
  padding: 24px 26px 26px;
  overflow: clip;
}
.fin-hero::before,
.fin-kpi--accent::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(60% 140% at 0% 0%, color-mix(in srgb, var(--plx-accent) 10%, transparent), transparent 62%);
  pointer-events: none;
}
.fin-hero > *,
.fin-kpi > * {
  position: relative;
}

.fin-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mute);
  font: 500 11.5px/1.2 var(--plx-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fin-live {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acc);
  animation: fin-pulse 2.4s ease-out infinite;
}

.fin-hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin-top: 16px;
}
.fin-hero__value {
  font-size: clamp(40px, 6.4cqi, 56px);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
}
.fin-hero__count {
  color: var(--mute);
  font-size: 15px;
  font-weight: 500;
}
.fin-hero__count b,
.fin-stat__meta b {
  color: var(--ink);
  font-weight: 700;
}

.fin-split {
  display: flex;
  gap: 3px;
  height: 10px;
  margin-top: 24px;
}
.fin-split[data-empty] {
  border-radius: 999px;
  background: var(--wash);
}
.fin-split__seg {
  flex: var(--v) 1 0;
  min-width: 12px;
  border-radius: 3px;
  transform-origin: 0 50%;
  animation: fin-grow-x 0.7s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 100ms + 160ms);
  transition:
    opacity 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}
.fin-split__seg:first-child {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}
.fin-split__seg:last-child {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}
.fin-split[data-hot] .fin-split__seg:not([data-on]) {
  opacity: 0.22;
}
.fin-split__seg[data-on] {
  box-shadow: 0 0 18px -1px var(--acc-glow);
}
.fin .fin-split__seg[data-fill='sent'][data-on] {
  background: color-mix(in srgb, var(--plx-accent) 68%, transparent);
}

/* ── Холд: три статуса ────────────────────────────────── */

.fin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.fin-stat,
.fin-kpi {
  transition:
    transform 0.3s var(--ease-out),
    border-color 0.2s ease,
    box-shadow 0.3s ease;
}
.fin-stat:hover,
.fin-stat[data-hot] {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}
.fin-kpi:hover {
  border-color: var(--line-strong);
}

.fin-stat {
  padding: 18px 20px 20px;
}
.fin-stat__label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}
.fin-stat__value {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.fin-stat__meta {
  margin-top: 6px;
  color: var(--mute);
  font-size: 13px;
}
.fin-stat[data-zero] .fin-stat__value,
.fin-stat[data-zero] .fin-stat__meta b {
  color: var(--mute);
}
.fin-stat[data-alert] {
  border-color: var(--acc-line);
}

.fin-note {
  display: flex;
  gap: 10px;
  max-width: 104ch;
  margin: 2px 2px 0;
  color: var(--mute);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}
.fin-note > svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2.5px;
  opacity: 0.85;
}

/* ── Таблицы ──────────────────────────────────────────── */

.fin-tablecard {
  overflow: clip; /* clip, а не hidden: липкая шапка таблицы продолжает работать */
}

.fin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 14px;
}

/* ширины колонок; первая (товар) забирает остаток */
.fin-c-amount {
  width: 116px;
}
.fin-c-status {
  width: 150px;
}
.fin-c-date {
  width: 194px;
}
.fin-c-buyer {
  width: 172px;
}
.fin-c-day {
  width: 116px;
}

.fin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 44px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--plx-surface-2);
  color: var(--mute);
  font: 500 12px/1 var(--plx-mono);
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

.fin-table td {
  padding: 13px 20px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}
.fin-table tbody tr:first-child td {
  border-top-color: transparent;
}
.fin-table tbody tr {
  transition: background-color 0.15s ease;
}
.fin-table tbody tr:hover {
  background: var(--wash);
}

.fin-table .is-end {
  text-align: right;
}
.fin-table td[data-cell='amount'] {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fin-table td[data-cell='date'] {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fin-date {
  color: var(--ink-2);
}
.fin-time {
  color: var(--mute);
}

.fin-row-in {
  animation: fin-row 0.4s var(--ease-out) backwards;
}

.fin-cell-title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fin-cell-buyer {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--mute);
  font-size: 13px;
}
.fin-cell-title + .fin-cell-buyer {
  margin-top: 2px;
}
.fin-cell-buyer svg {
  flex: none;
  width: 13px;
  height: 13px;
  opacity: 0.8;
}
.fin-cell-buyer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fin-table td[data-cell='buyer'] .fin-cell-buyer {
  color: var(--ink-2);
  font-size: 13.5px;
}

.fin-table__empty {
  padding: 36px 20px;
  color: var(--mute);
  text-align: center;
}

.fin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.fin-pill svg {
  flex: none;
  width: 13px;
  height: 13px;
  color: var(--mute);
}
.fin-pill[data-status='paid'] svg {
  color: var(--acc);
}
.fin-pill[data-status='done'] {
  border-color: transparent;
  background: transparent;
  color: var(--mute);
}
.fin-pill[data-status='problem'] {
  border-color: var(--acc-line);
  background: var(--acc-wash);
  color: var(--acc);
}
.fin-pill[data-status='problem'] svg {
  color: inherit;
}

/* ── Продажи: показатели и график ─────────────────────── */

.fin-salestop {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2.25fr);
  gap: 16px;
}

.fin-kpis {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 16px;
}

.fin-kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 136px;
  padding: 18px 20px 22px 22px;
  overflow: clip;
}
.fin-kpi__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}
.fin-kpi__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--wash);
  color: var(--mute);
}
.fin-kpi__icon svg {
  width: 15px;
  height: 15px;
}
.fin-kpi--accent .fin-kpi__icon {
  border-color: var(--acc-line);
  background: var(--acc-wash);
  color: var(--acc);
}
.fin-kpi__value {
  font-size: clamp(30px, 3.9cqi, 38px);
  font-weight: 750;
  font-variant-numeric: proportional-nums;
  letter-spacing: -0.035em;
  line-height: 1;
}

.fin-chart {
  --gutter: 58px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 22px 18px;
}

.fin-chart__plot {
  position: relative;
  flex: 1;
  min-height: 188px;
  margin: 36px 0 0 var(--gutter);
  border-radius: 8px;
}
.fin .fin-chart__plot:focus-visible {
  outline-offset: 8px;
}

.fin-chart__tick {
  position: absolute;
  inset: auto 0 var(--y) 0;
  border-top: 1px dashed var(--line-soft);
}
.fin-chart__tick[data-zero] {
  border-top: 1px solid var(--line);
}
.fin-chart__tick span {
  position: absolute;
  top: -8px;
  right: calc(100% + 12px);
  color: var(--mute);
  font: 500 11px/16px var(--plx-mono);
  white-space: nowrap;
}

.fin-chart__cols {
  position: absolute;
  inset: 0;
  display: flex;
}

.fin-col {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  padding: 0 clamp(1px, 0.5cqi, 5px);
}
.fin-col::before {
  content: '';
  position: absolute;
  inset: -8px 1px 0;
  border-radius: 8px;
  background: var(--wash);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.fin-col[data-on]::before {
  opacity: 1;
}

.fin-col__bar {
  position: relative;
  width: 100%;
  max-width: 36px;
  height: var(--h);
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--acc), color-mix(in srgb, var(--plx-accent) 56%, transparent));
  box-shadow: inset 0 1px 0 var(--hl-strong);
  transform-origin: 50% 100%;
  animation: fin-grow-y 0.65s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 22ms + 140ms);
  transition:
    opacity 0.2s ease,
    box-shadow 0.2s ease;
}
.fin-chart[data-hot] .fin-col:not([data-on]) .fin-col__bar {
  opacity: 0.3;
}
.fin-col[data-on] .fin-col__bar {
  box-shadow:
    inset 0 1px 0 var(--hl-strong),
    0 0 24px -2px var(--acc-glow);
}

.fin-chart__x {
  display: flex;
  margin: 10px 0 0 var(--gutter);
}
.fin-chart__x span {
  flex: 1 1 0;
  min-width: 0;
  color: var(--mute);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  transition: color 0.18s ease;
}
.fin-chart__x span[data-on] {
  color: var(--ink);
}

.fin-tip {
  position: absolute;
  z-index: 3;
  bottom: min(calc(var(--h) + 12px), calc(100% - 20px));
  left: clamp(48px, var(--x), calc(100% - 48px));
  padding: 8px 11px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--plx-surface-2);
  box-shadow:
    inset 0 1px 0 var(--hl),
    0 14px 32px -12px rgb(0 0 0 / 0.85);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  translate: -50% 0;
  scale: 0.96;
  transform-origin: 50% 100%;
  transition:
    left 0.22s var(--ease-out),
    bottom 0.22s var(--ease-out),
    opacity 0.15s ease,
    scale 0.15s ease;
}
.fin-tip[data-on] {
  opacity: 1;
  scale: 1;
}
.fin-tip__day {
  color: var(--mute);
  font: 500 11px/1 var(--plx-mono);
}
.fin-tip__val {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ── Калькулятор ──────────────────────────────────────── */

.fin-lead {
  max-width: 80ch;
  margin: 2px 2px 0;
  color: var(--mute);
  font-size: 14.5px;
  line-height: 1.55;
  text-wrap: pretty;
}

.fin-calc {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.fin-calc__col {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.fin-form {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
}

.fin-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.fin-label {
  padding: 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.fin-input,
.fin-select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--plx-field);
  color: var(--ink);
  font: 550 14.5px/1.2 var(--plx-font);
  text-overflow: ellipsis;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.22s ease;
}
.fin-input::placeholder {
  color: var(--mute);
  font-weight: 500;
  opacity: 0.85;
}
.fin-input:hover,
.fin-select:hover {
  border-color: var(--line-strong);
}
.fin-input:focus-visible,
.fin-select:focus-visible {
  border-color: var(--acc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--plx-accent) 16%, transparent);
}
.fin-input[aria-invalid='true'] {
  border-color: var(--acc-line);
}
.fin-input--num {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fin-selectwrap,
.fin-inputwrap {
  position: relative;
  min-width: 0;
}
.fin-selectwrap > svg,
.fin-inputwrap > svg {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--mute);
  pointer-events: none;
  translate: 0 -50%;
  transition: color 0.18s ease;
}
.fin-selectwrap > svg {
  right: 14px;
}
.fin-inputwrap > svg {
  left: 14px;
}
.fin-selectwrap:hover > svg {
  color: var(--ink);
}
.fin-inputwrap:focus-within > svg {
  color: var(--acc);
}
.fin-select {
  appearance: none;
  padding-right: 42px;
  text-overflow: ellipsis;
  cursor: pointer;
}
.fin-select[data-empty] {
  color: var(--mute);
}
.fin-select option {
  background: var(--plx-surface);
  color: var(--plx-text);
}
.fin-inputwrap .fin-input {
  padding-left: 40px;
}

.fin-linkrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.fin-error {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  animation: fin-tick 0.3s var(--ease-out) backwards;
}
.fin-error svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--acc);
}

.fin-details {
  overflow: clip;
}
.fin-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  color: var(--acc);
  font-size: 14px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.18s ease;
}
.fin-details > summary::-webkit-details-marker {
  display: none;
}
.fin-details > summary:hover {
  background: var(--wash);
}
.fin .fin-details > summary:focus-visible {
  border-radius: var(--r-card);
  outline-offset: -3px;
}
.fin-details__chev {
  flex: none;
  width: 16px;
  height: 16px;
  transition: rotate 0.35s var(--ease-out);
}
.fin-details[open] .fin-details__chev {
  rotate: 90deg;
}
.fin-details__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 2px 22px 22px;
}
/* плавное раскрытие нативного <details> (Chrome 131+); в остальных — мгновенно */
.fin-details::details-content {
  block-size: 0;
  overflow: clip;
  opacity: 0;
  transition:
    block-size 0.42s var(--ease-out),
    opacity 0.3s ease,
    content-visibility 0.42s allow-discrete;
}
.fin-details[open]::details-content {
  block-size: auto;
  opacity: 1;
}

.fin-seg {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.fin-seg > legend {
  margin-bottom: 8px;
}
.fin-seg__track {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--plx-field);
}
.fin-seg__opt {
  position: relative;
  display: block;
  cursor: pointer;
}
.fin-seg__opt input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.fin-seg__opt span {
  display: grid;
  place-items: center;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--mute);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}
.fin-seg__opt:hover span {
  color: var(--ink);
}
.fin-seg__opt input:checked + span {
  border-color: var(--line-strong);
  background: var(--plx-surface-2);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 var(--hl),
    0 1px 2px rgb(0 0 0 / 0.4);
}
.fin-seg__opt input:focus-visible + span {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

.fin-form--params {
  container: fin-params / inline-size;
}
.fin-params {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
}
@container fin-params (max-width: 470px) {
  .fin-params {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fin-params > :last-child {
    grid-column: 1 / -1;
  }
}
.fin-help {
  margin: 0;
  color: var(--mute);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* результат */

.fin-result {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  min-height: 372px;
  padding: 20px 22px 22px;
}
.fin-result__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 16px;
  animation: fin-fade 0.35s ease backwards;
}

.fin-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px 8px 6px;
  text-align: center;
  animation: fin-fade 0.35s ease backwards;
}
.fin-empty__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--wash);
  color: var(--ink-2);
  box-shadow: inset 0 1px 0 var(--hl);
}
.fin-empty__icon svg {
  width: 20px;
  height: 20px;
}
.fin-empty p {
  max-width: 30ch;
  margin: 0;
  color: var(--mute);
  font-size: 14px;
  text-wrap: balance;
}
.fin-empty__ghost {
  display: grid;
  gap: 14px;
  width: 100%;
  margin-top: 20px;
  padding-top: 22px;
  border-top: 1px dashed var(--line-soft);
}
.fin-empty__ghost i {
  display: flex;
  justify-content: space-between;
}
.fin-empty__ghost i::before,
.fin-empty__ghost i::after {
  content: '';
  height: 10px;
  border-radius: 5px;
  background: var(--wash);
}
.fin-empty__ghost i::before {
  width: var(--a);
}
.fin-empty__ghost i::after {
  width: var(--b);
}

.fin-src {
  padding: 13px 14px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--plx-field) 55%, transparent);
}
.fin-src__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.fin-src__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fin-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--wash);
  color: var(--ink-2);
  font: 500 11.5px/1 var(--plx-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fin-chip--accent {
  border-color: var(--acc-line);
  background: var(--acc-wash);
  color: var(--acc);
}

.fin-flow {
  display: flex;
  flex: none;
  gap: 3px;
  height: 8px;
  margin-top: 18px;
  border-radius: 999px;
}
.fin-flow[data-empty] {
  background: var(--wash);
}
.fin-flow__seg {
  flex: var(--v) 1 0;
  min-width: 4px;
  border-radius: 2px;
  animation: fin-fade 0.3s ease backwards;
  transition: flex-grow 0.5s var(--ease-out);
}
.fin-flow__seg:first-child {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}
.fin-flow__seg:last-child {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.fin-rows {
  display: grid;
  margin: 12px 0 16px;
}
.fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px dashed var(--line-soft);
  font-size: 14px;
  animation: fin-row 0.4s var(--ease-out) backwards;
}
.fin-row:first-child {
  border-top: 0;
}
.fin-row:nth-child(2) {
  animation-delay: 40ms;
}
.fin-row:nth-child(3) {
  animation-delay: 80ms;
}
.fin-row:nth-child(4) {
  animation-delay: 120ms;
}
.fin-row:nth-child(5) {
  animation-delay: 160ms;
}
.fin-row dt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink-2);
}
.fin-row dd {
  margin: 0;
  font-weight: 650;
}
.fin-row[data-zero] dd {
  color: var(--mute);
}

.fin-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 16px 16px 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--plx-surface-2);
  box-shadow: inset 0 1px 0 var(--hl);
}
.fin-total__label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 550;
}
.fin-total__value {
  display: block;
  margin-top: 10px;
  color: var(--acc);
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
}
.fin-total__value .fin-money__rest {
  color: inherit;
  opacity: 0.6;
}
.fin-total[data-negative] .fin-total__value {
  color: var(--ink);
}

.fin-skel {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--wash) 20%, color-mix(in srgb, var(--plx-text) 10%, transparent) 50%, var(--wash) 80%) 0 0 /
    220% 100%;
  animation: fin-shimmer 1.25s linear infinite;
}
.fin-skelrow {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px dashed var(--line-soft);
}

.fin-foot {
  flex-direction: column;
  gap: 8px;
}
.fin-foot__text {
  display: flex;
  gap: 10px;
}
.fin-foot__text svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2.5px;
  opacity: 0.85;
}
.fin-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 3px;
  margin-left: 25px;
  padding-bottom: 2px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  color: var(--acc);
  font-weight: 650;
  text-decoration: none;
  transition: background-size 0.35s var(--ease-out);
}
.fin-link:hover {
  background-size: 100% 1px;
}
.fin-link svg {
  width: 14px;
  height: 14px;
  transition: translate 0.25s var(--ease-out);
}
.fin-link:hover svg {
  translate: 2px -2px;
}

/* ── Адаптив по ширине самого раздела ─────────────────── */

@container fin (max-width: 920px) {
  .fin-salestop {
    grid-template-columns: minmax(0, 1fr);
  }
  .fin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fin-calc {
    grid-template-columns: minmax(0, 1fr);
  }
  .fin-result {
    position: static;
    min-height: 0;
  }

  /* таблица продаж (5 колонок) становится списком в две строки */
  .fin-table--sales,
  .fin-table--sales tbody {
    display: block;
  }
  .fin-table--sales colgroup {
    display: none;
  }
  .fin-table--sales thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .fin-table--sales tbody tr {
    display: grid;
    grid-template-areas:
      'main main amount'
      'buyer date status';
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 14px;
    padding: 13px 18px;
    border-top: 1px solid var(--line-soft);
  }
  .fin-table--sales tbody tr:first-child {
    border-top: 0;
  }
  .fin-table--sales td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .fin-table--sales td[data-cell='main'] {
    grid-area: main;
  }
  .fin-table--sales td[data-cell='amount'] {
    grid-area: amount;
    justify-self: end;
  }
  .fin-table--sales td[data-cell='buyer'] {
    grid-area: buyer;
  }
  .fin-table--sales td[data-cell='date'] {
    grid-area: date;
  }
  .fin-table--sales td[data-cell='status'] {
    grid-area: status;
    justify-self: end;
  }
  .fin-table--sales td[data-cell='buyer'] .fin-cell-buyer,
  .fin-table--sales .fin-date {
    color: var(--mute);
    font-size: 13px;
  }
  .fin-table--sales .fin-pill[data-status='done'] {
    padding-right: 0;
  }
  .fin-table--sales .fin-table__empty {
    grid-column: 1 / -1;
  }
}

/* Холд: колонки плотнее, время уходит под дату */
@container fin (max-width: 820px) {
  .fin-table--hold th,
  .fin-table--hold td {
    padding-inline: 16px;
  }
  .fin-table--hold .fin-c-amount {
    width: 104px;
  }
  .fin-table--hold .fin-c-status {
    width: 136px;
  }
  .fin-table--hold .fin-c-date {
    width: 118px;
  }
  .fin-table--hold .fin-time {
    display: block;
  }
}

/* метка «Обновлено» с кнопкой перестают помещаться рядом с вкладками */
@container fin (max-width: 850px) {
  .fin-actions--hold {
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
  }
}

@container fin (max-width: 620px) {
  .fin-stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .fin-stat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 14px;
    padding: 15px 18px;
  }
  .fin-stat__value {
    grid-row: 1 / span 2;
    grid-column: 2;
    margin: 0;
    font-size: 22px;
  }
  .fin-stat__meta {
    grid-column: 1;
    margin: 0;
    padding-left: 20px;
  }
}

/* Холд: строка таблицы становится карточкой; шапка остаётся для скринридеров */
@container fin (max-width: 600px) {
  .fin-table--hold,
  .fin-table--hold tbody {
    display: block;
  }
  .fin-table--hold colgroup {
    display: none;
  }
  .fin-table--hold thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .fin-table--hold tbody tr {
    display: grid;
    grid-template-areas:
      'main amount'
      'date status';
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 14px;
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
  }
  .fin-table--hold tbody tr:first-child {
    border-top: 0;
  }
  .fin-table--hold td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .fin-table--hold td.is-end {
    text-align: left;
  }
  .fin-table--hold td[data-cell='main'] {
    grid-area: main;
  }
  .fin-table--hold td[data-cell='amount'] {
    grid-area: amount;
    align-self: start;
    justify-self: end;
  }
  .fin-table--hold td[data-cell='date'] {
    grid-area: date;
    font-size: 13px;
  }
  .fin-table--hold td[data-cell='status'] {
    grid-area: status;
    justify-self: end;
  }
  .fin-table--hold .fin-time {
    display: inline;
  }
  .fin-table--hold .fin-cell-title {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .fin-table--hold .fin-table__empty {
    grid-column: 1 / -1;
    text-align: center;
  }
}

@container fin (max-width: 560px) {
  .fin-actions--sales {
    width: 100%;
    margin-left: 0;
  }
  .fin-sub {
    font-size: 14px;
  }
  .fin-tab {
    padding: 0 13px;
    font-size: 13.5px;
  }
  .fin-hero {
    padding: 20px 18px 22px;
  }
  .fin-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .fin-kpi {
    gap: 16px;
    min-height: 0;
    padding: 16px 16px 20px 18px;
  }
  .fin-chart {
    --gutter: 0px;
    padding: 18px 14px 16px;
  }
  .fin-chart__tick span {
    display: none;
  }
  .fin-chart__x span {
    font-size: 10.5px;
  }
  .fin-chart__x span:nth-last-child(even) {
    visibility: hidden;
  }
  .fin-form,
  .fin-result {
    padding: 18px;
  }
  .fin-linkrow {
    grid-template-columns: minmax(0, 1fr);
  }
  .fin-details > summary {
    padding: 15px 18px;
  }
  .fin-details__body {
    grid-template-columns: minmax(0, 1fr);
    padding: 2px 18px 18px;
  }
  .fin-total__value {
    font-size: 28px;
  }
}

/* самые узкие экраны: вкладки компактнее, чтобы все три помещались без прокрутки */
@container fin (max-width: 330px) {
  .fin-tab {
    padding: 0 8px;
    font-size: 12.5px;
  }
}

@container fin (max-width: 480px) {
  .fin-table--sales tbody tr {
    grid-template-areas:
      'main main'
      'buyer amount'
      'date status';
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 16px;
  }
  .fin-table--sales .fin-cell-title {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* ── Меньше движения ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .fin *,
  .fin *::before,
  .fin *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.fin-defaults__bar{display:flex;align-items:center;gap:12px;margin-top:12px}
.fin-defaults .fin-params{margin-top:8px}
