/* TITANGATE — калькулятор и смета */

.calc { display: grid; gap: clamp(28px, 3vw, 48px); align-items: start; }
@media (min-width: 1180px) { .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 470px); } }

/* --- шаги конфигуратора --------------------------------------------------- */
.cstep { border-top: 1px solid var(--line); padding-top: clamp(24px, 3vw, 36px); margin-top: clamp(24px, 3vw, 36px); }
.cstep:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.cstep__h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.cstep__n { font-family: var(--ff-mono); font-size: 12px; letter-spacing: .12em; color: var(--signal); flex: none; }
.cstep__t { font-family: var(--ff-display); font-weight: 700; font-size: clamp(19px, 2vw, 24px); letter-spacing: -.015em; }
.cstep__d { font-size: 15px; color: var(--ink-mute); max-width: 64ch; margin-bottom: 22px; }
.cstep__body { display: grid; gap: 20px; }

/* --- пресеты размеров ----------------------------------------------------- */
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  font-family: var(--ff-mono); font-size: 13px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  transition: border-color .16s, background-color .16s, color .16s;
}
.preset:hover { border-color: var(--ink); }
.preset b { font-weight: 700; }
.preset i { font-style: normal; color: var(--ink-mute); margin-left: 6px; }

/* --- сетка выбора (серии, поверхности, схемы) ----------------------------- */
.opts { display: grid; gap: 10px; }
@media (min-width: 620px) { .opts--2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 620px) { .opts--3 { grid-template-columns: repeat(3, 1fr); } }

.opt {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; transition: border-color .16s, box-shadow .16s, transform .16s var(--ease);
}
.opt:hover { border-color: color-mix(in srgb, var(--ink) 34%, transparent); }
.opt[aria-pressed="true"] { border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 16%, transparent); }
.opt__t { font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt__t small { font-family: var(--ff-mono); font-weight: 500; font-size: 12px; color: var(--signal); flex: none; }
.opt__d { font-size: 13.5px; color: var(--ink-mute); margin-top: 6px; line-height: 1.45; }

/* --- опции со счётчиком ---------------------------------------------------- */
.addons { display: grid; gap: 8px; }
.addon {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px;
  transition: border-color .16s;
}
.addon.is-on { border-color: var(--signal); }
.addon__t { font-weight: 600; font-size: 15.5px; }
.addon__d { font-size: 13px; color: var(--ink-mute); margin-top: 4px; line-height: 1.45; }
.addon__p { font-family: var(--ff-mono); font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.addon__ctrl { display: flex; align-items: center; gap: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; }
.stepper button {
  width: 36px; height: 36px; border: 0; background: none; cursor: pointer; font-size: 19px; line-height: 1;
  color: var(--ink-soft); border-radius: 999px; transition: background-color .14s, color .14s;
}
.stepper button:hover { background: var(--zinc-100); color: var(--ink); }
.stepper output { min-width: 30px; text-align: center; font-family: var(--ff-mono); font-weight: 500; font-size: 15px; }
.tgl { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; width: 46px; height: 27px; margin: 0; cursor: pointer; }
.tgl__t {
  width: 46px; height: 27px; border-radius: 999px; background: var(--zinc-300);
  transition: background-color .18s; position: relative; flex: none;
}
.tgl__t::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .2s var(--ease);
}
.tgl input:checked + .tgl__t { background: var(--signal); }
.tgl input:checked + .tgl__t::after { transform: translateX(19px); }
.tgl input:focus-visible + .tgl__t { outline: 2px solid var(--signal); outline-offset: 3px; }

/* --- проверка проёма ------------------------------------------------------- */
.chk-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.chk-list { display: grid; gap: 6px; margin-top: 18px; }
.chk {
  display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); font-size: 14.5px;
}
.chk__i {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--ink-mute);
}
.chk--ok  .chk__i { background: var(--ok); }
.chk--bad .chk__i { background: var(--signal); }
.chk--ok  { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chk--bad { border-color: var(--signal); }
.chk__v { font-family: var(--ff-mono); font-size: 13px; text-align: right; white-space: nowrap; }
.chk__v i { font-style: normal; color: var(--ink-mute); display: block; font-size: 11px; }
.chk__hint {
  padding: 14px 16px; border-radius: var(--r); background: var(--signal-100);
  font-size: 14px; color: #7A3208; border: 1px solid color-mix(in srgb, var(--signal) 30%, transparent);
}

/* --- смета (sticky) -------------------------------------------------------- */
.sheet { position: sticky; top: 92px; }
.sheet__card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 30px 60px -40px rgba(0,0,0,.35);
}
.sheet__hd {
  background: var(--graphite-900); color: var(--on-dark); padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sheet__hd b { font-family: var(--ff-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.sheet__hd span { font-family: var(--ff-mono); font-size: 11.5px; color: var(--on-dark-mute); letter-spacing: .08em; }
.sheet__stage { padding: 14px 16px 4px; background: var(--zinc-50); border-bottom: 1px solid var(--line); }
.sheet__body { padding: 8px 0 0; max-height: 40vh; overflow-y: auto; }
@media (min-width: 1180px) { .sheet__body { max-height: min(38vh, 380px); } }

.cl { width: 100%; font-size: 13.5px; }
.cl th, .cl td { padding: 10px 22px; border-bottom: 1px dashed var(--line); vertical-align: top; text-align: left; }
.cl thead th {
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 500; padding-top: 14px; padding-bottom: 8px;
}
.cl tbody tr:last-child td { border-bottom: 0; }
.cl__k { display: block; font-weight: 500; line-height: 1.35; }
.cl__n { display: block; font-size: 11.5px; color: var(--ink-mute); margin-top: 3px; }
.cl__free { color: var(--ok); font-family: var(--ff-body); font-weight: 500; font-size: 12.5px; }
.cl .is-num { font-family: var(--ff-mono); font-size: 12px; color: var(--ink-mute); white-space: nowrap; text-align: right; }
.cl .is-price { font-family: var(--ff-mono); font-weight: 700; text-align: right; white-space: nowrap; }

.sheet__total { padding: 18px 22px; border-top: 2px solid var(--ink); display: grid; gap: 4px; }
.sheet__total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sheet__total-row span { font-size: 13.5px; color: var(--ink-mute); }
.sheet__total-row b { font-family: var(--ff-mono); font-weight: 700; font-size: 14px; }
.sheet__grand { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.sheet__grand span { font-size: 15px; color: var(--ink); font-weight: 600; }
.sheet__grand b { font-family: var(--ff-display); font-weight: 800; font-size: clamp(24px, 2.6vw, 31px); letter-spacing: -.03em; }
.sheet__note { padding: 0 22px 18px; font-size: 12.5px; color: var(--ink-mute); line-height: 1.45; }
.sheet__acts { padding: 0 22px 22px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.sheet__acts .btn { padding: 12px 14px; font-size: 14px; }
.sheet__acts .btn--wide { grid-column: 1 / -1; }

/* мобильная нижняя панель */
.calc-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 70; display: none;
  background: var(--graphite-900); color: var(--on-dark);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  align-items: center; justify-content: space-between; gap: 14px;
  box-shadow: 0 -10px 30px -18px rgba(0,0,0,.9);
}
.calc-bar span { font-size: 12px; color: var(--on-dark-mute); display: block; }
.calc-bar b { font-family: var(--ff-display); font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
@media (max-width: 1179px) { .calc-bar { display: flex; } body.is-calc { padding-bottom: 78px; } .sheet { position: static; } }

.calc-done { text-align: center; padding: 26px 18px; }
.calc-done b { font-family: var(--ff-display); font-size: 20px; display: block; margin-bottom: 8px; }
.calc-done p { color: var(--ink-soft); font-size: 15px; }

.calc-legal { font-size: 12.5px; color: var(--ink-mute); line-height: 1.5; max-width: 72ch; }

/* --- печать сметы ---------------------------------------------------------- */
.print-only { display: none; }

@media print {
  @page { margin: 14mm; }
  .hdr, .mnav, .ftr, .fab, .crumbs, .calc-bar, .cstep, .sheet__acts, .calc__intro, .band--dark { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .calc { display: block; }
  .sheet { position: static; }
  .sheet__card { border: 0; box-shadow: none; }
  .sheet__hd { background: #fff; color: #000; border-bottom: 2px solid #000; padding: 0 0 10px; }
  .sheet__body { max-height: none; overflow: visible; }
  .sheet__stage { background: #fff; padding: 12px 0; }
  .cl th, .cl td { padding: 7px 0; }
  .print-only { display: block; }
  .print-hd { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 14px; font-size: 11px; }
  .print-hd b { font-size: 16px; font-family: var(--ff-display); }
  .print-spec { margin-top: 14px; font-size: 11px; columns: 2; column-gap: 24px; }
  .print-spec .spec__row { padding: 5px 0; break-inside: avoid; }
  .print-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid #000; font-size: 10px; }
  a[href]::after { content: ''; }
}
