/* Carsel — общий стиль. Цвета меняются в одном месте: :root */
:root {
  --bg: #F3F2EE;
  --surface: #FFFFFF;
  --ink: #1D2125;
  --muted: #5E6369;
  --line: #DDDAD2;
  --line-soft: #ECEAE4;
  --field: #C9C5BB;
  --accent: #1E5B74;
  --accent-dark: #123E50;
  --accent-soft: #E6EFF2;
  --ok: #1E6B45;
  --ok-soft: #E3F1E8;
  --warn: #7A4F00;
  --warn-soft: #FBF0D9;
  --danger: #8A2B2B;
  --danger-soft: #F7E4E1;
  --header: #1D2125;
  --radius: 12px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--bg);
  background-image: url("../img/pattern.svg");
  background-size: 280px 280px;
  min-height: 100vh;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { font-size: 26px; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Шапка ---------- */
.topbar {
  background: var(--header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }
.brand small { font-weight: 400; font-size: 11px; color: #AEB3B8; }
.brand:hover { color: #fff; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: #D5D7DA; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-size: 14px; }
.nav a:hover { background: #2E3439; color: #fff; }
.nav a.active { background: #3A4047; color: #fff; }
.nav .badge { background: #C0392B; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar-right a, .topbar-right button.link { color: #fff; }
.org-chip { color: #D5D7DA; }
.lang-form { display: flex; }
.lang-form button {
  background: none; border: 1px solid #5A6066; color: #D5D7DA; font: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 8px; cursor: pointer;
}
.lang-form button:first-child { border-radius: 5px 0 0 5px; }
.lang-form button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
.lang-form button.on { background: #fff; color: var(--ink); border-color: #fff; }
button.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.menu-toggle { display: none; }

/* ---------- Раскладка ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 8px; }

/* ---------- Формы ---------- */
label, .label { display: block; font-size: 13px; font-weight: 500; color: #4A4E53; margin-bottom: 6px; }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* 16px — чтобы iPhone не увеличивал страницу при вводе */
  padding: 10px 12px;
  border: 1px solid var(--field);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
select[multiple] { padding: 6px; min-height: 44px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err, .errorlist { color: var(--danger); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.radio-row { display: flex; gap: 0; border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; }
.radio-row label { flex: 1; margin: 0; text-align: center; padding: 11px; font-size: 15px; font-weight: 600; color: var(--accent); cursor: pointer; }
.radio-row input { position: absolute; opacity: 0; }
.radio-row label:has(input:checked) { background: var(--accent); color: #fff; }
.checkbox { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--ink); }
.checkbox input { width: 18px; height: 18px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 15px; font-weight: 600;
  min-height: 44px; padding: 10px 18px;
  border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-plain { background: #fff; color: var(--ink); border-color: var(--field); }
.btn-plain:hover { background: #F6F5F1; color: var(--ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #154F33; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--field); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-dashed { background: #fff; color: var(--accent); border-style: dashed; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- Таблицы ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table td { font-size: 14px; padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .sub { display: block; color: var(--muted); font-size: 13px; }
.table tfoot td { font-weight: 700; }

/* ---------- Метки ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.tag-new, .tag-pending { background: var(--warn-soft); color: var(--warn); }
.tag-paid, .tag-active { background: var(--ok-soft); color: var(--ok); }
.tag-cancelled, .tag-rejected { background: var(--line-soft); color: #4A4E53; }
.chip { display: inline-block; font-size: 13px; padding: 3px 8px; background: var(--accent-soft); border-radius: 4px; margin: 2px 4px 2px 0; }

/* ---------- Сообщения ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.msg-success { background: var(--ok-soft); color: #154F33; }
.msg-error, .msg-danger { background: var(--danger-soft); color: var(--danger); }
.msg-warning, .msg-info { background: var(--warn-soft); color: #5A3B00; }
.note { background: var(--warn-soft); color: #5A3B00; border-radius: 10px; padding: 14px 16px; font-size: 13px; }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 12px 16px; font-size: 15px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* ---------- Фильтры ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.filters select, .filters input[type=date] { width: auto; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills a { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--field); background: #fff; font-size: 14px; text-decoration: none; color: var(--ink); }
.pills a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; align-items: center; font-size: 14px; }

/* ---------- Экран входа ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; justify-content: flex-end; padding: 16px 24px; }
.auth-top .lang-form button { border-color: var(--ink); color: var(--ink); background: #fff; font-size: 14px; padding: 8px 12px; }
.auth-top .lang-form button.on { background: var(--ink); color: #fff; }
.auth-box { width: 100%; max-width: 440px; margin: 20px auto 60px; padding: 0 16px; }
.auth-box.wide { max-width: 540px; }
.auth-logo { font-size: 22px; font-weight: 700; color: var(--accent); }
.auth-logo small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---------- Карточки организаций ---------- */
.org-card { display: flex; flex-direction: column; gap: 14px; }
.org-head { display: flex; gap: 14px; align-items: center; }
.org-logo { width: 48px; height: 48px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.org-logo img { width: 100%; height: 100%; object-fit: cover; }
.stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) minmax(0, 1fr); gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
@media (max-width: 720px) { .stat b { font-size: 18px; } }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi b { font-size: 24px; }

/* ---------- Заказ ---------- */
.line-row td { vertical-align: top; }
.line-next { padding-top: 20px !important; font-weight: 600; white-space: nowrap; }
.remove-line { border: 0; background: none; font-size: 22px; color: var(--danger); cursor: pointer; width: 40px; height: 40px; }
.total { font-size: 20px; font-weight: 700; }
.history-item { padding-top: 10px; border-top: 1px solid var(--line-soft); margin-top: 10px; }
.new-car { background: #F6F5F1; border-radius: 10px; padding: 14px; margin-top: 10px; }
.found { color: var(--ok); font-size: 13px; font-weight: 500; margin-top: 4px; }
.car-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.car-pill { flex: 1; min-width: 140px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); }
.car-pill.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.car-pill small { display: block; color: #4A4E53; }
.next-box { background: var(--accent); color: #fff; border-radius: var(--radius); padding: 16px 20px; }
.next-box h2 { color: #fff; font-size: 16px; }
.next-box .row-line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 15px; }

/* ---------- Смартфон ---------- */
@media (max-width: 900px) {
  .with-aside { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .page { padding: 16px; }
  h1 { font-size: 22px; }
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .menu-toggle { display: inline-flex; margin-left: auto; background: none; border: 0; color: #fff; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; }
  .nav, .topbar-right { display: none; width: 100%; }
  .topbar.open .nav { display: flex; flex-direction: column; }
  .topbar.open .topbar-right { display: flex; flex-wrap: wrap; padding: 8px 0 12px; }
  .nav a { padding: 12px; font-size: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .actions .btn { flex: 1; }
  .filters select, .filters input[type=date] { flex: 1; }

  /* Таблицы превращаются в карточки */
  .table-wrap.cards { background: none; border: 0; padding: 0; }
  .cards table.table, .cards .table tbody, .cards .table tr, .cards .table td { display: block; width: 100%; }
  .cards .table thead { display: none; }
  .cards .table tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
  .cards .table td { border: 0; padding: 4px 0; text-align: left !important; }
  .cards .table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  .cards .table tfoot { display: block; }

  /* Строки работ в заказе — блоками */
  .lines table, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines thead { display: none; }
  .lines tr.line-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; position: relative; }
  .lines td { border: 0 !important; padding: 4px 0 !important; }
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .lines .remove-cell { position: absolute; top: 4px; right: 4px; width: auto; }
  .line-next { padding-top: 4px !important; }
}

/* ---------- Печать ---------- */
@media print {
  .topbar, .actions, .no-print { display: none !important; }
  body { background: #fff; }
}

/* Поле «Марка и модель» с подсказками */
.car-search { position: relative; }
.car-options {
  position: absolute; left: 0; right: 0; z-index: 20; margin: 4px 0 0; padding: 4px 0; list-style: none;
  max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.car-options li { padding: 11px 14px; cursor: pointer; font-size: 15px; }
.car-options li:hover, .car-options li.active { background: var(--accent-soft); color: var(--accent-dark); }
.mileage-field { margin-top: 14px; }
.mileage-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 12px; margin-top: 14px; }
.mileage-row .field { margin-bottom: 0; }
.mileage-row .warn-text { grid-column: 1 / -1; }
.due-overdue { color: #8A2B2B !important; font-weight: 600; }
.due-soon { color: #7A4F00 !important; }

[hidden] { display: none !important; }  /* скрытые элементы не показываем, даже если у них свой display */

/* Обязательные поля */
label.req::after { content: " *"; color: #B42318; font-weight: 700; }
form.was-validated input:invalid { border-color: #B42318; background: #FFF6F5; }
.warn-text { color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; margin-top: 6px; font-size: 13px; }

/* Блоки работ: номер и спокойные пастельные цвета, чтобы блоки отделялись друг от друга */
.lines tr.line-row { --line-bg: #EEF4F8; --line-accent: #7FA7C0; }
.lines tr.line-row:nth-child(5n+2) { --line-bg: #F7F1E6; --line-accent: #C9A96A; }
.lines tr.line-row:nth-child(5n+3) { --line-bg: #EDF5EF; --line-accent: #7FB08E; }
.lines tr.line-row:nth-child(5n+4) { --line-bg: #F2EFF7; --line-accent: #A393C4; }
.lines tr.line-row:nth-child(5n+5) { --line-bg: #F8EEEE; --line-accent: #C99A9A; }
.lines tr.line-row > td { background: var(--line-bg); }
.lines tr.line-row > td:first-child { box-shadow: inset 4px 0 0 var(--line-accent); }
.line-num { white-space: nowrap; padding-top: 18px !important; color: var(--accent-dark); }
.line-num-label { display: none; }
.line-num .line-no { font-size: 16px; }

/* «Следующая замена» — внизу блока, выделена цветом блока, чтобы не путать с суммами */
.line-next-cell input { border: 2px solid var(--line-accent, var(--accent)); background: #fff; font-weight: 700; font-size: 17px; color: var(--accent-dark); }
.prod-hint:empty { display: none; }

@media (max-width: 720px) {
  .lines tr.line-row { background: var(--line-bg); border: 0; border-left: 5px solid var(--line-accent); padding: 12px; }
  .lines tr.line-row > td { background: transparent; }
  .lines tr.line-row > td:first-child { box-shadow: none; }
  .line-num { padding: 0 0 6px !important; font-size: 15px; }
  .line-num-label { display: inline; font-weight: 700; }
  .lines td.line-next-cell { margin-top: 8px; padding-top: 10px !important; border-top: 1px dashed rgba(0,0,0,.18) !important; }
  .lines td.line-next-cell::before { color: var(--accent-dark); font-weight: 700; font-size: 13px; }
}

/* «Мои товары»: массовое добавление и цены */
.bulk-filters { padding: 12px; margin-bottom: 10px; position: sticky; top: 60px; z-index: 5; }
.type-chips { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chip-btn { flex-shrink: 0; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bulk-list, .price-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 76px; }
.bulk-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; margin: 0; font-size: 15px; }
.bulk-item input { width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.bulk-item:has(input:checked:not(:disabled)) { background: var(--accent-soft); }
.bulk-item.is-have { opacity: .55; cursor: default; }
.bulk-name { flex: 1; min-width: 0; }
.bulk-type { display: block; font-size: 12px; color: var(--muted); }
.bulk-price { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bulk-have { color: var(--ok); font-size: 12px; white-space: nowrap; }
.bulk-submit { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.price-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.price-row.is-off { opacity: .55; }
.price-name { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 500; color: var(--ink); }
.price-input { display: flex; align-items: center; gap: 6px; width: 140px; flex-shrink: 0; }
.price-input input { text-align: right; font-weight: 600; }
.price-input input:placeholder-shown { background: var(--warn-soft); }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
@media (max-width: 720px) {
  .price-input { width: 118px; }
}
.nowrap { white-space: nowrap; }
.plist { margin-bottom: 16px; }
.plist .row-check { width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.plist a.price-name { text-decoration: none; }
.plist-price { white-space: nowrap; font-weight: 600; font-size: 14px; }

/* Автомобиль клиента: список с отметкой ✓, выбор одного */
.car-choice { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.car-opt { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--field); border-radius: 10px; background: #fff; cursor: pointer; margin: 0; font-weight: 500; }
.car-opt input { position: absolute; opacity: 0; pointer-events: none; }
.car-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--field); flex-shrink: 0; display: grid; place-items: center; font-size: 13px; color: #fff; }
.car-opt:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); padding: 10px 13px; }
.car-opt:has(input:checked) .car-tick { background: var(--accent); border-color: var(--accent); }
.car-opt:has(input:checked) .car-tick::after { content: "✓"; font-weight: 700; }
.car-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.car-text small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
#new-car-btn.on { background: var(--accent-soft); border-width: 2px; }
.car-opt { font-size: 16px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.car-text small { font-size: 13px; }

/* Бонусы в заказе */
.bonus-box { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #FBF6EA; border: 1px solid #EBDDBB; display: flex; flex-direction: column; gap: 8px; }
.bonus-box .bonus-head { font-size: 15px; }
.bonus-box input { max-width: 180px; font-weight: 600; }
.bonus-sum { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.bonus-tag { color: #8A5A00; font-weight: 600; white-space: nowrap; }
.bonus-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.bonus-card { flex: 1; min-width: 150px; background: #FBF6EA; border: 1px solid #EBDDBB; border-radius: 10px; padding: 10px 14px; }
.bonus-card b { font-size: 20px; display: block; }
.bonus-card small { color: var(--muted); }


/* Выбор товаров в заказе (Android, компьютер): кнопка-поле + окно с галочками */
.line-products.enhanced { display: none !important; }
.prod-btn { -webkit-tap-highlight-color: transparent; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; min-height: 46px; padding: 8px 36px 8px 10px;
  font: inherit; font-size: 15px; text-align: left; color: var(--ink); cursor: pointer; border: 1px solid var(--field); border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235E6369' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center; }
.prod-btn:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.prod-placeholder { color: var(--muted); }
.prod-chip { display: inline-block; max-width: 100%; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 14px; line-height: 1.35; }
body.sheet-open { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 24, 28, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none !important; }
.sheet-panel { background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  border-radius: 16px 16px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.18); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-panel { border-radius: 16px; max-height: 80vh; } }
@media (max-width: 699px) { .sheet-panel { height: 88vh; height: 88dvh; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; font-size: 17px; }
.sheet-close { border: 0; background: none; font-size: 28px; line-height: 1; width: 44px; height: 44px; margin: -8px -10px -8px 0; color: var(--muted); cursor: pointer; }
.sheet-search { margin: 0 16px 8px; width: auto !important; }
.sheet-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 8px; flex: 1; }
.sheet-group { position: sticky; top: 0; background: var(--surface); padding: 10px 8px 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; z-index: 1; }
.sheet-item { -webkit-tap-highlight-color: transparent; user-select: none; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 11px 8px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.sheet-item[hidden] { display: none; }
.sheet-item input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); grid-row: span 2; }
.sheet-name { font-size: 15px; line-height: 1.35; word-break: break-word; }
.sheet-price { grid-column: 2; font-size: 13px; color: var(--muted); }
.sheet-item:has(input:checked) { background: var(--accent-soft); border-radius: 8px; }
.sheet-empty { padding: 16px 8px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.sheet-sum { font-size: 14px; color: var(--muted); }
.sheet-done { min-width: 120px; }

/* ---------- Отчёты ---------- */
.ink { color: var(--ink); }
.back-link { display: inline-block; margin-bottom: 8px; font-size: 14px; text-decoration: none; }
.report-filters { align-items: center; }
.report-dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.report-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 40px 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.report-card:hover { border-color: var(--accent); }
.report-card:active { background: var(--accent-soft); }
.report-card-title { font-weight: 600; font-size: 16px; }
.report-card-title .tag { background: var(--line-soft); color: var(--muted); font-weight: 500; margin-left: 4px; vertical-align: 1px; }
.report-card-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }
.report-card-kpis { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.report-card-kpis small { display: block; font-size: 12px; color: var(--muted); }
.report-card-kpis b { font-size: 17px; }
.report-card-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--muted); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.report-head h2 { margin: 0 0 4px; }
.report-head p { margin: 0; }
.report-period { margin: -6px 0 14px; font-size: 14px; }
.report-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.report-kpis .kpi { padding: 12px 16px; }
.report-kpis .kpi b { font-size: 20px; overflow-wrap: anywhere; }
.rtable td.num, .rtable th.right { white-space: nowrap; }
.rtable .neg { color: var(--danger); }
.rtable .pos { color: var(--ok); }
.rtable tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.report-note { margin-top: 12px; max-width: 760px; }

@media (max-width: 720px) {
  .report-grid { grid-template-columns: 1fr; gap: 10px; }
  .report-bar .btn, .report-head .btn { width: 100%; justify-content: center; }
  .report-dates { width: 100%; }
  .report-dates input[type=date] { flex: 1; min-width: 0; }
  .report-dates .btn { width: 100%; }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .report-kpis .kpi { padding: 10px 12px; }
  .report-kpis .kpi b { font-size: 17px; }
  /* Таблица отчёта на телефоне — карточки: подпись слева, значение справа */
  .rtable { background: none; border: 0; padding: 0; overflow: visible; }
  .rtable table, .rtable tbody, .rtable tfoot, .rtable tr { display: block; width: 100%; }
  .rtable thead { display: none; }
  .rtable tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 10px; }
  .rtable td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0 !important;
    padding: 5px 0; text-align: right !important; white-space: normal !important; overflow-wrap: anywhere; }
  .rtable td::before { content: attr(data-label); flex: 0 0 auto; max-width: 55%; text-align: left; font-size: 13px; color: var(--muted); font-weight: 400; }
  .rtable td:first-child { display: block; text-align: left !important; font-weight: 600; font-size: 16px; padding-bottom: 6px;
    border-bottom: 1px solid var(--line-soft) !important; margin-bottom: 2px; }
  .rtable td:first-child::before { display: none; }
  .rtable td:empty { display: none; }
  .rtable tfoot tr { background: var(--accent-soft); border-color: var(--accent-soft); }
  .rtable tfoot td { border-top: 0; }
  .rtable tfoot td.empty { display: none; }
  /* Сводка: одна строка на показатель, прошлый период — мелко под ней */
  .rtable-compact tbody { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px; }
  .rtable-compact tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; border: 0; border-radius: 0;
    padding: 10px 0; margin: 0; background: none; border-bottom: 1px solid var(--line-soft); }
  .rtable-compact tr:last-child { border-bottom: 0; }
  .rtable-compact td:first-child { font-size: 15px; font-weight: 400; padding: 0; border: 0 !important; margin: 0; }
  .rtable-compact td:nth-child(2) { display: block; padding: 0; font-weight: 700; font-size: 16px; }
  .rtable-compact td:nth-child(2)::before { display: none; }
  .rtable-compact td:nth-child(n+3) { grid-column: 1 / -1; display: inline; padding: 2px 0 0; font-size: 13px; color: var(--muted); text-align: left !important; }
  .rtable-compact td:nth-child(n+3)::before { display: inline; font-size: 13px; margin-right: 6px; }
  .rtable-compact td:nth-child(3) { grid-row: 2; grid-column: 1; }
  .rtable-compact td:nth-child(4) { grid-row: 2; grid-column: 2; text-align: right !important; }
  .rtable-compact td:nth-child(4)::before { display: none; }
  .rtable-compact td.pos { color: var(--ok); } .rtable-compact td.neg { color: var(--danger); }
}
