/* ==========================================================================
   Кофебайт CRM — графит, крем, лиловый; пиксельный мотив.
   Шрифты: Unbounded (заголовки, цифры), Manrope (текст), Pixelify Sans (акценты).
   ========================================================================== */

/* ---------- токены ---------- */
:root {
  --bg: #16120f;
  --bg-sunk: #120f0c;
  --surface: #211c19;
  --surface-2: #2b2521;
  --surface-3: #342d28;
  --line: #3a322d;
  --line-soft: #2e2824;
  --text: #f3e7d6;
  --text-2: #b9aa98;
  --text-3: #a39483;
  --lilac: #b48ee6;
  --lilac-hover: #c7a8f0;
  --lilac-deep: #7a56b8;
  --lilac-ink: #1d1426;
  --caramel: #e0a458;
  --red: #e56b6f;
  --green: #7cc79a;
  --sky: #7fb4e0;
  --cream: #e8d5b5;

  --lilac-a10: rgba(180, 142, 230, 0.1);
  --lilac-a15: rgba(180, 142, 230, 0.15);
  --lilac-a25: rgba(180, 142, 230, 0.25);
  --caramel-a12: rgba(224, 164, 88, 0.13);
  --red-a12: rgba(229, 107, 111, 0.13);
  --green-a12: rgba(124, 199, 154, 0.13);
  --sky-a12: rgba(127, 180, 224, 0.13);

  --input-bg: #1a1613;
  --sidebar-bg: #191512;
  --overlay: rgba(10, 8, 6, 0.66);
  --cup-lid: #f3e7d6;
  --cup-body: #e3d2b9;
  --grain-opacity: 0.09;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.35);
  --glow: 0 8px 24px -10px rgba(180, 142, 230, 0.65);

  --r-xs: 7px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-pixel: 'Pixelify Sans', ui-monospace, 'Cascadia Mono', monospace;

  --sidebar-w: 248px;
  --tabbar-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #f6efe4;
  --bg-sunk: #efe6d8;
  --surface: #fffaf2;
  --surface-2: #f4ebde;
  --surface-3: #ebdfcd;
  --line: #e0d2bd;
  --line-soft: #ebe1d1;
  --text: #211b17;
  --text-2: #5e5044;
  --text-3: #6f6153;
  --lilac: #6b45a8;
  --lilac-hover: #7a56b8;
  --lilac-deep: #7a56b8;
  --lilac-ink: #ffffff;
  --caramel: #94570f;
  --red: #b5363c;
  --green: #2c7a4d;
  --sky: #2f6a9c;
  --cream: #8a6a3c;

  --lilac-a10: rgba(122, 86, 184, 0.08);
  --lilac-a15: rgba(122, 86, 184, 0.12);
  --lilac-a25: rgba(122, 86, 184, 0.22);
  --caramel-a12: rgba(196, 128, 42, 0.13);
  --red-a12: rgba(196, 64, 70, 0.1);
  --green-a12: rgba(44, 122, 77, 0.1);
  --sky-a12: rgba(47, 106, 156, 0.1);

  --input-bg: #fffdf9;
  --sidebar-bg: #f1e8da;
  --overlay: rgba(33, 27, 23, 0.42);
  --cup-lid: #2b2521;
  --cup-body: #4a3f38;
  --grain-opacity: 0.06;

  --shadow-1: 0 1px 2px rgba(60, 40, 20, 0.06), 0 10px 30px -20px rgba(60, 40, 20, 0.35);
  --shadow-2: 0 24px 60px -24px rgba(60, 40, 20, 0.45), 0 2px 8px rgba(60, 40, 20, 0.08);
  --glow: 0 8px 22px -12px rgba(107, 69, 168, 0.55);

  color-scheme: light;
}

/* ---------- база ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url('/img/grain.svg');
  background-size: 220px 220px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
}

#app {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: var(--lilac);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--lilac-hover);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--lilac-a25);
}

.sr-only {
  position: absolute !important;
  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;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--lilac);
  color: var(--lilac-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 12px;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Menlo, monospace;
  font-size: 0.86em;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 13px;
}

.strong {
  font-weight: 700;
}

.text-red {
  color: var(--red);
}

.text-green {
  color: var(--green);
}

.text-caramel {
  color: var(--caramel);
}

.text-red-soft {
  color: var(--red);
  opacity: 0.9;
}

.mr-auto {
  margin-right: auto;
}

.eyebrow-plain {
  font-family: var(--font) !important;
  font-weight: 700;
  font-size: 12px !important;
  letter-spacing: 0.1em !important;
}

.eyebrow {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lilac);
}

/* ---------- логотип и пиксели ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.logo-word {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

.logo-word-svg {
  fill: currentColor;
  flex: none;
}

.logo-tag {
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 3px 6px 2px;
  border-radius: 4px;
  background: var(--lilac-a15);
  color: var(--lilac);
}

.logo-mark {
  flex: none;
  overflow: visible;
}

.px-lid {
  fill: var(--cup-lid);
}

.px-body {
  fill: var(--cup-body);
}

.px-sleeve {
  fill: var(--lilac);
}

.px-steam {
  fill: var(--lilac-hover);
}

.logo-mark.is-animated .px-steam {
  animation: px-steam 2.8s steps(4, end) infinite;
}

.logo-mark.is-animated .px-steam-2 {
  animation-delay: -0.9s;
}

.logo-mark.is-animated .px-steam-3 {
  animation-delay: -1.8s;
}

@keyframes px-steam {
  0% {
    opacity: 0;
    transform: translateY(1px);
  }
  30% {
    opacity: 1;
  }
  75% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translateY(-2px);
  }
}

.pixel-steam {
  position: absolute;
  width: 72px;
  height: 84px;
  pointer-events: none;
}

.pixel-steam .ps {
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--lilac);
  opacity: 0;
  animation: px-rise 4.2s steps(7, end) infinite;
}

.ps-1 { left: 8px; bottom: 0; animation-delay: 0s !important; }
.ps-2 { left: 22px; bottom: 6px; animation-delay: -0.6s !important; background: var(--cream) !important; }
.ps-3 { left: 36px; bottom: 2px; animation-delay: -1.2s !important; }
.ps-4 { left: 50px; bottom: 8px; animation-delay: -1.8s !important; background: var(--lilac-hover) !important; }
.ps-5 { left: 15px; bottom: 14px; animation-delay: -2.4s !important; }
.ps-6 { left: 29px; bottom: 18px; animation-delay: -3s !important; background: var(--cream) !important; }
.ps-7 { left: 43px; bottom: 12px; animation-delay: -3.6s !important; }
.ps-8 { left: 57px; bottom: 20px; animation-delay: -1.5s !important; background: var(--lilac-hover) !important; }
.ps-9 { left: 1px; bottom: 22px; animation-delay: -2.7s !important; }

@keyframes px-rise {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  20% {
    opacity: 0.85;
  }
  80% {
    opacity: 0.25;
  }
  100% {
    opacity: 0;
    transform: translateY(-56px);
  }
}

.px-bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--lilac);
  box-shadow: 8px -8px 0 -1px var(--lilac-a25);
  margin-right: 10px;
  flex: none;
  vertical-align: middle;
}

.step-divider {
  height: 8px;
  background: var(--line);
  -webkit-mask: url('/img/steps.svg') repeat-x left center / 32px 8px;
  mask: url('/img/steps.svg') repeat-x left center / 32px 8px;
  opacity: 0.9;
}

/* ---------- загрузка ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}

.boot-cup {
  display: grid;
  grid-template-columns: repeat(3, 10px);
  gap: 4px;
}

.boot-cup i {
  width: 10px;
  height: 10px;
  background: var(--lilac);
  animation: boot-pulse 1.2s steps(3, end) infinite;
}

.boot-cup i:nth-child(2n) {
  background: var(--cream);
}

.boot-cup i:nth-child(2) { animation-delay: 0.15s; }
.boot-cup i:nth-child(3) { animation-delay: 0.3s; }
.boot-cup i:nth-child(4) { animation-delay: 0.45s; }
.boot-cup i:nth-child(5) { animation-delay: 0.6s; }
.boot-cup i:nth-child(6) { animation-delay: 0.75s; }

@keyframes boot-pulse {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.boot-text {
  font-family: var(--font-pixel);
  color: var(--text-2);
  letter-spacing: 0.06em;
}

.offline {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.offline h1 {
  font-family: var(--font-display);
  font-size: 22px;
}

/* ---------- кнопки ---------- */
.btn {
  --btn-h: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s, color 0.15s, box-shadow 0.2s, transform 0.08s;
  position: relative;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
}

.btn .icon {
  flex: none;
}

.btn-primary {
  background: var(--lilac);
  color: var(--lilac-ink);
  box-shadow: var(--glow);
}

[data-theme='light'] .btn-primary {
  background: var(--lilac-deep);
}

.btn-primary:hover:not(:disabled) {
  background: var(--lilac-hover);
  color: var(--lilac-ink);
}

[data-theme='light'] .btn-primary:hover:not(:disabled) {
  background: #6a47a6;
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-primary-soft {
  background: var(--lilac-a15);
  color: var(--lilac);
}

.btn-primary-soft:hover:not(:disabled) {
  background: var(--lilac-a25);
  color: var(--lilac);
}

.btn-danger {
  background: var(--red);
  color: #1b0d0e;
}

[data-theme='light'] .btn-danger {
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--red-a12);
}

.btn-chip {
  --btn-h: 38px;
  border-radius: 999px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  padding: 0 14px 0 11px;
  box-shadow: var(--shadow-1);
}

.btn-chip .icon {
  color: var(--lilac);
}

.btn-chip:hover:not(:disabled) {
  border-color: var(--lilac-a25);
  background: var(--surface-2);
}

.btn-sm {
  --btn-h: 32px;
  padding: 0 11px;
  font-size: 13.5px;
  border-radius: 10px;
  gap: 6px;
}

.btn-lg {
  --btn-h: 50px;
  font-size: 16px;
  border-radius: 14px;
}

.btn-block {
  width: 100%;
}

.btn-icon-only {
  padding: 0;
  width: var(--btn-h);
}

.btn.is-busy {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-busy > * {
  visibility: hidden;
}

.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  left: calc(50% - 4px);
  top: calc(50% - 4px);
  background: var(--lilac-ink);
  box-shadow: -12px 0 0 var(--lilac-ink), 12px 0 0 var(--lilac-ink);
  animation: busy 0.9s steps(3, end) infinite;
}

.btn-secondary.is-busy::after,
.btn-ghost.is-busy::after,
.btn-primary-soft.is-busy::after {
  background: var(--lilac);
  box-shadow: -12px 0 0 var(--lilac), 12px 0 0 var(--lilac);
}

@keyframes busy {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  transition: background-color 0.15s, color 0.15s;
  flex: none;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn-danger:hover:not(:disabled) {
  background: var(--red-a12);
  color: var(--red);
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 650;
  font-size: 13.5px;
  text-decoration: none;
  color: var(--text-2);
  padding: 4px 6px 4px 10px;
  border-radius: 8px;
}

.link-more:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- бейджи ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}

.badge .icon {
  flex: none;
}

.badge-lilac { background: var(--lilac-a15); color: var(--lilac); }
.badge-caramel { background: var(--caramel-a12); color: var(--caramel); }
.badge-red { background: var(--red-a12); color: var(--red); }
.badge-green { background: var(--green-a12); color: var(--green); }
.badge-sky { background: var(--sky-a12); color: var(--sky); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }

.badge-px {
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  border-radius: 3px;
  padding: 3px 7px 2px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.18);
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- поля ввода ---------- */
.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.input::placeholder {
  color: var(--text-3);
  opacity: 0.8;
}

.input:hover {
  border-color: color-mix(in srgb, var(--line) 50%, var(--text-3));
}

.input:focus {
  outline: none;
  border-color: var(--lilac);
  box-shadow: 0 0 0 3px var(--lilac-a25);
}

.input:disabled {
  opacity: 0.5;
}

.input[aria-invalid='true'] {
  border-color: var(--red);
}

.input-lg {
  height: 50px;
  font-size: 16px;
  border-radius: 14px;
}

.input-static {
  display: flex;
  align-items: center;
  color: var(--text-2);
  background: var(--surface-2);
}

.textarea {
  height: auto;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
  min-height: 64px;
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a39483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.select-compact {
  height: 38px;
  width: auto;
  max-width: 100%;
  font-size: 14px;
}

.input-num {
  font-variant-numeric: tabular-nums;
}

.input-wrap {
  position: relative;
}

.input-affix {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.input-affix:focus-within {
  border-color: var(--lilac);
  box-shadow: 0 0 0 3px var(--lilac-a25);
}

.input-affix .input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-right: 4px;
}

.input-affix .input:disabled + .affix {
  opacity: 0.5;
}

.has-error .input-affix,
.input-affix:has(.input[aria-invalid='true']) {
  border-color: var(--red);
}

.affix {
  flex: none;
  padding: 0 12px 0 4px;
  color: var(--text-3);
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
}

.input-with-btn {
  position: relative;
}

.input-with-btn .input {
  padding-right: 50px;
}

.input-with-btn .icon-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  height: 40px;
  padding-left: 40px;
}

.search-input::-webkit-search-cancel-button {
  filter: grayscale(1);
  opacity: 0.6;
}

/* переключатель */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  position: relative;
  min-height: 36px;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 38px;
  height: 22px;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  flex: none;
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background-color 0.18s, border-color 0.18s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--text-2);
  transition: transform 0.18s var(--ease), background-color 0.18s;
}

.switch-input:checked + .switch-track {
  background: var(--lilac);
  border-color: var(--lilac);
}

[data-theme='light'] .switch-input:checked + .switch-track {
  background: var(--lilac-deep);
  border-color: var(--lilac-deep);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(16px);
  background: var(--lilac-ink);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}

.switch-input:checked ~ .switch-label {
  color: var(--text);
}

/* сегменты */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  max-width: 100%;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn[aria-checked='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme='light'] .seg-btn[aria-checked='true'] {
  box-shadow: 0 1px 3px rgba(60, 40, 20, 0.14);
}

.seg-count {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 700;
}

.seg-btn[aria-checked='true'] .seg-count {
  color: var(--lilac);
}

.chip-scroll {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

/* вкладки */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab[role='tab'] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-weight: 650;
  font-size: 14.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab[role='tab']:hover {
  color: var(--text);
}

.tab[role='tab'][aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--lilac);
}

.tab-count {
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}

.tab[aria-selected='true'] .tab-count {
  background: var(--lilac-a15);
  color: var(--lilac);
}

/* ---------- каркас ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 18px;
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand:hover {
  color: var(--text);
}

.brand-crm {
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 3px 6px 2px;
  border-radius: 4px;
  background: var(--lilac-a15);
  color: var(--lilac);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-caption {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 12px 6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: 650;
  font-size: 14.5px;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item[aria-current='page'] {
  background: var(--lilac-a15);
  color: var(--text);
}

.nav-item[aria-current='page'] .nav-item-icon {
  color: var(--lilac);
}

.nav-item[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 12px;
  width: 4px;
  height: 16px;
  background: var(--lilac);
  box-shadow: 4px 4px 0 -0px var(--lilac-a25);
}

.nav-item-icon {
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding-left: 6px;
}

.sidebar-login {
  font-weight: 650;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.main {
  margin-left: var(--sidebar-w);
  padding: 30px 36px 56px;
  min-height: 100vh;
  outline: none;
}

.main > .page {
  max-width: 1320px;
  margin: 0 auto;
}

.topbar,
.tabbar {
  display: none;
}

/* ---------- страница ---------- */
.page {
  display: grid;
  gap: 20px;
  animation: page-in 0.32s var(--ease) both;
  min-width: 0;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page > * {
  min-width: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  padding-bottom: 2px;
}

.page-titles {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
  outline: none;
}

.page-subtitle {
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 92ch;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.grid > * {
  min-width: 0;
}

/* ---------- карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-titles {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--lilac-a10);
  color: var(--lilac);
  flex: none;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.card-meta {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.big-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.calm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--green-a12);
  color: var(--green);
  font-weight: 650;
  font-size: 14px;
}

.error-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  color: var(--red);
}

.error-card h2 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 4px;
}

/* показатели */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 15px 16px 14px;
  box-shadow: var(--shadow-1);
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
}

.stat-label .icon {
  color: var(--text-3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 12.5px;
  color: var(--text-3);
}

.stat-green .stat-value { color: var(--green); }
.stat-caramel .stat-value { color: var(--caramel); }
.stat-red .stat-value { color: var(--red); }

.progress {
  height: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--lilac);
  transition: width 0.5s var(--ease);
}

.progress-caramel .progress-bar { background: var(--caramel); }
.progress-red .progress-bar { background: var(--red); }

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  margin: 12px 0 0;
  font-size: 14px;
}

.kv dt {
  color: var(--text-2);
}

.kv dd {
  margin: 0;
  text-align: right;
  font-weight: 650;
}

.kv-tight {
  gap: 6px 12px;
  font-size: 13.5px;
}

/* аватары */
.avatar {
  --av: var(--lilac);
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex: none;
  background: color-mix(in srgb, var(--av) 18%, transparent);
  color: var(--av);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 10.5px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 16px;
}

/* цвета сотрудников */
.emp-0 { --av: #b48ee6; --emp: #b48ee6; }
.emp-1 { --av: #e0a458; --emp: #e0a458; }
.emp-2 { --av: #7cc79a; --emp: #7cc79a; }
.emp-3 { --av: #7fb4e0; --emp: #7fb4e0; }
.emp-4 { --av: #e88a8d; --emp: #e88a8d; }
.emp-5 { --av: #d9c3a0; --emp: #d9c3a0; }

[data-theme='light'] .emp-0 { --av: #6b45a8; --emp: #7a56b8; }
[data-theme='light'] .emp-1 { --av: #94570f; --emp: #c4802a; }
[data-theme='light'] .emp-2 { --av: #2c7a4d; --emp: #3f9a66; }
[data-theme='light'] .emp-3 { --av: #2f6a9c; --emp: #4a8bc0; }
[data-theme='light'] .emp-4 { --av: #b5363c; --emp: #d0575c; }
[data-theme='light'] .emp-5 { --av: #7a5a2c; --emp: #b09060; }

/* категории (расходы, контакты) */
.cat-bg-0 { background: #b48ee6; }
.cat-bg-1 { background: #7fb4e0; }
.cat-bg-2 { background: #e0a458; }
.cat-bg-3 { background: #7cc79a; }
.cat-bg-4 { background: #d9c3a0; }
.cat-bg-5 { background: #e56b6f; }
.cat-bg-6 { background: #5fb3a8; }
.cat-bg-7 { background: #8f6bd1; }
.cat-bg-8 { background: #f0a07c; }
.cat-bg-9 { background: #9c8b7a; }

.cat-stroke-0 { stroke: #b48ee6; }
.cat-stroke-1 { stroke: #7fb4e0; }
.cat-stroke-2 { stroke: #e0a458; }
.cat-stroke-3 { stroke: #7cc79a; }
.cat-stroke-4 { stroke: #d9c3a0; }
.cat-stroke-5 { stroke: #e56b6f; }
.cat-stroke-6 { stroke: #5fb3a8; }
.cat-stroke-7 { stroke: #8f6bd1; }
.cat-stroke-8 { stroke: #f0a07c; }
.cat-stroke-9 { stroke: #9c8b7a; }

.cat-edge-0 { border-left-color: #b48ee6 !important; }
.cat-edge-1 { border-left-color: #7fb4e0 !important; }
.cat-edge-2 { border-left-color: #e0a458 !important; }
.cat-edge-3 { border-left-color: #7cc79a !important; }
.cat-edge-4 { border-left-color: #d9c3a0 !important; }
.cat-edge-5 { border-left-color: #e56b6f !important; }
.cat-edge-6 { border-left-color: #5fb3a8 !important; }
.cat-edge-7 { border-left-color: #8f6bd1 !important; }
.cat-edge-8 { border-left-color: #f0a07c !important; }
.cat-edge-9 { border-left-color: #9c8b7a !important; }

.cat-soft-0 { --av: #b48ee6; }
.cat-soft-1 { --av: #7fb4e0; }
.cat-soft-2 { --av: #e0a458; }
.cat-soft-3 { --av: #7cc79a; }
.cat-soft-4 { --av: #d9c3a0; }
.cat-soft-5 { --av: #e88a8d; }
.cat-soft-6 { --av: #5fb3a8; }

[data-theme='light'] .cat-soft-0 { --av: #6b45a8; }
[data-theme='light'] .cat-soft-1 { --av: #2f6a9c; }
[data-theme='light'] .cat-soft-2 { --av: #94570f; }
[data-theme='light'] .cat-soft-3 { --av: #2c7a4d; }
[data-theme='light'] .cat-soft-4 { --av: #7a5a2c; }
[data-theme='light'] .cat-soft-5 { --av: #b5363c; }
[data-theme='light'] .cat-soft-6 { --av: #2a7a70; }

/* ---------- таблицы ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border-radius: var(--r);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th,
.table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.table thead th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom-color: var(--line);
  white-space: nowrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.table .num {
  text-align: right;
}

.table tbody tr:hover > * {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.table tfoot th,
.table tfoot td {
  border-bottom: 0;
  font-weight: 700;
  padding-top: 14px;
}

.table-compact th,
.table-compact td {
  padding: 8px 10px;
}

.td-action {
  text-align: right;
  white-space: nowrap;
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.table-note {
  margin-top: -6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.fc-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
}

.fc-legend .fc-pill {
  min-width: 0;
  font-size: 12px;
  padding: 2px 7px;
}

/* ---------- главная ---------- */
.home-head {
  align-items: flex-end;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr);
  gap: 22px 28px;
  padding: 26px 28px 24px;
  border-color: var(--lilac-a25);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(122, 86, 184, 0.28), transparent 55%),
    radial-gradient(80% 90% at 100% 100%, rgba(224, 164, 88, 0.07), transparent 60%),
    var(--surface);
}

[data-theme='light'] .hero {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(122, 86, 184, 0.14), transparent 55%),
    radial-gradient(80% 90% at 100% 100%, rgba(224, 164, 88, 0.1), transparent 60%),
    var(--surface);
}

.hero-steam {
  top: -30px;
  left: 214px;
  opacity: 0.75;
}

.hero-main {
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: start;
  position: relative;
}

.hero-title {
  font-family: var(--font-display);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-top: 4px;
}

.hero-num {
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-unit {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-2);
  margin-left: -6px;
}

.hero-approx {
  font-size: 19px;
  font-weight: 600;
  color: var(--lilac);
  padding: 4px 12px;
  border-radius: 10px;
  background: var(--lilac-a15);
  letter-spacing: -0.01em;
}

.hero-title-bad {
  font-size: 20px;
  color: var(--red);
}

.hero-sub {
  color: var(--text-2);
  font-size: 14.5px;
}

.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 4px;
}

.f-chip {
  display: grid;
  gap: 2px;
  padding: 9px 13px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--line);
}

.f-chip b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.f-cap {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 650;
}

.f-legend {
  font-size: 11.5px;
  color: var(--text-3);
}

.f-op {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text-3);
}

.hero-breakdown {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 13.5px;
}

.hero-breakdown li {
  display: flex;
  gap: 6px;
}

.hero-breakdown span {
  color: var(--text-3);
}

.hero-breakdown b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hero-side {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 50%, transparent);
  position: relative;
}

.hero-plan {
  font-size: 14px;
  color: var(--text-2);
}

.hero-plan-num {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}

.gauge {
  display: block;
  padding: 8px 0 2px;
}

.gauge-track {
  position: relative;
  display: block;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
}

.gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--lilac-deep), var(--lilac));
}

.gauge.is-below .gauge-fill {
  background: linear-gradient(90deg, #b07a3a, var(--caramel));
}

.gauge-mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  background: var(--text);
  border-radius: 2px;
}

.gauge-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
}

.gauge-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gauge-legend span::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--lilac);
}

.gauge.is-below .gl-plan::before {
  background: var(--caramel);
}

.gauge-legend .gl-be::before {
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: var(--text);
}

.hero-profit {
  display: grid;
  gap: 2px;
}

.hero-profit-num {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hero-profit-num span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.hero-profit.is-pos .hero-profit-num { color: var(--green); }
.hero-profit.is-neg .hero-profit-num { color: var(--red); }

.hero-profit-sub {
  font-weight: 650;
  color: var(--text-2);
  font-size: 14px;
}

.hero-warns {
  grid-column: 1 / -1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.hero-warns li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 11px;
  background: var(--caramel-a12);
  color: var(--caramel);
  font-size: 13.5px;
  font-weight: 600;
}

.hero-warns li .icon {
  flex: none;
}

.warn-link {
  color: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.warn-link:hover {
  color: var(--text);
}

.stats-home .stat-value {
  font-size: 22px;
}

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

.exp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.task-stack {
  display: grid;
  gap: 8px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mini-stats > div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.mini-stats > .is-due {
  background: var(--caramel-a12);
}

.mini-stats > .is-due .mini-num {
  color: var(--caramel);
}

.mini-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mini-cap {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.mini-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.mini-list li:last-child {
  border-bottom: 0;
}

.mini-list li > span:first-child {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foot-note {
  text-align: center;
  padding-top: 4px;
}

/* график */
.chart-wrap {
  position: relative;
}

.chart {
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}

.grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.axis-zero {
  stroke: var(--text-3);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.axis-label {
  fill: var(--text-3);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
}

.axis-title {
  fill: var(--text-3);
  font-family: var(--font);
  font-weight: 650;
  font-size: 11.5px;
}

.chart-line {
  stroke: var(--lilac);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.grad-pos-a {
  stop-color: var(--green);
  stop-opacity: 0.32;
}

.grad-pos-b {
  stop-color: var(--green);
  stop-opacity: 0.03;
}

.area-neg {
  fill: var(--red);
  fill-opacity: 0.14;
}

.mark-line {
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.mark-be { stroke: var(--caramel); fill: var(--caramel); }
.mark-plan { stroke: var(--lilac); fill: var(--lilac); }

.mark-label {
  stroke: none;
  font-family: var(--font);
  font-weight: 700;
  font-size: 12px;
}

.mark-dot {
  fill: var(--lilac);
  stroke: var(--surface);
  stroke-width: 2.5;
}

.cursor-line {
  stroke: var(--text-3);
  stroke-width: 1;
}

.cursor-dot {
  stroke: var(--surface);
  stroke-width: 2;
  fill: var(--lilac);
}

.cursor-dot.is-pos { fill: var(--green); }
.cursor-dot.is-neg { fill: var(--red); }

.chart-overlay {
  cursor: crosshair;
}

.chart-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  pointer-events: none;
  padding: 8px 11px;
  border-radius: 11px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  white-space: nowrap;
  z-index: 2;
}

.chart-tip-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.chart-tip .pos {
  color: var(--green);
  font-weight: 700;
}

.chart-tip .neg {
  color: var(--red);
  font-weight: 700;
}

.chart-tip-sub {
  color: var(--text-2);
}

.profit-table tr.is-plan > * {
  background: var(--lilac-a10);
}

.profit-table tr.is-neg td.strong {
  color: var(--red);
}

.profit-table tr.is-pos td.strong {
  color: var(--green);
}

.profit-card .table-scroll {
  margin-top: 14px;
}

/* donut и легенда */
.donut-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.donut-wrap {
  position: relative;
  flex: none;
}

.donut {
  overflow: visible;
}

.donut-track {
  stroke: var(--surface-2);
}

.donut-seg {
  transition: stroke-width 0.15s;
}

.donut-seg:hover {
  stroke-width: 16;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-value {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.donut-label {
  font-size: 12px;
  color: var(--text-3);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  flex: 1 1 200px;
  min-width: 0;
}

.legend-item {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
}

.legend-item:hover,
.legend-item.is-active {
  background: var(--surface-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-label {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.legend-value {
  font-weight: 700;
}

.legend-pct {
  text-align: right;
  color: var(--text-3);
  font-size: 12.5px;
}

/* план / факт */
.pf-bars {
  display: grid;
  gap: 12px;
}

.pf-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  margin-bottom: 5px;
}

.pf-label {
  color: var(--text-2);
  font-weight: 600;
}

.pf-nums b {
  font-variant-numeric: tabular-nums;
}

.pf-of {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pf-track {
  position: relative;
  height: 9px;
  border-radius: 5px;
  background: var(--surface-2);
}

.pf-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  max-width: 100%;
  transition: width 0.5s var(--ease);
}

.pf-fill.is-over {
  background: var(--red) !important;
}

.pf-plan {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  border-radius: 1px;
  opacity: 0.7;
}

/* ---------- платежи ---------- */
.pay-list {
  display: grid;
  gap: 6px;
}

.pay-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 6px;
  border-radius: 13px;
  transition: background-color 0.15s;
}

.pay-row:hover {
  background: var(--surface-2);
}

.pay-date {
  display: grid;
  justify-items: center;
  padding: 5px 0 4px;
  border-radius: 11px;
  background: var(--surface-2);
  line-height: 1.1;
}

.pay-row.is-overdue .pay-date {
  background: var(--red-a12);
  color: var(--red);
}

.pay-day {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}

.pay-mon {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 650;
}

.pay-row.is-overdue .pay-mon {
  color: var(--red);
}

.pay-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.pay-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

.pay-amount {
  font-weight: 700;
}

.grid-pay {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  align-items: start;
}

.pay-side {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.pay-defs {
  display: grid;
  gap: 4px;
}

.pay-def {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
}

.pay-def:hover {
  background: var(--surface-2);
}

.pay-def-main,
.pay-def-side {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pay-def-side {
  text-align: right;
  font-weight: 700;
}

/* календари */
.cal {
  display: grid;
  gap: 6px;
}

.cal-head,
.cal-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-wd {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.04em;
  padding-bottom: 2px;
}

.cal-wd.is-weekend {
  color: var(--lilac);
  opacity: 0.85;
}

.cal-cell {
  position: relative;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 6px 6px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.cal-cell.is-weekend {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--lilac-a10));
}

.cal-cell.is-out {
  background: transparent;
  border: 1px dashed var(--line-soft);
  opacity: 0.5;
}

.cal-cell.is-today {
  border-color: var(--lilac);
  box-shadow: 0 0 0 3px var(--lilac-a15);
}

.cal-num {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  line-height: 1;
  padding: 2px 2px 0;
}

.cal-cell.is-today .cal-num {
  color: var(--lilac);
}

.cal-btn {
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.cal-btn:hover {
  border-color: var(--line);
  background: var(--surface-3);
}

.cal-add {
  position: absolute;
  right: 6px;
  top: 5px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s;
}

.cal-btn:hover .cal-add,
.cal-btn:focus-visible .cal-add {
  opacity: 1;
}

.cal-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cal-person {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--emp) 22%, transparent);
  color: var(--av);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.cal-person.is-paid {
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--emp) 45%, transparent);
  opacity: 0.8;
}

.cal-chip {
  display: grid;
  gap: 0;
  width: 100%;
  padding: 3px 6px 3px 7px;
  border: 0;
  border-left: 3px solid var(--lilac);
  border-radius: 6px;
  background: var(--lilac-a10);
  text-align: left;
  font-size: 11.5px;
  line-height: 1.25;
  min-width: 0;
}

.cal-chip:hover {
  background: var(--lilac-a15);
}

.cal-chip .icon {
  display: none;
}

.cal-chip-text {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-chip-sum {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-chip.is-paid {
  background: var(--green-a12);
  opacity: 0.85;
}

.cal-chip.is-paid .cal-chip-text::before {
  content: '✓ ';
  color: var(--green);
}

.cal-chip.is-overdue {
  background: var(--red-a12);
  border-left-color: var(--red) !important;
}

.cal-chip.is-overdue .cal-chip-text {
  color: var(--red);
}

.cal-hint {
  margin-top: 10px;
}

/* ---------- сотрудники ---------- */
.grid-staff {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.staff-team {
  grid-row: span 2;
}

.emp-list {
  display: grid;
  gap: 6px;
}

.emp-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
}

.emp-card:hover {
  background: var(--surface-2);
}

.emp-card.is-inactive {
  opacity: 0.6;
}

.emp-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.emp-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shift-day {
  display: grid;
  gap: 8px;
}

.shift-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 96px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}

.shift-line.is-on {
  border-color: color-mix(in srgb, var(--emp) 45%, transparent);
  background: color-mix(in srgb, var(--emp) 9%, var(--surface-2));
}

.shift-who {
  display: grid;
  gap: 0;
  min-width: 0;
}

.shift-who .switch {
  color: var(--text);
  min-height: 28px;
}

.shift-hours-wrap .input {
  height: 38px;
  text-align: right;
}

/* ---------- расходы ---------- */
.grid-exp {
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: start;
}

.exp-list-card .card-head {
  margin-bottom: 6px;
}

.exp-groups {
  display: grid;
  gap: 14px;
}

.exp-group {
  display: grid;
  gap: 2px;
}

.exp-date {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-soft);
}

.exp-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.exp-row:hover {
  background: var(--surface-2);
}

.exp-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.exp-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.exp-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex-wrap: wrap;
}

.exp-comment {
  color: var(--text-2);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-amount {
  font-weight: 700;
  font-size: 15px;
}

/* ---------- месяц ---------- */
.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.month-nav .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.month-nav-title {
  min-width: 128px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  padding: 0 4px;
}

.month-nav .btn {
  margin-left: 2px;
}

/* ---------- задачи ---------- */
.quick-card {
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.quick-add {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--lilac-a15);
  color: var(--lilac);
  flex: none;
}

.quick-input {
  border: 0;
  background: transparent;
  height: 40px;
  padding: 0 4px;
  font-size: 15.5px;
}

.quick-input:focus {
  box-shadow: none;
}

.quick-hint {
  font-size: 12.5px;
  color: var(--text-3);
  padding-left: 44px;
}

.quick-hint b {
  font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace;
  font-weight: 600;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
}

.board-tabs {
  display: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.board-col {
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line-soft);
  padding: 12px;
  transition: border-color 0.15s, background-color 0.15s;
  min-width: 0;
}

.board-col.is-drop {
  border-color: var(--lilac);
  border-style: dashed;
  background: var(--lilac-a10);
}

.board-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
}

.board-dot {
  width: 10px;
  height: 10px;
  background: var(--lilac);
  box-shadow: 3px 3px 0 var(--lilac-a25);
}

.board-doing .board-dot {
  background: var(--caramel);
  box-shadow: 3px 3px 0 var(--caramel-a12);
}

.board-done .board-dot {
  background: var(--green);
  box-shadow: 3px 3px 0 var(--green-a12);
}

.board-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
}

.board-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--surface-2);
}

.board-list {
  display: grid;
  gap: 8px;
  min-height: 80px;
  align-content: start;
}

.board-empty {
  padding: 18px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.task {
  --prio: transparent;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 11px 10px 11px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  box-shadow: inset 3px 0 0 var(--prio);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s;
}

.task:hover {
  border-color: var(--line);
}

.task[draggable='true']:active {
  cursor: grabbing;
}

.task.is-dragging {
  opacity: 0.5;
  transform: rotate(-1deg);
}

.task-prio-high {
  --prio: var(--lilac);
}

.task-prio-low {
  --prio: transparent;
}

.task.is-overdue {
  --prio: var(--red);
}

.task-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 2px solid var(--line);
  background: transparent;
  color: transparent;
  padding: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.task-check:hover {
  border-color: var(--green);
  color: var(--green);
}

.task-check.is-checked {
  background: var(--green);
  border-color: var(--green);
  color: var(--surface);
}

.task-body {
  min-width: 0;
}

.task-title {
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task.is-done .task-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
  color: var(--text-3);
}

.task-notes {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.task-meta:empty {
  display: none;
}

.assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
}

.task-move {
  width: 30px;
  height: 30px;
  opacity: 0;
  transition: opacity 0.15s;
}

.task:hover .task-move,
.task:focus-within .task-move {
  opacity: 1;
}

/* ---------- меню ---------- */
.menu-board {
  display: grid;
  gap: 30px;
}

.menu-cat {
  display: grid;
  gap: 14px;
}

.menu-cat-title {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.menu-cat-count {
  margin-left: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--surface-2);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s, transform 0.18s var(--ease);
}

.menu-item:hover {
  border-color: var(--lilac-a25);
}

.menu-item.is-inactive {
  opacity: 0.62;
  border-style: dashed;
}

.menu-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'name edit' 'badges badges';
  gap: 6px 8px;
  align-items: start;
}

.menu-item-name {
  grid-area: name;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  padding-top: 4px;
}

.menu-item-badges {
  grid-area: badges;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.menu-item-badges:empty {
  display: none;
}

.menu-item-edit {
  grid-area: edit;
  margin: -4px -6px 0 0;
}

.menu-item-desc {
  color: var(--text-2);
  font-size: 14px;
}

.price-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-size {
  font-weight: 650;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}

.price-dots {
  flex: 1;
  border-bottom: 2px dotted var(--line);
  transform: translateY(-4px);
  min-width: 12px;
}

.price-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.menu-tech {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.menu-tech summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-3);
  padding: 4px 6px 4px 2px;
  border-radius: 8px;
}

.menu-tech summary::-webkit-details-marker {
  display: none;
}

.menu-tech summary:hover {
  color: var(--text);
}

.menu-tech summary .icon {
  transition: transform 0.18s var(--ease);
}

.menu-tech[open] summary .icon {
  transform: rotate(180deg);
}

.tech-steps {
  margin: 8px 0 4px;
  padding-left: 22px;
  display: grid;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-2);
}

.tech-steps li::marker {
  font-weight: 800;
  color: var(--lilac);
}

.tech-notes {
  font-size: 13px;
  color: var(--caramel);
  padding: 6px 0 2px;
}

.sizes-editor {
  display: grid;
  gap: 10px;
}

.sizes-list {
  display: grid;
  gap: 8px;
}

.size-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface-2);
}

.size-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.size-cap {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
}

.size-del {
  margin-bottom: 3px;
}

.sizes-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.print-menu {
  display: none;
}

/* ---------- себестоимость ---------- */
.stats-costs .stat-value {
  font-size: 21px;
}

.cost-table-host {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 6px;
  min-width: 0;
}

.cost-table-host > .empty {
  padding: 30px 16px;
}

.cost-table {
  min-width: 1080px;
  font-size: 13.5px;
}

.cost-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.cost-table .col-name {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  min-width: 250px;
  max-width: 320px;
}

.cost-table thead .col-name {
  z-index: 2;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-btn:hover,
.sort-btn.is-active {
  color: var(--text);
}

.cost-cat th {
  padding: 18px 12px 8px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

.cost-cat th .px-bullet {
  width: 6px;
  height: 6px;
  box-shadow: 6px -6px 0 -1px var(--lilac-a25);
}

.cost-row th,
.cost-row td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.cost-group:hover .cost-row > *,
.cost-group.is-open .cost-row > * {
  background: var(--surface-2);
}

.cost-group.is-inactive .cost-item {
  color: var(--text-3);
}

.cost-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cost-name-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.cost-item {
  font-weight: 700;
}

.cost-size {
  color: var(--text-3);
  font-weight: 650;
  font-size: 13px;
}

.cost-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cost-badges:empty {
  display: none;
}

.expand-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  padding: 0;
  transition: transform 0.18s var(--ease), background-color 0.15s, color 0.15s;
}

.expand-btn:hover {
  color: var(--text);
  border-color: var(--lilac-a25);
}

.expand-btn[aria-expanded='true'] {
  background: var(--lilac-a15);
  border-color: var(--lilac-a25);
  color: var(--lilac);
}

.expand-btn[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}

.col-variable,
.col-full {
  font-weight: 700;
}

.col-recommended {
  white-space: nowrap;
}

.col-recommended .icon-btn {
  display: inline-grid;
  width: 26px;
  height: 26px;
  margin-left: 4px;
  vertical-align: middle;
  color: var(--lilac);
}

.rec-up {
  color: var(--caramel);
  font-weight: 700;
}

.rec-up::before {
  content: '↑ ';
}

.rec-down {
  color: var(--text-2);
}

.fc-pill {
  display: inline-block;
  min-width: 60px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 750;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.fc-good { background: var(--green-a12); color: var(--green); }
.fc-warn { background: var(--caramel-a12); color: var(--caramel); }
.fc-bad { background: var(--red-a12); color: var(--red); }
.fc-none { color: var(--text-3); }

.cost-detail-cell {
  padding: 0 10px 14px !important;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line) !important;
}

.cost-group:hover .cost-detail-cell {
  background: var(--surface-2);
}

.recipe {
  position: sticky;
  left: 10px;
  max-width: min(980px, calc(100vw - var(--sidebar-w) - 110px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
}

.recipe-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recipe-title {
  display: grid;
  gap: 2px;
}

.recipe-title strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-3);
}

.save-state.is-ok { color: var(--green); }
.save-state.is-error { color: var(--red); }
.save-state.is-busy { color: var(--lilac); }

.save-state.is-busy .icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.recipe-lines {
  display: grid;
  gap: 6px;
}

.recipe-line {
  display: grid;
  grid-template-columns: minmax(200px, 2.4fr) minmax(120px, 1fr) minmax(100px, 0.9fr) minmax(90px, 0.8fr) 36px;
  align-items: center;
  gap: 10px;
}

.recipe-line-head {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-line-head span:nth-child(3),
.recipe-line-head span:nth-child(4) {
  text-align: right;
}

.recipe-line.is-missing .select {
  border-color: color-mix(in srgb, var(--caramel) 60%, var(--line));
}

.rl-comp {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rl-comp .select {
  width: 100%;
}

.line-kind {
  font-size: 11px;
  color: var(--text-3);
  padding-left: 4px;
}

.line-kind:empty {
  display: none;
}

.rl-qty .input-affix .input {
  height: 38px;
  text-align: right;
}

.rl-unit,
.rl-cost {
  text-align: right;
  font-size: 13.5px;
}

.recipe-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.recipe-sum {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.rs-item {
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
}

.rs-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
}

.rs-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.rs-extra {
  font-size: 11.5px;
}

.rs-rec {
  grid-column: span 2;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: var(--lilac-a10);
}

.rs-rec .rs-label {
  grid-column: 1 / -1;
}

/* ---------- сырьё ---------- */
.stock-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.tabs-page {
  margin-top: -6px;
}

.comp-group .card-head {
  margin-bottom: 8px;
}

.comp-list {
  display: grid;
}

.comp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(110px, auto);
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  width: 100%;
  border-radius: 10px;
}

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

.comp-row:hover {
  background: var(--surface-2);
}

.comp-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.comp-name {
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.comp-key {
  color: var(--text-3);
  font-weight: 500;
}

.comp-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comp-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.comp-price {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}

.catalog-card {
  padding: 6px;
}

.catalog-table {
  min-width: 860px;
}

.catalog-row {
  cursor: pointer;
}

.catalog-row.is-used th::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--lilac);
  margin: 0 8px 2px 0;
}

.cat-name {
  font-weight: 650;
  display: inline;
}

.more-row {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.picker {
  display: grid;
  gap: 8px;
}

.picked {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 12px;
  background: var(--lilac-a10);
  border: 1px solid var(--lilac-a25);
  color: var(--lilac);
}

.picked.is-missing {
  background: var(--caramel-a12);
  border-color: transparent;
  color: var(--caramel);
}

.picked-main {
  min-width: 0;
  color: var(--text);
}

.picked-name {
  font-weight: 700;
}

.picker-results {
  display: grid;
  gap: 2px;
}

.picker-results:empty {
  display: none;
}

.picker-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 0;
  background: var(--surface-2);
  text-align: left;
  width: 100%;
}

.picker-item:hover,
.picker-item:focus-visible {
  background: var(--surface-3);
}

.picker-item.is-selected {
  box-shadow: inset 0 0 0 1px var(--lilac);
}

.picker-name {
  font-weight: 650;
  min-width: 0;
}

.picker-meta {
  color: var(--text-3);
  font-size: 13px;
  white-space: nowrap;
}

.picker-empty {
  padding: 6px 4px;
}

.unit-preview {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.unit-preview-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
}

.unit-preview-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}

/* ---------- контакты ---------- */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.contact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
}

.contact-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.contact-titles {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-width: 0;
}

.contact-name {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
}

.contact-company {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.contact-edit {
  margin: -6px -8px 0 0;
}

.contact-links {
  display: grid;
  gap: 4px;
}

.contact-links:empty {
  display: none;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contact-row .contact-link {
  flex: 1;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  min-width: 0;
  transition: background-color 0.15s;
}

.contact-link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.contact-link-icon {
  display: grid;
  place-items: center;
  color: var(--lilac);
  flex: none;
}

.contact-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-copy {
  width: 40px;
  height: 40px;
}

.contact-notes {
  font-size: 13.5px;
  color: var(--text-2);
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  white-space: pre-line;
}

/* ---------- настройки ---------- */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.settings-main,
.settings-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.settings-side {
  position: sticky;
  top: 20px;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px 18px;
}

.set-card .seg {
  margin-bottom: 10px;
}

.preview-card {
  display: grid;
  gap: 8px;
  border-color: var(--lilac-a25);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(122, 86, 184, 0.22), transparent 60%),
    var(--surface);
}

.preview-main {
  font-weight: 600;
}

.preview-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.preview-unit {
  color: var(--text-2);
}

.pw-form {
  display: grid;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.data-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.data-actions .btn {
  justify-content: flex-start;
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: rise 0.25s var(--ease);
}

.save-bar-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
  margin-right: 8px;
  color: var(--text-2);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- формы ---------- */
.form {
  display: grid;
  gap: 4px;
}

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

.field {
  min-width: 0;
}

.span-2 {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}

.req {
  color: var(--lilac);
}

.field-hint {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.4;
}

.field-error {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--red);
  margin-top: 5px;
}

.field-error:empty {
  display: none;
}

.has-error .input,
.has-error .seg {
  border-color: var(--red);
}

.field-toggle {
  padding-top: 2px;
}

.form-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--font);
  font-weight: 750;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lilac);
}

.form-section::after {
  content: '';
  flex: 1;
  height: 8px;
  background: var(--line);
  -webkit-mask: url('/img/steps.svg') repeat-x left center / 32px 8px;
  mask: url('/img/steps.svg') repeat-x left center / 32px 8px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--red-a12);
  color: var(--red);
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 10px;
}

.form-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

/* ---------- модальные окна ---------- */
.modal {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  width: calc(100% - 32px);
  max-width: 600px;
  max-height: calc(100dvh - 48px);
  overflow: visible;
}

.modal-sm { max-width: 460px; }
.modal-lg { max-width: 840px; }

.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.2s ease both;
}

.modal[open] .modal-card {
  animation: modal-in 0.24s var(--ease) both;
}

.modal.is-closing .modal-card {
  animation: modal-out 0.16s ease both;
}

.modal.is-closing::backdrop {
  animation: fade 0.16s ease reverse both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@keyframes modal-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 10px 22px;
}

.modal-titles {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.modal-eyebrow {
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lilac);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.modal-subtitle {
  color: var(--text-2);
  font-size: 14px;
}

.modal-close {
  margin: -4px -2px 0 0;
}

.modal-body {
  padding: 10px 22px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px 16px 22px;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-2) 40%, var(--surface));
}

.confirm-text {
  color: var(--text-2);
  font-size: 15px;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.more-tile {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.more-tile:hover {
  background: var(--surface-3);
  color: var(--text);
}

.more-tile-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--lilac-a15);
  color: var(--lilac);
}

.more-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}

/* ---------- тосты ---------- */
.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
  max-width: min(440px, calc(100vw - 24px));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  border-radius: 14px;
  background: #2b2521;
  color: #f3e7d6;
  border: 1px solid #3a322d;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  font-size: 14px;
  animation: toast-in 0.26s var(--ease) both;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
  background: rgba(124, 199, 154, 0.16);
  color: #7cc79a;
}

.toast-error .toast-icon {
  background: rgba(229, 107, 111, 0.16);
  color: #e56b6f;
}

.toast-warn .toast-icon {
  background: rgba(224, 164, 88, 0.16);
  color: #e0a458;
}

.toast-text {
  min-width: 0;
}

.toast-action {
  border: 0;
  background: rgba(180, 142, 230, 0.16);
  color: #c7a8f0;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 9px;
  white-space: nowrap;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b9aa98;
  flex: none;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f3e7d6;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- пустые состояния ---------- */
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
  padding: 44px 20px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.empty-compact {
  padding: 26px 16px;
  border: 0;
  background: transparent;
}

.empty-art {
  position: relative;
  padding: 26px 20px 4px;
}

.empty-steam {
  left: calc(50% - 36px);
  top: -34px;
  transform: scale(0.75);
  opacity: 0.8;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

.empty-text {
  color: var(--text-2);
  max-width: 440px;
  font-size: 14.5px;
}

.empty .btn {
  margin-top: 6px;
}

/* ---------- вход ---------- */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr);
}

.login-art {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(122, 86, 184, 0.38), transparent 70%),
    radial-gradient(60% 50% at 80% 90%, rgba(224, 164, 88, 0.1), transparent 70%),
    var(--bg-sunk);
  border-right: 1px solid var(--line-soft);
}

.login-cup {
  position: relative;
  padding-top: 60px;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45));
}

.login-steam {
  left: calc(50% - 36px);
  top: -20px;
  transform: scale(1.6);
}

.login-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 96px;
  background: linear-gradient(180deg, var(--lilac-deep), color-mix(in srgb, var(--lilac-deep) 60%, var(--bg-sunk)));
  -webkit-mask: url('/img/wave.svg') repeat-x left bottom / 192px 48px;
  mask: url('/img/wave.svg') repeat-x left bottom / 192px 48px;
  opacity: 0.55;
}

.login-wave::after {
  content: '';
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 30px 28px 24px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}

.login-card.shake {
  animation: shake 0.36s steps(6, end);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-brand {
  margin-bottom: 10px;
}

.login-brand .logo-tag {
  font-size: 12px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.login-sub {
  color: var(--text-2);
  margin-top: -6px;
  margin-bottom: 6px;
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 1320px) {
  .grid-exp {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .exp-total-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-side {
    position: static;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-pay {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-staff {
    grid-template-columns: minmax(0, 1fr);
  }

  .staff-team {
    grid-row: auto;
  }

  .emp-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* узкий десктоп и планшет — меню иконками */
@media (max-width: 1080px) and (min-width: 761px) {
  :root {
    --sidebar-w: 76px;
  }

  .sidebar {
    padding: 16px 10px;
    align-items: center;
  }

  .sidebar-brand {
    padding: 6px 0 16px;
  }

  .sidebar-brand .logo-word,
  .brand-crm,
  .nav-caption,
  .nav-item-label,
  .sidebar-login {
    display: none;
  }

  .nav-group + .nav-group {
    border-top: 1px solid var(--line-soft);
    padding-top: 6px;
  }

  .nav-item {
    width: 48px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }

  .nav-item[aria-current='page']::before {
    left: -10px;
  }

  .sidebar-foot {
    flex-direction: column;
  }

  .sidebar-user {
    flex: none;
    padding: 0;
  }

  .main {
    padding: 24px 24px 48px;
  }

  .grid-home {
    grid-template-columns: minmax(0, 1fr);
  }

  .recipe {
    max-width: calc(100vw - var(--sidebar-w) - 80px);
  }
}

/* телефон */
@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 14px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line-soft);
  }

  .topbar-brand {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
  }

  .topbar-title {
    flex: 1;
    font-family: var(--font-display);
    font-size: 15.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(16px);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line);
  }

  .tab:not([role='tab']) {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 700;
    padding: 0;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .tab-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 28px;
    border-radius: 10px;
    transition: background-color 0.15s, color 0.15s;
  }

  .tab-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tab[aria-current='page'],
  .tab.is-active {
    color: var(--lilac);
  }

  .tab[aria-current='page'] .tab-icon,
  .tab.is-active .tab-icon {
    background: var(--lilac-a15);
  }

  .main {
    margin-left: 0;
    padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
    min-height: auto;
  }

  .page {
    gap: 16px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-title {
    font-size: 23px;
  }

  .page-subtitle {
    font-size: 14px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1 1 auto;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 12px 13px;
  }

  .stat-value,
  .stats-home .stat-value,
  .stats-costs .stat-value {
    font-size: 18px;
  }

  .stats-home .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .toolbar .search {
    flex-basis: 100%;
    max-width: none;
  }

  .toolbar .select-compact {
    flex: 1 1 140px;
  }

  /* главная */
  .home-head .quick-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .home-head .btn-chip {
    padding: 0 4px;
    gap: 3px;
    font-size: 12.5px;
    min-width: 0;
  }

  .home-head .btn-chip .icon {
    width: 14px;
    height: 14px;
  }

  .hero {
    padding: 20px 16px 16px;
    gap: 16px;
  }

  .hero-steam {
    right: 8px;
    top: 0;
  }

  .hero-num {
    font-size: 34px;
  }

  .hero-unit {
    font-size: 16px;
  }

  .hero-approx {
    font-size: 15px;
  }

  .formula {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .f-op {
    justify-self: center;
    line-height: 1;
  }

  .f-chip b {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  .hero-warns li {
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
    gap: 4px 8px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .hero-warns li .icon {
    margin-top: 2px;
  }

  .warn-link {
    grid-column: 2;
  }

  .hero-steam {
    left: auto;
    right: 10px;
  }

  .grid-home {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .mini-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mini-list li > .muted {
    display: none;
  }

  .mini-list li .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .pay-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .pay-row .pay-amount {
    grid-row: 1;
    grid-column: 3;
  }

  .pay-row .btn {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .pay-row .btn-icon-only {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }

  /* календари */
  .cal-head,
  .cal-body {
    gap: 3px;
  }

  .cal-cell {
    min-height: 54px;
    padding: 4px 3px;
    border-radius: 9px;
    align-items: center;
  }

  .cal-num {
    font-size: 12px;
  }

  .cal-people {
    justify-content: center;
    gap: 2px;
  }

  .cal-person {
    min-width: 0;
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 2px;
    font-size: 0;
    background: var(--emp);
  }

  .cal-person.is-paid {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--emp);
  }

  .cal-add {
    display: none;
  }

  .cal-chip {
    width: 10px;
    height: 10px;
    padding: 0;
    border-left: 0;
    border-radius: 3px;
    background: var(--lilac);
    justify-self: center;
  }

  .cal-chip.is-paid {
    background: var(--green);
  }

  .cal-chip.is-overdue {
    background: var(--red);
  }

  .cal-chip-text,
  .cal-chip-sum {
    display: none;
  }

  .cal-pay .cal-cell {
    flex-direction: column;
    flex-wrap: wrap;
  }

  .month-nav-title {
    min-width: 0;
    flex: 1;
  }

  .month-nav {
    max-width: 100%;
  }

  .card-head .month-nav {
    width: 100%;
  }

  /* сотрудники */
  .shift-line {
    grid-template-columns: auto minmax(0, 1fr) 84px;
  }

  .shift-line .badge {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .table-pay {
    min-width: 0;
  }

  .table-pay thead {
    display: none;
  }

  .table-pay tbody tr,
  .table-pay tfoot tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line-soft);
  }

  .table-pay th,
  .table-pay td {
    display: grid;
    padding: 0;
    border: 0;
    text-align: left !important;
  }

  .table-pay td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .table-pay td:first-child,
  .table-pay th:first-child,
  .table-pay .td-action {
    grid-column: 1 / -1;
  }

  .table-pay td:first-child::before {
    display: none;
  }

  .table-pay .td-action:empty {
    display: none;
  }

  .table-pay tbody tr:hover > * {
    background: transparent;
  }

  /* задачи */
  .board-tabs {
    display: flex;
  }

  .board {
    grid-template-columns: minmax(0, 1fr);
  }

  .board-col {
    display: none;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .board-col.is-active {
    display: block;
  }

  .board-head {
    display: none;
  }

  .task-move {
    opacity: 1;
  }

  .quick-hint {
    padding-left: 0;
  }

  .quick-submit {
    display: none;
  }

  /* меню */
  .menu-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .size-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  }

  .size-row .size-cell:first-child {
    grid-column: 1 / -1;
  }

  .size-row .size-del {
    grid-column: 3;
    grid-row: 2;
  }

  /* себестоимость: таблица → карточки */
  .cost-table-host {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .cost-table-host .table-scroll {
    overflow: visible;
  }

  .cost-table {
    min-width: 0;
    display: block;
  }

  .cost-table thead {
    display: none;
  }

  .cost-table tbody,
  .cost-table tr,
  .cost-table th,
  .cost-table td {
    display: block;
  }

  .cost-cat th {
    padding: 10px 2px 6px;
    background: transparent;
    border: 0;
  }

  .cost-group {
    margin-bottom: 10px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    box-shadow: var(--shadow-1);
    overflow: hidden;
  }

  .cost-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 12px;
  }

  .cost-row > * {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
  }

  .cost-table .col-name {
    position: static;
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
  }

  .cost-row td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1px;
  }

  .cost-row .col-raw,
  .cost-row .col-packaging,
  .cost-row .col-overhead {
    display: none !important;
  }

  .cost-detail-cell {
    padding: 0 8px 8px !important;
    border: 0 !important;
  }

  .recipe {
    position: static;
    max-width: none;
    padding: 12px;
  }

  .recipe-line {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
    gap: 6px 8px;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface);
  }

  .recipe-line-head {
    display: none;
  }

  .rl-comp {
    grid-column: 1 / -1;
  }

  .rl-qty {
    grid-column: 1;
  }

  .rl-unit {
    grid-column: 2;
    grid-row: 3;
    text-align: left;
  }

  .rl-cost {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }

  .rl-del {
    grid-column: 3;
    grid-row: 2;
  }

  .rs-rec {
    grid-column: 1 / -1;
  }

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

  /* сырьё */
  .comp-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .comp-badges {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .catalog-card {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .catalog-table {
    min-width: 0;
    display: block;
  }

  .catalog-table thead {
    display: none;
  }

  .catalog-table tbody {
    display: grid;
    gap: 8px;
  }

  .catalog-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
  }

  .catalog-table th,
  .catalog-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left !important;
    background: transparent !important;
  }

  .catalog-table th {
    grid-column: 1 / -1;
  }

  .catalog-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
  }

  .catalog-table td:nth-child(2),
  .catalog-table td:last-child {
    grid-column: 1 / -1;
  }

  /* контакты */
  .contacts-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* расходы */
  .grid-exp {
    grid-template-columns: minmax(0, 1fr);
  }

  .donut-row {
    justify-content: center;
  }

  /* настройки */
  .settings-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .set-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .save-bar {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
    left: 12px;
    right: 12px;
    justify-self: stretch;
  }

  .save-bar-text {
    flex: 1;
    font-size: 13px;
  }

  /* формы и модалки — снизу листом */
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal,
  .modal-sm,
  .modal-lg {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: 94dvh;
  }

  .modal-card {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }

  .modal[open] .modal-card {
    animation: sheet-in 0.28s var(--ease) both;
  }

  .modal.is-closing .modal-card {
    animation: sheet-out 0.18s ease both;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0.4;
    }
  }

  @keyframes sheet-out {
    to {
      transform: translateY(40px);
      opacity: 0;
    }
  }

  .modal-head {
    padding: 18px 12px 8px 18px;
  }

  .modal-body {
    padding: 8px 18px 18px;
  }

  .modal-footer {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) 14px;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
  }

  .modal-footer .mr-auto {
    flex: 0 0 auto;
  }

  .toasts {
    left: 12px;
    right: 12px;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
    justify-items: stretch;
    max-width: none;
  }

  /* вход */
  .login {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .login-art {
    min-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .login-cup {
    padding-top: 40px;
    transform: scale(0.55);
    margin: -60px 0 -70px;
  }

  .login-wave {
    height: 48px;
    -webkit-mask-size: 96px 24px;
    mask-size: 96px 24px;
  }

  .login-panel {
    align-items: start;
    padding: 20px 16px 32px;
  }

  .login-card {
    padding: 24px 20px 20px;
    border-radius: 22px;
  }
}

@media (max-width: 400px) {
  .tab:not([role='tab']) {
    font-size: 10px;
  }

  .tab-icon {
    width: 40px;
  }

  .hero-num {
    font-size: 30px;
  }

  .seg-btn {
    padding: 0 10px;
  }
}

/* ---------- без анимаций ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .pixel-steam .ps {
    opacity: 0.55;
    animation: none !important;
  }

  .logo-mark.is-animated .px-steam {
    animation: none !important;
    opacity: 1;
  }
}

/* ==========================================================================
   Печать: меню A4
   ========================================================================== */
@page {
  size: A4;
  margin: 14mm 14mm 12mm;
}

@media print {
  :root,
  [data-theme='light'],
  [data-theme='dark'] {
    --bg: #fff;
    --surface: #fff;
    --text: #1d1714;
    --text-2: #4d4038;
    --text-3: #6f6153;
    --line: #d9cbb6;
    --lilac: #6b45a8;
    --cup-lid: #2b2521;
    --cup-body: #4a3f38;
  }

  body {
    background: #fff;
    color: #1d1714;
    font-size: 10.5pt;
  }

  body::before,
  .sidebar,
  .topbar,
  .tabbar,
  .toasts,
  .skip-link,
  .save-bar,
  dialog {
    display: none !important;
  }

  .main {
    margin: 0;
    padding: 0;
  }

  .page {
    animation: none;
  }

  .card,
  .stat {
    box-shadow: none;
    break-inside: avoid;
  }

  .page-menu > :not(.print-menu) {
    display: none !important;
  }

  .page-menu .print-menu {
    display: block !important;
    color: #1d1714;
  }

  .pm-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 6mm;
  }

  .pm-head .logo-word {
    color: #1d1714;
  }

  .pm-head .px-steam {
    fill: #9b7ad6;
  }

  .pm-head .px-sleeve {
    fill: #7a56b8;
  }

  .pm-sub {
    font-size: 10pt;
    color: #4d4038;
    text-align: right;
    max-width: 70mm;
  }

  .pm-steps {
    height: 3mm;
    background: #7a56b8;
    -webkit-mask: url('/img/steps.svg') repeat-x left center / 12mm 3mm;
    mask: url('/img/steps.svg') repeat-x left center / 12mm 3mm;
    margin-bottom: 7mm;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .pm-cols {
    column-count: 2;
    column-gap: 12mm;
  }

  .pm-cat {
    break-inside: avoid-column;
    margin-bottom: 7mm;
  }

  .pm-cat-title {
    font-family: var(--font-display);
    font-size: 13pt;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b45a8;
    border-bottom: 0.6pt solid #d9cbb6;
    padding-bottom: 2mm;
    margin-bottom: 3mm;
  }

  .pm-item {
    break-inside: avoid;
    margin-bottom: 3.6mm;
  }

  .pm-item-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }

  .pm-name {
    font-family: var(--font-display);
    font-size: 11.5pt;
    font-weight: 600;
  }

  .pm-season {
    font-family: var(--font);
    font-weight: 700;
    font-size: 8pt;
    color: #94570f;
    letter-spacing: 0.04em;
  }

  .pm-desc {
    font-size: 9pt;
    color: #5e5044;
    margin: 0.6mm 0 1mm;
  }

  .pm-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 2mm 6mm;
    font-size: 10pt;
  }

  .pm-size {
    color: #6f6153;
  }

  .pm-price b {
    font-family: var(--font-display);
    font-weight: 600;
  }

  .pm-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 6mm;
    padding-top: 3mm;
    border-top: 0.6pt solid #d9cbb6;
    font-size: 8.5pt;
    color: #6f6153;
  }
}
