@charset "UTF-8";

/* ==========================================================================
   SmartWorld Kassa - design system
   --------------------------------------------------------------------------
   1. Tokens            6. Forms                 11. Sale sidebar (cart)
   2. Base              7. Tables / lists        12. Page-specific blocks
   3. App shell         8. Status / feedback     13. Responsive
   4. Panels            9. Modals                14. Print
   5. Buttons          10. Receipt

   Rules of the system:
   - font-weight: 400 text · 500 important data / labels · 600 titles. Never above 600.
   - border-radius: 6px (chips, small controls) · 8px (controls) · 12px (panels, modals).
     Status badges are pills; avatar, dot, spinner, radio are circles.
   - control height: 40px (30px small, 46px large). Spacing scale: 4 / 8 / 12 / 16 / 24.
   - flat surfaces: 1px borders instead of shadows; shadows only on floating layers.
   ========================================================================== */

/* Manrope: шрифт интерфейса. Файл переменный (вес 200-800), лежит в assets/fonts/Manrope/. */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope/Manrope-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f6f7f98e;
  --surface-hover: #f3f4f8a6;
  --sidebar-bg: #fafbfc;
  --line: #e6e9ee;
  --line-strong: #d6dbe3;

  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --placeholder: #8a93a3;

  --accent: #1f6feb;
  --accent-strong: #1858c4;
  --accent-soft: #eaf2fe;
  --accent-line: #bcd4f8;

  --success: #17a367;
  --success-text: #0f7a4c;
  --success-soft: #e6f6ee;
  --success-line: #b9e3cf;

  --warning: #d98a0b;
  --warning-text: #8f5d00;
  --warning-soft: #fdf3dc;
  --warning-line: #f1d79b;

  --danger: #e5484d;
  --danger-text: #c0292e;
  --danger-soft: #fdeeee;
  --danger-line: #f4c4c6;

  --radius-xs: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --h-control: 40px;
  --h-control-sm: 30px;
  --h-control-lg: 42px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 18px;

  --shadow-pop: 0 6px 16px rgba(16, 24, 40, 0.1);
  --shadow-modal: 0 12px 32px rgba(16, 24, 40, 0.18);

  --ring: 0 0 0 3px rgba(37, 99, 235, 0.16);
  --ring-danger: 0 0 0 3px rgba(229, 72, 77, 0.16);

  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --sidebar-right-w: 360px;
  --header-h: 60px;
  --page-pad: 28px;

  --transition: 0.12s ease;
}

/* 2. Base ------------------------------------------------------------------ */

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #c5ccd7 transparent;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    "Manrope",
    "Segoe UI",
    system-ui,
    -apple-system,
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
}
b,
strong {
  font-weight: 500;
}
p {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  font-weight: 500;
}
img {
  max-width: 100%;
  display: block;
}
svg {
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}
.is-hidden {
  display: none !important;
}
body.modal-open {
  overflow: hidden;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.muted {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: 1.4;
}

/* 3. App shell ------------------------------------------------------------- */

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--sidebar-right-w);
  overflow: hidden;
}
.app-shell.no-right {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.app-shell.is-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr) var(
      --sidebar-right-w
    );
}
.app-shell.is-collapsed.no-right {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

/* Navigation sidebar */

.primary-sidebar {
  background: #203149;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 0 0 var(--space-3);
  gap: 0;
  position: relative;
  z-index: 4;
  overflow: hidden;
  min-height: 0;
}

.sidebar-brand {
  width: 100%;
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-5);
  margin-bottom: var(--space-3);
}
.sidebar-brand-icon {
  display: none;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius);
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}
.sidebar-brand-text {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.primary-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: 0 var(--space-3);
  overflow: hidden auto;
}

.primary-nav {
  scrollbar-width: none !important;
}

.nav-group {
  margin-bottom: var(--space-3);
}

/* Section caption ("Продажа", "Поступление" …). Groups are always expanded, so the
   former toggle button is only a caption now. */
.nav-section-label,
.nav-group-toggle,
.nav-group-toggle.active {
  width: 100%;
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  margin: 0 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #eee;
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
}
.nav-group-toggle .nav-icon,
.nav-group-chevron {
  display: none;
}

.nav-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-subitem {
  position: relative;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  overflow: hidden;
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 400;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition);
}
.nav-subitem:hover {
  background: #f3f5f824;
}
.nav-subitem.active {
  background: #eaf2fe33;
  /* color: var(--accent-strong); */
  font-weight: 500;
}
.nav-subitem.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fff;
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.nav-subitem.active .nav-icon {
  color: var(--accent-strong);
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.primary-sidebar-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-2) var(--space-3) 0;
  /* margin-top: var(--space-1); */
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.sidebar-collapse-btn {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition);
}
.sidebar-collapse-btn:hover {
  background: #f3f5f824;
}
.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.app-shell.is-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}
.sidebar-clock {
  padding: var(--space-1) var(--space-3) 0;
  font-size: var(--fs-xs);
  color: #fff;
  line-height: 1.5;
  white-space: nowrap;
}
.sidebar-clock strong {
  display: block;
  font-size: var(--fs-base);
  color: #fff;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Collapsed rail: icons only, titles stay available through the title attribute. */
.app-shell.is-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}
.app-shell.is-collapsed .sidebar-brand-icon {
  display: grid;
}
.app-shell.is-collapsed .sidebar-brand-text,
.app-shell.is-collapsed .nav-section-label,
.app-shell.is-collapsed .nav-group-toggle,
.app-shell.is-collapsed .nav-label,
.app-shell.is-collapsed .sidebar-collapse-btn span,
.app-shell.is-collapsed .sidebar-clock {
  display: none;
}
.app-shell.is-collapsed .primary-nav {
  padding: 0 var(--space-2);
}
.app-shell.is-collapsed .primary-sidebar-footer {
  padding: var(--space-2) var(--space-2) 0;
}
.app-shell.is-collapsed .nav-group {
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}
.app-shell.is-collapsed .nav-group:last-child {
  border-bottom: 0;
}
.app-shell.is-collapsed .nav-subitem,
.app-shell.is-collapsed .sidebar-collapse-btn {
  justify-content: center;
  padding: 0;
}

/* Main column + page header
   The header is one flex block: a 64px top bar (user block, drawn with ::before + an
   absolutely placed .header-meta) and, below it, breadcrumb → title row → search. */

.main-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-header {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: calc(var(--header-h) + 15px) var(--page-pad) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid #eee;
}
.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.breadcrumb {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: calc(-1 * var(--space-2));
  font-size: var(--fs-base);
  color: var(--placeholder);
}
.breadcrumb-sep {
  color: var(--placeholder);
}
.breadcrumb-current {
  color: var(--text-2);
}

.page-header-titles {
  flex: 1 1 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  min-width: 0;
}
.page-header-titles > div {
  min-width: 0;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-header p {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 400;
  max-width: 760px;
}
.page-header-titles > .primary-button,
.page-header-titles > .secondary-button {
  min-height: var(--h-control);
  padding: 0 var(--space-5);
  font-size: var(--fs-base);
}
.page-header-titles .primary-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.header-search {
  flex: 0 1 420px;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--h-control);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.header-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.header-search svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.header-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: var(--fs-base);
}
.header-search input::placeholder {
  color: var(--placeholder);
}

.header-select,
.header-daterange {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--h-control);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.header-select {
  position: relative;
  flex: 0 1 220px;
  min-width: 160px;
}
.header-select:focus-within,
.header-daterange:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.header-select svg,
.header-daterange svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.header-select select {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0 22px 0 0;
  border: 0;
  background-color: transparent;
  background-position: right 0 center;
  box-shadow: none;
  outline: none;
  color: var(--text);
  font-size: var(--fs-base);
}
.header-select select:focus,
.header-select select:hover {
  border: 0;
  box-shadow: none;
}
.header-daterange input[type="date"] {
  width: 112px;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  padding: 0;
  color: var(--text);
  font-size: var(--fs-base);
}

.header-meta {
  position: absolute;
  top: 0;
  right: var(--page-pad);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.header-user-info {
  order: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.25;
}
.header-user-info strong {
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
}
.header-avatar {
  order: 0;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eceff3;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
}

.page-content {
  padding: var(--page-pad) var(--space-5);
  overflow: auto;
  min-height: 0;
  flex: 1;
}

/* Right-hand cart sidebar container */

.secondary-sidebar {
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: var(--space-4);
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
}

/* 4. Panels ---------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel + .panel {
  margin-top: var(--space-4);
}
.panel-header {
  min-height: 56px;
  padding: 12px var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
}
.panel-header .muted {
  margin-top: 1px;
}
.panel-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.panel-body {
  padding: var(--space-5);
}
/* panel that is just a table card (reference "Все продажи") */
.panel-flush .panel-body {
  padding: 0;
}
.panel-flush .table-wrap {
  border: 0;
  border-radius: 0;
}
.panel-flush .empty-state {
  margin: var(--space-5);
}
.table-footer {
  padding: var(--space-4) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-base);
  color: var(--muted);
}
.pager {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pager-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.pager-btn:hover:not(:disabled):not(.is-active) {
  background: var(--surface-hover);
}
.pager-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pager-gap {
  min-width: 24px;
  text-align: center;
  color: var(--placeholder);
}

/* rows hidden by the sales filters / pagination / the admin «Только свои» switch */
.data-table tbody tr.is-filtered-out,
.data-table tbody tr.is-page-hidden,
.data-table tbody tr.is-scope-hidden,
.data-table tbody tr.is-adv-hidden {
  display: none !important;
}
/* «Создал» column is only meaningful while other users' records are shown */
.data-table[data-scope="own"] .col-creator {
  display: none;
}

.secondary-menu-title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.cart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.cart-panel-header .secondary-menu-title {
  margin-bottom: 0;
}

/* 5. Buttons --------------------------------------------------------------- */

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--h-control);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.secondary-button-small:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
a.primary-button,
a.secondary-button,
a.danger-button {
  width: fit-content;
}

/* primary */
.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.primary-button:active {
  background: #1e40af;
  border-color: #1e40af;
}
.primary-button:disabled,
.primary-button.is-muted {
  cursor: not-allowed;
  opacity: 0.5;
}
.primary-button.is-loading {
  opacity: 0.75;
  cursor: progress;
}
.primary-button.full-width {
  width: 100%;
}
.primary-button.is-blocked,
.primary-button.is-blocked:disabled {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  opacity: 0.55;
  cursor: not-allowed;
}

/* secondary */
.secondary-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}
.secondary-button:hover {
  background: var(--surface-hover);
  border-color: #b9c1cd;
}
.secondary-button:active {
  background: #e8ecf2;
}
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* danger */
.danger-button {
  background: var(--surface);
  border-color: var(--danger-line);
  color: var(--danger-text);
}
.danger-button:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.danger-button:active {
  background: var(--danger-text);
  border-color: var(--danger-text);
  color: #fff;
}
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ghost */
.ghost-button {
  background: transparent;
  color: var(--text-2);
}
.ghost-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* compact variants */
.refresh-button {
  min-height: var(--h-control);
  padding: 0 12px;
}
.refresh-button:disabled,
.refresh-button.is-loading {
  cursor: progress;
  opacity: 0.65;
}
.secondary-button-small {
  display: inline-flex;
  align-items: center;
  min-height: var(--h-control-sm);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.secondary-button-small:hover {
  background: var(--surface-hover);
  border-color: #b9c1cd;
}
.secondary-button-small:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* icon-only */
.icon-button {
  width: var(--h-control);
  height: var(--h-control);
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition),
    color var(--transition);
}
.icon-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* text link */
.text-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
}
.text-link-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.button-spinner {
  display: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.is-loading .button-spinner {
  display: inline-block;
}

/* Segmented control (RFID / Barcode switch) */
.mode-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  gap: 2px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  /* background: var(--surface-muted); */
  min-height: var(--h-control);
}
.mode-switch-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  min-height: 34px;
  padding: 0 14px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-xs);
  transition:
    background var(--transition),
    color var(--transition);
}
.mode-switch-btn:hover {
  color: var(--text);
}
.mode-switch-btn.is-active {
  background: var(--accent);
  color: #fff;
}

#inventory-history-btn {
  border-color: var(--line-strong);
}

/* 6. Forms ----------------------------------------------------------------- */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  font-weight: 500;
}
.form-field > .muted {
  font-weight: 400;
}

.form-field
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  width: 100%;
  min-height: var(--h-control);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.3;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}
textarea {
  padding: 7px 10px;
  resize: vertical;
  font-family: inherit;
}
select {
  appearance: none;
  padding-right: 28px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7689' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.form-field input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}
.form-field input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: #b4bcc9;
}
.form-field input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.form-field input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}
.form-field input[readonly] {
  background: var(--surface-muted);
  cursor: default;
}
.form-field
  input[type="file"]:not([type="checkbox"]):not([type="radio"]):not(
    [type="hidden"]
  ) {
  display: flex;
  align-items: center;
  padding: 0 4px;
  line-height: 1;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.form-field input[type="file"]::file-selector-button {
  height: 24px;
  margin: 0 10px 0 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}
.form-field input[type="file"]::file-selector-button:hover {
  background: var(--surface-hover);
}

.field-error {
  display: none;
  color: var(--danger-text);
  font-size: var(--fs-sm);
  font-weight: 400;
}
.form-field.is-invalid .field-error {
  display: block;
}
.form-field.is-invalid input:not([type="checkbox"]),
.form-field.is-invalid select,
.form-field.is-invalid textarea,
.form-field.is-invalid .client-search-field {
  border-color: var(--danger);
}
.form-field.is-invalid input:focus,
.form-field.is-invalid select:focus,
.form-field.is-invalid .client-search-field:focus-within {
  box-shadow: var(--ring-danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
  width: 100%;
  max-width: 720px;
}
.form-grid > [data-field="name"],
.form-grid > [data-field="description"],
.form-grid > [data-field="supplier"] {
  grid-column: 1 / -1;
}

/* Checkboxes */
input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Combined search field (client / supplier lookup) */

.client-search-wrap {
  position: relative;
}
.client-search-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--h-control);
  padding: 0 4px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.client-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.client-search-field.has-client {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.client-search-field input,
.form-field
  .client-search-field
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text);
}
.client-search-field input:focus,
.form-field .client-search-field input:focus {
  box-shadow: none;
}
.client-search-field input::placeholder {
  color: var(--placeholder);
}
.client-search-field.has-client input,
.client-search-field input:disabled {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  opacity: 1;
  font-weight: 500;
  background: transparent;
  cursor: default;
}
.client-search-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}
.client-search-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.client-search-btn svg {
  width: 15px;
  height: 15px;
}
.client-clear-btn {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 36, 51, 0.1);
  color: var(--text-2);
  font-size: 10px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}
.client-clear-btn:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.client-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 1px;
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.client-search-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.client-search-option:hover,
.client-search-option.is-active {
  background: var(--surface-hover);
}
.client-search-option strong {
  font-size: var(--fs-base);
  font-weight: 500;
}
.client-search-option span {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
}
.client-search-empty,
.client-search-loading {
  padding: 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: center;
}

/* 7. Tables / lists -------------------------------------------------------- */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-base);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 14px 16px;
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: var(--fs-base);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr {
  transition: background var(--transition);
}
.data-table tbody tr:hover {
  background: var(--surface-muted);
}
.data-table .col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}
.row-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-2);
}
.row-more svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.data-table tbody tr:hover .row-more {
  background: var(--surface-hover);
}
.data-table tbody tr.data-row {
  cursor: pointer;
}
.data-table tbody tr.data-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.data-table tbody tr.is-danger,
.data-table tbody tr.row-unresolved,
.data-table tbody tr.row-out-of-stock {
  background: var(--danger-soft);
}
.data-table tbody tr.is-danger:hover,
.data-table tbody tr.row-unresolved:hover,
.data-table tbody tr.row-out-of-stock:hover {
  background: #fbe3e4;
}

/* hierarchy inside a cell: title (500) → sub (400, muted) */
.cell-title {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}
.cell-sub {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
}
.cell-strong {
  font-weight: 500;
}
.cell-nowrap {
  white-space: nowrap;
}

.table-wrap .empty-state,
td.empty-state {
  border: 0;
}

/* Quantity controls */

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.qty-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: #b4bcc9;
}
.qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
  font-size: var(--fs-base);
}
.qty-static {
  font-weight: 500;
  font-size: var(--fs-base);
}

/* Row delete */

.row-actions {
  width: 36px;
  padding-left: 0 !important;
  text-align: right;
}
.row-delete-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition),
    color var(--transition);
}
.row-delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.row-delete-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-danger);
}
td .secondary-button-small + .secondary-button-small {
  margin-left: var(--space-2);
}

/* Toolbars and summary counters (used above tables) */

.import-review-toolbar {
  display: flex;
  align-items: flex-end;
  /* justify-content: space-between; */
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.import-review-summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--h-control);
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  font-size: var(--fs-base);
  color: var(--text-2);
}
.import-review-summary strong {
  font-weight: 500;
  color: var(--text);
}

/* 8. Status / feedback ----------------------------------------------------- */

/* Badge: one status language across the app.
   default = neutral (pending / inactive); .green success; .amber warning;
   .red error; .blue info / active. */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--text-2);
  border: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.badge:not(.secondary-button)::before {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #8a93a3;
}
.badge.green,
.badge.success {
  background: #e6f6ea;
  color: #1b7a3a;
}
.badge.green::before,
.badge.success::before {
  background: #2fa84f;
}
.badge.amber,
.badge.warning {
  background: #fdf0d5;
  color: #8a5a00;
}
.badge.amber::before,
.badge.warning::before {
  background: #f5a623;
}
.badge.red,
.badge.danger,
.badge.error {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.badge.red::before,
.badge.danger::before,
.badge.error::before {
  background: var(--danger);
}
.badge.blue,
.badge.info {
  background: #e3effd;
  color: #1e55b8;
}
.badge.blue::before,
.badge.info::before {
  background: var(--accent);
}
/* counter chip in the panel header ("badge secondary-button") */
.badge.secondary-button,
.badge.secondary-button:hover {
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-strong);
  font-size: var(--fs-sm);
  cursor: default;
}

/* Connection status */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  background: var(--success-soft);
  border: 1px solid var(--success-line);
  color: var(--success-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.status-pill.is-offline {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger-text);
}
.status-pill.is-offline .status-dot {
  background: var(--danger);
}

/* Toasts */
.toast-root {
  position: fixed;
  right: var(--space-4);
  top: var(--space-4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  transform: translateX(24px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: none;
}
.toast-success {
  border-left-color: var(--success);
}
.toast-error {
  border-left-color: var(--danger);
}
.toast-info {
  border-left-color: var(--accent);
}

/* Empty states */
.empty-state,
.arrival-placeholder,
.inventory-placeholder {
  padding: var(--space-5) var(--space-4);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.5;
}
.empty-state {
  font-size: 17px;
}
.arrival-placeholder,
.inventory-placeholder {
  padding: 40px var(--space-4);
}
.arrival-notfound {
  padding: var(--space-4);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: var(--fs-base);
  font-weight: 400;
  text-align: center;
}
.arrival-notfound strong {
  font-weight: 600;
}

/* Alerts */
.payment-modal-error,
.import-mapping-hint {
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.45;
}
.import-mapping-hint {
  margin-top: var(--space-3);
}
/* Подробная ошибка оформления продажи: заголовок + строки «Этап / Причина / Сделка» */
#processing-error-text {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-align: left;
}
#processing-error-text > strong {
  font-weight: 600;
}
.payment-error-line {
  font-weight: 400;
  overflow-wrap: anywhere;
}
.payment-error-line span {
  font-weight: 500;
}
.import-resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  padding: 10px var(--space-3);
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.45;
}

/* Loaders */
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.inventory-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px var(--space-4);
}

.processing-dots {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.processing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: processing-dot-bounce 1s ease-in-out infinite;
}
.processing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.processing-dot:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes processing-dot-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.processing-caption {
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--muted);
}
.processing-success-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: grid;
  place-items: center;
  animation: processing-success-pop 0.3s ease;
}
.processing-success-circle svg {
  width: 22px;
  height: 22px;
}
@keyframes processing-success-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Progress */
.dup-progress {
  width: min(360px, 80%);
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.dup-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* 9. Modals ---------------------------------------------------------------- */

/* One behaviour for every dialog of the project: a sheet docked to the right edge, full screen
   height, 750px wide. It slides up from the bottom when it opens and slides back down when it
   closes (both are plain transitions on the .is-open class, so every opener/closer in the JS
   gets the animation for free). */
.modal-overlay,
.client-drawer-overlay {
  --sheet-w: 750px;
  --sheet-duration: 0.35s;
  --sheet-ease: cubic-bezier(0.22, 0.8, 0.26, 1);
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  background: rgba(16, 24, 40, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sheet-duration) ease;
  backdrop-filter: blur(5px);
}
.client-drawer-overlay {
  z-index: 55;
}
.modal-overlay.is-open,
.client-drawer-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal,
.client-drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(var(--sheet-w, 750px), 100%);
  height: 100vh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 25px 25px 0 0;
  box-shadow: var(--shadow-modal);
  transform: translateY(100%);
  transition: transform var(--sheet-duration) var(--sheet-ease);
  will-change: transform;
}
.modal-overlay.is-open .modal,
.client-drawer-overlay.is-open .client-drawer {
  transform: translateY(0);
}
/* size variants no longer change the width - every dialog is 750px */
.modal-lg,
.modal-payment,
.modal-success {
  width: min(var(--sheet-w, 750px), 100%);
}
/* the small confirmation dialogs keep their content centred in the tall sheet */
.modal-success .modal-body {
  align-content: center;
}

.modal-header,
.client-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  margin-top: 10px;
}
.modal-header .icon-button,
.client-drawer-header .icon-button {
  margin: -4px -8px -4px 0;
}
.modal-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.modal-header h3,
.client-drawer-header h3 {
  margin-top: 1px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
/* header that carries only one line ("Продажа #123") → show it as the title */
.modal-header > div > .modal-eyebrow:only-child {
  font-size: var(--fs-lg);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  line-height: 1.3;
}

.modal-body,
.client-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
  display: grid;
  gap: var(--space-4);
  align-content: start;
}
.client-drawer-body {
  gap: var(--space-3);
}

.modal-footer,
.client-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
  flex-shrink: 0;
}
.client-drawer-footer {
  justify-content: flex-end;
}
.modal-footer > div:empty {
  display: none;
}
.modal-footer-center {
  justify-content: center;
}
.modal-total span {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.modal-total strong {
  font-size: var(--fs-lg);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-left: auto;
}
.modal-footer-center .full-width {
  margin: 0;
}

.modal-success-body {
  justify-items: center;
  text-align: center;
  padding-top: var(--space-5);
  padding-bottom: var(--space-4);
}
.modal-success-body strong {
  font-size: var(--fs-md);
  font-weight: 500;
}

/* Key / value block */
.modal-meta-grid {
  display: grid;
  gap: 17px;
  width: 100%;
}

.modal-meta-grid > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.modal-meta-grid span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 500;
}
.modal-meta-grid strong {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.modal-meta-grid .modal-meta-sub {
  font-weight: 400;
  color: var(--muted);
}
.modal-meta-grid .badge {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-2);
}
.modal-meta-grid .badge.green {
  color: var(--success-text);
}
.modal-meta-grid .badge.red {
  color: var(--danger-text);
}

/* Checkout */
.payment-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.processing-stage {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
}
.processing-stage.is-active {
  display: flex;
  animation: checkout-stage-in 0.2s ease;
}
@keyframes checkout-stage-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.processing-stage strong {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}

.payment-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
}
.payment-link-card,
.payment-qr-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.payment-link-card span,
.payment-qr-card span {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.payment-link-card a {
  color: var(--accent);
  word-break: break-all;
  font-size: var(--fs-sm);
  font-weight: 400;
}
.payment-link-card a:hover {
  text-decoration: underline;
}
.payment-qr-frame {
  display: grid;
  place-items: center;
  min-height: 200px;
}
.payment-qr-frame img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

/* RFID scan list inside modals */
.rfid-scan-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rfid-scan-list .data-table {
  margin: 0;
}
.rfid-scan-list .table-wrap {
  border: 0;
  border-radius: 0;
}
.rfid-scan-list .empty-state {
  border: 0;
  background: transparent;
}

/* 10. Receipt -------------------------------------------------------------- */

.receipt-page {
  min-height: 100vh;
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
  align-content: start;
}
.receipt-page-bar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.receipt-empty-state {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
.receipt-preview {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.receipt-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.receipt-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 600;
  display: grid;
  place-items: center;
}
.receipt-company {
  font-size: var(--fs-md);
  font-weight: 600;
}
.receipt-subtitle {
  margin-top: 1px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.receipt-meta-grid {
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.receipt-meta-grid span {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.receipt-meta-grid strong {
  display: block;
  margin-top: 3px;
  font-size: var(--fs-base);
  font-weight: 500;
}
.receipt-divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-4) 0;
}
.receipt-items-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}
.receipt-items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.receipt-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 8px var(--space-3);
  border-bottom: 1px solid var(--line);
}
.receipt-item:last-child {
  border-bottom: 0;
}
.receipt-item-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.receipt-item-main {
  min-width: 0;
}
.receipt-item-title {
  font-size: var(--fs-base);
  font-weight: 500;
}
.receipt-item-code {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 1px;
}
.receipt-item-info {
  text-align: right;
  white-space: nowrap;
}
.receipt-item-info span {
  display: block;
  font-size: var(--fs-base);
  font-weight: 500;
}
.receipt-item-info strong {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
}
.receipt-total {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-strong);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--fs-md);
  font-weight: 500;
}
.receipt-total strong {
  font-size: 18px;
  font-weight: 600;
}

/* 11. Sale sidebar (cart) -------------------------------------------------- */

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-right: 2px;
}
.sidebar-block {
  flex-shrink: 0;
}
.sidebar-pinned {
  flex-shrink: 0;
}

/* Round "!" hint next to a block title; the text appears on hover / keyboard focus */
.sidebar-pay-hint {
  position: relative;
}
.info-tip-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.info-tip {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
  transition:
    color var(--transition),
    border-color var(--transition);
}
.info-tip:hover,
.info-tip:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.info-tip-text {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  z-index: 10;
  padding: 10px var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--transition),
    visibility var(--transition);
}
.info-tip-row:has(.info-tip:hover) + .info-tip-text,
.info-tip-row:has(.info-tip:focus-visible) + .info-tip-text {
  opacity: 1;
  visibility: visible;
}

/* Payment block: totals + one pay button that carries the amount */
.pay-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}
.pay-summary-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pay-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pay-summary-row span {
  font-size: var(--fs-base);
  color: var(--muted);
  font-weight: 400;
}
.pay-summary-row strong {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pay-summary-row.pay-summary-discount strong {
  color: var(--accent-strong);
}
.pay-summary-button {
  min-height: var(--h-control-lg);
  font-size: var(--fs-md);
  font-weight: 600;
}

/* Accordions: per-item discount block + payment-type block */
.accordion {
  display: grid;
  gap: var(--space-2);
}
.payment_type .accordion {
  grid-template-columns: repeat(2, 1fr);
}
.accordion-item {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color var(--transition),
    background var(--transition);
}
.accordion-item:hover {
  border-color: #b4bcc9;
}
.accordion-item.is-open {
  border-color: #b4bcc9;
  background: var(--surface-muted);
}
.payment_type .accordion-item.is-open {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px var(--space-3);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}
.accordion-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accordion-meta {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.accordion-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform var(--transition);
}
.accordion-item.is-open .accordion-chevron {
  transform: rotate(180deg);
}
.accordion-radio {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  transition:
    border-color var(--transition),
    background var(--transition);
}
.accordion-item.is-open .accordion-radio {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}
.accordion-item.is-open .accordion-header {
  font-weight: 500;
}
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.18s ease;
}
.accordion-item.is-open .accordion-body {
  max-height: 170px;
}
.accordion-body-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-3);
}
.accordion-hint {
  margin: 0 0 var(--space-3);
  padding: 0 var(--space-3);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.4;
}

.discount-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: var(--h-control);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.discount-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.discount-input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}
.discount-type-toggle {
  display: flex;
  flex-shrink: 0;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.discount-type-btn {
  min-width: 40px;
  min-height: 26px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}
.discount-type-btn:hover {
  color: var(--text);
}
.discount-type-btn.is-active {
  background: var(--accent);
  color: #fff;
}

/* 12. Page-specific blocks ------------------------------------------------- */

/* Новый товар / Присвоить RFID */
.arrival-product {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.arrival-product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.arrival-product-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.arrival-product-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}
.arrival-product-price {
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--muted);
}
.arrival-product-barcode {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.arrival-save-row {
  display: flex;
  margin: var(--space-4) 0 0;
}
.arrival-product .arrival-save-row {
  margin: 0;
}

/* Инвентаризация */
.inventory-store-field {
  flex: 1 1 260px;
  max-width: 320px;
}
.inventory-check-cell {
  text-align: center;
}
.inventory-check-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.inventory-history-filters {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.inventory-history-filters .form-field select {
  min-width: 120px;
}
.history-table-wrap {
  max-height: 60vh;
}
.history-table th,
.history-table td {
  text-align: center;
  white-space: nowrap;
}
.history-table td:first-child,
.history-table th:first-child,
.history-table td:nth-child(2),
.history-table th:nth-child(2) {
  text-align: left;
  white-space: normal;
}
.history-square {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.history-square.is-exist {
  background: var(--success);
}
.history-square.is-absent {
  background: var(--danger);
}

/* Импорт */
.import-content {
  padding-bottom: 84px;
}
.import-panel-header {
  align-items: center;
  flex-wrap: wrap;
}
.import-step-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  flex: 1 1 480px;
  max-width: 640px;
}
.import-step-button {
  min-height: var(--h-control);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}
.import-step-button:hover:not(:disabled):not(.is-active) {
  background: var(--surface-hover);
  color: var(--text);
}
.import-step-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.import-step-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.import-stage {
  display: none;
}
.import-stage.is-active {
  display: block;
}
.import-stage-note {
  display: none;
  margin-bottom: var(--space-4);
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--text-2);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.5;
}
.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
  width: 100%;
  max-width: 720px;
}
.import-file-field {
  grid-column: 1 / -1;
}
.import-file-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.import-file-name {
  min-height: var(--h-control);
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 400;
}
.import-checks {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.import-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-base);
  color: var(--text);
  font-weight: 400;
  cursor: pointer;
}
.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.import-summary-card,
.import-result-card {
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}
.import-summary-card span,
.import-result-card span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.import-summary-card strong,
.import-result-card strong {
  display: block;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.import-result-card {
  margin-bottom: var(--space-3);
  border-style: dashed;
}
.import-result-card.is-hidden {
  display: none;
}
.import-map-wrap,
.import-preview-wrap {
  max-height: 58vh;
}
.import-review-wrap {
  max-height: 56vh;
}
.import-select {
  width: 100%;
  max-width: 280px;
}
.import-map-table td .cell-sub {
  margin-top: 3px;
}
/* Список сверки рисуется «окном» (см. renderReviewWindow в app.js): строки одной высоты,
   колонки фиксированной ширины, длинный текст обрезается - иначе распорки не совпадут с высотой. */
.import-review-table {
  table-layout: fixed;
  min-width: 900px;
}
.import-review-table th:nth-child(1) {
  width: 22%;
}
.import-review-table th:nth-child(2) {
  width: 13%;
}
.import-review-table th:nth-child(3) {
  width: 22%;
}
.import-review-table th:nth-child(4),
.import-review-table th:nth-child(5) {
  width: 10%;
}
.import-review-table th:nth-child(6) {
  width: 7%;
}
.import-review-table th:nth-child(7) {
  width: 16%;
}
.import-review-table td:nth-child(6),
.import-review-table th:nth-child(6),
.import-review-table td:nth-child(7),
.import-review-table th:nth-child(7) {
  text-align: center;
}
.import-review-table tbody td {
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-review-table tbody tr.vs-spacer,
.import-review-table tbody tr.vs-spacer:hover {
  background: transparent;
}
.import-review-table tbody tr.vs-spacer td {
  padding: 0;
  border: 0;
}
.import-review-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.import-review-search {
  width: 280px;
  max-width: 100%;
  min-height: var(--h-control);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
}
.import-review-search:focus {
  outline: none;
  box-shadow: var(--ring);
}
.import-review-shown {
  font-size: var(--fs-base);
  color: var(--text-2);
}
.import-skipped {
  margin-top: var(--space-3);
  font-size: var(--fs-base);
  color: var(--text-2);
}
.import-skipped summary {
  cursor: pointer;
}
.import-skipped-wrap {
  margin-top: var(--space-2);
  max-height: 260px;
}
.import-review-check-cell {
  text-align: center;
}
.import-review-check-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.import-review-table tr.is-success,
.import-review-table tr.is-success:hover {
  background: var(--success-soft);
}
.import-review-table tr.is-muted {
  opacity: 0.8;
}

/* action bar pinned to the viewport corner */
.import-actions-fixed {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 40;
  display: flex;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  max-width: calc(100vw - 32px);
}
.import-actions-group {
  display: none;
  flex-direction: row-reverse; /* primary action sits at the right edge */
  gap: var(--space-2);
  flex-wrap: wrap;
}
.import-actions-group.is-active {
  display: flex;
}

.import-confirm-summary {
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  white-space: pre-line;
  line-height: 1.55;
  font-size: var(--fs-base);
  font-weight: 400;
}
.import-confirm-fields {
  display: grid;
  gap: var(--space-3);
}
.import-confirm-loading,
.import-confirm-success {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}
.import-confirm-success {
  border-color: var(--success-line);
  background: var(--success-soft);
}
.import-confirm-loading strong,
.import-confirm-success strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 500;
}
.import-confirm-success p,
.import-confirm-loading p {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.import-success-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--success);
}
.import-success-icon svg {
  width: 40px;
  height: 40px;
  animation: importSuccessCheck 0.9s ease both;
}
@keyframes importSuccessCheck {
  0% {
    stroke-dasharray: 0 100;
    stroke-dashoffset: 0;
    opacity: 0;
  }
  100% {
    stroke-dasharray: 100 0;
    opacity: 1;
  }
}

/* Настройки → Проверка дублей */
.dup-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 280px;
  text-align: center;
}
.dup-loader.is-hidden {
  display: none;
}
/* «База данных»: список резервных копий */
.backup-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.backup-list:empty {
  display: none;
}
.backup-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}
.backup-item:last-child {
  border-bottom: 0;
}
.backup-item:hover {
  background: var(--surface-muted);
}
.backup-item-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--success-soft);
  color: var(--success-text);
}
.backup-item-icon svg {
  width: 22px;
  height: 22px;
}
.backup-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.backup-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.backup-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}
.backup-item-actions .icon-button svg {
  width: 20px;
  height: 20px;
}
.icon-button.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dup-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.dup-list.is-hidden {
  display: none;
}
.dup-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--space-4);
  padding: 9px var(--space-3);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.dup-item:last-child {
  border-bottom: 0;
}
.dup-item:hover,
.dup-item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.dup-item:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.dup-item-rfid {
  font-weight: 500;
  word-break: break-all;
}
.dup-item-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
}

/* Настройки → Отдел пользователей: access tree */
.access-tree-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.access-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 40px;
  padding: 6px var(--space-3);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.access-tree-actions {
  display: flex;
  gap: var(--space-2);
}
.access-tree-actions .secondary-button {
  min-height: var(--h-control-sm);
  padding: 0 10px;
  font-size: var(--fs-sm);
  text-transform: none;
  letter-spacing: 0;
}
.access-tree {
  padding: var(--space-1);
}
/* Окно отдела: блоки «Доступ» и «Страница по умолчанию» показываются целиком, прокручивается всё окно.
   Раньше сетка тела окна сжимала блоки (overflow: hidden) и дерево страниц обрезалось с внутренней прокруткой. */
#department-modal-overlay .modal-body {
  grid-auto-rows: max-content;
}
#department-modal-overlay .access-tree-block {
  overflow: visible;
}
#department-modal-overlay .access-tree-header {
  border-radius: var(--radius) var(--radius) 0 0;
}
.access-tree-section + .access-tree-section {
  border-top: 1px solid var(--line);
}
.access-tree-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}
.access-tree-row:hover {
  background: var(--surface-hover);
}
.access-tree-row-section {
  font-weight: 500;
}
.access-tree-row-page {
  padding-left: 34px;
  font-weight: 400;
}
.access-tree-section-label {
  padding: 8px 10px 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.access-tree-toggle {
  width: 18px;
  height: 18px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.access-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--transition);
}
.access-chevron.is-open {
  transform: rotate(180deg);
}
.access-tree-toggle .access-chevron {
  width: 14px;
  height: 14px;
}
.access-tree-toggle .access-chevron.is-collapsed {
  transform: rotate(-90deg);
}
.access-tree-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--fs-base);
  color: var(--text);
}
.access-tree-pages.is-collapsed {
  display: none;
}

/* Warehouses a department may use on a page (under that page's row) */
.access-tree-stores-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
}
.access-tree-stores-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.access-tree-stores {
  margin: 0 10px 6px 58px;
  padding: 6px var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.access-tree-stores.is-collapsed {
  display: none;
}
.access-tree-stores-row {
  display: flex;
  align-items: center;
  padding: 4px 2px;
}
.access-tree-stores-row.is-master {
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}
.access-tree-stores-empty {
  padding: 4px 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Access-denied full-page notice (includes/access.php) */
.access-denied-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--space-5);
}
.access-denied-card {
  max-width: 400px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.access-denied-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: var(--fs-lg);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.access-denied-card h1 {
  font-size: var(--fs-lg);
  font-weight: 600;
}
.access-denied-card p {
  color: var(--muted);
  font-size: var(--fs-base);
}

/* 13. Responsive ----------------------------------------------------------- */

@media (max-width: 1100px) {
  .app-shell,
  .app-shell.no-right,
  .app-shell.is-collapsed,
  .app-shell.is-collapsed.no-right {
    grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .app-shell .primary-sidebar {
    grid-row: 1 / span 2;
  }
  .app-shell .sidebar-brand {
    justify-content: center;
    padding: 0;
  }
  .app-shell .sidebar-brand-icon {
    display: grid;
  }
  .app-shell .sidebar-brand-text,
  .app-shell .nav-section-label,
  .app-shell .nav-group-toggle,
  .app-shell .nav-label,
  .app-shell .sidebar-collapse-btn,
  .app-shell .sidebar-clock {
    display: none;
  }
  .app-shell .primary-nav,
  .app-shell .primary-sidebar-footer {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
  .app-shell .nav-group {
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--line);
  }
  .app-shell .nav-group:last-child {
    border-bottom: 0;
  }
  .app-shell .nav-subitem {
    justify-content: center;
    padding: 0;
  }
  .app-shell .secondary-sidebar {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: var(--space-3) var(--space-4);
  }
  .secondary-sidebar .sidebar-scroll,
  .secondary-sidebar .pay-summary-breakdown {
    display: none;
  }
  .secondary-sidebar .pay-summary {
    padding: 0;
    border: 0;
    background: transparent;
  }
  .secondary-sidebar .primary-button {
    width: auto;
    padding: 0 24px;
  }
  .import-summary-grid {
    grid-template-columns: 1fr;
  }
  .import-step-switcher {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .import-step-switcher {
    grid-template-columns: 1fr;
  }
  .import-grid {
    grid-template-columns: 1fr;
  }
  .payment-modal-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --page-pad: 16px;
  }
  .page-header {
    padding-top: calc(var(--header-h) + var(--space-4));
    padding-bottom: var(--space-4);
    gap: var(--space-3);
  }
  .page-header h1 {
    font-size: 28px;
  }
  .page-header p {
    display: none;
  }
  .header-search {
    flex: 1 1 100%;
  }
  .header-user-info {
    display: none;
  }
  .page-content {
    padding-bottom: var(--space-3);
  }
  .panel-header {
    padding: 10px var(--space-3);
    flex-wrap: wrap;
  }
  .panel-body {
    padding: var(--space-3);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .modal,
  .client-drawer {
    border-left: 0;
  }
  .modal-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-actions {
    margin-left: 0;
    justify-content: stretch;
  }
  .modal-actions > * {
    flex: 1;
  }
  .receipt-page {
    padding: var(--space-3);
  }
  .receipt-page-bar {
    flex-direction: column;
  }
  .receipt-preview {
    padding: var(--space-4);
  }
  .import-actions-fixed {
    left: var(--space-2);
    right: var(--space-2);
    bottom: var(--space-2);
    max-width: none;
  }
  .import-actions-group {
    width: 100%;
  }
  .import-actions-group > * {
    flex: 1 1 auto;
  }
  .import-content {
    padding-bottom: 128px;
  }
  .toast-root {
    left: var(--space-3);
    right: var(--space-3);
    top: var(--space-3);
  }
  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 14. Print ---------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
  }
  .receipt-page {
    padding: 0;
  }
  .receipt-page-bar {
    display: none;
  }
  .receipt-preview {
    border: 0;
    padding: 0;
  }
}

/* Toolbar variant: controls grouped on the left instead of spread across the row */
.import-review-toolbar.is-start {
  justify-content: flex-start;
}
.import-review-toolbar.is-start .form-field {
  width: 168px;
}

/* «Присвоить RFID»: переключатель Barcode / SKU, поиск по SKU и найденные товары ---------- */
.arrival-head-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.arrival-product-codes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}
.arrival-sku {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.arrival-sku-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 520px;
}
.arrival-sku-search input {
  flex: 1;
  min-width: 0;
  min-height: var(--h-control);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
}
.arrival-sku-search input:focus {
  outline: none;
  box-shadow: var(--ring);
}
.arrival-sku-status {
  font-size: var(--fs-base);
  color: var(--text-2);
}
.arrival-sku-status.is-error {
  color: var(--danger-text);
}
.arrival-sku-results {
  max-height: 320px;
}
.arrival-sku-results .data-table tbody tr.data-row {
  cursor: pointer;
}
.arrival-sku-results .data-table tbody tr.is-selected,
.arrival-sku-results .data-table tbody tr.is-selected:hover {
  background: var(--success-soft);
}

/* «Все продажи»: каждая продажа - карточка «Продажа #id · Товар · Клиент · Сумма + статус» */
.panel-flush:has(.sales-cards) {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.panel-flush .table-wrap:has(.sales-cards) {
  overflow: visible;
}
.sales-cards,
.sales-cards tbody {
  display: block;
}
.sales-cards thead {
  display: none;
}
.sales-cards tbody {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.sales-cards tbody tr.data-row {
  display: grid;
  grid-template-columns:
    minmax(170px, 1fr) minmax(0, 1.7fr) minmax(0, 1.2fr)
    auto;
  align-items: center;
  gap: var(--space-5);
  padding: 14px var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--transition),
    background var(--transition);
  height: 92px;
}
.sales-cards tbody tr.data-row:has(td:nth-child(5)) {
  grid-template-columns:
    minmax(170px, 1fr) minmax(0, 1.6fr) minmax(0, 1.1fr)
    minmax(0, 1fr) auto;
}
.sales-cards tbody tr.data-row:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}
.sales-cards tbody td {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
}
.sale-card-main strong {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}
.sale-card-main .muted,
.sale-card-label {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.sale-card-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-md);
  color: var(--text);
}
.sale-card-more,
.sale-card-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.sale-card-more {
  margin-left: var(--space-1);
}
.sale-card-total {
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3) !important;
  white-space: nowrap;
}
.sale-card-total strong {
  font-size: var(--fs-md);
  font-weight: 600;
}
.sale-status {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--muted);
}
.sale-status svg {
  width: 16px;
  height: 16px;
}
.sale-status-ok {
  background: var(--success);
}
.sale-status-bad {
  background: var(--danger);
}
@media (max-width: 900px) {
  .sales-cards tbody tr.data-row,
  .sales-cards tbody tr.data-row:has(td:nth-child(5)) {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-4);
  }
  .sales-cards tbody td:nth-child(n + 2):not(.sale-card-total) {
    grid-column: 1 / -1;
    order: 2;
  }
}

/* «Фильтр» в списках продаж: кнопка рядом с поиском и окно с полями */
.header-filter-btn {
  min-height: var(--h-control);
  gap: var(--space-2);
}
.header-filter-btn svg {
  width: 18px;
  height: 18px;
}
/* «Источник» - поле-список справа от кнопки «Фильтр» в шапке «Всех продаж» */
.header-source-filter {
  display: inline-flex;
  align-items: center;
}
.header-source-filter select {
  min-height: var(--h-control);
  min-width: 170px;
  max-width: 240px;
}
.filter-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
}
.filter-count[hidden] {
  display: none;
}
.filter-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.filter-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.filter-section h4 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}
.filter-section .form-field input,
.filter-section .form-field select {
  width: 100%;
}
#sales-filter-lookup-status.is-error {
  color: var(--danger-text);
}
@media (max-width: 760px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Окно продажи (orders.php, megastar_sales.php): шапка с корзиной, блок данных + плашка статуса,
   «Товары» с таблицей и строкой «Итого:» */
.sale-modal .modal-header {
  align-items: center;
  padding: var(--space-4) var(--space-5);
}
.sale-modal-title {
  display: flex;
  align-items: end;
  gap: var(--space-3);
  min-width: 0;
}
.sale-modal-title svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--accent);
}
.sale-modal-title strong {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.sale-modal-num {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.sale-modal .modal-body {
  padding: var(--space-5);
  gap: var(--space-5);
}

.sale-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}
.sale-info-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-3) var(--space-5);
  align-items: center;
  min-width: 0;
}
.sale-info-list dt {
  color: var(--muted);
  font-size: var(--fs-md);
}
.sale-info-list dd {
  margin: 0;
  min-width: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.sale-person,
.sale-payment {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.sale-payment {
  font-weight: 400 !important;
}
.sale-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.sale-avatar svg {
  width: 20px;
  height: 20px;
}
.sale-person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sale-person-sub {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
}
.sale-person-sub[hidden] {
  display: none;
}
.sale-payment-icon {
  display: inline-flex;
  color: var(--text);
}
.sale-payment-icon svg {
  width: 24px;
  height: 24px;
}

.sale-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding: 10px var(--space-4);
  border-radius: 999px;
  background: #dcefd9;
  color: #1f5f2f;
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.sale-pill svg {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
}
.sale-pill-bad {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.sale-pill-bad svg {
  background: var(--danger);
}
.sale-pill-other {
  background: #eef0f3;
  color: var(--text-2);
}
.sale-pill-other svg {
  background: var(--muted);
}

.sale-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.sale-items-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-lg);
  font-weight: 600;
}
.sale-items-title svg {
  width: 24px;
  height: 24px;
}
.sale-items-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}
.sale-items-table th,
.sale-items-table td {
  padding: 14px var(--space-4);
  text-align: right;
}
.sale-items-table th:first-child,
.sale-items-table td:first-child {
  text-align: left;
}
.sale-items-table thead th {
  background: #f1f3fb;
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 500;
  white-space: nowrap;
}
.sale-items-table tbody td {
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}
.sale-items-table tbody td:first-child {
  white-space: normal;
}
.sale-items-table tbody tr.is-danger td {
  background: var(--danger-soft);
}
.sale-item-name {
  font-weight: 500;
  color: var(--text);
}
.sale-item-sub {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.sale-items-table tfoot td {
  background: #f1f3fb;
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  font-size: var(--fs-lg);
  font-weight: 600;
  white-space: nowrap;
}
.sale-items-table tfoot td:first-child {
  font-weight: 600;
  text-align: right;
}
.sale-items-table tfoot td:last-child {
  font-size: 20px;
}

.sale-modal-footer {
  background: transparent;
  border-top: 0;
  padding: var(--space-4) var(--space-5) var(--space-5);
}
.sale-modal-footer .primary-button {
  min-width: 120px;
  min-height: var(--h-control-lg);
}

@media (max-width: 560px) {
  .sale-info {
    flex-direction: column-reverse;
  }
  .sale-info-list {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .sale-info-list dd {
    margin-bottom: var(--space-2);
  }
}

/* «База данных»: переключатель «Система / Битрикс24 Склад» внизу шапки */
.backup-scope-row {
  flex: 1 1 100%;
}
.backup-scope-row .mode-switch {
  padding: 3px;
}
.backup-scope-row .mode-switch-btn {
  min-height: 34px;
  padding: 0 var(--space-5);
  font-size: var(--fs-base);
}
.dup-progress.is-indeterminate span {
  width: 40%;
  animation: backup-indeterminate 1.2s ease-in-out infinite;
}
@keyframes backup-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

/* Корзина в окне продажи + окно подтверждения удаления (Администратор) */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}
.modal-header-actions .icon-button {
  margin: 0;
}
.sale-modal .modal-header .modal-header-actions .icon-button {
  margin: 0;
}
.icon-button.is-danger {
  color: var(--danger);
}
.icon-button.is-danger svg {
  width: 20px;
  height: 20px;
}
.modal-overlay-top {
  z-index: 60;
}
.sale-delete-note {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: var(--fs-md);
}
.sale-delete-note p {
  margin: 0;
  font-size: var(--fs-base);
}
.sale-delete-note.is-info {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.sale-delete-confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.sale-delete-confirm:hover {
  background: var(--danger-text);
  border-color: var(--danger-text);
  color: #fff;
}

/* «Не указан» вместо прочерка, если у продажи нет клиента */
.sale-card-value.is-empty,
.sale-person-text strong.is-empty {
  color: var(--muted);
  font-weight: 400;
}

/* Инвентаризация: переключатель «Единица / Позиция» и колонка «Найдено: N из M» */
.inventory-view-field .mode-switch {
  min-height: var(--h-control);
  align-items: stretch;
}
.inventory-found-cell {
  min-width: 180px;
}
.inventory-found-text {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text);
}
.inventory-found-text.is-complete {
  color: var(--success-text);
}
.inventory-found-bar {
  display: block;
  height: 4px;
  max-width: 160px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.inventory-found-bar span {
  display: block;
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

/* Инвентаризация: поиск над списком и фиксированные колонки с многоточием */
.inventory-counters-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-width: 0;
}
.inventory-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 320px;
  max-width: 100%;
  height: var(--h-control);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
}
.inventory-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.inventory-search svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.inventory-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-base);
}
.inventory-table {
  table-layout: fixed;
}
.inventory-cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-table[data-view="unit"] th:nth-child(2) {
  width: 32%;
}
.inventory-table[data-view="unit"] th:nth-child(3) {
  width: 12%;
}
.inventory-table[data-view="unit"] th:nth-child(4) {
  width: 10%;
}
.inventory-table[data-view="unit"] th:nth-child(5) {
  width: 20%;
}
.inventory-table[data-view="unit"] th:nth-child(6) {
  width: 20%;
}
.inventory-table[data-view="unit"] th:nth-child(7) {
  width: 6%;
}
.inventory-table[data-view="position"] th:nth-child(2) {
  width: 42%;
}
.inventory-table[data-view="position"] th:nth-child(3) {
  width: 20%;
}
.inventory-table[data-view="position"] th:nth-child(4) {
  width: 14%;
}
.inventory-table[data-view="position"] th:nth-child(5) {
  width: 24%;
}

/* Выбор числа записей внизу списка продаж («10 / 20 / 50 / 100») */
.table-footer-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.page-size-select {
  /* содержит .visually-hidden (position: absolute): без этого скрытая подпись цепляется к окну и
     добавляет странице вторую прокрутку */
  position: relative;
  display: inline-block;
}
.page-size-select select {
  min-height: 36px;
  width: 76px;
  padding: 0 28px 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.inventory-table[data-view="unit"] th:nth-child(2) {
  width: 27%;
}
.inventory-table[data-view="unit"] th:nth-child(3) {
  width: 13%;
}
.inventory-table[data-view="unit"] th:nth-child(4) {
  width: 12%;
}
.inventory-table[data-view="unit"] th:nth-child(5) {
  width: 16%;
}
.inventory-table[data-view="unit"] th:nth-child(6) {
  width: 14%;
}
.inventory-table[data-view="unit"] th:nth-child(7) {
  width: 12%;
}
.inventory-table[data-view="unit"] th:nth-child(8) {
  width: 6%;
}
.inventory-table td,
.inventory-table th {
  white-space: nowrap;
}

/* 15. Skeleton --------------------------------------------------------------
   Каркас страницы с «переливающимися» блоками на время первой загрузки данных.
   Разметку печатает render_skeleton() (components/skeleton.php) первым ребёнком .page-content,
   состояние держит класс is-page-loading на <html>, снимает его PageLoader (assets/js/app.js). */

:root {
  --sk-base: #e9edf3;
  --sk-highlight: #f7f9fc;
}

.page-skeleton {
  display: none;
  position: relative;
}
html.is-page-loading .page-skeleton {
  display: block;
}
html.is-page-loading .page-content > :not(.page-skeleton),
html.is-page-loading .secondary-sidebar > :not(.page-skeleton) {
  display: none !important;
}
html.is-page-loading .secondary-sidebar > .page-skeleton {
  flex: 1;
  min-height: 0;
  display: flex;
}
html.is-page-ready .page-content > :not(.page-skeleton),
html.is-page-ready .secondary-sidebar > :not(.page-skeleton) {
  animation: sk-reveal 0.25s ease both;
}
@keyframes sk-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* shimmer: световая полоса проходит по блокам */
.sk-bar {
  display: block;
  max-width: 100%;
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    var(--sk-base) 30%,
    var(--sk-highlight) 50%,
    var(--sk-base) 70%
  );
  background-size: 300% 100%;
  animation: sk-shimmer 1.6s ease-in-out infinite;
}
@keyframes sk-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* trace: тонкая линия-индикатор сверху каркаса */
.sk-trace {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  z-index: 1;
}
.sk-trace::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sk-trace 1.4s linear infinite;
}
@keyframes sk-trace {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

.sk-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.sk-grow {
  flex: 1;
}
.sk-row-end,
.sk-row-between {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sk-row-end {
  justify-content: flex-end;
}
.sk-row-between {
  justify-content: space-between;
}

/* таблицы */
.sk-table {
  overflow: hidden;
}
.sk-trow {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.sk-trow:last-child {
  border-bottom: 0;
}
.sk-thead {
  height: 46px;
  background: var(--surface-muted);
}
.sk-cell {
  min-width: 0;
  padding-right: 16px;
}

/* карточки продаж */
.sk-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.sk-card {
  display: grid;
  grid-template-columns:
    minmax(170px, 1fr) minmax(0, 1.7fr) minmax(0, 1.2fr)
    auto;
  align-items: center;
  gap: var(--space-5);
  min-height: 92px;
  padding: 14px var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.sk-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.sk-toolbar-end {
  justify-content: flex-end;
  margin: var(--space-4) 0 0;
}
.sk-toolbar-end-aligned {
  margin-bottom: var(--space-3);
}
.sk-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* формы */
.sk-form {
  display: grid;
  gap: var(--space-3) var(--space-4);
  max-width: 720px;
}
.sk-form.is-two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sk-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* списки */
.sk-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sk-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.sk-list-item:last-child {
  border-bottom: 0;
}

/* «Новая продажа» */
.sk-cart {
  display: flex;
  flex-direction: column;
}
.sk-cart-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.sk-cart-row:last-child {
  border-bottom: 0;
}
.sk-hotkeys {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}
.sk-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 1;
  min-height: 0;
  width: 100%;
}
.sk-side-total {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.page-skeleton--cart-side .page-skeleton-error {
  display: none !important;
}

/* ошибка загрузки (вместо вечного скелета) */
.page-skeleton-error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-lg);
  background: var(--danger-soft);
  color: var(--danger-text);
}
.page-skeleton-error p {
  margin: 0;
  color: var(--text-2);
}
html.is-page-failed .page-skeleton-body,
html.is-page-failed .sk-trace {
  display: none;
}
html.is-page-failed .page-skeleton-error {
  display: flex;
}

@media (max-width: 900px) {
  .sk-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-4);
  }
  .sk-card > :nth-child(2),
  .sk-card > :nth-child(3) {
    grid-column: 1 / -1;
  }
  .sk-form.is-two-cols {
    grid-template-columns: 1fr;
  }
}

/* На узких экранах правая колонка «Новой продажи» превращается в нижнюю панель - скелет тоже */
@media (max-width: 1100px) {
  html.is-page-loading .secondary-sidebar > .page-skeleton {
    justify-content: flex-end;
  }
  .page-skeleton--cart-side .page-skeleton-body {
    width: 100%;
  }
  .sk-side {
    flex-direction: row;
    justify-content: flex-end;
  }
  .sk-side > :not(.sk-side-total) {
    display: none;
  }
  .sk-side-total {
    margin-top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }
  .sk-side-total > .sk-row-between {
    display: none;
  }
  .sk-side-total > .sk-bar {
    width: 180px !important;
  }
}

/* Row icons: иконка товара / склада / сотрудника в начале строки списка ---------------------------------
   <td class="col-ico"><span class="row-ico row-ico-product"></span></td> - отдельная колонка перед названием.
   Иконка рисуется маской, поэтому в разметку и JS попадает только пустой span с классом. */
.row-ico {
  --ico: none;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}
.row-ico::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.row-ico-product {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8 12 3 3 8v8l9 5 9-5V8Z'/%3E%3Cpath d='M3 8l9 5 9-5M12 13v8'/%3E%3C/svg%3E");
}
.row-ico-warehouse {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10 12 3l9 7v11H3z'/%3E%3Cpath d='M8 21v-7h8v7M8 17.5h8'/%3E%3C/svg%3E");
}
.row-ico-user {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8'/%3E%3C/svg%3E");
}
.row-ico-source {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4v16M4 6h13l-2.5 3.5L17 13H4'/%3E%3C/svg%3E");
}
.data-table th.col-ico,
.data-table td.col-ico,
.sale-items-table th.col-ico,
.sale-items-table td.col-ico,
.history-table th.col-ico,
.history-table td.col-ico {
  width: 1%;
  padding-right: 0;
  text-align: left;
  white-space: nowrap;
}
.inventory-table th.col-ico {
  width: 52px;
}
.col-ico + th,
.col-ico + td {
  padding-left: 12px;
}
.sale-items-table .col-ico + th,
.sale-items-table .col-ico + td {
  text-align: left;
}
.sale-items-table tbody td.col-ico + td {
  white-space: normal;
}
.history-table td:nth-child(2) {
  min-width: 220px;
}

/* Custom select: раскрывающаяся панель вместо системного списка (assets/js/custom-select.js) -------------
   Сам <select> остаётся на месте; пока панель открыта, он подсвечен как поле в фокусе. */
select.cs-open {
  border-color: var(--accent);
  box-shadow: var(--ring);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231f6feb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15l6-6 6 6'/%3E%3C/svg%3E");
}
.cs-pop {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow:
    0 14px 34px rgba(16, 24, 40, 0.16),
    0 2px 6px rgba(16, 24, 40, 0.06);
  font-size: var(--fs-base);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}
.cs-pop.cs-up {
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom left;
}
.cs-pop.is-open {
  opacity: 1;
  transform: none;
}
.cs-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 36px;
  margin-bottom: 6px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--placeholder);
}
.cs-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.cs-search svg {
  flex: none;
  width: 16px;
  height: 16px;
}
.cs-search input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.cs-list {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cs-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.cs-opt-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-opt.is-active {
  background: var(--surface-hover);
}
.cs-opt.is-selected {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 500;
}
.cs-opt.is-selected.is-active {
  background: #dbe8fd;
}
.cs-opt.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.cs-check {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
}
.cs-opt.is-selected .cs-check {
  opacity: 1;
}
.cs-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}
.cs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(16, 24, 40, 0.35);
}
/* узкие экраны: список «шторкой» снизу с крупными пунктами */
.cs-pop.cs-sheet {
  left: 12px;
  right: 12px;
  top: auto;
  bottom: 12px;
  border-radius: 16px;
  transform: translateY(16px);
  transform-origin: bottom center;
}
.cs-pop.cs-sheet.is-open {
  transform: none;
}
.cs-pop.cs-sheet .cs-opt {
  min-height: 44px;
}
@media (prefers-reduced-motion: reduce) {
  .cs-pop {
    transition: none;
  }
}

/* ==========================================================================
   Меню строки «⋮» (Изменить / Удалить) в списках настроек, поиск в панели, окно проверки дублей
   ========================================================================== */

/* Колонка с кнопкой «⋮» - первая в списке */
.data-table th.col-menu,
.data-table td.col-menu {
  width: 1%;
  padding-right: 0;
  white-space: nowrap;
}
.col-menu + th,
.col-menu + td {
  padding-left: 8px;
}
.row-menu-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}
.row-menu-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.row-menu-btn:hover,
.row-menu-btn[aria-expanded="true"] {
  background: var(--surface-hover);
  border-color: var(--line);
  color: var(--text);
}
.row-menu-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Плавающий блок меню (создаётся в <body>, позиционируется у кнопки) */
.row-menu {
  position: fixed;
  z-index: 95;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.row-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  text-align: left;
  cursor: pointer;
}
.row-menu-item:hover,
.row-menu-item:focus-visible {
  outline: none;
  background: var(--surface-hover);
}
.row-menu-item.is-danger {
  color: var(--danger-text);
}
.row-menu-item.is-danger:hover,
.row-menu-item.is-danger:focus-visible {
  background: var(--danger-soft);
}

/* Поиск внутри панели (слева от кнопки «Добавить …» в шапке панели) */
.panel-search {
  flex: 0 1 280px;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--h-control);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.panel-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.panel-search svg {
  flex: none;
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.panel-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: var(--fs-base);
}
.panel-search input::placeholder {
  color: var(--placeholder);
}
.panel-header-actions:has(.panel-search) {
  flex-wrap: nowrap;
}
@media (max-width: 640px) {
  .panel-header:has(.panel-search) {
    flex-wrap: wrap;
  }
  .panel-header-actions:has(.panel-search) {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .panel-header-actions .panel-search {
    flex: 1 1 100%;
  }
}

/* Проверка дублей: окно с товарами дубля шире (1000px), сверху - поиск и фильтр по складу */
#dup-modal-overlay .modal {
  --sheet-w: 1000px;
  width: min(1000px, 100%);
}
.dup-modal-filters {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.dup-modal-filters .panel-search {
  flex: 1 1 auto;
}
.dup-modal-filters .dup-store-filter {
  flex: 0 0 240px;
  min-width: 0;
}
.dup-modal-filters .dup-store-filter select {
  width: 100%;
}
@media (max-width: 560px) {
  .dup-modal-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .dup-modal-filters .dup-store-filter {
    flex-basis: auto;
  }
}

/* Галочка отдела под строкой страницы («Купоны» → «Изменение статуса») */
.access-tree-options {
  display: grid;
  gap: 2px;
  padding: 2px 10px 6px 58px;
}
.access-tree-options[hidden] {
  display: none;
}
.access-tree-option {
  min-height: 28px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

/* «Новая продажа»: купон в блоке «Скидка» */
.coupon-box {
  margin-top: var(--space-3);
}
.coupon-open-btn {
  width: 100%;
  min-height: var(--h-control);
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.coupon-open-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.coupon-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}
.coupon-field {
  flex: 1;
  min-width: 0;
}
.coupon-field.is-invalid {
  border-color: var(--danger);
}
.coupon-field.is-invalid:focus-within {
  box-shadow: var(--ring-danger);
}
.coupon-add-btn {
  width: var(--h-control);
  height: var(--h-control);
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition);
}
.coupon-add-btn:hover:not(:disabled) {
  background: var(--accent-strong);
}
.coupon-add-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.coupon-add-btn svg {
  width: 18px;
  height: 18px;
}
.coupon-error {
  margin-top: 6px;
  color: var(--danger-text);
  font-size: var(--fs-sm);
}
.coupon-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--h-control);
  padding: 0 10px;
  border: 1px solid #f8bcbc;
  border-radius: var(--radius);
  /* background: var(--accent-soft); */
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  overflow: hidden;
}
.coupon-applied-percent {
  display: inline-block;
  margin-left: 2px;
  padding: 5px 26px;
  color: #fff;
  background: #dc2626;
  font-weight: 600;
  white-space: nowrap;
  transform: rotate(-45deg);
  border-radius: 2px 4px 4px 2px;
} /* Окно продажи: строки «Всего» / «Скидка» над «Итого» */
.sale-items-table tfoot tr.sale-sum-row td {
  font-size: var(--fs-md);
  font-weight: 500;
  padding-block: 10px;
}
.sale-items-table tfoot tr.sale-sum-row td:first-child {
  font-weight: 500;
  color: var(--muted);
}
.sale-items-table tfoot tr.sale-sum-row td:last-child {
  font-size: var(--fs-md);
}

/* Строка истории, у которой идёт удаление товара (⋮ → «Удалить») */
.data-table tbody tr.is-busy {
  opacity: 0.5;
  pointer-events: none;
}