/* =====================================================
   Calculator V2 (Brand: blue + neutrals)
   - Loaded after main style.css
   ===================================================== */

.calculator-page.calculator-v2 {
  --brand-primary: var(--primary);
  --brand-primary-weak: rgb(var(--primary-rgb) / 0.10);
  --brand-primary-soft: rgb(var(--primary-rgb) / 0.06);
  --text-strong: var(--text);
  --text-muted: var(--text-muted);
  --calc-bg: #ffffff;
  --calc-surface: #ffffff;
  --calc-surface-alt: var(--bg-alt);
  --calc-border: rgb(var(--secondary-rgb) / 0.12);
  --calc-border-strong: rgb(var(--secondary-rgb) / 0.18);
  --calc-shadow: 0 16px 40px rgb(var(--secondary-rgb) / 0.10);
  --calc-shadow-hover: 0 22px 60px rgb(var(--secondary-rgb) / 0.14);
  --calc-radius: 18px;
  --calc-radius-sm: 14px;

  background: var(--calc-bg);
  padding: clamp(2rem, 4vw, 3rem) 0;
}

.calculator-page.calculator-v2 .calculator-header {
  margin-bottom: clamp(1.25rem, 2vw, 1.75rem);
}

.calculator-page.calculator-v2 .calculator-wrapper {
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: clamp(1.25rem, 2.4vw, 2rem);
}

@media (max-width: 992px) {
  .calculator-page.calculator-v2 .calculator-wrapper {
    grid-template-columns: 1fr;
  }
}

/* Remove "big rectangle" feeling: form is a clean stack of cards */
.calculator-page.calculator-v2 .calculator-form {
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}

.calculator-page.calculator-v2 .calc-tabs {
  display: flex;
  flex-direction: row;
  background: rgb(var(--secondary-rgb) / 0.04);
  border: 1px solid var(--calc-border);
  border-radius: 999px;
  padding: 6px;
  gap: 6px;
}

.calculator-page.calculator-v2 .calc-tab {
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.calculator-page.calculator-v2 .calc-tab i {
  opacity: 0.9;
}

.calculator-page.calculator-v2 .calc-tab:hover {
  border-color: rgb(var(--secondary-rgb) / 0.14);
  background: rgb(255 255 255 / 0.65);
}

.calculator-page.calculator-v2 .calc-tab.active {
  background: var(--calc-surface);
  border-color: rgb(var(--secondary-rgb) / 0.14);
  color: var(--brand-primary);
  box-shadow: 0 12px 28px rgb(var(--secondary-rgb) / 0.10);
}

.calculator-page.calculator-v2 .calc-section {
  border: 1px solid var(--calc-border);
  background: var(--calc-surface);
  border-radius: var(--calc-radius);
  padding: clamp(1.1rem, 2vw, 1.5rem);
  box-shadow: var(--calc-shadow);
}

.calculator-page.calculator-v2 .calc-section + .calc-section {
  margin-top: 14px;
}

/* Spacing between the active tab panel and common sections below it */
.calculator-page.calculator-v2 .calc-panel + .calc-section {
  margin-top: 14px;
}

.calculator-page.calculator-v2 .calc-section-title {
  color: var(--text-strong);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.calculator-page.calculator-v2 .calc-section-title i {
  color: rgb(var(--primary-rgb) / 0.85);
}

.calculator-page.calculator-v2 .calc-inline-note {
  margin: 8px 0 12px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.calculator-page.calculator-v2 .calc-inline-note strong {
  color: var(--text-strong);
  font-weight: 800;
}

.calculator-page.calculator-v2 .calc-row {
  margin-bottom: 0;
}

.calculator-page.calculator-v2 .calc-row > .calc-field:only-child {
  grid-column: 1 / -1;
}

.calculator-page.calculator-v2 #color-field > .calc-field,
.calculator-page.calculator-v2 #double-sided-color-row > .calc-field {
  grid-column: 1 / -1;
}

.calculator-page.calculator-v2 #color-field,
.calculator-page.calculator-v2 #double-sided-color-row {
  grid-template-columns: minmax(0, 1fr) !important;
}

.calculator-page.calculator-v2 .calc-row + .calc-row {
  margin-top: 14px;
}

.calculator-page.calculator-v2 .calc-field label {
  font-weight: 700;
  color: var(--text-strong);
}

/* Keep checkbox rows perfectly aligned in calculator cards */
.calculator-page.calculator-v2 .calc-field > label.checkbox-inline,
.calculator-page.calculator-v2 .calc-row > label.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  line-height: 1.2;
}

.calculator-page.calculator-v2 .calc-field > label.checkbox-inline input[type="checkbox"],
.calculator-page.calculator-v2 .calc-row > label.checkbox-inline input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}

.calculator-page.calculator-v2 .calc-field > label.checkbox-inline > span,
.calculator-page.calculator-v2 .calc-row > label.checkbox-inline > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 769px) {
  /* Keep "Доставка" checkbox aligned with the distance input control on desktop */
  .calculator-page.calculator-v2 .calc-common > .calc-row:first-of-type {
    align-items: end;
  }

  .calculator-page.calculator-v2 .calc-common > .calc-row:first-of-type > .calc-field:first-child {
    align-self: end;
  }
}

/* Inputs */
.calculator-page.calculator-v2 input[type="text"],
.calculator-page.calculator-v2 input[type="number"],
.calculator-page.calculator-v2 select,
.calculator-page.calculator-v2 textarea {
  border: 1px solid var(--calc-border);
  border-radius: 14px;
  background: var(--calc-surface);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.calculator-page.calculator-v2 select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 44px;
  background-image:
    linear-gradient(180deg, rgb(var(--secondary-rgb) / 0.03), rgb(var(--secondary-rgb) / 0.00)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M5.6 7.6a1 1 0 0 1 1.4 0L10 10.6l3-3a1 1 0 1 1 1.4 1.4l-3.7 3.7a1 1 0 0 1-1.4 0L5.6 9a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0 0, right 14px center;
  background-size: auto, 14px 14px;
}

.calculator-page.calculator-v2 select:hover {
  border-color: var(--calc-border-strong);
}

.calculator-page.calculator-v2 input[type="text"]:focus,
.calculator-page.calculator-v2 input[type="number"]:focus,
.calculator-page.calculator-v2 select:focus,
.calculator-page.calculator-v2 textarea:focus {
  outline: none;
  border-color: rgb(var(--primary-rgb) / 0.40);
  box-shadow: 0 0 0 4px var(--brand-primary-weak);
}

.calculator-page.calculator-v2 .urgent-option i {
  color: #7c3aed;
}

/* Custom Select (for better dropdown UI) */
.calculator-page.calculator-v2 .cs-select {
  position: relative;
  z-index: 1;
}

.calculator-page.calculator-v2 .cs-select.is-open {
  z-index: 2600;
}

.calculator-page.calculator-v2 .cs-select__native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.calculator-page.calculator-v2 .cs-select__button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--calc-border);
  border-radius: 14px;
  background: var(--calc-surface);
  color: var(--text-strong);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.calculator-page.calculator-v2 .cs-select__button::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  opacity: 0.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M5.6 7.6a1 1 0 0 1 1.4 0L10 10.6l3-3a1 1 0 1 1 1.4 1.4l-3.7 3.7a1 1 0 0 1-1.4 0L5.6 9a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
}

.calculator-page.calculator-v2 .cs-select__button:hover {
  border-color: var(--calc-border-strong);
  background: linear-gradient(180deg, rgb(var(--secondary-rgb) / 0.02), rgb(255 255 255 / 1));
}

.calculator-page.calculator-v2 .cs-select__button:focus-visible {
  outline: none;
  border-color: rgb(var(--primary-rgb) / 0.40);
  box-shadow: 0 0 0 4px var(--brand-primary-weak);
}

.calculator-page.calculator-v2 .cs-select__popover {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 2601;
  border: 1px solid var(--calc-border);
  border-radius: 16px;
  background: var(--calc-surface);
  box-shadow: 0 22px 60px rgb(var(--secondary-rgb) / 0.16);
  padding: 6px;
  max-height: 260px;
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
}

.calculator-page.calculator-v2 .cs-select.is-open .cs-select__popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s;
}

.calculator-page.calculator-v2 .cs-select.cs-select--dropup .cs-select__popover {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(-6px);
}

.calculator-page.calculator-v2 .cs-select.cs-select--dropup.is-open .cs-select__popover {
  transform: translateY(0);
}

.calculator-page.calculator-v2 .calc-section.has-open-select,
.calculator-page.calculator-v2 .calc-row.has-open-select {
  overflow: visible !important;
}

.calculator-page.calculator-v2 .cs-select__option {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: var(--text-strong);
  min-height: 44px;
}

.calculator-page.calculator-v2 .cs-select__option:hover,
.calculator-page.calculator-v2 .cs-select__option:focus-visible {
  outline: none;
  background: rgb(var(--secondary-rgb) / 0.04);
  border-color: rgb(var(--secondary-rgb) / 0.10);
}

.calculator-page.calculator-v2 .cs-select__option[aria-selected="true"] {
  background: var(--brand-primary-soft);
  border-color: rgb(var(--primary-rgb) / 0.22);
}

.calculator-page.calculator-v2 input[type="range"] {
  accent-color: var(--brand-primary);
}

/* Material cards */
.calculator-page.calculator-v2 .material-select {
  gap: 12px;
}

@media (max-width: 768px) {
  .calculator-page.calculator-v2 .material-select {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.calculator-page.calculator-v2 .material-card {
  border-radius: var(--calc-radius-sm);
  border: 1px solid var(--calc-border);
  background: linear-gradient(180deg, rgb(var(--secondary-rgb) / 0.02), rgb(var(--secondary-rgb) / 0.01));
  min-height: 72px;
  box-shadow: 0 10px 24px rgb(var(--secondary-rgb) / 0.06);
}

.calculator-page.calculator-v2 .material-card i {
  color: rgb(var(--primary-rgb) / 0.80);
}

.calculator-page.calculator-v2 .material-option input:checked + .material-card {
  border-color: rgb(var(--primary-rgb) / 0.38);
  background: linear-gradient(180deg, var(--brand-primary-soft), rgb(255 255 255 / 1));
  box-shadow: 0 18px 42px rgb(var(--secondary-rgb) / 0.10);
}

/* Toggle buttons */
.calculator-page.calculator-v2 .toggle-btn span {
  border-radius: 999px;
  border: 1px solid var(--calc-border);
  background: rgb(var(--secondary-rgb) / 0.03);
  min-height: 44px;
  justify-content: center;
}

.calculator-page.calculator-v2 .toggle-btn input:checked + span {
  background: var(--brand-primary);
  border-color: rgb(var(--primary-rgb) / 0.60);
  box-shadow: 0 16px 36px rgb(var(--primary-rgb) / 0.18);
}

/* Checkbox cards */
.calculator-page.calculator-v2 .checkbox-content {
  border-radius: var(--calc-radius-sm);
  border: 1px solid var(--calc-border);
  background: rgb(var(--secondary-rgb) / 0.02);
  min-height: 72px;
}

.calculator-page.calculator-v2 .checkbox-card input:checked + .checkbox-content {
  border-color: rgb(var(--primary-rgb) / 0.38);
  background: linear-gradient(180deg, var(--brand-primary-soft), rgb(255 255 255 / 1));
}

.calculator-page.calculator-v2 .checkbox-content i {
  color: rgb(var(--primary-rgb) / 0.80);
}

.calculator-page.calculator-v2 .checkbox-price {
  color: var(--brand-primary);
  font-weight: 800;
}

/* Color picker */
.calculator-page.calculator-v2 .color-picker-hint {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--text-muted);
}

.calculator-page.calculator-v2 .color-picker-hint__text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.calculator-page.calculator-v2 .color-picker-hint__track {
  position: relative;
  width: 42px;
  height: 10px;
  border-radius: 999px;
  background: rgb(var(--secondary-rgb) / 0.14);
  overflow: hidden;
}

.calculator-page.calculator-v2 .color-picker-hint__dot {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgb(var(--primary-rgb) / 0.90);
  box-shadow: 0 0 10px rgb(var(--primary-rgb) / 0.45);
  transform: translateY(-50%);
  animation: calcColorHintSwipe 1.6s ease-in-out infinite;
}

@keyframes calcColorHintSwipe {
  0% {
    transform: translate(0, -50%);
    opacity: 0.25;
  }
  22% {
    opacity: 1;
  }
  78% {
    transform: translate(30px, -50%);
    opacity: 1;
  }
  100% {
    transform: translate(30px, -50%);
    opacity: 0.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calculator-page.calculator-v2 .color-picker-hint__dot {
    animation: none;
    opacity: 0.9;
  }
}

.calculator-page.calculator-v2 .color-picker {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-columns: minmax(176px, 1fr);
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.calculator-page.calculator-v2 .color-picker::-webkit-scrollbar {
  height: 8px;
}

.calculator-page.calculator-v2 .color-picker::-webkit-scrollbar-thumb {
  background: rgb(var(--secondary-rgb) / 0.25);
  border-radius: 999px;
}

.calculator-page.calculator-v2 .color-picker::-webkit-scrollbar-track {
  background: rgb(var(--secondary-rgb) / 0.08);
  border-radius: 999px;
}

.calculator-page.calculator-v2 .color-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--calc-border);
  border-radius: 12px;
  background: var(--calc-surface);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  min-width: 176px;
  scroll-snap-align: start;
}

.calculator-page.calculator-v2 .calc-field {
  min-width: 0;
}

.calculator-page.calculator-v2 .color-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.calculator-page.calculator-v2 .color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgb(var(--secondary-rgb) / 0.14);
  flex: 0 0 auto;
}

.calculator-page.calculator-v2 .color-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.calculator-page.calculator-v2 .color-code {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}

.calculator-page.calculator-v2 .color-title {
  font-size: 0.69rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.calculator-page.calculator-v2 .color-option.active {
  border-color: rgb(var(--primary-rgb) / 0.40);
  background: linear-gradient(180deg, var(--brand-primary-soft), rgb(255 255 255 / 1));
}

.calculator-page.calculator-v2 .color-option input:checked + .color-swatch {
  border-color: rgb(var(--primary-rgb) / 0.85);
  box-shadow: 0 0 0 4px var(--brand-primary-weak);
}

/* Results panel */
.calculator-page.calculator-v2 .calculator-results {
  position: static;
}

.calculator-page.calculator-v2 .results-sticky {
  position: sticky;
  top: 124px;
}

@media (max-width: 992px) {
  .calculator-page.calculator-v2 .results-sticky {
    position: static;
    top: auto;
  }
}

/* =====================================================
   Mobile UX: tabs scroll + accordions + estimate bottom-sheet
   ===================================================== */
.calculator-page.calculator-v2 {
  --calc-sheet-bar-h: 84px;
}

@media (max-width: 992px) {
  /* No horizontal page scroll on calculator mobile */
  html,
  body {
    overflow-x: hidden;
  }

  body.page-calculator {
    overflow-x: hidden;
  }

  .calculator-page.calculator-v2 {
    overflow-x: clip;
  }

  .calculator-page.calculator-v2 .calculator-wrapper,
  .calculator-page.calculator-v2 .calculator-form,
  .calculator-page.calculator-v2 .calc-panel,
  .calculator-page.calculator-v2 .calc-section,
  .calculator-page.calculator-v2 .calc-row,
  .calculator-page.calculator-v2 .calc-field,
  .calculator-page.calculator-v2 .promo-input,
  .calculator-page.calculator-v2 .color-picker {
    max-width: 100%;
  }

  .calculator-page.calculator-v2 .calc-section {
    overflow-x: clip;
  }
}

/* Scrollable tabs on mobile */
@media (max-width: 768px) {
  /* Скрыть заголовок и подзаголовок на мобильных */
  .calculator-page.calculator-v2 .calculator-header .page-title,
  .calculator-page.calculator-v2 .calculator-header .page-subtitle {
    display: none !important;
  }

  .calculator-page.calculator-v2 .calc-tabs {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgb(var(--secondary-rgb) / 0.04);
    border: 1px solid var(--calc-border);
    border-radius: 999px;
  }

  .calculator-page.calculator-v2 .calc-tabs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .calculator-page.calculator-v2 .calc-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    min-height: 44px;
    padding: 10px 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-strong);
    transition: all 180ms ease;
    position: relative;
  }

  .calculator-page.calculator-v2 .calc-tab i {
    opacity: 0.9;
    margin-right: 6px;
  }

  .calculator-page.calculator-v2 .calc-tab:hover {
    background: rgb(255 255 255 / 0.65);
    border-color: rgb(var(--secondary-rgb) / 0.14);
  }

  .calculator-page.calculator-v2 .calc-tab.active {
    background: var(--calc-surface);
    border-color: rgb(var(--secondary-rgb) / 0.14);
    color: var(--brand-primary);
    box-shadow: 0 8px 20px rgb(var(--secondary-rgb) / 0.12);
  }
}

/* Improve spacing and prevent overlap with bottom sheet bar */
@media (max-width: 992px) {
  .calculator-page.calculator-v2 {
    padding-bottom: calc(var(--calc-sheet-bar-h) + env(safe-area-inset-bottom, 0px));
  }
}

/* Accordion sections (JS adds classes/aria + wraps content) */
.calculator-page.calculator-v2 .calc-accordion__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  min-width: 0;
}

.calculator-page.calculator-v2 .calc-section-title {
  min-width: 0;
}

.calculator-page.calculator-v2 .calc-accordion__toggle > span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.calculator-page.calculator-v2 .calc-accordion__toggle > span:first-child i {
  flex: 0 0 auto;
}

.calculator-page.calculator-v2 .calc-accordion__toggle i {
  color: rgb(var(--primary-rgb) / 0.85);
}

.calculator-page.calculator-v2 .calc-accordion__chev {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--calc-border);
  background: rgb(var(--secondary-rgb) / 0.02);
  color: rgb(var(--secondary-rgb) / 0.70);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
  flex: 0 0 auto;
}

.calculator-page.calculator-v2 .calc-section.is-collapsed .calc-accordion__chev {
  transform: rotate(-90deg);
}

.calculator-page.calculator-v2 .calc-accordion__content[hidden] {
  display: none !important;
}

.calculator-page.calculator-v2 .calc-accordion__content {
  padding-top: 12px;
}

@media (min-width: 993px) {
  .calculator-page.calculator-v2 .calc-accordion__chev {
    display: none;
  }

  .calculator-page.calculator-v2 .calc-accordion__toggle {
    cursor: default;
  }
}

/* Rows layout */
@media (max-width: 768px) {
  .calculator-page.calculator-v2 .calc-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 520px) and (max-width: 768px) {
  .calculator-page.calculator-v2 .calc-row--mobile-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Color picker compact */
@media (max-width: 768px) {
  .calculator-page.calculator-v2 .color-picker-hint {
    display: inline-flex;
    margin-bottom: 6px;
  }

  .calculator-page.calculator-v2 .color-picker-hint__text {
    font-size: 0.68rem;
  }

  .calculator-page.calculator-v2 .color-picker {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0.25rem 0.5rem;
    padding-right: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }

  .calculator-page.calculator-v2 .color-picker::-webkit-scrollbar {
    display: none;
  }

  .calculator-page.calculator-v2 .color-option {
    padding: 8px;
    gap: 8px;
    min-width: 168px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .calculator-page.calculator-v2 .color-swatch {
    width: 20px;
    height: 20px;
    border-width: 2px;
  }

  .calculator-page.calculator-v2 .color-code {
    font-size: 0.7rem;
  }

  .calculator-page.calculator-v2 .color-title {
    font-size: 0.66rem;
  }
}

/* =====================================================
   MOBILE CALCULATOR COMPACT IMPROVEMENTS
   ===================================================== */

@media (max-width: 768px) {
  /* Исправить переполнение секций */
  .calculator-page.calculator-v2 .container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 8px;
    padding-right: 8px;
  }

  .calculator-page.calculator-v2 .calculator-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }

  .calculator-page.calculator-v2 .calculator-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 0;
    padding-right: 0;
  }

  /* Компактные секции */
  .calculator-page.calculator-v2 .calc-section {
    padding: 0.625rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }

  .calculator-page.calculator-v2 .calc-section + .calc-section {
    margin-top: 8px;
  }

  .calculator-page.calculator-v2 .calc-panel + .calc-section {
    margin-top: 8px;
  }
  
  .calculator-page.calculator-v2 .calc-section-title {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
  
  /* Компактные вкладки */
  .calculator-page.calculator-v2 .calc-tabs {
    padding: 4px;
    gap: 4px;
  }
  
  .calculator-page.calculator-v2 .calc-tab {
    padding: 8px 12px;
    font-size: 0.8125rem;
    min-height: 40px;
  }
  
  .calculator-page.calculator-v2 .calc-tab i {
    font-size: 0.875rem;
    margin-right: 4px;
  }
  
  /* Компактные карточки материала */
  .calculator-page.calculator-v2 .material-select {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Odd item: span full width (e.g., 3 materials) */
  .calculator-page.calculator-v2 .material-select .material-option:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  
  .calculator-page.calculator-v2 .material-card {
    padding: 0.625rem;
    min-height: 64px;
    gap: 6px;
  }
  
  .calculator-page.calculator-v2 .material-card i {
    font-size: 1.25rem;
    margin-bottom: 0;
  }
  
  .calculator-page.calculator-v2 .material-name {
    font-size: 0.75rem;
  }
  
  /* Компактные поля */
  .calculator-page.calculator-v2 .calc-field {
    margin-bottom: 0.5rem;
  }
  
  .calculator-page.calculator-v2 .calc-field label {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
  }
  
  .calculator-page.calculator-v2 .calc-field input[type="number"],
  .calculator-page.calculator-v2 .calc-field select {
    padding: 0.5rem 0.625rem;
    font-size: 0.9375rem;
    min-height: 44px;
  }
  
  .calculator-page.calculator-v2 .calc-field input[type="range"] {
    margin-top: 0.5rem;
  }
  
  /* Компактные чекбоксы */
  .calculator-page.calculator-v2 .checkbox-group,
  .calculator-page.calculator-v2 .toggle-group {
    gap: 0.5rem;
  }
  
  .calculator-page.calculator-v2 .checkbox-item,
  .calculator-page.calculator-v2 .toggle-item,
  .calculator-page.calculator-v2 .checkbox-card {
    padding: 0;
    font-size: 0.875rem;
  }

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

  .calculator-page.calculator-v2 .checkbox-content {
    padding: 0.625rem;
    min-height: 64px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
  }

  .calculator-page.calculator-v2 .checkbox-content i {
    font-size: 1.25rem;
  }

  .calculator-page.calculator-v2 .checkbox-title {
    font-size: 0.9rem;
  }

  .calculator-page.calculator-v2 .checkbox-price {
    font-size: 0.875rem;
    margin-left: auto;
    white-space: nowrap;
    margin-left: 0;
  }
  
  /* Компактные toggle buttons */
  .calculator-page.calculator-v2 .toggle-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  
  .calculator-page.calculator-v2 .toggle-btn span {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.875rem;
    width: 100%;
  }
}

/* Маленькие экраны */
@media (max-width: 480px) {
  .calculator-page.calculator-v2 .calc-tabs {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px;
  }
  
  .calculator-page.calculator-v2 .calc-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  
  .calculator-page.calculator-v2 .calc-row--mobile-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .calculator-page.calculator-v2 .material-select {
    grid-template-columns: 1fr;
  }

  .calculator-page.calculator-v2 .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* Улучшенный bottom sheet для результатов */
@media (max-width: 992px) {
  .calculator-page.calculator-v2 .calc-sheet__bar {
    box-shadow: 0 -4px 20px rgb(var(--secondary-rgb) / 0.15);
  }
  
  .calculator-page.calculator-v2 .calculator-form {
    padding-bottom: calc(var(--calc-sheet-bar-h) + env(safe-area-inset-bottom, 0px));
  }
  
  /* Улучшенная видимость результатов */
  .calculator-page.calculator-v2 .calc-sheet__bar-value {
    font-size: 1.25rem;
  }
  
  .calculator-page.calculator-v2 .calc-sheet__bar-label {
    font-size: 0.75rem;
  }
}

/* Bottom-sheet estimate (<=992px) */
.calculator-page.calculator-v2 .calc-sheet-backdrop[hidden] {
  display: none;
}

.calculator-page.calculator-v2 .calc-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgb(15 23 42 / 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.calculator-page.calculator-v2 .calc-sheet {
  position: relative;
}

.calculator-page.calculator-v2 .calc-sheet__bar {
  display: none;
}

.calculator-page.calculator-v2 .calc-sheet__panel {
  position: static;
}

.calculator-page.calculator-v2 .calc-sheet__panel-head {
  display: none;
}

@media (min-width: 993px) {
  .calculator-page.calculator-v2 .calc-sheet__panel-head {
    display: none !important;
  }
}

@media (max-width: 992px) {
  .calculator-page.calculator-v2 .results-help {
    display: none;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 2200;
    background: rgb(255 255 255 / 0.94);
    border: 1px solid rgb(var(--secondary-rgb) / 0.12);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgb(var(--secondary-rgb) / 0.16);
    padding: 10px 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--brand-primary-weak), 0 18px 50px rgb(var(--secondary-rgb) / 0.16);
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-handle {
    grid-column: 1 / -1;
    justify-self: center;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgb(var(--secondary-rgb) / 0.22);
    margin-bottom: 2px;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-main {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-label {
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-value {
    font-weight: 900;
    color: var(--brand-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgb(var(--secondary-rgb) / 0.76);
    font-size: 0.875rem;
    white-space: nowrap;
  }

  .calculator-page.calculator-v2 .calc-sheet__bar-btn {
    min-height: 44px;
    border-radius: 14px;
    padding: 10px 14px;
    white-space: nowrap;
  }

  .calculator-page.calculator-v2 .calc-sheet__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2201;
    background: var(--calc-surface);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid rgb(var(--secondary-rgb) / 0.12);
    box-shadow: 0 -20px 70px rgb(var(--secondary-rgb) / 0.20);
    transform: translateY(110%);
    transition: transform 220ms ease;
    max-height: min(85vh, 760px);
    display: flex;
    flex-direction: column;
  }

  .calculator-page.calculator-v2 .calc-sheet.is-open .calc-sheet__panel {
    transform: translateY(0);
  }

  @media (prefers-reduced-motion: reduce) {
    .calculator-page.calculator-v2 .calc-sheet__panel {
      transition: none;
    }
  }

  .calculator-page.calculator-v2 .calc-sheet__panel-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgb(255 255 255 / 0.96);
    border-bottom: 1px solid rgb(var(--secondary-rgb) / 0.10);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .calculator-page.calculator-v2 .calc-sheet__panel-handle {
    grid-column: 1 / -1;
    justify-self: center;
    width: 46px;
    height: 4px;
    border-radius: 999px;
    background: rgb(var(--secondary-rgb) / 0.22);
    margin-bottom: 2px;
  }

  .calculator-page.calculator-v2 .calc-sheet__panel-title {
    grid-column: 1 / -1;
    text-align: center;
    font-weight: 900;
    letter-spacing: -0.01em;
    color: var(--text-strong);
  }

  .calculator-page.calculator-v2 .calc-sheet__close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgb(var(--secondary-rgb) / 0.12);
    background: rgb(var(--secondary-rgb) / 0.03);
    color: rgb(var(--secondary-rgb) / 0.75);
    cursor: pointer;
  }

  .calculator-page.calculator-v2 .calc-sheet__close:hover {
    background: rgb(var(--secondary-rgb) / 0.06);
  }

  .calculator-page.calculator-v2 .calc-sheet__panel-body {
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calculator-page.calculator-v2 .calc-sheet__panel-body .results-sticky {
    position: static;
    top: auto;
  }
}

@media (max-width: 992px) {
  body.page-calculator.cookie-banner-active .calculator-page.calculator-v2 .calc-sheet__bar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(24px);
  }

  body.page-calculator.cookie-banner-active .calculator-page.calculator-v2 .calc-sheet.is-open .calc-sheet__panel {
    transform: translateY(110%);
  }

  body.page-calculator.cookie-banner-active .calculator-page.calculator-v2 .calc-sheet-backdrop {
    display: none !important;
  }
}

/* When sheet is open, lock background scroll (JS adds class) */
.calc-sheet-open {
  overflow: hidden !important;
}

.calculator-page.calculator-v2 .results-card {
  border: 1px solid var(--calc-border);
  border-radius: 20px;
  box-shadow: var(--calc-shadow);
}

.calculator-page.calculator-v2 .results-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.calculator-page.calculator-v2 .calc-section-preview {
  border-style: dashed;
  background: rgb(var(--secondary-rgb) / 0.03);
}

.calculator-page.calculator-v2 .calc-section-preview.is-added {
  border-style: solid;
  border-color: rgb(var(--primary-rgb) / 0.28);
  background: rgb(var(--primary-rgb) / 0.06);
}

.calculator-page.calculator-v2 .calc-section-preview__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.calculator-page.calculator-v2 .calc-section-preview__meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.calculator-page.calculator-v2 .calc-section-preview__total {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.calculator-page.calculator-v2 .calc-section-preview__days {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.calculator-page.calculator-v2 .calc-section-preview__btn {
  min-height: 40px;
  border-radius: 12px;
  white-space: nowrap;
}

.calculator-page.calculator-v2 .results-mode-hint {
  margin: -8px 0 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.calculator-page.calculator-v2 .results-items {
  margin-bottom: 14px;
}

.calculator-page.calculator-v2 .result-item {
  grid-template-columns: minmax(0, 1fr) minmax(86px, auto) minmax(110px, auto);
  align-items: center;
  gap: 8px;
}

.calculator-page.calculator-v2 .item-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.calculator-page.calculator-v2 .item-name-body {
  min-width: 0;
}

.calculator-page.calculator-v2 .item-section-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgb(var(--primary-rgb) / 0.22);
  background: rgb(var(--primary-rgb) / 0.08);
  color: rgb(var(--primary-rgb) / 0.86);
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.calculator-page.calculator-v2 .item-color-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.calculator-page.calculator-v2 .item-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgb(var(--secondary-rgb) / 0.28);
  background: var(--item-color, #d1d5db);
  flex: 0 0 auto;
}

.calculator-page.calculator-v2 .item-color-text {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.calculator-page.calculator-v2 .item-qty,
.calculator-page.calculator-v2 .item-price,
.calculator-page.calculator-v2 #materials-cost,
.calculator-page.calculator-v2 #work-cost,
.calculator-page.calculator-v2 #delivery-cost,
.calculator-page.calculator-v2 #discount-value,
.calculator-page.calculator-v2 #total-cost {
  font-variant-numeric: tabular-nums;
}

.calculator-page.calculator-v2 .item-qty {
  text-align: right;
}

.calculator-page.calculator-v2 .item-price {
  color: var(--text-strong);
  font-weight: 700;
}

.calculator-page.calculator-v2 .results-empty {
  border: 1px dashed rgb(var(--secondary-rgb) / 0.24);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  .calculator-page.calculator-v2 .calc-section-preview__row {
    align-items: stretch;
    flex-direction: column;
  }

  .calculator-page.calculator-v2 .result-item {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
    align-items: start;
  }

  .calculator-page.calculator-v2 .item-name {
    grid-column: 1 / -1;
  }

  .calculator-page.calculator-v2 .item-qty {
    grid-column: 1;
    text-align: left;
  }

  .calculator-page.calculator-v2 .item-price {
    grid-column: 2;
    text-align: right;
    color: var(--brand-primary);
  }
}

.calculator-page.calculator-v2 .results-total {
  border-top: 1px solid rgb(var(--secondary-rgb) / 0.10);
}

.calculator-page.calculator-v2 .total-value {
  color: var(--brand-primary);
  letter-spacing: -0.02em;
}

.calculator-page.calculator-v2 .results-actions .btn.btn-link {
  border: 1px solid transparent;
  border-radius: 14px;
  justify-content: center;
  min-height: 44px;
}

.calculator-page.calculator-v2 .results-actions .btn.btn-link:hover {
  background: rgb(var(--secondary-rgb) / 0.04);
  border-color: rgb(var(--secondary-rgb) / 0.10);
  text-decoration: none;
}

.calculator-page.calculator-v2 .results-help {
  border: 1px solid var(--calc-border);
  border-radius: 20px;
  box-shadow: var(--calc-shadow);
}

.calculator-page.calculator-v2 .results-help h4 i {
  color: rgb(var(--primary-rgb) / 0.80);
}

/* Focus visibility */
.calculator-page.calculator-v2 .calc-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-primary-weak);
  border-color: rgb(var(--primary-rgb) / 0.35);
}

.calculator-page.calculator-v2 .material-option input:focus-visible + .material-card,
.calculator-page.calculator-v2 .toggle-btn input:focus-visible + span,
.calculator-page.calculator-v2 .checkbox-card input:focus-visible + .checkbox-content,
.calculator-page.calculator-v2 .color-option input:focus-visible + .color-swatch {
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-primary-weak);
  border-color: rgb(var(--primary-rgb) / 0.45);
}

/* Print-friendly output (for PDF fallback) */
@media print {
  .header,
  .footer,
  .cookie-banner,
  .modal,
  .results-actions,
  .burger-menu,
  .mobile-menu,
  .nav-actions,
  .nav-menu {
    display: none !important;
  }

  .calculator-page.calculator-v2 {
    padding: 0 !important;
    background: #fff !important;
  }

  .calculator-page.calculator-v2 .calculator-wrapper {
    grid-template-columns: 1fr !important;
  }

  .calculator-page.calculator-v2 .results-card,
  .calculator-page.calculator-v2 .calc-section {
    box-shadow: none !important;
  }
}
