/* Компоненты (Дизайн-спека §4). Состояния: обычное, нажатие, наведение, фокус, отключено, загрузка, пусто, ошибка.
   Классы .is-pressed и .is-hover повторяют :active и :hover, чтобы страница «Витрина» могла показать состояние статично. */

/* ---------- Карточка ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: var(--pad);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.card--nested {
  background: var(--surface-2);
  border: 0;
  border-radius: var(--r-m);
  box-shadow: none;
  padding: var(--s-3) var(--s-4);
}
.card--press {
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
  color: inherit;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.card--press:active,
.card--press.is-pressed {
  transform: scale(0.985);
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .card--press:hover {
    border-color: var(--line-2);
  }
}
.card--press.is-hover {
  border-color: var(--line-2);
}
.card.is-disabled {
  color: var(--disabled);
  cursor: not-allowed;
}
.card.is-error {
  border-color: var(--stop-line);
}

.card--hero {
  background: var(--hero-fill);
  border: 0;
  border-radius: var(--r-xl);
  padding: var(--pad-hero);
  box-shadow: var(--glow-hero);
  color: var(--hero-text);
  overflow: hidden;
  isolation: isolate;
}
.card--hero::before,
.card--hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 56px solid var(--hero-ring);
  pointer-events: none;
  z-index: -1;
}
.card--hero::before {
  width: 280px;
  height: 280px;
  right: -90px;
  top: -110px;
}
.card--hero::after {
  width: 420px;
  height: 420px;
  right: -190px;
  top: -70px;
  border-width: 1px;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.card__tile {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  background: var(--surface-2);
  color: var(--accent-text);
}

/* ---------- Скелет загрузки ---------- */
.skel {
  display: block;
  height: 1em;
  border-radius: var(--s-2);
  background: var(--skel);
  background-size: 200% 100%;
  animation: skel 1.6s linear infinite;
}
.skel--line {
  height: 14px;
  border-radius: var(--s-2);
}
.skel--num {
  height: 40px;
  width: 6ch;
  border-radius: var(--r-s);
}
.skel--ring {
  border-radius: 50%;
}
.skel--hero {
  background: var(--hero-chip);
  animation: none;
}
@keyframes skel {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skel {
    animation: none;
    background: var(--surface-2);
  }
}

/* ---------- Крупная цифра ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}
.stat__value {
  font: 800 var(--t-num-l) / 1 var(--f-display);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.stat--hero .stat__value {
  font-size: var(--t-hero);
  color: var(--hero-text);
  letter-spacing: -0.005em;
}
.stat--m .stat__value {
  font-size: var(--t-num-m);
}
.stat--s .stat__value {
  font-size: var(--t-num-s);
}
.stat__hint {
  font-size: var(--t-small);
  line-height: 1.43;
  color: var(--mute);
}
.stat__value.is-error {
  font-size: var(--t-h2);
  font-family: var(--f-text);
  font-weight: 600;
  color: var(--stop-text);
  display: inline-flex;
  gap: var(--s-2);
  align-items: center;
}
.stat__stamp {
  font-size: var(--t-small);
  color: var(--mute);
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--hero-chip);
  color: var(--hero-text);
  font: 600 var(--t-label) / 1.3 var(--f-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hero-chip--text {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--t-small);
  font-weight: 600;
  padding: 7px 14px;
}
.hero-line {
  font: 500 1.25rem / 1.35 var(--f-text);
  color: var(--hero-text);
  max-width: 28ch;
}
.bar {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--hero-track);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: var(--r-pill);
  background: var(--hero-text);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  animation: bar-in var(--dur-ring) var(--ease-out) both;
}
@keyframes bar-in {
  from {
    transform: scaleX(0);
  }
}
.bar--plain {
  background: var(--surface-2);
}
.bar--plain > i {
  background: var(--btn-fill);
}

/* ---------- Кольцо прогресса ---------- */
.ring-stop-a {
  stop-color: var(--ring-fill-a);
}
.ring-stop-b {
  stop-color: var(--ring-fill-b);
}
.ring {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--ring-d, 128px);
  height: var(--ring-d, 128px);
  flex: none;
}
.ring--l {
  --ring-d: 112px;
}
.ring--s {
  --ring-d: 44px;
}
@media (min-width: 640px) {
  .ring--l {
    --ring-d: 128px;
  }
}
.ring > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ring__track,
.ring__fill {
  fill: none;
  transform: rotate(-90deg);
  transform-box: fill-box;
  transform-origin: center;
}
.ring__track {
  stroke: var(--ring-track);
}
.ring__fill {
  stroke: url(#rko-ring-grad);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p, 0));
}
.ring.is-anim .ring__fill {
  animation: ring-in var(--dur-ring) var(--ease-out) both;
}
@keyframes ring-in {
  from {
    stroke-dashoffset: 100;
  }
}
.ring.is-full .ring__fill {
  stroke: var(--ok);
}
.ring.is-error .ring__fill,
.ring.is-error .ring__track {
  stroke: var(--stop-line);
}
.ring.is-loading .ring__track {
  animation: pulse 1.6s linear infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}
.ring__c {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.ring__c b {
  font: 800 var(--t-num-m) / 1 var(--f-display);
}
.ring--s .ring__c b {
  font: 700 0.8125rem / 1 var(--f-text);
}
.ring--s .ring__c {
  letter-spacing: -0.01em;
}
.ring__c .icon {
  color: var(--ok);
}
.ring--btn {
  cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out);
}
.ring--btn:active,
.ring--btn.is-pressed {
  transform: scale(0.98);
}

/* ---------- Кнопки ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--h-btn);
  padding: 0 var(--s-6);
  border-radius: var(--r-m);
  font: 600 var(--t-btn) / 1.2 var(--f-text);
  white-space: nowrap;
  user-select: none;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.btn.is-focused {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.btn--call {
  min-height: var(--h-btn-call);
}
.btn--block {
  display: flex;
  width: 100%;
}
.btn:active,
.btn.is-pressed {
  transform: scale(0.97);
}
.btn--primary {
  background: var(--btn-fill);
  color: var(--accent-ink);
  box-shadow: var(--glow-btn);
}
.btn--primary:active,
.btn--primary.is-pressed {
  box-shadow: none;
}
.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn--quiet {
  color: var(--accent-text);
  padding: 0 var(--s-4);
}
.btn--danger {
  background: var(--stop-soft);
  color: var(--stop-text);
  box-shadow: inset 0 0 0 1px var(--stop-line);
}
.btn--icon {
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-m);
}
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    filter: brightness(1.06);
  }
  .btn--secondary:hover {
    box-shadow: inset 0 0 0 1px var(--text-2);
  }
  .btn--quiet:hover {
    background: var(--accent-soft);
  }
}
.btn--quiet.is-hover {
  background: var(--accent-soft);
}
.btn--primary.is-hover {
  filter: brightness(1.06);
}
.btn--secondary.is-hover {
  box-shadow: inset 0 0 0 1px var(--text-2);
}
.btn[aria-disabled="true"],
.btn:disabled {
  background: var(--surface-2);
  color: var(--disabled);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}
.btn--quiet[aria-disabled="true"] {
  background: none;
}
.btn.is-loading {
  cursor: progress;
}
.btn.is-loading > .btn__label {
  opacity: 0.65;
}
.spin {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.form-error {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  color: var(--stop-text);
  font-size: var(--t-small);
  line-height: 1.43;
  margin-top: var(--s-2);
}

/* ---------- Чипы и вкладки-папки ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--text-2);
  font: 600 0.8125rem / 1 var(--f-text);
  white-space: nowrap;
}
.chip--ok {
  background: var(--ok-soft);
  box-shadow: none;
  color: var(--ok);
}
.chip--warn {
  background: var(--warn-soft);
  box-shadow: none;
  color: var(--warn);
}
.chip--stop {
  background: var(--stop-soft);
  box-shadow: none;
  color: var(--stop-text);
}
.chip--now {
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent-text);
}
.chip--demo {
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--t-label);
}
.chips {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 0;
  -webkit-mask-image: linear-gradient(90deg, var(--bg) calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, var(--bg) calc(100% - 24px), transparent);
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font: 600 0.8125rem / 1 var(--f-text);
  scroll-snap-align: start;
  box-shadow: inset 0 0 0 1px var(--edge);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip-tab:active,
.chip-tab.is-pressed {
  transform: scale(0.97);
}
.chip-tab[aria-selected="true"],
.chip-tab[aria-checked="true"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.chip-tab__n {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.chip-tab.is-loading .chip-tab__n {
  display: inline-block;
  width: 16px;
  height: 12px;
  border-radius: 4px;
  background: var(--raised);
  color: transparent;
}

/* Нижняя панель навигации (телефон) */
.tabbar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 5), 1fr);
  height: var(--h-tabbar);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tabbar__ind {
  position: absolute;
  top: -1px;
  left: 0;
  width: calc(100% / var(--n, 5));
  height: 3px;
  display: grid;
  place-items: center;
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform var(--dur-base) var(--ease-in-out);
  pointer-events: none;
}
.tabbar__ind::after {
  content: "";
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--mute);
  font: 500 0.75rem / 1 var(--f-text);
  min-width: 0;
  transition: transform var(--dur-press) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tab:active,
.tab.is-pressed {
  transform: scale(0.97);
}
.tab[aria-current="page"] {
  color: var(--accent-text);
}
.tabbar.is-none .tabbar__ind {
  opacity: 0;
}
.tab__badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--stop);
  color: var(--on-stop);
  font: 700 0.6875rem / 18px var(--f-text);
  text-align: center;
}

/* ---------- Поле ввода ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}
.field__label {
  font: 600 var(--t-label) / 1.3 var(--f-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
}
.field__box {
  position: relative;
  display: flex;
  align-items: center;
}
.field__input {
  width: 100%;
  height: var(--h-field);
  padding: 0 var(--s-4);
  background: var(--surface-2);
  border: 0;
  border-radius: var(--r-s);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
.field__input::placeholder {
  color: var(--mute);
}
.field__input:focus,
.field.is-focus .field__input {
  box-shadow: inset 0 0 0 2px var(--accent-text);
}
.field__input--area {
  height: auto;
  min-height: 112px;
  padding: var(--s-3) var(--s-4);
  line-height: 1.5;
  resize: none;
  font-family: inherit;
}
.field__input:disabled {
  color: var(--disabled);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: not-allowed;
}
.field.is-error .field__input,
.field__input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 2px var(--stop);
}
.field__suffix {
  position: absolute;
  right: var(--s-4);
  color: var(--mute);
  font-weight: 600;
  pointer-events: none;
}
.field__box--suffix .field__input {
  padding-right: var(--s-8);
}
.field__help {
  font-size: var(--t-small);
  line-height: 1.43;
  color: var(--mute);
}
.field__err {
  display: flex;
  gap: var(--s-2);
  font-size: var(--t-small);
  line-height: 1.43;
  color: var(--stop-text);
}
.field .spin {
  position: absolute;
  right: var(--s-4);
  color: var(--mute);
}

/* ---------- Строка списка (лид) ---------- */
.rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 72px;
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  text-align: left;
  width: 100%;
  color: inherit;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.row:active,
.row.is-pressed {
  transform: scale(0.985);
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .row:hover {
    border-color: var(--line-2);
  }
}
.row.is-hover {
  border-color: var(--line-2);
}
.row.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.row.is-hot {
  border-color: var(--stop-line);
}
.row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row__title {
  font: 500 var(--t-body) / 1.4 var(--f-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}
.row__meta .chip {
  flex: none;
  max-width: 100%;
}
.row__sub {
  min-width: 0;
  font-size: var(--t-small);
  line-height: 1.43;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* телефон: имя получает всю ширину, чип этапа живёт второй строкой, ник скрыт (он в карточке лида) */
@media (max-width: 639px) {
  .row__sub {
    display: none;
  }
}
.row__when {
  flex: none;
  align-self: flex-start;
  font-size: var(--t-small);
  color: var(--mute);
  white-space: nowrap;
}
.row.is-loading {
  pointer-events: none;
}
.row--plain {
  min-height: 64px;
}

/* ---------- Предупреждение КАПСОМ ---------- */
.caps-warn {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4) var(--s-5);
  background: var(--stop-soft);
  border: 1px solid var(--stop-line);
  border-radius: var(--r-m);
  color: var(--stop-text);
  font: 800 var(--t-caps-warn) / 1.3 var(--f-text);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.caps-warn .icon {
  margin-top: 1px;
}
.caps-warn--accent {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
}
.caps-warn--accent .icon {
  color: var(--accent-text);
}
.caps-warn--sticky {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

/* ---------- Пусто и ошибка ---------- */
.empty,
.errbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-5);
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  color: var(--mute);
}
.errbox__icon {
  color: var(--stop-text);
}
.empty__title,
.errbox__title {
  font: 700 var(--t-h2) / var(--t-lh-h2) var(--f-text);
}
.empty p,
.errbox p {
  color: var(--mute);
  max-width: 40ch;
}
.banner {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-s);
  font-size: var(--t-small);
  line-height: 1.43;
}
.banner--warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.banner--stop {
  background: var(--stop-soft);
  color: var(--stop-text);
}
.banner .btn {
  min-height: 36px;
  margin-left: auto;
}

/* ---------- Тост ---------- */
.toast-stack {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--h-tabbar) + var(--s-4) + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter);
}
@media (min-width: 1024px) {
  /* по центру колонки с содержимым, а не окна: слева боковая панель */
  .toast-stack {
    left: var(--w-side);
    bottom: var(--s-6);
  }
}
.toast__ok {
  flex: none;
  color: var(--ok);
}
.toast {
  position: relative;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  pointer-events: auto;
  font-size: var(--t-small);
  line-height: 1.43;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.toast.is-enter {
  opacity: 0;
  transform: translateY(12px);
}
.toast.is-leave {
  opacity: 0;
  transition-duration: var(--dur-fast);
}
.toast .btn {
  min-height: 44px;
}
.toast__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  animation: timer var(--toast-ms, 6000ms) linear forwards;
}
@keyframes timer {
  to {
    transform: scaleX(0);
  }
}
.toast--static .toast__timer {
  animation: none;
  transform: scaleX(0.6);
}

/* ---------- Всплывающее «+N ₽» ---------- */
.pop {
  display: inline-flex;
  padding: 6px 20px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--accent-line), var(--glow-pop);
  color: var(--accent-hi); /* подложка «+N ₽» всегда тёмная (--accent-ink), поэтому и цифра светлая в обеих темах */
  font: 800 2rem / 1 var(--f-display);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.pop.is-run {
  animation: pop var(--dur-pop) linear both;
}
@keyframes pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
    animation-timing-function: var(--ease-pop);
  }
  16% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  64% {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation-timing-function: var(--ease-out);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pop.is-run {
    animation: pop-soft 1.5s linear both;
  }
}
@keyframes pop-soft {
  0% {
    opacity: 0;
  }
  10%,
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- Итог созвона ---------- */
.recap {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--pad-hero);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
}
.recap__lead {
  font: 700 var(--t-h2) / var(--t-lh-h2) var(--f-text);
  color: var(--text-2);
  max-width: 24ch;
}
.recap__sum {
  font: 800 var(--t-sum) / 1 var(--f-display);
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
  white-space: nowrap;
}
.recap__tail {
  font: 700 var(--t-h2) / var(--t-lh-h2) var(--f-text);
  color: var(--text);
  max-width: 24ch;
}
.recap__left {
  margin-top: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.recap__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border-radius: var(--r-m);
}
.recap__item b {
  font: 800 var(--t-num-s) / 1 var(--f-display);
}
.recap__item span {
  min-width: 0;
}

/* ---------- Слои: нижний лист / правая панель ---------- */
.layer {
  position: absolute;
  inset: 0;
  padding-bottom: var(--kb, 0px); /* лист стоит над экранной клавиатурой (layer.js, watchKeyboard) */
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.layer__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--dur-sheet) var(--ease-out);
}
.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(92dvh - var(--kb, 0px));
  display: flex;
  flex-direction: column;
  background: var(--raised);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-raised);
  transform: translateY(100%);
  transition: transform var(--dur-sheet) var(--ease-drawer);
  padding-bottom: env(safe-area-inset-bottom);
}
.layer.is-open .layer__scrim {
  opacity: 1;
}
.layer.is-open .sheet {
  transform: translateY(0);
}
.layer.is-closing .sheet {
  transition-duration: 200ms;
}
.layer.is-closing .layer__scrim {
  transition-duration: 200ms;
}
.sheet__grip {
  flex: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: var(--s-3) auto 0;
}
.sheet__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5) var(--s-2);
}
.sheet__title {
  font: 700 var(--t-h2) / var(--t-lh-h2) var(--f-text);
}
.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-2) var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  overscroll-behavior: contain;
}
@media (min-width: 1024px) {
  .layer {
    align-items: stretch;
    justify-content: flex-end;
  }
  .sheet {
    width: 480px;
    max-width: 480px;
    max-height: none;
    height: 100%;
    border-radius: var(--r-xl) 0 0 var(--r-xl);
    transform: translateX(100%);
  }
  .layer.is-open .sheet {
    transform: translateX(0);
  }
  .sheet__grip {
    display: none;
  }
  .sheet__head {
    padding-top: var(--s-6);
  }
}
.kv {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.kv__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--t-small);
  line-height: 1.43;
}
.kv__row b {
  font-weight: 600;
  text-align: right;
}

/* ---------- Переключатель включено / выключено ---------- */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s-1);
  text-align: left;
  color: var(--text);
  font-weight: 600;
}
.switch__track {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.switch__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--text-2);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.switch[aria-checked="true"] .switch__track {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.switch[aria-checked="true"] .switch__knob {
  transform: translateX(20px);
  background: var(--accent-text);
}
