/* Квартальный календарь — реалистичное превью */
.calc-client-layout--calendar {
  display: grid;
  gap: 20px;
}
@media (min-width: 992px) {
  .calc-client-layout--calendar {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    align-items: start;
  }
  .cal-preview {
    order: 0;
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--cmykos-topbar-h, 56px) + 12px);
  }
  .calc-client-layout--calendar > .calc-client-form {
    grid-column: 1;
    grid-row: 1;
  }
}

.cal-preview-card-wrap {
  background: var(--ds-surface, #fff);
  border: 1px solid var(--ds-border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px 16px;
}
.cal-preview-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 10px;
}

.cal-preview-stage {
  --cal-w: 184px;
  --cal-poster-h: 92px;
  --cal-block-h: 64px;
  --cal-ad-h: 22px;
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 12px 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #dbe4f0;
  gap: 10px;
}

.cal-wall {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 28%),
    repeating-linear-gradient(
      90deg,
      #d5dee9 0,
      #d5dee9 1px,
      #e2eaf3 1px,
      #e2eaf3 28px
    ),
    #dbe4f0;
  opacity: 0.95;
  pointer-events: none;
}

.cal-preview-canvas {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  min-height: 360px;
  max-height: 520px;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 36px 28px 28px;
  transition: padding 0.25s ease;
}
.cal-hang {
  position: relative;
  z-index: 2;
  width: var(--cal-w);
  height: 18px;
  margin-bottom: -2px;
  transition: width 0.28s ease;
}
.cal-hang-cord {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: linear-gradient(#94a3b8, #64748b);
  border-radius: 1px;
}
.cal-hang-eyelet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 38%, #c0c7d1 40%, #9aa3b0 72%, #e8ecf1 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.cal-stack {
  position: relative;
  z-index: 2;
  width: var(--cal-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  filter: drop-shadow(0 14px 22px rgba(15, 23, 42, 0.22));
  transform-origin: top center;
  animation: cal-sway 5.5s ease-in-out infinite;
  transition: width 0.28s ease;
}
@keyframes cal-sway {
  0%, 100% { transform: rotate(-0.6deg); }
  50% { transform: rotate(0.7deg); }
}
@media (prefers-reduced-motion: reduce) {
  .cal-stack { animation: none; }
}

.cal-part {
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  overflow: hidden;
}

/* —— Постер —— */
.cal-part--poster {
  height: var(--cal-poster-h);
  border-radius: 3px 3px 0 0;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
  transition: height 0.28s ease;
}
.cal-poster-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.cal-poster-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 70% 18%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(165deg, #38bdf8 0%, #2563eb 42%, #1e3a8a 100%);
}
.cal-poster-hill {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -8%;
  height: 48%;
  background: linear-gradient(180deg, #34d399, #059669 55%, #047857);
  border-radius: 60% 60% 0 0 / 100% 100% 0 0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.15);
}
.cal-poster-mark {
  position: absolute;
  left: 10%;
  top: 12%;
  padding: 3px 7px;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}
.cal-poster-title {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 28%;
  font-size: 0.78rem;
  font-weight: 750;
  color: #fff;
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.45);
}
.cal-poster-year {
  position: absolute;
  right: 10%;
  top: 12%;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.4);
}
.cal-poster-lam {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.cal-poster-uv,
.cal-poster-foil,
.cal-poster-emboss {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.cal-preview[data-uv="1+0"] .cal-poster-uv,
.cal-preview[data-uv="1+1"] .cal-poster-uv {
  opacity: 1;
  background: linear-gradient(
    160deg,
    transparent 20%,
    rgba(56, 189, 248, 0.18) 42%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 68%
  );
  mix-blend-mode: soft-light;
}
.cal-preview[data-foil="1"] .cal-poster-foil {
  opacity: 1;
  background:
    radial-gradient(circle at 28% 36%, rgba(251, 191, 36, 0.55) 0 8%, transparent 18%),
    radial-gradient(circle at 62% 58%, rgba(252, 211, 77, 0.4) 0 6%, transparent 16%);
}
.cal-preview[data-emboss="1"] .cal-poster-emboss {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08),
    inset 2px 2px 4px rgba(15, 23, 42, 0.12),
    inset -1px -1px 2px rgba(255, 255, 255, 0.35);
}
.cal-preview[data-lam="gloss"] .cal-poster-lam {
  opacity: 1;
  background: linear-gradient(
    118deg,
    transparent 12%,
    rgba(255, 255, 255, 0.18) 28%,
    rgba(255, 255, 255, 0.7) 40%,
    transparent 55%,
    rgba(255, 255, 255, 0.25) 72%,
    transparent 88%
  );
  mix-blend-mode: soft-light;
  background-size: 180% 100%;
  animation: cal-gloss 3.6s ease-in-out infinite;
}
.cal-preview[data-lam="matte"] .cal-poster-lam {
  opacity: 1;
  background: rgba(248, 250, 252, 0.22);
  box-shadow: inset 0 0 30px rgba(148, 163, 184, 0.12);
}
.cal-preview[data-lam="soft_touch"] .cal-poster-lam {
  opacity: 1;
  background: rgba(100, 116, 139, 0.14);
}
@keyframes cal-gloss {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* —— Пружина —— */
.cal-preview {
  --cal-spring: #f3f4f6;
  --cal-spring-dark: #9ca3af;
}
.cal-spring {
  height: 7px;
  margin: -1px 4px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--cal-spring) 0 3px,
      var(--cal-spring-dark) 3px 4px,
      var(--cal-spring) 4px 7px
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 1px rgba(15, 23, 42, 0.2);
  z-index: 3;
  transition: background 0.25s ease;
}
.cal-preview[data-spring="white"],
.cal-preview[data-spring="белая"] {
  --cal-spring: #f3f4f6;
  --cal-spring-dark: #9ca3af;
}
.cal-preview[data-spring="black"],
.cal-preview[data-spring="чёрная"],
.cal-preview[data-spring="черная"] {
  --cal-spring: #2d2d2d;
  --cal-spring-dark: #111;
}
.cal-preview[data-spring="silver"],
.cal-preview[data-spring="серебро"] {
  --cal-spring: #e5e7eb;
  --cal-spring-dark: #6b7280;
}
.cal-preview[data-spring="gold"],
.cal-preview[data-spring="золото"] {
  --cal-spring: #fbbf24;
  --cal-spring-dark: #b45309;
}
.cal-preview[data-spring="custom"],
.cal-preview[data-spring="color"],
.cal-preview[data-spring="другая"] {
  --cal-spring: var(--cal-spring-custom, #2563eb);
  --cal-spring-dark: color-mix(in srgb, var(--cal-spring-custom, #2563eb) 55%, #0f172a);
}
/* При 1 рекламном поле средние поля скрыты, но пружины между блоками остаются */

/* Выбор цвета пружины */
.cal-spring-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cal-spring-swatch {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cal-spring-swatch:hover {
  border-color: #94a3b8;
}
.cal-spring-swatch.is-on {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.cal-spring-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 20%),
    radial-gradient(circle at 50% 50%, var(--sw, #f3f4f6) 0 55%, var(--sw-d, #9ca3af) 58% 100%);
  border: 1px solid rgba(15, 23, 42, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}
.cal-spring-dot--custom {
  background:
    conic-gradient(#dc2626, #fbbf24, #16a34a, #2563eb, #7c3aed, #db2777, #dc2626);
}

/* —— Календарный блок (готовый Polimat) —— */
.cal-part--block {
  height: var(--cal-block-h);
  background: #fafafa;
  padding: 4px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: height 0.28s ease;
}
.cal-month-brand {
  display: none;
}
.cal-month-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 1px 1px;
  border-bottom: 1px solid #e2e8f0;
  gap: 4px;
}
.cal-month-name {
  font-size: 0.58rem;
  font-weight: 750;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex: 1;
}
.cal-month-yr {
  font-size: 0.5rem;
  color: #64748b;
  font-weight: 600;
}

/* Индивидуальный блок — свой дизайн сетки, не «подкраска» готового */
.cal-preview[data-block="custom"] .cal-part--block {
  background:
    linear-gradient(180deg, #eff6ff 0%, #eff6ff 18%, #ffffff 18%);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
  padding-top: 0;
}
.cal-preview[data-block="custom"] .cal-month-head {
  background: linear-gradient(90deg, #1d4ed8, #2563eb 55%, #3b82f6);
  border-bottom: none;
  margin: 0 0 3px;
  padding: 3px 5px;
  align-items: center;
  border-radius: 0;
}
.cal-preview[data-block="custom"] .cal-month-brand {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}
.cal-preview[data-block="custom"] .cal-month-name,
.cal-preview[data-block="custom"] .cal-month-yr {
  color: #fff;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.25);
}
.cal-preview[data-block="custom"] .cal-month-yr {
  opacity: 0.85;
}
.cal-preview[data-block="custom"] .cal-grid {
  padding: 0 2px 2px;
}
.cal-preview[data-block="custom"] .cal-cell {
  background: #f8fafc;
  color: #1e3a8a;
  font-weight: 700;
}
.cal-preview[data-block="custom"] .cal-cell--head {
  background: transparent;
  color: #3b82f6;
}
.cal-preview[data-block="custom"] .cal-cell--we {
  color: #e11d48;
  background: #fff1f2;
}
.cal-preview[data-block="custom"] .cal-cell--empty {
  background: transparent;
}
.cal-preview[data-block="custom"] .cal-cursor {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3), 0 2px 6px rgba(37, 99, 235, 0.35);
}
.cal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 1px;
  min-height: 0;
}
.cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.42rem;
  font-weight: 600;
  color: #334155;
  background: #fff;
  border-radius: 1px;
  line-height: 1;
}
.cal-cell--head {
  color: #64748b;
  background: transparent;
  font-size: 0.38rem;
  font-weight: 700;
}
.cal-cell--head.cal-cell--we,
.cal-cell--we {
  color: #dc2626;
}
.cal-cell--empty {
  background: transparent;
}
.cal-cursor {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  border: 1.5px solid #ef4444;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25), 0 2px 6px rgba(239, 68, 68, 0.35);
  pointer-events: none;
  z-index: 2;
  left: 42%;
  top: 48%;
  background: rgba(255, 255, 255, 0.35);
}
.cal-preview[data-cursor="magnetic"] .cal-cursor {
  border-color: #0f766e;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0.05)),
    repeating-linear-gradient(
      90deg,
      rgba(15, 118, 110, 0.12) 0 2px,
      transparent 2px 4px
    );
  box-shadow:
    0 0 0 1px rgba(15, 118, 110, 0.28),
    0 2px 6px rgba(15, 118, 110, 0.35);
}
.cal-preview[data-cursor="regular"] .cal-cursor {
  border-color: #64748b;
  background: rgba(248, 250, 252, 0.9);
  box-shadow:
    0 0 0 1px rgba(100, 116, 139, 0.25),
    0 2px 5px rgba(100, 116, 139, 0.3);
}
.cal-preview[data-cursor="none"] .cal-cursor {
  display: none !important;
}
.cal-part--block[data-month="1"] .cal-cursor {
  display: block;
}
.cal-part--block:not([data-month="1"]) .cal-cursor {
  display: none;
}

/* —— Рекламные поля —— */
.cal-part--ad {
  height: var(--cal-ad-h);
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  display: flex;
  align-items: center;
  padding: 0 6px;
  transition: height 0.28s ease;
}
.cal-ad-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.cal-ad-logo {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}
.cal-ad-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-ad-lines i {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: rgba(146, 64, 14, 0.28);
}
.cal-ad-lines i:first-child { width: 72%; }
.cal-ad-lines i:last-child { width: 48%; }
.cal-ad-inner--bottom {
  justify-content: space-between;
}
.cal-ad-phone,
.cal-ad-site {
  font-size: 0.48rem;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.01em;
}
.cal-preview[data-ad="1"] .cal-part--mid {
  display: none;
}

.cal-preview-meta {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #334155;
}
.cal-preview-size { font-weight: 700; }
.cal-preview-dims {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-line;
}
.cal-preview-block {
  margin-top: 6px;
  font-weight: 600;
  color: #2563eb;
}
.cal-preview-spring {
  margin-top: 4px;
  font-weight: 600;
  color: #475569;
  font-size: 0.8rem;
}
.cal-preview-cursor {
  margin-top: 4px;
  font-weight: 600;
  color: #b45309;
  font-size: 0.8rem;
}
.cal-preview-mount {
  margin-top: 4px;
  font-weight: 600;
  color: #0f766e;
  font-size: 0.78rem;
  line-height: 1.35;
}
#cal-size-group .btn small,
#cal-block-group .btn small {
  display: block;
  font-weight: 500;
  opacity: 0.8;
}

/* Линейки размеров */
.cal-dim-w {
  display: flex;
  align-items: center;
  gap: 6px;
  width: var(--cal-w);
  margin-top: 10px;
  transition: width 0.28s ease;
}
.cal-dim-w i {
  flex: 1;
  height: 0;
  border-top: 1px solid #334155;
  position: relative;
}
.cal-dim-w i::before,
.cal-dim-w i::after {
  content: '';
  position: absolute;
  top: -4px;
  width: 1px;
  height: 8px;
  background: #334155;
}
.cal-dim-w i:first-child::before { left: 0; }
.cal-dim-w i:first-child::after { display: none; }
.cal-dim-w i:last-child::before { display: none; }
.cal-dim-w i:last-child::after { right: 0; }
.cal-dim-w span {
  font-size: 0.68rem;
  font-weight: 750;
  color: #1e293b;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 5px;
  border-radius: 4px;
}
.cal-dim-h {
  position: absolute;
  right: 6px;
  top: 30px;
  bottom: 40px;
  width: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.cal-dim-h i {
  flex: 1;
  width: 0;
  border-left: 1px solid #334155;
  position: relative;
  min-height: 12px;
}
.cal-dim-h i::before,
.cal-dim-h i::after {
  content: '';
  position: absolute;
  left: -4px;
  height: 1px;
  width: 8px;
  background: #334155;
}
.cal-dim-h i:first-child::before { top: 0; }
.cal-dim-h i:first-child::after { display: none; }
.cal-dim-h i:last-child::before { display: none; }
.cal-dim-h i:last-child::after { bottom: 0; }
.cal-dim-h span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.62rem;
  font-weight: 750;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 2px;
  border-radius: 4px;
  margin: 4px 0;
}

/* Сравнение силуэтов мини / миди / макси */
.cal-size-compare {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 8px 8px 4px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.cal-sil {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 52px;
}
.cal-sil-bar {
  --sil-scale: 0.12;
  width: calc(var(--sil-w) * var(--sil-scale) * 1px);
  height: calc(var(--sil-h) * var(--sil-scale) * 1px);
  border-radius: 2px;
  background: #cbd5e1;
  border: 1px solid #94a3b8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.cal-sil-lbl {
  font-size: 0.62rem;
  font-weight: 650;
  color: #64748b;
  text-align: center;
  line-height: 1.15;
}
.cal-sil.is-on .cal-sil-bar {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-color: #1d4ed8;
  transform: scale(1.06);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}
.cal-sil.is-on .cal-sil-lbl {
  color: #1d4ed8;
  font-weight: 800;
}
.cal-sil:hover .cal-sil-bar {
  border-color: #64748b;
}
