/* Кабинет продавца — пастельный небесно-голубой плиточный UI */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --sky-50: #f4f9fd;
  --sky-100: #e8f2fc;
  --sky-200: #d4e7f7;
  --sky-300: #b8d4f0;
  --sky-400: #8ebce3;
  --sky-500: #5a9fd0;
  --ink: #1e3a4f;
  --ink-soft: #4a6a7f;
  --mint: #c8e6d5;
  --mint-ink: #1f6b45;
  --peach: #f7d5c8;
  --peach-ink: #9a3f2a;
  --sand: #f3ebe0;
  --sand-ink: #7a5c3e;
  --lavender: #dde4f5;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(30, 58, 79, 0.08);
  --radius: 20px;
  --radius-sm: 14px;
  /* Единый размер контролов в фильтрах / тулбарах */
  --control-height: 40px;
  --control-radius: 12px;
  --control-pad-x: 14px;
  --font: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* <picture> не ломает flex/grid: стили на img применяются как раньше */
body.cabinet picture {
  display: contents;
}

html {
  scroll-behavior: smooth;
}

body.cabinet {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9ebfa 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e7f3ec 0%, transparent 50%),
    linear-gradient(180deg, var(--sky-100), var(--sky-50) 40%, #f7fafc);
}

a {
  color: var(--sky-500);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* --- Auth --- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(184, 212, 240, 0.7);
  border-radius: 28px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.auth-brand {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  color: var(--ink);
}

.auth-lead {
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field-input,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.field select {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--sky-300);
  background: var(--white);
  border-radius: var(--control-radius);
  padding: 0 var(--control-pad-x);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea,
textarea.field-input {
  width: 100%;
  height: auto;
  min-height: 96px;
  border: 1px solid var(--sky-300);
  background: var(--white);
  border-radius: var(--control-radius);
  padding: 10px var(--control-pad-x);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
textarea.field-input:focus {
  border-color: var(--sky-500);
  box-shadow: 0 0 0 4px rgba(90, 159, 208, 0.18);
}

/* Без стрелочек у number (цены, количества) */
body.cabinet input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

body.cabinet input[type="number"]::-webkit-outer-spin-button,
body.cabinet input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-errors {
  background: var(--peach);
  color: var(--peach-ink);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.auth-field-error {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  color: var(--sand-ink);
  border: 1px solid rgba(210, 190, 165, 0.75);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 14px;
}

.auth-field-error--inline {
  margin-top: 6px;
  margin-bottom: 0;
  font-weight: 600;
}

.auth-field-error-action {
  margin-top: 6px;
}

.auth-reset-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  color: var(--sky-ink, #245b8a);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.auth-reset-link:hover {
  opacity: 0.85;
}

.field-input.is-invalid,
.field .field-input.is-invalid,
.field input.is-invalid {
  border-color: rgba(210, 190, 165, 0.95);
  background: #faf6f0;
  box-shadow: 0 0 0 4px rgba(122, 92, 62, 0.12);
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field .field-input,
.password-field input {
  width: 100%;
  padding-right: 5.5rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  z-index: 2;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(184, 212, 240, 0.35);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--sky-400);
  outline-offset: 1px;
}

.auth-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-switch {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.auth-social {
  margin-top: 22px;
}

.auth-social-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.auth-social-divider::before,
.auth-social-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(184, 212, 240, 0.85);
}

.auth-social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-social-form {
  margin: 0;
}

.auth-social-btn {
  width: 100%;
  justify-content: center;
  font-weight: 600;
  border-left: 3px solid transparent;
}

.auth-social-btn--yandex { border-left-color: #fc3f1d; }
.auth-social-btn--vk { border-left-color: #0077ff; }
.auth-social-btn--mailru { border-left-color: #005ff9; }
.auth-social-btn--ok { border-left-color: #ee8208; }

.auth-social-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.auth-social-hint {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

.auth-consent {
  margin-top: 4px;
}

.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-weight: 500;
  cursor: pointer;
}

.auth-consent-check {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--sky-500);
}

.auth-card--legal {
  width: min(720px, 100%);
}

.legal-doc {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.legal-doc h2 {
  margin: 1.1rem 0 0.4rem;
  font-size: 1.02rem;
}

.legal-doc p,
.legal-doc ul {
  margin: 0 0 0.65rem;
  color: var(--ink-soft);
}

.legal-doc ul {
  padding-left: 1.2rem;
}

.legal-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.legal-back {
  margin-top: 1.4rem !important;
}

/* --- Cookie / consent bar (как у типичных RU-сервисов) --- */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(184, 212, 240, 0.85);
  box-shadow: 0 -8px 28px rgba(30, 58, 79, 0.08);
}

.cookie-consent[hidden] {
  display: none !important;
}

.cookie-consent__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.cookie-consent__text {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.cookie-consent__btn {
  flex-shrink: 0;
  min-width: 110px;
}

@media (max-width: 640px) {
  .cookie-consent__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-consent__btn {
    width: 100%;
  }

  .auth-shell {
    padding-bottom: 140px;
  }
}

/* --- Shell --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(244, 249, 253, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(184, 212, 240, 0.55);
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--sky-200);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.chip.ok {
  background: var(--mint);
  color: var(--mint-ink);
}

.chip.warn {
  background: var(--sand);
  color: var(--sand-ink);
}

.chip.muted {
  background: var(--lavender);
  color: var(--ink-soft);
}

button.chip-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  appearance: none;
  transition: transform 0.12s ease, filter 0.12s ease;
}

button.chip-btn:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

button.chip-btn:focus-visible {
  outline: 2px solid var(--sky-400);
  outline-offset: 2px;
}

.chip-caret {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.plan-modal .plan-options {
  margin-top: 4px;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(184, 212, 240, 0.7);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
}

a.banner:hover {
  text-decoration: none;
}

.banner.warn {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.75);
  color: var(--sand-ink);
}

.banner.danger {
  background: linear-gradient(145deg, #fde8e6, #f3c8c4);
  border-color: rgba(210, 150, 145, 0.7);
  color: var(--peach-ink);
}

.banner a {
  color: inherit;
  font-weight: 700;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--sky-300);
  background: rgba(255, 255, 255, 0.9);
  width: 40px;
  height: 40px;
  border-radius: var(--control-radius);
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.confirm-dialog-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.45;
  font-weight: 600;
}

.modal--confirm {
  width: min(440px, 100%);
}

.attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attention-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border: 1px solid rgba(210, 190, 165, 0.7);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.attention-row:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(30, 58, 79, 0.1);
}

.attention-row-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--sky-100);
  flex-shrink: 0;
}

.attention-row-img--empty {
  display: block;
  border: 1px dashed rgba(210, 190, 165, 0.9);
}

.attention-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.attention-row-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.attention-row-meta {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sand-ink);
  opacity: 0.9;
}

.report-alert {
  margin-bottom: 16px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--sand);
  color: var(--sand-ink);
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.report-alert-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.report-alert-summary::-webkit-details-marker {
  display: none;
}

.report-alert-summary strong {
  font-weight: 800;
  flex-shrink: 0;
}

.report-alert-summary > span:not(.report-alert-toggle) {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-alert-toggle {
  margin-left: auto;
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  position: relative;
}

.report-alert-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
  transition: transform 0.15s ease;
}

.report-alert[open] .report-alert-toggle::before {
  transform: translateY(2px) rotate(225deg);
}

.report-alert-body {
  padding: 0 16px 14px;
  border-top: 1px solid rgba(122, 92, 62, 0.18);
}

.report-alert-text {
  margin: 10px 0 0;
}

.report-alert-list {
  margin: 10px 0 0;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
}

.report-alert-list a {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 2px;
}

.row-warn td {
  background: rgba(240, 230, 216, 0.55);
}

.row-warn-note {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sand-ink);
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 22px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.nav {
  --nav-gap: 4px;
  --nav-group-gap: 3px;
  --nav-group-space: 8px;
  --nav-foot-space: 10px;
  --nav-label-pad-x: 13px;
  --nav-label-pad-b: 3px;
  --nav-label-size: 0.68rem;
  --nav-link-pad-y: 9px;
  --nav-link-pad-x: 13px;
  --nav-link-size: 0.91rem;
  --nav-link-radius: 13px;
  --nav-sticky-top: 74px;
  display: flex;
  flex-direction: column;
  gap: var(--nav-gap);
  position: sticky;
  top: var(--nav-sticky-top);
  align-self: start;
  max-height: calc(100vh - var(--nav-sticky-top) - 12px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--nav-group-gap);
  margin-top: var(--nav-group-space);
  padding-top: var(--nav-group-space);
  border-top: 1px solid rgba(184, 212, 240, 0.55);
}

.nav-group--foot {
  margin-top: var(--nav-foot-space);
}

.nav-label {
  padding: 0 var(--nav-label-pad-x) var(--nav-label-pad-b);
  font-size: var(--nav-label-size);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.75;
  user-select: none;
}

.nav a {
  display: block;
  padding: var(--nav-link-pad-y) var(--nav-link-pad-x);
  border-radius: var(--nav-link-radius);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: var(--nav-link-size);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.nav a:hover,
.nav a.is-active {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  text-decoration: none;
  transform: translateX(2px);
}

.nav a.is-active {
  box-shadow: inset 3px 0 0 var(--sky-400);
}

/* Плотность меню по высоте экрана */
@media (max-height: 820px) {
  .nav {
    --nav-gap: 1px;
    --nav-group-gap: 1px;
    --nav-group-space: 5px;
    --nav-foot-space: 6px;
    --nav-label-pad-b: 1px;
    --nav-link-pad-y: 6px;
    --nav-link-pad-x: 12px;
    --nav-link-size: 0.86rem;
    --nav-link-radius: 11px;
    --nav-sticky-top: 68px;
  }
}

@media (min-height: 900px) {
  .nav {
    --nav-gap: 5px;
    --nav-group-gap: 4px;
    --nav-group-space: 10px;
    --nav-foot-space: 12px;
    --nav-label-pad-b: 4px;
    --nav-link-pad-y: 10px;
    --nav-link-size: 0.92rem;
    --nav-link-radius: 14px;
  }
}

@media (min-height: 1050px) {
  .nav {
    --nav-gap: 6px;
    --nav-group-gap: 5px;
    --nav-group-space: 12px;
    --nav-foot-space: 14px;
    --nav-label-size: 0.7rem;
    --nav-link-pad-y: 12px;
    --nav-link-pad-x: 14px;
    --nav-link-size: 0.94rem;
  }
}

/* На широких высоких мониторах — ещё чуть просторнее */
@media (min-width: 1280px) and (min-height: 1050px) {
  .nav {
    --nav-gap: 7px;
    --nav-group-space: 14px;
    --nav-link-pad-y: 13px;
    --nav-link-size: 0.96rem;
  }

  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

.main {
  min-width: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.page-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.page-head > .btn,
.page-head > .toolbar,
.page-head > .period-filter {
  margin-left: auto;
  flex-shrink: 0;
}

/* Карточка товара: период в одной строке с артикулом */
.page-head.page-head--product-detail {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
}

.page-head--product-detail .page-head-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  width: 100%;
}

.page-head--product-detail .page-head-meta > .page-sub {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.page-head--product-detail .page-head-meta > .period-filter {
  margin-left: auto;
  flex: 0 0 auto;
  align-items: flex-end;
}

@media (max-width: 720px) {
  .page-head--product-detail .page-head-meta {
    flex-wrap: wrap;
  }
}

.page-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.page-sub-link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.page-sub-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.page-sync-meta {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.page-sync-meta.is-just-updated {
  color: var(--mint-ink);
  animation: sync-meta-flash 1.6s ease both;
}

@keyframes sync-meta-flash {
  0% {
    opacity: 0.35;
    transform: translateY(2px);
  }
  35% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* Ненавязчивый индикатор фоновой синхронизации Ozon */
.sync-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(184, 212, 240, 0.75);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  transform: translateX(-50%);
  animation: rise 0.35s ease both;
  pointer-events: none;
}

.sync-toast.is-done {
  color: var(--mint-ink);
  border-color: rgba(160, 205, 180, 0.75);
  background: rgba(232, 245, 238, 0.94);
}

.sync-toast.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.sync-toast-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--sky-500);
  box-shadow: 0 0 0 0 rgba(90, 159, 208, 0.45);
  animation: sync-toast-pulse 1.4s ease-out infinite;
}

.sync-toast-text {
  min-width: 0;
}

@keyframes sync-toast-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(90, 159, 208, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(90, 159, 208, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(90, 159, 208, 0);
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  border-radius: var(--control-radius);
  padding: 0 16px;
  min-height: var(--control-height);
  height: var(--control-height);
  background: var(--sky-400);
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  background: var(--sky-500);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(90, 159, 208, 0.28);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--sky-300);
}

.btn.secondary:hover {
  background: var(--sky-100);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px dashed var(--sky-300);
}

.btn.danger {
  background: rgba(255, 255, 255, 0.92);
  color: var(--peach-ink);
  border: 1px solid rgba(154, 63, 42, 0.28);
  box-shadow: none;
}

.btn.danger:hover {
  background: #fdf1ec;
  color: var(--peach-ink);
  box-shadow: none;
  transform: translateY(-1px);
}

.btn.btn-sm,
.btn.ghost.btn-sm,
.btn.danger.btn-sm,
.btn.secondary.btn-sm {
  height: auto;
  min-height: 0;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.messages {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.messages li {
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  animation: rise 0.35s ease both;
}

.messages .success {
  background: var(--mint);
  color: var(--mint-ink);
}

.messages .error {
  background: var(--peach);
  color: var(--peach-ink);
}

.messages .warning,
.messages .info {
  background: var(--sand);
  color: var(--ink);
}

/* --- Tiles --- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.tiles.dense {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.tile {
  position: relative;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius);
  padding: 18px 36px 18px 16px;
  box-shadow: var(--shadow);
  animation: rise 0.4s ease both;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(30, 58, 79, 0.1);
}

.tile.is-active-filter {
  outline: 2px solid var(--sky-400);
  outline-offset: 2px;
  box-shadow: 0 14px 34px rgba(90, 159, 208, 0.22);
}

.tile-click {
  appearance: none;
  border: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: inherit;
  min-width: 0;
  overflow: hidden;
}

.tile-click:focus-visible {
  outline: 2px solid var(--sky-500);
  outline-offset: 2px;
}

.tile-password-mask {
  font-size: 1.45rem;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.view-toggle {
  display: inline-flex;
  align-items: stretch;
  height: var(--control-height);
  min-height: var(--control-height);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--sky-300);
  border-radius: var(--control-radius);
  padding: 3px;
  gap: 2px;
  box-sizing: border-box;
}

.view-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.2;
  color: var(--ink-soft);
  padding: 0 12px;
  border-radius: calc(var(--control-radius) - 3px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
  white-space: nowrap;
}

.view-toggle-btn.is-active {
  background: var(--sky-300);
  color: var(--ink);
}

.view-toggle-btn:hover:not(.is-active) {
  background: var(--sky-100);
}

a.view-toggle-btn {
  text-decoration: none;
}

.sales-mode-bar {
  display: flex;
  justify-content: center;
  margin: 18px 0 8px;
}

table.margin-table {
  table-layout: fixed;
}

table.margin-table th,
table.margin-table td {
  vertical-align: middle;
}

/* Кликабельна вся ширина заголовка, не только текст */
table.margin-table th:has(> .th-sort) {
  padding: 0;
  cursor: pointer;
}

table.margin-table .th-sort {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  min-height: 2.75rem;
  box-sizing: border-box;
  white-space: nowrap;
  padding: 10px 12px;
  margin: 0;
  border-radius: 12px;
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

table.margin-table .th-sort--center {
  justify-content: center;
  text-align: center;
}

table.margin-table th:has(> .th-sort):hover .th-sort,
table.margin-table .th-sort:hover {
  color: var(--ink);
  background: rgba(232, 242, 252, 0.7);
}

/* Подсветка на всю ячейку th — иначе в узких колонках фон уже текста */
table.margin-table th:has(.th-sort.is-sorted) {
  background: var(--sky-100);
  border-radius: 12px;
}

table.margin-table th:has(.th-sort.is-sorted):hover .th-sort,
table.margin-table .th-sort.is-sorted {
  background: transparent;
  font-weight: 800;
  color: var(--ink);
}

table.margin-table .margin-col-product {
  width: 32%;
  word-break: break-word;
}

.margin-product {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.margin-product-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--sky-100);
  flex-shrink: 0;
}

.margin-product-img--empty {
  display: block;
  border: 1px dashed var(--sky-300);
}

.margin-product-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.margin-product-text a:not(.no-supply-chip) {
  font-weight: 600;
  line-height: 1.3;
}

table.margin-table .margin-col-qty {
  width: 12%;
  white-space: nowrap;
  text-align: center;
}

table.margin-table .margin-col-num {
  width: 13%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.margin-table .margin-col-pct {
  width: 8%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.margin-table .row-warn-note {
  white-space: normal;
}

/* Отчёт «Остатки»: все колонки в ширину окна, длинное имя обрезается */
table.stock-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

table.stock-table .stock-col-status {
  width: 18%;
  white-space: nowrap;
  vertical-align: middle;
}

table.stock-table .stock-col-product {
  width: 34%;
  vertical-align: middle;
  overflow: hidden;
}

table.stock-table .stock-col-num {
  width: 9.5%;
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

table.stock-table .stock-col-dos {
  width: 10%;
  white-space: nowrap;
}

table.stock-table .stock-col-free {
  width: 9%;
  white-space: nowrap;
}

table.stock-table tr.stock-row-clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}

table.stock-table tr.stock-row-clickable:hover,
table.stock-table tr.stock-row-clickable:focus-visible {
  background: rgba(14, 116, 144, 0.08);
}

table.stock-table tr.stock-row-clickable:focus-visible {
  outline: 2px solid var(--sky-400, #38bdf8);
  outline-offset: -2px;
}

table.stock-table th {
  overflow: visible;
}

table.stock-table .chip-stock {
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  justify-content: center;
}

.stock-product {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.stock-product-name {
  display: block;
  max-width: 100%;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.stock-product-sku {
  display: block;
  max-width: 100%;
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-supply-chip {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border: 1px solid rgba(210, 190, 165, 0.7);
  color: var(--sand-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.12s;
}

.no-supply-chip:hover {
  text-decoration: none;
  color: var(--sand-ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(122, 92, 62, 0.12);
}

.period-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.period-custom.is-collapsed {
  display: none;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.filters-row > .filters {
  margin-bottom: 0;
  min-width: min(100%, 280px);
}

.filters-row .period-filter {
  align-items: flex-end;
  flex: 0 1 auto;
}

/* Произвольный период: поиск и даты на одной базовой линии */
.filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: end;
  justify-content: stretch;
}

.filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) > .filters {
  grid-row: 2;
  grid-column: 1;
  align-self: end;
  min-width: 0;
}

.filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-filter {
  display: contents;
}

.filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-presets {
  grid-row: 1;
  grid-column: 1 / -1;
  justify-self: end;
}

.filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-custom {
  grid-row: 2;
  grid-column: 2;
  margin-bottom: 0;
  align-self: end;
}

.filters-row .filters,
.filters-row .period-custom {
  align-items: end;
}

.filters-row .filters > .btn,
.filters-row .period-custom > .btn,
.filters > .btn {
  height: var(--control-height);
  min-height: var(--control-height);
  padding-top: 0;
  padding-bottom: 0;
}

.filters-row .field > label,
.filters .field > label {
  line-height: 1.25;
  min-height: 1.25em;
}

.filters-row .period-presets.view-toggle,
.period-filter .period-presets.view-toggle,
.page-head .period-presets.view-toggle {
  height: var(--control-height);
  min-height: var(--control-height);
}

/* Кастомный datepicker */
.datepicker {
  position: relative;
  width: 100%;
}

.datepicker-input {
  width: 100%;
  padding-right: 42px !important;
  cursor: text;
  color-scheme: light;
}

.datepicker-input.is-invalid {
  border-color: #e0a090;
  box-shadow: 0 0 0 4px rgba(201, 107, 90, 0.15);
}

.datepicker-input::-webkit-calendar-picker-indicator {
  opacity: 0;
  display: none;
}

.datepicker-input::-webkit-date-and-time-value {
  text-align: left;
}

.datepicker-trigger {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--sky-100);
  color: var(--sky-500);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}

.datepicker-trigger:hover {
  background: var(--sky-200);
  color: var(--ink);
}

.datepicker-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(300px, 92vw);
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--sky-300);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(30, 58, 79, 0.14);
  animation: rise 0.2s ease both;
}

.datepicker-pop.is-up {
  top: auto;
  bottom: calc(100% + 8px);
}

.datepicker-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.datepicker-title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.datepicker-nav-btn {
  appearance: none;
  border: 1px solid var(--sky-300);
  background: var(--sky-100);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.datepicker-nav-btn:hover {
  background: var(--sky-200);
}

.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.datepicker-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.datepicker-day {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
}

.datepicker-day.is-empty {
  pointer-events: none;
}

.datepicker-day:hover:not(.is-empty) {
  background: var(--sky-100);
}

.datepicker-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--sky-400);
}

.datepicker-day.is-selected {
  background: linear-gradient(145deg, var(--sky-300), var(--sky-400));
  color: #fff;
  font-weight: 800;
}

.datepicker-day.is-selected:hover {
  background: linear-gradient(145deg, var(--sky-400), var(--sky-500));
}

.datepicker-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--sky-200);
}

.datepicker-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--sky-500);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}

.datepicker-link:hover {
  background: var(--sky-100);
  color: var(--ink);
}

.product-list-view {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-list-row {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}

.product-list-row.sand {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.7);
}

.product-list-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(30, 58, 79, 0.1);
}

.product-list-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}

.product-list-main:hover {
  text-decoration: none;
}

.product-list-img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--sky-100);
  flex-shrink: 0;
}

.product-list-img--empty {
  display: block;
  border: 1px dashed var(--sky-300);
}

.product-list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-list-name {
  font-weight: 700;
  font-size: 0.98rem;
}

.product-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.84rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.product-list-metrics {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
  text-align: right;
}

.product-list-metrics .k {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.product-list-metrics .v {
  font-weight: 800;
  font-size: 0.95rem;
}

.product-extended-view {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-extended-row {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}

.product-extended-row.sand {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.7);
}

.product-extended-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(30, 58, 79, 0.1);
}

.product-extended-main {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
}

.product-extended-main:hover {
  text-decoration: none;
}

.product-extended-img {
  width: 112px;
  height: 112px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--sky-100);
}

.product-extended-img--empty {
  display: block;
  border: 1px dashed var(--sky-300);
}

.product-extended-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-extended-name {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.product-extended-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.product-extended-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.px-group {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(184, 212, 240, 0.45);
  background: rgba(244, 249, 253, 0.55);
  min-width: 0;
}

.px-group-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.product-extended-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px 10px;
}

.px-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.px-metric .k {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.px-metric .v {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.px-metric .v.pos {
  color: #1f7a4d;
}

.px-metric .v.neg {
  color: #b42318;
}

.px-metric--accent {
  padding: 6px 8px;
  margin: -6px -8px 0;
  border-radius: 10px;
  background: rgba(200, 230, 213, 0.45);
}

.px-metric--accent .k {
  color: var(--mint-ink);
}

@media (max-width: 1100px) {
  .product-extended-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .product-extended-main {
    flex-direction: column;
  }

  .product-extended-img {
    width: 88px;
    height: 88px;
  }
}

@media (max-width: 700px) {
  .product-list-main {
    flex-wrap: wrap;
  }

  .product-list-metrics {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}

.tile-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding-right: 4px;
}

.tile-help {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ink-soft) 45%, transparent);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  cursor: help;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--white) 85%, transparent);
  margin: 0;
}

/* Рядом с заголовком раздела (не в углу плитки) */
.tile-help--inline {
  position: relative;
  top: auto;
  right: auto;
  margin-left: 2px;
}

.tile-help--inline .tile-help-tip {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
}

.tile-help--inline .tile-help-tip::after {
  right: auto;
  left: 50%;
  margin-left: -5px;
}

/* Рядом с кнопкой удаления — чуть левее */
.tile:has(.tile-delete) {
  padding-right: 64px;
}

.tile:has(.tile-delete) .tile-help {
  right: 42px;
}

.tile-help:hover,
.tile-help:focus,
.tile-help:focus-within {
  color: var(--ink);
  border-color: var(--sky-500);
  outline: none;
  z-index: 60;
}

/* Чтобы подсказка не уходила под sticky-шапку */
.tile:has(.tile-help:hover),
.tile:has(.tile-help:focus),
.tile:has(.tile-help:focus-within) {
  z-index: 60;
  overflow: visible;
}

.tile-help-tip {
  display: none;
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 8px);
  transform: none;
  width: max-content;
  max-width: min(280px, 72vw);
  padding: 9px 11px;
  border-radius: 10px;
  background: #1f2933;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  z-index: 60;
  pointer-events: none;
  white-space: normal;
}

.tile-help-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 10px;
  left: auto;
  margin-left: 0;
  border: 5px solid transparent;
  border-top-color: #1f2933;
}

.tile-help:hover .tile-help-tip,
.tile-help:focus .tile-help-tip,
.tile-help:focus-within .tile-help-tip {
  display: block;
}

/* Подсказка на всю плитку (как у «?», но по hover плитки) */
.tile.tile--hover-tip:hover,
.tile.tile--hover-tip:focus-within {
  z-index: 60;
  overflow: visible;
}

.tile-hover-tip {
  display: none;
  position: absolute;
  right: 12px;
  left: auto;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(280px, 72vw);
  padding: 9px 11px;
  border-radius: 10px;
  background: #1f2933;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  z-index: 60;
  pointer-events: none;
  white-space: normal;
}

.tile-hover-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 10px;
  left: auto;
  margin-left: 0;
  border: 5px solid transparent;
  border-top-color: #1f2933;
}

.tile.tile--hover-tip:hover .tile-hover-tip,
.tile.tile--hover-tip:focus-within .tile-hover-tip {
  display: block;
}

.tile-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.tile-value--email {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tile-hint {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.tile.pos .tile-value {
  color: var(--mint-ink);
}

.tile.neg .tile-value {
  color: var(--peach-ink);
}

.tile.sky {
  background: linear-gradient(145deg, #eef6fc, #dceaf7);
}

.tile.mint {
  background: linear-gradient(145deg, #eef8f2, #d9efe3);
}

/* --- Plan upgrade options (account) --- */
.plan-panel {
  max-width: 720px;
}

.plan-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.plan-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(184, 212, 240, 0.55);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.plan-option--full {
  background: linear-gradient(145deg, #eef8f2, #f7fbfd);
}

.plan-option.is-current {
  outline: 2px solid var(--sky-400);
  outline-offset: 1px;
}

.plan-option-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.plan-option-name {
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.plan-option-price {
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.plan-option-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.plan-option-desc {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.plan-option-actions {
  margin-top: auto;
  padding-top: 4px;
}

.plan-option-locked {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.achievement-card {
  opacity: 0.92;
}

.achievement-card .plan-option-name {
  font-size: 0.98rem;
}

.tile.peach {
  background: linear-gradient(145deg, #fdf1ec, #f6ddd3);
}

.tile.stock-low {
  background: linear-gradient(145deg, #fbf3e6, #f7e6c8);
}

.tile.sand,
.tile.amber {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
}

.tile.danger {
  background: linear-gradient(145deg, #fde8e6, #f3c8c4);
}

.tile.sand .tile-hint,
.tile.amber .tile-hint,
.tile.danger .tile-hint {
  color: inherit;
  opacity: 0.85;
}

.tile.abc-a {
  background: linear-gradient(145deg, #e8f6ee, #cfead9);
}

.tile.abc-b {
  background: linear-gradient(145deg, #eef3fb, #d7e3f4);
}

.tile.abc-c {
  background: linear-gradient(145deg, #f8f1ea, #eddccb);
}

.tile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: visible;
}

.tiles--competitors {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tile-card--offer {
  gap: 8px;
}

/* Место под × и ? только у заголовка, не у всего текста плитки */
.tile-card--offer:has(.tile-delete) {
  padding-right: 16px;
}

.tile-card--offer:has(.tile-delete) .tile-label {
  padding-right: 52px;
}

.competitor-offer-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.tile-card--product {
  padding: 14px 64px 14px 14px;
  min-height: 92px;
}

.tile-link {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.tile-link--with-thumb {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.tile-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--sky-100);
  flex-shrink: 0;
}

.tile-thumb--empty {
  display: block;
  border: 1px dashed var(--sky-300);
}

.tile-link-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.tile-card-head {
  display: block;
  min-width: 0;
}

.tile-card-head .tile-card-title {
  display: -webkit-box;
  padding-right: 0;
}

.tile-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  padding-right: 28px;
  word-break: break-word;
}

.tile-card-price {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tile-card-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tile-link:hover {
  text-decoration: none;
}

.tile-card--product.sand .tile-card-meta,
.tile-card--product.amber .tile-card-meta,
.tile-card--product.danger .tile-card-meta {
  color: inherit;
  opacity: 0.9;
}

.tile-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  margin: 0;
}

.icon-btn {
  appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--peach-ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(30, 58, 79, 0.08);
  transition: background 0.12s, transform 0.12s;
}

.icon-btn:hover {
  background: var(--peach);
  transform: scale(1.05);
}

.tile-actions {
  margin: 0;
  margin-top: auto;
  text-decoration: none;
  box-sizing: border-box;
}

.tile-actions:hover {
  text-decoration: none;
}

.tile-total {
  margin-top: 4px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.88rem;
}

.supply-timeline,
.competitor-timeline {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.supply-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sky-300);
}

.supply-day-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.supply-day-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.supply-list,
.competitor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.supply-row,
.competitor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}

.supply-row:hover,
.competitor-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(30, 58, 79, 0.1);
}

.competitor-row.sand {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.7);
}

.competitor-row.danger {
  background: linear-gradient(145deg, #fde8e6, #f3c8c4);
  border-color: rgba(210, 150, 145, 0.7);
}

.supply-row-main,
.competitor-row-main {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.supply-row-main:hover,
.competitor-row-main:hover {
  text-decoration: none;
}

.competitor-row-main--static {
  cursor: default;
}

.supply-row-img,
.competitor-row-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--sky-100);
  flex-shrink: 0;
}

.supply-row-img--empty,
.competitor-row-img--empty {
  display: block;
  border: 1px dashed var(--sky-300);
}

.supply-row-text,
.competitor-row-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.supply-row-name,
.competitor-row-name {
  font-weight: 700;
  font-size: 0.98rem;
}

.supply-row-meta,
.competitor-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.competitor-row.sand .competitor-row-meta,
.competitor-row.danger .competitor-row-meta {
  color: inherit;
  opacity: 0.9;
}

.supply-row-total,
.competitor-row-total {
  color: var(--ink);
  font-weight: 700;
}

.supply-row-actions,
.competitor-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.supply-row-actions .btn,
.competitor-row-actions .btn {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.supply-row-actions form,
.competitor-row-actions form {
  margin: 0;
}

.cost-table .field-input {
  width: 100%;
  min-width: 120px;
}

.cost-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.cost-delete {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cost-delete .btn {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.cost-delete input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.progress-panel {
  max-width: 720px;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-meta span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.progress-meta #progress-percent {
  color: var(--ink);
  font-size: 1rem;
}

.progress-track {
  height: 16px;
  background: var(--sky-200);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--sky-400), var(--sky-500));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-fill.is-done {
  background: linear-gradient(90deg, #7ec9a0, #4fa978);
}

.progress-fill.is-error {
  background: linear-gradient(90deg, #e8a090, #c96b5a);
}

.progress-stage {
  margin: 14px 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.progress-sku {
  margin: 0;
  min-height: 1.2em;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.progress-log {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 0 0 0 22px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.progress-log li {
  margin-bottom: 6px;
}

.progress-log .time {
  color: var(--sky-500);
  margin-right: 8px;
  font-weight: 600;
}

@media (max-width: 700px) {
  .supply-row,
  .competitor-row {
    flex-direction: column;
    align-items: stretch;
  }

  .supply-row-actions,
  .competitor-row-actions {
    justify-content: flex-end;
  }
}

.section {
  margin-top: 28px;
}

.section-head {
  margin-bottom: 14px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 800;
}

.section-head .section-title {
  margin-bottom: 4px;
}

.section-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.expense-breakdown-sub {
  margin: -4px 0 12px;
}

/* 7 статей → сетка 4+3, без «хвоста» 6+1 */
.tiles.expense-tiles {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.expense-tile {
  padding: 14px 32px 14px 14px;
  min-height: 0;
}

.expense-tile:hover {
  transform: translateY(-2px);
}

.expense-tile-value {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.expense-tile.is-zero {
  opacity: 0.55;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.55);
}

.expense-tile.is-zero:hover {
  transform: none;
  box-shadow: none;
}

.expense-tile.is-zero .tile-value {
  font-weight: 600;
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .tiles.expense-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .tiles.expense-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .tiles.expense-tiles {
    grid-template-columns: 1fr;
  }
}

.day-sales-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.day-sales-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.day-sales-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.day-sales-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.day-sales-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.day-sales-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.day-sales-metric {
  min-width: 0;
}

.day-sales-k {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.day-sales-v {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

.day-sales-h {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.day-sales-delta {
  font-weight: 800;
}

.day-sales-delta.pos {
  color: #1f7a4d;
}

.day-sales-delta.neg {
  color: #b42318;
}

@media (max-width: 900px) {
  .day-sales-grid {
    grid-template-columns: 1fr;
  }

  .day-sales-metrics {
    grid-template-columns: 1fr;
  }
}

/* Product cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

[data-live-search-item][hidden],
[data-live-search-group][hidden],
[data-live-search-empty][hidden],
.is-live-search-hidden {
  display: none !important;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  animation: rise 0.4s ease both;
}

.product-card.sand {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.7);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(30, 58, 79, 0.12);
  text-decoration: none;
}

.product-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--sky-100);
}

.product-card .body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-card .name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.product-card .metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.metric {
  background: var(--sky-100);
  border-radius: 12px;
  padding: 8px 10px;
}

.metric .k {
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.metric .v {
  font-weight: 800;
  font-size: 0.95rem;
}

.panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 212, 240, 0.55);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sky-200);
}

table.data th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 700;
}

table.data tr:hover td {
  background: rgba(232, 242, 252, 0.55);
}

.sales-more-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--sky-200);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--sky-700, #2f6fa3);
  text-align: left;
}

.sales-more-toggle:hover {
  background: rgba(232, 242, 252, 0.55);
}

table.sales-table tr.sales-row-clickable {
  cursor: pointer;
}

table.sales-table tr.sales-row-clickable:focus-visible {
  outline: 2px solid var(--sky-400, #38bdf8);
  outline-offset: -2px;
}

table.sales-table tr.sales-row-clickable:focus-visible td {
  background: rgba(14, 116, 144, 0.08);
}

.sales-more-chevron {
  flex: 0 0 auto;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 8px;
  background: rgba(184, 212, 240, 0.35);
  position: relative;
}

.sales-more-chevron::before {
  content: "";
  position: absolute;
  top: 45%;
  left: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid var(--sky-700, #2f6fa3);
  border-bottom: 2px solid var(--sky-700, #2f6fa3);
  transform: translate(-50%, -60%) rotate(45deg);
  transition: transform 0.15s ease;
}

.sales-more-toggle.is-open .sales-more-chevron::before {
  transform: translate(-50%, -30%) rotate(225deg);
}

.attention-more-toggle {
  margin-top: 8px;
  border: 1px solid rgba(210, 190, 165, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  color: var(--sand-ink);
}

.attention-more-toggle:hover {
  background: rgba(250, 246, 240, 0.9);
}

.attention-more-toggle .sales-more-chevron {
  background: rgba(210, 190, 165, 0.35);
}

.attention-more-toggle .sales-more-chevron::before {
  border-right-color: var(--sand-ink);
  border-bottom-color: var(--sand-ink);
}

.chip-abc {
  min-width: 1.75rem;
  justify-content: center;
  font-weight: 800;
}

.chip-abc-a {
  background: var(--mint);
  color: var(--mint-ink);
}

.chip-abc-b {
  background: var(--sky-200);
  color: var(--ink);
}

.chip-abc-c {
  background: var(--sand);
  color: var(--ink-soft);
}

.chip-stock {
  font-weight: 700;
  font-size: 0.75rem;
}

.chip-stock-oos {
  background: var(--peach);
  color: var(--peach-ink);
}

.chip-stock-low {
  background: #f7e6c8;
  color: #8a5a20;
}

.chip-stock-dead {
  background: var(--sand);
  color: var(--sand-ink);
}

.chip-stock-ok {
  background: var(--mint);
  color: var(--mint-ink);
}

.chip-stock-unknown {
  background: var(--lavender);
  color: var(--ink-soft);
}

.pos {
  color: var(--mint-ink);
  font-weight: 700;
}

.neg {
  color: var(--peach-ink);
  font-weight: 700;
}

.row-hint {
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.empty-note {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
}

table.data td.num,
table.data th.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.discount-panel {
  overflow: hidden;
}

.discount-product {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.discount-product-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--sky-100);
  flex: 0 0 auto;
}

.discount-product-img--empty {
  display: inline-block;
}

.discount-product-text {
  min-width: 0;
  overflow: hidden;
}

.discount-product-text a,
.discount-product-text > span {
  display: block;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discount-product-text a:hover {
  text-decoration: underline;
}

.discount-product-meta {
  margin-top: 1px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.discount-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.84rem;
}

table.discount-table td,
table.discount-table th {
  vertical-align: middle;
  padding: 8px 8px;
}

table.discount-table .discount-col-product {
  width: auto;
}

table.discount-table .discount-col-price {
  width: 7.5rem;
}

table.discount-table .discount-col-disc {
  width: 5.5rem;
}

table.discount-table .discount-col-qty {
  width: 4rem;
}

table.discount-table .discount-col-income {
  width: 8rem;
}

table.discount-table .discount-col-actions {
  width: 11.5rem;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
  text-align: right;
}

table.discount-table td.num,
table.discount-table th.num {
  white-space: nowrap;
}

table.discount-table .bulk-col,
table.actions-detail-table .bulk-col {
  width: 2.25rem;
  padding-left: 8px;
  padding-right: 4px;
  text-align: center;
  vertical-align: middle;
}

.bulk-check {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--sky-500, #0ea5e9);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--sky-200, #cfe3f5);
  background: rgba(232, 242, 252, 0.75);
}

.bulk-bar-count {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.bulk-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.bulk-bar .btn {
  margin: 0;
  padding: 7px 12px;
  font-size: 0.8rem;
}

table.discount-table tr.row-loss td {
  background: rgba(248, 226, 216, 0.35);
}

.discount-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.discount-action-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
}

.discount-actions .btn,
.discount-btn-accept,
.discount-btn-decline {
  margin: 0;
  padding: 6px 9px;
  font-size: 0.76rem;
  line-height: 1.15;
  white-space: nowrap;
}

table.actions-table .actions-col-count {
  width: 3.5rem;
}

table.actions-table .discount-col-price {
  width: 5.75rem;
}

table.actions-table .discount-col-income {
  width: 6.5rem;
}

table.actions-table .discount-col-actions {
  width: 5.75rem;
  padding-left: 6px;
  padding-right: 6px;
}

table.actions-table tr.actions-row-clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}

table.actions-table tr.actions-row-clickable:hover,
table.actions-table tr.actions-row-clickable:focus-visible {
  background: rgba(14, 116, 144, 0.08);
}

table.actions-table tr.actions-row-clickable:focus-visible {
  outline: 2px solid var(--sky-400, #38bdf8);
  outline-offset: -2px;
}

table.actions-table .actions-row-name {
  display: block;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.actions-table .actions-btn-product {
  margin: 0;
  padding: 6px 9px;
  font-size: 0.76rem;
  line-height: 1.15;
  white-space: nowrap;
  text-decoration: none;
}

table.actions-detail-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

table.actions-detail-table .actions-col-title {
  width: auto;
  overflow: hidden;
}

table.actions-detail-table .discount-col-price {
  width: 5.5rem;
}

table.actions-detail-table .discount-col-income {
  width: 6.5rem;
}

table.actions-detail-table .actions-col-promo {
  width: 6.75rem;
}

table.actions-detail-table th.actions-col-promo {
  text-align: center;
}

table.actions-detail-table .actions-col-qty {
  width: 5.5rem;
}

table.actions-detail-table th.actions-col-qty {
  text-align: center;
}

table.actions-detail-table .discount-col-actions {
  width: 12.5rem;
}

table.actions-detail-table th.discount-col-actions {
  text-align: center;
}

/* ---- переключение просмотр / редактирование ---- */
table.actions-detail-table .action-price-edit,
table.actions-detail-table .action-stock-edit,
table.actions-detail-table .action-stock-edit-hint,
table.actions-detail-table .action-btns-edit {
  display: none !important;
}

table.actions-detail-table tr.is-editing .action-price-view,
table.actions-detail-table tr.is-editing .action-stock-view,
table.actions-detail-table tr.is-editing .action-btns-view {
  display: none !important;
}

table.actions-detail-table tr.is-editing .action-price-edit {
  display: block !important;
  margin: 0;
}

table.actions-detail-table tr.is-editing .action-stock-edit {
  display: block !important;
}

table.actions-detail-table tr.is-editing .action-stock-edit-hint {
  display: block !important;
}

table.actions-detail-table tr.is-editing .action-btns-edit {
  display: grid !important;
}

/* Обе пары кнопок — одна сетка 2×1, одинаковый размер и позиция */
table.actions-detail-table .action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  align-items: stretch;
  justify-items: stretch;
}

table.actions-detail-table .action-btn-form {
  display: block;
  margin: 0;
  min-width: 0;
}

table.actions-detail-table .action-btn {
  width: 100%;
  margin: 0;
  padding: 6px 4px;
  font-size: 0.76rem;
  line-height: 1.15;
  height: 32px;
  min-height: 32px;
  white-space: nowrap;
  box-sizing: border-box;
}

.action-price-input {
  display: block;
  width: 100%;
  max-width: 5.75rem;
  margin-left: auto;
  height: 32px;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 0.84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.action-stock-input {
  display: block;
  width: 100%;
  max-width: 4.5rem;
  margin-left: auto;
  height: 32px;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 0.84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.action-price-input.is-invalid {
  border-color: rgba(210, 190, 165, 0.95);
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  box-shadow: 0 0 0 4px rgba(122, 92, 62, 0.12);
}

table.actions-detail-table tr.action-price-error-row[hidden] {
  display: none !important;
}

table.actions-detail-table tr.action-price-error-row td {
  padding-top: 0;
  padding-bottom: 10px;
  border-top: none;
}

.action-price-error {
  margin: 0;
  text-align: left;
  color: var(--sand-ink);
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border: 1px solid rgba(210, 190, 165, 0.75);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.actions-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  border: 1px dashed var(--sky-300);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.filters .field {
  margin: 0;
  min-width: 140px;
}

.filters .field-narrow {
  min-width: 100px;
  max-width: 120px;
}

/* Product detail: compact status + photo beside calculator */
.product-status-panel {
  margin-bottom: 12px;
  padding: 12px;
}

.product-status-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.product-status-tiles--compact .tile {
  margin: 0;
  min-height: 0;
  padding: 10px 12px;
}

.product-status-tiles--compact .tile-label {
  font-size: 0.68rem;
  margin-bottom: 2px;
}

.product-status-tiles--compact .tile-hint {
  margin-top: 2px;
  font-size: 0.7rem;
}

.product-status-value {
  font-size: 1.1rem;
  line-height: 1.2;
}

.product-status-value--sm {
  font-size: 0.95rem;
}

.product-calc-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}

.product-calc-layout:not(:has(.price-calc-panel)) {
  grid-template-columns: 240px;
}

.product-calc-photo {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.product-calc-photo img,
.product-calc-photo-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--sky-100);
  box-shadow: var(--shadow);
  display: block;
}

.product-calc-photo-link {
  position: relative;
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  line-height: 0;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.12s;
}

.product-calc-photo-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.product-calc-photo-placeholder {
  flex: 1 1 auto;
}

.product-calc-photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 28px 12px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(30, 58, 79, 0.35);
  background: linear-gradient(
    180deg,
    rgba(30, 58, 79, 0) 0%,
    rgba(30, 58, 79, 0.55) 55%,
    rgba(30, 58, 79, 0.72) 100%
  );
  pointer-events: none;
}

.product-calc-photo-link:hover {
  text-decoration: none;
  box-shadow: 0 0 0 2px var(--sky-300, #8eb8e0), var(--shadow);
}

.product-calc-photo-link:hover img {
  transform: scale(1.02);
  filter: brightness(0.96);
}

.product-calc-photo-link:hover .product-calc-photo-caption {
  background: linear-gradient(
    180deg,
    rgba(30, 58, 79, 0) 0%,
    rgba(30, 58, 79, 0.62) 50%,
    rgba(30, 58, 79, 0.82) 100%
  );
}

.price-calc-panel {
  margin-bottom: 0;
  min-width: 0;
  height: 100%;
}

.price-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-calc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.price-calc-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.price-calc-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.price-edit-metrics-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.price-scenario {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--sky-300);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 249, 253, 0.7));
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.price-scenario:focus-within {
  border-color: var(--sky-400);
  box-shadow: 0 0 0 3px rgba(90, 159, 208, 0.16);
}

.price-scenario.is-warn {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.75);
}

.price-scenario.is-invalid {
  border-color: rgba(210, 190, 165, 0.95);
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  box-shadow: 0 0 0 3px rgba(122, 92, 62, 0.12);
}

.price-scenario.is-invalid.is-warn {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  border-color: rgba(210, 190, 165, 0.95);
}

.price-scenario .field-input.is-invalid {
  border-color: rgba(210, 190, 165, 0.95);
  background: #faf6f0;
  box-shadow: 0 0 0 4px rgba(122, 92, 62, 0.12);
}

.price-calc-error {
  background: linear-gradient(145deg, #faf6f0, #f0e6d8);
  color: var(--sand-ink);
  border: 1px solid rgba(210, 190, 165, 0.75);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.price-scenario.is-income-error .price-preview-v[data-role="unit-income"] {
  color: var(--sand-ink);
}

.price-scenario-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-scenario-top .field-input {
  height: var(--control-height);
  min-height: var(--control-height);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 12px;
}

.price-scenario-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(184, 212, 240, 0.9);
}

.price-preview-k {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.price-preview-v {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
  transition: color 0.15s;
}

.price-preview-v.pos {
  color: #1f7a4d;
}

.price-preview-v.neg {
  color: #b42318;
}

.price-calc-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 212, 240, 0.45);
}

.price-scenario--old {
  margin: 0;
  max-width: none;
  width: 100%;
}

.price-old-dual {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 8px;
  align-items: end;
}

.price-old-dual .field-input {
  height: var(--control-height);
  min-height: var(--control-height);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 12px;
}

.price-calc-submit {
  white-space: nowrap;
  height: var(--control-height);
  min-height: var(--control-height);
  align-self: end;
  justify-self: end;
  padding: 0 16px;
}

.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.field-label-row label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field .tile-help,
.field-label-row .tile-help,
.price-calc-head .tile-help {
  position: relative;
  top: auto;
  right: auto;
  width: 1rem;
  height: 1rem;
  font-size: 0.65rem;
  background: var(--white);
  flex: 0 0 auto;
}

.field .tile-help-tip,
.field-label-row .tile-help-tip,
.price-calc-head .tile-help-tip {
  right: auto;
  left: 0;
  bottom: calc(100% + 8px);
  max-width: min(280px, 70vw);
}

.field .tile-help-tip::after,
.field-label-row .tile-help-tip::after,
.price-calc-head .tile-help-tip::after {
  right: auto;
  left: 10px;
}

.price-calc-head .tile-help-tip {
  left: auto;
  right: 0;
}

.price-calc-head .tile-help-tip::after {
  left: auto;
  right: 10px;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .nav {
    position: fixed;
    top: 68px;
    left: 12px;
    right: 12px;
    z-index: 40;
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    max-height: min(70vh, 520px);
    overflow: auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(184, 212, 240, 0.7);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(30, 58, 79, 0.16);
  }

  .nav.is-open {
    display: flex;
  }

  .nav-group {
    display: flex;
    margin-top: 8px;
    padding-top: 8px;
  }

  .nav-group--foot {
    margin-top: 8px;
  }

  .nav-label {
    display: block;
  }

  .nav a {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(70, 100, 130, 0.22);
  }

  .product-status-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-calc-layout {
    grid-template-columns: 1fr;
  }

  .product-calc-photo {
    max-width: 240px;
    aspect-ratio: 1;
  }

  .price-edit-metrics-row {
    grid-template-columns: 1fr;
  }

  .price-calc-actions {
    grid-template-columns: 1fr;
  }

  .price-old-dual {
    grid-template-columns: 1fr 1fr;
  }

  .price-calc-submit {
    width: 100%;
  }

  .filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-filter {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-presets {
    justify-self: stretch;
    align-self: stretch;
  }

  .filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) > .filters,
  .filters-row:has(> .filters):has(.period-custom:not(.is-collapsed)) .period-custom {
    grid-row: auto;
    grid-column: auto;
    width: 100%;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tile:nth-child(1) { animation-delay: 0.02s; }
.tile:nth-child(2) { animation-delay: 0.05s; }
.tile:nth-child(3) { animation-delay: 0.08s; }
.tile:nth-child(4) { animation-delay: 0.11s; }
.tile:nth-child(5) { animation-delay: 0.14s; }
.tile:nth-child(6) { animation-delay: 0.17s; }
.product-card:nth-child(1) { animation-delay: 0.03s; }
.product-card:nth-child(2) { animation-delay: 0.06s; }
.product-card:nth-child(3) { animation-delay: 0.09s; }
.product-card:nth-child(4) { animation-delay: 0.12s; }

/* Модальные окна */
body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 24px;
  overflow-y: auto;
  background: rgba(70, 100, 130, 0.28);
  backdrop-filter: blur(2px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(520px, 100%);
  margin: auto 0;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(184, 212, 240, 0.7);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 24px 48px rgba(70, 110, 150, 0.22);
  animation: rise 0.28s ease both;
}

.modal--wide {
  width: min(720px, 100%);
}

.supply-create-form .field {
  width: 100%;
}

table.ads-campaigns-table th,
table.ads-campaigns-table td {
  vertical-align: middle;
}

table.ads-campaigns-table .chip-stock {
  white-space: nowrap;
}

.ads-product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.ads-product-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.04);
}

.ads-product-img--empty {
  display: inline-block;
}

table.ads-products-table .discount-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

