/* =============================================================
 * assembly-calculator.css — /assemblycalculator, mobile-first.
 * Карточки вместо таблицы, sticky-итог снизу.
 * ============================================================= */

/* ──────── HERO (компактный) ──────── */
.ac-hero {
  background: var(--color-grey-100);
  padding-block: var(--sp-6);
  border-bottom: 1px solid var(--color-grey-200);
}
.ac-hero__inner { max-width: 720px; }
.ac-hero__title {
  font-size: clamp(1.8rem, 1rem + 2.4vw, 2.6rem);
  font-weight: var(--fw-medium);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: var(--sp-3) 0 var(--sp-3);
}
.ac-hero__lead {
  font-size: var(--fs-md);
  color: var(--color-text-secondary);
  line-height: var(--lh-body);
  margin: 0;
}
.ac-hero__lead strong { color: var(--color-text); font-weight: var(--fw-semibold); }

/* ──────── "Что входит" — collapsible ──────── */
.ac-include { padding-block: var(--sp-5); }
.ac-include__details {
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-md);
}
.ac-include__summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
}
.ac-include__summary::-webkit-details-marker { display: none; }
.ac-include__summary::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--duration-fast) var(--ease-out);
  margin-left: auto;
  opacity: 0.6;
}
.ac-include__details[open] .ac-include__summary::after { transform: rotate(-135deg); }

.ac-include__count {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  font-weight: var(--fw-regular);
}
.ac-include__list {
  margin: 0;
  padding: 0 var(--sp-5) var(--sp-5) calc(var(--sp-5) + var(--sp-4));
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
}
.ac-include__list li { margin-bottom: 6px; }

/* ──────── СЕКЦИЯ КАЛЬКУЛЯТОРА ──────── */
.ac-section {
  padding-block: var(--sp-6) var(--sp-7);
  /* отступ снизу под sticky-bar чтобы контент не упирался */
  padding-bottom: 130px;
}
.ac-section__hint {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--sp-5);
}

/* ──────── СПИСОК ПОЗИЦИЙ ──────── */
.ac-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ──────── ОДНА ПОЗИЦИЯ ──────── */
.ac-item {
  display: grid;
  grid-template-columns: 44px 1fr 220px;
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.ac-item.is-active {
  border-color: var(--color-warm-black);
  background: linear-gradient(to right, rgba(220, 52, 31, 0.025) 0%, var(--color-white) 100%);
}

/* mobile: 2-уровневая стопка */
@media (max-width: 768px) {
  .ac-item {
    grid-template-columns: 36px 1fr;
    grid-template-areas:
      "num  body"
      "inp  inp";
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
  }
  .ac-item__num   { grid-area: num; }
  .ac-item__body  { grid-area: body; }
  .ac-item__input { grid-area: inp; }
}

.ac-item__num {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 14px;
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  letter-spacing: -0.02em;
  padding-top: 2px;
}
.ac-item.is-active .ac-item__num { color: var(--color-accent); }

.ac-item__body { min-width: 0; }
.ac-item__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  line-height: 1.4;
  margin: 0 0 4px;
}
.ac-item__meta {
  font-size: var(--fs-xs);
  color: var(--color-text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ac-item__price strong { color: var(--color-text); font-weight: var(--fw-semibold); }

/* блок ввода — справа на desktop, снизу на mobile */
.ac-item__input {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch; /* поле ввода и карточка «СУММА» — одной высоты */
}
.ac-item__input-label {
  grid-column: 1 / -1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  font-weight: var(--fw-semibold);
  margin-bottom: 4px;
}
.ac-item__input input {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  background: var(--color-white);
  border: 1.5px solid var(--color-grey-300);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  caret-color: var(--color-accent);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  /* убираем стрелки number-input */
  -moz-appearance: textfield;
}
.ac-item__input input::-webkit-outer-spin-button,
.ac-item__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ac-item__input input:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(20, 18, 16, 0.08);
}

.ac-item__output {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: baseline;
  padding: 10px 12px;
  background: var(--color-grey-150);
  border-radius: var(--radius-sm);
  min-height: 44px;
}
.ac-item.is-active .ac-item__output { background: var(--color-warm-black); color: #fff; }
.ac-item__output-label {
  grid-column: 1 / -1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  /* был opacity:0.6 → #1d1d1d×0.6 ≈ #747474 = 4.36:1 на #f7f7f7 (фейл WCAG).
     Явный grey-650 (#5e5e5e) даёт ~7:1. На активной (тёмной) — белый 70%. */
  color: var(--color-grey-650);
  font-weight: var(--fw-semibold);
}
.ac-item.is-active .ac-item__output-label { color: rgba(255, 255, 255, 0.72); }
.ac-item__output-value {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.ac-item__output-unit { font-size: 12px; color: var(--color-grey-650); }
.ac-item.is-active .ac-item__output-unit { color: rgba(255, 255, 255, 0.72); }

/* ──────── DISCLAIMER + NOTES ──────── */
.ac-disclaimer {
  margin: var(--sp-6) 0 var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: rgba(220, 52, 31, 0.06);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--color-text);
  line-height: 1.55;
}
.ac-disclaimer a { color: var(--color-accent-text); text-decoration: underline; }

.ac-notes {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}
.ac-notes li { margin-bottom: 4px; }

/* ──────── STICKY ИТОГ ──────── */
.ac-sticky {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  background: var(--color-warm-black);
  color: #fff;
  box-shadow: 0 -8px 24px rgba(20, 18, 16, 0.25);
  padding: var(--sp-3) 0;
}
.ac-sticky[hidden] { display: none; }
.ac-sticky__inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--sp-4);
  align-items: center;
}
.ac-sticky__count {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.ac-sticky__count-label,
.ac-sticky__total-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  font-weight: var(--fw-semibold);
}
.ac-sticky__count-value {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.ac-sticky__total {
  display: flex; flex-direction: column; gap: 2px;
  text-align: right;
}
.ac-sticky__total-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1;
}
.ac-sticky__rub { font-size: 14px; opacity: 0.6; font-weight: var(--fw-regular); }

.ac-sticky__btn { white-space: nowrap; }
.ac-sticky__actions { display: flex; gap: var(--sp-2); align-items: center; }

@media (max-width: 480px) {
  .ac-sticky__inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "count   total"
      "actions actions";
    gap: var(--sp-2) var(--sp-3);
  }
  .ac-sticky__count   { grid-area: count; }
  .ac-sticky__total   { grid-area: total; }
  .ac-sticky__actions { grid-area: actions; }
  .ac-sticky__actions .ac-sticky__btn { flex: 1; min-width: 0; }
  .ac-sticky__total-value { font-size: var(--fs-xl); }
  .ac-section { padding-bottom: 180px; }
}

/* ══════════════ PDF-ОТЧЁТ (печать → «Сохранить как PDF») ══════════════ */
/* На экране отчёт скрыт; виден только при печати. Заполняется из JS. */
.ac-report { display: none; }

@media print {
  /* печатаем ТОЛЬКО отчёт — всё остальное (sidebar/header/виджет/калькулятор) убираем */
  body > *:not(.ac-report) { display: none !important; }

  .ac-report {
    display: block !important;
    color: #000;
    background: #fff;
    font-family: var(--font-sans, -apple-system, "Segoe UI", Arial, sans-serif);
    font-size: 11pt;
    line-height: 1.4;
  }

  @page { size: A4 portrait; margin: 14mm; }

  .ac-report__head { border-bottom: 2px solid #1d1d1d; padding-bottom: 8px; margin-bottom: 16px; }
  .ac-report__brand { font-size: 19pt; font-weight: 700; letter-spacing: 0.04em; }
  .ac-report__brand-sub { font-size: 9pt; color: #555; margin-top: 3px; }

  .ac-report__title { font-size: 15pt; font-weight: 700; margin: 0 0 2px; }
  .ac-report__date { font-size: 9.5pt; color: #555; margin: 0 0 16px; }

  .ac-report__table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
  .ac-report__table thead { display: table-header-group; } /* повтор шапки на новых страницах */
  .ac-report__table th {
    text-align: left; font-size: 8pt; text-transform: uppercase; letter-spacing: 0.04em;
    color: #555; border-bottom: 1.5px solid #1d1d1d; padding: 5px 6px;
  }
  .ac-report__table td { font-size: 10pt; border-bottom: 0.5px solid #cfcfcf; padding: 6px; vertical-align: top; }
  .ac-report__table tr { page-break-inside: avoid; }
  .ac-report__num  { color: #888; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .ac-report__calc { color: #555; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .ac-report__sum  { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

  .ac-report__table tfoot td { border-top: 1.5px solid #1d1d1d; border-bottom: none; padding-top: 9px; }
  .ac-report__total-label { text-transform: uppercase; letter-spacing: 0.04em; font-size: 10pt; font-weight: 700; }
  .ac-report__total-sum { text-align: right; font-weight: 700; font-size: 14pt; white-space: nowrap; }

  .ac-report__notes { font-size: 8.5pt; color: #444; margin-bottom: 16px; page-break-inside: avoid; }
  .ac-report__notes p { margin: 0 0 6px; }
  .ac-report__notes ul { margin: 0; padding-left: 16px; }
  .ac-report__notes li { margin-bottom: 2px; }

  .ac-report__foot { border-top: 0.5px solid #cfcfcf; padding-top: 8px; font-size: 8pt; color: #666; }
  .ac-report__foot p { margin: 0; }
  .ac-report__foot-sub { margin-top: 2px !important; color: #999; }
}
