/* =============================================================================
   РџРёРІРњР°СЃС‚РµСЂ В· РљРѕРјРјРµСЂС‡РµСЃРєРёР№ РєР°Р±РёРЅРµС‚
   Brand: logo amber heart (#e8a830) + slate ink (#304040), warm mist canvas.
   Contrast rule: amber surfaces в†’ dark ink text; dark surfaces в†’ light text.
   Fonts: self-hosted woff2 (CSP style-src/font-src 'self'). Manrope has Cyrillic.
   ============================================================================= */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/manrope-cyrillic-500.50c16b5d8d7b.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/manrope-latin-500.f95b8f975304.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/manrope-cyrillic-600.3470ad06386c.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/manrope-latin-600.58d382c3e448.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/manrope-cyrillic-700.b3aed8e4cd3a.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/manrope-latin-700.ed9e261b92db.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/source-sans-3-cyrillic-400.bbdffcad8aba.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/source-sans-3-latin-400.27ab01c4cb50.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/source-sans-3-cyrillic-600.b4bb3a93536d.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/source-sans-3-latin-600.9a35cba76eda.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/source-sans-3-cyrillic-700.dc692ffda067.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/source-sans-3-latin-700.9b13bd3653e3.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* РџРёРІРњР°СЃС‚РµСЂ вЂ” С†РІРµС‚Р° Р»РѕРіРѕС‚РёРїР° */
  --ink: #304040;
  --ink-soft: #3d4a4a;
  --muted: #5c6a6a;
  --muted-soft: #7a8888;
  --line: #e6e3dc;
  --line-strong: #d0ccc3;
  --surface: #ffffff;
  --surface-subtle: #f8f6f1;
  --canvas: #f5f3ee;
  --canvas-deep: #efece5;

  --charcoal: #304040;
  --charcoal-elevated: #243232;
  --charcoal-hover: #3d4c4c;
  --hop: #e8a830;
  --hop-dark: #b87916;
  --hop-deeper: #8f5c10;
  --hop-soft: #f3d89a;
  --hop-wash: #fbf3e0;
  --on-hop: #243232;

  --success: #0f7b6c;
  --success-bg: #edf8f6;
  --warning: #9a6700;
  --warning-bg: #fbf3db;
  --danger: #c43c3c;
  --danger-bg: #fdebec;
  --info: #b87916;
  --info-bg: #fbf3e0;
  --focus: #b87916;
  --link: #8f5c10;
  --table-header-bg: #f8f6f1;
  --table-header-fg: #304040;

  --accent: var(--hop);
  --accent-2: var(--hop-dark);
  --border: var(--line);
  --text: var(--ink);
  --bg: var(--canvas);
  --panel: var(--surface-subtle);

  --font-sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  /* Р¦РёС„СЂС‹ вЂ” С‚РѕС‚ Р¶Рµ РіСЂРѕС‚РµСЃРє СЃ tabular nums (Р±РµР· РјРѕРЅРѕС€РёСЂРёРЅРЅРѕРіРѕ IBM Plex) */
  --font-mono: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-brand: "Manrope", "Source Sans 3", system-ui, sans-serif;
  --text-body: 1rem; /* 16px вЂ” РѕСЃРЅРѕРІРЅРѕР№ С‚РµРєСЃС‚ */
  --text-body-compact: 0.9375rem; /* 15px вЂ” С‚Р°Р±Р»РёС†С‹ */
  --text-meta: 0.875rem; /* 14px вЂ” РїРѕРґРїРёСЃРё */
  --text-cap: 0.8125rem; /* 13px вЂ” РјРµС‚РєРё */
  --text-title: 1.875rem; /* 30px вЂ” H1 СЃС‚СЂР°РЅРёС†С‹ */
  --text-section: 1.125rem; /* 18px вЂ” H2 СЃРµРєС†РёРё */
  --leading-copy: 1.55;
  --leading-compact: 1.45;
  --leading-tight: 1.3;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius: 4px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-control: var(--radius-sm);
  --radius-panel: 0px;
  --radius-chip: var(--radius-md);
  --radius-avatar: 50%;
  --shadow-tint: transparent;
  --shadow: none;
  --shadow-panel: none;
  --control-min-height: 40px;
  --density-pad: 8px 16px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 120ms;
  --dur-ui: 180ms;
  --dur-enter: 280ms;

  --z-sticky: 30;
  --z-drawer-backdrop: 40;
  --z-drawer: 50;
  --z-skip: 1000;
  /* Липкий thead крупных таблиц — к верху viewport (topbar не sticky) */
  --table-sticky-top: 0px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-copy);
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--hop-dark); }
:focus-visible {
  outline: 2px solid var(--hop);
  outline-offset: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: var(--z-skip);
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--charcoal);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.is-hidden { display: none !important; }
.muted { color: var(--muted); }

/* -----------------------------------------------------------------------------
   App shell
   ----------------------------------------------------------------------------- */

.app-shell { min-height: 100dvh; }

.sidebar {
  position: fixed;
  z-index: var(--z-drawer);
  inset: 0 auto 0 0;
  display: flex;
  width: 240px;
  flex-direction: column;
  color: var(--ink);
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.brand {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--hop-wash) 0%, var(--surface) 100%);
}

.brand-logo {
  display: block;
  width: auto;
  height: 18px;
  max-width: min(100%, 200px);
}

.side-nav {
  position: relative;
  overflow-y: auto;
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.side-nav .side-liquid {
  position: absolute;
  left: 8px;
  top: 0;
  z-index: 0;
  width: calc(100% - 16px);
  height: 36px;
  border-radius: 12px;
  pointer-events: none;
  background: color-mix(in srgb, var(--surface) 92%, #fff);
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--ink) 6%, transparent),
    0 2px 8px -3px rgba(15, 30, 60, 0.16);
  will-change: transform, height, width;
  opacity: 0;
}
.side-nav.has-liquid .side-liquid { opacity: 1; }

.nav-group {
  padding: 4px 0 8px;
}

.nav-group + .nav-group {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.nav-label {
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.side-nav a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 0;
  padding: 8px 10px;
  color: var(--ink-soft);
  border-radius: 12px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  background: transparent;
  transition: color var(--dur-fast) var(--ease-out);
}
.side-nav a .side-label {
  display: inline;
  min-width: 0;
}
.lord-nav-ic {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
}
.lord-nav-ic.lord-dock {
  width: 30px;
  height: 30px;
}
.lord-nav-ic.lord-side,
.lord-nav-ic.lord-more {
  width: 24px;
  height: 24px;
}
.side-nav .lord-nav-ic {
  flex: none;
}
.cabinet-more-list .lord-nav-ic {
  flex: none;
}

.side-nav a::before { display: none; content: none; }

@media (hover: hover) and (pointer: fine) {
  .side-nav a:hover {
    color: var(--ink);
  }
  .side-nav.has-liquid a:hover:not([aria-current="page"]) {
    background: color-mix(in srgb, var(--ink) 5%, transparent);
  }
}

.side-nav a[aria-current="page"] {
  color: var(--hop);
  background: transparent;
  box-shadow: none;
  font-weight: 650;
}

.side-nav a[aria-current="page"]::before { display: none; }

@media (prefers-reduced-motion: reduce) {
  .side-nav .side-liquid { transition: none; }
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
}

.sidebar-footer small {
  display: none;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.sidebar .role-badge {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.app-column {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin-left: 240px;
}
/* Desk-страницы: колонка = кадр окна, без скролла документа */
.app-column:has(> .main-content.desk-main) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: var(--z-sticky);
  display: flex;
  height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: color-mix(in srgb, var(--hop-wash) 55%, var(--surface));
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.menu-button { display: none !important; }

.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-themes,
.phone-coach { display: none; }

.profile form { margin: 0; }

.profile-copy strong,
.profile-copy small {
  display: block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong { font-size: 13px; font-weight: 600; }
.profile-copy small { color: var(--muted); font-size: 12px; }

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: var(--hop-deeper);
  background: var(--hop-wash);
  border: 1px solid color-mix(in srgb, var(--hop) 34%, var(--line));
  border-radius: var(--radius-avatar);
  font-family: var(--font-brand);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.02em;
  box-sizing: border-box;
}

.avatar-small { width: 28px; height: 28px; flex-basis: 28px; }
.avatar-tiny { width: 22px; height: 22px; flex: 0 0 22px; font-size: 10px; }

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .icon-button:hover {
    color: var(--ink);
    background: var(--surface-subtle);
  }
}

.icon-button:active { transform: scale(0.97); }

/* Soft-nav: каркас живой, main слегка тускнеет на время fetch */
html.is-soft-nav {
  cursor: progress;
}
html.is-soft-nav .main-content {
  opacity: 0.72;
  transition: opacity 120ms ease;
}
@media (max-width: 900px) {
  html.is-soft-nav .main-content {
    opacity: 0.94;
    transition: opacity 80ms ease;
  }
  .app-body .main-content.is-ready > *:not(.filter-shell) {
    --dur-enter: 140ms;
  }
  @keyframes page-rise {
    from {
      opacity: 0.92;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
@supports (view-transition-name: none) {
  #main-content { view-transition-name: rmkd-main; }
  ::view-transition-old(rmkd-main),
  ::view-transition-new(rmkd-main) { animation-duration: 160ms; }
}
@media (max-width: 900px) {
  @supports (view-transition-name: none) {
    #main-content { view-transition-name: none; }
  }
}

.main-content {
  width: 100%;
  max-width: 1660px;
  margin: 0 auto;
  padding: 28px 32px 56px;
}

/* Desk: единый каркас вкладок (Маркетинг и др.) — одна ширина, одна рабочая высота */
.main-content.desk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 1660px;
  width: 100%;
  padding-bottom: 28px;
  overflow: hidden;
}
.desk {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}
.desk > .page-tabs,
.desk > .marketing-tabs {
  flex: none;
  margin: 0 0 14px;
}
.desk > .page-heading {
  flex: none;
  margin-bottom: 16px;
}
.desk > .sync-tabs,
.desk > .page-tabs:not(.marketing-tabs) {
  flex: none;
  margin: 0 0 14px;
}
.desk-body {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  width: 100%;
  overflow: auto;
}
/* Несколько блоков — листается сама рабочая область, блоки не сжимаются */
.desk-body > :not(:only-child) {
  flex: none;
}
.desk-body > .data-section,
.desk-body > .form-panel,
.desk-body > .mc,
.desk-body > .model-form,
.desk-body > .reviews-layout {
  width: 100%;
  margin-top: 0;
  min-height: 0;
}
.desk-body > .model-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}
/* Одна рабочая поверхность заполняет кадр; скролл — внутри неё, не у document */
.desk-body > :only-child {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
.desk-body > .data-section:only-child,
.desk-body > .form-panel:only-child,
.desk-body > .model-form:only-child {
  overflow: auto;
}
.desk-body > .reviews-layout {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}
/* tabs стоят ДО заголовка (Маркетинг) — тот же ритм, что у heading+tabs */
.page-tabs + .page-heading {
  margin-bottom: 16px;
}

/* Motion 1: page enter вЂ” Р·Р°РјРµС‚РЅС‹Р№ РїРѕРґСЉС‘Рј + Р»С‘РіРєРёР№ stagger */
.app-body .main-content.is-ready > *:not(.filter-shell) {
  animation: page-rise var(--dur-enter) var(--ease-out) both;
}

.app-body .main-content.is-ready > *:nth-child(1) { animation-delay: 0ms; }
.app-body .main-content.is-ready > *:nth-child(2) { animation-delay: 50ms; }
.app-body .main-content.is-ready > *:nth-child(3) { animation-delay: 100ms; }
.app-body .main-content.is-ready > *:nth-child(4) { animation-delay: 150ms; }
.app-body .main-content.is-ready > *:nth-child(5) { animation-delay: 200ms; }
.app-body .main-content.is-ready > *:nth-child(n+6) { animation-delay: 240ms; }

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    /* none, not translateY(0): with fill-mode both a leftover transform would
       become the containing block for position:fixed drawers inside the page. */
    transform: none;
  }
}

.filter-panel.is-applying,
.data-section.is-applying {
  animation: filter-flash var(--dur-ui) var(--ease-out);
}

@keyframes filter-flash {
  0% { border-color: var(--hop); box-shadow: 0 0 0 1px color-mix(in srgb, var(--hop) 40%, transparent); }
  100% { border-color: var(--line); box-shadow: none; }
}

.main-content.report-main {
  max-width: none;
  padding-right: 16px;
  padding-left: 16px;
}

.drawer-backdrop { display: none; }

/* -----------------------------------------------------------------------------
   Type & page chrome
   ----------------------------------------------------------------------------- */

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-brand);
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h2 {
  margin-bottom: 4px;
  color: var(--ink);
  font-family: var(--font-brand);
  font-size: var(--text-section);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.page-heading h1 {
  padding-bottom: 0;
  border-bottom: 0;
  width: auto;
  max-width: 100%;
  margin-bottom: 0;
  font-size: var(--text-title);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.eyebrow {
  display: none;
}

.page-heading {
  display: flex;
  min-height: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

/* Сегменты сразу под заголовком — как у отзывов: меньше воздуха, ровнее ритм */
.page-heading:has(+ .page-tabs),
.page-heading:has(+ .sync-tabs) {
  margin-bottom: 14px;
}

.oos-loss-banner {
  margin: 0 0 24px;
  padding: 22px 26px 18px;
  border: 1px solid color-mix(in srgb, #c23b3b 32%, var(--line));
  border-radius: 14px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, #c23b3b 16%, var(--surface)) 0%,
      color-mix(in srgb, #c23b3b 6%, var(--surface)) 55%,
      var(--surface) 100%
    );
  box-shadow: 0 10px 24px -18px rgba(120, 24, 24, 0.45);
}

.oos-loss-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 40px;
}

.oos-loss-metric {
  min-width: 0;
}

.oos-loss-metric-margin .oos-loss-value {
  color: color-mix(in srgb, #8b1212 88%, var(--ink));
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
}

.oos-loss-label {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, #9b1c1c 75%, var(--ink-soft));
}

.oos-loss-value {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, #8b1212 85%, var(--ink));
  text-wrap: balance;
}

.oos-loss-hint {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, #c23b3b 22%, transparent);
  font-size: 0.9rem;
  color: color-mix(in srgb, #8b1212 55%, var(--muted));
}

@media (max-width: 640px) {
  .oos-loss-banner {
    padding: 16px 16px 14px;
    margin-bottom: 18px;
  }

  .oos-loss-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .oos-loss-value,
  .oos-loss-metric-margin .oos-loss-value {
    font-size: clamp(2rem, 11vw, 3rem);
  }
}

.page-heading-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
}

.page-export-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.page-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.page-heading > div:first-child > p:last-child {
  max-width: 64ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--text-body-compact);
  line-height: 1.5;
}

.enqueue-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.enqueue-source {
  min-width: 200px;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.period-summary {
  min-width: 220px;
  padding: 10px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.period-summary small,
.period-summary strong,
.period-summary span { display: block; }

.period-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.period-summary strong {
  margin: 4px 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.period-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.period-summary .period-tz {
  color: var(--hop-dark);
  font-variant-numeric: tabular-nums;
}

.period-tz-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.period-summary .button {
  display: inline-flex;
  margin-top: 10px;
}

.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  max-width: 72ch;
  font-size: var(--text-meta);
  line-height: 1.5;
}
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.journal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.export-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft, #24302a);
  cursor: pointer;
  user-select: none;
}

.page-export-group .export-option {
  align-self: flex-start;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.export-option input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--hop, #3d6b52);
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  min-height: var(--control-min-height);
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--density-pad);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.button:active { transform: scale(0.97); }

.button-primary {
  color: var(--on-hop);
  background: var(--hop);
  border-color: var(--hop);
}

@media (hover: hover) and (pointer: fine) {
  .button-primary:hover {
    color: var(--on-hop);
    background: #f0b545;
    border-color: #f0b545;
  }
}

.button-quiet {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--line-strong);
}

@media (hover: hover) and (pointer: fine) {
  .button-quiet:hover {
    color: var(--ink);
    background: var(--surface-subtle);
  }
}

.button-export {
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--hop);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hop) 35%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .button-export:hover {
    color: var(--on-hop);
    background: var(--hop);
    border-color: var(--hop);
  }
}

.button-full { width: 100%; }

.button-link {
  padding: 5px 2px;
  color: var(--link);
  background: none;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}

.button-link:hover {
  color: var(--hop-dark);
  text-decoration: underline;
}

.button-link-danger {
  color: var(--danger, #b42318);
}

.button-link-danger:hover {
  color: color-mix(in srgb, var(--danger, #b42318) 85%, #000);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.table-actions-form {
  display: contents;
}

/* -----------------------------------------------------------------------------
   KPI ledger strip (not card soup)
   ----------------------------------------------------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi {
  position: relative;
  min-height: 118px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.kpi:last-child { border-right: 0; }

.kpi-label,
.kpi-note,
.kpi a { display: block; }

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.kpi strong {
  display: block;
  margin: 8px 0 8px;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 2vw, 1.85rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi-note,
.kpi a {
  color: var(--muted);
  font-size: 13px;
}

.kpi a { color: var(--link); }

.kpi-warning {
  background: color-mix(in srgb, var(--danger-bg) 70%, var(--surface));
}

.kpi-warning strong { color: var(--danger); }

.workspace-section { margin-top: 28px; }

.action-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.action-row {
  display: grid;
  min-height: 72px;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out);
}

.action-row:last-child { border-bottom: 0; }

@media (hover: hover) and (pointer: fine) {
  .action-row:hover {
    color: var(--ink);
    background: var(--surface-subtle);
  }
}

.action-row strong,
.action-row small { display: block; }

.action-row small {
  margin-top: 2px;
  color: var(--muted);
}

.action-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--hop-dark);
  background: var(--hop-wash);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
}

.action-icon-alert {
  color: var(--danger);
  background: var(--danger-bg);
}

/* -----------------------------------------------------------------------------
   Panels, forms, tables
   ----------------------------------------------------------------------------- */

.filter-panel,
.form-panel,
.data-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}

.filter-shell { margin-bottom: 0; }

.filter-trigger {
  display: inline-flex;
  width: auto;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.filter-trigger:hover {
  background: var(--surface-subtle);
}

.filter-trigger[aria-expanded="true"] {
  border-color: var(--ink);
}

.period-summary .filter-trigger {
  width: 100%;
  margin-top: 10px;
  min-height: 36px;
  justify-content: center;
  color: var(--on-hop);
  background: var(--hop);
  border-color: var(--hop);
}

.period-summary .filter-trigger:hover {
  color: var(--on-hop);
  background: #f0b545;
  border-color: #f0b545;
}

.period-summary .filter-trigger[aria-expanded="true"] {
  color: var(--on-hop);
  border-color: var(--hop-dark);
}

.period-summary .filter-trigger .count-badge {
  margin-left: 0;
  color: #fff;
  background: var(--ink);
}

.filter-setup {
  margin-top: 8px;
}

.filter-setup-body {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 24px;
}

.filter-setup-body strong {
  font-size: 18px;
  font-weight: 700;
}

.filter-setup-body p {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.filter-setup-body .filter-trigger {
  margin-top: 6px;
  min-height: 44px;
  padding: 10px 20px;
  font-size: 15px;
  color: var(--on-hop);
  background: var(--hop);
  border-color: var(--hop);
}

.filter-setup-body .filter-trigger:hover {
  color: var(--on-hop);
  background: #f0b545;
  border-color: #f0b545;
}

.filter-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1200 !important;
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(12, 16, 22, 0.58);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.filter-dialog {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1201 !important;
  display: none;
  margin: 0;
  place-items: center;
  align-content: center;
  justify-items: center;
  padding: max(16px, 4vh) 16px;
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  background: transparent;
}

.filter-dialog-chrome {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(880px, calc(100vw - 32px));
  max-height: min(90vh, 920px);
  margin: auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 28px 80px rgba(8, 12, 18, 0.42);
}

.filter-dialog-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.filter-dialog-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.filter-dialog-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.filter-dialog-close:hover {
  color: var(--ink);
  background: var(--surface-subtle);
}

.filter-error {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 20px;
  color: var(--danger);
  background: var(--danger-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  font-size: 13px;
  font-weight: 600;
}

/* Dialog body: period в†’ search в†’ lists в†’ options в†’ actions */
.filter-dialog .filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  flex: 1 1 auto;
  align-content: start;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 20px 0;
  background: var(--surface);
  border-top: 0;
  border-radius: 0 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px);
}

.filter-dialog .filter-form > .field-hint,
.filter-dialog .filter-form > .period-tz-hint {
  grid-column: 1 / -1;
  margin: -4px 0 0;
}

.filter-dialog .field-search,
.filter-dialog .filter-period-group {
  grid-column: 1 / -1;
}

.filter-dialog .filter-period-group {
  padding: 0;
  border: 0;
  background: transparent;
}

.filter-dialog .filter-period-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.filter-dialog .field:has(.filter-fold) {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.filter-dialog .field:has(.filter-fold[open]) {
  z-index: 40;
}

.filter-dialog .field:has(.filter-fold) > label {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.filter-dialog .filter-fold {
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 0;
  overflow: visible;
}

.filter-dialog .filter-fold > summary {
  display: flex;
  position: relative;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.filter-dialog .filter-fold[open] > summary {
  display: flex;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* РЎРїРёСЃРѕРє РІС‹РµР·Р¶Р°РµС‚ РїРѕРІРµСЂС… С„РѕСЂРјС‹ вЂ” СЂР°Р·РјРµСЂ РѕРєРЅР° РЅРµ РјРµРЅСЏРµС‚СЃСЏ */
.filter-dialog .filter-fold-panel {
  display: none;
}

.filter-dialog .filter-fold[open] > .filter-fold-panel {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: min(280px, 42vh);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 16px 36px rgba(8, 12, 18, 0.22);
}

.filter-dialog .filter-fold-panel .filter-fold-search,
.filter-dialog .filter-fold-panel .filter-fold-actions,
.filter-dialog .filter-fold-panel .checklist,
.filter-dialog .filter-fold-panel .field-hint {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  background: var(--surface);
}

.filter-dialog .filter-fold-panel > :first-child {
  border-top: 0;
}

.filter-dialog .filter-fold-panel .checklist {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.filter-dialog .filter-fold-panel .field-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 10px 8px;
  border-bottom: 0;
}

.filter-dialog .field-checkbox {
  grid-column: 1 / -1;
  width: fit-content;
  max-width: 100%;
}

.filter-dialog .field-checkbox + .field-checkbox {
  margin-top: -8px;
}

.filter-dialog .filter-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 8px -20px 0;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.filter-dialog .filter-actions .button-primary {
  min-width: 128px;
}

.filter-shell.is-open .filter-overlay,
body > .filter-overlay.is-open {
  display: block;
}

.filter-shell.is-open .filter-dialog,
body > .filter-dialog.is-open {
  display: grid;
}

.filter-shell:not(.is-open) .filter-overlay,
.filter-shell:not(.is-open) .filter-dialog {
  display: none;
}

body.filter-dialog-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .filter-dialog .filter-form {
    grid-template-columns: 1fr;
  }

  .filter-dialog .filter-actions .button {
    flex: 1;
    min-height: 48px;
  }
}

.filter-panel { margin-bottom: 20px; }

.filter-panel summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.filter-panel summary::marker { color: var(--muted); }

.summary-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.count-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  padding: 0 6px;
  place-items: center;
  color: var(--on-hop, #fff);
  background: var(--charcoal, var(--ink));
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--line);
  align-items: start;
}

.filter-form-compact .field-search {
  grid-column: span 2;
}

.filter-period-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-period-title {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.filter-period-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.filter-period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
}

.filter-period-preset {
  appearance: none;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle, var(--surface));
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.filter-period-preset:hover {
  border-color: color-mix(in srgb, var(--hop) 45%, var(--line));
  color: var(--hop-dark);
}

.filter-period-preset.is-active {
  border-color: var(--hop);
  background: color-mix(in srgb, var(--hop) 14%, var(--surface));
  color: var(--hop-dark);
}

.filter-period-preset:focus-visible {
  outline: 2px solid var(--hop);
  outline-offset: 2px;
}

.filter-period-preset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.filter-period-preset:disabled:hover {
  border-color: var(--line);
  color: var(--ink);
}

.filter-period-group > .field-hint {
  margin: 0;
}

.field { min-width: 0; }

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.field input:not([type="checkbox"]),
.field select {
  width: 100%;
  min-height: var(--control-min-height);
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

/* Looks like a select; nest inside .field so the label matches period/source */
.filter-fold {
  min-width: 0;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.filter-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.filter-fold > summary::-webkit-details-marker { display: none; }

.filter-fold > summary::after {
  content: "+";
  flex: 0 0 auto;
  margin-left: 2px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.filter-fold[open] > summary {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.filter-fold[open] > summary::after {
  content: "\2212"; /* − */
}

.filter-fold-placeholder {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 600;
}

.filter-fold-placeholder:not(.is-empty) {
  color: var(--ink);
}

.filter-fold-meta {
  flex: 0 1 auto;
  margin-left: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.filter-fold-meta:empty {
  display: none;
}

.filter-fold .checklist {
  max-height: 296px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.filter-fold-search {
  margin: 0;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 0;
}

.filter-fold-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: center;
  margin: 0;
  padding: 4px 10px 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 0;
}

.filter-fold-actions .button-link {
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}

.filter-fold-search input {
  width: 100%;
  min-height: 32px;
  padding: 5px 8px;
  color: var(--ink);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.filter-fold .checklist-item.is-filtered-out,
.filter-fold .checklist-item.is-source-hidden {
  display: none !important;
}

.filter-fold .field-hint {
  margin: 0;
  padding: 6px 10px 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.filter-fold[open] .field-hint {
  border-radius: 0;
}

.filter-fold[open] .filter-fold-search + .checklist,
.filter-fold[open] .filter-fold-actions + .checklist,
.filter-fold[open] .field-hint + .checklist,
.filter-fold .checklist:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.filter-fold[open] .filter-fold-search + .checklist + .field-hint,
.filter-fold[open] .filter-fold-actions + .checklist + .field-hint,
.filter-fold[open] .checklist + .field-hint {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 5px 6px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
}

.checklist-item:hover { background: var(--surface-subtle); }

.checklist-item input {
  margin: 2px 0 0;
  flex: 0 0 auto;
}

.checklist-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.field input:not([type="checkbox"]):hover,
.field select:hover { border-color: var(--line-strong); }

.field input:not([type="checkbox"]):focus,
.field select:focus {
  border-color: var(--hop);
  outline: 2px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 0;
}

.field-checkbox {
  display: flex;
  min-height: 38px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
}

.field-checkbox label { margin: 0; order: 2; }
.field-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--hop);
}
.field-checkbox .help-text,
.field-checkbox .field-error { width: 100%; order: 3; }

.filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  /* Match .field label + gap so buttons sit on the control baseline */
  padding-top: calc(11px * 1.35 + 5px);
}

.help-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.field-error {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
}

.field-invalid input:not([type="checkbox"]),
.field-invalid select { border-color: var(--danger); }

.field-date[hidden] { display: none !important; }

.field-date.is-active input {
  border-color: var(--hop);
}

.data-section {
  margin-top: 20px;
  padding: 0;
  /* visible: РёРЅР°С‡Рµ position:sticky Сѓ thead Р»РѕРјР°РµС‚СЃСЏ (scrollport СЃРµРєС†РёРё). */
  overflow: visible;
}

.data-section > .section-heading {
  margin-bottom: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
}

.data-section > .section-heading.section-heading-row {
  align-items: center;
  gap: 12px 16px;
}

.data-section > .scroll-hint {
  padding: 10px 16px 0;
}

.table-wrap {
  /* overflow-x only вЂ” vertical sticky headers break if overflow is not visible */
  overflow-x: auto;
  overflow-y: visible;
  background: var(--surface);
  border-top: 0;
  border-radius: 0;
}

/* Viewport sticky: РЅРµ СЃРѕР·РґР°РІР°С‚СЊ scrollport РїРѕ Y (РёРЅР°С‡Рµ thead РЅРµ Р»РёРїРЅРµС‚ РїРѕРґ topbar). */
.table-wrap:has(> .data-table:not(.ipr-table)) {
  overflow: visible;
}

.table-wrap:focus { outline-offset: -3px; }

.report-table-wrap {
  /* Fit viewport width; page scrolls vertically. */
  container-type: inline-size;
  container-name: report;
  overflow: visible;
  border-bottom: 1px solid var(--line);
}

.data-table {
  width: 100%;
  min-width: 0;
  /* separate: sticky thead РЅР°РґС‘Р¶РЅРµРµ, С‡РµРј РїСЂРё border-collapse: collapse */
  border-spacing: 0;
  border-collapse: separate;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}

/* Settings / sync grids that need a bit of room */
.data-table:not(.report-table):not(.ipr-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table):not(.reviews-geo-table):not(.reviews-traffic-table) {
  min-width: 640px;
}
.data-table.reviews-geo-table,
.data-table.reviews-traffic-table {
  min-width: 36rem;
}

/* Auto-fit ops grid to available width */
.report-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.report-table-autorder,
.report-table-oos {
  min-width: 0;
}

.data-table.report-table th,
.data-table.report-table td {
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Липкий thead у крупных отчётных таблиц — белая плашка, читаемый текст, тень при скролле */
.data-table.report-table thead th,
.data-table.ipr-table thead th {
  position: sticky;
  top: var(--table-sticky-top);
  z-index: calc(var(--z-sticky) + 1);
  background: var(--surface, #fff);
  color: var(--ink-soft);
  font-weight: 700;
  box-shadow:
    inset 0 -1px 0 var(--line-strong),
    0 10px 18px -12px rgba(32, 40, 40, 0.28);
}

.data-table.report-table thead th:first-child,
.data-table.ipr-table thead th:first-child {
  border-top-left-radius: 14px;
}

.data-table.report-table thead th:last-child,
.data-table.ipr-table thead th:last-child {
  border-top-right-radius: 14px;
}

.data-table.report-table th {
  padding: 12px 14px;
  color: var(--ink-soft);
  background: var(--surface, #fff);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-transform: none;
  white-space: nowrap;
}

.report-table .col-store { width: 11%; }
.report-table .col-sku { width: 5%; }
.report-table .col-name { width: 16%; }
.report-table .col-meta { width: 8%; }
.report-table .col-num { width: 4.5%; }
.report-table .col-order { width: 5.5%; }

.report-table-oos .col-name { width: 22%; }
.report-table-oos .col-num { width: 8%; }
.report-table-oos .col-order { width: 11%; }

/* Валовая YoY: 9 широких колонок — не давить fixed 4.5%, лучше гориз. скролл */
.report-table-wrap-yoy {
  /* overflow-x без scrollport по Y — иначе thead не липнет к странице */
  overflow-x: auto;
  overflow-y: visible;
  /* ponytail: Chrome часто поднимает overflow-y до auto; sticky тогда внутри wrap */
}

.report-table-yoy {
  table-layout: auto;
  width: max(100%, 68rem);
  min-width: 68rem;
}

.report-table-yoy .col-name {
  width: 14rem;
  min-width: 12rem;
  max-width: 18rem;
}

.report-table-yoy .col-num {
  width: auto;
  min-width: 6.75rem;
}

.report-table-yoy th.col-num,
.report-table-yoy td.col-num {
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
}

.report-table-yoy th {
  white-space: normal;
  line-height: 1.2;
  vertical-align: bottom;
}

.report-table-yoy th a {
  display: inline;
  white-space: normal;
}

.report-table td.col-store,
.report-table td.col-meta {
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-table td.col-num,
.report-table td.col-order,
.report-table td.col-sku {
  white-space: nowrap;
}

.report-table td.col-store,
.report-table td.col-name,
.report-table td.col-meta {
  vertical-align: top;
}

.report-table td.col-store {
  color: var(--ink-soft);
  font-weight: 600;
}

.store-group-head td {
  background: var(--surface-2, #f3f1eb);
  border-bottom: 1px solid var(--line-strong);
  padding: 0.45rem 0.6rem;
}

.store-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0.15rem 0;
}

.store-group-chevron {
  display: inline-block;
  width: 1ch;
  color: var(--muted);
}

.store-group-count {
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 500;
}

.store-group-count::before {
  content: "\00B7\0020"; /* · */
}

.store-group.is-collapsed .store-group-row {
  display: none;
}

.report-table-autorder .col-store {
  width: 8%;
}

.report-table td.col-meta {
  color: var(--muted);
}

.report-table .product-cell strong {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.report-table .sku {
  font-size: 13px;
  font-weight: 600;
}

.report-table .no-data {
  color: var(--muted-soft);
  font-size: 0.92em;
}

@container report (max-width: 1280px) {
  .report-table .col-store { width: 12%; }
  .report-table .col-name { width: 18%; }
  .report-table .col-meta { width: 8%; }
}

@container report (max-width: 1040px) {
  .report-table th.col-meta,
  .report-table td.col-meta {
    display: none;
  }
  .report-table .col-store { width: 13%; }
  .report-table .col-name { width: 20%; }
  .report-table .col-num { width: 5.5%; }
  .report-table .col-order { width: 7%; }
}

.scroll-hint {
  display: block;
  margin: 0;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 12px;
}

.scroll-hint-mobile { display: none; }

.data-table th,
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  text-align: left;
  vertical-align: middle;
}

.data-table th:last-child,
.data-table td:last-child { border-right: 0; }

.data-table th {
  color: var(--table-header-fg);
  background: var(--table-header-bg);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 var(--hop);
}

.data-table th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.data-table th a:hover { color: var(--hop-dark); }

.data-table tbody tr:last-child td { border-bottom: 0; }

/* Без зебры — ровный фон; строку подсвечиваем по hover/focus */
.data-table tbody tr {
  transition: background var(--dur-fast) var(--ease-out);
}

.data-table tbody tr:hover td,
.data-table tbody tr:focus-within td {
  background: color-mix(in srgb, var(--hop-wash) 78%, var(--surface));
}

.data-table tbody tr:hover td:first-child,
.data-table tbody tr:focus-within td:first-child {
  box-shadow: inset 3px 0 0 var(--hop);
}

.data-table .numeric {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.data-table th.is-emphasis {
  color: var(--ink);
  background: var(--hop-wash);
  box-shadow: inset 0 -2px 0 var(--hop);
}

.data-table td.value-strong {
  color: var(--ink);
  background: color-mix(in srgb, var(--hop-wash) 76%, var(--surface));
  font-size: 1em;
  font-weight: 700;
}

.data-table tbody tr:hover td.value-strong,
.data-table tbody tr:focus-within td.value-strong {
  background: color-mix(in srgb, var(--hop-wash) 90%, var(--surface));
}

.sku {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 600;
  white-space: nowrap;
}

.product-cell { min-width: 220px; }
.product-cell strong,
.product-cell small { display: block; }
.product-cell strong {
  max-width: 320px;
  font-size: var(--text-body-compact);
  font-weight: 700;
  line-height: 1.4;
}
.product-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: 1.4;
}

.no-data {
  color: var(--muted-soft);
  font-size: var(--text-meta);
  white-space: nowrap;
}

.margin-cue {
  display: block;
  margin-top: 2px;
  color: var(--warning);
  font-size: var(--text-cap);
  font-weight: 600;
}

.abc-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

@media (max-width: 720px) {
  .abc-summary-stats {
    grid-template-columns: 1fr;
  }
}

.abc-summary-card {
  padding: 14px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--ink-soft));
}

.abc-summary-card dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 600;
}

.abc-summary-card dd {
  margin: 0;
  font-size: var(--text-body-compact);
  font-weight: 700;
}

/* Сводка отчётов: плотная лента вместо пустых серых карточек */
.report-summary > .section-heading {
  padding-bottom: 10px;
}

.report-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  background: var(--surface);
}

.report-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 112px;
  padding: 16px 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.report-stat:last-child {
  border-right: 0;
}

.report-stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.report-stat-value {
  font-family: var(--font-brand, var(--font-sans));
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.report-stat-meta {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-stat.is-lead {
  background: color-mix(in srgb, var(--hop-wash, #e8f2ea) 55%, var(--surface));
}

.report-stat.is-up .report-stat-value {
  color: var(--success, #2f7d4a);
}

.report-stat.is-down .report-stat-value {
  color: var(--danger, #c23b3b);
}

.report-summary-strip.is-abc .report-stat {
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  min-height: 128px;
  padding-top: 18px;
}

.report-stat-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  font-family: var(--font-brand, var(--font-sans));
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--ink-soft));
}

.report-stat.abc-class-a .report-stat-badge {
  background: color-mix(in srgb, var(--success, #2f7d4a) 28%, var(--surface));
  color: color-mix(in srgb, var(--success, #2f7d4a) 70%, #0a0a0a);
}

.report-stat.abc-class-b .report-stat-badge {
  background: color-mix(in srgb, var(--warning, #c47b16) 28%, var(--surface));
  color: color-mix(in srgb, var(--warning, #c47b16) 75%, #0a0a0a);
}

.report-stat.abc-class-c .report-stat-badge {
  background: color-mix(in srgb, var(--muted-soft) 40%, var(--surface));
  color: var(--ink-soft);
}

.report-stat-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.report-stat-bar {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 80%, transparent);
  overflow: hidden;
}

.report-stat-bar::after {
  content: "";
  display: block;
  width: min(100%, var(--pct, 0%));
  height: 100%;
  border-radius: inherit;
  background: var(--hop, #3d7a4a);
}

.report-stat.abc-class-a .report-stat-bar::after {
  background: var(--success, #2f7d4a);
}

.report-stat.abc-class-b .report-stat-bar::after {
  background: var(--warning, #c47b16);
}

.report-stat.abc-class-c .report-stat-bar::after {
  background: var(--muted-soft, #9aa3a0);
}

@media (max-width: 900px) {
  .report-summary-strip,
  .report-summary-strip.is-abc {
    grid-template-columns: 1fr;
    margin-inline: 12px;
  }

  .report-stat,
  .report-summary-strip.is-abc .report-stat {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
  }

  .report-stat:last-child {
    border-bottom: 0;
  }
}

.abc-class-badge {
  display: inline-flex;
  min-width: 1.6em;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.abc-class-a .abc-class-badge,
.abc-class-badge.abc-class-a,
.abc-summary-card.abc-class-a {
  background: color-mix(in srgb, var(--success, #2f7d4a) 18%, var(--surface));
}

.abc-class-b .abc-class-badge,
.abc-class-badge.abc-class-b,
.abc-summary-card.abc-class-b {
  background: color-mix(in srgb, var(--warning, #c47b16) 18%, var(--surface));
}

.abc-class-c .abc-class-badge,
.abc-class-badge.abc-class-c,
.abc-summary-card.abc-class-c {
  background: color-mix(in srgb, var(--muted-soft) 28%, var(--surface));
}

.report-table-oos tbody tr.oos-row-abc-a td {
  background: color-mix(in srgb, #c47b16 14%, var(--surface));
  color: var(--ink);
}

.report-table-oos tbody tr.oos-row-abc-a:hover td,
.report-table-oos tbody tr.oos-row-abc-a:focus-within td {
  background: color-mix(in srgb, #c47b16 22%, var(--surface));
}

.report-table-oos tbody tr.oos-row-abc-a td.value-strong {
  background: color-mix(in srgb, #c47b16 22%, var(--surface));
  color: var(--ink);
}

.abc-class-badge.abc-class-none {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

/* ABC: без зебры; явно выделяем маржу ≥ 40% */
.report-table-abc tbody tr td {
  background: var(--surface);
}

.report-table-abc tbody tr:hover td,
.report-table-abc tbody tr:focus-within td,
.report-table-abc tbody tr:hover td.value-strong,
.report-table-abc tbody tr:focus-within td.value-strong {
  background: color-mix(in srgb, var(--hop-wash) 72%, var(--surface));
}

.report-table-abc tbody tr.abc-row-high-margin > td,
.report-table-abc tbody tr.abc-row-high-margin td.value-strong {
  background: color-mix(in srgb, #3d9a5f 28%, var(--surface));
}

.report-table-abc tbody tr.abc-row-high-margin:hover > td,
.report-table-abc tbody tr.abc-row-high-margin:focus-within > td,
.report-table-abc tbody tr.abc-row-high-margin:hover td.value-strong,
.report-table-abc tbody tr.abc-row-high-margin:focus-within td.value-strong {
  background: color-mix(in srgb, #3d9a5f 38%, var(--surface));
}

.report-table-abc tbody tr.abc-row-high-margin > td:first-child {
  box-shadow: inset 4px 0 0 #2f7d4a;
}

.report-table-abc tbody tr.abc-row-high-margin:hover > td:first-child,
.report-table-abc tbody tr.abc-row-high-margin:focus-within > td:first-child {
  box-shadow: inset 4px 0 0 #24633a;
}

.report-table-wrap:has(> .report-table-plan-fact) {
  overflow-x: auto;
  overflow-y: visible;
}

.report-table-plan-fact {
  table-layout: auto;
  width: max(100%, 64rem);
  min-width: 64rem;
}

.report-table-plan-fact th.col-name,
.report-table-plan-fact td.col-name {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 14rem;
  background: var(--surface);
  box-shadow: 8px 0 16px -14px rgba(20, 18, 12, 0.35);
}

.report-table-plan-fact thead th.col-name {
  z-index: 3;
}

@media (min-width: 901px) {
    @container report (max-width: 1800px) {
    .report-table-plan-fact {
      width: 100%;
      min-width: 0;
    }
    .report-table-plan-fact thead th:nth-child(1),
    .report-table-plan-fact tbody td:nth-child(1),
    .report-table-plan-fact thead th:nth-child(6),
    .report-table-plan-fact tbody td:nth-child(6),
    .report-table-plan-fact thead th:nth-child(7),
    .report-table-plan-fact tbody td:nth-child(7),
    .report-table-plan-fact thead th:nth-child(8),
    .report-table-plan-fact tbody td:nth-child(8) {
      display: none;
    }
  }
}

.report-table-plan-fact tbody tr td {
  background: var(--surface);
}

.report-table-plan-fact .pf-col-plan,
.report-table-plan-fact .pf-col-rr,
.report-table-plan-fact .pf-col-score,
.report-table-plan-fact th.pf-col-plan,
.report-table-plan-fact th.pf-col-rr,
.report-table-plan-fact th.pf-col-score {
  background: color-mix(in srgb, var(--hop-wash) 70%, var(--surface));
}

.report-table-plan-fact td.pf-dev-pos,
.report-table td.pf-dev-pos {
  background: color-mix(in srgb, var(--success) 22%, var(--surface));
  font-weight: 700;
}

.report-table-plan-fact td.pf-dev-neg,
.report-table td.pf-dev-neg {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
  font-weight: 700;
}

/* Hover не должен затирать tint отклонения (валовая YoY, план-факт). */
.report-table tbody tr:hover td.pf-dev-pos,
.report-table tbody tr:focus-within td.pf-dev-pos,
.report-table-plan-fact tbody tr:hover td.pf-dev-pos,
.report-table-plan-fact tbody tr:focus-within td.pf-dev-pos {
  background: color-mix(in srgb, var(--success) 30%, var(--surface));
}

.report-table tbody tr:hover td.pf-dev-neg,
.report-table tbody tr:focus-within td.pf-dev-neg,
.report-table-plan-fact tbody tr:hover td.pf-dev-neg,
.report-table-plan-fact tbody tr:focus-within td.pf-dev-neg {
  background: color-mix(in srgb, var(--danger) 26%, var(--surface));
}

.pf-plan-input {
  width: 100%;
  min-width: 7rem;
  max-width: 10rem;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-family: var(--font-mono);
  text-align: right;
}

.pf-score-input {
  min-width: 4.5rem;
  max-width: 6.5rem;
}

.report-table-plan-fact .pf-total-row td {
  font-weight: 700;
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-cap);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.status-success,
.status-partial {
  color: var(--warning);
  background: var(--warning-bg);
}
.status-succeeded {
  color: var(--success);
  background: var(--success-bg);
}

.status-error,
.status-failed {
  color: var(--danger);
  background: var(--danger-bg);
}

.status-warning,
.status-queued {
  color: var(--warning);
  background: var(--warning-bg);
}

.status-running {
  color: var(--info);
  background: var(--info-bg);
}

.status-cancelled {
  color: var(--muted);
  background: var(--surface-subtle);
}

.status-neutral {
  color: var(--muted);
  background: var(--surface-subtle);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
}

.empty-state > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-soft);
  font-size: 28px;
}

.empty-state strong {
  display: block;
  font-size: 14px;
}

.empty-state p {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.pagination {
  display: grid;
  min-height: 56px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
}

.pagination > :last-child { justify-self: end; }
.pagination > span {
  color: var(--muted);
  font-size: 11px;
}

.form-panel { padding: 18px; }
.form-panel-narrow { max-width: 760px; }
.model-form { margin: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-rules {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-fold-single > summary .filter-fold-placeholder {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-fold-single > summary .filter-fold-placeholder.is-empty {
  color: var(--ink-soft);
}

.menu-slots-table input,
.menu-slots-table select {
  width: 100%;
  min-width: 4.5rem;
  font: inherit;
}
.menu-slots-table td { vertical-align: middle; }

.app-dock,
.cabinet-bottom-nav,
.cabinet-bottom-nav-more { display: none; }
.cabinet-bottom-nav-more {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.cabinet-more-sheet {
  width: min(420px, calc(100vw - 24px));
  max-height: min(80vh, 560px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.cabinet-more-sheet::backdrop { background: rgba(20, 18, 12, 0.4); }
.cabinet-more-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
}
.cabinet-more-sheet-head h2 { margin: 0; font-size: 1.05rem; }
.cabinet-more-list {
  display: grid;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
}
.cabinet-more-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}
.cabinet-more-list a:hover,
.cabinet-more-list a:focus-visible {
  background: var(--fill, var(--surface-subtle));
}
.field-roles { grid-column: 1 / -1; }
.field-roles ul {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.field-roles li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.field-roles li label { margin: 0; font-weight: 500; }
/* Django CheckboxSelectMultiple + optgroups → вложенные div */
.field-roles > div > div {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.field-roles > div > div:first-child {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}
.field-roles > div > div > label:first-child {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field-roles > div > div > div {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.field-roles > div > div > div > label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  font-weight: 500;
  line-height: 1.35;
}

.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 16px 12px;
}

.users-search { flex: 1 1 220px; min-width: 0; }

.users-toolbar input[type="search"],
.users-toolbar select {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 14px;
}

.users-toolbar select { width: auto; }

.user-dialog:not([open]) {
  display: none;
}

.user-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(680px, calc(100vw - 24px));
  max-height: min(92dvh, 860px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 28px 80px rgba(8, 12, 18, 0.42);
}

.user-dialog::backdrop {
  background: rgba(12, 16, 22, 0.58);
}

.user-dialog .form-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.user-dialog .model-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(92dvh, 860px);
}

.user-dialog .filter-dialog-header,
.user-dialog .form-actions {
  flex: 0 0 auto;
}

.user-dialog .filter-dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.user-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 4px;
}

.user-dialog .form-actions {
  margin-top: 0;
  padding: 12px 20px 16px;
  background: var(--surface);
}

.user-dialog .field-password,
.user-dialog .field-checkbox,
.user-dialog .field-roles,
.user-dialog .field-menu-stores,
.user-dialog .field-retail-stores {
  grid-column: 1 / -1;
}

.password-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.password-tools input {
  width: auto;
  flex: 1 1 14rem;
  min-width: 0;
}

.password-tools .button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.password-tools-note {
  margin: 8px 0 0;
  color: var(--hop-dark, #8a4f12);
  font-size: 13px;
}

.field-password { grid-column: 1 / -1; }
.reviews-layout {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 1100px) {
  .reviews-layout {
    grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.2fr);
    align-items: start;
  }
}
.reviews-stores tr.is-selected td {
  background: color-mix(in srgb, var(--accent, #e8a830) 12%, transparent);
}
.day-revenue-table tr.is-current td {
  background: color-mix(in srgb, var(--accent, #e8a830) 12%, transparent);
}
.day-revenue .filter-period-preset {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.grain-choice .filter-period-preset {
  position: relative;
}
.grain-choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.grain-choice .filter-period-preset:has(input:checked) {
  border-color: var(--hop);
  background: color-mix(in srgb, var(--hop) 14%, var(--surface));
  color: var(--hop-dark);
}
.day-revenue-table a {
  font-weight: 600;
}
.reviews-filters {
  margin: 0;
}
.reviews-filters select {
  min-height: 2.25rem;
}
.traffic-summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.75rem;
}
.traffic-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: var(--surface, #fff);
}
.traffic-card h3 {
  margin: 0;
  font-size: 1rem;
}
.traffic-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.85rem;
  margin: 0.75rem 0 0;
}
.traffic-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.traffic-metrics dt {
  margin: 0;
  color: var(--muted, #6b6b6b);
}
.traffic-metrics dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.traffic-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.traffic-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 240px;
  padding: 1.25rem 0.5rem 0.35rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 39px,
      color-mix(in srgb, var(--line) 70%, transparent) 39px,
      color-mix(in srgb, var(--line) 70%, transparent) 40px
    );
  background-size: 100% 40px;
  background-position: left bottom 2.6rem;
}
.traffic-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  min-width: 2.4rem;
  flex: 1 1 2.4rem;
  max-width: 3.2rem;
}
.traffic-chart-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  width: 70%;
  min-width: 1.1rem;
  max-width: 1.75rem;
  height: 200px;
  margin: 0 auto;
}
.traffic-seg {
  width: 100%;
  flex: 0 0 auto;
}
.traffic-seg-direct {
  background: #c45c4a;
  border-radius: 3px 3px 0 0;
}
.traffic-seg-discovery {
  background: #e8c84a;
}
.traffic-seg-discovery:first-child:last-child,
.traffic-chart-bar > .traffic-seg-discovery:only-child {
  border-radius: 3px;
}
.traffic-seg-discovery:first-child {
  border-radius: 0 0 3px 3px;
}
.traffic-seg-discovery + .traffic-seg-direct {
  border-radius: 3px 3px 0 0;
}
.traffic-seg-single {
  background: #c45c4a;
  border-radius: 3px;
}
.traffic-chart-label {
  display: block;
  min-height: 2.4em;
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
  color: var(--muted, #6b6b6b);
  max-width: 4.5rem;
}
.traffic-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.25rem;
}
.traffic-totals-kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  color: var(--muted, #6b6b6b);
}
.traffic-totals-value {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.traffic-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
}
.traffic-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  vertical-align: -0.1em;
  margin-right: 0.25rem;
}
.traffic-swatch-direct { background: #c45c4a; }
.traffic-swatch-discovery { background: #e8c84a; }
.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.review-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface, #fff);
}
.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.review-stars {
  letter-spacing: 0.05em;
  color: #c47a00;
}
.review-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92em;
}
.review-text {
  margin: 0.55rem 0 0;
  white-space: pre-wrap;
}
.review-reply {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--line);
  background: color-mix(in srgb, var(--surface-2, #f5f5f5) 80%, transparent);
}
.inline-form { display: inline; margin: 0; }
.field-menu-stores,
.field-retail-stores { grid-column: 1 / -1; }
.ms-dropdown {
  position: relative;
  width: 100%;
}
.ms-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ms-dropdown-toggle::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
  flex-shrink: 0;
}
.ms-dropdown.is-open .ms-dropdown-toggle::after {
  transform: rotate(-135deg);
  margin-top: 0.25rem;
}
.ms-dropdown-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-dropdown-panel {
  display: none;
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 16rem;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.ms-dropdown.is-open .ms-dropdown-panel {
  display: block;
}
.ms-dropdown-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.ms-dropdown-panel li {
  margin: 0;
}
.ms-dropdown-panel li label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}
.ms-dropdown-panel li label:hover {
  background: color-mix(in srgb, var(--line) 35%, transparent);
}
.ms-dropdown-panel input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.form-grid-single { grid-template-columns: 1fr; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.unsaved-note {
  display: none;
  margin-left: 6px;
  color: var(--warning);
  font-size: 11px;
}

.is-dirty .unsaved-note { display: inline; }

.data-section + .data-section,
.form-panel + .data-section { margin-top: 20px; }

.alert {
  padding: 10px 12px;
  border: 1px solid;
  border-radius: var(--radius-control);
  font-size: 12px;
}

.alert + .alert { margin-top: 8px; }

.alert-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
}

.alert-warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
}

.alert-info {
  color: var(--info);
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 32%, transparent);
}

.alert-success {
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
}

.message-stack { margin-bottom: 16px; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-cell strong,
.user-cell small { display: block; }

.user-cell small {
  color: var(--muted);
  font-size: 10px;
}

.password-help ul {
  margin: 5px 0 0;
  padding-left: 18px;
}

.two-column-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.two-column-layout .data-section { margin-top: 0; }

.compact-list {
  margin: 20px -18px -18px;
  border-top: 1px solid var(--line);
}

.compact-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
}

.compact-list > div:last-child { border-bottom: 0; }
.compact-list strong,
.compact-list small { display: block; }
.compact-list small {
  color: var(--muted);
  font-size: 10px;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  justify-content: flex-end;
}

.inline-form {
  display: inline;
  margin: 0;
}

.sync-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  background: color-mix(in srgb, var(--surface) 88%, var(--line));
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sync-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 160ms cubic-bezier(.2, .8, .2, 1), background 160ms cubic-bezier(.2, .8, .2, 1);
}

.sync-tabs a:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.sync-tabs a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent);
}

.audit-section-full {
  max-height: none;
}

.audit-section {
  max-height: 680px;
  overflow: auto;
}

.audit-list { padding: 0 16px 16px; }

.audit-list article {
  position: relative;
  display: grid;
  grid-template-columns: 13px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.audit-list article:first-child { border-top: 0; }

.audit-marker {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  background: var(--muted-soft);
  border-radius: 50%;
}

.audit-list strong { font-size: 11px; }

.audit-list p,
.audit-list time {
  display: block;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.audit-filters {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  border-top: 0;
}

.audit-filters .field-search {
  grid-column: span 2;
}

.audit-filter-actions {
  grid-column: 1 / -1;
}

.audit-filter-actions .form-actions {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.audit-journal .table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.audit-table {
  min-width: 760px;
}

.audit-table .audit-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.audit-table .audit-what strong {
  display: block;
  font-size: 14px;
}

.audit-table .audit-what small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.audit-table .audit-object {
  max-width: 360px;
  white-space: normal;
}

.audit-table .audit-ip {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.error-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   Auth / login вЂ” brand-first
   ----------------------------------------------------------------------------- */

.auth-body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in srgb, var(--hop) 28%, transparent), transparent 70%),
    var(--canvas-deep);
}

.auth-main { min-height: 100dvh; }

.auth-layout {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  background: transparent;
}

.brand-auth {
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: 0 0 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.brand-auth .brand-logo {
  height: 26px;
  max-width: min(100%, 280px);
}

.auth-card {
  display: flex;
  width: 100%;
  max-width: 360px;
  min-height: 0;
  flex-direction: column;
  justify-content: flex-start;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.auth-card > div:first-child { margin-bottom: 8px; }

.auth-card h2 {
  margin-bottom: 4px;
  font-size: 1.25rem;
}

.auth-card > div:first-child > p:last-child,
.auth-help { color: var(--muted); }

.auth-form { margin-top: 18px; }
.auth-form .field { margin-bottom: 15px; }
.auth-form .field input { min-height: 44px; }

.auth-help {
  margin: 16px 0 0;
  font-size: 11px;
  text-align: center;
}

.auth-layout.is-ready .auth-card {
  animation: auth-rise-card calc(var(--dur-enter) + 40ms) var(--ease-out) both;
  animation-delay: 80ms;
}

@keyframes auth-rise-card {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.success-state {
  max-width: 560px;
  margin: 12vh auto 0;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}

.success-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  place-items: center;
  color: var(--success);
  background: var(--success-bg);
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
}

.error-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.success-state p:not(.eyebrow) { color: var(--muted); }

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .filter-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-search { grid-column: span 2; }
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px; }
  .two-column-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  body.drawer-open { overflow: hidden; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--dur-ui) var(--ease-out);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .drawer-open .sidebar { transform: none; box-shadow: 12px 0 32px rgba(0, 0, 0, 0.28); }

  .drawer-backdrop {
    position: fixed;
    z-index: var(--z-drawer-backdrop);
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    background: rgba(10, 14, 12, 0.52);
    border: 0;
  }

  .drawer-open .drawer-backdrop { display: block; }

  .app-column { margin-left: 0; }
  .topbar {
    box-sizing: border-box;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 16px 0;
  }
  .menu-button {
    display: grid;
    margin-right: 6px;
  }
  body:has(.app-dock) .menu-button {
    display: none !important;
  }

  .main-content,
  .main-content.report-main {
    padding: 24px 18px calc(44px + env(safe-area-inset-bottom, 0px));
  }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }

  .form-grid,
  .form-grid-users { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .auth-layout { grid-template-columns: 1fr; }
  .auth-card {
    min-height: 100dvh;
    max-width: none;
    border-left: 0;
    padding: 10vh max(24px, calc((100vw - 440px) / 2));
  }
}

@media (max-width: 900px) {
  :root {
    --table-sticky-top: 0px;
  }

  .topbar {
    box-sizing: border-box;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
  }

  .freshness small { display: none; }
  .freshness strong {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profile { gap: 6px; }

  .main-content,
  .main-content.report-main {
    padding: 20px 12px calc(36px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.cabinet-bottom-nav) .main-content,
  body:has(.cabinet-bottom-nav) .main-content.report-main,
  body:has(.app-dock) .main-content,
  body:has(.app-dock) .main-content.report-main {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.cabinet-bottom-nav) .menu-button,
  body:has(.retail-bottom-nav) .menu-button {
    display: none !important;
  }

  body:has(.cabinet-bottom-nav) .app-dock.retail-bottom-nav {
    display: none !important;
  }

  .wiki-link { display: none; }
  .wiki-link-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

  .page-tabs.analytics-tabs { display: none !important; }
  .report-switch { display: block; margin: 0 0 12px; }
  body:has(.retail-bottom-nav):not(:has(.cabinet-bottom-nav)) .topbar-themes {
    display: none;
  }
  body:has(.retail-bottom-nav):not(:has(.cabinet-bottom-nav)) .retail-desk-tabs {
    display: none !important;
  }

  .page-tabs {
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .page-tabs::-webkit-scrollbar { display: none; }
  .page-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
  }

  .app-dock {
    position: fixed;
    z-index: var(--z-sticky, 30);
    left: 50%;
    right: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: max-content;
    max-width: calc(
      100% - max(24px, env(safe-area-inset-left, 0px) + 12px)
            - max(24px, env(safe-area-inset-right, 0px) + 12px)
    );
    height: auto;
    min-height: 0;
    padding: 6px 8px;
    border: 0.5px solid color-mix(in srgb, var(--ink) 10%, transparent);
    border-radius: 34px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow:
      inset 0 0.5px 0 color-mix(in srgb, #fff 55%, transparent),
      0 0 0 0.5px color-mix(in srgb, var(--ink) 4%, transparent),
      0 12px 36px -14px rgba(20, 18, 12, 0.45);
    backdrop-filter: saturate(200%) blur(36px);
    -webkit-backdrop-filter: saturate(200%) blur(36px);
  }
  .app-dock .dock-liquid {
    position: absolute;
    top: 6px;
    left: 0;
    z-index: 0;
    width: 64px;
    height: 58px;
    border-radius: 20px;
    pointer-events: none;
    background: color-mix(in srgb, var(--ink) 10%, transparent);
    box-shadow: inset 0 0.5px 0 color-mix(in srgb, #fff 45%, transparent);
    will-change: transform, width, height, border-radius;
  }
  .app-dock .dock-item {
    appearance: none;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: auto;
    min-width: 64px;
    max-width: 84px;
    height: 58px;
    min-height: 58px;
    margin: 0;
    padding: 6px 8px;
    gap: 3px;
    border: 0;
    border-radius: 20px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 160ms cubic-bezier(.2, .8, .2, 1);
  }
  .app-dock .dock-glyph {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    background: none;
    transition: transform 160ms cubic-bezier(.2, .8, .2, 1);
  }
  .app-dock .dock-ic {
    width: 26px;
    height: 26px;
    stroke-width: 1.7;
  }
  .app-dock .lord-nav-ic.lord-dock {
    width: 30px;
    height: 30px;
  }
  .app-dock .dock-item[aria-current="page"],
  .app-dock .dock-item.is-current {
    color: var(--hop);
    background: transparent;
  }
  .app-dock .dock-item[aria-current="page"] .dock-ic,
  .app-dock .dock-item.is-current .dock-ic {
    stroke-width: 2.15;
  }
  .app-dock .dock-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 0;
    box-shadow: none;
  }
  .app-dock .dock-profile.is-current .dock-avatar {
    box-shadow: 0 0 0 1.5px var(--hop);
  }
  .app-dock .dock-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    z-index: 1;
    display: grid;
    place-items: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--danger);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 82%, transparent);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    pointer-events: none;
  }

  body:has(.app-dock) .topbar {
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    pointer-events: none;
  }
  body:has(.app-dock) .topbar .profile { margin: 0; }
  body:has(.app-dock) .topbar > *:not(.profile),
  body:has(.app-dock) .topbar .profile > :not([data-profile-menu]) {
    display: none !important;
  }
  /* Единый safe-area под чёлкой (Розница, ИПР, всё с dock): непрозрачная крышка + отступ */
  body:has(.app-dock) .app-shell::before {
    content: "";
    position: fixed;
    z-index: calc(var(--z-sticky, 30) + 20);
    top: 0;
    left: 0;
    right: 0;
    height: max(env(safe-area-inset-top, 0px), 47px);
    pointer-events: none;
    background: var(--bg, #f6f5f2);
  }
  body:has(.app-dock) .main-content,
  body:has(.app-dock) .main-content.report-main {
    padding-top: calc(max(env(safe-area-inset-top, 0px), 47px) + 10px);
  }
  .app-dock a:active .dock-glyph,
  .app-dock button:active .dock-glyph { transform: scale(0.92); }
  .app-dock .dock-label {
    flex: none;
    height: 14px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 14px;
  }
  .app-dock .dock-item[aria-current="page"] .dock-label,
  .app-dock .dock-item.is-current .dock-label {
    font-weight: 600;
  }
  .cabinet-bottom-nav-more,
  .retail-bottom-nav-more { display: flex; }
  body:has(.app-dock) #pint-guide-root {
    top: max(4px, env(safe-area-inset-top, 0px));
    right: 2px;
    bottom: auto;
    left: auto;
    flex-direction: column-reverse;
    justify-content: flex-start;
    --pint-size: 72px;
  }
  body:has(.app-dock) #pint-guide-root .pint-figure {
    width: calc(var(--pint-size) + 8px);
    height: calc(var(--pint-size) + 10px);
  }
  body:has(.app-dock) #pint-guide-root .pint-bubble {
    border-radius: 18px 8px 18px 18px;
  }

  .topbar-themes {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 2px;
    padding: 3px;
    border: 0.5px solid color-mix(in srgb, var(--ink) 8%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
  }
  .topbar-theme {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
  }
  .topbar-theme .ui-theme-swatch {
    width: 18px;
    height: 18px;
    margin: 0;
  }
  .topbar-theme[aria-checked="true"] {
    border-color: var(--hop);
    background: var(--hop-wash);
  }
  .topbar-theme:focus-visible {
    outline: 2px solid var(--hop);
    outline-offset: 2px;
  }

  .main-content.is-swiping {
    transition: none;
    will-change: transform;
  }
  .main-content {
    transition: transform 180ms cubic-bezier(.2, .8, .2, 1);
  }

  .phone-coach {
    position: fixed;
    z-index: 28;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 0.5px solid color-mix(in srgb, var(--ink) 8%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 0 10px 28px -16px rgba(20, 18, 12, 0.4);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    color: var(--ink);
  }
  .phone-coach.is-on { display: flex; }
  .phone-coach p {
    margin: 0;
    flex: 1;
    font-size: 13.5px;
    line-height: 1.35;
  }
  .phone-coach-ok {
    flex: none;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: var(--hop);
    color: var(--on-hop, #2b1d04);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .menu-slots-table,
  .screens-stores-table,
  .reviews-geo-table,
  .reviews-traffic-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .menu-slots-table thead,
  .screens-stores-table thead,
  .reviews-geo-table thead,
  .reviews-traffic-table thead { display: none; }
  .menu-slots-table tbody,
  .screens-stores-table tbody,
  .reviews-geo-table tbody,
  .reviews-traffic-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .menu-slots-table tbody tr,
  .screens-stores-table tbody tr,
  .reviews-geo-table tbody tr,
  .reviews-traffic-table tbody tr {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .menu-slots-table td,
  .screens-stores-table td,
  .reviews-geo-table td,
  .reviews-traffic-table td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border: 0;
    white-space: normal;
  }
  .menu-slots-table td::before,
  .screens-stores-table td::before,
  .reviews-geo-table td::before,
  .reviews-traffic-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }
  .reviews-geo-table td:first-child,
  .reviews-traffic-table td:first-child {
    display: block;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
  }
  .reviews-geo-table td:first-child::before,
  .reviews-traffic-table td:first-child::before { content: none; }
  .reviews-geo-table td.numeric,
  .reviews-traffic-table td.numeric {
    text-align: left;
    font-variant-numeric: tabular-nums;
  }
  .reviews-layout .table-wrap {
    overflow: visible;
    max-width: 100%;
  }
  .menu-slots-table td:nth-child(1),
  .menu-slots-table td:nth-child(2),
  .menu-slots-table td:nth-child(3) {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .menu-slots-table td:nth-child(1)::before,
  .menu-slots-table td:nth-child(2)::before { content: none; }
  .menu-slots-table tbody tr:not(:has(.menu-slot-active:checked)) td:nth-child(n+4) {
    display: none;
  }
  .screens-stores-table td:last-child {
    display: block;
    padding-top: 10px;
  }
  .screens-stores-table td:last-child::before { content: none; }
  .screens-stores-table .button-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }
  form[data-menu-slots-form] .form-actions {
    position: sticky;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    margin: 16px -12px 0;
    padding: 12px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-top: 1px solid var(--line);
  }
  form[data-menu-slots-form] .form-actions .button {
    min-height: 44px;
  }

  /* iOS не зумит страницу при фокусе, если шрифт ≥16px */
  .main-content input:not([type="checkbox"]):not([type="radio"]),
  .main-content select,
  .main-content textarea,
  .filter-dialog input:not([type="checkbox"]):not([type="radio"]),
  .filter-dialog select,
  .filter-dialog textarea {
    font-size: 16px;
  }

  .button,
  .filter-trigger,
  .icon-button {
    min-height: 44px;
  }

  .page-heading {
    display: block;
    margin-bottom: 18px;
  }

  .page-heading-tools {
    display: grid;
    gap: 12px;
    margin-top: 14px;
  }

  .page-heading-tools .button-export,
  .page-export-group {
    width: auto;
    max-width: 100%;
  }

  .dash .table-wrap,
  .report-main .table-wrap:has(> .data-table) {
    overflow-x: visible;
  }

  /*
   * Карточки строк только у «голых» data-table.
   * report-table / ipr-table / kitchen-table / pulse — свои мобильные раскладки;
   * иначе .report-main .data-table перебивает их по специфичности (0,2,1 > 0,1,2).
   */
  .dash .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table),
  .report-main .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .dash .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) thead,
  .report-main .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) thead {
    display: none;
  }

  .dash .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) tbody,
  .report-main .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .dash .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) tr,
  .report-main .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) tr {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .dash .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) td,
  .report-main .data-table:not(.report-table):not(.ipr-table):not(.kitchen-table):not(.pulse-yo-table):not(.menu-slots-table):not(.screens-stores-table) td {
    display: block;
    border: 0;
    padding: 0;
  }

  /* Старый ИПР · сводка KPI: карточки «подпись | крупная цифра» */
  .report-main .ipr-kpi-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) thead { display: none; }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 14px;
    padding: 14px 16px;
    min-height: 56px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) td {
    display: block;
    border: 0;
    padding: 0;
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) td:first-child {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-soft);
    line-height: 1.3;
  }
  .report-main .data-table.ipr-kpi-table:not(.ipr-kpi-weekly) td:last-child {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono, ui-monospace, monospace);
  }
  .report-main .data-table.ipr-kpi-weekly {
    min-width: 36rem;
  }
  /* План / матрица / остатки ИПР — горизонтальный скролл, не ломаные карточки */
  .report-main .ipr-panel-plan .table-wrap,
  .report-main .ipr-panel-stock .table-wrap,
  .report-main .ipr-panel-matrix .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-export-group .export-option {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .page-heading > .button,
  .page-heading > form,
  .page-heading > .status-badge { margin-top: 14px; }

  .page-heading > form .button { width: 100%; }
  .period-summary {
    min-width: 0;
    margin-top: 0;
  }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi {
    min-height: 108px;
    padding: 14px;
  }
  .kpi strong { font-size: 1.5rem; }

  .action-row {
    min-height: 64px;
    grid-template-columns: 34px 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .action-row small { font-size: 10px; }
  .action-icon {
    width: 30px;
    height: 30px;
  }

  .filter-form {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .field-search { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .filter-actions .button { flex: 1; }
  .summary-hint { display: none; }

  .form-panel { padding: 14px; }
  .form-grid,
  .form-grid-users { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .unsaved-note {
    width: 100%;
    margin: 3px 0 0;
  }

  .data-section { padding-top: 0; }
  .data-section > .section-heading { padding: 12px 12px 10px; }
  .section-heading-row {
    display: grid;
    gap: 6px;
  }
  .result-note { justify-self: start; }

  .scroll-hint-desktop { display: none; }
  .scroll-hint-mobile {
    display: block;
    padding: 0 4px 12px;
    font-size: 13px;
  }

  /* Card stack: full-width fields (desktop col-% widths must not leak) */
  .report-table-wrap {
    background: none;
    border-top: 0;
    border-bottom: 0;
    container-type: normal;
  }

  .report-table,
  .report-table-autorder,
  .report-table-oos {
    display: block;
    width: 100%;
    min-width: 0 !important;
    table-layout: auto;
  }

  .report-table thead { display: none; }

  .report-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .report-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .report-table tbody tr:hover td,
  .report-table tbody tr:focus-within td {
    background: transparent;
  }

  .report-table tbody tr td.pf-dev-pos {
    background: color-mix(in srgb, #3d9a5f 22%, var(--surface));
  }

  .report-table tbody tr td.pf-dev-neg {
    background: color-mix(in srgb, #c23b3b 18%, var(--surface));
  }

  .report-table-abc tbody tr.abc-row-high-margin {
    background: color-mix(in srgb, #3d9a5f 22%, var(--surface));
    box-shadow: inset 4px 0 0 #2f7d4a, var(--shadow);
  }

  .report-table-abc tbody tr.abc-row-high-margin td {
    background: transparent;
  }

  .report-table tbody tr.report-empty-row {
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .report-table tbody tr.report-empty-row td {
    display: block;
    width: 100% !important;
    padding: 0;
    border: 0;
  }

  .report-table th:first-child,
  .report-table td:first-child {
    position: static;
    left: auto;
    min-width: 0;
    max-width: none;
    box-shadow: none;
  }

  .report-table .col-store,
  .report-table .col-sku,
  .report-table .col-name,
  .report-table .col-meta,
  .report-table .col-num,
  .report-table .col-order,
  .report-table-oos .col-name,
  .report-table-oos .col-num,
  .report-table-oos .col-order {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .report-table td {
    display: grid;
    grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: start;
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 48px;
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
    line-height: 1.4;
    text-align: left !important;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: break-word;
    word-break: normal;
  }
  /* Темы (glass 14.5px) не должны ужимать цифры на телефоне */
  html[data-ui] .report-table td {
    font-size: 16px;
  }
  html[data-ui] .report-table td.col-name strong {
    font-size: 17px;
  }
  html[data-ui] .report-table td.col-order,
  html[data-ui] .report-table td.value-strong {
    font-size: 1.25rem;
  }

  .report-table th.col-meta,
  .report-table td.col-meta {
    display: grid;
  }

  .report-table td:last-child { border-bottom: 0; }

  .report-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    min-width: 0;
  }

  .report-table td[data-label="№"] { display: none; }

  .report-table td.col-name {
    grid-template-columns: 1fr;
    gap: 4px;
    order: -2;
    padding-top: 14px;
    padding-bottom: 12px;
    background: color-mix(in srgb, var(--surface-subtle) 55%, var(--surface));
    border-bottom: 1px solid var(--line-strong);
  }

  .report-table td.col-name::before {
    color: var(--muted-soft);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .report-table td.col-name strong {
    display: block;
    max-width: none;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    font-family: var(--font-brand);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    overflow-wrap: break-word;
  }

  .report-table td.col-store {
    order: -3;
    grid-template-columns: 1fr;
    gap: 4px;
    padding-top: 12px;
    padding-bottom: 10px;
    background: var(--charcoal);
    color: #f5f2ea;
    border-bottom: 0;
    font-weight: 600;
    overflow-wrap: break-word;
  }

  .report-table td.col-store::before {
    color: var(--hop-soft);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .report-table td.col-sku {
    order: -1;
    align-items: center;
    background: color-mix(in srgb, var(--hop-wash) 40%, var(--surface));
  }

  .report-table .sku { font-size: 14px; }

  .report-table td.col-num {
    grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr);
  }

  .report-table td.col-order,
  .report-table td.value-strong {
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 56px;
    background: var(--hop-wash) !important;
    border-top: 1px solid color-mix(in srgb, var(--hop) 28%, var(--line));
    font-size: 1.25rem;
    font-weight: 700;
  }

  .report-table td.col-order::before,
  .report-table td.value-strong::before {
    color: var(--hop-dark);
    font-size: 14px;
  }

  .report-table .product-cell strong {
    -webkit-line-clamp: unset;
    max-width: none;
    white-space: normal;
  }

  .report-table .status-badge {
    font-size: 13px;
    padding: 4px 8px;
  }

  .pagination {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px 4px 0;
  }
  .pagination > span {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
    font-size: 13px;
  }
  .pagination .button {
    min-height: 44px;
    justify-content: center;
  }

  .auth-card { padding: 40px 20px; }
  .success-state {
    margin-top: 5vh;
    padding: 28px 20px;
  }
}

/* Телефон: плотность — меньше воздуха, без лишних подписей */
@media (max-width: 900px) {
  .main-content,
  .main-content.report-main {
    padding-left: 10px;
    padding-right: 10px;
  }
  /* Без dock: topbar уже с safe-area */
  body:not(:has(.app-dock)) .main-content,
  body:not(:has(.app-dock)) .main-content.report-main {
    padding-top: 12px;
  }
  body:has(.app-dock) .main-content,
  body:has(.app-dock) .main-content.report-main {
    padding-top: calc(max(env(safe-area-inset-top, 0px), 47px) + 10px);
  }

  .page-lead,
  .ipr-goal-flow-hint,
  .scroll-hint-mobile,
  .scroll-hint-desktop,
  .summary-hint,
  .pulse-section-hint,
  .section-hint,
  .ipr-effect-help,
  .ipr-hero-note {
    display: none !important;
  }

  /* Пояснения без ссылок — шум; meta/ссылки оставляем */
  .section-heading p:not(:has(a)):not(.section-meta),
  .dash-section-heading p:not(:has(a)):not(.section-meta) {
    display: none;
  }
  .section-heading p.section-meta {
    display: block;
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.3;
    color: var(--muted);
  }

  .page-heading {
    margin-bottom: 10px;
    gap: 8px;
  }
  .page-heading:has(+ .page-tabs),
  .page-heading:has(+ .sync-tabs),
  .page-heading:has(+ .retail-desk-tabs),
  .report-main .page-heading:has(+ .sync-tabs),
  .report-main .page-heading:has(+ .page-tabs) {
    margin-bottom: 8px;
  }
  html[data-ui] .page-heading h1,
  html[data-ui="glass"] h1,
  html[data-ui="glass"] .page-heading h1,
  html[data-ui="light"] .page-heading h1,
  html[data-ui="dark"] .page-heading h1 {
    font-size: 1.35rem !important;
    letter-spacing: -0.02em;
    line-height: 1.2;
  }
  .page-heading-tools {
    gap: 8px;
    margin-top: 8px;
  }
  .page-heading > .button,
  .page-heading > form,
  .page-heading > .status-badge {
    margin-top: 8px;
  }

  .sync-tabs,
  .report-main .sync-tabs,
  .report-main .ipr-surface-tabs {
    margin: 0 0 10px;
    padding: 3px;
    gap: 2px;
    border-radius: 999px;
  }
  .sync-tabs a,
  .report-main .sync-tabs.ipr-step-tabs a {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
    border-radius: 999px;
  }

  .page-tabs {
    margin: 0 0 10px;
    gap: 4px;
  }
  .page-tab {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .data-section + .data-section,
  .form-panel + .data-section {
    margin-top: 12px;
  }
  .data-section > .section-heading {
    padding: 10px 12px 6px;
  }
  .section-heading {
    margin-bottom: 8px;
    gap: 2px;
  }
  .section-heading h2,
  .dash-section-title {
    font-size: 1rem;
    line-height: 1.25;
  }
  .section-heading p:has(a) {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.3;
  }
  .section-heading-row {
    gap: 4px;
  }

  .kpi-grid { gap: 0; }
  .kpi {
    min-height: 0;
    padding: 10px 12px;
  }
  .kpi strong { font-size: 1.28rem; }
  .kpi span { font-size: 0.78rem; }

  .filter-panel { margin-bottom: 12px; }
  .period-summary .filter-trigger {
    min-height: 40px;
    padding: 8px 12px;
  }
  .period-summary .filter-trigger { margin-top: 0; }

  .reviews-layout { gap: 0.75rem; }
  .review-item { padding: 12px 14px; }
  .review-list { gap: 10px; }

  .report-main .data-section.ipr-hero-card,
  .report-main .data-section:has(.ipr-sheet-head),
  .report-main .data-section:has(.ipr-pulse),
  .report-main .data-section:has(.ipr-sheet-tasks),
  .report-main .data-section:has(.ipr-effect-help) {
    padding: 12px 14px 14px;
  }

  .dash-pair,
  .dash-rank-single,
  .dash-charts,
  .dash-rank-board {
    gap: 12px;
  }
  .dash-plan-hero {
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border-left-width: 4px;
  }
  .dash-plan-hero-top { gap: 8px; }
  .dash-plan-title {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
  }
  .dash-plan-hero-main,
  .dash-plan-hero-tri,
  .dash-plan-hero-main.pulse-net-grid {
    gap: 8px 12px;
  }
  .pulse-net-grid .dash-plan-fact-value,
  .pulse-net-grid .dash-plan-pct-value,
  .dash-plan-fact-value,
  .dash-plan-pct-value {
    font-size: 1.15rem;
  }
  .dash-plan-pct-label,
  .dash-plan-fact-label {
    font-size: 0.72rem;
  }
  .dash-pulse {
    gap: 12px;
  }
  .pulse-attention {
    padding: 0.65rem 0.8rem;
  }
  .oos-loss-banner {
    margin-bottom: 12px;
    padding: 12px 14px;
  }

  .message-stack { margin-bottom: 10px; }
  .pagination { padding-top: 10px; gap: 8px; }

  .action-row {
    min-height: 52px;
    padding: 8px 10px;
  }

  .form-panel { padding: 12px; }
  .traffic-summary-grid { gap: 0.75rem; margin-top: 0.5rem; }
  .traffic-card { padding: 0.7rem 0.85rem; }

  .phone-coach {
    padding: 10px 12px;
    gap: 8px;
  }
  .phone-coach p { font-size: 12.5px; }
}

@media (max-width: 400px) {
  .filter-form { grid-template-columns: 1fr; }
  .field-search,
  .filter-actions { grid-column: auto; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi {
    min-height: 100px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .kpi:nth-child(3) { border-bottom: 1px solid var(--line); }
  .kpi:last-child { border-bottom: 0; }

  /* Узкий телефон: всё равно подпись слева / цифра справа, не стопка */
  .report-table td,
  .report-table td.col-num {
    grid-template-columns: minmax(0, 6.75rem) minmax(0, 1fr);
    gap: 6px 10px;
  }

  .report-table td.col-order,
  .report-table td.value-strong {
    grid-template-columns: 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .auth-layout.is-ready .auth-card,
  .app-body .main-content.is-ready > * {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media print {
  .sidebar,
  .topbar,
  .filter-panel,
  .pagination,
  .page-heading .button,
  .page-heading .button-export { display: none !important; }
  .app-column { margin: 0; }
  .main-content {
    max-width: none;
    padding: 0;
  }
  .data-section {
    border: 0;
    box-shadow: none;
  }
  .table-wrap { overflow: visible; }
  body { background: #fff; }
}

/* РРџР  shell */
.ipr-section + .ipr-section { margin-top: 16px; }

.ipr-board {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  grid-template-areas:
    "kpi"
    "gross"
    "plan"
    "stock"
    "matrix";
  gap: 14px;
  align-items: start;
  justify-items: stretch;
}

.ipr-board > .ipr-section { margin-top: 0; }

.ipr-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  /* Скругление сверху и снизу как у «План по выручке» — иначе низ квадратный */
  overflow: hidden;
}

.ipr-panel-kpi { grid-area: kpi; }
.ipr-panel-plan { grid-area: plan; }
.ipr-panel-gross { grid-area: gross; }
.ipr-panel-stock { grid-area: stock; }
.ipr-panel-matrix { grid-area: matrix; }

/* РџРѕРЅРµРґРµР»СЊРЅР°СЏ РґРёРЅР°РјРёРєР°: РїРѕРєР°Р·Р°С‚РµР»Рё РЅР° РІСЃСЋ С€РёСЂРёРЅСѓ, РІР°Р»РѕРІР°СЏ РЅРёР¶Рµ */
.ipr-board.is-weekly {
  grid-template-columns: 1fr;
  grid-template-areas:
    "kpi"
    "gross"
    "plan"
    "stock"
    "matrix";
}

.ipr-kpi-weekly {
  min-width: max(100%, 40rem);
  table-layout: auto;
}

/* Понедельно: не наследовать «узкую 2-ю колонку» от сводки Показателей */
.ipr-kpi-weekly th:nth-child(n+2),
.ipr-kpi-weekly td:nth-child(n+2) {
  width: auto;
  min-width: 7.5rem;
  padding-left: 12px;
  padding-right: 12px;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.ipr-kpi-weekly thead th {
  /* Без «карточной» тени — иначе первая неделя выглядит парящим блоком */
  box-shadow: inset 0 -1px 0 var(--line-strong);
  white-space: nowrap;
  vertical-align: bottom;
  line-height: 1.25;
}

.ipr-kpi-weekly th:first-child,
.ipr-kpi-weekly td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface, #fff);
  box-shadow: 1px 0 0 var(--line);
  text-align: left;
  white-space: nowrap;
}

.ipr-kpi-weekly thead th:first-child {
  z-index: 3;
}

.filter-weekly {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 600;
}

.ipr-weekly-brief {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 8px);
  background: color-mix(in srgb, var(--surface-subtle, #f5f5f0) 80%, var(--surface, #fff));
  border: 1px solid color-mix(in srgb, var(--line, #ddd) 70%, transparent);
}

.ipr-weekly-brief strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.ipr-weekly-brief ul {
  margin: 0;
  padding-left: 1.15rem;
}

.ipr-weekly-brief li {
  margin: 0.25rem 0;
  line-height: 1.35;
  font-size: 0.92rem;
}

.ipr-panel > .section-heading {
  padding-bottom: 8px;
}

.ipr-panel > .section-heading p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ipr-panel .table-wrap {
  flex: 0 0 auto;
  width: 100%;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.ipr-panel-kpi .table-wrap,
.ipr-panel-plan .table-wrap {
  max-height: none;
}

.ipr-panel-matrix .table-wrap {
  max-height: none;
}

.ipr-empty-hint {
  margin: 0;
  padding: 0 16px 16px;
}

/* Две колонки уже с ~1200px: узкие Показатели, Валовая на всю оставшуюся ширину */
@media (min-width: 1200px) {
  .ipr-board:not(.is-weekly) {
    grid-template-columns: 17.5rem minmax(0, 1fr);
    grid-template-areas:
      "kpi gross"
      "plan plan"
      "stock stock"
      "matrix matrix";
  }

  .ipr-board:not(.is-weekly) .ipr-panel-kpi,
  .ipr-board:not(.is-weekly) .ipr-panel-gross {
    height: auto;
    max-height: none;
  }

  .ipr-board:not(.is-weekly) .ipr-panel-kpi .table-wrap,
  .ipr-board:not(.is-weekly) .ipr-panel-gross .table-wrap,
  .ipr-board:not(.is-weekly) .ipr-panel-stock .table-wrap,
  .ipr-board:not(.is-weekly) .ipr-panel-plan .table-wrap,
  .ipr-board:not(.is-weekly) .ipr-panel-matrix .table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
  }
}

.ipr-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding: 0 16px 16px;
}

.ipr-meta div {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.ipr-meta dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: var(--text-cap);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ipr-meta dd {
  margin: 0;
  font-weight: 600;
}

.ipr-table .ipr-hint {
  max-width: none;
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: 1.35;
  white-space: normal;
}

.ipr-table .ipr-hint span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* IPR grids: natural column widths, no forced fixed layout */
.ipr-table {
  min-width: 0;
  width: 100%;
  table-layout: auto;
  font-size: var(--text-body-compact);
}

.ipr-table th,
.ipr-table td {
  padding: 8px 12px;
  line-height: 1.35;
  vertical-align: middle;
}

.ipr-table th {
  position: static;
  color: var(--ink-soft);
  background: #eef2ef;
  box-shadow: none;
  text-align: left;
}

.ipr-table th.numeric {
  text-align: right;
}

.ipr-table th.is-sortable,
.data-table th.is-sortable {
  cursor: pointer;
  user-select: none;
}

.ipr-table th.is-sortable:hover,
.ipr-table th.is-sortable:focus-visible,
.data-table th.is-sortable:hover,
.data-table th.is-sortable:focus-visible {
  color: var(--hop-dark, #8a4f12);
}

.ipr-table th.is-sortable .sort-cue,
.data-table th.is-sortable .sort-cue {
  color: var(--muted, #7a8a82);
  font-weight: 500;
}

.ipr-table th[aria-sort] .sort-cue,
.data-table th[aria-sort] .sort-cue {
  color: var(--hop, #c47818);
}

.ipr-table td:first-child {
  color: var(--ink);
  font-weight: 600;
}

.ipr-table .numeric {
  font-size: 0.9em;
  font-weight: 500;
  letter-spacing: 0;
}

/* KPI: Р·РЅР°С‡РµРЅРёСЏ СЂСЏРґРѕРј СЃ РїРѕРґРїРёСЃСЊСЋ, Р±РµР· СЂР°СЃС‚СЏРЅСѓС‚РѕР№ РїСѓСЃС‚РѕС‚С‹ */
.ipr-kpi-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.ipr-kpi-table {
  width: 100%;
  table-layout: auto;
}

.ipr-kpi-table th,
.ipr-kpi-table td {
  padding: 8px 12px;
}

.ipr-kpi-table th:nth-child(1),
.ipr-kpi-table td:nth-child(1) {
  width: auto;
  padding-right: 16px;
}

/* Только сводка (2 колонки). Понедельная таблица — см. .ipr-kpi-weekly */
.ipr-kpi-table:not(.ipr-kpi-weekly) th:nth-child(2),
.ipr-kpi-table:not(.ipr-kpi-weekly) td:nth-child(2) {
  width: 1%;
  padding-left: 8px;
  white-space: nowrap;
  text-align: right;
}

.ipr-plan-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
}

.ipr-plan-table th,
.ipr-plan-table td {
  white-space: nowrap;
}

.ipr-plan-table th:nth-child(1),
.ipr-plan-table td:nth-child(1) { width: auto; }
.ipr-plan-table th:nth-child(2),
.ipr-plan-table td:nth-child(2),
.ipr-plan-table th:nth-child(3),
.ipr-plan-table td:nth-child(3),
.ipr-plan-table th:nth-child(4),
.ipr-plan-table td:nth-child(4),
.ipr-plan-table th:nth-child(5),
.ipr-plan-table td:nth-child(5),
.ipr-plan-table th:nth-child(6),
.ipr-plan-table td:nth-child(6) { width: auto; }

.ipr-plan-input {
  width: 100%;
  max-width: 9.5rem;
  margin-left: auto;
  display: block;
  min-height: 32px;
  padding: 4px 8px;
  text-align: right;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.ipr-plan-input:focus {
  border-color: var(--hop);
  outline: 2px solid color-mix(in srgb, var(--hop) 35%, transparent);
  outline-offset: 1px;
}

.ipr-plan-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 16px 16px;
}

.ipr-matrix-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
}

.ipr-matrix-table th,
.ipr-matrix-table td {
  white-space: nowrap;
}

.ipr-matrix-table th:nth-child(1),
.ipr-matrix-table td:nth-child(1) { width: auto; min-width: 12rem; }
.ipr-matrix-table th:nth-child(2),
.ipr-matrix-table td:nth-child(2),
.ipr-matrix-table th:nth-child(3),
.ipr-matrix-table td:nth-child(3),
.ipr-matrix-table th:nth-child(4),
.ipr-matrix-table td:nth-child(4),
.ipr-matrix-table th:nth-child(5),
.ipr-matrix-table td:nth-child(5) { width: auto; }

/* 1С group tables: на всю ширину карточки */
.ipr-onec-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

.ipr-onec-table th,
.ipr-onec-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: keep-all;
}

.ipr-onec-table th:first-child,
.ipr-onec-table td:first-child {
  width: 32%;
  min-width: 10rem;
  max-width: none;
  padding-right: 16px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.ipr-onec-table th:not(:first-child),
.ipr-onec-table td:not(:first-child) {
  width: auto;
}

.ipr-notes {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.ipr-note {
  display: grid;
  gap: 6px;
}

.ipr-note span {
  color: var(--muted);
  font-size: var(--text-meta);
}

.ipr-note textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.ipr-report-source {
  margin: 0;
  padding: 10px 16px 0;
  color: var(--muted);
  font-size: var(--text-meta);
}

.ipr-onec-table tbody tr.ipr-total-row td {
  border-top: 2px solid var(--line-strong);
  background: color-mix(in srgb, var(--hop-wash) 56%, var(--surface));
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ipr-onec-table tbody tr.ipr-total-row td:first-child strong {
  font-family: var(--font-brand);
  font-weight: 700;
}

.ipr-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.ipr-attach-slot {
  display: grid;
  gap: 6px;
  min-height: 120px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  align-content: start;
}

.ipr-attach-slot span,
.ipr-attach-slot em {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: normal;
}

.ipr-attach-slot em { font-style: italic; }

/* Home dashboard вЂ” brand overview */
.dash {
  --dash-gap: 16px;
  --dash-gap-lg: 22px;
  --dash-rail: minmax(0, 1fr);
  display: grid;
  gap: var(--dash-gap-lg);
  align-content: start;
}

.dash-heading {
  margin: 0;
  padding: 0;
}

/* Пульс / дашборд: заголовок и период всегда в одну строку */
.page-heading.dash-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: nowrap;
}

.page-heading.dash-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.page-heading.dash-heading .page-heading-tools {
  display: flex;
  flex: 0 1 auto;
  margin-top: 0;
  max-width: min(58%, 17rem);
}

.page-heading.dash-heading .dash-period-wrap {
  align-items: stretch;
  width: auto;
  max-width: 100%;
}

.page-heading.dash-heading .dash-period-btn {
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.page-heading.dash-heading .dash-period-note,
.page-heading.dash-heading .dash-sync-note {
  display: none;
}

.dash-period-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 11.5rem;
  min-height: 44px;
  padding: 6px 14px;
  text-align: left;
  line-height: 1.2;
}

.dash-period-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}

.dash-period-note {
  margin: 0;
  max-width: 14rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: right;
}

.dash-period-btn-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-period-btn-range {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.dash-kpi-section,
.dash-charts-section {
  display: grid;
  gap: 10px;
  margin: 0;
  min-width: 0;
}

.dash-section-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 16px;
  min-height: 44px;
  margin: 0;
}

.dash-section-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.dash-section-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-pair {
  display: grid;
  grid-template-columns: repeat(2, var(--dash-rail));
  gap: var(--dash-gap);
  align-items: stretch;
  min-width: 0;
}

.dash-rank-single {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--dash-gap);
  min-width: 0;
}

.kpi-grid.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
}

.dash-kpi-grid .kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  min-height: 108px;
  min-width: 0;
  padding: 16px 14px 14px;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  overflow: hidden;
  background: var(--surface);
}

.dash-kpi-grid .kpi:last-child { border-right: 0; }

.dash-kpi-grid .kpi-label {
  margin: 0;
  width: 100%;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.dash-kpi-grid .kpi strong {
  margin: 0;
  width: 100%;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 1.1vw + 0.55rem, 1.35rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.dash-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 1.2em;
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.dash-kpi-delta.is-up { color: var(--success); }
.dash-kpi-delta.is-down { color: var(--danger); }
.dash-kpi-delta.is-empty {
  color: var(--muted-soft);
  font-weight: 500;
}

.dash-kpi-delta.is-up::before,
.dash-kpi-delta.is-down::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  flex: 0 0 auto;
}

.dash-kpi-delta.is-up::before {
  border-width: 0 4px 6px;
  border-color: transparent transparent currentColor;
}

.dash-kpi-delta.is-down::before {
  border-width: 6px 4px 0;
  border-color: currentColor transparent transparent;
}

.dash-charts {
  margin: 0;
}

.dash-charts > .data-section,
.dash-charts > .data-section + .data-section,
.dash-rank-board > .data-section,
.dash-rank-board > .data-section + .data-section {
  margin: 0;
  min-width: 0;
  height: 100%;
}

.dash-board {
  margin: 0;
}

.dash-rank-panel,
.dash-chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
}

.dash-rank-panel .section-heading,
.dash-chart-panel .section-heading {
  margin: 0;
  padding: 14px 18px 8px;
}

.dash-rank-panel .section-heading h2,
.dash-chart-panel .section-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.dash-rank-panel .section-heading p,
.dash-chart-panel .section-heading p {
  display: none;
}

.dash-chart {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 16px;
  min-height: 0;
}

.dash-plot {
  display: block;
  width: 100%;
  height: 180px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
}

.dash-bar {
  fill: var(--hop);
}

.dash-bar.is-highlight {
  fill: var(--hop-dark);
}

.dash-bar-checks {
  fill: color-mix(in srgb, var(--ink-soft) 55%, var(--line));
}

.dash-bar-checks.is-highlight {
  fill: var(--ink);
}

.dash-chart-empty {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 180px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
}

.dash-chart-empty .field-hint { margin: 0; }

.dash-bar-axis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  min-height: 1.1rem;
}

.dash-bar-axis.is-empty {
  min-height: 0;
}

.dash-bar-tick {
  overflow: hidden;
  color: var(--muted-soft);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-bar-tick.is-highlight {
  color: var(--ink-soft);
  font-weight: 600;
}

.dash-rank {
  list-style: none;
  margin: 0;
  padding: 4px 18px 16px;
  flex: 1 1 auto;
}

.dash-rank-row {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1.15fr) minmax(4.5rem, 0.95fr) 7.5rem 3.4rem;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.dash-rank-row:last-child { border-bottom: 0; }

.dash-rank-pos {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dash-rank-row:first-child .dash-rank-pos { color: var(--hop-dark); }
.dash-rank-panel-bottom .dash-rank-row:first-child .dash-rank-pos {
  color: var(--muted);
}

.dash-rank-name {
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-rank-track {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 80%, var(--surface-subtle));
}

.dash-rank-bar {
  display: block;
  width: 100%;
  height: 100%;
}

.dash-rank-fill {
  fill: var(--hop);
}

.dash-rank-fill.is-muted {
  fill: color-mix(in srgb, var(--ink-soft) 45%, var(--line));
}

.dash-rank-value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  justify-self: stretch;
}

.dash-rank-share {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  justify-self: stretch;
}

@media (max-width: 1680px) {
  .kpi-grid.dash-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dash-kpi-grid .kpi {
    border-bottom: 1px solid var(--line);
  }

  .dash-kpi-grid .kpi:nth-child(4n) { border-right: 0; }
  .dash-kpi-grid .kpi:nth-last-child(-n+3):nth-child(4n+1),
  .dash-kpi-grid .kpi:nth-last-child(-n+3):nth-child(4n+2),
  .dash-kpi-grid .kpi:nth-last-child(-n+3):nth-child(4n+3),
  .dash-kpi-grid .kpi:nth-last-child(-n+3):nth-child(4n) {
    border-bottom: 0;
  }
}

@media (max-width: 1100px) {
  .dash-pair {
    grid-template-columns: 1fr;
  }

  .page-heading .dash-grain { width: 100%; }
  .dash-section-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .dash-section-toolbar .dash-grain,
  .dash-grain { display: flex; width: 100%; }
  .dash-grain-btn { flex: 1; text-align: center; }
  /* Не растягивать кнопку периода на всю ширину — ломает строку с заголовком */
  .page-heading:not(.dash-heading) .dash-period-btn { width: 100%; min-width: 0; }
  .page-heading:not(.dash-heading) .dash-period-wrap { align-items: stretch; width: 100%; }
  .dash-period-note { max-width: none; text-align: left; }
}

@media (max-width: 900px) {
  .page-heading.dash-heading {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
  }

  .page-heading.dash-heading .page-heading-tools {
    display: flex;
    margin-top: 0;
    max-width: min(55%, 15rem);
  }

  .page-heading.dash-heading .dash-heading-meta {
    margin-top: 2px;
    font-size: 0.82rem;
  }

  .page-heading.dash-heading .dash-period-btn {
    min-height: 40px;
    min-width: 0;
    padding: 5px 10px;
  }

  .page-heading.dash-heading .dash-period-btn-label {
    font-size: 0.64rem;
  }

  .page-heading.dash-heading .dash-period-btn-range {
    font-size: 0.8rem;
  }
}

@media (max-width: 720px) {
  .kpi-grid.dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-kpi-grid .kpi {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .dash-kpi-grid .kpi:nth-child(2n) { border-right: 0; }
  .dash-kpi-grid .kpi:nth-last-child(-n+2) { border-bottom: 0; }

  .dash-plot,
  .dash-chart-empty {
    height: 158px;
    min-height: 158px;
  }

  .dash-bar-tick { font-size: 0.62rem; }
  .dash-rank { padding: 4px 14px 14px; }
  .dash-rank-row {
    grid-template-columns: 1.5rem minmax(0, 1fr) auto;
    grid-template-areas:
      "pos name value"
      "pos name share"
      "bar bar bar";
    gap: 4px 10px;
    padding: 12px 0;
  }
  .dash-rank-pos { grid-area: pos; align-self: start; padding-top: 2px; }
  .dash-rank-name { grid-area: name; white-space: normal; }
  .dash-rank-track { grid-area: bar; margin-top: 2px; }
  .dash-rank-value { grid-area: value; }
  .dash-rank-share { grid-area: share; min-width: 0; }
}

@media (max-width: 720px) {
  .ipr-meta { padding: 0 8px 12px; }
  .ipr-notes,
  .ipr-attachments { padding: 0 8px 12px; }
  .ipr-report-source { margin: 0 8px 10px; }
  .ipr-table .ipr-hint { max-width: none; }
}

/* Filter / IPR load overlay */
body.is-loading {
  overflow: hidden;
}

.app-load-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--ink, #1a1f1c) 45%, transparent);
  backdrop-filter: blur(2px);
}

.app-load-overlay[hidden] {
  display: none !important;
}

.app-load-card {
  width: min(100%, 420px);
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, #fff);
  box-shadow: var(--shadow);
  text-align: center;
}

.app-load-title {
  margin: 0 0 6px;
  font-family: var(--font-brand);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.app-load-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.app-load-progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 80%, transparent);
  accent-color: var(--hop, #c9852a);
}

.app-load-progress::-webkit-progress-bar {
  background: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: var(--radius-sm);
}

.app-load-progress::-webkit-progress-value {
  background: var(--hop, #c9852a);
  border-radius: var(--radius-sm);
}

.app-load-progress::-moz-progress-bar {
  background: var(--hop, #c9852a);
  border-radius: var(--radius-sm);
}

.app-load-pct {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* =============================================================================
   Changelog / updates вЂ” Notion day groups
   ============================================================================= */

.changelog {
  display: grid;
  gap: 36px;
  max-width: 720px;
}

.changelog-day {
  display: grid;
  gap: 14px;
}

.changelog-day-title {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.changelog-day-title time {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.changelog-day-body {
  display: grid;
  gap: 20px;
  padding-left: 2px;
}

.changelog-block {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.changelog-block-title {
  margin: 0 0 8px;
  font-family: var(--font-brand);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.changelog-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.changelog-item {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 8px 14px;
  align-items: start;
  padding: 6px 0;
  border-bottom: 0;
}

.changelog-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  width: fit-content;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
  background: var(--surface-subtle);
  color: var(--muted);
}

.changelog-item.kind-new .changelog-kind {
  color: var(--hop-dark);
  background: var(--hop-wash);
}
.changelog-item.kind-fix .changelog-kind {
  color: #9b2c2c;
  background: var(--danger-bg);
}
.changelog-item.kind-improve .changelog-kind {
  color: var(--success);
  background: var(--success-bg);
}

.changelog-text {
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 15px;
}

@media (max-width: 640px) {
  .changelog-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.dash.is-partner {
  /* РЎРјРµРЅР° РїР°СЂС‹: Manrope вЂ” С‚РµРєСЃС‚, Source Sans вЂ” Р·Р°РіРѕР»РѕРІРєРё; С†РёС„СЂС‹ вЂ” Plex Mono */
  --font-brand: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-sans: "Manrope", "Source Sans 3", system-ui, sans-serif;
  font-family: var(--font-sans);
}

.dash.is-partner .dash-heading h1 {
  font-family: var(--font-brand);
  font-size: clamp(1.75rem, 1.2vw + 1.35rem, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.dash-section-heading-col {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dash-period-caption {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.3;
}

.dash.is-partner .dash-period-caption {
  font-size: 1.12rem;
  color: var(--ink);
}

.dash-heading-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
}

.dash-sync-note {
  margin: 0;
  max-width: 14rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-partner-stores {
  margin: 0 0 24px;
}

.dash-store-cards {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.dash-store-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow, 0 0 0 1px rgba(20, 18, 12, 0.05), 0 8px 20px -10px rgba(20, 18, 12, 0.12));
}

.dash-store-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.dash-store-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.dash-store-card .button {
  justify-self: start;
}

.dash-plan-hero {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  border-left: 5px solid var(--hop);
}

.dash-plan-hero.is-good { border-left-color: var(--success); }
.dash-plan-hero.is-warn { border-left-color: var(--warning); }
.dash-plan-hero.is-bad { border-left-color: var(--danger); }

.dash-plan-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dash-plan-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(1.65rem, 1.4vw + 1.2rem, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--ink);
}

.dash-plan-hero-main {
  display: grid;
  grid-template-columns: minmax(9rem, 0.85fr) minmax(0, 2.2fr);
  gap: 18px 28px;
  align-items: stretch;
}

.dash-plan-hero-tri {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-plan-fact-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.dash-plan-fact-value {
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 1.5vw + 1rem, 2.2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.dash-plan-pct-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--surface-subtle) 80%, var(--hop-wash, #f3f6ea));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.dash-plan-pct-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.dash-plan-pct-value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 2vw + 1.4rem, 2.85rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}

.dash-plan-hero.is-good .dash-plan-pct-value { color: var(--success); }
.dash-plan-hero.is-warn .dash-plan-pct-value { color: var(--warning); }
.dash-plan-hero.is-bad .dash-plan-pct-value { color: var(--danger); }

.dash.is-partner .dash-section-title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.dash.is-partner .dash-kpi-grid .kpi {
  min-height: 132px;
  gap: 8px;
  padding: 18px 16px 16px;
}

.dash.is-partner .dash-kpi-grid .kpi-label {
  font-family: var(--font-brand);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dash.is-partner .dash-kpi-grid .kpi-value,
.dash.is-partner .dash-kpi-grid .kpi strong {
  font-size: clamp(1.35rem, 1.4vw + 0.85rem, 1.85rem);
  line-height: 1.1;
}

.dash.is-partner .dash-kpi-delta {
  font-size: 0.95rem;
  font-weight: 700;
}

.dash-advisor-section {
  display: grid;
  gap: 12px;
  margin: 0;
  min-width: 0;
}

.dash-advisor-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.dash-insight {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
}

.dash-insight.is-plus {
  background: color-mix(in srgb, var(--success) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 22%, var(--line));
}

.dash-insight.is-minus {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 22%, var(--line));
}

.dash-insight.is-focus {
  background: color-mix(in srgb, var(--accent, #e8a830) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--accent, #e8a830) 28%, var(--line));
}

.dash-insight.is-look {
  background: color-mix(in srgb, var(--hop-dark, #5a6b2f) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--hop-dark, #5a6b2f) 22%, var(--line));
}

.dash-insight.is-llm {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hop) 18%, transparent);
}

.dash-insight-kind {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.35em;
  max-width: 100%;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--surface-subtle) 80%, var(--surface));
  border-radius: 999px;
}

.dash-insight.is-plus .dash-insight-kind {
  color: color-mix(in srgb, var(--success) 72%, var(--ink));
  background: color-mix(in srgb, var(--success) 16%, var(--surface));
}

.dash-insight.is-minus .dash-insight-kind {
  color: color-mix(in srgb, var(--danger) 72%, var(--ink));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}

.dash-insight.is-focus .dash-insight-kind {
  color: color-mix(in srgb, var(--accent, #e8a830) 55%, var(--ink));
  background: color-mix(in srgb, var(--accent, #e8a830) 18%, var(--surface));
}

.dash-insight.is-look .dash-insight-kind {
  color: color-mix(in srgb, var(--hop-dark, #5a6b2f) 65%, var(--ink));
  background: color-mix(in srgb, var(--hop-dark, #5a6b2f) 14%, var(--surface));
}

.dash-insight-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
}

.dash-insight-body {
  display: grid;
  gap: 8px;
  margin: 0;
}

.dash-insight-line {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.dash-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: color-mix(in srgb, var(--hop) 18%, transparent);
  padding: 0 0.22em;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.dash-insight.is-minus .dash-num {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: color-mix(in srgb, var(--danger) 70%, var(--ink));
}

.dash-insight.is-plus .dash-num {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: color-mix(in srgb, var(--success) 65%, var(--ink));
}

.dash-insight-cta {
  align-self: flex-start;
  margin-top: 2px;
}

.dash-chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 18px 8px;
}

.dash-chart-stats div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface-subtle) 75%, var(--surface));
  border-radius: var(--radius-sm);
}

.dash-chart-stats dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.dash-chart-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.2;
}

.dash-chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 4px 0 0;
  padding: 0;
}

.dash-chart-legend li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.dash-chart-legend strong {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.dash-chart-legend li.is-highlight strong {
  color: var(--hop-dark);
}

/* вЂ”вЂ” РџСѓР»СЊСЃ СЃРµС‚Рё: РІРµСЂС‚РёРєР°Р»СЊРЅС‹Р№ СЃС‚РµРє Р±РµР· РЅР°Р»РѕР¶РµРЅРёР№ вЂ”вЂ” */
.dash-pulse {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-width: 0;
}

.dash-pulse > * {
  min-width: 0;
  position: relative;
  z-index: 0;
}

.dash-pulse .dash-heading,
.dash-pulse .dash-plan-hero,
.dash-pulse .data-section,
.dash-pulse .dash-pair,
.dash-pulse .dash-board {
  margin-top: 0;
}

.dash-pulse .data-section + .data-section {
  margin-top: 0;
}

.pulse-attention {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--danger);
  background: var(--surface);
  border-radius: 2px;
}

.pulse-attention-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.pulse-attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.pulse-attention-list a {
  display: grid;
  grid-template-columns: minmax(8rem, 1.4fr) minmax(4rem, 0.6fr) 1.6fr;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  align-items: baseline;
}

.pulse-attention-list a:hover strong {
  text-decoration: underline;
}

.pulse-attention-city {
  color: var(--muted);
  font-size: 0.9rem;
}

.pulse-attention-problem {
  font-size: 0.9rem;
}

.dash-plan-hero-main.pulse-net-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: 0.75rem 0.85rem;
  align-items: stretch;
}

.pulse-net-grid .dash-plan-fact-block,
.pulse-net-grid .dash-plan-pct-block {
  min-width: 0;
  padding: 12px 14px;
}

.pulse-net-grid .dash-plan-pct-label {
  overflow-wrap: anywhere;
}

.pulse-net-grid .dash-plan-fact-value,
.pulse-net-grid .dash-plan-pct-value {
  font-size: clamp(1.15rem, 0.85vw + 0.9rem, 1.65rem);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pulse-section-hint {
  margin: 0.15rem 0 0.75rem;
}

.pulse-cities {
  padding: 16px 18px 18px;
}

.pulse-cities .dash-section-title {
  padding: 0;
  margin: 0 0 0.2rem;
}

.pulse-cities-wrap {
  max-height: min(26rem, 50vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

/* Р“Р»РѕР±Р°Р»СЊРЅРѕ .table-wrap:has(...) СЃС‚Р°РІРёС‚ overflow:visible вЂ” РґР»СЏ РіРѕСЂРѕРґРѕРІ РЅСѓР¶РµРЅ СЃРєСЂРѕР»Р» */
.table-wrap.pulse-cities-wrap,
.table-wrap.pulse-cities-wrap:has(> .data-table) {
  overflow: auto;
}

/* Sticky top:60px (РїРѕРґ topbar) РІРЅСѓС‚СЂРё Р»РѕРєР°Р»СЊРЅРѕРіРѕ СЃРєСЂРѕР»Р»Р° вЂ” С€Р°РїРєР° В«РІРёСЃРёС‚В» РїРѕСЃРµСЂРµРґРёРЅРµ */
.dash-pulse .pulse-cities-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--table-header-bg);
}

.pulse-cities-table {
  table-layout: fixed;
  width: 100%;
  min-width: 28rem;
}

.pulse-cities-table th,
.pulse-cities-table td {
  white-space: nowrap;
}

.pulse-cities-table th:first-child,
.pulse-cities-table td:first-child {
  width: 42%;
  max-width: 0; /* table-layout:fixed — даёт ellipsis в ячейке */
  padding-left: 14px;
  padding-right: 10px;
}

.pulse-cities-table th:not(:first-child),
.pulse-cities-table td:not(:first-child) {
  padding-left: 10px;
  padding-right: 14px;
}

.pulse-city-row td:first-child {
  border-left: 3px solid transparent;
}

.pulse-city-row.is-good td:first-child { border-left-color: var(--success); }
.pulse-city-row.is-warn td:first-child { border-left-color: var(--warning); }
.pulse-city-row.is-bad td:first-child { border-left-color: var(--danger); }
.pulse-city-row.is-neutral td:first-child { border-left-color: var(--line); }

.pulse-city-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.pulse-city-link:hover {
  color: var(--hop-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pulse-rr-pill {
  display: inline-block;
  min-width: 4.25rem;
  padding: 0.12rem 0.45rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border-radius: 2px;
  background: color-mix(in srgb, var(--line) 55%, var(--surface));
}

.pulse-rr-pill.is-good {
  color: color-mix(in srgb, var(--success) 75%, var(--ink));
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}

.pulse-rr-pill.is-warn {
  color: color-mix(in srgb, var(--warning) 70%, var(--ink));
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
}

.pulse-rr-pill.is-bad {
  color: color-mix(in srgb, var(--danger) 75%, var(--ink));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.pulse-rank-pair {
  margin: 0;
  align-items: stretch;
}

.pulse-rank-panel {
  overflow: hidden;
  min-height: 0;
  padding: 16px 18px 14px;
}

.pulse-rank-panel .dash-section-title {
  padding: 0;
  margin: 0 0 0.45rem;
}

.pulse-rank-panel.is-anti .dash-section-title {
  color: var(--ink-soft);
}

.pulse-rank {
  padding: 0;
  margin: 0;
}

/* 4 колонки (без share): место имени + бар, длинные адреса — в ellipsis */
.pulse-rank .dash-rank-row {
  grid-template-columns: 1.85rem minmax(0, 1.35fr) minmax(3.25rem, 0.9fr) minmax(5.25rem, auto);
  gap: 8px 12px;
  padding: 9px 0;
}

.pulse-rank .dash-rank-pos {
  text-align: left;
}

.pulse-rank .dash-rank-name,
.pulse-rank .dash-rank-name a {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-rank .dash-rank-value.is-up {
  color: color-mix(in srgb, var(--success) 70%, var(--ink));
}

.pulse-rank .dash-rank-value.is-down {
  color: color-mix(in srgb, var(--danger) 70%, var(--ink));
}

.pulse-empty {
  margin: 0.35rem 0 0;
  padding: 1.15rem 1.25rem;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.pulse-empty p {
  margin: 0;
  max-width: 52ch;
}

.pulse-empty.is-stub {
  min-height: 5rem;
  display: flex;
  align-items: center;
  padding: 1.25rem 1.35rem;
}

.pulse-trend-section,
.pulse-stores-section,
.pulse-stub-card {
  margin: 0;
  padding: 16px 18px 18px;
}

.pulse-trend-section .dash-section-title,
.pulse-stores-section .dash-section-title,
.pulse-stub-card .dash-section-title {
  padding: 0;
  margin: 0 0 0.45rem;
}

.pulse-trend-lead {
  margin: 0.15rem 0 0.85rem;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.table-wrap.pulse-yo-wrap,
.table-wrap.pulse-yo-wrap:has(> .data-table) {
  overflow-x: auto;
  overflow-y: visible;
}

.pulse-yo-table {
  min-width: 0;
  width: 100%;
  table-layout: auto;
}

.pulse-yo-table th,
.pulse-yo-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 12px 16px;
}

.pulse-yo-table th:last-child,
.pulse-yo-table td:last-child {
  padding-right: 18px;
}

.pulse-yo-table th[scope="row"] {
  font-weight: 600;
  color: var(--ink);
  min-width: 5.75rem;
  max-width: 7.5rem;
  white-space: normal;
  line-height: 1.3;
  padding-right: 12px;
}

.pulse-yo-month {
  display: block;
}

.pulse-yo-table td.numeric {
  min-width: 6.75rem;
  padding-left: 18px;
  text-align: right;
}

.pulse-yo-bars-th,
.pulse-yo-cell {
  width: 38%;
  min-width: 10rem;
  white-space: normal;
}

.pulse-yo-pair {
  display: grid;
  gap: 5px;
}

.pulse-yo-track {
  height: 10px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface-subtle));
  overflow: hidden;
}

.pulse-yo-bar {
  display: block;
  height: 100%;
  border-radius: 2px;
  transform-origin: left center;
}

.pulse-yo-bar.is-cur { background: var(--hop); }
.pulse-yo-bar.is-ly {
  background: color-mix(in srgb, var(--ink) 42%, var(--surface));
}

@media (prefers-reduced-motion: no-preference) {
  .pulse-yo-bar {
    animation: pulse-yo-grow 0.22s ease-out both;
  }
}

@keyframes pulse-yo-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.pulse-yo-table tr.is-current td,
.pulse-yo-table tr.is-current th {
  background: var(--hop-wash);
}

.pulse-yo-table tr.is-muted td,
.pulse-yo-table tr.is-muted th {
  color: var(--muted);
}

.pulse-yo-now {
  display: block;
  margin: 2px 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hop-deeper);
}

.pulse-trend-legend {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pulse-trend-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
  border-radius: 1px;
}

.pulse-trend-swatch.is-cur { background: var(--hop); }
.pulse-trend-swatch.is-ly {
  background: color-mix(in srgb, var(--ink) 42%, var(--surface));
}

.pulse-stores-section .report-table-wrap,
.pulse-stores-section .table-wrap.report-table-wrap:has(> .data-table) {
  overflow-x: auto;
  overflow-y: visible;
}

.pulse-table {
  table-layout: fixed;
  width: 100%;
  min-width: 70rem;
}

.data-table.report-table.pulse-table th,
.data-table.report-table.pulse-table td {
  padding: 12px 14px;
  line-height: 1.4;
  overflow: visible;
}

.pulse-table th,
.pulse-table td {
  white-space: nowrap;
}

.pulse-table th:first-child,
.pulse-table td:first-child {
  width: 16rem;
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  vertical-align: top;
}

.pulse-store-link {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
  text-underline-offset: 3px;
}

.pulse-store-link strong {
  font-weight: 700;
}

.pulse-city-cell,
.pulse-table td:nth-child(2),
.pulse-table th:nth-child(2) {
  width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-table td.numeric,
.pulse-table th.numeric {
  font-size: 0.82rem;
}

.pulse-table td.pf-dev-pos,
.pulse-table td.pf-dev-neg {
  padding-left: 10px;
  padding-right: 10px;
}

.pulse-stubs {
  margin: 0;
}

@media (max-width: 900px) {
  .dash-pulse .pulse-rank-pair {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .pulse-attention-list a {
    grid-template-columns: 1fr;
  }

  .pulse-trend-legend {
    flex-direction: column;
    gap: 0.35rem;
  }

  .dash-plan-hero-main.pulse-net-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dash-rank-name a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 900px) {
  .dash-plan-hero-main,
  .dash-plan-hero-tri {
    grid-template-columns: 1fr;
  }

  .dash-chart-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dash-plan-hero-top {
    flex-direction: column;
  }
}

/* Динамика сети */
.dynamics-metric-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  margin: 8px 0 12px;
}

.dynamics-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.dynamics-table {
  width: max-content;
  min-width: 100%;
  border-spacing: 0;
}

.dynamics-table th,
.dynamics-table td {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.dynamics-table tbody tr:last-child th,
.dynamics-table tbody tr:last-child td {
  border-bottom: 0;
}

.dynamics-table .dynamics-col-store {
  position: sticky;
  left: 0;
  z-index: calc(var(--z-sticky) + 2);
  background: var(--surface);
  min-width: 11rem;
  max-width: 16rem;
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-size: 0.98rem;
  white-space: nowrap;
}

.dynamics-table thead .dynamics-col-store,
.dynamics-table thead .dynamics-col-week {
  z-index: calc(var(--z-sticky) + 3);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: color-mix(in srgb, var(--text) 72%, transparent);
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
}

.dynamics-table thead .dynamics-col-store {
  z-index: calc(var(--z-sticky) + 4);
}

.dynamics-table .dynamics-col-num {
  font-size: 1.2rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  text-align: right;
  padding: 0.7rem 0.85rem;
  white-space: nowrap;
  min-width: 6.5rem;
}

.dynamics-table .dynamics-col-num.is-empty {
  min-width: 3.5rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--line));
}

.dynamics-table tr.is-total th,
.dynamics-table tr.is-total td {
  font-weight: 750;
  background: color-mix(in srgb, var(--surface) 82%, var(--line));
}

.dynamics-table tr.is-total .dynamics-col-store,
.dynamics-table tr.is-total .dynamics-col-num {
  background: color-mix(in srgb, var(--surface) 82%, var(--line));
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
  padding: 0.2rem;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--line));
}

.page-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: color 160ms cubic-bezier(.2, .8, .2, 1), background 160ms cubic-bezier(.2, .8, .2, 1);
}

.page-tab:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.page-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent);
}

.report-switch { display: none; }
.report-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.report-switcher::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
.report-sheet-nav {
  display: grid;
  gap: 4px;
  padding: 4px 0 12px;
}
.report-sheet-link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.report-sheet-link.is-active {
  background: var(--hop-wash);
  color: var(--hop);
}

.filter-more,
.pulse-more,
.ipr-more {
  margin: 4px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, var(--line));
}
.filter-more > summary,
.pulse-more > summary,
.ipr-more > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  font-weight: 650;
  color: var(--ink);
}
.filter-more > summary::-webkit-details-marker,
.pulse-more > summary::-webkit-details-marker,
.ipr-more > summary::-webkit-details-marker { display: none; }
.filter-more[open] > summary,
.pulse-more[open] > summary,
.ipr-more[open] > summary {
  border-bottom: 1px solid var(--line);
}
.filter-more > :not(summary),
.pulse-more > :not(summary) {
  padding: 10px 12px 12px;
}
.ipr-more {
  min-width: 10rem;
}
.ipr-more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 12px;
}

.settings-hub { display: grid; gap: 16px; }
.settings-hub-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.settings-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.settings-hub-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
}
.settings-hub-card:hover { border-color: var(--hop); }
.settings-hub-card .nav-ic { width: 20px; height: 20px; flex: none; color: var(--hop); }
.settings-hub-card strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.settings-hub-meta {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.settings-hub-meta.is-alert { color: var(--danger); }

@media (max-width: 900px) {
  .settings-hub { gap: 14px; }
  .settings-hub-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .settings-hub-card {
    min-height: 44px;
    padding: 10px 12px;
  }
}

@media (max-width: 900px) {
  .page-tabs.analytics-tabs { display: none !important; }
  .report-switch { display: block; margin: 0 0 12px; }
}

.page-heading-lead {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ipr-journal-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 0 0 1rem;
}

.ipr-journal-filter select {
  min-width: 14rem;
}

.ipr-call-log-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ipr-call-log-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.ipr-call-log-add-row,
.ipr-call-log-edit-row {
  display: grid;
  grid-template-columns: 9rem minmax(8rem, 1fr) minmax(10rem, 1.2fr) minmax(10rem, 1.2fr) auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.ipr-call-log-edit-row {
  grid-template-columns: 9rem minmax(8rem, 1fr) minmax(10rem, 1.2fr) minmax(10rem, 1.2fr);
}

.ipr-call-log-add-row label,
.ipr-call-log-edit-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.ipr-call-log-add-row input,
.ipr-call-log-edit-row input,
.ipr-call-log-edit-row textarea {
  width: 100%;
  min-width: 0;
}

.ipr-call-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.15rem 0 0;
}

.ipr-call-log-inline {
  display: inline;
  margin: 0;
}

.ipr-call-log-readonly p {
  margin: 0 0 0.35rem;
}

@media (max-width: 960px) {
  .ipr-call-log-add-row,
  .ipr-call-log-edit-row {
    grid-template-columns: 1fr;
  }
}

.partner-tasks {
  margin-bottom: 20px;
}

.partner-tasks.is-saving {
  opacity: 0.65;
  pointer-events: none;
}

.partner-task-flash {
  margin: 0 16px 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

.partner-tasks.is-dash .partner-task-flash {
  margin: 0 0 10px;
}

.partner-task-flash.is-error {
  color: var(--danger, #b42318);
}

.partner-tasks.is-dash {
  padding: 16px 18px 18px;
}

.partner-tasks.is-dash .dash-section-title {
  padding: 0;
  margin: 0 0 0.2rem;
}

.partner-tasks.is-dash .pulse-section-hint {
  margin: 0.15rem 0 0.75rem;
}

.partner-tasks.is-dash .pulse-empty {
  margin: 0.15rem 0 0;
}

.partner-tasks > .section-heading {
  gap: 8px;
}

.partner-tasks-hint {
  padding: 0 16px 16px;
}

.partner-task-main {
  min-width: 0;
  flex: 1 1 16rem;
}

.partner-task-main strong {
  overflow-wrap: anywhere;
}

.partner-task-form-row {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) repeat(4, minmax(7.5rem, 1fr)) auto;
  gap: 12px 16px;
  align-items: end;
  padding: 0 16px 16px;
}

.partner-tasks.is-dash .partner-task-form-row {
  padding: 0 0 8px;
}

.partner-task-form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.partner-task-form-row input,
.partner-task-form-row select {
  min-height: var(--control-min-height);
  font-weight: 500;
  color: var(--ink);
}

.partner-task-list {
  list-style: none;
  margin: 0;
  padding: 0 16px 16px;
}

.partner-tasks.is-dash .partner-task-list {
  padding: 0;
}

.partner-task-item {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.partner-task-list > .partner-task-item:first-child {
  border-top: 0;
  padding-top: 4px;
}

.partner-task-item.is-overdue {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.partner-tasks.is-dash .partner-task-item.is-overdue {
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
  border-radius: var(--radius-sm);
}

.partner-task-meta {
  margin: 4px 0 0;
  color: var(--muted, var(--ink));
  font-size: 0.9rem;
}

.partner-task-meta .status-badge {
  margin-left: 0.35rem;
  vertical-align: 1px;
}

.partner-task-actions,
.partner-task-done-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.partner-task-done-form input[type="text"] {
  min-height: var(--control-min-height);
  min-width: 10rem;
}

.partner-task-done {
  padding: 0 16px 4px;
}

.partner-task-fold {
  padding: 0 16px 8px;
}

.partner-tasks.is-dash .partner-task-done,
.partner-tasks.is-dash .partner-task-fold {
  padding: 8px 0 0;
}

.partner-task-fold > summary,
.partner-task-done > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  user-select: none;
}

.partner-task-fold > summary::-webkit-details-marker,
.partner-task-done > summary::-webkit-details-marker {
  display: none;
}

.partner-task-fold > summary::after,
.partner-task-done > summary::after {
  content: "▾";
  display: inline-block;
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
}

.partner-task-fold[open] > summary::after,
.partner-task-done[open] > summary::after {
  transform: rotate(180deg);
}

.partner-task-fold-overdue {
  color: var(--danger, #b42318);
}

.partner-task-fold .partner-task-list {
  padding-top: 4px;
}

.partner-task-list.is-done {
  padding-top: 4px;
}

.partner-task-list.is-done .partner-task-item {
  opacity: 0.82;
}
.partner-tasks.is-dash .partner-task-list.is-pulse-history {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.partner-tasks.is-dash .partner-task-tabs {
  margin: 0 0 14px;
}
.partner-tasks.is-dash .partner-task-tabs .page-tab {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.partner-tasks.is-dash .partner-task-panel-tab[hidden] {
  display: none !important;
}

.partner-task-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 4px 10px 4px 4px;
  background: color-mix(in srgb, var(--hop-wash) 70%, var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
}

.partner-task-person-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.partner-task-person-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.partner-task-person-copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.partner-task-person.is-editable {
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.partner-task-person.is-editable:focus-within {
  border-color: var(--hop);
  box-shadow: 0 0 0 2px var(--hop);
}

@media (hover: hover) and (pointer: fine) {
  .partner-task-person.is-editable:hover {
    background: var(--hop-wash);
  }
}

.partner-task-person-select-wrap {
  position: relative;
  display: block;
}

.partner-task-person-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: var(--muted);
  border-bottom-width: 0;
  transform: translateY(-20%);
  pointer-events: none;
}

.partner-task-person-select-wrap select {
  appearance: none;
  width: auto;
  max-width: 12rem;
  min-height: 0;
  padding: 0 14px 0 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.partner-task-person-select-wrap select:focus,
.partner-task-person-select-wrap select:focus-visible {
  outline: none;
}

@media (max-width: 720px) {
  .partner-task-form-row {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------------------------------------------------------
   Доступы API и MCP (settings/api-tokens)
   ----------------------------------------------------------------------------- */

.form-panel + .form-panel,
.data-section + .form-panel,
.token-alert + .form-panel { margin-top: 20px; }
.token-alert { margin: 0 0 16px; font-size: var(--text-meta); }

.token-wait { margin-top: 0; padding: 9px 0; }
.token-scope-note { max-width: 80ch; margin: 16px 0 0; font-size: var(--text-meta); line-height: 1.45; }

.token-fieldset {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}
.token-fieldset[hidden] { display: none; }

.token-fieldset legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.token-fieldset .field-hint { margin: 0; }

.token-store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.token-fieldset.field-invalid .token-store-grid { border-color: var(--danger); }

.token-store-grid label,
.token-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-meta);
  line-height: 1.35;
  cursor: pointer;
}

.token-check { margin-top: 14px; }

.token-store-grid input,
.token-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--hop);
}

.token-confirm {
  margin-top: 18px;
  padding: 16px;
  background: color-mix(in srgb, var(--hop) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--hop) 55%, var(--line));
  border-radius: var(--radius-control);
}

.token-confirm h3 { margin: 0; font-size: 16px; }

.token-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px;
  margin: 12px 0 16px;
  font-size: var(--text-meta);
}

.token-facts dt { color: var(--muted); font-weight: 600; }
.token-facts dd { margin: 0; overflow-wrap: anywhere; }

.token-secret { border-color: color-mix(in srgb, var(--hop) 55%, var(--line)); }

.token-secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 9px;
}

.token-secret-value {
  flex: 1 1 320px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
  user-select: all;
}

.token-note {
  max-width: 80ch;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: 1.5;
}

.token-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.button-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.token-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
}

.token-inline-form .field { flex: 0 1 260px; }

.token-filter { padding: 12px 16px 14px; }

.token-admission-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.token-admission-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-meta);
}

.token-admission-name { min-width: 180px; font-weight: 600; }
.token-admission-list form { margin-left: auto; }

.token-table td { vertical-align: top; }
.token-table code { font-size: 13px; }
.token-nowrap { white-space: nowrap; }

.token-kind {
  color: var(--muted);
  font-size: var(--text-cap);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.token-dates {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-cap);
  line-height: 1.4;
}

.token-actions {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  white-space: normal;
}

.token-actions form { margin: 0; }
.token-actions .button-link { padding-left: 0; text-align: left; }

.token-actions summary {
  padding: 5px 2px;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
}

.token-actions details[open] {
  display: grid;
  gap: 8px;
  margin: 4px 0 8px;
}

.token-actions details form { display: grid; gap: 8px; }

.token-changes {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-meta);
  line-height: 1.4;
}

.token-changes li + li { margin-top: 2px; }

.token-empty {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .token-inline-form .field { flex-basis: 100%; }
  .token-admission-list form { margin-left: 0; }
  .token-facts { grid-template-columns: 1fr; gap: 2px; }
  .token-facts dd { margin-bottom: 6px; }
}


/* =============================================================================
   016 — новая админка: тёмное меню, иконки, раздел «Администрирование»
   ============================================================================= */

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.nav-ic,
.btn-ic {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-ic { width: 16px; height: 16px; }
.side-nav a .nav-ic { opacity: 0.85; }
.side-nav a[aria-current="page"] .nav-ic { opacity: 1; }

/* Dark sidebar for the default theme (other themes keep their own menu). */
html:is([data-ui="default"], :not([data-ui])) .sidebar {
  color: #dfe6e4;
  background: var(--charcoal-elevated);
  border-right-color: #1b2626;
}
html:is([data-ui="default"], :not([data-ui])) .sidebar .brand {
  background: linear-gradient(180deg, #2b3a3a 0%, var(--charcoal-elevated) 100%);
  border-bottom-color: #1b2626;
}
html:is([data-ui="default"], :not([data-ui])) .sidebar .brand-logo { filter: brightness(0) invert(1); opacity: 0.95; }
html:is([data-ui="default"], :not([data-ui])) .nav-label { color: #8fa3a0; }
html:is([data-ui="default"], :not([data-ui])) .nav-group + .nav-group { border-top-color: #2f3e3e; }
html:is([data-ui="default"], :not([data-ui])) .side-nav a { color: #d3dcda; }
html:is([data-ui="default"], :not([data-ui])) .side-nav a:hover { color: #fff; background: #2f4040; }
html:is([data-ui="default"], :not([data-ui])) .side-nav a[aria-current="page"] {
  color: #fff;
  background: #344747;
  box-shadow: inset 3px 0 0 var(--hop);
}
html:is([data-ui="default"], :not([data-ui])) .side-nav a[aria-current="page"] .nav-ic { color: var(--hop); }
html:is([data-ui="default"], :not([data-ui])) .sidebar-footer { border-top-color: #2f3e3e; }
html:is([data-ui="default"], :not([data-ui])) .sidebar .role-badge { color: #a9b8b6; border-color: #3a4b4b; }

.topbar-crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin-right: auto;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Розница: место показывают вкладки / нижний док — крошки «Розница / …» лишние */
body:has(.retail-main) .topbar-crumbs {
  display: none;
}
.topbar-crumbs a { color: var(--muted); text-decoration: none; }
.topbar-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.topbar-crumbs strong { color: var(--ink); font-weight: 600; }

/* Layout: secondary settings nav + content — те же карточки, что на хабе */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0 0 2px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.admin-nav-back:hover { color: var(--hop); }
.admin-nav-back::before { content: "←"; }
.admin-nav .admin-nav-group.settings-hub-title {
  margin: 0;
}
.admin-nav .admin-nav-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}
.admin-nav .settings-hub-card strong { color: var(--hop); }
.admin-nav .settings-hub-card.is-current,
.admin-nav .settings-hub-card[aria-current="page"] {
  border-color: color-mix(in srgb, var(--hop) 55%, var(--line));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hop) 28%, transparent),
    0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
}
.admin-nav-head { display: none; }
.admin-nav-title,
.admin-nav-lead { display: none; }
.admin-nav-group {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.admin-nav-label { min-width: 0; }
.admin-nav-count {
  margin-left: auto;
  padding: 1px 8px;
  color: var(--muted);
  background: var(--canvas-deep);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.admin-nav-count.is-alert { color: var(--danger); background: var(--danger-bg); }

.admin-main { min-width: 0; }
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.admin-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.015em; }
.admin-head .page-lead { margin: 4px 0 0; max-width: 68ch; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.admin-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.admin-head-actions:empty { display: none; }
.admin-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.admin-head-actions { flex: 0 1 auto; }
.admin-head-actions .enqueue-form { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; }
.admin-head-actions .enqueue-source { min-width: 0; width: auto; min-height: 38px; border-radius: 8px; }
.admin-main .table-wrap:has(> .data-table) { overflow-x: auto; }

.admin-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 0 16px;
  padding: 3px;
  background: var(--canvas-deep);
  border-radius: 9px;
}
.admin-subtabs a {
  padding: 6px 12px;
  color: var(--ink-soft);
  border-radius: 7px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.admin-subtabs a:hover { color: var(--ink); }
.admin-subtabs a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Unified card look for old and new admin blocks */
.admin-main .form-panel,
.admin-main .data-section,
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(36, 50, 50, 0.04), 0 6px 20px rgba(36, 50, 50, 0.04);
}
.admin-main .data-section > .section-heading {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.admin-main .data-table th { box-shadow: inset 0 -1px 0 var(--line-strong); }
.admin-main .help-text { font-size: 12.5px; line-height: 1.4; }

/* Toolbar */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.admin-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}
.admin-search .nav-ic { position: absolute; top: 10px; left: 11px; color: var(--muted-soft); }
.admin-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
}
.admin-select {
  height: 38px;
  padding: 0 30px 0 11px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
}
.admin-search input:focus,
.admin-select:focus {
  border-color: var(--hop);
  outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent);
  outline-offset: 0;
}
.admin-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--canvas-deep);
  border-radius: 9px;
}
.admin-seg button {
  padding: 5px 11px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.admin-seg button b { margin-left: 5px; color: var(--muted); font-weight: 600; }
.admin-seg button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Table */
.admin-card .table-wrap {
  overflow-x: auto;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.admin-table th {
  padding: 10px 14px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.admin-table thead th:first-child { border-top-left-radius: 12px; }
.admin-table thead th:last-child { border-top-right-radius: 12px; }
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  vertical-align: middle;
}
.admin-table th:first-child,
.admin-table td:first-child { padding-left: 18px; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover td { background: color-mix(in srgb, var(--hop) 5%, var(--surface)); }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link,
.row-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--hop-deeper); text-decoration: underline; }
.row-sub { display: block; color: var(--muted); font-size: 13px; }
.rating { color: var(--hop-dark); font-weight: 600; white-space: nowrap; }
.admin-card-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.pill-ok { color: var(--success); background: var(--success-bg); }
.pill-warn,
.pill-queued,
.pill-running { color: var(--warning); background: var(--warning-bg); }
.pill-failed { color: var(--danger); background: var(--danger-bg); }
.pill-off,
.pill-empty { color: var(--muted); background: var(--canvas-deep); }

.switch-form { margin: 0; }
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  padding: 0;
  background: #d3cec4;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  content: "";
  transition: left 0.15s ease;
}
.switch.is-on { background: var(--success); }
.switch.is-on::after { left: 19px; }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch[aria-busy="true"] { opacity: 0.6; }

.button-small { min-height: 30px; padding: 0 10px; font-size: 13.5px; }

/* Side drawer: opened by the server (?new=1, ?edit=id, validation errors) or by JS */
.side-drawer-scrim {
  position: fixed;
  z-index: 90;
  inset: 0;
  background: rgba(20, 28, 28, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.side-drawer {
  position: fixed;
  z-index: 91;
  top: 0;
  right: 0;
  display: flex;
  width: min(540px, 100vw);
  height: 100dvh;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.16);
  /* Closed drawer is removed from layout: a translated fixed box would widen the page. */
}
.side-drawer:not(.is-open) { display: none; }
.side-drawer.is-open { animation: side-drawer-in 0.22s ease; }
@keyframes side-drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .side-drawer.is-open { animation: none; } }
.side-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.side-drawer-form { display: flex; min-height: 0; flex: 1; flex-direction: column; margin: 0; }
.side-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.side-drawer-head h2 { margin: 0; font-size: 19px; }
.side-drawer-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.side-drawer-x { display: inline-flex; padding: 5px; color: var(--muted); border-radius: 7px; }
.side-drawer-x:hover { color: var(--ink); background: var(--canvas-deep); }
.side-drawer-body { flex: 1; overflow-y: auto; padding: 4px 22px 22px; }
.side-drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--line);
}
.drawer-group {
  min-width: 0;
  margin: 0;
  padding: 16px 0 6px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.drawer-group:last-child { border-bottom: 0; }
.drawer-group legend {
  float: left;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.drawer-group legend + * { clear: both; }
.drawer-group .field { margin-bottom: 12px; }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.choice-card input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--hop); }
.choice-card b { display: block; font-weight: 600; }
.choice-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
html.has-side-drawer { overflow: hidden; }

/* Sync overview cards */
.sync-bases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.sync-base {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(36, 50, 50, 0.04), 0 6px 20px rgba(36, 50, 50, 0.04);
}
.sync-base.is-failed { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.sync-base-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sync-base-head h2 { margin: 0; font-size: 15.5px; }
.sync-base-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 0;
  font-size: 13.5px;
}
.sync-base-meta dt { color: var(--muted); }
.sync-base-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.sync-base-error { color: var(--danger); overflow-wrap: anywhere; }
.sync-base form { margin: auto 0 0; }

@media (max-width: 1100px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .admin-nav {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    padding-bottom: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-back,
  .admin-nav-head,
  .admin-nav-group { display: none; }
  .admin-nav .admin-nav-grid {
    display: contents;
  }
  .admin-nav .settings-hub-card {
    flex: none;
    min-width: max-content;
    white-space: nowrap;
    -webkit-user-drag: none;
  }
}

@media (max-width: 720px) {
  .admin-head { flex-direction: column; }
  .admin-head > div:first-child { flex-basis: auto; }
  .admin-head-actions .enqueue-form { flex-wrap: wrap; }
  .admin-head-actions { justify-content: flex-start; }
  .admin-search { max-width: none; }
  .drawer-grid { grid-template-columns: 1fr; }
  .topbar-crumbs { display: none; }
}

/* 016 часть 2 — правила пополнения и пользователи */
.side-drawer-wide { width: min(620px, 100vw); }
.side-drawer-foot .unsaved-note { margin-right: auto; align-self: center; }
.drawer-note { margin: -4px 0 12px; }
.rule-apply { margin: -4px 0 14px; }
.side-drawer .field-choice .filter-fold { width: 100%; }

.rule-list { overflow: hidden; }
.rule-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 18px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rule-group-title span {
  padding: 0 7px;
  color: var(--muted);
  background: var(--canvas-deep);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0;
}
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 13px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.rule-row:last-child { border-bottom: 0; }
.rule-row:hover { background: color-mix(in srgb, var(--hop) 5%, var(--surface)); }
.rule-row.is-off .rule-scope,
.rule-row.is-off .rule-params { opacity: 0.6; }
.rule-main { min-width: 0; }
.rule-scope { margin: 0 0 6px; color: var(--ink); font-weight: 600; line-height: 1.35; }
.rule-arrow { margin: 0 4px; color: var(--muted-soft); }
.rule-params { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rule-param {
  padding: 3px 9px;
  color: #7a520e;
  background: var(--hop-wash);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rule-param span { margin-right: 4px; color: #8f6a2a; font-weight: 400; }
.rule-meta { color: var(--muted); font-size: 13px; }
.rule-side { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 14px; }
.rule-precision { color: var(--muted); font-size: 12.5px; }
.rule-actions { display: flex; align-items: center; gap: 10px; }
.rule-actions .button-link { padding: 4px 2px; }

.admin-toolbar-note { margin-left: auto; color: var(--muted); font-size: 13.5px; }
.tag {
  display: inline-block;
  margin: 1px 4px 1px 0;
  padding: 2px 8px;
  color: var(--ink-soft);
  background: var(--canvas-deep);
  border-radius: 6px;
  font-size: 12.5px;
  white-space: nowrap;
}
.user-open {
  display: block;
  max-width: 100%;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.user-open:hover { color: var(--hop-deeper); text-decoration: underline; }
.admin-table .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 12rem;
}
.admin-table .user-cell > span:last-child {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
}
.admin-table-meta { white-space: nowrap; }
.admin-table-actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.admin-table .table-actions {
  flex-wrap: nowrap;
  gap: 4px;
}
.admin-table .table-actions .button {
  flex: 0 0 auto;
}
.table-icon-btn {
  width: 32px;
  height: 32px;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.table-icon-btn:hover {
  color: var(--ink);
  background: var(--canvas-deep);
  border-color: var(--line-strong);
}
.table-icon-btn .btn-ic { width: 15px; height: 15px; }
.nowrap { white-space: nowrap; }

/* User editor: the existing <dialog> becomes a right-hand drawer */
dialog.user-drawer {
  width: min(600px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.16);
}
dialog.user-drawer::backdrop { background: rgba(20, 28, 28, 0.36); }
dialog.user-drawer .user-dialog-panel {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
dialog.user-drawer .model-form { display: flex; min-height: 0; flex: 1; flex-direction: column; }
dialog.user-drawer .filter-dialog-header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog.user-drawer .filter-dialog-header h2 { font-size: 19px; }
dialog.user-drawer .user-dialog-body { flex: 1; overflow-y: auto; padding: 16px 22px; }
dialog.user-drawer .form-grid-users { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
dialog.user-drawer .field-roles,
dialog.user-drawer .field-password,
dialog.user-drawer .field-menu-stores,
dialog.user-drawer .field-retail-stores { grid-column: 1 / -1; }
dialog.user-drawer .form-actions {
  margin: 0;
  padding: 14px 22px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .rule-row { flex-direction: column; align-items: flex-start; }
  .rule-side { justify-content: flex-start; }
  dialog.user-drawer .form-grid-users { grid-template-columns: 1fr; }
  .admin-toolbar-note { margin-left: 0; }
}

.admin-toolbar.users-toolbar { padding: 0; }
.admin-toolbar.users-toolbar .admin-search input { height: 38px; padding: 0 12px 0 36px; border-radius: 8px; }
.admin-toolbar.users-toolbar .admin-select { height: 38px; min-height: 38px; padding: 0 30px 0 11px; border-radius: 8px; }
dialog.user-drawer[open] {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(600px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.16);
  z-index: 95;
}
dialog.user-drawer[open] .user-dialog-panel { flex: 1; height: 100%; max-height: none; min-height: 0; }
dialog.user-drawer[open] .model-form { flex: 1; max-height: none; min-height: 0; height: 100%; }
dialog.user-drawer[open] .form-actions { flex: 0 0 auto; position: sticky; bottom: 0; z-index: 2; }

/* 016 часть 3 — журнал и API/MCP */
.side-drawer .form-grid { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.side-drawer .form-actions { position: sticky; bottom: -22px; margin: 18px -22px -22px; padding: 14px 22px; background: var(--surface-subtle); border-top: 1px solid var(--line); }
.side-drawer .token-confirm { margin-top: 16px; }

.audit-toolbar .audit-more { position: relative; }
.audit-more > summary {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
}
.audit-more > summary::-webkit-details-marker { display: none; }
.audit-more[open] > summary { border-color: var(--hop); }
.audit-more-body {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 10px;
  width: 300px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(36, 50, 50, 0.14);
}
.audit-more-body label { display: grid; gap: 4px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.audit-more-body .admin-select { width: 100%; }

.audit-feed { overflow: hidden; }
.audit-day {
  margin: 0;
  padding: 8px 18px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}
.audit-event {
  display: grid;
  grid-template-columns: 46px 30px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 11px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.audit-event:hover { background: color-mix(in srgb, var(--hop) 4%, var(--surface)); }
.audit-time { padding-top: 5px; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.audit-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--canvas-deep);
  border-radius: 8px;
}
.audit-icon .nav-ic { width: 16px; height: 16px; }
.audit-icon.is-good { color: var(--success); background: var(--success-bg); }
.audit-icon.is-bad { color: var(--danger); background: var(--danger-bg); }
.audit-body { min-width: 0; }
.audit-title { margin: 0; color: var(--ink); font-weight: 600; line-height: 1.35; }
.audit-detail { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.audit-who { padding-top: 5px; color: var(--ink-soft); font-size: 13.5px; text-align: right; white-space: nowrap; }
.audit-who small { display: block; color: var(--muted-soft); font-size: 12px; }
.audit-pager { display: flex; gap: 8px; }

@media (max-width: 720px) {
  .audit-event { grid-template-columns: 30px minmax(0, 1fr); }
  .audit-time { grid-column: 2; grid-row: 2; padding-top: 0; }
  .audit-who { grid-column: 2; text-align: left; padding-top: 0; }
  .audit-more-body { width: min(300px, calc(100vw - 32px)); }
  .side-drawer .form-grid { grid-template-columns: 1fr; }
}
#token-drawer .side-drawer-body { padding-top: 16px; }
.audit-toolbar .admin-search { flex-basis: 200px; }
/* 016 review fixes */
/* Absolute bits in tables (sr-only labels) must be clipped by the scrolling wrapper. */
.admin-main .table-wrap { position: relative; }
.admin-main .compact-list small { font-size: 12.5px; }
@media (max-width: 720px) {
  .admin-main .form-panel .compact-list { margin-right: -14px; margin-left: -14px; }
}
.admin-main .data-section .compact-list { margin-right: 0; margin-left: 0; }
.app-body .main-content.is-ready > .admin-layout:has(.side-drawer.is-open) { animation: none; }
.admin-main .data-section .compact-list { margin-top: 0; }
.admin-main .field-checkbox label { flex: 1 1 0; min-width: 0; }
.admin-main .field-checkbox .help-text { font-size: 12.5px; }

/* ── Отчёты: общий каркас (этап 1 редизайна) ─────────────────────────────
   Шапка с компактной плашкой периода, фильтры — боковой панелью как в
   администрировании, заголовки колонок переносятся вместо обрезки. */
@media (min-width: 901px) {
  .main-content.report-main { padding-right: 32px; padding-left: 32px; }
}
.report-main .page-heading { align-items: center; margin-bottom: 22px; }
.report-main .page-heading-tools { align-items: center; }

.period-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 1px;
  min-width: 0;
  padding: 8px 8px 8px 14px;
  background: var(--surface);
  border-radius: var(--radius-control, var(--radius-sm));
}
.period-summary > :not(.filter-trigger) { grid-column: 1; min-width: 0; }
.period-summary small { display: none; }
.period-summary strong { margin: 0; font-size: 14px; white-space: nowrap; }
.period-summary span { font-size: 12px; line-height: 1.35; }
.period-summary .filter-trigger {
  grid-column: 2;
  grid-row: 1 / span 4;
  width: auto;
  min-height: 38px;
  margin-top: 0;
  padding: 0 16px;
}

/* Фильтры: боковая панель справа на всю высоту. */
.filter-overlay {
  background: rgba(20, 28, 28, 0.36);
  backdrop-filter: none;
}
.filter-dialog {
  inset: 0 0 0 auto !important;
  width: min(560px, 100vw);
  padding: 0;
  overflow: hidden;
  pointer-events: auto;
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.16);
}
.filter-shell.is-open .filter-dialog,
body > .filter-dialog.is-open {
  display: flex;
  flex-direction: column;
  animation: side-drawer-in 0.22s ease;
}
@media (prefers-reduced-motion: reduce) {
  .filter-shell.is-open .filter-dialog,
  body > .filter-dialog.is-open { animation: none; }
}
.filter-dialog-chrome {
  flex: 1;
  width: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.filter-dialog-chrome { position: relative; }
.filter-dialog-header { padding: 18px 22px; }
/* Кнопки — подвал панели: прижаты к низу, форма прокручивается над ними. */
.filter-dialog .filter-form { padding: 18px 22px 88px; border-radius: 0; scroll-padding-bottom: 88px; }
/* Списки «Источники / Магазины» раскрываются в потоке: в панели нет места под всплывашку. */
.filter-dialog .filter-fold[open] > .filter-fold-panel {
  position: static;
  max-height: min(320px, 50vh);
  box-shadow: none;
}
.filter-dialog .filter-actions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 14px 22px;
  background: var(--surface-subtle);
}

/* Заголовки колонок: перенос по словам, а не «Выр…». */
.data-table.report-table th {
  white-space: normal;
  text-overflow: clip;
  vertical-align: bottom;
  hyphens: auto;
}
.data-table.report-table th > a { display: inline; }
.data-table.report-table th > a > span { margin-left: 2px; white-space: nowrap; }

/* Поиск всегда на всю строку: «span 2» на телефоне рождал лишнюю колонку. */
.filter-dialog .filter-form > .field-search { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .report-main .page-heading-tools { justify-content: stretch; }
  .period-summary { grid-template-columns: 1fr; }
  .period-summary .filter-trigger { grid-column: 1; grid-row: auto; width: 100%; margin-top: 8px; }
  .filter-dialog .filter-form { padding: 16px 16px 88px; }
  .filter-dialog .filter-actions { margin: 0; padding: 14px 16px; }
}

/* iPhone: фильтр — нижний sheet над home indicator (перебивает side-drawer выше) */
@media (max-width: 720px) {
  .filter-overlay {
    background: rgba(0, 0, 0, 0.28);
  }
  .filter-dialog {
    inset: 0 !important;
    width: 100%;
    max-width: none;
    padding: 0;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
  }
  .filter-shell.is-open .filter-dialog,
  body > .filter-dialog.is-open {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    animation: none;
  }
  .filter-dialog-chrome {
    flex: 0 1 auto;
    width: 100%;
    max-height: min(92dvh, 920px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
    background: var(--surface);
    overflow: hidden;
  }
  .filter-dialog-header {
    padding-top: 14px;
  }
  .filter-dialog .filter-form {
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .filter-dialog .filter-actions {
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Главная «Пульс сети» (этап 2 редизайна) ───────────────────────────── */
/* Суммы в шапке — одной строкой: шрифт ужимается под ширину карточки. */
.pulse-net-grid .dash-plan-fact-block,
.pulse-net-grid .dash-plan-pct-block { container-type: inline-size; }
.pulse-net-grid .dash-plan-fact-value,
.pulse-net-grid .dash-plan-pct-value {
  font-size: min(1.65rem, 13cqi);
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

/* Задачи на главной: 5 первых, остальное по кнопке; просрочка — полоской, не заливкой. */
.partner-task-list.is-collapsed > .is-extra { display: none; }
.partner-task-more { margin-top: 10px; }
.partner-tasks.is-dash .partner-task-item.is-overdue {
  background: transparent;
  box-shadow: inset 3px 0 0 var(--danger);
  margin: 0;
  padding-left: 14px;
  border-radius: 0;
}
.partner-tasks.is-dash .partner-task-item.is-openable {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.partner-task-sheet {
  min-width: 0;
}
.partner-task-summary {
  display: block;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.partner-task-summary::-webkit-details-marker { display: none; }
.partner-task-summary .partner-task-main { min-width: 0; }
.partner-task-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-subtle) 80%, var(--surface));
}
.partner-task-panel .partner-task-done-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.partner-task-panel .partner-task-done-form > input[type="text"] {
  width: 100%;
  min-width: 0;
}
.partner-task-panel .partner-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.partner-task-panel .partner-task-actions .button {
  flex: 0 0 auto;
}
@media (min-width: 1100px) {
  .partner-tasks.is-dash .partner-task-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
  }
  .partner-tasks.is-dash .partner-task-list > .partner-task-item:nth-child(2) { border-top: 0; }
}

/* Таблица «Точки»: ширины по содержимому, «Точка» закреплена при прокрутке вбок. */
.pulse-table { min-width: 84rem; }
.pulse-table th:first-child,
.pulse-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 15rem;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--line);
}
.pulse-table thead th:first-child { z-index: calc(var(--z-sticky) + 2); }
.pulse-table th:nth-child(2), .pulse-table td:nth-child(2) { width: 8.5rem; }
.pulse-table th:nth-child(3), .pulse-table th:nth-child(4) { width: 7.5rem; }
.pulse-table th:nth-child(n+5):nth-child(-n+7) { width: 5rem; }
.pulse-table th:nth-child(8) { width: 6.5rem; }
.pulse-table th:nth-child(9), .pulse-table th:nth-child(10) { width: 5.25rem; }
.pulse-table th:nth-child(11) { width: 5.75rem; }
.pulse-table th:nth-child(12) { width: 4.5rem; }
.pulse-table th:nth-child(13) { width: 6rem; }

/* ── Меню профиля (спека 017) ─────────────────────────────────────────── */
.profile { position: relative; }
/* Шапка — свой слой (z 30); пока меню открыто, поднимаем её над Пинтой (1200). */
.topbar:has(.profile.is-open) { z-index: 1300; }
/* Кнопка профиля — только аватар; кольцо при наведении и пока меню открыто. */
.profile-trigger {
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.profile-trigger .avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 14px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.profile-trigger:hover .avatar,
.profile.is-open .profile-trigger .avatar {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--hop) 45%, var(--line-strong));
}
.profile.is-open .profile-trigger .avatar {
  border-color: color-mix(in srgb, var(--hop) 55%, var(--line));
  background: color-mix(in srgb, var(--hop-wash) 70%, var(--surface));
}
.profile-trigger:focus-visible { outline: none; }
.profile-trigger:focus-visible .avatar {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--hop) 55%, var(--line-strong));
}
img.avatar {
  display: block;
  object-fit: cover;
  color: transparent;
  background: var(--canvas-deep);
  border-color: var(--line);
}

.profile-menu {
  position: fixed;
  z-index: 1300;
  top: calc(12px + env(safe-area-inset-top, 0px) + 52px);
  right: 28px;
  display: grid;
  gap: 14px;
  width: 340px;
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  padding: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
  animation: pm-in 0.14s ease;
}
.profile-menu[hidden] { display: none; }
@keyframes pm-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .profile-menu { animation: none; } }

.pm-card { display: flex; align-items: center; gap: 14px; }
.pm-card .pm-avatar { width: 56px; height: 56px; flex: 0 0 56px; font-size: 22px; }
.pm-card-copy { display: grid; gap: 2px; min-width: 0; }
.pm-name { overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.pm-job { color: var(--muted); font-size: 13.5px; }
.pm-avatar-actions { display: flex; gap: 14px; margin-top: 4px; }
.pm-link {
  padding: 0;
  color: var(--link, var(--hop-dark));
  background: none;
  border: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pm-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.pm-link.is-muted { color: var(--muted); }
.profile.is-busy .pm-avatar { opacity: 0.5; }
.pm-error {
  margin: 0;
  padding: 8px 10px;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 8px;
  font-size: 13px;
}

.pm-section { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.pm-facts { gap: 12px; }
.pm-fact { display: grid; gap: 4px; margin: 0; }
.pm-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pm-value { font-size: 14.5px; font-weight: 600; }
.pm-field input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
}
.pm-field input:focus { border-color: var(--hop); outline: 2px solid color-mix(in srgb, var(--hop) 30%, transparent); }
.pm-field input.is-saved { border-color: var(--success); }

.pm-themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pm-theme {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 6px 2px;
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.pm-theme:hover { background: var(--surface-subtle); }
.pm-theme[aria-checked="true"] { color: var(--ink); border-color: var(--hop); background: color-mix(in srgb, var(--hop) 10%, transparent); }
.pm-theme .ui-theme-swatch { width: 34px; height: 34px; margin: 0; }

.pm-switch { display: flex; align-items: center; gap: 12px; margin: 0; cursor: pointer; }
.pm-switch-copy { display: grid; flex: 1; gap: 2px; }
.pm-switch-copy strong { font-size: 14.5px; }
.pm-switch-copy small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.pm-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pm-switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.15s ease;
}
.pm-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}
.pm-switch input:checked + .pm-switch-track { background: var(--hop); }
.pm-switch input:checked + .pm-switch-track::after { transform: translateX(18px); }
.pm-switch input:focus-visible + .pm-switch-track { outline: 2px solid var(--hop); outline-offset: 2px; }
.profile-menu .ui-pint-styles { margin: 4px 0 0; padding: 0; border: 0; }

.pm-logout-form { margin: 0; }
.pm-logout-form + .pm-logout-form { margin-top: 8px; }
.pm-logout {
  display: inline-flex;
  width: 100%;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}
.pm-logout:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

@media (max-width: 640px) {
  .profile-menu {
    position: fixed;
    top: 64px;
    right: 8px;
    left: 8px;
    width: auto;
  }
}
@media (max-width: 900px) {
  html body:has(.app-dock) .profile-menu {
    position: fixed;
    top: auto;
    left: auto;
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    width: min(320px, calc(100vw - 32px));
    max-height: min(70dvh, calc(100dvh - 120px));
    border-radius: 20px;
    pointer-events: auto;
  }
}
/* Характер Пинты в меню: компактнее, фон выбранного — от темы (светлый #fff8e8 гасил текст в тёмных темах). */
.profile-menu .ui-pint-style-option { grid-template-columns: 40px 1fr auto; gap: 10px; padding: 8px 10px; border-width: 1px; border-radius: 10px; }
.profile-menu .ui-pint-style-option:hover { transform: none; }
.profile-menu .ui-pint-style-option:has(input:checked) {
  background: color-mix(in srgb, var(--hop) 14%, var(--surface));
  box-shadow: none;
}
.profile-menu .ui-pint-style-preview { width: 40px; height: 40px; }

/* «Обмен с 1С»: корзинка в правом нижнем углу карточки базы — остановить обмен. */
.sync-base { position: relative; }
.sync-base-off { position: absolute; right: 12px; bottom: 12px; margin: 0; }
.sync-base-off-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.sync-base-off-btn:hover { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.sync-base-off-btn:focus-visible { outline: 2px solid var(--hop); outline-offset: 1px; }

/* ИПР · Валовая прибыль по группам на телефоне: карточка на группу вместо 6 колонок,
   где числа обрезались до «1 234…». Сверху группа и ВП, ниже 2×2 показателя с подписями.
   Селекторы с .data-table.ipr-table — чтобы перебить рамки/отступы/выравнивание таблицы. */
@media (max-width: 640px) {
  .data-table.ipr-table.ipr-gross-table,
  .ipr-gross-table tbody { display: block; width: 100%; min-width: 0; }
  .ipr-gross-table thead { display: none; }
  .data-table.ipr-table.ipr-gross-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 16px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
  }
  .data-table.ipr-table.ipr-gross-table td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    /* темы задают отступ и линию ячеек с !important — в карточке они не нужны */
    padding: 0 !important;
    border: 0 !important;
    background: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: left;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
  }
  .data-table.ipr-table.ipr-gross-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }
  /* строка 1: группа | валовая прибыль */
  .data-table.ipr-table.ipr-gross-table td:first-child { grid-column: 1; grid-row: 1; align-self: end; font-size: 16px; font-weight: 700; }
  .data-table.ipr-table.ipr-gross-table td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; font-size: 1.25rem; font-weight: 700; }
  /* строки 2–3: выручка | себестоимость, количество | рентабельность */
  .data-table.ipr-table.ipr-gross-table td:nth-child(3) { grid-column: 1; grid-row: 2; }
  .data-table.ipr-table.ipr-gross-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
  .data-table.ipr-table.ipr-gross-table td:nth-child(2) { grid-column: 1; grid-row: 3; }
  .data-table.ipr-table.ipr-gross-table td:nth-child(6) { grid-column: 2; grid-row: 3; text-align: right; }
  .data-table.ipr-table.ipr-gross-table tr.ipr-total-row { margin: 4px -14px 0; padding: 12px 16px; background: var(--surface-subtle); border-bottom: 0; }
  .ipr-panel-gross .table-wrap { overflow-x: visible; }
}

/* Кухня iiko (021) */
.kitchen-page .page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.kitchen-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}
.kitchen-kpi-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-subtle, #f3f4f6);
  border: 1px solid var(--line, transparent);
}
.kitchen-kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.kitchen-kpi-card strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.kitchen-abc-a { border-color: color-mix(in srgb, #16a34a 35%, var(--line)); }
.kitchen-abc-b { border-color: color-mix(in srgb, #ca8a04 35%, var(--line)); }
.kitchen-abc-c { border-color: color-mix(in srgb, #64748b 35%, var(--line)); }
.kitchen-abc-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.kitchen-abc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 6px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}
.kitchen-abc-badge.kitchen-abc-a { background: #dcfce7; color: #166534; }
.kitchen-abc-badge.kitchen-abc-b { background: #fef9c3; color: #854d0e; }
.kitchen-abc-badge.kitchen-abc-c { background: #e2e8f0; color: #334155; }
.kitchen-table { width: 100%; }
.kitchen-table th.num,
.kitchen-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kitchen-dish-name { display: block; font-weight: 600; }
.kitchen-dish-code {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.kitchen-gap-warn { color: #b45309; font-weight: 600; }
.kitchen-empty {
  margin: 8px 0 24px;
  padding: 20px 16px;
  border-radius: 12px;
  background: var(--surface-subtle, #f3f4f6);
}
.kitchen-empty strong { display: block; margin-bottom: 6px; }

@media (max-width: 900px) {
  .kitchen-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .kitchen-kpi { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kitchen-kpi-card { padding: 10px 12px; }
  .kitchen-kpi-card strong { font-size: 1.05rem; }
  .kitchen-col-secondary { display: none; }

  .kitchen-table-wrap { overflow: visible; }
  .kitchen-table thead { display: none; }
  .kitchen-table,
  .kitchen-table tbody,
  .kitchen-table tr,
  .kitchen-table td {
    display: block;
    width: 100%;
  }
  .kitchen-table tr {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
  }
  .kitchen-table td {
    display: grid;
    grid-template-columns: minmax(5rem, 36%) 1fr;
    gap: 8px;
    padding: 8px 0;
    border: 0;
    font-size: 16px;
    text-align: left !important;
    white-space: normal;
  }
  .kitchen-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }
  .kitchen-table td.kitchen-primary {
    display: block;
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  .kitchen-table td.kitchen-primary::before { display: none; }
  .kitchen-table td.kitchen-col-abc {
    display: block;
    padding-bottom: 0;
  }
  .kitchen-table td.kitchen-col-abc::before { display: none; }
}

/* —— ИПР с целью (024) —— */
/* Единый ритм секций: воздух вокруг контента, как у панелей кабинета */
.report-main .data-section.ipr-hero-card,
.report-main .data-section:has(.ipr-sheet-head),
.report-main .data-section:has(.ipr-pulse),
.report-main .data-section:has(.ipr-sheet-tasks),
.report-main .data-section:has(.ipr-effect-help) {
  padding: 18px 20px 22px;
}
.report-main .ipr-surface-tabs {
  margin: 0 0 16px;
}
.report-main .page-heading:has(+ .sync-tabs),
.report-main .page-heading:has(+ .page-tabs) {
  margin-bottom: 14px;
}
.report-main .sync-tabs { margin: 0 0 16px; }
.report-main .sync-tabs.ipr-step-tabs {
  width: fit-content;
  max-width: 100%;
}
.report-main .sync-tabs.ipr-step-tabs a {
  min-height: 40px;
  padding: 0 16px;
}
.report-main .ipr-goal-flow-hint {
  margin: 0 0 14px;
  max-width: 62ch;
  line-height: 1.45;
}
.ipr-goal-blockhead {
  display: grid;
  gap: 6px;
  margin: 22px 0 12px;
}
.ipr-goal-subhead {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.ipr-goal-blockhead .field-hint {
  margin: 0;
  max-width: 72ch;
  line-height: 1.45;
}

.ipr-growth-hero {
  background: #1e3a5f;
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  margin: 1rem 0;
}
.ipr-growth-hero h2 { margin: 0 0 0.5rem; font-size: 1.25rem; color: #fff; }
.ipr-growth-hero p { margin: 0; opacity: 0.92; line-height: 1.45; }
.ipr-growth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
@media (max-width: 960px) {
  .ipr-growth-grid { grid-template-columns: 1fr; }
}
.ipr-growth-col {
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ipr-growth-col--blue { border-top: 4px solid #2563eb; }
.ipr-growth-col--green { border-top: 4px solid #16a34a; }
.ipr-growth-col--orange { border-top: 4px solid #ea580c; }
.ipr-growth-col-head h3 {
  margin: 0 0 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 1rem;
  color: #fff;
}
.ipr-growth-col--blue .ipr-growth-col-head h3 { background: #2563eb; }
.ipr-growth-col--green .ipr-growth-col-head h3 { background: #16a34a; }
.ipr-growth-col--orange .ipr-growth-col-head h3 { background: #ea580c; }
.ipr-growth-col-head p { margin: 0.35rem 0; font-size: 0.9rem; line-height: 1.4; }
.ipr-growth-price {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--hop-wash, #fbf6ea);
}
.ipr-growth-col h4 {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ipr-growth-list { margin: 0; padding-left: 1.2rem; }
.ipr-growth-list li { margin-bottom: 0.65rem; }
.ipr-growth-formula { margin: 0; font-size: 0.85rem; font-weight: 600; }
.ipr-growth-list strong { display: block; }
.ipr-growth-list span { display: block; font-size: 0.9rem; color: var(--muted); line-height: 1.4; margin-top: 0.15rem; }
.ipr-growth-list span b { color: var(--ink); font-weight: 650; }
.ipr-growth-foot {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.ipr-growth-howto {
  background: #1e3a5f;
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  line-height: 1.45;
}

.growth-ref { margin: 1.25rem 0 2rem; scroll-margin-top: 72px; }

.growth-ref-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr);
  gap: 1.5rem;
  padding: 1.5rem 1.6rem 1.35rem;
  border-radius: 22px;
  background: #121826;
  color: #f4f6f8;
}

.growth-ref-kicker {
  margin: 0 0 0.35rem;
  color: #8ea0b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Специфичнее html[data-ui] h2 — иначе glass/dark перекрашивают заголовок в --ink. */
html[data-ui] .growth-ref-hero h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.growth-ref-lead { margin: 0.7rem 0 0; font-size: 1.02rem; line-height: 1.4; }
.growth-ref-formula { margin: 0.35rem 0 0; color: #c5d0de; font-size: 0.95rem; }
.growth-ref-price { margin: 0.55rem 0 0; color: #9fb0c4; font-size: 0.82rem; }

.growth-ref-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.growth-ref-pills li {
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #1c2533;
  color: #d5deea;
  font-size: 0.78rem;
}

.growth-ref-signals {
  padding: 1rem 1.05rem;
  border-radius: 16px;
  background: #1b2433;
}

.growth-ref-signals > p:first-child {
  margin: 0 0 0.65rem;
  color: #3dce8e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.growth-ref-signals ul { margin: 0; padding: 0; list-style: none; }
.growth-ref-signals li {
  position: relative;
  margin: 0.35rem 0;
  padding-left: 0.9rem;
  font-size: 0.92rem;
}
.growth-ref-signals li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d5deea;
}
.growth-ref-cadence { margin: 0.8rem 0 0; color: #9fb0c4; font-size: 0.85rem; }

.growth-ref-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.growth-ref--green .growth-ref-cards > :last-child:nth-child(3n + 1) { grid-column: 2; }

.growth-ref-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1rem 0.9rem;
  border: 1px solid var(--line-strong, #e6e8ee);
  border-radius: 16px;
  background: var(--surface, #fff);
  color: var(--ink, #1d1d1f);
  box-shadow: var(--shadow-panel, 0 8px 24px rgba(16, 24, 40, 0.05));
}

.growth-ref-card header { display: flex; align-items: center; gap: 0.65rem; }
.growth-ref-card header span {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #2f6fed;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.growth-ref--green .growth-ref-card header span { background: #1f9d55; }
.growth-ref--orange .growth-ref-card header span { background: #e07a5f; }
.growth-ref-card h3 {
  margin: 0;
  color: var(--ink, #1d1d1f);
  font-size: 1.02rem;
  line-height: 1.25;
}

.growth-ref-card p,
.growth-ref-how {
  margin: 0;
  color: var(--ink-soft, #3a3a3c);
  font-size: 0.9rem;
  line-height: 1.4;
}

.growth-ref-card b {
  display: block;
  margin-bottom: 0.12rem;
  color: var(--success, #1f9d55);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.growth-ref-how {
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  background: var(--info-bg, #e7f0ff);
  color: var(--ink, #1d1d1f);
}
.growth-ref-take { align-self: flex-start; margin-top: auto; }
.growth-ref--green .growth-ref-how { background: var(--success-bg, #e5f6ec); }
.growth-ref--orange .growth-ref-how { background: var(--warning-bg, #fde8e2); }

.growth-ref-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--muted, #8b909a);
  font-size: 0.78rem;
}
.growth-ref-foot a { color: inherit; }

@media (max-width: 960px) {
  .growth-ref-hero,
  .growth-ref-cards { grid-template-columns: 1fr; }
  .growth-ref--green .growth-ref-cards > :last-child:nth-child(3n + 1) { grid-column: auto; }
  .growth-ref-foot { flex-direction: column; }
}

.ipr-goal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}
.ipr-goal-toolbar .field {
  margin: 0;
  flex: 1 1 14rem;
  max-width: 22rem;
}
.ipr-goal-toolbar label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.ipr-goal-toolbar select,
.ipr-goal-toolbar input[type="month"] {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: inherit;
}
.ipr-goal-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-left: auto;
}
.ipr-goal-toolbar-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 7.5rem;
  padding: 0 16px;
  box-sizing: border-box;
}
@media (max-width: 720px) {
  .ipr-goal-toolbar .field {
    flex: 1 1 100%;
    max-width: none;
  }
  .ipr-goal-toolbar-actions {
    margin-left: 0;
    width: 100%;
  }
  .ipr-goal-toolbar-actions .button {
    flex: 1 1 auto;
  }
}
.ipr-goal-flow-hint {
  font-size: 0.9rem;
  color: var(--muted);
}
.ipr-goal-callout { border-left: 3px solid var(--hop); }

/* Таблицы листа: Excel-логика (жёлтое — ввод), язык кабинета */
.ipr-sheet-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 0 14px;
}
.ipr-sheet-head h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  line-height: 1.25;
}
.ipr-sheet-head .field-hint {
  margin: 0;
  max-width: 62ch;
  line-height: 1.45;
}
.ipr-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ipr-sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.ipr-sheet-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.ipr-sheet-wrap.is-flush {
  border: 0;
  border-radius: 0;
  background: transparent;
}
/* подсказка в thead не должна обрезаться скроллпортом */
.ipr-sheet-wrap:has(.ipr-th-hint:hover),
.ipr-sheet-wrap:has(.ipr-th-hint:focus-visible) {
  overflow: visible;
}
.ipr-sheet {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ipr-sheet th,
.ipr-sheet td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.ipr-sheet thead th {
  background: var(--canvas);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom-color: var(--line-strong);
}
.ipr-sheet thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}
.ipr-sheet tbody th { font-weight: 600; }
.ipr-sheet .num { text-align: right; }
.ipr-sheet .strong { font-weight: 700; }
.ipr-sheet .muted,
.ipr-sheet .is-empty { color: var(--muted); }
.ipr-sheet .is-neg { color: #c2410c; }
.ipr-sheet .lbl {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  white-space: normal;
  min-width: 12rem;
}
.ipr-sheet .lbl small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.ipr-sheet .is-base { background: color-mix(in srgb, var(--hop-wash) 55%, transparent); }
.ipr-sheet thead th.is-base { background: var(--hop-wash); color: var(--ink); }
.ipr-sheet tbody tr:hover > * { background-color: color-mix(in srgb, var(--hop-wash) 40%, transparent); }
.ipr-sheet tbody tr:last-child > * { border-bottom: 0; }
.ipr-col-label { width: 30%; }
.ipr-col-num { width: auto; }
.ipr-col-act { width: 3rem; }

.ipr-sheet tr.group th {
  padding-top: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ipr-sheet tr.total > * {
  font-weight: 700;
  background: var(--canvas);
  border-top: 1px solid var(--line-strong);
}
.ipr-sheet tbody.grand tr > *,
.ipr-sheet tr.grand > * {
  font-weight: 800;
  font-size: 15px;
  background: var(--hop-wash);
}
.ipr-sheet tr.grand-sub > * { font-weight: 600; background: var(--hop-wash); }
.ipr-sheet tfoot tr > * { border-bottom: 0; }
.ipr-sheet tr.empty-row td { padding: 20px 12px; color: var(--muted); white-space: normal; }

/* Ячейка ввода: жёлтая как в шаблоне Excel, без рамки до наведения */
.ipr-sheet-edit td,
.ipr-sheet-edit th.lbl { padding-top: 5px; padding-bottom: 5px; }
.cell-input {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--hop-wash);
  color: inherit;
  font: inherit;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cell-input.is-text { text-align: left; }
.ipr-sheet th .cell-input.is-text { font-weight: 600; background: transparent; }
.cell-input.is-new { background: transparent; border-style: dashed; border-color: var(--line-strong); }
.cell-input::placeholder { color: var(--muted); font-weight: 400; }
.cell-input:hover { border-color: var(--line-strong); }
.cell-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--hop);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hop) 22%, transparent);
}
select.cell-input { padding-right: 6px; cursor: pointer; }
.ipr-legend-input {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 4px;
  vertical-align: -0.1em;
  border-radius: 3px;
  background: var(--hop-wash);
  border: 1px solid var(--hop);
}

.ipr-sheet td.act { text-align: right; white-space: nowrap; }
.ipr-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.ipr-icon-btn:hover { border-color: var(--line-strong); color: #c2410c; }
.ipr-icon-btn.is-add,
.ipr-icon-btn.is-save { color: var(--ink); background: var(--hop-wash); }
.ipr-icon-btn.is-add:hover,
.ipr-icon-btn.is-save:hover { border-color: var(--hop); color: var(--ink); }
.ipr-icon-btn:focus-visible { outline: 2px solid var(--hop); outline-offset: 1px; }

/* Цвета рычагов = колонки «Инструментов роста» */
.ipr-sheet { --lever-avg: #2563eb; --lever-checks: #16a34a; --lever-margin: #ea580c; }
.ipr-goal-stats,
.ipr-sheet-head { --lever-avg: #2563eb; --lever-checks: #16a34a; --lever-margin: #ea580c; }
.ipr-sheet thead th.lever-avg { box-shadow: inset 0 3px 0 var(--lever-avg); }
.ipr-sheet thead th.lever-checks { box-shadow: inset 0 3px 0 var(--lever-checks); }
.ipr-sheet thead th.lever-margin { box-shadow: inset 0 3px 0 var(--lever-margin); }
.ipr-sheet td.lever-avg { color: var(--lever-avg); font-weight: 700; }
.ipr-sheet td.lever-checks { color: var(--lever-checks); font-weight: 700; }
.ipr-sheet td.lever-margin { color: var(--lever-margin); font-weight: 700; }
.ipr-sheet .ipr-scen-group { text-align: center; font-weight: 600; color: var(--muted); }
.ipr-sheet thead th.ipr-th-hint {
  cursor: help;
  border-bottom-style: dashed;
  position: relative;
}
.ipr-sheet thead th.ipr-th-hint[data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: min(22rem, calc(100vw - 2rem));
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 28px rgba(36, 50, 50, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.ipr-sheet thead th.ipr-th-hint:last-child[data-hint]::after,
.ipr-sheet thead th.ipr-th-hint:nth-last-child(2)[data-hint]::after {
  left: auto;
  right: 0;
}
.ipr-sheet thead th.ipr-th-hint:hover::after,
.ipr-sheet thead th.ipr-th-hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.ipr-sheet-tasks tr.lever-avg > td:first-child { box-shadow: inset 3px 0 0 var(--lever-avg); }
.ipr-sheet-tasks tr.lever-checks > td:first-child { box-shadow: inset 3px 0 0 var(--lever-checks); }
.ipr-sheet-tasks tr.lever-margin > td:first-child { box-shadow: inset 3px 0 0 var(--lever-margin); }
.ipr-sheet-tasks tr.status-done td { color: var(--muted); }
.ipr-sheet-tasks tr.status-failed .cell-input:not(.status-select) { text-decoration: line-through; color: var(--muted); }
.lever-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px 0 2px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 0.05em;
}
.lever-dot.lever-avg { background: #2563eb; }
.lever-dot.lever-checks { background: #16a34a; }
.lever-dot.lever-margin { background: #ea580c; }

.ipr-sheet-tasks { min-width: 1240px; table-layout: fixed; }
.ipr-sheet-tasks .t-n { width: 2.75rem; }
.ipr-sheet-tasks .t-title { width: 40%; }
.ipr-sheet-tasks .t-action { width: 60%; }
.ipr-sheet-tasks .t-date { width: 10rem; }
.ipr-sheet-tasks .t-resp { width: 10rem; }
.ipr-sheet-tasks .t-lever { width: 15rem; }
.ipr-sheet-tasks td { vertical-align: top; }
.ipr-sheet-tasks td.num.strong,
.ipr-sheet-tasks td.muted { padding-top: 12px; }
.ipr-sheet td.wrap { white-space: normal; }
/* Многострочный текст задачи: растёт по содержимому, весь текст виден */
textarea.cell-input {
  display: block;
  min-height: 2.25rem;
  resize: vertical;
  field-sizing: content;
  white-space: pre-wrap;
  line-height: 1.35;
}
.ipr-sheet thead th small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.ipr-sheet td small.delta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
}
.ipr-effect-help {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--hop-wash) 0%, var(--surface) 100%);
  box-shadow: inset 3px 0 0 var(--hop);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.ipr-effect-help strong { color: var(--ink); }
.ipr-effect-help ul { margin: 8px 0 0; padding-left: 0; list-style: none; }
.ipr-effect-help li { margin: 4px 0; }
.ipr-sheet-tasks .t-eff { width: 9.5rem; }
.ipr-sheet-tasks .t-profit { width: 7.5rem; }
.ipr-sheet-tasks .t-status { width: 9rem; }
.ipr-sheet-tasks .t-act { width: 3.25rem; }
.cell-unit { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.cell-unit .cell-input { width: 4.5rem; flex: 0 0 auto; }
.cell-unit small { color: var(--muted); font-size: 11px; white-space: nowrap; }

.ipr-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--canvas);
  color: var(--ink-soft);
}
.ipr-chip.is-ok,
.ipr-chip.status-done { background: color-mix(in srgb, #16a34a 14%, transparent); color: #15803d; }
.ipr-chip.is-bad,
.ipr-chip.status-failed { background: color-mix(in srgb, #ea580c 14%, transparent); color: #c2410c; }
.ipr-chip.status-progress { background: var(--hop-wash); color: var(--ink); }

/* Цель + показатели */
.ipr-goal-goalform {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px;
  border-radius: 12px;
  background: var(--hop-wash);
}
.ipr-goal-goalfield { display: grid; gap: 4px; flex: 1 1 18rem; }
.ipr-goal-goalfield.is-narrow { flex: 0 1 14rem; }
.ipr-goal-goalfield > span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.ipr-goal-goalform .cell-input { background: var(--surface); border-color: var(--line-strong); }
.ipr-goal-goalinput { font-size: 20px; font-weight: 800; padding: 9px 12px; }
.ipr-goal-goalview { font-size: 1.1rem; }
.ipr-goal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 10px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  overflow: visible;
}
.ipr-goal-stats li {
  position: relative;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
  box-shadow: inset 0 3px 0 var(--line-strong);
  text-align: center;
}
.ipr-goal-stats li.has-hint { z-index: 1; }
.ipr-goal-stats li.has-hint:hover,
.ipr-goal-stats li.has-hint:focus-visible {
  z-index: 30;
  background: var(--surface);
  border-color: color-mix(in srgb, var(--hop) 40%, var(--line));
  box-shadow: inset 0 3px 0 var(--hop);
  outline: none;
}
.ipr-goal-stats span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
}
.ipr-goal-stats span.is-hinted {
  cursor: help;
  border-bottom: 1px dashed color-mix(in srgb, var(--muted) 65%, transparent);
  width: fit-content;
}
.ipr-goal-stats li.has-hint[data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: min(22rem, calc(100vw - 2rem));
  max-width: min(22rem, 90vw);
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(36, 50, 50, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.ipr-goal-stats li.has-hint:last-child[data-hint]::after,
.ipr-goal-stats li.has-hint:nth-child(5)[data-hint]::after {
  left: auto;
  right: 0;
}
.ipr-goal-stats li.has-hint:hover::after,
.ipr-goal-stats li.has-hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.ipr-goal-stats strong {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ipr-goal-stats small { font-size: 12px; font-weight: 500; color: var(--muted); }
.ipr-stat-detail {
  margin-top: 2px;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  color: var(--muted-soft);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.ipr-goal-stats.is-compact { gap: 8px; margin-top: 12px; }
.ipr-goal-stats.is-compact li { padding: 10px 12px; }
.ipr-goal-stats.is-compact strong { font-size: 1rem; }
.ipr-goal-stats.is-compact .ipr-stat-detail { display: none; }
.ipr-goal-stats li.lever-avg { box-shadow: inset 0 3px 0 var(--lever-avg); }
.ipr-goal-stats li.lever-checks { box-shadow: inset 0 3px 0 var(--lever-checks); }
.ipr-goal-stats li.lever-margin { box-shadow: inset 0 3px 0 var(--lever-margin); }
.ipr-goal-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--canvas);
  overflow: hidden;
}
.ipr-goal-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--hop);
  transition: width 0.4s ease;
}
.ipr-goal-progress-label { margin: 6px 0 0; font-size: 13px; font-weight: 600; }
.ipr-goal-mini-cover {
  display: grid;
  justify-items: end;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--hop-wash);
}
.ipr-goal-mini-cover span { font-size: 12px; color: var(--muted); }
.ipr-goal-mini-cover strong { font-size: 18px; }

/* Трекер в шапке страницы */
.ipr-goal-tracker { display: flex; gap: 6px; align-items: flex-end; }
.ipr-goal-tracker label { display: grid; gap: 3px; }
.ipr-goal-tracker label > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.ipr-goal-tracker .cell-input { width: 13rem; background: var(--surface); border-color: var(--line); }

/* «Куда идём» — hop-wash + charcoal, как остальной кабинет */
.ipr-hero-card { --hero-accent: var(--hop-deeper); }
.ipr-hero-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 0 16px;
}
.ipr-hero-head h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  line-height: 1.25;
}
.ipr-hero-head .field-hint {
  margin: 0;
  max-width: 42ch;
  line-height: 1.45;
}
.ipr-hero-goalform { display: flex; gap: 10px; align-items: flex-end; }
.ipr-hero-goalform label { display: grid; gap: 5px; }
.ipr-hero-goalform label > span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.ipr-hero-goalinput {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.ipr-hero-goalinput:focus-within {
  border-color: var(--hop);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hop) 22%, transparent);
}
.ipr-hero-goalinput .cell-input {
  width: 8.5rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  font-weight: 700;
}
.ipr-hero-goalinput small { font-size: 15px; font-weight: 700; }

.ipr-hero {
  padding: 18px 18px 16px;
  border: 1px solid color-mix(in srgb, var(--hop) 35%, var(--line));
  border-radius: 12px;
  background: linear-gradient(180deg, var(--hop-wash) 0%, var(--surface) 88%);
}
.ipr-hero-top {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: stretch;
  justify-content: space-between;
}
.ipr-hero-main { display: grid; gap: 8px; flex: 1 1 16rem; min-width: 0; }
.ipr-hero-kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}
.ipr-hero-big {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  color: var(--danger);
  font-size: clamp(1.75rem, 2.4vw, 2.125rem);
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ipr-hero-big.is-ok { color: var(--success); }
.ipr-hero-chip {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--charcoal);
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
}
.ipr-hero-sub {
  max-width: 52ch;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.ipr-hero-sub b { font-weight: 700; color: var(--ink); }
.ipr-hero-perday {
  display: grid;
  align-content: start;
  gap: 6px;
  flex: 0 1 16rem;
  min-width: 14rem;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--hop);
}
.ipr-hero-perday-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--hop-deeper);
  line-height: 1.3;
}
.ipr-hero-perday strong {
  font-size: 1.5rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ipr-hero-perday strong small {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.ipr-hero-perday-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

/* Степпер месяцев */
.ipr-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.ipr-steps::before {
  content: "";
  position: absolute;
  top: 5px;
  left: calc(16.666% + 6px);
  right: calc(16.666% + 6px);
  height: 2px;
  background: color-mix(in srgb, var(--line-strong) 80%, transparent);
}
.ipr-step {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.ipr-step-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
.ipr-step.is-current .ipr-step-dot { border-color: var(--hop-dark); background: var(--hop); }
.ipr-step.is-past .ipr-step-dot { border-color: var(--ink-soft); background: var(--ink-soft); }
.ipr-step.is-goal .ipr-step-dot { border-color: var(--hop-deeper); background: var(--hop); }
.ipr-step-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.ipr-step.is-current .ipr-step-card {
  border-color: color-mix(in srgb, var(--hop) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hop) 25%, transparent);
}
.ipr-step.is-goal .ipr-step-card {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--hop) 60%, var(--line));
}
.ipr-step.is-current.is-goal .ipr-step-card { border-style: solid; }
.ipr-step-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}
.ipr-step-label { font-weight: 700; }
.ipr-step-badge { font-size: 12px; color: var(--muted); }
.ipr-step.is-current .ipr-step-badge { color: var(--hop-deeper); font-weight: 600; }
.ipr-step.is-goal .ipr-step-badge { color: var(--hop-deeper); font-weight: 600; }
.ipr-step-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ipr-step.is-future .ipr-step-value { color: var(--muted); }
.ipr-step-bar {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--canvas);
  overflow: hidden;
}
.ipr-step-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--hop); }
.ipr-step.is-current .ipr-step-bar > span { background: var(--hop-dark); }
.ipr-step-foot { font-size: 12px; line-height: 1.35; color: var(--muted); max-width: 18ch; }
.ipr-step-foot.is-bad { color: var(--danger); font-weight: 600; }
.ipr-step-foot.is-ok { color: var(--success); font-weight: 600; }
.ipr-hero-note {
  margin: 14px 0 0;
  max-width: 70ch;
  line-height: 1.45;
}
.ipr-hero-big.is-todo { color: var(--ink); font-size: 1.6rem; }
.ipr-hero.is-empty .ipr-hero-top { align-items: center; }

/* Гибрид */
.ipr-hybrid {
  margin-top: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.ipr-hybrid-head {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, var(--hop-wash) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line);
}
.ipr-hybrid-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hop-deeper);
}
.ipr-hybrid-head h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}
.ipr-hybrid-head .field-hint {
  margin: 0;
  max-width: 70ch;
  line-height: 1.45;
}
.ipr-hybrid .ipr-sheet-wrap.is-flush { border-radius: 0; }
.ipr-sheet-hybrid tbody tr.is-goal td,
.ipr-sheet-hybrid tbody tr.is-goal th {
  background: var(--hop-wash);
  font-weight: 600;
}
.ipr-hero-todo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.ipr-hero-todo li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}
.ipr-hero-todo b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--canvas);
  font-size: 11px;
}
.ipr-hero-todo li.is-done { color: var(--ink-soft); }
.ipr-hero-todo li.is-done b { background: var(--success); color: #fff; }
.ipr-hero-todo li.is-next {
  border-color: color-mix(in srgb, var(--hop) 50%, var(--line));
  color: var(--ink);
  font-weight: 600;
}
.ipr-hero-todo li.is-next b { background: var(--hop); color: var(--on-hop); }
@media (max-width: 760px) {
  .ipr-steps { grid-template-columns: 1fr; }
  .ipr-steps::before { display: none; }
  .ipr-hero-perday { flex: 1 1 100%; }
}

/* Пульс месяца — без «коробки в коробке» */
.ipr-pulse {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.ipr-pulse-head { margin: 0 0 12px; }
.ipr-pulse-head h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  line-height: 1.3;
}
.ipr-pulse-head .field-hint {
  margin: 0;
  max-width: 70ch;
  line-height: 1.45;
}
.ipr-pulse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ipr-pulse-cards li {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
  box-shadow: inset 0 3px 0 var(--line-strong);
  text-align: center;
}
.ipr-pulse-cards li.is-ok {
  background: var(--success-bg);
  box-shadow: inset 0 3px 0 var(--success);
}
.ipr-pulse-cards li.is-bad {
  background: color-mix(in srgb, var(--danger-bg) 70%, var(--surface));
  box-shadow: inset 0 3px 0 var(--danger);
}
.ipr-pulse-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
}
.ipr-pulse-cards strong {
  font-size: 1.35rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.ipr-pulse-extra,
.ipr-pulse-target {
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-soft);
}
.ipr-pulse-gap {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
.is-ok .ipr-pulse-gap { color: var(--success); }
.is-bad .ipr-pulse-gap { color: var(--danger); }

@media (max-width: 720px) {
  .ipr-col-label { width: 40%; }
  .ipr-sheet th,
  .ipr-sheet td { padding: 8px; }
}

/* =============================================================================
   029 partner MVP: диалог подтверждения, тост, занятые кнопки, ошибки у полей.
   Цвета — роли темы (--surface/--ink/--line/--hop); glass — в themes.css.
   ============================================================================= */
.confirm-dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  max-height: min(80dvh, 560px);
  margin: auto;
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(8, 12, 18, 0.32);
}
.confirm-dialog::backdrop { background: rgba(12, 16, 22, 0.42); }
.confirm-dialog[open] { animation: confirm-dialog-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
.confirm-dialog-body {
  display: grid;
  gap: 8px;
  padding: 22px 22px 18px;
}
.confirm-dialog-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.confirm-dialog-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.confirm-dialog-actions .button { min-width: 112px; }
@keyframes confirm-dialog-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes confirm-sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@media (max-width: 720px) {
  .confirm-dialog {
    width: 100%;
    max-height: min(85dvh, 560px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(15, 30, 60, 0.2);
  }
  .confirm-dialog[open] { animation: confirm-sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .confirm-dialog-body { padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .confirm-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .confirm-dialog-actions .button {
    min-width: 0;
    min-height: 48px;
  }
}

/* Тост: снизу по центру, на телефоне — над капсулой дока. */
.rmkd-toast {
  position: fixed;
  z-index: 1300;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(560px, calc(100vw - 24px));
  padding: 12px 12px 12px 18px;
  color: #f5f5f7;
  background: rgba(28, 30, 36, 0.94);
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.45);
  font-size: 14.5px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.18s var(--ease-out),
    transform 0.22s var(--ease-out),
    visibility 0s linear 0.22s;
}
.rmkd-toast.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.rmkd-toast-text { margin: 0; }
.rmkd-toast-action {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 12px;
  color: var(--hop);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.rmkd-toast-action:hover,
.rmkd-toast-action:focus-visible { background: rgba(255, 255, 255, 0.1); }
.rmkd-toast-action[hidden] { display: none; }
@media (max-width: 900px) {
  .rmkd-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .rmkd-toast-action { min-height: 44px; }
}

/* Кнопка ждёт ответа сервера (B4). */
.button[aria-busy="true"] { cursor: progress; }
.button[aria-busy="true"]::after {
  content: "";
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rmkd-busy-spin 0.7s linear infinite;
}
@keyframes rmkd-busy-spin { to { transform: rotate(360deg); } }

/* Ошибка сервера у поля (позиции экранов и др. AJAX-формы). */
[data-ajax-invalid] {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 1px var(--danger) !important;
}
.field-error[data-ajax-error] {
  font-size: 12px;
  line-height: 1.35;
}
[data-menu-status].is-error {
  color: var(--danger);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .confirm-dialog[open] { animation: none; }
  .rmkd-toast,
  .rmkd-toast.is-open { transform: translate(-50%, 0); transition: opacity 0.01s, visibility 0s; }
  .button[aria-busy="true"]::after { animation: none; border-right-color: currentColor; opacity: 0.5; }
}

/* 029: полоса ИПР из шести вкладок на телефоне листается вбок, а не переносится. */
@media (max-width: 720px) {
  .report-main .sync-tabs.ipr-step-tabs {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .report-main .sync-tabs.ipr-step-tabs::-webkit-scrollbar { display: none; }
  .report-main .sync-tabs.ipr-step-tabs a { flex: none; white-space: nowrap; }
}

/* 029: граница групп «Деньги / Товар» в аналитике. */
.page-tabs-sep {
  flex: none;
  width: 1px;
  align-self: stretch;
  margin: 6px 4px;
  background: var(--line);
}
.report-sheet-nav .filter-period-title:not(:first-child) { margin-top: 10px; }

/* 029: страница ошибки внутри кабинета — карточка в потоке, не на весь экран. */
.app-body .auth-layout.error-page {
  min-height: 0;
  padding: 48px 16px;
}
.app-body .auth-layout.error-page .auth-card { min-height: 0; }

html[data-ui="dark"] .ipr-sheet thead th.ipr-th-hint[data-hint]::after,
html[data-ui="dark"] .ipr-goal-stats li.has-hint[data-hint]::after {
  background: #111;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
