/* Стиль в духе bmtltd.ru: шрифт Golos, лёгкие заголовки (400),
   бирюзовый акцент #29BAE2, градиентные кнопки r16, много воздуха. */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --card: #ffffff;
  --ink: #363636;
  --muted: #8a8f96;
  --line: #e6e8ea;
  --line-strong: #d6d9dc;
  --accent: #29bae2;
  --accent-dark: #1b93b5;
  --grad: linear-gradient(97.76deg, #93d5dd 0%, #97c76a 100%);
  --grad-strong: linear-gradient(97.76deg, #5dc4e4 0%, #74ad40 100%);
  --ok: #4b9e3f;
  --ok-bg: #eef6ea;
  --warn: #b5820b;
  --warn-bg: #fbf3df;
  --err: #c0392b;
  --err-bg: #fbe7e4;
  --radius: 16px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Golos Text", "Golos", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { font-weight: 500; line-height: 1.25; color: var(--ink); margin: 0 0 .6em; }
h1 { font-size: 27px; }
h2 { font-size: 20px; }

/* ---- Шапка сайта ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-header .inner {
  max-width: 1040px; margin: 0 auto; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.site-header .logo { display: flex; align-items: center; gap: 12px; }
.site-header .logo img { height: 46px; width: auto; display: block; }
.site-header .logo .tagline {
  font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line-strong);
  padding-left: 12px; max-width: 220px; line-height: 1.35;
}
.site-header nav { font-size: 14px; display: flex; gap: 18px; align-items: center; }
@media (max-width: 620px) {
  .site-header .logo .tagline { display: none; }
  .site-header .inner { padding: 12px 14px; }
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 18px 72px; }
.wrap.narrow { max-width: 440px; }

/* ---- Формы входа / регистрации ---- */
.wrap.narrow .card > h1 { margin-bottom: 20px; }
.wrap.narrow .card > label { display: block; margin-bottom: 16px; }
.wrap.narrow .card > button { display: block; margin-top: 4px; }
.wrap.narrow .card > .error { margin-bottom: 16px; }
.wrap.narrow .card > .hint { margin-top: 16px; }
.wrap.narrow .card > label > .hint { margin: 0 0 0 6px; }

.hero { padding: 12px 2px 22px; }
.hero h1 { font-size: 30px; margin-bottom: 10px; font-weight: 600; }
.lead { color: var(--muted); margin: 0; max-width: 62ch; font-size: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 22px;
}
.card.center { text-align: center; }
.card h2 { margin-top: 28px; color: var(--ink); }
.card h2:first-of-type { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid, .grid-3 { grid-template-columns: 1fr; } }

.extra-field { display: block; width: 100%; }

/* Равномерный вертикальный ритм блоков формы посетителя */
#reg-form > .grid,
#reg-form > .extra-field { margin: 0 0 18px; }

label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 6px; }
label.chk, label.consent {
  display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 14px;
}
label.chk > input, label.consent > input {
  flex: none; width: 18px; height: 18px; margin: 2px 0 0; padding: 0;
}

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input:not([type]), select, textarea {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;  /* не меньше 16px — иначе iOS Safari зумит при фокусе */
  color: var(--ink);
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 186, 226, .18);
}
.req { color: var(--err); }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.catalog { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.cat-row {
  display: block;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: #fff;
  transition: border-color .12s, background .12s;
}
.cat-row::after { content: ""; display: table; clear: both; }
.cat-row:hover { border-color: var(--accent); background: #fbfefe; }
.cat-info { min-width: 0; }
.cat-name { font-weight: 500; color: var(--ink); }
.cat-mfr { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.cat-details { margin-top: 8px; }
.cat-details > summary {
  cursor: pointer; color: var(--accent-dark); font-size: 12.5px;
  list-style: none; display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
.cat-details > summary::-webkit-details-marker { display: none; }
.cat-details > summary::before { content: "▸"; font-size: 10px; transition: transform .12s; }
.cat-details[open] > summary::before { transform: rotate(90deg); }
.cat-details > summary:hover { color: var(--accent); }
.cat-desc {
  color: var(--muted); font-size: 12.5px; white-space: pre-line;
  margin-top: 8px; padding-left: 2px;
}
.qty {
  float: right; margin: 0 0 10px 16px;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.qty > input { width: 78px; margin-top: 0; }

/* Степпер количества (крупные кнопки для тача) */
.qty-stepper { display: inline-flex; align-items: stretch; border-radius: var(--radius-sm); }
.qty-stepper:focus-within { box-shadow: 0 0 0 3px rgba(41, 186, 226, .18); }
.qty-stepper > input {
  width: 48px; text-align: center; margin: 0;
  border-radius: 0; border-left: 0; border-right: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.qty-stepper > input:focus { box-shadow: none; border-color: var(--line-strong); }
.qty-stepper > input::-webkit-outer-spin-button,
.qty-stepper > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-btn {
  flex: none; width: 40px; min-height: 40px; padding: 0;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s, background .12s, color .12s;
}
.qty-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.qty-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.qty-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.qty-btn:active { background: var(--bg-soft); }

.consent { margin: 22px 0; }

/* ---- Свой автокомплит (замена нативного datalist на мобильных) ---- */
.ac-wrap { position: relative; display: block; }
.ac-wrap > input { width: 100%; display: block; margin: 0; }
label > .ac-wrap { margin-top: 6px; }
.ac-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
  max-height: 264px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.ac-item {
  padding: 11px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; line-height: 1.3;
}
.ac-item:hover, .ac-item.is-active { background: #e6f7fc; color: var(--accent-dark); }

/* ---- Поле «Запрос»: несколько строк с подсказками ---- */
.extra-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.extra-row { display: flex; align-items: center; gap: 8px; }
.extra-row-input { flex: 1; margin-top: 0 !important; }
.extra-row > .ac-wrap { flex: 1; min-width: 0; margin-top: 0; }
.extra-row-btn {
  flex: none; border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.extra-row-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.extra-row-add { color: var(--accent-dark); font-weight: 600; }

/* ---- Кнопки ---- */
.btn-primary, .btn-secondary, .btn-send, .btn-small {
  display: inline-block; border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 500; cursor: pointer; line-height: 1.2;
  transition: filter .12s, background .12s, transform .04s;
}
.btn-primary, .btn-send { color: #fff; background-image: var(--grad); padding: 12px 22px; }
.btn-primary:hover, .btn-send:hover { filter: brightness(.95); color: #fff; }
.btn-primary:active, .btn-send:active { transform: translateY(1px); }
.btn-send { font-size: 16px; padding: 13px 26px; background-image: var(--grad-strong); }
.btn-send[disabled] { filter: grayscale(.7) brightness(1.1); cursor: not-allowed; }
.btn-secondary {
  background: #fff; color: var(--accent-dark); padding: 11px 20px;
  border: 1px solid var(--accent); border-radius: var(--radius);
}
.btn-secondary:hover { background: #f2fbfd; color: var(--accent-dark); }
.btn-small {
  background: var(--bg-soft); color: var(--ink); padding: 7px 14px;
  font-size: 13px; border-radius: 999px;
}
.btn-small:hover { background: #e9eaec; color: var(--ink); }
.btn-compact { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }

.check {
  font-size: 40px; color: #fff; background-image: var(--grad-strong);
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 4px auto 16px;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 2px 20px; font-size: 14px; color: var(--muted);
}
.topbar nav a { margin-left: 16px; }

.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid-table th, .grid-table td {
  border-bottom: 1px solid var(--line); padding: 10px 11px; text-align: left; vertical-align: top;
}
.grid-table th {
  color: var(--muted); font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px;
}
.grid-table tbody tr:hover { background: #fafcfd; }
.grid-table td.num, .grid-table th.num, .num { text-align: right; white-space: nowrap; }
.grid-table td.center, .center { text-align: center; }
.muted { color: var(--muted); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-new { background: #e6f7fc; color: var(--accent-dark); }
.badge-in_progress, .badge-draft { background: var(--warn-bg); color: var(--warn); }
.badge-sent { background: var(--ok-bg); color: var(--ok); }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.client-box {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px;
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 14px 0 22px; font-size: 13.5px;
}
@media (max-width: 640px) { .client-box { grid-template-columns: 1fr; } }
.client-box .k {
  display: block; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 1px;
}
.client-box .wide { grid-column: 1 / -1; }
.pre { white-space: pre-line; }

table.pos .in-qty { width: 68px; }
table.pos .in-coeff { width: 76px; }
table.pos td.num input { text-align: right; }
.strong { font-weight: 600; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.send-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.locked input, .locked button, .locked select { opacity: .55; pointer-events: none; }

.notice { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err, .error { background: var(--err-bg); color: var(--err); }
.error { padding: 10px 13px; border-radius: var(--radius-sm); margin: 0 0 14px; font-size: 13.5px; }

.inline-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

.footnote {
  max-width: 1040px; margin: 0 auto; padding: 0 18px 40px;
  color: var(--muted); font-size: 12px;
}

/* ---- Подвал ---- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--bg); }
.site-footer .inner {
  max-width: 1040px; margin: 0 auto; padding: 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted);
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---- Юридический текст: Политика, Согласие ---- */
.legal { max-width: 780px; }
.legal h1 { font-size: 24px; font-weight: 600; }
.legal h2 { font-size: 17px; margin-top: 26px; }
.legal p, .legal li { font-size: 14px; color: var(--ink); }
.legal ul, .legal ol { padding-left: 22px; }
.legal li { margin: 5px 0; }
.legal .doc-meta { color: var(--muted); font-size: 12.5px; margin: -4px 0 22px; }
