@charset "UTF-8";

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --bg: #f4f5fb;
  --bg-2: #eceffa;
  --surface: #ffffff;
  --surface-muted: #f7f8fd;
  --surface-2: #eef0f9;
  --line: #e8eaf3;
  --line-strong: #d9dcec;
  --text: #171a2b;
  --text-soft: #40465c;
  --muted: #767c94;
  --muted-2: #9298ab;

  --accent: #4f46e5;
  --accent-2: #6d63f2;
  --accent-dark: #362fa3;
  --accent-soft: #eef0ff;
  --accent-soft-strong: #e1e0fe;
  --accent-line: rgba(79, 70, 229, 0.22);

  --gold: var(--accent);
  --gold-2: var(--accent);
  --gold-soft: var(--accent-soft);

  --success: #16a34a;
  --success-2: #0f8a3c;
  --success-soft: #e9f9ee;
  --green: var(--success);

  --danger: #e0234d;
  --danger-2: #c81d42;
  --danger-soft: #fdedf1;

  --warning: #d97706;
  --warning-soft: #fef3e0;

  --info: #2563eb;
  --info-soft: #eaf1ff;

  --sidebar-bg-1: #161a33;
  --sidebar-bg-2: #0c0e1e;
  --sidebar-line: rgba(255, 255, 255, 0.09);
  --sidebar-text: rgba(255, 255, 255, 0.6);
  --sidebar-text-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-anim: 0.26s var(--ease);

  --shadow-xs: 0 1px 2px rgba(21, 24, 46, 0.05);
  --shadow-sm: 0 3px 10px rgba(21, 24, 46, 0.06);
  --shadow-soft: 0 8px 22px rgba(21, 25, 51, 0.06);
  --shadow: 0 14px 34px rgba(21, 25, 51, 0.1);
  --shadow-lg: 0 24px 54px rgba(21, 25, 51, 0.16);
  --shadow-accent: 0 10px 24px rgba(79, 70, 229, 0.22);

  --radius-xl: 24px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  --icon-sale: 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='M6 8h12l-1 11a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 8Z'/%3E%3Cpath d='M9 8V6a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E");
  --icon-products: 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%3Crect x='4' y='4' width='7' height='7' rx='1.6'/%3E%3Crect x='13' y='4' width='7' height='7' rx='1.6'/%3E%3Crect x='4' y='13' width='7' height='7' rx='1.6'/%3E%3Crect x='13' y='13' width='7' height='7' rx='1.6'/%3E%3C/svg%3E");
  --icon-orders: 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='M8 6h12M8 12h12M8 18h12'/%3E%3Ccircle cx='4' cy='6' r='1'/%3E%3Ccircle cx='4' cy='12' r='1'/%3E%3Ccircle cx='4' cy='18' r='1'/%3E%3C/svg%3E");
  --icon-import: 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='M12 15V4'/%3E%3Cpath d='M7 8l5-5 5 5'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E");
  --icon-employees: 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='9' cy='8' r='3.2'/%3E%3Cpath d='M3.4 20a5.7 5.7 0 0 1 11.2 0'/%3E%3Ccircle cx='17.3' cy='9' r='2.6'/%3E%3Cpath d='M15.6 13.1a5 5 0 0 1 5.2 4.9'/%3E%3C/svg%3E");
  --icon-currency: 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 7h14'/%3E%3Cpath d='M15 4l3 3-3 3'/%3E%3Cpath d='M20 17H6'/%3E%3Cpath d='M9 14l-3 3 3 3'/%3E%3C/svg%3E");
  --icon-stores: 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 21h18'/%3E%3Cpath d='M4 21V10l8-6 8 6v11'/%3E%3Cpath d='M9 21v-6h6v6'/%3E%3C/svg%3E");
  --icon-refresh: 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='M20 11A8 8 0 1 0 18.5 16'/%3E%3Cpath d='M20 5v6h-6'/%3E%3C/svg%3E");
  --icon-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-trash: 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 7h16'/%3E%3Cpath d='M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M6 7l1 13a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-13'/%3E%3C/svg%3E");
  --icon-user: 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='3.6'/%3E%3Cpath d='M4.5 20a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E");
  --icon-globe: 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.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M3.5 12h17M12 3.5c2.4 2.4 3.7 5.4 3.7 8.5s-1.3 6.1-3.7 8.5c-2.4-2.4-3.7-5.4-3.7-8.5S9.6 5.9 12 3.5Z'/%3E%3C/svg%3E");
  --icon-logout: 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='M9 21H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E");
  --icon-search-muted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767c94' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.3-4.3'/%3E%3C/svg%3E");
  --icon-plus-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-check: 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='12' r='9'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 5-5'/%3E%3C/svg%3E");
  --icon-calendar: 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%3Crect x='3.5' y='5' width='17' height='16' rx='2'/%3E%3Cpath d='M3.5 10h17'/%3E%3Cpath d='M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --icon-building: 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%3Crect x='4' y='3' width='16' height='18' rx='1.5'/%3E%3Cpath d='M9 21v-4h6v4'/%3E%3Cpath d='M8 7h.01M12 7h.01M16 7h.01M8 11h.01M12 11h.01M16 11h.01'/%3E%3C/svg%3E");
  --icon-tag: 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='M12.6 3.5H6a2 2 0 0 0-2 2v6.6c0 .5.2 1 .6 1.4l8 8a2 2 0 0 0 2.8 0l6-6a2 2 0 0 0 0-2.8l-8-8a2 2 0 0 0-1.4-.6Z'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.2'/%3E%3C/svg%3E");
  --icon-hash: 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='M5 9h14M5 15h14M10 4l-2 16M16 4l-2 16'/%3E%3C/svg%3E");
  --icon-phone: 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='M6.6 10.8a15 15 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.2c1 .3 2 .5 3.1.5a1 1 0 0 1 1 1v3.1a1 1 0 0 1-1 1A18 18 0 0 1 3 4a1 1 0 0 1 1-1h3.1a1 1 0 0 1 1 1c0 1.1.2 2.1.5 3.1a1 1 0 0 1-.2 1L6.6 10.8Z'/%3E%3C/svg%3E");
  --icon-dollar: 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='M12 3v18'/%3E%3Cpath d='M17 7.5c0-1.9-2.2-3.5-5-3.5s-5 1.4-5 3.2c0 4.4 10 2 10 6.4 0 1.8-2.2 3.4-5 3.4s-5-1.6-5-3.4'/%3E%3C/svg%3E");
  --icon-wallet: 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 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z'/%3E%3Cpath d='M16 12h3'/%3E%3Cpath d='M3 9h18'/%3E%3C/svg%3E");
  --icon-layers: 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='M12 3l9 5-9 5-9-5 9-5Z'/%3E%3Cpath d='M3 13l9 5 9-5'/%3E%3Cpath d='M3 18l9 5 9-5'/%3E%3C/svg%3E");
  --icon-trend: 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 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 6h6v6'/%3E%3C/svg%3E");
  --icon-undo: 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 10h11a5 5 0 0 1 0 10h-2'/%3E%3Cpath d='M8 5 3 10l5 5'/%3E%3C/svg%3E");
  --icon-chart: 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 20V10'/%3E%3Cpath d='M12 20V4'/%3E%3Cpath d='M20 20v-7'/%3E%3Cpath d='M2 20h20'/%3E%3C/svg%3E");
  --icon-settings: 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='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  --icon-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --icon-chevron-left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
  --icon-edit: 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='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
  --icon-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18'/%3E%3Cpath d='M6 6l12 12'/%3E%3C/svg%3E");
  /* Продажа "История" (see .held-baskets-toggle-btn) - a plain clock, kept
     visually distinct from --icon-calendar (date, not recency). */
  --icon-history: 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='12' r='9'/%3E%3Cpath d='M12 7v5l3.3 2'/%3E%3C/svg%3E");
  /* Продажа "Отложить" (see .held-basket-save-btn) - an archive box. */
  --icon-hold: 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%3Crect x='3' y='4' width='18' height='5' rx='1.5'/%3E%3Cpath d='M5 9v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9'/%3E%3Cpath d='M10 13h4'/%3E%3C/svg%3E");

  /* Primary sidebar nav icons only (Продажа/Товары/Продажи/Курс валют/
     Аналитика/Кассовый отчет) — deliberately separate from --icon-sale/
     --icon-products/--icon-orders/--icon-currency/--icon-chart/--icon-wallet
     above, which are also used elsewhere (sale-modal header icon, sale
     items table column icons, KPI cards) and must keep their existing
     look; only the sidebar's own icons change here, matching the reference
     design exactly. */
  --icon-nav-sale: 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='M6 8h12l-1 11a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 8Z'/%3E%3Cpath d='M9 8V6a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E");
  --icon-nav-products: 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 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.73Z'/%3E%3Cpath d='M3.3 7 12 12l8.7-5'/%3E%3Cpath d='M12 22V12'/%3E%3C/svg%3E");
  --icon-nav-orders: 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='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M15 2v5h5'/%3E%3Cpath d='M10 9H8'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3C/svg%3E");
  --icon-nav-wholesale: 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='M12 2 2 7l10 5 10-5-10-5Z'/%3E%3Cpath d='m2 17 10 5 10-5'/%3E%3Cpath d='m2 12 10 5 10-5'/%3E%3C/svg%3E");
  --icon-nav-debts: 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%3Crect x='2' y='6' width='20' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M6 12h.01'/%3E%3Cpath d='M18 12h.01'/%3E%3C/svg%3E");
  --icon-nav-requests: 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='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M8 12h8'/%3E%3Cpath d='M8 16h5'/%3E%3C/svg%3E");
  --icon-nav-defects: 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='M10.3 4 2.6 18a2 2 0 0 0 1.7 3h15.4a2 2 0 0 0 1.7-3L13.7 4a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --icon-nav-audit: 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 12a9 9 0 1 0 2.6-6.4'/%3E%3Cpath d='M3 4v5h5'/%3E%3Cpath d='M12 7.5V12l3.5 2'/%3E%3C/svg%3E");
  --icon-nav-sync: 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 12a9 9 0 0 1-15.5 6.2L3 16'/%3E%3Cpath d='M3 21v-5h5'/%3E%3Cpath d='M3 12a9 9 0 0 1 15.5-6.2L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E");
  --icon-nav-currency: 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='M8 3 4 7l4 4'/%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='m16 21 4-4-4-4'/%3E%3Cpath d='M20 17H4'/%3E%3C/svg%3E");
  --icon-nav-chart: 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='6' cy='15' r='1.6'/%3E%3Cpath d='M6 16.6V21'/%3E%3Ccircle cx='12' cy='9' r='1.6'/%3E%3Cpath d='M12 10.6V21'/%3E%3Ccircle cx='18' cy='5' r='1.6'/%3E%3Cpath d='M18 6.6V21'/%3E%3C/svg%3E");
  --icon-nav-cashier: 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%3Crect x='2' y='19' width='20' height='2.2' rx='1'/%3E%3Crect x='3.5' y='10.5' width='17' height='8.8' rx='1.2'/%3E%3Crect x='6' y='7' width='3.2' height='5.2' rx='0.8'/%3E%3Cpath d='M16.5 10.5V6.5'/%3E%3Crect x='13' y='2.5' width='7' height='4' rx='1'/%3E%3Cpath d='M11.8 12.5h1.6M15.6 12.5h1.6M11.8 15h1.6M15.6 15h1.6M11.8 17.5h1.6M15.6 17.5h1.6'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: #ffffff;
}
::-moz-selection {
  background: var(--accent);
  color: #ffffff;
}

* {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(64, 70, 92, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(64, 70, 92, 0.32);
  background-clip: padding-box;
}

html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(
      1100px 620px at 100% -8%,
      rgba(79, 70, 229, 0.07) 0%,
      rgba(79, 70, 229, 0) 60%
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}

textarea {
  resize: none !important;
}

button,
input,
textarea,
select {
  font: inherit;
}
img {
  max-width: 100%;
  display: block;
}
body.modal-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.t24logo {
  color: #ffffff96 !important;
  text-align: center;
  font-size: 10px;
  margin-top: 15px;
  max-height: 40px;
  opacity: 1;
  overflow: hidden;
  transition:
    opacity 0.16s var(--ease),
    max-height var(--sidebar-anim),
    margin-top var(--sidebar-anim);
}

.t24logo img {
  width: 60px;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}
/* ==========================================================================
   Layout
   ========================================================================== */

.app-shell {
  height: 100vh;
  display: grid;
  /* First track is `auto` (not a fixed px) on purpose - it sizes to
     .primary-sidebar's own `width`, which is what actually animates (see
     .primary-sidebar below). Grid recalculates that track every layout
     frame, so it tracks the sidebar's width transition smoothly; a fixed
     px value or a var() substitution here both failed to reverse reliably
     (grid-template-columns and inherited custom-property transitions are
     both unreliable across engines - this is the standard, robust way to
     animate a grid column). */
  grid-template-columns: auto minmax(0, 1fr) 384px;
  grid-template-rows: 100vh;
  overflow: hidden;
}
.app-shell.no-right {
  grid-template-columns: auto minmax(0, 1fr);
}

.primary-sidebar {
  width: 248px;
  background: linear-gradient(
    190deg,
    var(--sidebar-bg-1) 0%,
    var(--sidebar-bg-2) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 18px 14px;
  gap: 4px;
  position: relative;
  z-index: 4;
  box-shadow: 6px 0 28px rgba(6, 7, 18, 0.28);
  transition:
    width var(--sidebar-anim),
    padding var(--sidebar-anim);
}

.sidebar-topbar {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--sidebar-line);
  transition: padding var(--sidebar-anim);
}
.sidebar-brand {
  min-width: 0;
  flex: 1 1 auto;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}
.sidebar-collapse-btn {
  position: absolute;
  top: 63px;
  right: -12px;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--sidebar-text);
  background: linear-gradient(
    190deg,
    var(--sidebar-bg-1) 0%,
    var(--sidebar-bg-2) 100%
  );
  border: none;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    transform 0.22s var(--ease);
}
.sidebar-collapse-btn:hover {
  color: var(--sidebar-text-strong);
}
.sidebar-collapse-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  display: block;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-chevron-left);
  mask-image: var(--icon-chevron-left);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: transform var(--sidebar-anim);
}
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 600 !important;
  font-family: inherit;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--accent-dark);
  transition: font-size var(--sidebar-anim);
}
.primary-sidebar .sidebar-brand-text {
  color: var(--sidebar-text-strong);
}
.login-brand .sidebar-brand-text {
  gap: 8px;
  justify-content: center;
}
.sidebar-brand-text::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: url("/img/Logo24.png") center/cover no-repeat;
  box-shadow: var(--shadow-accent);
  flex: 0 0 auto;
  transition:
    width var(--sidebar-anim),
    height var(--sidebar-anim);
}

.primary-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.nav-item {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  color: var(--sidebar-text);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    padding var(--sidebar-anim);
  cursor: pointer;
  text-align: left;
  padding: 0 12px;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.nav-item.active .nav-icon {
  background-color: #fff;
}
.nav-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  font-size: 0;
  line-height: 0;
}
.nav-label {
  display: block;
  max-width: 160px;
  margin-left: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 1;
  transition:
    opacity 0.16s var(--ease),
    max-width var(--sidebar-anim),
    margin-left var(--sidebar-anim);
}
.nav-item[href="neworder.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-sale);
  mask-image: var(--icon-nav-sale);
}
.nav-item[href="products.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-products);
  mask-image: var(--icon-nav-products);
}
.nav-item[href="orders.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-orders);
  mask-image: var(--icon-nav-orders);
}
.nav-item[href="analytics.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-chart);
  mask-image: var(--icon-nav-chart);
}
.nav-item[href="import.php"] .nav-icon {
  -webkit-mask-image: var(--icon-import);
  mask-image: var(--icon-import);
}
.nav-item[href="employees.php"] .nav-icon {
  -webkit-mask-image: var(--icon-employees);
  mask-image: var(--icon-employees);
}
.nav-item[href="currency.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-currency);
  mask-image: var(--icon-nav-currency);
}
.nav-item[href="stores.php"] .nav-icon {
  -webkit-mask-image: var(--icon-stores);
  mask-image: var(--icon-stores);
}
.nav-item[href="settings.php"] .nav-icon {
  -webkit-mask-image: var(--icon-settings);
  mask-image: var(--icon-settings);
}
.nav-item[href="cash_report.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-cashier);
  mask-image: var(--icon-nav-cashier);
}
.nav-item[href="wholesale.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-wholesale);
  mask-image: var(--icon-nav-wholesale);
}
.nav-item[href="debts.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-debts);
  mask-image: var(--icon-nav-debts);
}
.nav-item[href="stock_requests.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-requests);
  mask-image: var(--icon-nav-requests);
}
.nav-item[href="defects.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-defects);
  mask-image: var(--icon-nav-defects);
}
.nav-item[href="audit_log.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-audit);
  mask-image: var(--icon-nav-audit);
}
.nav-item[href="sync_log.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-sync);
  mask-image: var(--icon-nav-sync);
}

/* ==========================================================================
   Настройки: inner sidebar (Сотрудники/График/Смена/Склады/Филиалы/Импорт)
   ========================================================================== */

.settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.settings-sidebar {
  flex: 0 0 208px;
  width: 208px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 22px;
}
.settings-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 10px;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.settings-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.settings-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.settings-main {
  flex: 1;
  min-width: 0;
}

@media (max-width: 900px) {
  .settings-layout {
    flex-direction: column;
  }
  .settings-sidebar {
    width: 100%;
    flex: 0 0 auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .settings-sidebar-title {
    display: none;
  }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.secondary-sidebar {
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -18px 0 40px -32px rgba(21, 25, 51, 0.35);
  padding: 20px 18px;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.main-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-header {
  height: 76px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.page-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.page-header p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.header-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 19px;
  font-weight: 600;
  text-transform: uppercase;
  color: #000000;
}

.header-meta .company_logo {
  background: linear-gradient(109deg, #0055ff 56%, #ff0000 40%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-meta .bitrix_logo {
  background: linear-gradient(109deg, #3db8ff 75%, #0246db 25%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-content {
  padding: 22px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}

#sale-contact-section {
  margin-bottom: 20px;
}

/* ==========================================================================
   Panels
   ========================================================================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease);
}
.panel + .panel {
  margin-top: 18px;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-header {
  min-height: 64px;
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-body {
  padding: 20px;
}

.muted {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid var(--accent-line);
  font-size: 11px;
  font-weight: 700;
}
.badge.green {
  background: var(--success-soft);
  color: var(--success-2);
  border-color: rgba(22, 163, 74, 0.22);
}
.badge.red {
  background: var(--danger-soft);
  color: var(--danger-2);
  border-color: rgba(224, 35, 77, 0.22);
}
/* Sale-modal header badge (shows the employee who made the sale) - the
   site's main accent gradient, same as .primary-button, instead of the
   soft accent/red/green variants used for status pills elsewhere. */
.badge.badge-gradient {
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border-color: transparent;
}
.is-danger-text {
  color: var(--danger-2) !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.primary-button,
.secondary-button,
.icon-button,
.danger-button {
  border: 0;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-xs);
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.primary-button:hover:not(:disabled):not(.is-muted) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.3);
}
.primary-button:active:not(:disabled):not(.is-muted) {
  transform: translateY(0);
}
.primary-button:disabled,
.primary-button.is-muted {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}
.primary-button.is-loading {
  opacity: 0.75;
  cursor: progress;
}
.primary-button.full-width,
.secondary-button.full-width {
  width: 100%;
  text-align: center;
}
.primary-button.is-blocked,
.primary-button.is-blocked:disabled {
  background: var(--danger);
  color: rgba(255, 255, 255, 0.9);
  opacity: 1;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--text-soft);
  font-weight: 600;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.secondary-button:hover {
  border-color: var(--accent-line);
  color: var(--accent-dark);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: var(--danger-2);
  font-weight: 700;
  border: 1px solid rgba(224, 35, 77, 0.2);
  cursor: pointer;
}
.danger-button:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  transform: translateY(-1px);
}
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}
.danger-button.is-loading {
  opacity: 0.75;
  cursor: progress;
}

.panel-header-actions,
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* "13.08.2026, Четверг" block, far right of every page-header — see
   render_page_header_date() in components/page_header_date.php. On pages
   with "Закрыть кассу" (Продавец role) it's the first child inside the
   same .page-header-actions, so it sits to that button's left. */
.page-header-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
/* Кассовый отчет, Продавец role: ФИО текущего сотрудника instead of the
   admin-only cash-report-employee-filter dropdown - see initCashReportPage()
   in assets/js/app.js. */
.cash-report-current-employee {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.refresh-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}
.refresh-button:disabled,
.refresh-button.is-loading {
  cursor: progress;
  opacity: 0.65;
  transform: none;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.icon-button:hover {
  background: var(--danger-soft);
  color: var(--danger-2);
  border-color: rgba(224, 35, 77, 0.22);
}

#products-refresh-btn::before,
#employee-add-btn::before,
#contact-pick-btn::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
#products-refresh-btn::before {
  -webkit-mask-image: var(--icon-refresh);
  mask-image: var(--icon-refresh);
}
#employee-add-btn::before {
  -webkit-mask-image: var(--icon-plus);
  mask-image: var(--icon-plus);
  width: 14px;
  height: 14px;
}
#contact-pick-btn::before {
  -webkit-mask-image: var(--icon-user);
  mask-image: var(--icon-user);
}
#modal-edit-btn::before,
#modal-close-btn::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
#modal-edit-btn::before {
  -webkit-mask-image: var(--icon-edit);
  mask-image: var(--icon-edit);
}
#modal-close-btn::before {
  -webkit-mask-image: var(--icon-x);
  mask-image: var(--icon-x);
}

/* ==========================================================================
   Data tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

/* Opt-in column-header icons - only used by the Заказы modal items table (see orders.php), other tables' <th> never contain a .th-icon span, so this doesn't affect them. */
.th-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  background-color: var(--muted);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: -1px;
}
.th-icon-hash {
  -webkit-mask-image: var(--icon-hash);
  mask-image: var(--icon-hash);
}
.th-icon-products {
  -webkit-mask-image: var(--icon-products);
  mask-image: var(--icon-products);
}
.th-icon-orders {
  -webkit-mask-image: var(--icon-orders);
  mask-image: var(--icon-orders);
}
.th-icon-dollar {
  -webkit-mask-image: var(--icon-dollar);
  mask-image: var(--icon-dollar);
}
.th-icon-wallet {
  -webkit-mask-image: var(--icon-wallet);
  mask-image: var(--icon-wallet);
}

.import-map-table tbody td {
  border-bottom: 1px solid var(--line) !important;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr.data-row {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.data-table tbody tr.data-row:hover,
.data-table tbody tr.data-row:focus-visible {
  background: var(--accent-soft);
  outline: none;
}
.data-table tbody tr.is-danger {
  background: var(--danger-soft);
}
.data-table tbody tr.row-unresolved {
  background: rgba(224, 35, 77, 0.09);
}

.cell-title {
  font-size: 12.5px;
  font-weight: 700;
}
.cell-sub {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.cell-strong {
  font-weight: 600;
}

.avatar-initials {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.employee-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Quantity controls
   ========================================================================== */

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  max-height: 26px;
  width: 78px;
}
.qty-btn {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
}
.qty-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-minus {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.qty-plus {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.qty-value {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #e3e3e3;
  border-left: 1px solid #e3e3e3;
}
/* The cart's quantity is typed as well as stepped: an input dressed as the
   number between − and +. */
input.qty-value {
  flex: 1 1 auto;
  padding: 0;
  border-top: none;
  border-bottom: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  outline: none;
}
input.qty-value:focus {
  background: #f1efff;
}
.qty-static {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   Row delete icon
   ========================================================================== */

.row-actions {
  width: 32px;
  padding-left: 0;
  padding-right: 12px;
}
.row-delete-btn {
  opacity: 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.15s var(--ease),
    background 0.15s var(--ease);
}
.data-table tbody tr:hover .row-delete-btn {
  opacity: 1;
}
.row-delete-btn:hover {
  background: var(--danger-soft);
}
.row-delete-btn:focus-visible {
  opacity: 1;
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

/* ==========================================================================
   Sidebar stats + pinned action
   ========================================================================== */

.secondary-menu-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.secondary-menu-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.secondary-menu-title-row .secondary-menu-title {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}
.secondary-menu-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.cart-count-badge strong {
  color: var(--text);
  font-weight: 600;
}
.cart-clear-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.cart-clear-btn::before {
  content: "";
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-trash);
  mask-image: var(--icon-trash);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.cart-clear-btn:hover {
  background: var(--danger-soft);
  color: var(--danger-2);
  border-color: rgba(224, 35, 77, 0.25);
}

/* Продажа "История"/"Отложить" - see api/held_baskets*.php,
   initHeldBaskets() in assets/js/app.js. */

.secondary-menu-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.held-baskets-toggle-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-history);
  mask-image: var(--icon-history);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.held-baskets-toggle-btn:hover,
.held-baskets-toggle-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent-line);
}

.held-basket-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    opacity 0.15s var(--ease);
}
.held-basket-save-btn::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-hold);
  mask-image: var(--icon-hold);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.held-basket-save-btn:hover {
  background: var(--accent-soft-strong);
}
.held-basket-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}

/* Anchored near .held-baskets-toggle-btn via positionDropdownMenu() (same
   fixed-position/flip/clamp logic the Склад/Статус dropdown filters
   already use) instead of a full page - see task spec 1: "панель не
   должна открываться как полноценная страница". */
.held-baskets-panel {
  position: fixed;
  width: min(340px, calc(100vw - 16px));
  max-height: min(480px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  /* Below .modal-overlay (z-index: 50) - the use/delete/edit modals this
     panel opens must always render above it, never behind it. */
  z-index: 45;
  overflow: hidden;
}
.held-baskets-panel.is-hidden {
  display: none;
}
.held-baskets-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}
.held-baskets-panel-header .icon-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 11px;
}
.held-baskets-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.held-baskets-empty {
  padding: 22px 4px;
  text-align: center;
}

.held-basket-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.held-basket-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.held-basket-item.is-insufficient {
  opacity: 0.85;
}
.held-basket-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.held-basket-item-name {
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.held-basket-item-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.held-basket-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.held-basket-item-actions .icon-button {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 11px;
}
.held-basket-edit-btn::before,
.held-basket-delete-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.held-basket-edit-btn::before {
  -webkit-mask-image: var(--icon-edit);
  mask-image: var(--icon-edit);
}
.held-basket-delete-btn::before {
  -webkit-mask-image: var(--icon-trash);
  mask-image: var(--icon-trash);
}
.held-basket-delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger-2);
  border-color: rgba(224, 35, 77, 0.22);
}

.sidebar-stats {
  display: grid;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
}
.stat-row span {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.stat-row strong {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.stat-row-discount strong.stat-negative {
  color: var(--danger-2);
}
.stat-row-total {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}
.stat-row-total span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.stat-row-total strong {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-pinned {
  flex-shrink: 0;
  padding-top: 6px;
  display: grid;
  gap: 10px;
}
.sidebar-pinned .primary-button {
  min-height: 50px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.32);
}
.sidebar-pinned .primary-button::before {
  content: "";
  width: 17px;
  height: 17px;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-sale);
  mask-image: var(--icon-sale);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Mini scanned items list: fills the space above the stats/button, which
   stay pinned together at the bottom of the sidebar. */
.sidebar-scanned-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.scanned-mini-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.scanned-mini-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  font-size: 12px;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.scanned-mini-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.scanned-mini-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.scanned-mini-thumb {
  width: 80px;
  height: 80px;
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.scanned-mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanned-mini-thumb.product-card-noimage::before {
  width: 55%;
  height: 55%;
}
.scanned-mini-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.scanned-mini-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.scanned-mini-code {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scanned-mini-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.scanned-mini-bottom {
  display: grid;
  align-items: center;
  justify-content: start;
  gap: 8px;
  grid-template-columns: repeat(3, 30% 30% 30%);
}
.scanned-mini-unit {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scanned-mini-qty {
  color: var(--muted);
  font-weight: 600;
}
.scanned-mini-price {
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.scanned-mini-price.has-discount {
  color: var(--success-2);
}
.scanned-mini-empty {
  padding: 18px 4px;
  text-align: center;
}
.scanned-mini-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* "Склад N" header grouping scanned-mini-items by warehouse - see
   renderCart() in assets/js/app.js. Same label styling as
   .secondary-menu-title (the "Чек" panel title above it), just without its
   own margin since .scanned-mini-items' flex gap already spaces it. */
.scanned-mini-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.scanned-mini-group-title:not(:first-child) {
  margin-top: 4px;
}
.row-edit-btn {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
  transform: rotate(90deg);
}
.row-edit-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.row-edit-btn.is-active {
  color: var(--accent);
  background: var(--accent-soft-strong);
}

.scanned-mini-item .row-delete-btn {
  opacity: 1;
  width: 24px;
  height: 24px;
  color: var(--muted);
  background: transparent;
}
.scanned-mini-item .row-delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger-2);
}
.scanned-mini-item .row-delete-btn:focus-visible {
  opacity: 1;
  outline: none;
  box-shadow: 0 0 0 2px var(--danger);
}

.scanned-mini-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 12px 12px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-muted);
}
.scanned-mini-editor label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}
.scanned-mini-editor input {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}
.scanned-mini-editor input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.scanned-mini-editor-comment {
  grid-column: 1 / -1;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-root {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 340px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateX(24px) scale(0.98);
  transition:
    opacity 0.25s var(--ease),
    transform 0.25s var(--ease-spring);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.toast-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.toast-close {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
}
.toast-close:hover {
  opacity: 1;
}
.toast-success {
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--success-2);
}
.toast-error {
  border-color: rgba(224, 35, 77, 0.3);
  color: var(--danger-2);
}
.toast-info {
  border-color: var(--accent-line);
  color: var(--accent-dark);
}

/* SPA navigation progress bar (top of viewport, shown while a sidebar
   page-to-page transition is fetching the next page's HTML) */

.spa-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition:
    width 0.25s var(--ease),
    opacity 0.2s var(--ease);
}
.spa-progress-bar.is-active {
  opacity: 1;
}

/* Skeleton / shimmer loaders - placeholders shown inside page-content
   while its data is being fetched (see renderSkeletonCards()/
   renderSkeletonRows() in app.js), shaped to match the real content so
   nothing jumps around once it arrives. */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 6px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
@keyframes skeletonShimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-line {
  height: 10px;
  border-radius: 5px;
}
.skeleton-card .product-card-image.skeleton {
  border-radius: 0;
}
.skeleton-card .product-card-stock.skeleton {
  width: 72px;
  height: 17px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.skeleton-card .product-card-title.skeleton {
  width: 90%;
  height: 12px;
  margin-bottom: 6px;
}
.skeleton-card .product-card-codes.skeleton {
  width: 55%;
  height: 9px;
}
.skeleton-card .product-card-price.skeleton {
  width: 60px;
  height: 13px;
  margin-top: 8px;
}
.skeleton-card .product-card-remaining.skeleton {
  width: 70px;
  height: 9px;
}
.skeleton-card .product-card-footer {
  margin-top: 10px;
}
.skeleton-card:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.skeleton-row td {
  padding: 10px;
}
.skeleton-row .skeleton-line {
  width: 70%;
}

/* Fade-in for freshly rendered rows/cards replacing a skeleton (or a
   previous page's content), kept subtle to avoid feeling like a jump. */
@keyframes fadeInRow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.fade-in-row {
  animation: fadeInRow 0.3s var(--ease) both;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: end;
  height: 100%;
  background: rgba(15, 17, 33, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  width: 30%;
  overflow-x: auto;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(300px);
  transition: transform 300ms;
}
.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.add-sale-modal {
  width: min(720px, 100%) !important;
}

.add-sale-modal .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.products-refresh-modal {
  width: min(720px, 100%) !important;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.modal-header h3 {
  margin: 3px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.modal-meta-grid-div {
  border-radius: 14px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.meta-text {
  min-width: 0;
  flex-direction: column;
  gap: 0;
  align-items: self-start;
}
.meta-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  flex: 0 0 auto;
  position: relative;
}
.meta-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  background-color: var(--accent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.meta-icon-status::before {
  -webkit-mask-image: var(--icon-check);
  mask-image: var(--icon-check);
}
.meta-icon-date::before {
  -webkit-mask-image: var(--icon-calendar);
  mask-image: var(--icon-calendar);
}
.meta-icon-company::before {
  -webkit-mask-image: var(--icon-building);
  mask-image: var(--icon-building);
}
.meta-icon-deal::before {
  -webkit-mask-image: var(--icon-tag);
  mask-image: var(--icon-tag);
}
.meta-icon-contact-id::before {
  -webkit-mask-image: var(--icon-hash);
  mask-image: var(--icon-hash);
}
.meta-icon-contact-name::before {
  -webkit-mask-image: var(--icon-user);
  mask-image: var(--icon-user);
}
.meta-icon-contact-phone::before {
  -webkit-mask-image: var(--icon-phone);
  mask-image: var(--icon-phone);
}
.modal-meta-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.modal-meta-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}
/* Single-column variant - Недельный график's add/edit modal stacks 8
   fields (Название + 7 day selects) vertically instead of the usual
   2-column layout, since pairing them up reads worse than one field per
   row for a form this long (see 2.4 of the task spec: "вертикальное
   модальное окно"). */
.form-grid.form-grid-1col {
  grid-template-columns: 1fr;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
}
.form-field input,
.form-field select,
.form-field textarea {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.form-field textarea {
  padding: 10px 12px;
  font-family: inherit;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: #fff;
}
.modal-total span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.modal-total strong {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-dark);
  letter-spacing: -0.01em;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.sale-success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 44px 16px;
  text-align: center;
}
.sale-success-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition:
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
/* Loading (right after "Продажа" is clicked, while the request is in
   flight) - no fill on the circle itself, just the animated dots (which
   carry their own accent color) on a plain transparent background; the
   colored circle only ever appears once the sale actually succeeds (see
   .is-success below), so the color swap reads as a real state change
   instead of the loading step already looking "done". */
.sale-success-icon.is-loading {
  background: none;
  box-shadow: none;
}
.sale-success-icon.is-success {
  background: linear-gradient(155deg, var(--success) 0%, var(--success-2) 100%);
  box-shadow: 0 12px 26px rgba(22, 163, 74, 0.32);
  animation: saleSuccessPulse 2.6s linear infinite;
}
.sale-success-check {
  display: none;
}
.sale-success-icon.is-success .sale-success-check {
  display: block;
  animation: saleSuccessCheck 2.6s ease-in-out infinite;
}
/* Hidden by default (and whenever .is-success is active, since the
   checkmark takes over then) - shown only while .is-loading, and as a real
   flex row so `gap` actually applies between the three dots. It used to
   default to display:flex (visible even outside the loading state) and
   then get overridden to display:block during loading, which broke both
   the dots' spacing and their disappearance once the sale succeeded. */
.sale-success-loading-dots {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
}
.sale-success-icon.is-loading .sale-success-loading-dots {
  display: flex;
}

.sale-success-loading-dots span {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  opacity: 0.28;
  transform: translate3d(0, 0, 0) scale(0.8);
  animation:
    saleSuccessDot 1.05s cubic-bezier(0.33, 1, 0.68, 1) infinite,
    saleSuccessBrightness 1.05s ease-in-out infinite;
  will-change: transform, opacity, filter;
}

.sale-success-loading-dots span:nth-child(1) {
  animation-delay: 0s, 0s;
}

.sale-success-loading-dots span:nth-child(2) {
  animation-delay: 0.12s, 0.12s;
}

.sale-success-loading-dots span:nth-child(3) {
  animation-delay: 0.24s, 0.24s;
}

/* Движение точки */
@keyframes saleSuccessDot {
  0%,
  58%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.8);
    opacity: 0.28;
  }

  18% {
    transform: translate3d(0, -2px, 0) scale(1.08);
    opacity: 0.72;
  }

  30% {
    transform: translate3d(0, -4px, 0) scale(1.5);
    opacity: 1;
  }

  42% {
    transform: translate3d(0, -2px, 0) scale(1.15);
    opacity: 0.82;
  }
}

/* Яркий пик */
@keyframes saleSuccessBrightness {
  0%,
  58%,
  100% {
    filter: brightness(0.7);
  }

  28% {
    filter: brightness(1.35);
  }

  38% {
    filter: brightness(1.15);
  }
}

.sale-success-text {
  color: var(--success-2);
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.18s var(--ease);
}
.sale-success-icon.is-loading ~ .sale-success-text {
  color: var(--accent-dark);
}
.sale-success-text.is-fading {
  opacity: 0;
}

@keyframes saleSuccessPulse {
  0% {
    filter: brightness(0.92);
    box-shadow:
      0 9px 22px rgba(22, 163, 74, 0.22),
      0 0 0 1px rgba(22, 163, 74, 0.02);
  }

  10% {
    filter: brightness(0.97);
    box-shadow:
      0 10px 24px rgba(22, 163, 74, 0.26),
      0 0 0 4px rgba(22, 163, 74, 0.04);
  }

  20% {
    filter: brightness(1.02);
    box-shadow:
      0 12px 28px rgba(22, 163, 74, 0.32),
      0 0 0 7px rgba(22, 163, 74, 0.07);
  }

  30% {
    filter: brightness(1.08);
    box-shadow:
      0 14px 31px rgba(22, 163, 74, 0.38),
      0 0 0 11px rgba(22, 163, 74, 0.1);
  }

  40% {
    filter: brightness(1.13);
    box-shadow:
      0 16px 35px rgba(22, 163, 74, 0.44),
      0 0 0 14px rgba(22, 163, 74, 0.08);
  }

  50% {
    filter: brightness(1.16);
    box-shadow:
      0 17px 38px rgba(22, 163, 74, 0.47),
      0 0 0 17px rgba(22, 163, 74, 0.06);
  }

  60% {
    filter: brightness(1.12);
    box-shadow:
      0 15px 34px rgba(22, 163, 74, 0.41),
      0 0 0 20px rgba(22, 163, 74, 0.04);
  }

  70% {
    filter: brightness(1.06);
    box-shadow:
      0 13px 30px rgba(22, 163, 74, 0.34),
      0 0 0 22px rgba(22, 163, 74, 0.025);
  }

  80% {
    filter: brightness(1.01);
    box-shadow:
      0 11px 26px rgba(22, 163, 74, 0.29),
      0 0 0 23px rgba(22, 163, 74, 0.015);
  }

  90% {
    filter: brightness(0.96);
    box-shadow:
      0 10px 24px rgba(22, 163, 74, 0.25),
      0 0 0 20px rgba(22, 163, 74, 0.008);
  }

  100% {
    filter: brightness(0.92);
    box-shadow:
      0 9px 22px rgba(22, 163, 74, 0.22),
      0 0 0 1px rgba(22, 163, 74, 0.02);
  }
}

@keyframes saleSuccessCheck {
  0%,
  100% {
    opacity: 0.88;
  }

  50% {
    opacity: 1;
  }
}

.import-field-settings-help {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.import-field-settings-list {
  display: grid;
  gap: 10px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.import-field-settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition:
    border-color 0.15s var(--ease),
    background 0.15s var(--ease);
}
.import-field-settings-item:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.import-field-settings-item input {
  margin: 0;
  accent-color: var(--accent);
}

.import-field-settings-footer {
  justify-content: flex-end;
}

.import-field-settings-head {
  width: 48px;
}

.import-field-settings-toggle {
  width: 0;
  height: 0;
  background: transparent;
  transform: scale(2);
  border-radius: 10px;
}

.payment-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

.payment-link-card,
.payment-qr-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.payment-link-card span,
.payment-qr-card span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}

.payment-link-card a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: var(--accent);
  word-break: break-all;
  font-size: 11.5px;
  font-weight: 600;
}

.payment-qr-frame {
  display: grid;
  place-items: center;
  min-height: 240px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

.payment-qr-frame img {
  width: 220px;
  height: 220px;
  object-fit: contain;
}

.payment-modal-error {
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 35, 77, 0.2);
  background: var(--danger-soft);
  color: var(--danger-2);
  font-weight: 700;
  line-height: 1.5;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .payment-modal-content {
    grid-template-columns: 1fr;
  }

  .payment-qr-frame {
    min-height: 200px;
  }

  .payment-qr-frame img {
    width: 200px;
    height: 200px;
  }
}

/* ==========================================================================
   Receipt
   ========================================================================== */

.receipt-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.receipt-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.receipt-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  box-shadow: var(--shadow-accent);
}
.receipt-company {
  font-size: 15px;
  font-weight: 600;
}
.receipt-subtitle {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.receipt-meta-grid {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.receipt-meta-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.receipt-meta-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}
.receipt-divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}
.receipt-items-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 10px;
}
.receipt-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.receipt-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.receipt-item-danger {
  background: var(--danger-soft);
  color: var(--danger-2);
}
.receipt-item-title {
  font-size: 12.5px;
  font-weight: 700;
}
.receipt-item-code {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}
.receipt-item-info {
  text-align: right;
}
.receipt-item-info span {
  display: block;
  font-size: 12px;
  font-weight: 700;
}
.receipt-item-info strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}
.receipt-total {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.receipt-total strong {
  font-size: 20px;
  color: var(--accent-dark);
}

.receipt-page {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.receipt-page-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Import page
   ========================================================================== */

.import-panel .panel-body {
  padding-top: 22px;
}

.import-panel-header {
  align-items: flex-start;
  gap: 18px;
}

.import-step-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: min(500px, 100%);
}

.import-step-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.import-step-button:hover:not(:disabled) {
}

.import-step-button.is-active {
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: var(--shadow-accent);
}

.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: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 60%;
}

.import-file-field {
  grid-column: 1 / -1;
}

.import-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.import-file-name {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.import-checks {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.import-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
}

.import-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.import-summary-card,
.import-result-card {
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.import-summary-card span,
.import-result-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.import-summary-card strong,
.import-result-card strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}

.import-result-card {
  margin-bottom: 14px;
  border-style: dashed;
}

.import-result-card.is-hidden {
  display: none;
}

.import-map-wrap,
.import-preview-wrap {
  max-height: 58vh;
}

.import-select {
  width: 60%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.import-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.import-map-table td .cell-sub {
  margin-top: 4px;
}

.import-preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.import-actions-fixed {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.import-actions-group {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
}

.import-actions-group.is-active {
  display: flex;
}

.import-actions-fixed .secondary-button,
.import-actions-fixed .primary-button {
  min-width: 156px;
}

.import-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.import-review-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.import-review-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#import-review-status,
#import-confirm-status {
  font-size: 16px;
}

.import-review-wrap {
  max-height: 56vh;
}

.import-review-table td:last-child,
.import-review-table th:last-child {
  width: 92px;
  text-align: center;
}

.import-review-check-cell {
  text-align: center;
}

.import-review-check-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  pointer-events: none;
}

.import-review-table tr.is-success {
  background: var(--success-soft);
}

.import-review-table tr.is-muted {
  opacity: 0.82;
}

.import-confirm-summary {
  margin-bottom: 14px;
  padding: 15px 18px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  white-space: pre-line;
  line-height: 1.55;
  font-weight: 600;
}

.import-confirm-loading,
.import-confirm-success {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.import-confirm-loading strong,
.import-confirm-success strong {
  display: block;
  margin-bottom: 4px;
}

.import-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--success);
  animation: importSuccessPulse 1.8s ease-in-out infinite;
}

.import-success-icon svg {
  animation: importSuccessCheck 1.1s ease both;
}

.import-confirm-success p,
.import-confirm-loading p {
  margin: 0;
  color: var(--muted);
}

@keyframes importSuccessPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes importSuccessCheck {
  0% {
    stroke-dasharray: 0 100;
    stroke-dashoffset: 0;
    opacity: 0;
  }
  100% {
    stroke-dasharray: 100 0;
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .import-step-switcher {
    min-width: 0;
  }

  .import-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .import-step-switcher {
    grid-template-columns: 1fr;
  }

  .import-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .import-actions-fixed {
    flex-wrap: wrap;
    justify-content: stretch;
    padding: 10px;
  }

  .import-actions-group {
    width: 100%;
    justify-content: stretch;
  }

  .import-actions-fixed .secondary-button,
  .import-actions-fixed .primary-button {
    min-width: 0;
  }
}

/* ==========================================================================
   Shared states
   ========================================================================== */

.empty-state {
  padding: 35px 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.is-hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .app-shell,
  .app-shell.no-right {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .app-shell .primary-sidebar {
    width: 84px;
    grid-row: 1 / span 2;
    padding: 14px 8px;
  }
  .app-shell .sidebar-topbar {
    padding: 6px 2px 16px;
  }
  .app-shell .sidebar-brand {
    justify-content: center;
  }
  .app-shell .sidebar-brand-text {
    font-size: 0;
  }
  .app-shell .sidebar-collapse-btn {
    display: none;
  }
  .app-shell .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 6px 2px;
    min-height: 54px;
    text-align: center;
    font-size: 10px;
  }
  .app-shell .nav-item .nav-icon {
    width: 19px;
    height: 19px;
  }
  .app-shell .sidebar-user {
    justify-content: center;
    padding: 8px 2px;
    background: transparent;
    border-color: transparent;
  }
  .app-shell .sidebar-user-info,
  .app-shell .sidebar-user-chevron {
    display: none;
  }
  .app-shell .sidebar-quick-action-label {
    font-size: 0;
  }
  .app-shell .secondary-sidebar {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-left: 0;
    box-shadow: none;
    border-top: 1px solid var(--line);
    padding: 14px 18px;
  }
  .secondary-sidebar .sidebar-stats,
  .secondary-sidebar .sidebar-scanned-list {
    display: none;
  }
  .secondary-sidebar .sidebar-pinned {
    margin-top: 0;
    border-top: 0;
  }
  .secondary-sidebar .primary-button {
    width: auto;
    padding: 0 22px;
  }
}

@media (max-width: 760px) {
  .page-header {
    padding: 0 16px;
  }
  .page-content {
    padding: 16px;
  }
  .receipt-page {
    padding: 14px;
  }
  .receipt-page-bar {
    flex-direction: column;
  }
  .modal-meta-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-actions {
    justify-content: stretch;
  }
  .modal-actions > * {
    flex: 1;
  }
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(
      900px 560px at 12% -10%,
      rgba(79, 70, 229, 0.14) 0%,
      rgba(79, 70, 229, 0) 60%
    ),
    radial-gradient(
      900px 560px at 100% 110%,
      rgba(109, 99, 242, 0.14) 0%,
      rgba(109, 99, 242, 0) 60%
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.login-shell {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}
.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-brand {
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.login-card h1 {
  margin: 4px 0 6px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.01em;
}
.login-error {
  background: var(--danger-soft);
  color: var(--danger-2);
  border: 1px solid rgba(224, 35, 77, 0.22);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.login-card .primary-button {
  min-height: 44px;
  font-size: 13.5px;
  margin-top: 6px;
}

/* ==========================================================================
   Sidebar bottom actions (language switch / logout)
   ========================================================================== */

.primary-sidebar-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-line);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sidebar-line);
  transition:
    padding var(--sidebar-anim),
    background 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.sidebar-user-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-left: auto;
  opacity: 1;
  background-color: var(--sidebar-text);
  -webkit-mask-image: var(--icon-chevron-down);
  mask-image: var(--icon-chevron-down);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition:
    opacity 0.16s var(--ease),
    width var(--sidebar-anim),
    margin-left var(--sidebar-anim);
}
.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-accent);
}
.sidebar-user-info {
  min-width: 0;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 1;
  overflow: hidden;
  transition:
    opacity 0.16s var(--ease),
    max-width var(--sidebar-anim);
}
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sidebar-text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.sidebar-quick-action {
  min-height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  padding: 8px 4px;
  border: none;
  text-align: center;
}
.sidebar-quick-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.sidebar-quick-action-icon.icon-globe {
  -webkit-mask-image: var(--icon-globe);
  mask-image: var(--icon-globe);
}
.sidebar-quick-action-icon.icon-logout {
  -webkit-mask-image: var(--icon-logout);
  mask-image: var(--icon-logout);
}
.sidebar-quick-action-label {
  max-height: 16px;
  opacity: 1;
  overflow: hidden;
  transition:
    opacity 0.16s var(--ease),
    max-height var(--sidebar-anim);
}
.sidebar-quick-action:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}

.exit-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* ==========================================================================
   Collapsed sidebar (manual toggle via .sidebar-collapse-btn) - icon-only,
   independent of viewport width. State lives on <body> (never touched by
   spaApplyDom's .app-shell swap, see app.js) and is persisted client-side,
   so it survives both SPA navigations and full page loads.

   The width itself animates through --sidebar-w (registered via @property
   above .app-shell so the browser can interpolate it as a real <length>
   instead of snapping - animating grid-template-columns directly doesn't
   reliably reverse, see git history). Every element that disappears in this
   state uses opacity/max-width/max-height transitions (declared on the base
   rules above) rather than `display: none`, so it fades/collapses in step
   with the sidebar shrinking instead of popping in and out.
   ========================================================================== */

body.sidebar-collapsed .primary-sidebar {
  width: 84px;
  padding: 18px 10px;
}
body.sidebar-collapsed .sidebar-topbar {
  justify-content: center;
  padding: 6px 0 16px;
}
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-brand-text {
  font-size: 0;
}
body.sidebar-collapsed .sidebar-brand-text::before {
  width: 30px;
  height: 30px;
}
body.sidebar-collapsed .sidebar-collapse-btn::before {
  transform: rotate(180deg);
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}
body.sidebar-collapsed .nav-label {
  opacity: 0;
  max-width: 0;
  margin-left: 0;
}
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 8px 0;
  background: transparent;
  border-color: transparent;
}
body.sidebar-collapsed .sidebar-user-info {
  display: none;
}
body.sidebar-collapsed .sidebar-user-chevron {
  display: none;
}
body.sidebar-collapsed .sidebar-quick-actions {
  grid-template-columns: 1fr;
}
body.sidebar-collapsed .sidebar-quick-action-label {
  opacity: 0;
  max-height: 0;
}
body.sidebar-collapsed .t24logo {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
}

/* ==========================================================================
   Pagination (unified across every list)
   ========================================================================== */

#sale-pagination {
  margin-top: 30px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.pagination-size {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination-size-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}
.pagination-size-btn:hover {
  border-color: var(--accent-line);
}
.pagination-size-caret {
  font-size: 9px;
  color: var(--muted);
}
.pagination-size-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 96px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 5;
}
.pagination-size-menu.is-hidden {
  display: none;
}
.pagination-size-option {
  border: 0;
  background: transparent;
  padding: 9px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.pagination-size-option:hover {
  background: var(--accent-soft);
}
.pagination-size-option.is-active {
  background: var(--accent-soft-strong);
  color: var(--accent-dark);
}
.pagination-size-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.pagination-total {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagination-page-btn,
.pagination-arrow {
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}
.pagination-page-btn:hover,
.pagination-arrow:hover:not(:disabled) {
  border-color: var(--accent-line);
  color: var(--accent-dark);
}
.pagination-page-btn.is-active {
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.pagination-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Panel search field (Продажа page header)
   ========================================================================== */

.panel-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-search {
  flex: 1;
  min-width: 0;
  max-width: 440px;
}
.panel-search-input {
  width: 300px;
  min-height: 40px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-muted) var(--icon-search-muted) no-repeat 13px
    center / 16px 16px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    background-color 0.15s var(--ease);
}
.panel-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.panel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Status filter dropdown (Все / В наличии / Нет в наличии), next to the
   product search box on Продажа + Товары. */
.status-filter {
  position: relative;
  flex: 0 0 auto;
}
.status-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s var(--ease);
}
.status-filter-btn:hover {
  border-color: var(--accent-line);
}
.status-filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 5;
}
.status-filter-menu.is-hidden {
  display: none;
}
.status-filter-option {
  border: 0;
  background: transparent;
  padding: 10px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.status-filter-option:hover {
  background: var(--accent-soft);
}
.status-filter-option.is-active {
  background: var(--accent-soft-strong);
  color: var(--accent-dark);
}

/* ==========================================================================
   Product grid (Продажа + Товары pages)
   ========================================================================== */

.product-grid {
  display: grid;
  /* Four to a row: at five the names were cut to one word and the stock
     lines to a guess. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.product-grid.is-hidden {
  display: none;
}
.product-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.15s var(--ease),
    opacity 0.2s var(--ease);
}
.product-card:not(.skeleton-card):hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.product-card:hover .product-card-image img {
  transform: scale(1.05);
}
.product-card.is-active {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent-soft-strong),
    var(--shadow);
}
.product-card:has(.product-card-stock.is-out) .product-card-image,
.product-card:has(.product-card-stock.is-out) .product-card-body {
  opacity: 0.55;
  transition: opacity 0.2s var(--ease);
}
.product-card:has(.product-card-stock.is-out):hover .product-card-image,
.product-card:has(.product-card-stock.is-out):hover .product-card-body {
  opacity: 0.78;
}
.product-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}
.product-card-noimage {
  position: relative;
}
.product-card-noimage::before {
  content: "";
  width: 40%;
  height: 40%;
  opacity: 0.28;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767c94' stroke-width='1.5'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='8.5' cy='8.5' r='1.5'/><path d='M21 15l-5-5L5 21'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.product-card-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}
.product-card-stock {
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}
.product-card-stock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.product-card-stock.is-out {
  color: var(--danger-2);
  background: var(--danger-soft);
}
.product-card-stock.is-available {
  color: var(--success-2);
  background: var(--success-soft);
}
.product-card-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-codes {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card-price {
  margin-top: 8px;
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.product-card-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.product-card-remaining {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card-footer::after {
  content: "";
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  background-image:
    var(--icon-plus-white),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size:
    12px 12px,
    cover;
  /* box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35); */
  pointer-events: none;
  /* transition: transform 0.15s var(--ease); */
}
.product-card:not(.skeleton-card):hover .product-card-footer::after {
  transform: scale(1.08) rotate(90deg);
}
.skeleton-card .product-card-footer::after {
  display: none;
}

@media (max-width: 1300px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Product detail page (Товары -> карточка товара)
   ========================================================================== */

.pd-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.pd-page-title {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.pd-title-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.pd-title-code {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.pd-gallery {
  height: 100%;
  width: 100%;
  padding: 60px;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  -webkit-user-select: none;
  user-select: none;
}
.pd-thumbs-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  /* Matches .pd-main-frame's height below - few thumbnails stay compact
     (natural height, no scroll), more than fit start scrolling instead of
     spilling out of the gallery block. */
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding-right: 2px;
}
.pd-main-col {
  flex: 1 1 auto;
  min-width: 0;
}
.pd-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.15s var(--ease);
}
.pd-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pd-thumb.is-active,
.pd-thumb:hover {
  border-color: var(--accent);
}

.pd-tabs-content {
  border-left: 1px solid var(--line);
}

.pd-main-frame {
  overflow: hidden;
  height: 400px;
  width: 100%;
}
.pd-main-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-sizing: border-box;
  padding: 10px;
}
.pd-main-frame .pd-noimage {
  width: 100%;
  height: 100%;
}
.pd-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}
.pd-nav-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-dark);
}
.pd-nav-prev {
  left: 14px;
}
.pd-nav-next {
  right: 14px;
}
.pd-dots {
  /* display: flex; */
  display: none;
  align-items: center;
  gap: 7px;
}
.pd-dot {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--line-strong);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  transition:
    background 0.15s var(--ease),
    transform 0.15s var(--ease);
}
.pd-dot.is-active {
  background: var(--accent);
  transform: scale(1.3);
  color: white;
}
.pd-dot-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

.pd-tabs-panel {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 40% 60%);
}
.pd-tabs-nav {
  display: flex;
  gap: 22px;
  padding: 6px 20px 0;
  border-bottom: 1px solid var(--line);
}
.pd-tab-btn {
  border: 0;
  background: transparent;
  padding: 13px 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.15s var(--ease);
}
.pd-tab-btn:hover {
  color: var(--text);
}
.pd-tab-btn.is-active {
  color: var(--accent-dark);
}
.pd-tab-btn.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}
.pd-tab-panel {
  display: none;
  padding: 20px;
}
.pd-tab-panel.is-active {
  display: block;
}

.pd-parent-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.pd-parent-link strong {
  font-size: 12.5px;
}
.pd-parent-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.pd-block-title {
  margin: 16px 0 7px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.product-detail-variations {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-detail-variation-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.product-detail-variation-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.pd-section-title {
  margin: 0 0 12px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.pd-mt {
  margin-top: 16px;
}
.pd-mb {
  margin-bottom: 18px;
}
.pd-text {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-line;
}
.pd-collapsible summary {
  cursor: pointer;
  list-style: none;
}
.pd-collapsible summary::-webkit-details-marker {
  display: none;
}
.pd-collapsible summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s var(--ease);
  color: var(--accent);
}
.pd-collapsible[open] summary::before {
}
.pd-collapsible[open] summary {
  margin-bottom: 0;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 20px;
}
.fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.fact-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fact-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

@media (max-width: 640px) {
  .pd-tabs-panel {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pd-gallery {
    flex-direction: column;
  }
  .pd-thumbs-col {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    order: 2;
  }
  .pd-main-col {
    order: 1;
  }
  .pd-page-title {
    font-size: 20px;
  }
}

/* ==========================================================================
   Progress bar (Товары page catalog refresh)
   ========================================================================== */

.progress-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  transition: width 0.25s var(--ease);
}

.progress-bar-fill.is-done {
  background: linear-gradient(90deg, var(--success) 0%, var(--success-2) 100%);
}

.progress-bar-track.is-active .progress-bar-fill {
  position: relative;
  overflow: hidden;

  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);

  animation: progress-pulse 1.8s ease-in-out infinite;
}

/* Бегущий свет слева направо */
.progress-bar-track.is-active .progress-bar-fill::after {
  content: "";
  position: absolute;

  top: 0;
  left: -55%;

  width: 55%;
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 15%,
    rgba(255, 255, 255, 0.18) 30%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0.18) 70%,
    rgba(255, 255, 255, 0.05) 85%,
    transparent 100%
  );

  filter: blur(1px);

  animation: progress-sweep 1.25s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Дополнительное мягкое свечение */
.progress-bar-fill::before {
  content: "";
  position: absolute;
  inset: 0;

  border-radius: inherit;

  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );

  opacity: 0;

  animation: progress-glow 1.6s ease-in-out infinite;
}

/* Плавное сильное пульсирование */
@keyframes progress-pulse {
  0%,
  100% {
    opacity: 0.72;
    filter: brightness(0.8);
    transform: scaleY(0.96);
  }

  35% {
    opacity: 0.88;
    filter: brightness(1);
    transform: scaleY(1);
  }

  50% {
    opacity: 1;
    filter: brightness(1.45);
    transform: scaleY(1.08);
  }

  65% {
    opacity: 0.88;
    filter: brightness(1);
    transform: scaleY(1);
  }
}

/* Плавный блик слева направо */
@keyframes progress-sweep {
  0% {
    left: -55%;
    opacity: 0;
  }

  12% {
    opacity: 0.2;
  }

  25% {
    opacity: 1;
  }

  55% {
    opacity: 1;
  }

  78% {
    opacity: 0.75;
  }

  100% {
    left: 110%;
    opacity: 0;
  }
}

/* Дополнительное мягкое дыхание */
@keyframes progress-glow {
  0%,
  100% {
    opacity: 0;
  }

  45% {
    opacity: 0.15;
  }

  55% {
    opacity: 0.35;
  }

  65% {
    opacity: 0;
  }
}
.progress-bar-label {
  margin-top: 10px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

/* ==========================================================================
   Contact picker (Продажа: sale confirmation modal)
   ========================================================================== */

.contact-picker-field {
  grid-column: span 1;
}
.contact-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.contact-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 700;
  max-width: 100%;
}
.contact-picker-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-picker-chip .icon-button {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ==========================================================================
   Contact search modal
   ========================================================================== */

.modal-contact-search {
  max-width: 460px;
  position: relative;
}
.contact-search-row {
  display: flex;
  gap: 8px;
}
.contact-search-row input {
  flex: 1;
  min-height: 40px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-muted) var(--icon-search-muted) no-repeat 13px
    center / 16px 16px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.contact-search-row input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.contact-search-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-bottom: 30px;
}
.contact-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  transition: border-color 0.15s var(--ease);
}
.contact-search-result:hover {
  border-color: var(--accent-line);
}
.contact-search-result-info {
  min-width: 0;
}
.contact-search-result-name {
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-search-result-phone {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.sale-totals-summary {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 22px;
}
.sale-totals-summary > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.sale-totals-summary span {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.sale-totals-summary strong {
  font-size: 13px;
  font-weight: 600;
}

.modal-comment-block {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}
.modal-comment-block span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.modal-comment-block p {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.contact-search-add-hint {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-align: center;
  position: absolute;
  bottom: 10px;
  background: #fff;
  right: 0;
  left: 0;
}
.contact-search-add-hint button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.contact-search-add-hint button:hover {
  text-decoration: underline;
}
.contact-search-empty {
  margin-top: 14px;
  text-align: center;
}
.contact-search-empty p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Searchable dropdown filter (Сотрудник on Аналитика) - extends
   .status-filter-menu with a pinned search box + scrollable option list.
   ========================================================================== */

.status-filter-menu-searchable {
  padding: 8px;
  min-width: 220px;
}
.status-filter-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  margin-bottom: 6px;
}
.status-filter-search:focus {
  outline: none;
  border-color: var(--accent-line);
}
.status-filter-options-scroll {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.status-filter-options-scroll .status-filter-option {
  border-radius: var(--radius-xs);
}
.status-filter-empty {
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Период filter picker modals (Месяц/Год/Выбрать дату/Выбрать период) -
   components/period_filter_modals.php, shared by Продажи + Аналитика.
   ========================================================================== */

.period-picker-modal {
  width: min(420px, 100%);
}
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.month-picker-btn {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.month-picker-btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.month-picker-btn.is-active {
  background: var(--accent-soft-strong);
  color: var(--accent-dark);
  border-color: var(--accent-line);
}

/* ==========================================================================
   Sale view modal (components/sale_view_modal.php) - shared by Продажи and
   Аналитика "Последние продажи".
   ========================================================================== */

.sale-modal {
  width: min(760px, 100%);
}
.sale-modal-header {
  align-items: center;
}
.sale-modal-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sale-modal-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  flex: 0 0 auto;
  position: relative;
}
.sale-modal-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  background-color: var(--accent);
  -webkit-mask-image: var(--icon-sale);
  mask-image: var(--icon-sale);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.sale-modal-header h3 {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
}
.sale-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sale-modal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sale-modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Аналитика page layout
   ========================================================================== */

.analytics-filters-panel .panel-body,
.analytics-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.analytics-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}
.analytics-page .panel + .panel {
  margin-top: 0;
}
.analytics-more-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.analytics-recent-wrap {
  overflow: hidden;
}

@media (max-width: 1180px) {
  .analytics-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* По статусам/По сотрудникам/По филиалам - 3 equal-width donut panels,
   same fade-loading behaviour as .analytics-grid-2 but its own even column
   split (that other grid's 1.15fr/0.85fr ratio is tuned for the uneven
   trend-chart+donut pairing, not this row of 3 identical panels). */
.analytics-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .analytics-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* These 3 panels are narrower than По складам's (.analytics-grid-2), so
   .donut-widget's visual+legend almost always wrap onto separate rows (see
   its flex-wrap in the shared rule above) - the ring then ends up alone on
   its own row and defaults to flex-start, reading as pinned to the left.
   Centering just this grid's widget fixes that without touching
   .donut-legend, which already fills its own row edge-to-edge either way. */
.analytics-grid-3 .donut-widget {
  justify-content: center;
}

/* Sixth row of the compact "Последние продажи" list - sliced in half to
   read as "there's more", see createSalesListController()'s compact mode. */
.sales-row-clipped {
  position: relative;
  height: 24px;
  overflow: hidden;
}
.sales-row-clipped::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    var(--surface) 92%
  );
  pointer-events: none;
}

.chart-empty {
  padding: 32px 0;
  text-align: center;
}

/* ==========================================================================
   Trend Indicator ("Динамика продаж") - premium/minimal dashboard style:
   thin smoothed line, soft gradient fill, unobtrusive Y-axis reference
   lines, compact evenly-spaced X-axis, a single highlighted peak point
   (no per-point clutter) and a richer hover tooltip.
   ========================================================================== */

.analytics-trend-panel .panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.trend-indicator-value-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.trend-indicator-value-row strong {
  font-size: 25px;
  font-weight: 00;
  letter-spacing: -0.025em;
  color: var(--text);
}
.trend-indicator-change {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.trend-indicator-change.trend-up {
  background: var(--success-soft);
  color: var(--success-2);
}
.trend-indicator-change.trend-down {
  background: var(--danger-soft);
  color: var(--danger-2);
}
.trend-chart {
  position: relative;
  margin-top: 22px;
  padding-left: 38px;
}
.trend-chart-svg {
  width: 100%;
  height: 190px;
  display: block;
  overflow: visible;
}
.trend-chart-gridline {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.trend-chart-baseline {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: none;
}
.trend-chart-area {
  opacity: 0.9;
  transition: opacity 0.3s var(--ease);
}
.trend-chart-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
  transition: stroke-dashoffset 0.7s var(--ease);
}
.trend-chart-peak-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2.5;
  display: none;
}
.trend-chart-yaxis {
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 190px;
  pointer-events: none;
}
.trend-chart-yaxis span {
  position: absolute;
  left: 0;
  right: 6px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-2);
  text-align: right;
  white-space: nowrap;
}
.trend-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Donut chart + legend (По складам / По статусам / По сотрудникам)
   ========================================================================== */

.metric-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.metric-switch-btn {
  min-height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.metric-switch-btn.is-active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: var(--shadow-xs);
}

.donut-widget {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}
.donut-visual {
  /* 1.5x the previous 188px - ring thickness (strokeWidth in
     renderDonut(), assets/js/app.js) is intentionally NOT scaled with it,
     so the ring reads thinner and the hole grows by more than 1.5x. */
  position: relative;
  width: 282px;
  height: 282px;
  flex: 0 0 auto;
}
.donut-svg {
  width: 100%;
  height: 100%;
}
.donut-track-empty {
  stroke: var(--surface-2);
}
.donut-segment {
  transition: opacity 0.15s var(--ease);
}
/* Centered on the donut's own midpoint (left/top 50% + transform), not on
   the wider .donut-widget row - and width-capped to the ring's hole so the
   value can never visually reach the ring or the legend. The exact largest
   font that fits a given value is computed in JS (fitDonutCenterValue());
   this max-width is what it measures against. */
.donut-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center strong {
  display: block;
  max-width: 100%;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Only this element (not the whole .donut-center) accepts pointer
     events - hovering it is how the full, untruncated value shows up as a
     native title tooltip when fitDonutCenterValue() had to ellipsis it. */
  pointer-events: auto;
  cursor: default;
}
.donut-center span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Donut legend, redrawn as a compact horizontal bar-chart: category name +
   value/percent on one line, a thin proportional bar (colored to match its
   donut segment) underneath - replaces the old dot+columns legend. */
.donut-legend {
  flex: 1 1 240px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.donut-legend-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.donut-legend-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.donut-legend-name {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.donut-legend-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
}
.donut-legend-value {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
}
.donut-legend-percent {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  min-width: 38px;
  text-align: right;
}
.donut-legend-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.donut-legend-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s var(--ease-spring);
}

/* ==========================================================================
   Аналитика - KPI summary cards
   ========================================================================== */

@keyframes analyticsCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.analytics-fade-block:last-child {
  margin-top: 18px;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: analyticsCardIn 0.32s var(--ease-spring) both;
  transition:
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.kpi-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.kpi-card:nth-child(1) {
  animation-delay: 0.02s;
}
.kpi-card:nth-child(2) {
  animation-delay: 0.08s;
}
.kpi-card:nth-child(3) {
  animation-delay: 0.14s;
}
.kpi-card:nth-child(4) {
  animation-delay: 0.2s;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex: 0 0 auto;
  position: relative;
  background: var(--accent-soft);
}
.kpi-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  background-color: var(--accent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: var(--icon-wallet);
  mask-image: var(--icon-wallet);
}
.kpi-icon.kpi-icon-count {
  background: var(--success-soft);
}
.kpi-icon.kpi-icon-count::before {
  background-color: var(--success-2);
  -webkit-mask-image: var(--icon-sale);
  mask-image: var(--icon-sale);
}
.kpi-icon.kpi-icon-avg {
  background: var(--info-soft);
}
.kpi-icon.kpi-icon-avg::before {
  background-color: var(--info);
  -webkit-mask-image: var(--icon-layers);
  mask-image: var(--icon-layers);
}
.kpi-icon.kpi-icon-returns {
  background: var(--warning-soft);
}
.kpi-icon.kpi-icon-returns::before {
  background-color: var(--warning);
  -webkit-mask-image: var(--icon-undo);
  mask-image: var(--icon-undo);
}
.kpi-icon.kpi-icon-clients {
  background: var(--info-soft);
}
.kpi-icon.kpi-icon-clients::before {
  background-color: var(--info);
  -webkit-mask-image: var(--icon-user);
  mask-image: var(--icon-user);
}

/* Кассовый отчет - same .kpi-card component as Аналитика's KPI row (see
   .analytics-kpi-grid above), just a 3-column grid instead of 4 since this
   page only has 3 KPIs. */
.cash-report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .cash-report-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .cash-report-kpi-grid {
    grid-template-columns: 1fr;
  }
}
.cash-report-date-input {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.cash-report-date-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.kpi-body {
  min-width: 0;
  flex: 1;
}
.kpi-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  margin-top: 4px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-change {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.kpi-change .kpi-change-arrow {
  font-size: 10px;
}
.kpi-change.trend-up {
  color: var(--success-2);
}
.kpi-change.trend-down {
  color: var(--danger-2);
}
.kpi-change-note {
  font-weight: 600;
  color: var(--muted-2);
}

@media (max-width: 1180px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Аналитика - filter row reset button, loading transition, chart tooltip,
   donut/legend hover sync
   ========================================================================== */

.analytics-reset-btn {
  margin-left: auto;
}

.analytics-fade-block {
  transition:
    opacity 0.18s var(--ease),
    filter 0.18s var(--ease);
}
.analytics-fade-block.is-loading {
  opacity: 0.45;
  filter: saturate(0.7);
  pointer-events: none;
}

.trend-chart {
  position: relative;
}
/* position:fixed with JS-computed, viewport-clamped left/top (see
   showTooltip() in app.js) - same escape-the-panel technique as
   positionDropdownMenu(). A plain position:absolute here would get clipped
   by .panel's own overflow:hidden (it exists to round that panel's
   corners, not to clip this tooltip) whenever a hovered point sits near
   the chart's edge, and could never render above a neighboring panel
   either. --tooltip-arrow-left keeps the little pointer aimed at the
   actual data point even after the tooltip box itself gets shifted to
   stay fully on-screen. */
.chart-tooltip {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  transform: scale(0.96);
  transform-origin: bottom center;
  background: var(--text);
  color: #fff;
  border-radius: 12px;
  padding: 9px 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition:
    opacity 0.12s var(--ease),
    transform 0.12s var(--ease);
  pointer-events: none;
}
.chart-tooltip.is-visible {
  opacity: 1;
  transform: scale(1);
}
.chart-tooltip.is-below {
  transform-origin: top center;
}
.chart-tooltip-label {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chart-tooltip-value {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.chart-tooltip::after {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 50%);
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.chart-tooltip.is-below::after {
  bottom: auto;
  top: -4px;
}
.trend-chart-hit-point {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.1s var(--ease);
}
.trend-chart-hit-point.is-active {
  opacity: 1;
}
.trend-chart-hover-line {
  stroke: var(--line-strong);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.1s var(--ease);
}
.trend-chart-hover-line.is-active {
  opacity: 1;
}

.donut-legend-row {
  cursor: default;
  border-radius: 10px;
  padding: 7px 8px;
  margin: 0 -8px;
  transition: background 0.14s var(--ease);
}
.donut-legend-row:hover,
.donut-legend-row.is-active {
  background: var(--surface-2);
}
.donut-segment {
  cursor: pointer;
}
.donut-widget.has-hover .donut-segment:not(.is-active) {
  opacity: 0.35;
}
.donut-widget.has-hover .donut-legend-row:not(.is-active) {
  opacity: 0.55;
}

/* Shown on a Продавец's product card when their own shop is out but another
   warehouse still has the item - the cue to raise a складга заявка.
   See renderProductCards() in assets/js/app.js. */
.product-card-elsewhere {
    font-size: 11px;
    color: #8e8594;
    margin-top: 2px;
}

/* Per-warehouse stock on a product card - the cashier needs to see WHERE the
   item is, not one lumped total. See renderProductCards() in assets/js/app.js. */
.product-card-stocks {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 6px;
}

.product-card-stock-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: #6b6475;
}

.product-card-stock-line .pcs-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card-stock-line .pcs-qty {
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}

/* The seller's own shop - the only warehouse they can actually sell from. */
.product-card-stock-line.is-own {
    color: #2f2a37;
    font-weight: 600;
}

/* "Заявка на склад" on a product card - shown only when the seller's own shop
   is out but another warehouse has the item. See renderProductCards(). */
.product-card-request {
    margin-top: 8px;
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #5b4ee0;
    background: #f0eefc;
    border: 1px solid #ddd8f7;
    border-radius: 6px;
    cursor: pointer;
}

.product-card-request:hover {
    background: #e6e2fa;
}

.product-card-request:focus-visible {
    outline: 2px solid #5b4ee0;
    outline-offset: 1px;
}

.stock-request-to {
    margin-top: 12px;
    font-size: 13px;
    color: #6b6475;
}

/* Заявки на склад list - see initStockRequestsPage() in assets/js/app.js. */
.status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.status-new       { background: #eef0fb; color: #4a4fd0; }
.status-badge.status-approved  { background: #e6f5ee; color: #1b7a55; }
.status-badge.status-rejected  { background: #fbeceb; color: #a63b32; }
.status-badge.status-done      { background: #eef1f4; color: #5f6c79; }

.small-button {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.row-actions .small-button + .small-button {
    margin-left: 6px;
}

/* Заявки: approving/finishing a request talks to Bitrix and takes a few
   seconds, so the whole row stays visibly busy until it answers. */
.secondary-button.is-loading {
    opacity: 0.75;
    cursor: progress;
}

.row-actions button:disabled {
    cursor: progress;
}

/* Заявка lines: requested / picked / received on one line each, with a
   shortage called out. See initStockRequestsPage() in assets/js/app.js. */
.stockreq-item {
    font-size: 12px;
    line-height: 1.6;
}

.stockreq-shortage {
    color: #a63b32;
    font-weight: 600;
}

.status-badge.status-picking   { background: #eef0fb; color: #4a4fd0; }
.status-badge.status-shipped   { background: #fdf3e3; color: #96690a; }
.status-badge.status-receiving { background: #fdf3e3; color: #96690a; }

#stockreq-qty-body input[type="number"] {
    width: 90px;
}

/* Оптовые заказы - see initWholesalePage() in assets/js/app.js. */
.status-badge.status-stage { background: #eef0fb; color: #4a4fd0; }

/* A line Bitrix is not holding: another seller can still take those goods. */
.wholesale-noreserve {
    color: #a63b32;
    font-weight: 600;
}

.modal.modal-wide {
    max-width: 860px;
    width: 100%;
}

/* Новый оптовый заказ: inline suggestion lists for customer and product
   search. See initWholesalePage() in assets/js/app.js. */
.ws-suggest {
    display: flex;
    flex-direction: column;
    border: 1px solid #e3e1ea;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
}

.ws-suggest-row {
    text-align: left;
    padding: 7px 10px;
    font-size: 13px;
    background: none;
    border: none;
    border-bottom: 1px solid #f0eff4;
    cursor: pointer;
}

.ws-suggest-row:last-child { border-bottom: none; }
.ws-suggest-row:hover { background: #f5f4f9; }

.ws-chosen {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2f2a37;
}

.ws-total {
    margin-top: 10px;
    text-align: right;
    font-size: 15px;
    font-weight: 600;
}

#wsn-lines input[type="number"] { width: 100px; }

/* Смена: the ТЗ 44 chain, line by line. See initShiftControls(). */
.shift-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shift-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    color: #5b5566;
    font-variant-numeric: tabular-nums;
}

.shift-row.is-total {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #e3e1ea;
    font-size: 15px;
    font-weight: 600;
    color: #2f2a37;
}

.shift-row.is-muted {
    margin-top: 6px;
    font-size: 12px;
    color: #8e8594;
}

.shift-diff {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.shift-diff.is-short { background: #fbeceb; color: #a63b32; }
.shift-diff.is-over  { background: #f3e8cd; color: #96690a; }

/* Долги - see initDebtsPage() in assets/js/app.js. */
.debts-total {
    font-size: 15px;
    font-weight: 600;
    color: #2f2a37;
    font-variant-numeric: tabular-nums;
}

.debts-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.debt-section {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #6b6475;
}

.debt-section:first-child { margin-top: 0; }

/* ТЗ 40: what will be left owing when a sale is only part-paid. */
.sale-debt-hint {
    margin-top: 6px;
    padding: 7px 10px;
    border-radius: 6px;
    background: #f3e8cd;
    color: #96690a;
    font-size: 13px;
    font-weight: 600;
}

/* Брак - see initDefectsPage() in assets/js/app.js. */
.defect-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 6px;
}

.defect-result {
    text-align: left;
    padding: 8px 10px;
    border: 1px solid #e6e2ec;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}

.defect-result:hover {
    background: #f6f4f9;
}

.defect-chosen {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f2eefb;
    font-size: 13px;
    font-weight: 600;
    color: #2f2a37;
}

.defect-store-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.defect-store-row select {
    min-width: 240px;
}

/* Тип продажи (ТЗ 11) - sits in the Продажа search row. */
.sale-type-select {
    height: 36px;
    border: 1px solid #e6e2ec;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    font-size: 13px;
}

/* Лимиты скидок (ТЗ 12) - see initDiscountLimits() in assets/js/app.js. */
.discount-limits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.discount-limit-field input {
    width: 100%;
}

.discount-limits-actions {
    margin-top: 12px;
}

/* Скидка на заказ (ТЗ 12) - sits with the sidebar totals. */
.stat-row-order-discount .order-discount-inputs {
    display: flex;
    gap: 6px;
}

.stat-row-order-discount input {
    width: 72px;
    height: 30px;
    border: 1px solid #e6e2ec;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 13px;
    text-align: right;
}

/* Смешанная оплата (ТЗ 13) - see mixedPayments() in assets/js/app.js. */
.mixed-payment-toggle {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.mixed-payment-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
    border-top: 1px solid #efecf4;
}

.mixed-payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.mixed-payment-row input {
    width: 120px;
    height: 30px;
    border: 1px solid #e6e2ec;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 13px;
    text-align: right;
}

.mixed-payment-summary {
    font-size: 12px;
    color: #6b6475;
    text-align: right;
}

.mixed-payment-summary.is-error {
    color: #c0392b;
    font-weight: 600;
}

/* Излишек при приемке (ТЗ 29). */
.stockreq-excess-waiting {
    font-size: 12px;
    color: #b9770e;
}

/* Оффлайн / очередь синхронизации - see initSyncStatus() in assets/js/app.js. */
.sync-status {
    margin: 10px 12px;
    padding: 10px;
    border-radius: 8px;
    background: #fdf3e3;
    border: 1px solid #f0dcb8;
    font-size: 12px;
    line-height: 1.4;
    color: #8a6116;
}

.sync-status.is-offline {
    background: #fdeaea;
    border-color: #f2c4c4;
    color: #a33a3a;
}

.sync-status-btn {
    margin-top: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
}

.sync-status-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Чек (ТЗ 16) - see render_sale_receipt() in components/receipt.php. */
.receipt-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    padding: 3px 0;
    color: #4a4453;
}

.receipt-payments {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e0dbe8;
}

.receipt-line-debt {
    color: #a33a3a;
    font-weight: 600;
}

.receipt-item-was {
    color: #9b93a6;
    margin-right: 6px;
}

/* Состояние товара при возврате (ТЗ 36) - see sale_view_modal.php. */
.return-condition {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.return-condition-title {
    font-size: 13px;
    font-weight: 600;
    color: #4a4453;
}

.return-condition-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e6e2ec;
    border-radius: 8px;
    cursor: pointer;
}

.return-condition-option:hover {
    background: #f8f6fb;
}

.return-condition-option strong {
    display: block;
    font-size: 13px;
}

.return-condition-option small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #6b6475;
}

/* Дневной отчёт (ТЗ 46) - see initDailyReport() in assets/js/app.js. */
.daily-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.daily-block {
    padding: 12px 14px;
    border: 1px solid #eceaf2;
    border-radius: 10px;
    background: #fbfafd;
}

.daily-block-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8b8398;
    margin-bottom: 8px;
}

.daily-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
    padding: 3px 0;
    color: #4a4453;
}

.daily-line.is-strong {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid #eceaf2;
    font-weight: 600;
    color: #2f2a37;
}

/* Логи синхронизации (ТЗ 52) - see initSyncLog() in assets/js/app.js. */
.sync-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.sync-badge.is-pending {
    background: #fdf3e3;
    color: #8a6116;
}

.sync-badge.is-done {
    background: #e8f6ed;
    color: #1e7a45;
}

.sync-badge.is-failed {
    background: #fdeaea;
    color: #a33a3a;
}

.sync-error-cell {
    color: #a33a3a;
    font-size: 12px;
    max-width: 320px;
}

/* Связанное перемещение оптового заказа (ТЗ 30). */
.ws-transfers {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #e6e2ec;
    border-radius: 8px;
    background: #fbfafd;
}

.ws-transfer-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    padding: 2px 0;
}

.ws-transfer-line .is-done {
    color: #1e7a45;
}

.ws-transfer-line .is-draft {
    color: #8a6116;
}

/* Каталог внутри формы оптового заказа - the Продажа grid, boxed so the
   form around it stays reachable. */
.ws-grid-wrap {
    margin-top: 8px;
    max-height: 340px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e6e2ec;
    border-radius: 10px;
    background: #fbfafd;
}

.ws-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

/* Насия (ТЗ 39) - the credit switch on the sale form. */
/* Оплачено + Вернуть до: revealed together by the Насия switch above them,
   inset so they read as belonging to it rather than as two more form rows. */
.sale-credit-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #e6e2ec;
    border-left: 3px solid #6a5cff;
    border-radius: 8px;
    background: #fbfafd;
}

.sale-credit-fields .form-field {
    margin: 0;
}

.sale-credit-toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e6e2ec;
    border-radius: 8px;
    background: #fbfafd;
    cursor: pointer;
}

.sale-credit-toggle span {
    font-size: 13px;
    font-weight: 600;
}

/* ==========================================================================
   Sale card: category, description, collapsible stock · payment pills ·
   held-basket print/Excel · Штрих-кодлар page (September 2026)
   ========================================================================== */

:root {
  --icon-nav-barcodes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-linecap='round'%3E%3Cpath d='M4 5v14' stroke-width='2'/%3E%3Cpath d='M7.5 5v14' stroke-width='1.2'/%3E%3Cpath d='M10.5 5v14' stroke-width='2.4'/%3E%3Cpath d='M14 5v14' stroke-width='1.2'/%3E%3Cpath d='M17 5v14' stroke-width='2'/%3E%3Cpath d='M20 5v14' stroke-width='1.2'/%3E%3C/svg%3E");
  --icon-print: 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='M6 9V3h12v6'/%3E%3Crect x='3' y='9' width='18' height='8' rx='2'/%3E%3Cpath d='M7 14h10v7H7z'/%3E%3C/svg%3E");
  --icon-excel: 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='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3Cpath d='M8.5 12.5l5 5M13.5 12.5l-5 5'/%3E%3C/svg%3E");
}

.nav-item[href="barcodes.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-barcodes);
  mask-image: var(--icon-nav-barcodes);
}

/* --- Product card: description in the image corner ------------------------ */
.product-card-image {
  position: relative;
}

.product-card-info {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 20, 40, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-dark);
  font: italic 700 14px/1 Georgia, "Times New Roman", serif;
  box-shadow: 0 2px 8px rgba(20, 20, 40, 0.14);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.product-card-info:hover {
  background: #fff;
  color: var(--accent);
}

.product-card.is-desc-open .product-card-info {
  background: var(--accent);
  color: #fff;
}

.product-card-desc {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 12px 38px 12px 12px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-y: auto;
  cursor: default;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s var(--ease), visibility 0.15s var(--ease);
}

.product-card.is-desc-open .product-card-desc {
  opacity: 1;
  visibility: visible;
}

.product-card-section {
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Product card: stock folded to one line ------------------------------- */
.product-card-stocks-wrap {
  margin-top: 8px;
}

.product-card-stocks-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.product-card-stocks-toggle:hover {
  border-color: var(--line-strong);
}

.pcs-toggle-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.pcs-toggle-count::after {
  content: "▾";
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.15s var(--ease);
}

.product-card-stocks-wrap.is-open .pcs-toggle-count::after {
  transform: rotate(180deg);
}

.product-card-stocks-wrap .product-card-stocks {
  display: none;
  margin-top: 4px;
  padding: 0 2px;
}

.product-card-stocks-wrap.is-open .product-card-stocks {
  display: flex;
}

/* --- Sale filters ---------------------------------------------------------- */
.is-empty-filter .status-filter-btn {
  opacity: 0.6;
}

/* --- Payment: one click per type ------------------------------------------ */
#sale-payment-type-field {
  grid-column: 1 / -1;
}

.payment-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
  pointer-events: none;
}

.payment-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.payment-pill {
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.payment-pill:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.payment-pill.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.sale-items-details {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.sale-items-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.sale-items-details > summary::-webkit-details-marker {
  display: none;
}

.sale-items-details > summary::after {
  content: "▾";
  color: var(--muted);
  transition: transform 0.15s var(--ease);
}

.sale-items-details[open] > summary::after {
  transform: rotate(180deg);
}

.sale-items-details .table-wrap {
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.sale-auto-receipt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}

/* --- Held baskets ---------------------------------------------------------- */
.held-basket-print-btn::before,
.held-basket-excel-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.held-basket-print-btn::before {
  -webkit-mask-image: var(--icon-print);
  mask-image: var(--icon-print);
}

.held-basket-excel-btn::before {
  -webkit-mask-image: var(--icon-excel);
  mask-image: var(--icon-excel);
}

.held-basket-item-by {
  font-size: 11px;
  color: var(--muted);
}

.badge.hb-partial {
  background: #fff3de;
  color: #a85a00;
}

.held-basket-edit-unavailable {
  color: var(--danger-2);
}

/* --- Excel buttons ---------------------------------------------------------- */
.export-excel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.export-excel-btn::before {
  content: "";
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask: var(--icon-excel) center / contain no-repeat;
  mask: var(--icon-excel) center / contain no-repeat;
}

/* --- Штрих-кодлар page ------------------------------------------------------ */
.barcodes-page {
  display: grid;
  gap: 18px;
  align-content: start;
}

.barcodes-steps {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.barcodes-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.barcodes-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 380px;
  height: 40px;
  padding: 0 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.barcodes-file:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.barcodes-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.barcodes-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
}

.barcodes-preview {
  margin-top: 16px;
}

.barcodes-summary {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.barcodes-preview .table-wrap {
  max-height: 420px;
  overflow: auto;
}

.barcodes-apply-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.badge.bc-ok {
  background: var(--success-soft);
  color: var(--success-2);
}

.badge.bc-same {
  background: var(--surface-2);
  color: var(--muted);
}

.badge.bc-bad {
  background: var(--danger-soft);
  color: var(--danger-2);
}

.barcodes-labels {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.6fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 1000px) {
  .barcodes-labels {
    grid-template-columns: 1fr;
  }
}

.barcodes-labels-search .panel-search-input {
  width: 100%;
}

.barcodes-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 440px;
  margin-top: 8px;
  overflow: auto;
}

.barcodes-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.barcodes-result:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.barcodes-result-title {
  font-weight: 700;
}

.barcodes-result-code {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.barcodes-result-empty {
  padding: 10px 4px;
  font-size: 13px;
}

.barcodes-copies {
  width: 76px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.barcodes-print-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.barcodes-size select {
  height: 38px;
}

.barcodes-check {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  font-size: 13px;
}

.barcodes-nocode {
  color: var(--danger-2);
  font-size: 12px;
}

/* --- Amount fields: grouped digits + currency (enhanceMoneyInput()) ------- */
.money-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.form-field .money-field,
.scanned-mini-editor .money-field {
  display: flex;
  width: 100%;
}

.money-field > input {
  width: 100%;
  min-width: 0;
  padding-right: 48px !important;
  font-variant-numeric: tabular-nums;
}

.money-field-currency {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.mixed-payment-row .money-field {
  width: 160px;
}

.scanned-mini-editor .money-field > input {
  padding-right: 36px !important;
}

.scanned-mini-editor .money-field-currency {
  right: 8px;
  font-size: 10.5px;
}

#wsn-lines .money-field {
  width: 140px;
}

.money-input {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   POS sale screen (neworder.php): search first, the cart in the middle,
   customer / discount / pay on the right, payment on a screen of its own.
   ========================================================================== */

:root {
  --icon-pos-catalog: 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.9' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='7' height='7' rx='1.6'/%3E%3Crect x='13.5' y='3.5' width='7' height='7' rx='1.6'/%3E%3Crect x='3.5' y='13.5' width='7' height='7' rx='1.6'/%3E%3Crect x='13.5' y='13.5' width='7' height='7' rx='1.6'/%3E%3C/svg%3E");
  --icon-pos-swap: 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.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h14l-3.5-3.5'/%3E%3Cpath d='M20 16H6l3.5 3.5'/%3E%3C/svg%3E");
  --icon-pos-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-6 8-6s8 2 8 6z'/%3E%3C/svg%3E");
  --icon-pos-card: 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.9' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='19' height='14' rx='2.5'/%3E%3Cpath d='M2.5 10h19' /%3E%3Cpath d='M6 15h4' stroke-linecap='round'/%3E%3C/svg%3E");
  --icon-pos-cash: 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.9' stroke-linejoin='round'%3E%3Crect x='2.5' y='6' width='19' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.6'/%3E%3Cpath d='M6 9.5v5M18 9.5v5' stroke-linecap='round'/%3E%3C/svg%3E");
  --icon-pos-bank: 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.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='2.5' width='12' height='19' rx='2.5'/%3E%3Cpath d='M10.5 18h3'/%3E%3C/svg%3E");
  --icon-pos-credit: 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.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.pos-page kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font: 700 10.5px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  vertical-align: middle;
}

/* --- Layout ----------------------------------------------------------------- */
.app-shell.pos-shell {
  grid-template-columns: auto minmax(0, 1fr) 370px;
}

.pos-main {
  gap: 14px;
  padding: 18px 22px 0;
  background: var(--surface-2);
}

/* --- Top bar: search + icon buttons ------------------------------------------ */
.pos-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 14px 0 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.pos-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pos-search-icon {
  position: absolute;
  left: 17px;
  width: 18px;
  height: 18px;
  background: var(--icon-search-muted) no-repeat center / contain;
}

.pos-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.pos-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.pos-search-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.pos-search-item:hover,
.pos-search-item.is-active {
  background: var(--accent-soft);
}

/* Out of stock here: the product fades, the "Заявка" button beside it does not. */
.pos-search-item.is-out > :not(.pos-search-request) {
  opacity: 0.55;
}

.pos-search-item {
  grid-template-columns: 42px minmax(0, 1fr) auto auto auto;
}

.pos-search-request {
  padding: 6px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.pos-search-request:hover {
  background: var(--accent-soft-strong);
}

.pos-search-thumb {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-2);
}

.pos-search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pos-search-main {
  min-width: 0;
}

.pos-search-title {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-search-meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-search-stock {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pos-search-price {
  min-width: 90px;
  font-size: 14px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.pos-search-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pos-icon-btn,
.pos-icon-btn.held-baskets-toggle-btn {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  color: var(--accent-dark);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.pos-icon-btn:hover,
.pos-icon-btn.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.pos-icon-btn::before {
  content: "";
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--icon-pos-catalog) center / contain no-repeat;
  mask: var(--icon-pos-catalog) center / contain no-repeat;
}

.pos-icon-btn.held-baskets-toggle-btn::before {
  -webkit-mask-image: var(--icon-history);
  mask-image: var(--icon-history);
}

.pos-icon-btn.pos-icon-return::before {
  -webkit-mask-image: var(--icon-pos-swap);
  mask-image: var(--icon-pos-swap);
}

.pos-topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-topbar-end:empty {
  display: none;
}

/* --- Cart header ----------------------------------------------------------------- */
.pos-cart-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pos-cart-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.pos-count {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.pos-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pos-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pos-switch-track {
  position: relative;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s var(--ease);
}

.pos-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s var(--ease);
}

.pos-switch input:checked + .pos-switch-track {
  background: var(--accent);
}

.pos-switch input:checked + .pos-switch-track::after {
  transform: translateX(17px);
}

.pos-switch input:focus-visible + .pos-switch-track {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pos-cart-head-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.pos-sale-number {
  color: #c5c6d3;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* --- Cart ------------------------------------------------------------------------- */
.pos-cart.scanned-mini-items {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.pos-cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.pos-cart-empty strong {
  color: var(--text-soft);
  font-size: 21px;
  font-weight: 700;
}

.pos-cart-empty span {
  font-size: 13.5px;
  font-weight: 600;
}

.pos-cart .scanned-mini-group-title {
  padding: 6px 10px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pos-cart.scanned-mini-items {
  container-type: inline-size;
}

/* A narrow cart (big left menu, small screen) gives the name the room and
   drops the unit price - the line total beside it says the same thing. */
@container (max-width: 640px) {
  .pos-cart .scanned-mini-item .scanned-mini-unit {
    display: none;
  }
}

/* Below 1100 px the shared layout moves the right column under the page;
   the sale screen keeps its three columns, just narrower. */
@media (max-width: 1100px) {
  .app-shell.pos-shell {
    grid-template-columns: auto minmax(0, 1fr) 300px;
    grid-template-rows: 100vh;
  }

  .app-shell.pos-shell .primary-sidebar {
    grid-row: 1;
  }

  .app-shell.pos-shell .secondary-sidebar.pos-side {
    grid-column: 3;
    grid-row: 1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 16px 14px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .pos-hints {
    display: none;
  }
}

.pos-cart .scanned-mini-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 112px minmax(96px, auto) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: none;
  font-size: 13px;
}

.pos-cart .scanned-mini-top,
.pos-cart .scanned-mini-bottom {
  display: contents;
}

.pos-cart .scanned-mini-thumb {
  order: 1;
  width: 52px;
  height: 52px;
  border-radius: 11px;
}

.pos-cart .scanned-mini-info {
  order: 2;
}

.pos-cart .scanned-mini-title {
  display: -webkit-box;
  font-size: 14px;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pos-cart .scanned-mini-unit {
  order: 3;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.pos-cart .qty-stepper {
  order: 4;
  justify-self: center;
  width: 110px;
  max-height: 36px;
  border-radius: 11px;
}

.pos-cart .qty-stepper .qty-btn {
  width: 34px;
  height: 34px;
  font-size: 16px;
}

.pos-cart .scanned-mini-price {
  order: 5;
  font-size: 15px;
  font-weight: 800;
  text-align: right;
}

.pos-cart .scanned-mini-actions {
  order: 6;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.pos-cart .scanned-mini-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pos-cart .scanned-mini-editor {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 12px 6px 78px;
}

.pos-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 4px 4px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pos-hints kbd + kbd {
  margin-left: 3px;
}

/* --- Right side: customer, discount, note, totals ----------------------------------- */
.pos-side.secondary-sidebar {
  gap: 20px;
  padding: 20px 18px;
}

.pos-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
}

.pos-block-head > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pos-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pos-link:hover {
  text-decoration: underline;
}

.pos-link-danger {
  color: var(--danger-2);
}

.pos-client-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.pos-client-input:hover {
  border-color: var(--accent-line);
}

.pos-client-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background-color: var(--accent);
  -webkit-mask: var(--icon-pos-user) center / contain no-repeat;
  mask: var(--icon-pos-user) center / contain no-repeat;
}

.pos-client:has(.pos-client-chip:not(.is-hidden)) .pos-client-input {
  display: none;
}

.pos-client-chip.contact-picker-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.pos-discount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.pos-discount-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.pos-discount-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pos-segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.pos-segmented button {
  min-width: 52px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.pos-segmented button.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.pos-discount-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.pos-discount-chips:empty {
  display: none;
}

.pos-chip {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.pos-chip:hover {
  border-color: var(--accent-line);
  color: var(--accent-dark);
}

.pos-note textarea {
  min-height: 84px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.pos-note textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pos-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.pos-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.pos-total-row span {
  color: var(--muted);
}

.pos-total-row .stat-negative {
  color: var(--danger-2);
}

.pos-pay-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease);
}

.pos-pay-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.pos-pay-btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pos-pay-btn strong {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pos-pay-btn kbd,
.pos-pay-submit kbd {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.pos-pay-btn:disabled {
  background: #c9cad6;
  box-shadow: none;
  cursor: not-allowed;
}

.pos-hold-btn.held-basket-save-btn {
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

.pos-hold-btn.held-basket-save-btn:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* --- Held baskets: a centred window with search ----------------------------------------- */
.pos-page .held-baskets-panel {
  top: 50% !important;
  left: 50% !important;
  width: min(560px, calc(100vw - 32px));
  max-height: min(660px, calc(100vh - 48px));
  border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(15, 17, 33, 0.45), var(--shadow-lg);
  transform: translate(-50%, -50%);
  z-index: 48;
}

.pos-page .held-baskets-panel-header {
  padding: 20px 22px 8px;
  border-bottom: 0;
  font-size: 22px;
  font-weight: 800;
}

.held-baskets-search {
  padding: 8px 18px 6px;
}

.held-baskets-search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2) var(--icon-search-muted) no-repeat 14px center / 16px 16px;
  font-size: 13.5px;
  font-weight: 600;
}

.held-baskets-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.pos-page .held-baskets-panel-body {
  padding: 10px 18px 18px;
}

.pos-page .held-basket-item {
  padding: 14px 16px;
  border-color: transparent;
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: none;
}

.pos-page .held-basket-item:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* --- Catalog window ---------------------------------------------------------------------- */
.pos-catalog-overlay,
.pos-pay-overlay {
  align-items: center;
  justify-content: center;
}

.pos-catalog-modal.modal {
  display: flex;
  flex-direction: column;
  width: min(1200px, calc(100vw - 40px));
  height: calc(100vh - 40px);
  overflow: hidden;
  border-radius: 22px;
  transform: scale(0.98);
}

.pos-catalog-header {
  align-items: center;
  flex-wrap: wrap;
}

.pos-catalog-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.pos-catalog-header .panel-search-row {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pos-catalog-body.modal-body {
  flex: 1;
  display: block;
  overflow: auto;
}

/* --- Payment screen ----------------------------------------------------------------------- */
.pos-pay {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  width: calc(100vw - 40px);
  height: calc(100vh - 40px);
  overflow: hidden;
  border-radius: 26px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: scale(0.98);
  transition: transform 0.2s var(--ease);
}

.pos-pay-overlay.is-open .pos-pay {
  transform: scale(1);
}

.pos-pay-receipt {
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 34px 26px;
  background: var(--surface-2);
}

.pos-receipt-paper {
  position: relative;
  align-self: flex-start;
  width: 300px;
  padding: 22px 18px 26px;
  background: #fff;
  color: #1c1c24;
  box-shadow: 0 10px 28px rgba(20, 22, 40, 0.12);
  font-family: "Courier New", Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.pos-receipt-paper::before,
.pos-receipt-paper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: radial-gradient(circle at 5px 8px, transparent 5px, #fff 5.5px) repeat-x;
  background-size: 10px 8px;
}

.pos-receipt-paper::before {
  top: -8px;
}

.pos-receipt-paper::after {
  bottom: -8px;
  transform: rotate(180deg);
}

.prc-center {
  text-align: center;
}

.prc-company {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prc-sep {
  margin: 8px 0;
  border-top: 1px dashed #9a9aa6;
}

.prc-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.prc-row > :last-child {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.prc-item + .prc-item {
  margin-top: 5px;
}

.prc-item-title {
  font-weight: 700;
  word-break: break-word;
}

.prc-total,
.prc-strong {
  font-size: 15px;
  font-weight: 700;
}

.prc-thanks {
  margin-top: 10px;
  font-weight: 700;
}

.pos-pay-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: auto;
  padding: 30px 34px;
}

.pos-pay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pos-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.pos-back-btn:hover {
  background: var(--accent-soft);
}

.pos-pay-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 15px;
  background: #c9cad6;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.pos-pay-submit.is-ready {
  background: linear-gradient(135deg, #16b86f 0%, #0c9a5a 100%);
  box-shadow: 0 12px 26px rgba(18, 183, 106, 0.32);
}

.pos-pay-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

#sale-confirm-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pos-pay-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.pos-pay-totals span {
  display: block;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.pos-pay-totals strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pos-pay-due.is-due span,
.pos-pay-due.is-due strong {
  color: var(--accent-dark);
}

.pos-pay-due.is-done span,
.pos-pay-due.is-done strong,
.pos-pay-due.is-change span,
.pos-pay-due.is-change strong {
  color: #12a764;
}

.pos-pay-due.is-over span,
.pos-pay-due.is-over strong {
  color: var(--danger-2);
}

.pos-pay-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pos-pay-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.pos-pay-tile:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.pos-pay-tile.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pos-pay-tile-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  background-color: var(--accent);
  -webkit-mask: var(--icon-pos-bank) center / contain no-repeat;
  mask: var(--icon-pos-bank) center / contain no-repeat;
}

.pos-pay-tile.kind-cash .pos-pay-tile-icon {
  -webkit-mask-image: var(--icon-pos-cash);
  mask-image: var(--icon-pos-cash);
}

.pos-pay-tile.kind-card .pos-pay-tile-icon {
  -webkit-mask-image: var(--icon-pos-card);
  mask-image: var(--icon-pos-card);
}

.pos-pay-tile.kind-credit .pos-pay-tile-icon {
  background-color: var(--danger-2);
  -webkit-mask-image: var(--icon-pos-credit);
  mask-image: var(--icon-pos-credit);
}

.pos-pay-tile-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-pay-tile-plus {
  color: var(--accent);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.pos-pay-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-pay-rows:empty {
  display: none;
}

.pos-pay-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.pos-pay-row.kind-credit {
  border-color: rgba(217, 45, 32, 0.28);
  background: #fff8f7;
}

.pos-pay-row-label {
  font-size: 15px;
  font-weight: 700;
}

.pos-pay-row .money-field {
  width: 100%;
}

.pos-pay-row input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 800;
}

.pos-pay-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pos-pay-row .money-field-currency {
  font-size: 14px;
}

.pos-pay-row-remove {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.pos-pay-row-remove:hover {
  background: var(--danger-soft);
  color: var(--danger-2);
}

.pos-pay .sale-credit-fields {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: end;
  gap: 16px;
}

.pos-pay .sale-debt-hint {
  padding-bottom: 10px;
  color: var(--danger-2);
  font-weight: 700;
}

.pos-pay-warning {
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--danger-soft);
  color: var(--danger-2);
  font-weight: 600;
}

.pos-pay-main .sale-success-view {
  flex: 1;
}

.pos-success-actions {
  margin-left: 0;
}

@media (max-width: 1280px) {
  .app-shell.pos-shell {
    grid-template-columns: auto minmax(0, 1fr) 330px;
  }

  .pos-cart .scanned-mini-item {
    grid-template-columns: 44px minmax(0, 1fr) 100px 110px 120px 64px;
    gap: 10px;
  }

  .pos-pay {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .pos-pay-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Клиенты page · Обмен on the sale screen
   ========================================================================== */

:root {
  --icon-nav-clients: 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='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 2.9-6 6.5-6s6.5 2.4 6.5 6'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8'/%3E%3Cpath d='M18 14.3c2.1.7 3.5 2.7 3.5 5.7'/%3E%3C/svg%3E");
  --icon-clients-cake: 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 21h16v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2z'/%3E%3Cpath d='M4 16c2 0 2-1.5 4-1.5s2 1.5 4 1.5 2-1.5 4-1.5 2 1.5 4 1.5'/%3E%3Cpath d='M12 11V7'/%3E%3Cpath d='M12 4.5c.8-.8.8-1.7 0-2.5-.8.8-.8 1.7 0 2.5z'/%3E%3C/svg%3E");
  --icon-clients-new: 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='10' cy='8' r='4'/%3E%3Cpath d='M3 21c0-3.9 3.1-6.5 7-6.5 1.5 0 2.9.4 4 1.1'/%3E%3Cpath d='M19 15v6M16 18h6'/%3E%3C/svg%3E");
  --icon-clients-debt: 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-linejoin='round'%3E%3Crect x='2.5' y='6' width='19' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.6'/%3E%3C/svg%3E");
  --icon-exchange: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h14l-3.5-3.5'/%3E%3Cpath d='M20 16H6l3.5 3.5'/%3E%3C/svg%3E");
}

.nav-item[href="clients.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-clients);
  mask-image: var(--icon-nav-clients);
}

.clients-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.clients-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.clients-stat > span:not(.clients-stat-icon) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.clients-stat strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.clients-stat small {
  min-height: 1em;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clients-stat-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
  position: relative;
}

.clients-stat-icon::before {
  content: "";
  position: absolute;
  inset: 11px;
  background-color: var(--accent);
  -webkit-mask: var(--icon-nav-clients) center / contain no-repeat;
  mask: var(--icon-nav-clients) center / contain no-repeat;
}

.clients-stat-icon.is-new::before {
  -webkit-mask-image: var(--icon-clients-new);
  mask-image: var(--icon-clients-new);
}

.clients-stat-icon.is-birthday {
  background: #fff0f6;
}

.clients-stat-icon.is-birthday::before {
  background-color: #d6336c;
  -webkit-mask-image: var(--icon-clients-cake);
  mask-image: var(--icon-clients-cake);
}

.clients-stat-icon.is-debt {
  background: var(--danger-soft);
}

.clients-stat-icon.is-debt::before {
  background-color: var(--danger-2);
  -webkit-mask-image: var(--icon-clients-debt);
  mask-image: var(--icon-clients-debt);
}

.clients-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.clients-toolbar input {
  flex: 1;
  height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2) var(--icon-search-muted) no-repeat 14px center / 16px 16px;
  font-size: 14px;
  font-weight: 600;
}

.clients-toolbar input:focus {
  outline: none;
  border-color: var(--accent);
}

.clients-table .clients-row {
  cursor: pointer;
}

.clients-table .clients-row:hover td {
  background: var(--accent-soft);
}

.clients-table td.is-debt {
  color: var(--danger-2);
  font-weight: 700;
}

.clients-birthday-soon {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff0f6;
  color: #c2185b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.client-card-modal.modal {
  width: min(680px, 100%);
}

.client-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.client-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}

.client-card-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.client-tile,
.client-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.client-tile span,
.client-info span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.client-tile strong {
  font-size: 16px;
  font-weight: 800;
}

.client-tile.is-debt strong {
  color: var(--danger-2);
}

.client-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-info strong {
  font-size: 14px;
}

/* --- Обмен ------------------------------------------------------------------------ */
.pos-exchange-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #f3c98b;
  border-radius: 15px;
  background: #fff5e6;
  color: #8a4b00;
  font-size: 13.5px;
  font-weight: 700;
}

.pos-exchange-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background-color: #c26a00;
  -webkit-mask: var(--icon-exchange) center / contain no-repeat;
  mask: var(--icon-exchange) center / contain no-repeat;
}

#pos-exchange-text {
  flex: 1;
}

.pos-exchange-banner button {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #8a4b00;
  font-weight: 700;
  cursor: pointer;
}

.pos-pay-row.is-locked {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: #f3c98b;
  background: #fff8ee;
}

.pos-pay-row-amount {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .clients-stats,
  .client-card-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.clients-stat-icon.is-lost {
  background: #fff5e6;
}

.clients-stat-icon.is-lost::before {
  background-color: #c26a00;
  -webkit-mask-image: var(--icon-pos-credit);
  mask-image: var(--icon-pos-credit);
}

/* ==========================================================================
   Мало на складе · Ревизия · Отчёты
   ========================================================================== */

:root {
  --icon-nav-low-stock: 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='M12 4 3 20h18L12 4Z'/%3E%3Cpath d='M12 10v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --icon-nav-revision: 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%3Crect x='5' y='4' width='14' height='17' rx='2'/%3E%3Cpath d='M9 3h6v3H9z'/%3E%3Cpath d='M9 13l2 2 4-4'/%3E%3C/svg%3E");
  --icon-nav-reports: 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 20h16'/%3E%3Cpath d='M7 16v-5'/%3E%3Cpath d='M12 16V6'/%3E%3Cpath d='M17 16v-8'/%3E%3C/svg%3E");
}

.nav-item[href="low_stock.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-low-stock);
  mask-image: var(--icon-nav-low-stock);
}
.nav-item[href="revision.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-revision);
  mask-image: var(--icon-nav-revision);
}
.nav-item[href="reports.php"] .nav-icon {
  -webkit-mask-image: var(--icon-nav-reports);
  mask-image: var(--icon-nav-reports);
}

.nav-item {
  position: relative;
}
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  flex: 0 0 auto;
}
body.sidebar-collapsed .nav-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-table tr.is-clickable {
  cursor: pointer;
}
.data-table tr.is-clickable:hover td {
  background: var(--surface-muted);
}

/* --- Мало на складе -------------------------------------------------------- */

.low-stock-toolbar,
.reports-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.low-stock-toolbar input[type="search"],
#reports-search {
  flex: 1 1 220px;
  min-width: 180px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
}
#reports-search {
  flex: 0 1 260px;
}
.low-stock-threshold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 600;
}
.low-stock-threshold input {
  width: 72px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  text-align: right;
  font: inherit;
}
.metric-switch-btn [data-lcount] {
  opacity: 0.7;
  font-weight: 600;
}
.ls-min-input {
  width: 110px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  text-align: right;
  font: inherit;
  font-size: 12.5px;
  background: var(--surface);
}
.ls-min-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ls-zero {
  color: var(--danger-2);
  font-weight: 700;
}
.badge.ls-low,
.badge.rev-open {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.25);
}
.low-stock-foot {
  margin-top: 10px;
  font-size: 12px;
}

/* --- Ревизия --------------------------------------------------------------- */

.revision-head .panel-body {
  padding-top: 14px;
  padding-bottom: 14px;
}
.revision-head-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.revision-head-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.revision-head-title strong {
  font-size: 16px;
}
.revision-head-title .muted {
  font-size: 12.5px;
}
.revision-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.revision-save-state {
  font-size: 12px;
}
.revision-save-state.is-error {
  color: var(--danger-2);
  font-weight: 600;
}
.danger-outline {
  color: var(--danger-2);
}

.revision-scan-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.revision-scan-field,
.revision-qty-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.revision-scan-field {
  flex: 1 1 auto;
}
.revision-qty-field {
  width: 140px;
}
.revision-scan-field input,
.revision-qty-field input {
  height: 52px;
  padding: 0 16px;
  border: 2px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 18px;
  color: var(--text);
}
.revision-qty-field input {
  text-align: center;
}
.revision-scan-field input:focus,
.revision-qty-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.revision-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.revision-search-results:empty {
  display: none;
}
.rev-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.rev-result:hover,
.rev-result:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  outline: none;
}
.rev-result-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.revision-last {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  background: var(--success-soft);
  color: var(--success-2);
  font-weight: 700;
  font-size: 14px;
}
.revision-last.is-error {
  background: var(--danger-soft);
  color: var(--danger-2);
}
.revision-last.is-flash {
  animation: revisionFlash 0.45s var(--ease);
}
@keyframes revisionFlash {
  from {
    transform: scale(1.015);
    box-shadow: 0 0 0 4px var(--success-soft);
  }
  to {
    transform: none;
    box-shadow: none;
  }
}
.rev-count-input {
  width: 90px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  text-align: right;
  font: inherit;
  font-weight: 700;
}
.rev-line-hit td {
  background: var(--success-soft);
}
.rev-diff-short {
  color: var(--danger-2);
  font-weight: 700;
}
.rev-diff-surplus {
  color: var(--info);
  font-weight: 700;
}
.rev-diff-zero {
  color: var(--muted);
}
.rev-result-cell.has-diff {
  color: var(--danger-2);
  font-weight: 700;
}

.revision-stats,
.reports-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.revision-stat,
.reports-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.revision-stat span,
.reports-kpi span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.revision-stat strong,
.reports-kpi strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.revision-stat.is-match strong {
  color: var(--success-2);
}
.revision-stat.is-short strong {
  color: var(--danger-2);
}
.revision-stat.is-surplus strong {
  color: var(--info);
}
.revision-note,
.reports-note {
  margin: 0 0 14px;
  font-size: 12.5px;
}

.revision-mode-choice {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.revision-mode-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.revision-mode-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.revision-mode-option input {
  margin-top: 3px;
}
.revision-mode-option span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.revision-mode-option small {
  color: var(--muted);
  font-size: 12px;
}

/* --- Отчёты ---------------------------------------------------------------- */

.reports-table th.is-sortable {
  cursor: pointer;
  user-select: none;
}
.reports-table th.is-asc::after {
  content: " ▲";
  font-size: 9px;
}
.reports-table th.is-desc::after {
  content: " ▼";
  font-size: 9px;
}
.reports-table tr.reports-total td {
  font-weight: 700;
  border-top: 2px solid var(--line-strong);
  background: var(--surface-muted);
}

@media (max-width: 900px) {
  .revision-stats,
  .reports-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .revision-scan-row {
    flex-direction: column;
    align-items: stretch;
  }
  .revision-qty-field {
    width: auto;
  }
  .low-stock-threshold {
    margin-left: 0;
  }
}

@media print {
  .primary-sidebar,
  .page-header-actions,
  .revision-head-actions,
  [data-revision-back],
  #revision-result-filter,
  .toast-root {
    display: none !important;
  }
  .app-shell,
  .main-column {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .panel,
  .revision-stat {
    box-shadow: none !important;
  }
}
