/*
 * STALLEX Раскрой — оформление.
 * Токены взяты один в один с рабочего сайта stallexgroup.ru (--stx-*),
 * чтобы инструмент выглядел частью сайта, а не сторонней вставкой.
 */

/* ------------------------------------------------------------------ *
 * Токены
 * ------------------------------------------------------------------ */
:root {
  /* Фирменный оранжевый и его «объёмные» оттенки — сняты с кнопок stallexgroup.ru */
  --brand: #f15a22;
  --brand-2: #ff7a45;
  --brand-top: #ff7540;      /* верх градиента кнопки */
  --brand-deep: #d54813;     /* низ градиента кнопки */
  --brand-edge: #bc3c0d;     /* обводка кнопки */
  --brand-under: #9d300b;    /* «подложка» под кнопкой, даёт объём */
  --brand-ink: #d24413;
  --brand-soft: rgba(241, 90, 34, 0.1);

  --ink: #15181f;
  --ink2: #5c6472;
  --ink3: #8b93a1;
  --line: #e6eaef;
  --line-soft: #f0f3f6;
  --panel: #f5f7f9;
  --bg: #f4f5f7;
  --card: #ffffff;

  --graphite: #1b2027;
  --graphite-2: #232a33;

  --ok: #16a34a;
  --ok-soft: #ecfdf3;
  --ok-line: #c9f0dc;
  --ok-ink: #047857;
  --warn: #b45309;
  --warn-soft: #fff5e6;
  --danger: #cc1818;
  --danger-soft: #fef2f2;
  --danger-line: #fbd5d5;
  --blue: #2f6fed;
  --blue-soft: #eff4fb;
  --blue-line: #dbe7f5;
  --blue-ink: #1e3a5f;

  /* Тень карточек — ровно как у товарных карточек на сайте */
  --shadow: 0 1px 2px rgba(23, 27, 33, 0.05), 0 8px 24px rgba(23, 27, 33, 0.07);
  --shadow-sm: 0 1px 2px rgba(23, 27, 33, 0.05), 0 2px 8px rgba(23, 27, 33, 0.04);
  --shadow-lift: 0 2px 4px rgba(23, 27, 33, 0.06), 0 16px 38px -12px rgba(23, 27, 33, 0.16);

  /* Сталь — для логотипа и заглушек фото */
  --steel: radial-gradient(120% 100% at 30% 15%, #eef1f5, #dce1e8 55%, #c9cfd9);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --font: Manrope, Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: Montserrat, Manrope, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;

  --wrap: 1220px;
}

/* ======================== ДВА РЕЖИМА РАСКРОЯ ======================== */
.cut-mode-rail {
  margin: 0 0 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(180px, .55fr) minmax(420px, 1.45fr);
  gap: 18px;
  align-items: center;
  color: #fff;
  border: 1px solid #303844;
  border-radius: var(--r-xl);
  background:
    linear-gradient(115deg, rgba(255,255,255,.035) 0 34%, transparent 34% 100%),
    var(--graphite);
  box-shadow: 0 18px 42px rgba(20,24,31,.16);
}
.cut-mode-copy h2 { margin: 2px 0 0; font-size: clamp(20px, 2vw, 27px); color: #fff; }
.cut-mode-kicker,
.sheet-step-mark {
  color: #ff9b73;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.cut-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cut-mode-tab {
  min-height: 68px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #dfe4eb;
  text-align: left;
  border: 1px solid #3b4552;
  border-radius: 13px;
  background: #242b34;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.cut-mode-tab:hover { border-color: #697686; transform: translateY(-1px); }
.cut-mode-tab[aria-selected="true"] {
  color: #fff;
  border-color: var(--brand-2);
  background: linear-gradient(135deg, #2b333e, #20262e);
  box-shadow: inset 3px 0 0 var(--brand);
}
.cut-mode-tab:focus-visible { outline: 3px solid #ffba9c; outline-offset: 3px; }
.cut-mode-tab > span:last-child { display: grid; gap: 2px; }
.cut-mode-tab b { font-size: 15px; }
.cut-mode-tab small { color: #aeb8c4; font-size: 12px; }
.cut-mode-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: #ff9b73;
  font-size: 27px;
  line-height: 1;
  border: 1px solid #4a5563;
  border-radius: 9px;
  background: #191e25;
}
.cut-mode-icon-sheet { font-size: 23px; }
.cut-mode-panel[hidden] { display: none !important; }

/* ========================== ЛИСТОВОЙ РЕЖИМ ========================== */
.sheet-mode { margin-bottom: 32px; }
.sheet-mode-head {
  margin-bottom: 14px;
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  color: #fff;
  border-radius: var(--r-lg);
  background: linear-gradient(115deg, var(--graphite), #29323d);
}
.sheet-mode-head h2 { margin: 4px 0 7px; color: #fff; }
.sheet-mode-head p { margin: 0; color: #c2cad4; }
.sheet-local-badge {
  padding: 8px 11px;
  white-space: nowrap;
  color: #d9f5e7;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid #44745d;
  border-radius: 999px;
  background: #20392e;
}
.sheet-work-step {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.sheet-step-head { margin-bottom: 17px; display: flex; gap: 13px; align-items: flex-start; }
.sheet-step-head h3 { margin: 0 0 3px; font-size: 19px; }
.sheet-step-head p { margin: 0; color: var(--ink2); font-size: 13px; }
.sheet-step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: #fff;
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-weight: 800;
  border-radius: 8px 8px 8px 2px;
  background: var(--brand-deep);
}
.sheet-entry-list { display: grid; gap: 11px; margin-bottom: 12px; }
.sheet-entry-card {
  padding: 14px;
  border: 1px solid #dde2e9;
  border-left: 4px solid #aeb6c2;
  border-radius: var(--r);
  background: #fbfcfd;
}
.sheet-entry-card:focus-within { border-left-color: var(--brand); box-shadow: 0 0 0 3px rgba(241,90,34,.08); }
.sheet-card-head { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-remove {
  min-height: 44px;
  padding: 7px 10px;
  color: #9e2f20;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #ecc8c2;
  border-radius: 8px;
  background: #fff7f5;
  cursor: pointer;
}
.sheet-card-grid { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(120px, .75fr)); gap: 10px; }
.sheet-format-grid { grid-template-columns: 1.35fr repeat(3, minmax(118px, .72fr)); }
.sheet-field { display: grid; gap: 5px; align-content: start; }
.sheet-field-label { color: var(--ink2); font-size: 12px; font-weight: 750; }
.sheet-field input,
.sheet-field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  border: 1px solid #cfd5de;
  border-radius: 8px;
  background: #fff;
}
.sheet-field input:focus,
.sheet-field select:focus { outline: 3px solid rgba(241,90,34,.18); border-color: var(--brand-deep); }
.sheet-field input[aria-invalid="true"] { border-color: var(--danger); background: #fff8f7; }
.sheet-field small { min-height: 15px; color: #6d7580; font-size: 11px; }
.sheet-field-error { color: #a3271d !important; font-weight: 650; }
.sheet-check { margin-top: 11px; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; }
.sheet-check input { width: 19px; height: 19px; accent-color: var(--brand-deep); }
.sheet-advanced { margin-top: 16px; border-top: 1px solid var(--line); }
.sheet-advanced summary { padding: 15px 0 4px; color: var(--brand-ink); font-weight: 750; cursor: pointer; }
.sheet-settings-grid { padding-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.sheet-input-error { min-height: 22px; margin-top: 12px; color: #9c261c; font-size: 13px; font-weight: 700; }
.sheet-run-row {
  margin: 8px 0 20px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #dfe4ea;
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.sheet-run-row .btn { min-height: 46px; }
.sheet-status { margin-left: 6px; color: var(--ink2); font-size: 13px; }
.sheet-result {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.sheet-result-head { margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.sheet-result-actions { display: grid; justify-items: end; gap: 5px; }
.sheet-print-button { min-height: 44px; }
.sheet-print-hint { color: var(--ink2); font-size: 11px; }
.sheet-result-lead { margin-bottom: 15px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #dfe4ea; border-radius: var(--r); overflow: hidden; }
.sheet-result-line { padding: 14px 16px; display: grid; gap: 3px; background: #f7f8fa; }
.sheet-result-line + .sheet-result-line { border-left: 1px solid #dfe4ea; }
.sheet-result-line span { color: var(--ink2); font-size: 12px; }
.sheet-result-line strong { font-size: 16px; }
.sheet-kpis { margin: 14px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.sheet-kpi { padding: 13px; display: grid; gap: 5px; border: 1px solid #e1e5eb; border-radius: var(--r); background: #f8f9fb; }
.sheet-kpi span { color: #5c6472; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sheet-kpi strong { font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace; font-size: 19px; }
.sheet-map-toolbar { margin: 17px 0 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.sheet-map-nav { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.sheet-map-nav .btn,
.sheet-map-zoom .btn { min-width: 44px; min-height: 44px; }
.sheet-map-label { text-align: center; }
.sheet-map-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.sheet-map-zoom { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.sheet-map-print-button { white-space: nowrap; }
.sheet-zoom-value { min-width: 62px; min-height: 44px; padding: 9px 8px; display: grid; place-items: center; border: 1px solid #cfd5dc; border-radius: 9px; background: #fff; font-family: "JetBrains Mono", Consolas, monospace; font-weight: 800; }
.sheet-long-aspect { margin: 0 0 9px; color: #5b4635; font-size: 12px; font-weight: 650; }
.sheet-map-stage {
  height: clamp(300px, 50vh, 460px);
  height: clamp(300px, 50svh, 460px);
  min-height: 0;
  max-height: 460px;
  padding: 0;
  display: block;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y;
  border: 1px solid #cfd5dc;
  border-radius: var(--r);
  background:
    linear-gradient(45deg, #eef1f4 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f4 25%, transparent 25%),
    #f7f8fa;
  background-size: 18px 18px;
}
.sheet-map-pan { min-width: 100%; min-height: 100%; display: grid; place-items: center; }
.sheet-map-svg { width: auto; height: auto; max-width: none; max-height: none; display: block; flex: 0 0 auto; filter: drop-shadow(0 9px 14px rgba(19,24,31,.14)); }
.sheet-map-stock { fill: #d9dee5; stroke: #15181f; stroke-width: 3; vector-effect: non-scaling-stroke; }
.sheet-map-free { fill: #f1f3f5; stroke: #a4adb8; stroke-width: 1; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.sheet-map-piece rect { fill: #f1703e; stroke: #6f260e; stroke-width: 2; vector-effect: non-scaling-stroke; }
.sheet-map-piece:nth-of-type(3n) rect { fill: #df5421; }
.sheet-map-piece:nth-of-type(3n+1) rect { fill: #ff8b5e; }
.sheet-map-piece text { fill: #20160f; font-family: "JetBrains Mono", Consolas, monospace; font-weight: 900; pointer-events: none; }
.sheet-map-piece-size { font-weight: 800; }
.sheet-map-and-key { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 330px); gap: 14px; align-items: stretch; }
.sheet-piece-key { height: 100%; max-height: 460px; padding: 14px; overflow: auto; border: 1px solid #cfd5dc; border-radius: var(--r); background: #f8f9fb; }
.sheet-piece-key h3 { margin: 0 0 3px; font-size: 16px; }
.sheet-piece-key > p { margin: 0 0 10px; color: var(--ink2); font-size: 12px; }
.sheet-piece-key-list { margin: 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.sheet-piece-key-item { min-width: 0; padding: 8px; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: center; border: 1px solid #e0e4e9; border-radius: 9px; background: #fff; }
.sheet-piece-key-number { min-width: 34px; min-height: 34px; display: grid; place-items: center; border-radius: 8px; background: #f1703e; color: #20160f; font-family: "JetBrains Mono", Consolas, monospace; font-weight: 900; }
.sheet-piece-key-copy { min-width: 0; display: grid; gap: 2px; }
.sheet-piece-key-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.sheet-piece-key-copy span { color: var(--ink2); font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; font-weight: 700; }
.sheet-map-legend { margin: 10px 0 15px; display: flex; flex-wrap: wrap; gap: 16px; color: var(--ink2); font-size: 12px; }
.sheet-map-legend i { width: 17px; height: 12px; display: inline-block; vertical-align: -2px; border: 1px solid #5e6670; }
.sheet-legend-part { background: #f1703e; }
.sheet-legend-free { background: repeating-linear-gradient(135deg, #fff, #fff 4px, #d8dde3 4px, #d8dde3 6px); }
.sheet-result-table-wrap { margin-top: 14px; overflow-x: auto; }
.sheet-print-layouts { display: none; }
.sheet-result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet-result-table caption { padding: 4px 0 9px; text-align: left; font-weight: 800; }
.sheet-result-table th,
.sheet-result-table td { padding: 8px; text-align: left; border: 1px solid #e1e5ea; }
.sheet-result-table th { color: var(--ink2); font-size: 11px; text-transform: uppercase; background: #f5f7f9; }
.sheet-remnants { margin: 16px 0; }
.sheet-remnants h3 { margin-bottom: 4px; }
.sheet-remnants-note { margin: 0 0 10px; color: var(--ink2); font-size: 12px; }
.sheet-remnant-layout + .sheet-remnant-layout { margin-top: 12px; }
.sheet-remnants-table { margin-top: 5px; }
.sheet-unplaced { margin: 13px 0; padding: 14px; border: 1px solid var(--danger-line); border-radius: var(--r); background: var(--danger-soft); }
.sheet-unplaced h3 { margin: 0 0 7px; font-size: 16px; }
.sheet-unplaced ul { margin: 0; padding-left: 20px; }

@media (max-width: 820px) {
  .cut-mode-rail { grid-template-columns: 1fr; }
  .cut-mode-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .sheet-card-grid,
  .sheet-format-grid,
  .sheet-settings-grid { grid-template-columns: 1fr 1fr; }
  .sheet-kpis { grid-template-columns: 1fr 1fr; }
  .sheet-map-toolbar { grid-template-columns: 1fr; }
  .sheet-map-tools { justify-content: center; flex-wrap: wrap; }
  .sheet-map-zoom { justify-content: center; }
  .sheet-map-and-key { grid-template-columns: 1fr; }
  .sheet-piece-key { max-height: 260px; }
  .sheet-map-stage {
    height: clamp(220px, 38vh, 300px);
    height: clamp(220px, 38svh, 300px);
    min-height: 0;
    max-height: 300px;
  }
}

@media (max-width: 560px) {
  .cut-mode-rail { margin-left: -4px; margin-right: -4px; padding: 12px; border-radius: 15px; }
  .cut-mode-copy { display: block; }
  .cut-mode-tabs { grid-template-columns: 1fr; }
  .cut-mode-tab { min-height: 62px; }
  .sheet-mode-head { padding: 19px; display: grid; }
  .sheet-local-badge { justify-self: start; }
  .sheet-work-step { padding: 15px; }
  .sheet-card-grid,
  .sheet-format-grid,
  .sheet-settings-grid,
  .sheet-result-lead,
  .sheet-kpis { grid-template-columns: 1fr; }
  .sheet-result-line + .sheet-result-line { border-left: 0; border-top: 1px solid #dfe4ea; }
  .sheet-run-row { padding-bottom: calc(14px + env(safe-area-inset-bottom)); display: grid; position: sticky; bottom: 0; z-index: 20; }
  .sheet-run-row .btn { width: 100%; }
  .sheet-status { margin-left: 0; }
  .sheet-result { padding: 14px; }
  .sheet-result-head { display: grid; }
  .sheet-result-actions { width: 100%; justify-items: stretch; }
  .sheet-print-button { width: 100%; }
  .sheet-map-nav { grid-template-columns: 48px 1fr 48px; }
  .sheet-map-nav .btn { min-width: 44px; padding-left: 8px; padding-right: 8px; font-size: 0; }
  .sheet-map-nav .btn:first-child::after { content: "←"; font-size: 18px; }
  .sheet-map-nav .btn:last-child::after { content: "→"; font-size: 18px; }
  .sheet-map-zoom { display: grid; grid-template-columns: 44px minmax(62px, 1fr) 44px minmax(84px, auto); }
  .sheet-map-tools { display: grid; grid-template-columns: 1fr; }
  .sheet-map-print-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cut-mode-tab { transition: none; }
  .cut-mode-tab:hover { transform: none; }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.18; margin: 0; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(27px, 3.8vw, 42px); letter-spacing: -0.032em; }
h2 { font-size: clamp(20px, 2.5vw, 28px); letter-spacing: -0.026em; }
h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

/* Фокус видно всегда и одинаково — как на основном сайте. */
:focus-visible { outline: 3px solid rgba(241, 90, 34, .34); outline-offset: 3px; border-radius: 5px; }
p { margin: 0 0 12px; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 13px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink2); }
.dim { color: var(--ink3); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ *
 * Шапка
 * ------------------------------------------------------------------ */
.hdr {
  background: linear-gradient(180deg, var(--graphite-2), var(--graphite));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px -16px rgba(0, 0, 0, 0.7);
}
.hdr-in { display: flex; align-items: center; gap: 14px; min-height: 64px; min-width: 0; }

.logo { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; min-width: 0; }
.logo:hover { text-decoration: none; }
/* Знак STALLEX: стальной квадрат с буквой S и оранжевой планкой снизу. */
.logo-mark {
  position: relative; width: 42px; height: 42px; border-radius: 9px;
  display: grid; place-items: center; flex: none;
  background: linear-gradient(160deg, #f7f9fc, #c6ccd6);
  box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(0, 0, 0, 0.35);
  color: #171b21; font-family: var(--font-display); font-weight: 900; font-size: 24px;
  line-height: 1; padding-bottom: 4px;
}
.logo-mark::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 6px; height: 4px;
  background: var(--brand); border-radius: 2px;
}
.logo-txt { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; overflow: hidden; }
.logo-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-name i { font-style: normal; color: var(--brand-2); }
.logo-sub { font-size: 9.5px; letter-spacing: 0.16em; color: #97a1b0; text-transform: uppercase; margin-top: 2px; }

.hdr-nav { display: flex; gap: 4px; margin-left: 10px; flex: 1; min-width: 0; }
.hdr-nav a {
  color: #c6cdd8; padding: 8px 11px; border-radius: 9px; font-size: 14px; white-space: nowrap;
}
.hdr-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.hdr-nav a.is-active { background: rgba(255, 255, 255, 0.12); color: #fff; }

.hdr-side { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.hdr-phone { color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap; }
.hdr-phone:hover { text-decoration: none; color: var(--brand-2); }
.hdr-phone span { display: block; font-size: 10.5px; color: #8b93a1; font-weight: 400; letter-spacing: 0.04em; }

.burger { display: none; background: rgba(255,255,255,.1); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }

/* ------------------------------------------------------------------ *
 * Кнопки
 * ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; line-height: 1;
  padding: 11px 16px; background: var(--card); color: var(--ink);
  transition: background .14s ease, border-color .14s ease, color .14s ease,
              transform .14s ease, box-shadow .14s ease;
  text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

/*
 * Главная кнопка повторяет кнопку stallexgroup.ru буква в букву: градиент
 * сверху вниз, тёмная обводка и «подложка» 3px, которая и даёт объём.
 * При наведении подложка растёт, при нажатии кнопка вдавливается.
 */
.btn-primary {
  min-height: 46px;
  border-color: var(--brand-edge);
  background: linear-gradient(180deg, var(--brand-top) 0%, var(--brand) 54%, var(--brand-deep) 100%);
  color: #fff; font-weight: 800; letter-spacing: .005em;
  text-shadow: 0 1px 0 rgba(91, 25, 3, .38);
  box-shadow: 0 3px 0 var(--brand-under),
              0 12px 22px -10px rgba(241, 90, 34, .78),
              inset 0 1px 0 rgba(255, 255, 255, .34);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--brand-under),
              0 16px 28px -11px rgba(241, 90, 34, .85),
              inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--brand-under),
              0 6px 14px -9px rgba(241, 90, 34, .7),
              inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { transform: none; filter: saturate(.6); }

.btn-dark {
  min-height: 46px; background: linear-gradient(180deg, #2b333d, var(--graphite));
  border-color: #0d1116; color: #fff; font-weight: 800;
  box-shadow: 0 3px 0 #0a0d11, 0 12px 22px -12px rgba(23, 27, 33, .8),
              inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-dark:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #0a0d11, 0 16px 28px -12px rgba(23, 27, 33, .85), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn-dark:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a0d11, 0 6px 14px -10px rgba(23, 27, 33, .7); }

.btn-ghost { background: var(--card); border-color: #d7dde4; color: var(--ink); box-shadow: 0 1px 2px rgba(23, 27, 33, .05); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-ink); background: #fff; }
.btn-ghost:active { transform: translateY(1px); }
.btn-soft { background: var(--panel); border-color: var(--line); color: var(--ink2); }
.btn-soft:hover { background: #eceff3; color: var(--ink); border-color: #d7dde4; }
.btn-soft:active { transform: translateY(1px); }

.btn-lg { padding: 16px 26px; font-size: 16px; border-radius: 10px; }
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 0; border-radius: 7px; }
.btn-sm.btn-primary, .btn-sm.btn-dark { min-height: 34px; box-shadow: 0 2px 0 var(--brand-under), 0 8px 16px -9px rgba(241, 90, 34, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-sm.btn-dark { box-shadow: 0 2px 0 #0a0d11, 0 8px 16px -10px rgba(23, 27, 33, .7), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* ------------------------------------------------------------------ *
 * Герой
 * ------------------------------------------------------------------ */
/*
 * Тёмный герой в стиле главной страницы сайта: графит, белый Montserrat,
 * оранжевый угол-акцент и стальные полосы фоном.
 */
.hero {
  position: relative; overflow: hidden; margin: 18px 0 14px; padding: 32px 34px;
  border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #1b2027 0%, #262e38 52%, #1b2027 100%);
  box-shadow: 0 2px 4px rgba(23, 27, 33, .1), 0 22px 48px -22px rgba(23, 27, 33, .55);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 9px);
}
/* Оранжевый уголок — фирменная деталь STALLEX. */
.hero::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 74px; height: 74px;
  background: var(--brand); clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.hero > * { position: relative; }
.hero h1 { margin-bottom: 12px; color: #fff; }
.hero h1 em { font-style: normal; color: var(--brand-2); }
.hero-lead { color: #b6bfcb; max-width: 700px; font-size: 16px; margin-bottom: 0; }
.hero .chip { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .13); color: #c7cfda; }
.hero .chip:hover { border-color: rgba(255, 255, 255, .24); }
.hero .chip b { color: #fff; }
.hero .chip-ok { background: rgba(16, 185, 129, .13); border-color: rgba(16, 185, 129, .3); color: #6ee7b7; }
.hero .chip-ok b { color: #a7f3d0; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px;
  font-family: var(--font-display); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--brand-2);
}
.hero-kicker::before { content: ""; width: 20px; height: 2px; background: var(--brand); border-radius: 1px; }

/* Простой светлый герой для текстовых страниц. */
.hero-plain { background: none; box-shadow: none; padding: 26px 0 8px; border-radius: 0; color: var(--ink); }
.hero-plain::before, .hero-plain::after { display: none; }
.hero-plain h1 { color: var(--ink); }
.hero-plain .hero-lead { color: var(--ink2); }
/* Чипы — те же, что на карточках товара сайта: 11px, radius 7, серая заливка. */
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 7px;
  font-size: 11.5px; line-height: 1.25; font-weight: 600; letter-spacing: .01em;
  color: #4b5563; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.chip:hover { border-color: #d1d5db; }
.chip b { color: #111827; font-weight: 800; }
.chip-ok { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); font-weight: 700; }
.chip-ok b { color: var(--ok-ink); }
.chip-dark { color: #fff; background: var(--graphite); border-color: var(--graphite); }
.chip-dark b { color: #fff; }

/* Пульсирующая точка «в наличии» — прямой перенос со stallexgroup.ru. */
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: #10b981; animation: stxPulse 2s ease infinite; }
@keyframes stxPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .55); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
  .btn, .btn-primary, .btn-dark { transition: none; }
}

/* ------------------------------------------------------------------ *
 * Секции-гармошки
 * ------------------------------------------------------------------ */
.sec {
  background: var(--card); border: 1px solid transparent; border-radius: var(--r-lg);
  margin: 12px 0; box-shadow: var(--shadow); overflow: hidden;
}
/* Заголовок секции — как заголовки фильтров на сайте: Montserrat 800, капслок. */
.sec-head {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 16px 18px;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--ink);
  text-transform: uppercase; letter-spacing: .04em;
  transition: color .14s, background .14s;
}
.sec-head:hover { color: var(--brand); background: #fafbfc; }
.sec-head .arrow { transition: transform .2s; flex: none; color: #9aa1aa; }
.sec[data-open="false"] .sec-head .arrow { transform: rotate(-90deg); }
.sec-head .sec-note {
  margin-left: auto; font-family: var(--font); font-weight: 500; font-size: 12.5px;
  color: var(--ink3); text-transform: none; letter-spacing: 0;
}
.sec-body { padding: 0 18px 18px; }
.sec[data-open="false"] .sec-body { display: none; }
.sec-accent { border-color: rgba(241, 90, 34, .3); box-shadow: var(--shadow), 0 0 0 3px rgba(241, 90, 34, .05); }
.sec-accent .sec-head { color: var(--brand-ink); }

/* ------------------------------------------------------------------ *
 * Поля ввода
 * ------------------------------------------------------------------ */
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], select, textarea {
  font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--ink);
  background: var(--card); border: 1.5px solid #d7dde4; border-radius: 7px;
  padding: 8.5px 11px; width: 100%; min-width: 0;
  transition: border-color .14s, box-shadow .14s;
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #c2cad4; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
input::placeholder, textarea::placeholder { color: #b7bec9; }
input[type="number"], input[inputmode="decimal"], input[inputmode="numeric"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
textarea { resize: vertical; min-height: 96px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238b93a1' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink2); }
.field .hint { font-size: 12px; color: var(--ink3); line-height: 1.4; }

/* Переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 23px; border-radius: 99px; background: #d5dae1; position: relative;
  transition: background .16s; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .16s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-soft); }
.switch .switch-txt { font-size: 14px; }

/* Чекбокс-список */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 7px 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; margin: 0; }

/* ------------------------------------------------------------------ *
 * Таблицы ввода
 * ------------------------------------------------------------------ */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink3);
  text-transform: uppercase; letter-spacing: .05em; padding: 0 6px 7px; white-space: nowrap;
}
table.grid th .req { color: var(--brand); }
table.grid td { padding: 3px 3px; vertical-align: middle; }
table.grid td.n { width: 34px; color: var(--ink3); font-size: 12.5px; text-align: center; font-family: var(--font-mono); }
table.grid td.act { width: 34px; text-align: center; }
table.grid tr.row-blank td.n { color: #ccd2da; }

.cell-del {
  border: 0; background: none; color: #c3cad4; cursor: pointer; padding: 6px; border-radius: 6px; line-height: 0;
}
.cell-del:hover { color: var(--danger); background: var(--danger-soft); }

.col-len { min-width: 108px; width: 15%; }
.col-qty { min-width: 108px; width: 14%; }
.col-name { min-width: 130px; }
.col-prio { min-width: 96px; width: 11%; }
.col-mat { min-width: 120px; width: 15%; }
.col-cost { min-width: 100px; width: 12%; }

.qty-cell { position: relative; display: flex; align-items: center; }
.qty-cell input { padding-right: 34px; }
.inf-btn {
  position: absolute; right: 4px; width: 26px; height: 26px; border-radius: 6px;
  border: 0; background: none; color: #c3cad4; cursor: pointer; font-size: 16px; line-height: 1;
  display: grid; place-items: center;
}
.inf-btn:hover { background: var(--panel); color: var(--ink2); }
.inf-btn.on { background: var(--brand); color: #fff; }
.qty-cell.unlimited input { color: transparent; }
.qty-cell.unlimited::before {
  content: "без ограничения"; position: absolute; left: 11px; font-size: 12.5px; color: var(--ink3);
  pointer-events: none;
}

.tbl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.tbl-sum { margin-left: auto; font-size: 13px; color: var(--ink3); }
.tbl-sum b { color: var(--ink); }

/* ------------------------------------------------------------------ *
 * Настройки
 * ------------------------------------------------------------------ */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 20px; }
.set-block { margin-top: 20px; }
.set-block > h4 {
  font-family: var(--font); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink3); margin: 0 0 11px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft);
}
.set-switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 11px 20px; }

/* ------------------------------------------------------------------ *
 * Подбор из каталога
 * ------------------------------------------------------------------ */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pick-search { position: relative; }
.pick-list {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 320px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.pick-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover, .pick-item.is-active { background: var(--panel); }
.pick-item .t { font-size: 13.5px; font-weight: 600; }
.pick-item .m { font-size: 12px; color: var(--ink3); display: flex; gap: 9px; margin-top: 2px; flex-wrap: wrap; }
.pick-item .m b { color: var(--brand-ink); font-weight: 600; }

.picked {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border-radius: var(--r);
  background: linear-gradient(180deg, #fff, var(--panel)); border: 1px solid var(--line);
}
.picked-main { flex: 1; min-width: 0; }
.picked-title { font-weight: 700; font-size: 14.5px; }
.picked-meta { font-size: 12.5px; color: var(--ink2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.picked-price { text-align: right; flex: none; }
.picked-price b { font-family: var(--font-display); font-size: 19px; color: var(--brand-ink); display: block; }
.picked-price span { font-size: 11.5px; color: var(--ink3); }

/* ------------------------------------------------------------------ *
 * Кнопка расчёта
 * ------------------------------------------------------------------ */
.run-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 18px 0 8px; }
.run-btn {
  flex: 1; min-width: 260px; padding: 19px 26px; font-size: 17px; letter-spacing: .01em;
  font-family: var(--font-display);
}
.run-note { font-size: 12.5px; color: var(--ink3); }

/* ------------------------------------------------------------------ *
 * Результат
 * ------------------------------------------------------------------ */
.res { margin-top: 22px; }
.res-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.res-head h2 { margin-right: auto; }

/*
 * Устаревший результат. Данные поменяли, но человек ещё может захотеть
 * посмотреть, что было, — поэтому не прячем, а гасим и явно подписываем,
 * чтобы старые цифры нельзя было принять за актуальные.
 */
.stale-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; margin-bottom: 16px; border-radius: var(--r);
  background: var(--warn-soft); border: 1px solid #f5dcb8; color: #7c3d06;
  font-size: 13.5px; position: sticky; top: 72px; z-index: 20;
  box-shadow: 0 6px 18px -12px rgba(23, 27, 33, .4);
}
.stale-bar span { flex: 1; min-width: 220px; }
.res.is-stale .kpis,
.res.is-stale #resPanels,
.res.is-stale #resTotals,
.res.is-stale #resNotices,
.res.is-stale .res-head { opacity: .45; filter: grayscale(.7); }
.res.is-stale .res-actions { pointer-events: none; }

/* Ячейка, из-за которой расчёт не пошёл. */
input.is-invalid, input.is-invalid:hover {
  border-color: var(--danger); background: var(--danger-soft);
}
input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(204, 24, 24, .12); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid transparent; border-radius: var(--r-lg);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: #dfe4ea;
}
.kpi .k { font-family: var(--font-display); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink3); font-weight: 800; }
.kpi .v { font-family: var(--font-display); font-size: 24px; font-weight: 800; margin-top: 6px; line-height: 1.05; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11.5px; color: var(--ink3); margin-top: 4px; font-weight: 500; }
/* Значок «?» у карточек, где есть пояснение по наведению. */
.kpi-q {
  display: inline-grid; place-items: center; width: 13px; height: 13px; margin-left: 5px;
  border-radius: 50%; background: #dfe4ea; color: #fff; font-size: 9px; font-weight: 800;
  vertical-align: 1px; cursor: help;
}
.kpi[title] { cursor: help; }
.kpi-brand::before { background: linear-gradient(180deg, var(--brand-top), var(--brand-deep)); }
.kpi-brand .v { color: var(--brand-ink); }
.kpi-ok::before { background: #10b981; }
.kpi-ok .v { color: var(--ok-ink); }
.kpi-warn::before { background: #f59e0b; }
.kpi-warn .v { color: var(--warn); }

/* Вкладки-таблетки — в том же ключе, что переключатели категорий на сайте. */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  border: 1px solid var(--line); background: var(--card); padding: 9px 14px; cursor: pointer;
  font-size: 13px; font-weight: 700; font-family: var(--font-display);
  color: var(--ink2); border-radius: 8px; white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.tab:hover { color: var(--ink); border-color: #d7dde4; }
.tab.is-active { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Схема раскроя */
.pattern {
  background: var(--card); border: 1px solid transparent; border-radius: var(--r-lg);
  padding: 14px 16px; margin-bottom: 11px; box-shadow: var(--shadow);
  break-inside: avoid; page-break-inside: avoid;
}
.pattern-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.pattern-no { font-family: var(--font-display); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.pattern-mult {
  background: var(--graphite); color: #fff; border-radius: 7px; padding: 4px 9px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; letter-spacing: -.01em;
}
.pattern-stat { color: var(--ink3); margin-left: auto; font-family: var(--font-mono); font-size: 12px; }

.bar { display: flex; height: 42px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); background: repeating-linear-gradient(45deg, #f2f4f7, #f2f4f7 5px, #e9edf2 5px, #e9edf2 10px); }
.bar-piece {
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; min-width: 0;
  background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-right: 2px solid #fff;
  overflow: hidden; position: relative;
}
.bar-piece span { padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.bar-piece:nth-child(even) { background: linear-gradient(180deg, #ff8b5c, var(--brand-ink)); }
.bar-trim { background: repeating-linear-gradient(45deg, #cfd6de, #cfd6de 4px, #bcc4ce 4px, #bcc4ce 8px); border-right: 2px solid #fff; }
.bar-rest { display: grid; place-items: center; font-size: 11.5px; color: var(--ink2); min-width: 0; }
.bar-rest span { padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.bar-rest.is-useful { background: var(--ok-soft); color: #12703a; }
.bar-ruler { display: flex; margin-top: 4px; font-size: 10.5px; color: var(--ink3); font-family: var(--font-mono); }
.bar-ruler span { text-align: right; padding-right: 2px; min-width: 0; overflow: hidden; }

.pattern-parts { margin-top: 9px; font-size: 12.5px; color: var(--ink2); font-family: var(--font-mono); }
.pattern-names { margin-top: 5px; font-size: 12px; color: var(--ink3); }

/* Таблицы результата */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
table.data th {
  background: var(--panel); text-align: left; padding: 9px 12px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); border-bottom: 1px solid var(--line);
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; background: var(--panel); border-top: 1px solid var(--line); }

/* Этикетки */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 9px; }
.label {
  border: 1px dashed var(--ink3); border-radius: var(--r-sm); padding: 10px 12px; background: var(--card);
  break-inside: avoid;
}
.label .l-len { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.label .l-name { font-size: 13px; color: var(--ink2); margin-top: 2px; }
.label .l-meta { font-size: 11px; color: var(--ink3); margin-top: 5px; font-family: var(--font-mono); }

/* Коммерция */
.quote-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.quote-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 17px 19px; box-shadow: var(--shadow-sm); }
.quote-card h3 { margin-bottom: 12px; }
.money-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.money-row:last-of-type { border-bottom: 0; }
.money-row .m-v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-total { margin-top: 10px; padding-top: 12px; border-top: 2px solid var(--ink); font-size: 16px; font-weight: 700; }
.money-total .m-v { font-family: var(--font-display); font-size: 22px; color: var(--brand-ink); }
.money-sub { font-size: 13px; color: var(--ink2); }
.money-sub .m-v { color: var(--ink2); }

.notice { border-radius: 10px; padding: 11px 14px; font-size: 13px; line-height: 1.55; margin: 10px 0; }
.notice-warn { background: var(--warn-soft); color: #7c3d06; border: 1px solid #f5dcb8; }
.notice-info { background: var(--blue-soft); color: var(--blue-ink); border: 1px solid var(--blue-line); }
.notice-danger { background: var(--danger-soft); color: #b91c1c; border: 1px solid var(--danger-line); }
.notice-ok { background: var(--ok-soft); color: var(--ok-ink); border: 1px solid var(--ok-line); }
.notice b { font-weight: 800; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 3px; }

/* ------------------------------------------------------------------ *
 * Итоговая сводка
 * ------------------------------------------------------------------ */
.totals { margin-top: 26px; padding-top: 22px; border-top: 2px solid var(--ink); }
.totals-title {
  display: flex; align-items: center; gap: 9px; margin-bottom: 14px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  text-transform: uppercase; letter-spacing: .05em;
}
.totals-title::before { content: ""; width: 22px; height: 3px; background: var(--brand); border-radius: 2px; }
.totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(288px, 1fr)); gap: 14px; align-items: start; }
.totals-h {
  font-family: var(--font-display); font-weight: 800; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink3);
  margin: 0 0 11px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.totals .quote-card table.data { box-shadow: none; border: 1px solid var(--line); margin-bottom: 4px; }
.totals .money-row { font-size: 13.5px; }

/* Полоса с деньгами — как итоговая строка в счёте. */
.totals-money {
  display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 14px; overflow: hidden;
  border-radius: var(--r-lg); background: linear-gradient(135deg, #1b2027, #262e38);
}
.tm-item {
  flex: 1 1 170px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.tm-item:last-child { border-right: 0; }
.tm-item span { font-size: 11.5px; color: #98a2b0; font-weight: 600; }
.tm-item b { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.tm-total { background: rgba(241, 90, 34, .14); }
.tm-total b { color: var(--brand-2); font-size: 22px; }
.totals-note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink3); line-height: 1.5; }

/* ------------------------------------------------------------------ *
 * FAQ
 * ------------------------------------------------------------------ */
.faq { margin: 34px 0; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 9px; overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; border: 0; background: none; padding: 15px 18px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink);
  display: flex; gap: 12px; align-items: center;
}
.faq-q:hover { background: var(--panel); }
.faq-q .arrow { margin-left: auto; color: var(--ink3); transition: transform .18s; flex: none; }
.faq-item[data-open="true"] .faq-q .arrow { transform: rotate(180deg); }
.faq-a { padding: 0 18px 17px; color: var(--ink2); font-size: 14px; }
.faq-item[data-open="false"] .faq-a { display: none; }
.faq-a ul { padding-left: 20px; }
.faq-a li { margin-bottom: 4px; }
.faq-a code, code {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
  font-family: var(--font-mono); font-size: 12.5px;
}
pre {
  background: var(--graphite); color: #e6eaef; border-radius: var(--r); padding: 14px 16px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* ------------------------------------------------------------------ *
 * Модальные окна
 * ------------------------------------------------------------------ */
.modal-back {
  position: fixed; inset: 0; background: rgba(21, 24, 31, .55); z-index: 90;
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px);
}
.modal {
  background: var(--card); border-radius: var(--r-xl); width: min(560px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
.modal-wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 19px 22px 0; }
.modal-head h3 { margin-right: auto; font-size: 19px; }
.modal-body { padding: 16px 22px 22px; }
.modal-close { border: 0; background: var(--panel); border-radius: 9px; width: 32px; height: 32px; cursor: pointer; color: var(--ink2); font-size: 18px; line-height: 1; flex: none; }
.modal-close:hover { background: var(--line); color: var(--ink); }

/* Тосты */
.toasts {
  position: fixed; right: 16px; bottom: 16px; left: 16px; z-index: 120;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--graphite); color: #fff; border-radius: var(--r); padding: 12px 16px;
  font-size: 14px; box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .6); max-width: min(340px, 100%);
  animation: toast-in .18s ease-out; pointer-events: auto;
}
.toast-ok { background: #12703a; }
.toast-err { background: #a3120f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ *
 * История
 * ------------------------------------------------------------------ */
.hist-list { display: flex; flex-direction: column; gap: 7px; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.hist-main { flex: 1; min-width: 0; }
.hist-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.hist-empty { color: var(--ink3); font-size: 14px; padding: 8px 0; }

/* ------------------------------------------------------------------ *
 * Подвал
 * ------------------------------------------------------------------ */
.ftr { background: var(--graphite); color: #a8b1bd; margin-top: 46px; padding: 34px 0 26px; font-size: 13.5px; }
.ftr a { color: #cbd3de; }
.ftr a:hover { color: #fff; }
.ftr-cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 26px; }
.ftr h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font); margin-bottom: 11px; }
.ftr ul { list-style: none; margin: 0; padding: 0; }
.ftr li { margin-bottom: 7px; }
.ftr-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 26px; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: #7c8593; }
.ftr-bottom .sp { margin-left: auto; }

/* ------------------------------------------------------------------ *
 * Адаптив
 * ------------------------------------------------------------------ */
@media (max-width: 980px) {
  .quote-grid { grid-template-columns: 1fr; }
  .pick { grid-template-columns: 1fr; }
  .ftr-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .hdr-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--graphite); padding: 8px; gap: 2px; box-shadow: 0 20px 30px -18px rgba(0,0,0,.8);
  }
  .hdr-nav.is-open { display: flex; }
  .burger { display: grid; place-items: center; }
  .hdr-phone span { display: none; }
  .hdr-in { gap: 9px; }
  .logo-sub { display: none; }
  .logo-name { font-size: 15px; }
  .hdr-phone { font-size: 14px; }
  .hero { padding: 20px 0 4px; }
  .sec-body { padding: 0 12px 14px; }
  .sec-head { padding: 13px 12px; }
  .tbl-wrap { margin: 0 -12px; padding: 0 12px; }
  .kpi .v { font-size: 20px; }
  .ftr-cols { grid-template-columns: 1fr; }
  .run-row { flex-direction: column; align-items: stretch; }
  .modal { border-radius: var(--r-lg); }
}
@media (max-width: 560px) {
  /* На узком экране в шапке важнее телефон, чем название — логотипа хватает. */
  .logo-txt { display: none; }
  .hdr-in { gap: 8px; }
  .set-grid, .set-switches { grid-template-columns: 1fr; }
  .labels { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .res-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .res-head h2 { width: 100%; }
}
